fix(@desktop/wallet): Add back code missing after a merge conflict with another PR

This commit is contained in:
Khushboo Mehta 2023-05-08 17:55:05 +02:00 committed by Khushboo-dev-cpp
parent 461f4a2bee
commit 399eb75eb0
4 changed files with 14 additions and 8 deletions

View File

@ -125,6 +125,7 @@ method notifyFilterChanged(self: Module) =
self.assetsModule.filterChanged(self.filter.addresses, self.filter.chainIds)
self.collectiblesModule.filterChanged(self.filter.addresses, self.filter.chainIds)
self.transactionsModule.filterChanged(self.filter.addresses, self.filter.chainIds)
self.sendModule.filterChanged(self.filter.addresses, self.filter.chainIds)
method getCurrencyAmount*(self: Module, amount: float64, symbol: string): CurrencyAmount =
return self.controller.getCurrencyAmount(amount, symbol)

View File

@ -57,11 +57,11 @@ method authenticateUser*(self: AccessInterface) {.base.} =
method onUserAuthenticated*(self: AccessInterface, pin: string, password: string, keyUid: string) {.base.} =
raise newException(ValueError, "No implementation available")
method switchAccount*(self: AccessInterface, accountIndex: int) =
raise newException(ValueError, "No implementation available")
method setSelectedSenderAccountIndex*(self: AccessInterface, index: int) =
raise newException(ValueError, "No implementation available")
method setSelectedReceiveAccountIndex*(self: AccessInterface, index: int) =
raise newException(ValueError, "No implementation available")
method filterChanged*(self: AccessInterface, addresses: seq[string], chainIds: seq[int]) =
raise newException(ValueError, "No implementation available")

View File

@ -195,11 +195,11 @@ method suggestedRoutesReady*(self: Module, suggestedRoutes: string) =
method getEstimatedTime*(self: Module, chainId: int, maxFeePerGas: string): int =
return self.controller.getEstimatedTime(chainId, maxFeePerGas).int
method switchAccount*(self: Module, accountIndex: int) =
var walletAccount = self.controller.getWalletAccountByIndex(accountIndex)
if not walletAccount.isNil:
self.view.switchSenderAccountByAddress(walletAccount.address)
self.view.switchReceiveAccount(accountIndex)
method filterChanged*(self: Module, addresses: seq[string], chainIds: seq[int]) =
if addresses.len == 0:
return
self.view.switchSenderAccountByAddress(addresses[0])
self.view.switchReceiveAccountByAddress(addresses[0])
method setSelectedSenderAccountIndex*(self: Module, index: int) =
self.senderCurrentAccountIndex = index

View File

@ -154,6 +154,11 @@ QtObject:
self.setSelectedSenderAccount(account)
self.delegate.setSelectedSenderAccountIndex(index)
proc switchReceiveAccountByAddress*(self: View, address: string) =
let (account, index) = self.accounts.getItemByAddress(address)
self.setSelectetReceiveAccount(account)
self.delegate.setSelectedReceiveAccountIndex(index)
proc switchSenderAccount*(self: View, index: int) {.slot.} =
self.setSelectedSenderAccount(self.senderAccounts.getItemByIndex(index))
self.delegate.setSelectedSenderAccountIndex(index)