mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
clean up missing balance change issues
This commit is contained in:
parent
c83a0ec2a4
commit
32f9fc51e1
4 changed files with 18 additions and 9 deletions
|
@ -87,10 +87,6 @@ Future<void> migrateWalletsToIsar({
|
|||
//
|
||||
Map<String, dynamic> otherData = {};
|
||||
|
||||
otherData[WalletInfoKeys.cachedSecondaryBalance] = walletBox.get(
|
||||
DBKeys.cachedBalanceSecondary,
|
||||
) as String?;
|
||||
|
||||
otherData[WalletInfoKeys.tokenContractAddresses] = walletBox.get(
|
||||
DBKeys.ethTokenContracts,
|
||||
) as List<String>?;
|
||||
|
@ -132,6 +128,9 @@ Future<void> migrateWalletsToIsar({
|
|||
cachedBalanceString: walletBox.get(
|
||||
DBKeys.cachedBalance,
|
||||
) as String?,
|
||||
cachedBalanceSecondaryString: walletBox.get(
|
||||
DBKeys.cachedBalanceSecondary,
|
||||
) as String?,
|
||||
otherDataJsonString: jsonEncode(otherData),
|
||||
);
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
|||
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<DesktopSend> {
|
|||
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<DesktopSend> {
|
|||
// .toStringAsFixed(coin.decimals);
|
||||
} else {
|
||||
cryptoAmountController.text = info
|
||||
.cachedSecondaryBalance.spendable.decimal
|
||||
.cachedBalanceSecondary.spendable.decimal
|
||||
.toStringAsFixed(coin.decimals);
|
||||
// cryptoAmountController.text = firoWallet
|
||||
// .availablePublicBalance()
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -44,7 +44,14 @@ final pWalletBalance = Provider.family<Balance, String>(
|
|||
final pWalletBalanceSecondary = Provider.family<Balance, String>(
|
||||
(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<Balance, String>(
|
||||
(ref, walletId) {
|
||||
return ref.watch(_wiProvider(walletId)
|
||||
.select((value) => (value.value as WalletInfo).cachedBalanceTertiary));
|
||||
},
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue