diff --git a/lib/db/migrate_wallets_to_isar.dart b/lib/db/migrate_wallets_to_isar.dart index 3378c013b..9f46c274a 100644 --- a/lib/db/migrate_wallets_to_isar.dart +++ b/lib/db/migrate_wallets_to_isar.dart @@ -87,10 +87,6 @@ Future migrateWalletsToIsar({ // Map otherData = {}; - otherData[WalletInfoKeys.cachedSecondaryBalance] = walletBox.get( - DBKeys.cachedBalanceSecondary, - ) as String?; - otherData[WalletInfoKeys.tokenContractAddresses] = walletBox.get( DBKeys.ethTokenContracts, ) as List?; @@ -132,6 +128,9 @@ Future migrateWalletsToIsar({ cachedBalanceString: walletBox.get( DBKeys.cachedBalance, ) as String?, + cachedBalanceSecondaryString: walletBox.get( + DBKeys.cachedBalanceSecondary, + ) as String?, otherDataJsonString: jsonEncode(otherData), ); diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart index 2950fbaa1..60d31ef17 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart @@ -149,7 +149,7 @@ class _DesktopSendState extends ConsumerState { availableBalance = wallet.info.cachedBalance.spendable; // (manager.wallet as FiroWallet).availablePrivateBalance(); } else { - availableBalance = wallet.info.cachedSecondaryBalance.spendable; + availableBalance = wallet.info.cachedBalanceSecondary.spendable; // (manager.wallet as FiroWallet).availablePublicBalance(); } } else { @@ -556,7 +556,7 @@ class _DesktopSendState extends ConsumerState { balance = info.cachedBalance.spendable; // balance = wallet.availablePrivateBalance(); } else { - balance = info.cachedSecondaryBalance.spendable; + balance = info.cachedBalanceSecondary.spendable; // balance = wallet.availablePublicBalance(); } return ref.read(pAmountFormatter(coin)).format(balance); @@ -763,7 +763,7 @@ class _DesktopSendState extends ConsumerState { // .toStringAsFixed(coin.decimals); } else { cryptoAmountController.text = info - .cachedSecondaryBalance.spendable.decimal + .cachedBalanceSecondary.spendable.decimal .toStringAsFixed(coin.decimals); // cryptoAmountController.text = firoWallet // .availablePublicBalance() diff --git a/lib/wallets/isar/models/wallet_info.dart b/lib/wallets/isar/models/wallet_info.dart index d14944a1e..30e97d73c 100644 --- a/lib/wallets/isar/models/wallet_info.dart +++ b/lib/wallets/isar/models/wallet_info.dart @@ -320,6 +320,8 @@ class WalletInfo implements IsarId { int restoreHeight = 0, bool isMnemonicVerified = false, String? cachedBalanceString, + String? cachedBalanceSecondaryString, + String? cachedBalanceTertiaryString, String? otherDataJsonString, }) : assert( Coin.values.map((e) => e.name).contains(coinName), @@ -332,6 +334,8 @@ class WalletInfo implements IsarId { _restoreHeight = restoreHeight, _isMnemonicVerified = isMnemonicVerified, _cachedBalanceString = cachedBalanceString, + _cachedBalanceSecondaryString = cachedBalanceSecondaryString, + _cachedBalanceTertiaryString = cachedBalanceTertiaryString, _otherDataJsonString = otherDataJsonString; static WalletInfo createNew({ @@ -385,7 +389,6 @@ class WalletInfo implements IsarId { abstract class WalletInfoKeys { static const String tokenContractAddresses = "tokenContractAddressesKey"; - static const String cachedSecondaryBalance = "cachedSecondaryBalanceKey"; static const String epiccashData = "epiccashDataKey"; static const String bananoMonkeyImageBytes = "monkeyImageBytesKey"; } diff --git a/lib/wallets/isar/providers/wallet_info_provider.dart b/lib/wallets/isar/providers/wallet_info_provider.dart index d74cb399f..3cfeb1be2 100644 --- a/lib/wallets/isar/providers/wallet_info_provider.dart +++ b/lib/wallets/isar/providers/wallet_info_provider.dart @@ -44,7 +44,14 @@ final pWalletBalance = Provider.family( final pWalletBalanceSecondary = Provider.family( (ref, walletId) { return ref.watch(_wiProvider(walletId) - .select((value) => (value.value as WalletInfo).cachedSecondaryBalance)); + .select((value) => (value.value as WalletInfo).cachedBalanceSecondary)); + }, +); + +final pWalletBalanceTertiary = Provider.family( + (ref, walletId) { + return ref.watch(_wiProvider(walletId) + .select((value) => (value.value as WalletInfo).cachedBalanceTertiary)); }, );