fix(@desktop/wallet): keycard accounts do not display a keycard icon in the wallet list of accounts
Closes: #10643
This commit is contained in:
parent
38ce51e4bb
commit
1d41590d56
|
@ -36,16 +36,19 @@ proc init*(self: Controller) =
|
|||
proc getWalletAccount*(self: Controller, accountIndex: int): wallet_account_service.WalletAccountDto =
|
||||
return self.walletAccountService.getWalletAccount(accountIndex)
|
||||
|
||||
proc isKeycardAccount*(self: Controller, account: WalletAccountDto): bool =
|
||||
return self.walletAccountService.isKeycardAccount(account)
|
||||
|
||||
proc getIndex*(self: Controller, address: string): int =
|
||||
return self.walletAccountService.getIndex(address)
|
||||
|
||||
proc findTokenSymbolByAddress*(self: Controller, address: string): string =
|
||||
return self.walletAccountService.findTokenSymbolByAddress(address)
|
||||
|
||||
proc getChainIds*(self: Controller): seq[int] =
|
||||
proc getChainIds*(self: Controller): seq[int] =
|
||||
return self.networkService.getNetworks().map(n => n.chainId)
|
||||
|
||||
proc getEnabledChainIds*(self: Controller): seq[int] =
|
||||
proc getEnabledChainIds*(self: Controller): seq[int] =
|
||||
return self.networkService.getNetworks().filter(n => n.enabled).map(n => n.chainId)
|
||||
|
||||
proc getCurrentCurrency*(self: Controller): string =
|
||||
|
|
|
@ -54,13 +54,16 @@ proc setAssets(self: Module, tokens: seq[WalletTokenDto]) =
|
|||
let currencyFormat = self.controller.getCurrencyFormat(currency)
|
||||
|
||||
let items = tokens.map(t => walletTokenToItem(t, chainIds, enabledChainIds, currency, currencyFormat, self.controller.getCurrencyFormat(t.symbol)))
|
||||
|
||||
|
||||
self.view.getAssetsModel().setItems(items)
|
||||
|
||||
proc switchAccount*(self: Module, accountIndex: int) =
|
||||
self.currentAccountIndex = accountIndex
|
||||
|
||||
let walletAccount = self.controller.getWalletAccount(accountIndex)
|
||||
if walletAccount.isNil:
|
||||
return
|
||||
let keycardAccount = self.controller.isKeycardAccount(walletAccount)
|
||||
let currency = self.controller.getCurrentCurrency()
|
||||
let enabledChainIds = self.controller.getEnabledChainIds()
|
||||
|
||||
|
@ -68,6 +71,7 @@ proc switchAccount*(self: Module, accountIndex: int) =
|
|||
|
||||
let accountItem = walletAccountToWalletAccountsItem(
|
||||
walletAccount,
|
||||
keycardAccount,
|
||||
enabledChainIds,
|
||||
currency,
|
||||
currencyFormat,
|
||||
|
@ -100,7 +104,7 @@ method isLoaded*(self: Module): bool =
|
|||
|
||||
method viewDidLoad*(self: Module) =
|
||||
self.moduleLoaded = true
|
||||
|
||||
|
||||
method switchAccountByAddress*(self: Module, address: string) =
|
||||
let accountIndex = self.controller.getIndex(address)
|
||||
self.switchAccount(accountIndex)
|
||||
|
|
|
@ -34,5 +34,8 @@ proc deleteAccount*(self: Controller, address: string) =
|
|||
proc getKeycardByKeyUid*(self: Controller, keyUid: string): seq[KeycardDto] =
|
||||
return self.walletAccountService.getKeycardByKeyUid(keyUid)
|
||||
|
||||
proc isKeycardAccount*(self: Controller, account: WalletAccountDto): bool =
|
||||
return self.walletAccountService.isKeycardAccount(account)
|
||||
|
||||
proc getWalletAccount*(self: Controller, address: string): WalletAccountDto =
|
||||
return self.walletAccountService.getAccountByAddress(address)
|
|
@ -17,6 +17,7 @@ proc initItem*(
|
|||
emoji: string = "",
|
||||
relatedAccounts: related_accounts_model.Model = nil,
|
||||
keyUid: string = "",
|
||||
keycardAccount: bool = false
|
||||
): Item =
|
||||
result = Item()
|
||||
result.WalletAccountItem.setup(name,
|
||||
|
@ -25,9 +26,10 @@ proc initItem*(
|
|||
emoji,
|
||||
walletType,
|
||||
path,
|
||||
keyUid)
|
||||
keyUid,
|
||||
keycardAccount)
|
||||
result.relatedAccounts = relatedAccounts
|
||||
|
||||
|
||||
proc `$`*(self: Item): string =
|
||||
result = "ProfileSection-Accounts-Item("
|
||||
result = result & $self.WalletAccountItem
|
||||
|
|
|
@ -48,7 +48,8 @@ method refreshWalletAccounts*(self: Module) =
|
|||
let walletAccounts = self.controller.getWalletAccounts()
|
||||
|
||||
let items = walletAccounts.map(w => (block:
|
||||
walletAccountToWalletSettingsAccountsItem(w)
|
||||
let keycardAccount = self.controller.isKeycardAccount(w)
|
||||
walletAccountToWalletSettingsAccountsItem(w, keycardAccount)
|
||||
))
|
||||
|
||||
self.view.setItems(items)
|
||||
|
@ -62,7 +63,8 @@ method load*(self: Module) =
|
|||
|
||||
self.events.on(SIGNAL_WALLET_ACCOUNT_UPDATED) do(e:Args):
|
||||
let args = WalletAccountUpdated(e)
|
||||
self.view.onUpdatedAccount(walletAccountToWalletSettingsAccountsItem(args.account))
|
||||
let keycardAccount = self.controller.isKeycardAccount(args.account)
|
||||
self.view.onUpdatedAccount(walletAccountToWalletSettingsAccountsItem(args.account, keycardAccount))
|
||||
|
||||
self.events.on(SIGNAL_NEW_KEYCARD_SET) do(e: Args):
|
||||
let args = KeycardActivityArgs(e)
|
||||
|
|
|
@ -35,10 +35,13 @@ proc init*(self: Controller) =
|
|||
proc getWalletAccounts*(self: Controller): seq[wallet_account_service.WalletAccountDto] =
|
||||
return self.walletAccountService.getWalletAccounts()
|
||||
|
||||
proc isKeycardAccount*(self: Controller, account: WalletAccountDto): bool =
|
||||
return self.walletAccountService.isKeycardAccount(account)
|
||||
|
||||
proc deleteAccount*(self: Controller, address: string) =
|
||||
self.walletAccountService.deleteAccount(address)
|
||||
|
||||
proc getEnabledChainIds*(self: Controller): seq[int] =
|
||||
proc getEnabledChainIds*(self: Controller): seq[int] =
|
||||
return self.networkService.getNetworks().filter(n => n.enabled).map(n => n.chainId)
|
||||
|
||||
proc getCurrentCurrency*(self: Controller): string =
|
||||
|
|
|
@ -18,6 +18,7 @@ proc initItem*(
|
|||
currencyBalance: CurrencyAmount = nil,
|
||||
emoji: string = "",
|
||||
keyUid: string = "",
|
||||
keycardAccount: bool = false,
|
||||
assetsLoading: bool = true,
|
||||
): Item =
|
||||
result = Item()
|
||||
|
@ -27,17 +28,18 @@ proc initItem*(
|
|||
emoji,
|
||||
walletType,
|
||||
path,
|
||||
keyUid)
|
||||
keyUid,
|
||||
keycardAccount)
|
||||
result.assetsLoading = assetsLoading
|
||||
result.currencyBalance = currencyBalance
|
||||
|
||||
|
||||
proc `$`*(self: Item): string =
|
||||
result = "WalletSection-Accounts-Item("
|
||||
result = result & $self.WalletAccountItem
|
||||
result = result & "\nassetsLoading: " & $self.assetsLoading
|
||||
result = result & "\ncurrencyBalance: " & $self.currencyBalance
|
||||
result = result & ")"
|
||||
|
||||
|
||||
proc currencyBalance*(self: Item): CurrencyAmount =
|
||||
return self.currencyBalance
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ type
|
|||
CurrencyBalance,
|
||||
Emoji,
|
||||
KeyUid,
|
||||
KeycardAccount,
|
||||
AssetsLoading,
|
||||
|
||||
QtObject:
|
||||
|
@ -59,6 +60,7 @@ QtObject:
|
|||
ModelRole.CurrencyBalance.int:"currencyBalance",
|
||||
ModelRole.Emoji.int: "emoji",
|
||||
ModelRole.KeyUid.int: "keyUid",
|
||||
ModelRole.KeycardAccount.int: "keycardAccount",
|
||||
ModelRole.AssetsLoading.int: "assetsLoading",
|
||||
}.toTable
|
||||
|
||||
|
@ -99,6 +101,8 @@ QtObject:
|
|||
result = newQVariant(item.emoji())
|
||||
of ModelRole.KeyUid:
|
||||
result = newQVariant(item.keyUid())
|
||||
of ModelRole.KeycardAccount:
|
||||
result = newQVariant(item.keycardAccount())
|
||||
of ModelRole.AssetsLoading:
|
||||
result = newQVariant(item.assetsLoading())
|
||||
|
||||
|
|
|
@ -49,8 +49,10 @@ method refreshWalletAccounts*(self: Module) =
|
|||
let currencyFormat = self.controller.getCurrencyFormat(currency)
|
||||
|
||||
let items = walletAccounts.map(w => (block:
|
||||
let keycardAccount = self.controller.isKeycardAccount(w)
|
||||
walletAccountToWalletAccountsItem(
|
||||
w,
|
||||
keycardAccount,
|
||||
enabledChainIds,
|
||||
currency,
|
||||
currencyFormat,
|
||||
|
|
|
@ -26,7 +26,8 @@ QtObject:
|
|||
emoji,
|
||||
walletType,
|
||||
path = "",
|
||||
keyUid = "")
|
||||
keyUid = "",
|
||||
keycardAccount = false)
|
||||
self.assets = assets
|
||||
self.currencyBalance = currencyBalance
|
||||
|
||||
|
@ -44,7 +45,7 @@ QtObject:
|
|||
): AccountItem =
|
||||
new(result, delete)
|
||||
result.setup(name, address, color, emoji, walletType, assets, currencyBalance)
|
||||
|
||||
|
||||
proc `$`*(self: AccountItem): string =
|
||||
result = "WalletSection-Send-Item("
|
||||
result = result & $self.WalletAccountItem
|
||||
|
|
|
@ -33,7 +33,8 @@ proc walletAccountToRelatedAccountItem*(w: WalletAccountDto) : related_account_i
|
|||
w.emoji,
|
||||
)
|
||||
|
||||
proc walletAccountToWalletSettingsAccountsItem*(w: WalletAccountDto): wallet_settings_accounts_item.Item =
|
||||
proc walletAccountToWalletSettingsAccountsItem*(w: WalletAccountDto, keycardAccount: bool): wallet_settings_accounts_item.Item =
|
||||
discard
|
||||
let relatedAccounts = related_accounts_model.newModel()
|
||||
if w.isNil:
|
||||
return wallet_settings_accounts_item.initItem()
|
||||
|
@ -49,9 +50,10 @@ proc walletAccountToWalletSettingsAccountsItem*(w: WalletAccountDto): wallet_set
|
|||
w.emoji,
|
||||
relatedAccounts,
|
||||
w.keyUid,
|
||||
keycardAccount
|
||||
)
|
||||
|
||||
proc walletAccountToWalletAccountsItem*(w: WalletAccountDto, enabledChainIds: seq[int], currency: string,
|
||||
proc walletAccountToWalletAccountsItem*(w: WalletAccountDto, keycardAccount: bool, enabledChainIds: seq[int], currency: string,
|
||||
currencyFormat: CurrencyFormatDto): wallet_accounts_item.Item =
|
||||
return wallet_accounts_item.initItem(
|
||||
w.name,
|
||||
|
@ -62,6 +64,7 @@ proc walletAccountToWalletAccountsItem*(w: WalletAccountDto, enabledChainIds: se
|
|||
currencyAmountToItem(w.getCurrencyBalance(enabledChainIds, currency), currencyFormat),
|
||||
w.emoji,
|
||||
w.keyUid,
|
||||
keycardAccount,
|
||||
w.assetsLoading,
|
||||
)
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ QtObject:
|
|||
walletType: string
|
||||
path: string
|
||||
keyUid: string
|
||||
keycardAccount: bool
|
||||
|
||||
proc setup*(self: WalletAccountItem,
|
||||
name: string = "",
|
||||
|
@ -17,7 +18,8 @@ QtObject:
|
|||
emoji: string = "",
|
||||
walletType: string = "",
|
||||
path: string = "",
|
||||
keyUid: string = ""
|
||||
keyUid: string = "",
|
||||
keycardAccount: bool = false
|
||||
) =
|
||||
self.QObject.setup
|
||||
self.name = name
|
||||
|
@ -27,6 +29,7 @@ QtObject:
|
|||
self.walletType = walletType
|
||||
self.path = path
|
||||
self.keyUid = keyUid
|
||||
self.keycardAccount = keycardAccount
|
||||
|
||||
proc delete*(self: WalletAccountItem) =
|
||||
self.QObject.delete
|
||||
|
@ -40,6 +43,7 @@ QtObject:
|
|||
walletType: {self.walletType},
|
||||
path: {self.path},
|
||||
keyUid: {self.keyUid},
|
||||
keycardAccount: {self.keycardAccount},
|
||||
]"""
|
||||
|
||||
proc nameChanged*(self: WalletAccountItem) {.signal.}
|
||||
|
@ -103,4 +107,11 @@ QtObject:
|
|||
read = keyUid
|
||||
notify = keyUidChanged
|
||||
|
||||
proc keycardAccountChanged*(self: WalletAccountItem) {.signal.}
|
||||
proc keycardAccount*(self: WalletAccountItem): bool {.slot.} =
|
||||
return self.keycardAccount
|
||||
QtProperty[bool] keycardAccount:
|
||||
read = keycardAccount
|
||||
notify = keycardAccountChanged
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ proc priorityTokenCmp(a, b: WalletTokenDto): int =
|
|||
return -1
|
||||
if b.symbol == symbol:
|
||||
return 1
|
||||
|
||||
|
||||
cmp(a.name, b.name)
|
||||
|
||||
proc hex2Balance*(input: string, decimals: int): string =
|
||||
|
@ -84,7 +84,7 @@ type WalletAccountUpdated* = ref object of Args
|
|||
account*: WalletAccountDto
|
||||
|
||||
type DerivedAddressesArgs* = ref object of Args
|
||||
uniqueId*: string
|
||||
uniqueId*: string
|
||||
derivedAddresses*: seq[DerivedAddressDto]
|
||||
error*: string
|
||||
|
||||
|
@ -214,7 +214,7 @@ QtObject:
|
|||
if keypair.isNil:
|
||||
return
|
||||
account.relatedAccounts = keypair.accounts
|
||||
|
||||
|
||||
proc setRelatedAccountsForAllAccounts(self: Service, keyUid: string) =
|
||||
for wAcc in self.walletAccounts.mvalues:
|
||||
if wAcc.keyUid == keyUid:
|
||||
|
@ -224,7 +224,7 @@ QtObject:
|
|||
if updateRelatedAccounts:
|
||||
# updating related accounts for already added accounts
|
||||
self.setRelatedAccountsForAllAccounts(account.keyUid)
|
||||
# add new account to store
|
||||
# add new account to store
|
||||
self.walletAccounts[account.address] = account
|
||||
|
||||
proc storeTokensForAccount*(self: Service, address: string, tokens: seq[WalletTokenDto], areBalancesCached: bool, areMarketValuesCached: bool) =
|
||||
|
@ -284,7 +284,7 @@ QtObject:
|
|||
return
|
||||
result = self.walletAccounts[address]
|
||||
|
||||
proc getAccountsByAddresses*(self: Service, addresses: seq[string]): seq[WalletAccountDto] =
|
||||
proc getAccountsByAddresses*(self: Service, addresses: seq[string]): seq[WalletAccountDto] =
|
||||
for address in addresses:
|
||||
result.add(self.getAccountByAddress(address))
|
||||
|
||||
|
@ -428,18 +428,18 @@ QtObject:
|
|||
self.events.emit(SIGNAL_WALLET_ACCOUNT_UPDATED, WalletAccountUpdated(account: account))
|
||||
|
||||
## if password is not provided local keystore file won't be created
|
||||
proc addWalletAccount*(self: Service, password: string, doPasswordHashing: bool, name, address, path, publicKey,
|
||||
proc addWalletAccount*(self: Service, password: string, doPasswordHashing: bool, name, address, path, publicKey,
|
||||
keyUid, accountType, color, emoji: string): string =
|
||||
try:
|
||||
var response: RpcResponse[JsonNode]
|
||||
if password.len == 0:
|
||||
response = status_go_accounts.addAccountWithoutKeystoreFileCreation(name, address, path, publicKey, keyUid,
|
||||
response = status_go_accounts.addAccountWithoutKeystoreFileCreation(name, address, path, publicKey, keyUid,
|
||||
accountType, color, emoji)
|
||||
else:
|
||||
var finalPassword = password
|
||||
if doPasswordHashing:
|
||||
finalPassword = utils.hashPassword(password)
|
||||
response = status_go_accounts.addAccount(finalPassword, name, address, path, publicKey, keyUid, accountType,
|
||||
response = status_go_accounts.addAccount(finalPassword, name, address, path, publicKey, keyUid, accountType,
|
||||
color, emoji)
|
||||
if not response.error.isNil:
|
||||
error "status-go error", procName="addWalletAccount", errCode=response.error.code, errDesription=response.error.message
|
||||
|
@ -451,7 +451,7 @@ QtObject:
|
|||
return e.msg
|
||||
|
||||
## Mandatory fields for account: `address`, `keyUid`, `walletType`, `path`, `publicKey`, `name`, `emoji`, `color`
|
||||
proc addNewPrivateKeyKeypair*(self: Service, privateKey, password: string, doPasswordHashing: bool,
|
||||
proc addNewPrivateKeyKeypair*(self: Service, privateKey, password: string, doPasswordHashing: bool,
|
||||
keyUid, keypairName, rootWalletMasterKey: string, account: WalletAccountDto): string =
|
||||
if password.len == 0:
|
||||
error "for adding new private key account, password must be provided"
|
||||
|
@ -475,13 +475,13 @@ QtObject:
|
|||
return e.msg
|
||||
|
||||
## Mandatory fields for all accounts: `address`, `keyUid`, `walletType`, `path`, `publicKey`, `name`, `emoji`, `color`
|
||||
proc addNewSeedPhraseKeypair*(self: Service, seedPhrase, password: string, doPasswordHashing: bool,
|
||||
proc addNewSeedPhraseKeypair*(self: Service, seedPhrase, password: string, doPasswordHashing: bool,
|
||||
keyUid, keypairName, rootWalletMasterKey: string, accounts: seq[WalletAccountDto]): string =
|
||||
var finalPassword = password
|
||||
if password.len > 0 and doPasswordHashing:
|
||||
finalPassword = utils.hashPassword(password)
|
||||
try:
|
||||
if seedPhrase.len > 0 and password.len > 0:
|
||||
if seedPhrase.len > 0 and password.len > 0:
|
||||
let response = status_go_accounts.importMnemonic(seedPhrase, finalPassword)
|
||||
if not response.error.isNil:
|
||||
error "status-go error importing private key", procName="addNewSeedPhraseKeypair", errCode=response.error.code, errDesription=response.error.message
|
||||
|
@ -516,7 +516,7 @@ QtObject:
|
|||
return
|
||||
self.removeAccountFromLocalStoreAndNotify(address)
|
||||
except Exception as e:
|
||||
error "error: ", procName="deleteAccount", errName = e.name, errDesription = e.msg
|
||||
error "error: ", procName="deleteAccount", errName = e.name, errDesription = e.msg
|
||||
|
||||
proc getCurrency*(self: Service): string =
|
||||
return self.settingsService.getCurrency()
|
||||
|
@ -542,7 +542,7 @@ QtObject:
|
|||
return false
|
||||
try:
|
||||
var account = self.getAccountByAddress(address)
|
||||
let response = status_go_accounts.updateAccount(accountName, account.address, account.path, account.publicKey,
|
||||
let response = status_go_accounts.updateAccount(accountName, account.address, account.path, account.publicKey,
|
||||
account.keyUid, account.walletType, color, emoji, account.isWallet, account.isChat)
|
||||
if not response.error.isNil:
|
||||
error "status-go error", procName="updateWalletAccount", errCode=response.error.code, errDesription=response.error.message
|
||||
|
@ -697,7 +697,7 @@ QtObject:
|
|||
let accounts = self.getWalletAccounts()
|
||||
for walletAccount in accounts:
|
||||
result += walletAccount.getCurrencyBalance(@[network.chainId], self.getCurrentCurrencyIfEmpty(currency))
|
||||
|
||||
|
||||
proc findTokenSymbolByAddress*(self: Service, address: string): string =
|
||||
return self.tokenService.findTokenSymbolByAddress(address)
|
||||
|
||||
|
@ -736,7 +736,7 @@ QtObject:
|
|||
|
||||
proc emitAddKeycardAddAccountsChange(self: Service, success: bool, keycard: KeycardDto) =
|
||||
let data = KeycardActivityArgs(
|
||||
success: success,
|
||||
success: success,
|
||||
keycard: keycard
|
||||
)
|
||||
self.events.emit(SIGNAL_NEW_KEYCARD_SET, data)
|
||||
|
@ -780,10 +780,10 @@ QtObject:
|
|||
)
|
||||
self.threadpool.start(arg)
|
||||
|
||||
proc emitKeycardRemovedAccountsChange(self: Service, success: bool, keyUid: string, keycardUid: string,
|
||||
proc emitKeycardRemovedAccountsChange(self: Service, success: bool, keyUid: string, keycardUid: string,
|
||||
removedAccounts: seq[string]) =
|
||||
let data = KeycardActivityArgs(
|
||||
success: success,
|
||||
success: success,
|
||||
keycard: KeycardDto(keyUid: keyUid, keycardUid: keycardUid, accountsAddresses: removedAccounts)
|
||||
)
|
||||
self.events.emit(SIGNAL_KEYCARD_ACCOUNTS_REMOVED, data)
|
||||
|
@ -803,7 +803,7 @@ QtObject:
|
|||
error "error handilng migrated keycard response", errDesription=e.msg
|
||||
self.emitKeycardRemovedAccountsChange(success = false, keyUid = "", keycardUid = "", removedAccounts = @[])
|
||||
|
||||
proc getAllKnownKeycards*(self: Service): seq[KeycardDto] =
|
||||
proc getAllKnownKeycards*(self: Service): seq[KeycardDto] =
|
||||
try:
|
||||
let response = backend.getAllKnownKeycards()
|
||||
if responseHasNoErrors("getAllKnownKeycards", response):
|
||||
|
@ -811,7 +811,7 @@ QtObject:
|
|||
except Exception as e:
|
||||
error "error: ", procName="getAllKnownKeycards", errName = e.name, errDesription = e.msg
|
||||
|
||||
proc getKeycardWithKeycardUid*(self: Service, keycardUid: string): KeycardDto =
|
||||
proc getKeycardWithKeycardUid*(self: Service, keycardUid: string): KeycardDto =
|
||||
let allKnownKeycards = self.getAllKnownKeycards()
|
||||
let keycardsWithKeycardUid = allKnownKeycards.filter(kp => kp.keycardUid == keycardUid)
|
||||
if keycardsWithKeycardUid.len == 0:
|
||||
|
@ -821,7 +821,7 @@ QtObject:
|
|||
return
|
||||
return keycardsWithKeycardUid[0]
|
||||
|
||||
proc getAllKnownKeycardsGroupedByKeyUid*(self: Service): seq[KeycardDto] =
|
||||
proc getAllKnownKeycardsGroupedByKeyUid*(self: Service): seq[KeycardDto] =
|
||||
try:
|
||||
let response = backend.getAllKnownKeycardsGroupedByKeyUid()
|
||||
if responseHasNoErrors("getAllKnownKeycardsGroupedByKeyUid", response):
|
||||
|
@ -829,7 +829,7 @@ QtObject:
|
|||
except Exception as e:
|
||||
error "error: ", procName="getAllKnownKeycardsGroupedByKeyUid", errName = e.name, errDesription = e.msg
|
||||
|
||||
proc getKeycardByKeyUid*(self: Service, keyUid: string): seq[KeycardDto] =
|
||||
proc getKeycardByKeyUid*(self: Service, keyUid: string): seq[KeycardDto] =
|
||||
try:
|
||||
let response = backend.getKeycardByKeyUid(keyUid)
|
||||
if responseHasNoErrors("getKeycardByKeyUid", response):
|
||||
|
@ -837,6 +837,15 @@ QtObject:
|
|||
except Exception as e:
|
||||
error "error: ", procName="getKeycardByKeyUid", errName = e.name, errDesription = e.msg
|
||||
|
||||
proc isKeycardAccount*(self: Service, account: WalletAccountDto): bool =
|
||||
if account.isNil or
|
||||
account.keyUid.len == 0 or
|
||||
account.path.len == 0 or
|
||||
utils.isPathOutOfTheDefaultStatusDerivationTree(account.path):
|
||||
return false
|
||||
let keycards = self.getKeycardByKeyUid(account.keyUid)
|
||||
return keycards.len > 0
|
||||
|
||||
proc emitKeycardNameChange(self: Service, keycardUid: string, name: string) =
|
||||
let data = KeycardActivityArgs(success: true, keycard: KeycardDto(keycardUid: keycardUid, keycardName: name))
|
||||
self.events.emit(SIGNAL_KEYCARD_NAME_CHANGED, data)
|
||||
|
@ -914,7 +923,7 @@ QtObject:
|
|||
|
||||
proc handleKeycardActions(self: Service, keycardActions: seq[KeycardActionDto]) =
|
||||
if keycardActions.len == 0:
|
||||
return
|
||||
return
|
||||
for kcAction in keycardActions:
|
||||
if kcAction.action == KeycardActionKeycardAdded or
|
||||
kcAction.action == KeycardActionAccountsAdded:
|
||||
|
@ -951,4 +960,4 @@ QtObject:
|
|||
if token.symbol == symbol:
|
||||
totalTokenBalance += token.getTotalBalanceOfSupportedChains()
|
||||
|
||||
return totalTokenBalance
|
||||
return totalTokenBalance
|
||||
|
|
|
@ -238,7 +238,7 @@ Rectangle {
|
|||
width: !!icon ? 15: 0
|
||||
height: !!icon ? 15: 0
|
||||
color: Theme.palette.directColor1
|
||||
icon: model.migratedToKeycard ? "keycard" : ""
|
||||
icon: model.keycardAccount ? "keycard" : ""
|
||||
}
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in New Issue