From 628d424438aa104311e854db503939f11fd0ced3 Mon Sep 17 00:00:00 2001 From: slowbackspace Date: Thu, 14 Mar 2019 16:35:50 +0100 Subject: [PATCH] fix recalculating local amount for tokens on set max btn --- src/actions/ethereum/SendFormValidationActions.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/actions/ethereum/SendFormValidationActions.js b/src/actions/ethereum/SendFormValidationActions.js index 6a5d1cc5..c3f9a4d0 100644 --- a/src/actions/ethereum/SendFormValidationActions.js +++ b/src/actions/ethereum/SendFormValidationActions.js @@ -131,15 +131,12 @@ export const recalculateTotalAmount = ($state: State): PayloadAction => ( } else { const b = new BigNumber(account.balance).minus(pendingAmount); state.amount = calculateMaxAmount(b, state.gasPrice, state.gasLimit); - - // calculate amount in local currency - const { localCurrency } = getState().sendFormEthereum; - const fiatRates = getState().fiat.find(f => f.network === state.currency.toLowerCase()); - const localAmount = toFiatCurrency(state.amount, localCurrency, fiatRates); - if (localAmount) { - state.localAmount = localAmount; - } } + // calculate amount in local currency + const { localCurrency } = getState().sendFormEthereum; + const fiatRates = getState().fiat.find(f => f.network === state.currency.toLowerCase()); + const localAmount = toFiatCurrency(state.amount, localCurrency, fiatRates); + state.localAmount = localAmount; } state.total = calculateTotal(isToken ? '0' : state.amount, state.gasPrice, state.gasLimit);