diff options
Diffstat (limited to 'ui/app/send-v2.js')
-rw-r--r-- | ui/app/send-v2.js | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/ui/app/send-v2.js b/ui/app/send-v2.js index 690af7e5c..b7e904ea8 100644 --- a/ui/app/send-v2.js +++ b/ui/app/send-v2.js @@ -93,6 +93,9 @@ SendTransactionScreen.prototype.componentWillMount = function () { updateGasTotal, from, tokenContract, + editingTransactionId, + gasPrice, + gasLimit, } = this.props const { symbol } = selectedToken || {} @@ -102,22 +105,32 @@ SendTransactionScreen.prototype.componentWillMount = function () { const estimateGasParams = getParamsForGasEstimate(selectedAddress, symbol, data) - Promise - .all([ - getGasPrice(), - estimateGas(estimateGasParams), - tokenContract && tokenContract.balanceOf(from.address), - ]) - .then(([gasPrice, gas, usersToken]) => { - - const newGasTotal = multiplyCurrencies(gas, gasPrice, { - toNumericBase: 'hex', - multiplicandBase: 16, - multiplierBase: 16, + let newGasTotal + if (!editingTransactionId) { + Promise + .all([ + getGasPrice(), + estimateGas(estimateGasParams), + tokenContract && tokenContract.balanceOf(from.address) + ]) + .then(([gasPrice, gas, usersToken]) => { + + const newGasTotal = multiplyCurrencies(gas, gasPrice, { + toNumericBase: 'hex', + multiplicandBase: 16, + multiplierBase: 16, + }) + updateGasTotal(newGasTotal) + this.updateSendTokenBalance(usersToken) }) - updateGasTotal(newGasTotal) - this.updateSendTokenBalance(usersToken) + } else { + newGasTotal = multiplyCurrencies(gasLimit, gasPrice, { + toNumericBase: 'hex', + multiplicandBase: 16, + multiplierBase: 16, }) + updateGasTotal(newGasTotal) + } } SendTransactionScreen.prototype.componentDidUpdate = function (prevProps) { @@ -394,6 +407,7 @@ SendTransactionScreen.prototype.renderAmountRow = function () { errors, amount, } = this.props + return h('div.send-v2__form-row', [ h('div.send-v2__form-label', [ @@ -551,9 +565,12 @@ SendTransactionScreen.prototype.onSubmit = function (event) { gasPrice, signTokenTx, signTx, + updateAndApproveTx, selectedToken, - clearSend, + toAccounts, + editingTransactionId, errors: { amount: amountError, to: toError }, + backToConfirmScreen, } = this.props const noErrors = !amountError && toError === null @@ -564,6 +581,11 @@ SendTransactionScreen.prototype.onSubmit = function (event) { this.addToAddressBookIfNew(to) + if (editingTransactionId) { + backToConfirmScreen(editingTransactionId) + return + } + const txParams = { from, value: '0', @@ -576,8 +598,6 @@ SendTransactionScreen.prototype.onSubmit = function (event) { txParams.to = to } - clearSend() - selectedToken ? signTokenTx(selectedToken.address, to, amount, txParams) : signTx(txParams) |