Fix for haven wallet

This commit is contained in:
M 2022-02-24 19:54:38 +03:00
parent 7d7949125d
commit 10e7018afa
2 changed files with 4 additions and 4 deletions

View file

@ -153,20 +153,20 @@ abstract class HavenWalletBase extends WalletBase<MoneroBalance,
PendingTransactionDescription pendingTransactionDescription; PendingTransactionDescription pendingTransactionDescription;
if (!(syncStatus is SyncedSyncStatus)) { if (!(syncStatus is SyncedSyncStatus)) {
throw MoneroTransactionCreationException('The wallet is not synced.'); throw HavenTransactionCreationException('The wallet is not synced.');
} }
if (hasMultiDestination) { if (hasMultiDestination) {
if (outputs.any((item) => item.sendAll if (outputs.any((item) => item.sendAll
|| item.formattedCryptoAmount <= 0)) { || item.formattedCryptoAmount <= 0)) {
throw MoneroTransactionCreationException('Wrong balance. Not enough XMR on your balance.'); throw HavenTransactionCreationException('Wrong balance. Not enough XMR on your balance.');
} }
final int totalAmount = outputs.fold(0, (acc, value) => final int totalAmount = outputs.fold(0, (acc, value) =>
acc + value.formattedCryptoAmount); acc + value.formattedCryptoAmount);
if (unlockedBalance < totalAmount) { if (unlockedBalance < totalAmount) {
throw MoneroTransactionCreationException('Wrong balance. Not enough XMR on your balance.'); throw HavenTransactionCreationException('Wrong balance. Not enough XMR on your balance.');
} }
final moneroOutputs = outputs.map((output) => final moneroOutputs = outputs.map((output) =>
@ -194,7 +194,7 @@ abstract class HavenWalletBase extends WalletBase<MoneroBalance,
(formattedAmount == null && unlockedBalance <= 0)) { (formattedAmount == null && unlockedBalance <= 0)) {
final formattedBalance = moneroAmountToString(amount: unlockedBalance); final formattedBalance = moneroAmountToString(amount: unlockedBalance);
throw MoneroTransactionCreationException( throw HavenTransactionCreationException(
'Incorrect unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.'); 'Incorrect unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
} }