From dbcbe35573662bf7715b413b2412cb08d2be2083 Mon Sep 17 00:00:00 2001 From: lllwvlvwlll Date: Mon, 8 Nov 2021 12:32:32 -0700 Subject: [PATCH] closes #2285 --- app/containers/Send/Send.jsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app/containers/Send/Send.jsx b/app/containers/Send/Send.jsx index e5a3ffdb8..b5c24186c 100644 --- a/app/containers/Send/Send.jsx +++ b/app/containers/Send/Send.jsx @@ -268,8 +268,6 @@ export default class Send extends React.Component { calculateMaxValue = (asset: string, index: number = 0) => { const { sendableAssets, chain } = this.props - const MIN_EXPECTED_GAS_FEE = 0.072 - if (chain === 'neo2') { if (sendableAssets[asset]) { const rows = [...this.state.sendRowDetails] @@ -295,13 +293,14 @@ export default class Send extends React.Component { let totalSendableAssets = toBigNumber(sendableAssets[asset].balance) if (asset === 'GAS') { - const existingGasAmounts = - Number(this.calculateRowAmounts(asset, index)) - MIN_EXPECTED_GAS_FEE + // calculate the current transaction fee + const transactionFee = ( + Number(this.state.n3Fees.networkFee) + + Number(this.state.n3Fees.systemFee) + ).toFixed(8) - totalSendableAssets = minusNumber( - totalSendableAssets, - MIN_EXPECTED_GAS_FEE * rowsWithAsset.length, - ) + // Calculate the GAS less the current transaction fee + totalSendableAssets = minusNumber(totalSendableAssets, transactionFee) if (totalSendableAssets < 0) { // this.props.showErrorNotification({ message: 'oops' }) @@ -311,6 +310,10 @@ export default class Send extends React.Component { if (rowsWithAsset.length === 1 || rowsWithAsset.length === 0) { return toNumber(totalSendableAssets).toFixed(decimals) } + + const existingGasAmounts = Number( + this.calculateRowAmounts(asset, index), + ) return minusNumber(totalSendableAssets, existingGasAmounts).toFixed( decimals, )