From f5754ed2d36cfb2784aa33e6c9f26daa67822f32 Mon Sep 17 00:00:00 2001 From: David Adegoke <64401859+Blazebrain@users.noreply.github.com> Date: Wed, 24 Dec 2025 04:24:23 +0100 Subject: [PATCH] fix: Minor fixes - Solana (#2737) * fix: Minor fixes * refactor: handle updates to connectivity status for swipe to send button * fix: Remove Future.wait --- cw_solana/lib/solana_client.dart | 2 +- cw_solana/lib/solana_wallet.dart | 5 +- .../screens/dashboard/pages/address_page.dart | 12 ++--- lib/src/screens/send/send_page.dart | 52 ++++++++++--------- .../widgets/standard_slide_button_widget.dart | 2 +- lib/view_model/send/send_view_model.dart | 8 +++ 6 files changed, 46 insertions(+), 35 deletions(-) diff --git a/cw_solana/lib/solana_client.dart b/cw_solana/lib/solana_client.dart index 4360086d8..c4069c266 100644 --- a/cw_solana/lib/solana_client.dart +++ b/cw_solana/lib/solana_client.dart @@ -458,7 +458,7 @@ class SolanaWalletClient { } if (i + batchSize < signatures.length) { - await Future.delayed(const Duration(milliseconds: 300)); + await Future.delayed(const Duration(milliseconds: 100)); } } diff --git a/cw_solana/lib/solana_wallet.dart b/cw_solana/lib/solana_wallet.dart index 8bb094ea7..68e2d4be6 100644 --- a/cw_solana/lib/solana_wallet.dart +++ b/cw_solana/lib/solana_wallet.dart @@ -145,6 +145,7 @@ abstract class SolanaWalletBase await walletAddresses.init(); await transactionHistory.init(); + await save(); } @@ -227,8 +228,8 @@ abstract class SolanaWalletBase await _updateBalance(); final transactionCurrency = balance.keys.firstWhere( - (currency) => - currency.title == credentials.currency.title && + (currency) => + currency.title == credentials.currency.title && currency.tag == credentials.currency.tag, orElse: () => throw Exception( 'Currency ${credentials.currency.title} ${credentials.currency.tag} is not accessible in the wallet, try to enable it first.')); diff --git a/lib/src/screens/dashboard/pages/address_page.dart b/lib/src/screens/dashboard/pages/address_page.dart index c7e5c8793..20b1b9157 100644 --- a/lib/src/screens/dashboard/pages/address_page.dart +++ b/lib/src/screens/dashboard/pages/address_page.dart @@ -144,13 +144,11 @@ class AddressPage extends BasePage { child: Column( children: [ Expanded( - child: Observer( - builder: (_) => QRWidget( - formKey: _formKey, - addressListViewModel: addressListViewModel, - amountTextFieldFocusNode: _cryptoAmountFocus, - amountController: _amountController, - ), + child: QRWidget( + formKey: _formKey, + addressListViewModel: addressListViewModel, + amountTextFieldFocusNode: _cryptoAmountFocus, + amountController: _amountController, ), ), SizedBox(height: 16), diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index 09f9fc681..68e59f5d7 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -576,30 +576,34 @@ class SendPage extends BasePage { isDismissible: false, isScrollControlled: true, builder: (BuildContext bottomSheetContext) { - return ConfirmSendingBottomSheet( - key: ValueKey('send_page_confirm_sending_bottom_sheet_key'), - titleText: S.of(bottomSheetContext).confirm_transaction, - accessibleNavigationModeSlideActionButtonText: S.of(bottomSheetContext).send, - footerType: FooterType.slideActionButton, - isSlideActionEnabled: sendViewModel.isReadyForSend, - walletType: sendViewModel.walletType, - titleIconPath: sendViewModel.selectedCryptoCurrency.iconPath, - currency: sendViewModel.selectedCryptoCurrency, - amount: S.of(bottomSheetContext).send_amount, - amountValue: sendViewModel.pendingTransaction!.amountFormatted, - fiatAmountValue: sendViewModel.pendingTransactionFiatAmountFormatted, - fee: isEVMCompatibleChain(sendViewModel.walletType) - ? S.of(bottomSheetContext).send_estimated_fee - : S.of(bottomSheetContext).send_fee, - feeValue: sendViewModel.pendingTransaction!.feeFormatted, - feeFiatAmount: sendViewModel.pendingTransactionFeeFiatAmountFormatted, - outputs: sendViewModel.outputs, - onSlideActionComplete: () async { - Navigator.of(bottomSheetContext).pop(true); - sendViewModel.commitTransaction(context); - }, - change: sendViewModel.pendingTransaction!.change, - isOpenCryptoPay: sendViewModel.ocpRequest != null, + return Observer( + builder: (_) => ConfirmSendingBottomSheet( + key: ValueKey('send_page_confirm_sending_bottom_sheet_key'), + titleText: S.of(bottomSheetContext).confirm_transaction, + accessibleNavigationModeSlideActionButtonText: + S.of(bottomSheetContext).send, + footerType: FooterType.slideActionButton, + isSlideActionEnabled: sendViewModel.isReadyForSend, + walletType: sendViewModel.walletType, + titleIconPath: sendViewModel.selectedCryptoCurrency.iconPath, + currency: sendViewModel.selectedCryptoCurrency, + amount: S.of(bottomSheetContext).send_amount, + amountValue: sendViewModel.pendingTransaction!.amountFormatted, + fiatAmountValue: sendViewModel.pendingTransactionFiatAmountFormatted, + fee: isEVMCompatibleChain(sendViewModel.walletType) + ? S.of(bottomSheetContext).send_estimated_fee + : S.of(bottomSheetContext).send_fee, + feeValue: sendViewModel.pendingTransaction!.feeFormatted, + feeFiatAmount: + sendViewModel.pendingTransactionFeeFiatAmountFormatted, + outputs: sendViewModel.outputs, + onSlideActionComplete: () async { + Navigator.of(bottomSheetContext).pop(true); + sendViewModel.commitTransaction(context); + }, + change: sendViewModel.pendingTransaction!.change, + isOpenCryptoPay: sendViewModel.ocpRequest != null, + ), ); }, ); diff --git a/lib/src/widgets/standard_slide_button_widget.dart b/lib/src/widgets/standard_slide_button_widget.dart index 3f6b9ad59..5a7c019c9 100644 --- a/lib/src/widgets/standard_slide_button_widget.dart +++ b/lib/src/widgets/standard_slide_button_widget.dart @@ -113,7 +113,7 @@ class StandardSlideButtonState extends State { child: Icon( key: ValueKey('standard_slide_button_widget_slider_icon_key'), Icons.arrow_forward, - color: Theme.of(context).colorScheme.onSurface, + color: widget.isDisabled ? Theme.of(context).colorScheme.onSurface.withOpacity(0.2) : Theme.of(context).colorScheme.onSurface, ), ), ), diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index 24f71cac4..bdfb76cde 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -1053,6 +1053,14 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor return S.current.solana_invalid_data_message; } + if (errorMessage.contains('Blockhash not found') || + errorMessage.contains('BlockhashNotFound') || + errorMessage.contains('BlockhashMNotFound')) { + return 'Transaction failed because its recent blockhash expired. ' + 'Please retry your send; if this keeps happening, try again in ' + 'a few seconds or switch to a different Solana node.'; + } + return errorMessage; } if (walletType == WalletType.ethereum ||