mirror of
https://github.com/trezor/trezor-wallet
synced 2025-02-06 21:22:45 +00:00
recalculate reserve while "setMax"
This commit is contained in:
parent
9d325fb139
commit
249e5f9876
@ -87,14 +87,14 @@ const recalculateTotalAmount = ($state: State): PayloadAction<State> => (dispatc
|
|||||||
network,
|
network,
|
||||||
pending,
|
pending,
|
||||||
} = getState().selectedAccount;
|
} = getState().selectedAccount;
|
||||||
if (!account || !network) return $state;
|
if (!account || account.networkType !== 'ripple' || !network) return $state;
|
||||||
|
|
||||||
const state = { ...$state };
|
const state = { ...$state };
|
||||||
const fee = toDecimalAmount(state.selectedFeeLevel.fee, network.decimals);
|
const fee = toDecimalAmount(state.selectedFeeLevel.fee, network.decimals);
|
||||||
|
|
||||||
if (state.setMax) {
|
if (state.setMax) {
|
||||||
const pendingAmount = getPendingAmount(pending, state.networkSymbol, false);
|
const pendingAmount = getPendingAmount(pending, state.networkSymbol, false);
|
||||||
const availableBalance = new BigNumber(account.balance).minus(pendingAmount);
|
const availableBalance = new BigNumber(account.balance).minus(account.reserve).minus(pendingAmount);
|
||||||
state.amount = calculateMaxAmount(availableBalance, fee);
|
state.amount = calculateMaxAmount(availableBalance, fee);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user