From 249e5f98761748c94898b35cc21a551c4cd107af Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Sat, 12 Jan 2019 19:31:42 +0100 Subject: [PATCH] recalculate reserve while "setMax" --- src/actions/ripple/SendFormValidationActions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/actions/ripple/SendFormValidationActions.js b/src/actions/ripple/SendFormValidationActions.js index bef1642d..4ee3a2f9 100644 --- a/src/actions/ripple/SendFormValidationActions.js +++ b/src/actions/ripple/SendFormValidationActions.js @@ -87,14 +87,14 @@ const recalculateTotalAmount = ($state: State): PayloadAction => (dispatc network, pending, } = getState().selectedAccount; - if (!account || !network) return $state; + if (!account || account.networkType !== 'ripple' || !network) return $state; const state = { ...$state }; const fee = toDecimalAmount(state.selectedFeeLevel.fee, network.decimals); if (state.setMax) { 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); }