Improve sending error messages
Ideally these should be moved to the translation strings
Justin Ehrenhofer committed
Apr 7, 2023 at 08:54 UTC
6c0401089a994e1325c01dfd17a9027c9e2fcb21
3 files changed
+7
-7
cw_bitcoin/lib/bitcoin_transaction_wrong_balance_exception.dart
+1
-1
@@ -6,5 +6,5 @@ class BitcoinTransactionWrongBalanceException implements Exception {
6
final CryptoCurrency currency;
7
8
@override
9
- String toString() => 'Wrong balance. Not enough ${currency.title} on your balance.';
9
+ String toString() => 'You do not have enough ${currency.title} to send this amount.';
10
}
\ No newline at end of file
cw_haven/lib/haven_wallet.dart
+3
-3
@@ -166,14 +166,14 @@ abstract class HavenWalletBase extends WalletBase<MoneroBalance,
166
if (hasMultiDestination) {
167
if (outputs.any((item) => item.sendAll
168
|| (item.formattedCryptoAmount ?? 0) <= 0)) {
169
- throw HavenTransactionCreationException('Wrong balance. Not enough XMR on your balance.');
169
+ throw HavenTransactionCreationException('You do not have enough coins to send this amount.');
170
}
171
172
final int totalAmount = outputs.fold(0, (acc, value) =>
173
acc + (value.formattedCryptoAmount ?? 0));
174
175
if (unlockedBalance < totalAmount) {
176
- throw HavenTransactionCreationException('Wrong balance. Not enough XMR on your balance.');
176
+ throw HavenTransactionCreationException('You do not have enough coins to send this amount.');
177
}
178
179
final moneroOutputs = outputs.map((output) =>
@@ -204,7 +204,7 @@ abstract class HavenWalletBase extends WalletBase<MoneroBalance,
204
final formattedBalance = moneroAmountToString(amount: unlockedBalance);
205
206
throw HavenTransactionCreationException(
207
- 'Incorrect unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
207
+ 'You do not have enough unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
208
}
209
210
pendingTransactionDescription =
cw_monero/lib/monero_wallet.dart
+3
-3
@@ -180,14 +180,14 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
180
if (hasMultiDestination) {
181
if (outputs.any((item) => item.sendAll
182
|| (item.formattedCryptoAmount ?? 0) <= 0)) {
183
- throw MoneroTransactionCreationException('Wrong balance. Not enough XMR on your balance.');
183
+ throw MoneroTransactionCreationException('You do not have enough XMR to send this amount.');
184
}
185
186
final int totalAmount = outputs.fold(0, (acc, value) =>
187
acc + (value.formattedCryptoAmount ?? 0));
188
189
if (unlockedBalance < totalAmount) {
190
- throw MoneroTransactionCreationException('Wrong balance. Not enough XMR on your balance.');
190
+ throw MoneroTransactionCreationException('You do not have enough XMR to send this amount.');
191
}
192
193
final moneroOutputs = outputs.map((output) {
@@ -222,7 +222,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
222
final formattedBalance = moneroAmountToString(amount: unlockedBalance);
223
224
throw MoneroTransactionCreationException(
225
- 'Incorrect unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
225
+ 'You do not have enough unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
226
}
227
228
pendingTransactionDescription =