diff --git a/lib/src/screens/send/widgets/send_card.dart b/lib/src/screens/send/widgets/send_card.dart index 836e80fa1..c12f0c1b0 100644 --- a/lib/src/screens/send/widgets/send_card.dart +++ b/lib/src/screens/send/widgets/send_card.dart @@ -3,10 +3,10 @@ import 'dart:async'; import 'package:cake_wallet/core/open_crypto_pay/open_cryptopay_service.dart'; import 'package:cake_wallet/entities/priority_for_wallet_type.dart'; import 'package:cake_wallet/src/screens/receive/widgets/currency_input_field.dart'; -import 'package:cake_wallet/src/widgets/bottom_sheet/info_bottom_sheet_widget.dart'; import 'package:cake_wallet/src/widgets/bottom_sheet/payment_confirmation_bottom_sheet.dart'; import 'package:cake_wallet/src/widgets/bottom_sheet/wallet_switcher_bottom_sheet.dart'; import 'package:cake_wallet/src/widgets/bottom_sheet/swap_confirmation_bottom_sheet.dart'; +import 'package:cake_wallet/src/widgets/bottom_sheet/info_bottom_sheet_widget.dart'; import 'package:cake_wallet/src/widgets/picker.dart'; import 'package:cake_wallet/src/widgets/standard_checkbox.dart'; import 'package:cake_wallet/src/screens/exchange/widgets/currency_picker.dart'; @@ -776,6 +776,12 @@ class SendCardState extends State with AutomaticKeepAliveClientMixin sendViewModel.isReadyForSend, (bool isReadyForSend) { + if (isReadyForSend) { + sendViewModel.updateSendingBalance(); + } + }); + _effectsInstalled = true; } diff --git a/lib/view_model/send/output.dart b/lib/view_model/send/output.dart index 9c80cadd8..9a9aa462b 100644 --- a/lib/view_model/send/output.dart +++ b/lib/view_model/send/output.dart @@ -118,7 +118,8 @@ abstract class OutputBase with Store { _amount = wownero!.formatterWowneroParseAmount(amount: _cryptoAmount); break; case WalletType.zano: - _amount = zano!.formatterParseAmount(amount: _cryptoAmount, currency: cryptoCurrencyHandler()); + _amount = zano! + .formatterParseAmount(amount: _cryptoAmount, currency: cryptoCurrencyHandler()); break; case WalletType.none: case WalletType.haven: @@ -143,6 +144,9 @@ abstract class OutputBase with Store { @computed double get estimatedFee { try { + // forces mobx to rebuild the computed value + final _ = _wallet.syncStatus; + if (_wallet.type == WalletType.tron) { if (cryptoCurrencyHandler() == CryptoCurrency.trx) { final nativeEstimatedFee = tron!.getTronNativeEstimatedFee(_wallet) ?? 0; @@ -170,7 +174,8 @@ abstract class OutputBase with Store { return bitcoin!.formatterBitcoinAmountToDouble(amount: fee); } - if (_wallet.type == WalletType.litecoin || _wallet.type == WalletType.bitcoinCash || + if (_wallet.type == WalletType.litecoin || + _wallet.type == WalletType.bitcoinCash || _wallet.type == WalletType.dogecoin) { return bitcoin!.formatterBitcoinAmountToDouble(amount: fee); } @@ -192,7 +197,8 @@ abstract class OutputBase with Store { } if (_wallet.type == WalletType.zano) { - return zano!.formatterIntAmountToDouble(amount: fee, currency: cryptoCurrencyHandler(), forFee: true); + return zano!.formatterIntAmountToDouble( + amount: fee, currency: cryptoCurrencyHandler(), forFee: true); } if (_wallet.type == WalletType.decred) { @@ -207,6 +213,9 @@ abstract class OutputBase with Store { @computed String get estimatedFeeFiatAmount { + // forces mobx to rebuild the computed value + final _ = _wallet.syncStatus; + try { final currency = (isEVMCompatibleChain(_wallet.type) || _wallet.type == WalletType.solana || @@ -235,7 +244,8 @@ abstract class OutputBase with Store { } @action - void updateWallet(WalletBase, TransactionInfo> newWallet) { + void updateWallet( + WalletBase, TransactionInfo> newWallet) { _wallet = newWallet; _setCryptoNumMaximumFractionDigits(); } @@ -371,15 +381,15 @@ extension OutputCopyWith on Output { ); clone - ..cryptoAmount = cryptoAmount + ..cryptoAmount = cryptoAmount ..cryptoFullBalance = cryptoFullBalance - ..note = note - ..sendAll = sendAll - ..memo = memo - ..stealthAddress = stealthAddress - ..parsedAddress = parsedAddress ?? this.parsedAddress - ..fiatAmount = fiatAmount ?? this.fiatAmount; + ..note = note + ..sendAll = sendAll + ..memo = memo + ..stealthAddress = stealthAddress + ..parsedAddress = parsedAddress ?? this.parsedAddress + ..fiatAmount = fiatAmount ?? this.fiatAmount; return clone; } -} \ No newline at end of file +}