Fix sendall

This commit is contained in:
likho 2023-01-13 11:21:10 +02:00
parent 27322061f6
commit 78a64690ed

View file

@ -434,6 +434,20 @@ class EthereumWallet extends CoinServiceAPI {
} }
final feeEstimate = await estimateFeeFor(satoshiAmount, fee); 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<String, dynamic> txData = { Map<String, dynamic> txData = {
"fee": feeEstimate, "fee": feeEstimate,
@ -868,6 +882,7 @@ class EthereumWallet extends CoinServiceAPI {
final List<Map<String, dynamic>> midSortedArray = []; final List<Map<String, dynamic>> midSortedArray = [];
AddressTransaction txs = await fetchAddressTransactions(thisAddress); AddressTransaction txs = await fetchAddressTransactions(thisAddress);
if (txs.message == "OK") { if (txs.message == "OK") {
final allTxs = txs.result; final allTxs = txs.result;
allTxs.forEach((element) { allTxs.forEach((element) {