fix: Bug when building Monero.Com resulting from solana exceptions situated in send viewmodel from cw_solana package (#1893)
Some checks are pending
Cache Dependencies / test (push) Waiting to run

This commit is contained in:
David Adegoke 2024-12-19 18:41:59 +01:00 committed by GitHub
parent 301cb3b7e0
commit a6f61c595f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 13 deletions

View file

@ -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 {}

View file

@ -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;

View file

@ -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;
}