From 6e2ced92f744de48bf239aa1ca95bc4fda3aabec Mon Sep 17 00:00:00 2001 From: Fabian Date: Tue, 2 Jun 2020 11:53:01 -0500 Subject: [PATCH] Fabo/fix fees for 0 balance (#877) * trigger CI * handle 0 balance fees in Cosmos * changelog Co-authored-by: Bitcoinera --- changes/fabo_fix-fees-for-0-balance | 1 + data/network-fees.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changes/fabo_fix-fees-for-0-balance diff --git a/changes/fabo_fix-fees-for-0-balance b/changes/fabo_fix-fees-for-0-balance new file mode 100644 index 0000000000..d32703c6dd --- /dev/null +++ b/changes/fabo_fix-fees-for-0-balance @@ -0,0 +1 @@ +[Fixed] Handle fees if user has 0 balance in that token @faboweb \ No newline at end of file diff --git a/data/network-fees.js b/data/network-fees.js index 567bf8f3f1..8e4caf3a6a 100644 --- a/data/network-fees.js +++ b/data/network-fees.js @@ -332,7 +332,7 @@ const getCosmosFee = async (network, cosmosSource, senderAddress, messageType, m ), denom: feeDenom } - const selectedBalance = balances.find(({denom}) => denom === feeDenom) + const selectedBalance = balances.find(({denom}) => denom === feeDenom) || { amount: 0, denom: feeDenom } if ( Number(transactionAmount) + Number(estimatedFee.amount) > Number(selectedBalance.amount) &&