Merge pull request #866 from cake-tech/sending-error-messages

Improve sending error messages
This commit is contained in:
Justin Ehrenhofer
2023-04-07 10:01:36 -05:00
committed by GitHub
3 changed files with 7 additions and 7 deletions
@@ -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.';
}
+3 -3
View File
@@ -166,14 +166,14 @@ abstract class HavenWalletBase extends WalletBase<MoneroBalance,
if (hasMultiDestination) {
if (outputs.any((item) => 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<MoneroBalance,
final formattedBalance = moneroAmountToString(amount: unlockedBalance);
throw HavenTransactionCreationException(
'Incorrect unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
'You do not have enough unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
}
pendingTransactionDescription =
+3 -3
View File
@@ -180,14 +180,14 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
if (hasMultiDestination) {
if (outputs.any((item) => 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<MoneroBalance,
final formattedBalance = moneroAmountToString(amount: unlockedBalance);
throw MoneroTransactionCreationException(
'Incorrect unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
'You do not have enough unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
}
pendingTransactionDescription =