mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-27 18:58:08 +00:00
fix recalculating local amount for tokens on set max btn
This commit is contained in:
parent
58ca09def0
commit
628d424438
@ -131,15 +131,12 @@ export const recalculateTotalAmount = ($state: State): PayloadAction<State> => (
|
|||||||
} else {
|
} else {
|
||||||
const b = new BigNumber(account.balance).minus(pendingAmount);
|
const b = new BigNumber(account.balance).minus(pendingAmount);
|
||||||
state.amount = calculateMaxAmount(b, state.gasPrice, state.gasLimit);
|
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);
|
state.total = calculateTotal(isToken ? '0' : state.amount, state.gasPrice, state.gasLimit);
|
||||||
|
Loading…
Reference in New Issue
Block a user