From 78a64690ed11894260d31d27cb9407733fd04cf7 Mon Sep 17 00:00:00 2001 From: likho Date: Fri, 13 Jan 2023 11:21:10 +0200 Subject: [PATCH] Fix sendall --- lib/services/coins/ethereum/ethereum_wallet.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/services/coins/ethereum/ethereum_wallet.dart b/lib/services/coins/ethereum/ethereum_wallet.dart index e30e03aba..52967e712 100644 --- a/lib/services/coins/ethereum/ethereum_wallet.dart +++ b/lib/services/coins/ethereum/ethereum_wallet.dart @@ -434,6 +434,20 @@ class EthereumWallet extends CoinServiceAPI { } final feeEstimate = await estimateFeeFor(satoshiAmount, fee); + print("FEE ESTIMATE IS $feeEstimate"); + print("AMOUNT TO SEND IS $satoshiAmount"); + + bool isSendAll = false; + final balance = + Format.decimalAmountToSatoshis(await availableBalance, coin); + if (satoshiAmount == balance) { + isSendAll = true; + } + + if (isSendAll) { + //Subtract fee amount from send amount + satoshiAmount -= feeEstimate; + } Map txData = { "fee": feeEstimate, @@ -868,6 +882,7 @@ class EthereumWallet extends CoinServiceAPI { final List> midSortedArray = []; AddressTransaction txs = await fetchAddressTransactions(thisAddress); + if (txs.message == "OK") { final allTxs = txs.result; allTxs.forEach((element) {