Better error message when trying to send all and the fee is greater than the balance in the wallet

This commit is contained in:
julian 2024-04-23 11:01:21 -06:00
parent 76a0a82b24
commit ff86cbccf6

View file

@ -237,6 +237,13 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
}
final int amount = satoshiAmountToSend - feeForOneOutput;
if (amount < 0) {
throw Exception(
"Estimated fee ($feeForOneOutput sats) is greater than balance!",
);
}
final data = await buildTransaction(
txData: txData.copyWith(
recipients: await _helperRecipientsConvert(