fix: banano prepareSend int overflow

This commit is contained in:
julian 2023-06-08 14:10:08 -06:00
parent a3dcdf6fcd
commit 885310395e

View file

@ -668,20 +668,14 @@ class BananoWallet extends CoinServiceAPI
Map<String, dynamic>? args, Map<String, dynamic>? args,
}) async { }) async {
try { try {
int satAmount = amount.raw.toInt(); if (amount.decimals != coin.decimals) {
int realfee = 0; throw ArgumentError("Banano prepareSend attempted with invalid Amount");
if (balance.spendable == amount) {
satAmount = balance.spendable.raw.toInt() - realfee;
} }
Map<String, dynamic> txData = { Map<String, dynamic> txData = {
"fee": realfee, "fee": 0,
"addresss": address, "addresss": address,
"recipientAmt": Amount( "recipientAmt": amount,
rawValue: BigInt.from(satAmount),
fractionDigits: coin.decimals,
),
}; };
Logging.instance.log("prepare send: $txData", level: LogLevel.Info); Logging.instance.log("prepare send: $txData", level: LogLevel.Info);