fix(@wallet): fix all accounts balance

in case we add a new account the balance needs to be based on all
accounts all the time

fixes #11103
This commit is contained in:
Anthony Laibe 2023-06-15 12:33:27 +02:00 committed by Anthony Laibe
parent 10e5c714a2
commit d534bf6773

View File

@ -1,4 +1,4 @@
import NimQml, chronicles
import NimQml, chronicles, sequtils, sugar
import ./controller, ./view, ./filter
import ./io_interface as io_interface
@ -130,7 +130,14 @@ method getCurrentCurrency*(self: Module): string =
self.controller.getCurrency()
method setTotalCurrencyBalance*(self: Module) =
self.view.setTotalCurrencyBalance(self.controller.getCurrencyBalance(self.filter.addresses))
var addresses: seq[string] = @[]
let walletAccounts = self.controller.getWalletAccounts()
if self.filter.excludeWatchOnly:
addresses = walletAccounts.filter(a => a.walletType != "watch").map(a => a.address)
else:
addresses = walletAccounts.map(a => a.address)
self.view.setTotalCurrencyBalance(self.controller.getCurrencyBalance(addresses))
method notifyFilterChanged(self: Module) =
self.overviewModule.filterChanged(self.filter.addresses, self.filter.chainIds, self.filter.excludeWatchOnly, self.filter.allAddresses)