From 6c0401089a994e1325c01dfd17a9027c9e2fcb21 Mon Sep 17 00:00:00 2001 From: Justin Ehrenhofer Date: Fri, 7 Apr 2023 08:54:39 -0500 Subject: [PATCH] Improve sending error messages Ideally these should be moved to the translation strings --- .../lib/bitcoin_transaction_wrong_balance_exception.dart | 2 +- cw_haven/lib/haven_wallet.dart | 6 +++--- cw_monero/lib/monero_wallet.dart | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cw_bitcoin/lib/bitcoin_transaction_wrong_balance_exception.dart b/cw_bitcoin/lib/bitcoin_transaction_wrong_balance_exception.dart index 9960d6c65..3f379bea0 100644 --- a/cw_bitcoin/lib/bitcoin_transaction_wrong_balance_exception.dart +++ b/cw_bitcoin/lib/bitcoin_transaction_wrong_balance_exception.dart @@ -6,5 +6,5 @@ class BitcoinTransactionWrongBalanceException implements Exception { final CryptoCurrency currency; @override - String toString() => 'Wrong balance. Not enough ${currency.title} on your balance.'; + String toString() => 'You do not have enough ${currency.title} to send this amount.'; } \ No newline at end of file diff --git a/cw_haven/lib/haven_wallet.dart b/cw_haven/lib/haven_wallet.dart index a4b949d8f..e761d21fa 100644 --- a/cw_haven/lib/haven_wallet.dart +++ b/cw_haven/lib/haven_wallet.dart @@ -166,14 +166,14 @@ abstract class HavenWalletBase extends WalletBase item.sendAll || (item.formattedCryptoAmount ?? 0) <= 0)) { - throw HavenTransactionCreationException('Wrong balance. Not enough XMR on your balance.'); + throw HavenTransactionCreationException('You do not have enough coins to send this amount.'); } final int totalAmount = outputs.fold(0, (acc, value) => acc + (value.formattedCryptoAmount ?? 0)); if (unlockedBalance < totalAmount) { - throw HavenTransactionCreationException('Wrong balance. Not enough XMR on your balance.'); + throw HavenTransactionCreationException('You do not have enough coins to send this amount.'); } final moneroOutputs = outputs.map((output) => @@ -204,7 +204,7 @@ abstract class HavenWalletBase extends WalletBase item.sendAll || (item.formattedCryptoAmount ?? 0) <= 0)) { - throw MoneroTransactionCreationException('Wrong balance. Not enough XMR on your balance.'); + throw MoneroTransactionCreationException('You do not have enough XMR to send this amount.'); } final int totalAmount = outputs.fold(0, (acc, value) => acc + (value.formattedCryptoAmount ?? 0)); if (unlockedBalance < totalAmount) { - throw MoneroTransactionCreationException('Wrong balance. Not enough XMR on your balance.'); + throw MoneroTransactionCreationException('You do not have enough XMR to send this amount.'); } final moneroOutputs = outputs.map((output) { @@ -222,7 +222,7 @@ abstract class MoneroWalletBase extends WalletBase