From c47f3f2692bd1d6261ed8e8159ec556c4bba36ac Mon Sep 17 00:00:00 2001 From: Sale Djenic Date: Wed, 11 May 2022 13:15:01 +0200 Subject: [PATCH] feat(@desktop/wallet): redesigned wallet addresses are missing checksum Fixes #5473 --- .../wallet_section/current_account/view.nim | 60 ++++++++++++------- .../service/wallet_account/dto.nim | 2 + .../AppLayouts/Wallet/panels/WalletHeader.qml | 2 +- vendor/status-go | 2 +- 4 files changed, 43 insertions(+), 23 deletions(-) diff --git a/src/app/modules/main/wallet_section/current_account/view.nim b/src/app/modules/main/wallet_section/current_account/view.nim index bc1d42301f..1e11e03a26 100644 --- a/src/app/modules/main/wallet_section/current_account/view.nim +++ b/src/app/modules/main/wallet_section/current_account/view.nim @@ -11,6 +11,7 @@ QtObject: delegate: io_interface.AccessInterface name: string address: string + mixedcaseAddress: string path: string color: string publicKey: string @@ -45,13 +46,18 @@ QtObject: proc getAddress(self: View): QVariant {.slot.} = return newQVariant(self.address) - proc addressChanged(self: View) {.signal.} - QtProperty[QVariant] address: read = getAddress notify = addressChanged + proc getMixedcaseAddress(self: View): string {.slot.} = + return self.mixedcaseAddress + proc mixedcaseAddressChanged(self: View) {.signal.} + QtProperty[string] mixedcaseAddress: + read = getMixedcaseAddress + notify = mixedcaseAddressChanged + proc getPath(self: View): QVariant {.slot.} = return newQVariant(self.path) @@ -127,25 +133,37 @@ QtObject: proc update(self: View, address: string, accountName: string, color: string, emoji: string) {.slot.} = self.delegate.update(address, accountName, color, emoji) -proc setData*(self: View, dto: wallet_account_service.WalletAccountDto) = - self.name = dto.name - self.nameChanged() - self.address = dto.address - self.addressChanged() - self.path = dto.path - self.pathChanged() - self.color = dto.color - self.colorChanged() - self.publicKey = dto.publicKey - self.publicKeyChanged() - self.walletType = dto.walletType - self.walletTypeChanged() - self.isChat = dto.isChat - self.isChatChanged() - self.currencyBalance = dto.getCurrencyBalance() - self.currencyBalanceChanged() - self.emoji = dto.emoji - self.emojiChanged() + proc setData*(self: View, dto: wallet_account_service.WalletAccountDto) = + if(self.name != dto.name): + self.name = dto.name + self.nameChanged() + if(self.address != dto.address): + self.address = dto.address + self.addressChanged() + if(self.mixedcaseAddress != dto.mixedcaseAddress): + self.mixedcaseAddress = dto.mixedcaseAddress + self.mixedcaseAddressChanged() + if(self.path != dto.path): + self.path = dto.path + self.pathChanged() + if(self.color != dto.color): + self.color = dto.color + self.colorChanged() + if(self.publicKey != dto.publicKey): + self.publicKey = dto.publicKey + self.publicKeyChanged() + if(self.walletType != dto.walletType): + self.walletType = dto.walletType + self.walletTypeChanged() + if(self.isChat != dto.isChat): + self.isChat = dto.isChat + self.isChatChanged() + if(self.currencyBalance != dto.getCurrencyBalance()): + self.currencyBalance = dto.getCurrencyBalance() + self.currencyBalanceChanged() + if(self.emoji != dto.emoji): + self.emoji = dto.emoji + self.emojiChanged() let assets = token_model.newModel() diff --git a/src/app_service/service/wallet_account/dto.nim b/src/app_service/service/wallet_account/dto.nim index c5e91dfa15..263fdc5f1c 100644 --- a/src/app_service/service/wallet_account/dto.nim +++ b/src/app_service/service/wallet_account/dto.nim @@ -18,6 +18,7 @@ type WalletAccountDto* = ref object of RootObj name*: string address*: string + mixedcaseAddress*: string path*: string color*: string publicKey*: string @@ -57,6 +58,7 @@ proc toWalletAccountDto*(jsonObj: JsonNode): WalletAccountDto = result = WalletAccountDto() discard jsonObj.getProp("name", result.name) discard jsonObj.getProp("address", result.address) + discard jsonObj.getProp("mixedcase-address", result.mixedcaseAddress) discard jsonObj.getProp("path", result.path) discard jsonObj.getProp("color", result.color) discard jsonObj.getProp("wallet", result.isWallet) diff --git a/ui/app/AppLayouts/Wallet/panels/WalletHeader.qml b/ui/app/AppLayouts/Wallet/panels/WalletHeader.qml index 1cb0e699c9..87ec67623f 100644 --- a/ui/app/AppLayouts/Wallet/panels/WalletHeader.qml +++ b/ui/app/AppLayouts/Wallet/panels/WalletHeader.qml @@ -61,7 +61,7 @@ Item { StatusExpandableAddress { id: walletAddress - address: currentAccount.address + address: currentAccount.mixedcaseAddress anchors.top: title.bottom anchors.left: title.left addressWidth: 180 diff --git a/vendor/status-go b/vendor/status-go index cf8941c1d8..4018e4334b 160000 --- a/vendor/status-go +++ b/vendor/status-go @@ -1 +1 @@ -Subproject commit cf8941c1d816306e1e5b5c91c8d2ad41604bbd93 +Subproject commit 4018e4334beaaa5243a8a6e6450ecd5aeb3addef