From a6f61c595f98858a58b47cf61f798c309c0ecc7a Mon Sep 17 00:00:00 2001 From: David Adegoke <64401859+Blazebrain@users.noreply.github.com> Date: Thu, 19 Dec 2024 18:41:59 +0100 Subject: [PATCH 1/2] fix: Bug when building Monero.Com resulting from solana exceptions situated in send viewmodel from cw_solana package (#1893) --- cw_core/lib/exceptions.dart | 10 +++++++++- cw_solana/lib/solana_exceptions.dart | 16 +++++++++------- lib/view_model/send/send_view_model.dart | 9 ++++----- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/cw_core/lib/exceptions.dart b/cw_core/lib/exceptions.dart index 80bdd2886..cfd44f18f 100644 --- a/cw_core/lib/exceptions.dart +++ b/cw_core/lib/exceptions.dart @@ -27,7 +27,7 @@ class TransactionCommitFailed implements Exception { @override String toString() { - return errorMessage??"unknown error"; + return errorMessage ?? "unknown error"; } } @@ -44,3 +44,11 @@ class TransactionCommitFailedBIP68Final implements Exception {} class TransactionCommitFailedLessThanMin implements Exception {} class TransactionInputNotSupported implements Exception {} + +class SignNativeTokenTransactionRentException implements Exception {} + +class CreateAssociatedTokenAccountException implements Exception {} + +class SignSPLTokenTransactionRentException implements Exception {} + +class NoAssociatedTokenAccountException implements Exception {} diff --git a/cw_solana/lib/solana_exceptions.dart b/cw_solana/lib/solana_exceptions.dart index 888c95068..697521c29 100644 --- a/cw_solana/lib/solana_exceptions.dart +++ b/cw_solana/lib/solana_exceptions.dart @@ -1,4 +1,5 @@ import 'package:cw_core/crypto_currency.dart'; +import 'package:cw_core/exceptions.dart'; class SolanaTransactionCreationException implements Exception { final String exceptionMessage; @@ -20,18 +21,19 @@ class SolanaTransactionWrongBalanceException implements Exception { String toString() => exceptionMessage; } -class SolanaSignNativeTokenTransactionRentException implements Exception {} - -class SolanaCreateAssociatedTokenAccountException implements Exception { - final String exceptionMessage; +class SolanaSignNativeTokenTransactionRentException + extends SignNativeTokenTransactionRentException {} +class SolanaCreateAssociatedTokenAccountException extends CreateAssociatedTokenAccountException { SolanaCreateAssociatedTokenAccountException(this.exceptionMessage); + + final String exceptionMessage; } -class SolanaSignSPLTokenTransactionRentException implements Exception {} +class SolanaSignSPLTokenTransactionRentException extends SignSPLTokenTransactionRentException {} -class SolanaNoAssociatedTokenAccountException implements Exception { - const SolanaNoAssociatedTokenAccountException(this.account, this.mint); +class SolanaNoAssociatedTokenAccountException extends NoAssociatedTokenAccountException { + SolanaNoAssociatedTokenAccountException(this.account, this.mint); final String account; final String mint; diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index c1e0953a0..f8599513c 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -26,7 +26,6 @@ import 'package:cw_core/transaction_priority.dart'; import 'package:cw_core/unspent_coin_type.dart'; import 'package:cake_wallet/view_model/send/output.dart'; import 'package:cake_wallet/view_model/send/send_template_view_model.dart'; -import 'package:cw_solana/solana_exceptions.dart'; import 'package:flutter/material.dart'; import 'package:hive/hive.dart'; import 'package:mobx/mobx.dart'; @@ -676,19 +675,19 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor } } - if (error is SolanaSignNativeTokenTransactionRentException) { + if (error is SignNativeTokenTransactionRentException) { return S.current.solana_sign_native_transaction_rent_exception; } - if (error is SolanaCreateAssociatedTokenAccountException) { + if (error is CreateAssociatedTokenAccountException) { return S.current.solana_create_associated_token_account_exception; } - if (error is SolanaSignSPLTokenTransactionRentException) { + if (error is SignSPLTokenTransactionRentException) { return S.current.solana_sign_spl_token_transaction_rent_exception; } - if (error is SolanaNoAssociatedTokenAccountException) { + if (error is NoAssociatedTokenAccountException) { return S.current.solana_no_associated_token_account_exception; } From ac1c1989408f98a91b46cf0e58f183ff05b1ec6c Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Thu, 19 Dec 2024 22:48:52 +0200 Subject: [PATCH 2/2] minor --- .../seed/seed_verification/seed_verification_step_view.dart | 2 +- lib/utils/exception_handler.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/screens/seed/seed_verification/seed_verification_step_view.dart b/lib/src/screens/seed/seed_verification/seed_verification_step_view.dart index c7b4b31e6..b8c1500dc 100644 --- a/lib/src/screens/seed/seed_verification/seed_verification_step_view.dart +++ b/lib/src/screens/seed/seed_verification/seed_verification_step_view.dart @@ -71,7 +71,7 @@ class SeedVerificationStepView extends StatelessWidget { return GestureDetector( onTap: () async { final isCorrectWord = walletSeedViewModel.isChosenWordCorrect(option); - final isSecondWrongEntry = walletSeedViewModel.wrongEntries == 2; + final isSecondWrongEntry = walletSeedViewModel.wrongEntries >= 2; if (!isCorrectWord) { await showBar( context, diff --git a/lib/utils/exception_handler.dart b/lib/utils/exception_handler.dart index d79dfe314..357a69fa6 100644 --- a/lib/utils/exception_handler.dart +++ b/lib/utils/exception_handler.dart @@ -221,7 +221,7 @@ class ExceptionHandler { // just ignoring until we find a solution to this issue or migrate from flutter secure storage "core/auth_service.dart:63", "core/key_service.dart:14", - "core/wallet_loading_service.dart:132", + "core/wallet_loading_service.dart:133", ]; static Future _addDeviceInfo(File file) async {