diff options
author | Dan Finlay <flyswatter@users.noreply.github.com> | 2017-03-07 05:30:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-07 05:30:09 +0800 |
commit | f9b2c12dc34992deb1ef95f4a1f7572aac4aa1af (patch) | |
tree | b1426b18930b61d6f24031372f1a91f7375a4c47 /ui/app/components/pending-tx-details.js | |
parent | f162a11585392df5e593018a02549f8b03018d22 (diff) | |
parent | 72932bdcba10bd9d47724f271d0c14f84d12b759 (diff) | |
download | tangerine-wallet-browser-f9b2c12dc34992deb1ef95f4a1f7572aac4aa1af.tar tangerine-wallet-browser-f9b2c12dc34992deb1ef95f4a1f7572aac4aa1af.tar.gz tangerine-wallet-browser-f9b2c12dc34992deb1ef95f4a1f7572aac4aa1af.tar.bz2 tangerine-wallet-browser-f9b2c12dc34992deb1ef95f4a1f7572aac4aa1af.tar.lz tangerine-wallet-browser-f9b2c12dc34992deb1ef95f4a1f7572aac4aa1af.tar.xz tangerine-wallet-browser-f9b2c12dc34992deb1ef95f4a1f7572aac4aa1af.tar.zst tangerine-wallet-browser-f9b2c12dc34992deb1ef95f4a1f7572aac4aa1af.zip |
Merge pull request #1161 from MetaMask/Debugging
Tune up master
Diffstat (limited to 'ui/app/components/pending-tx-details.js')
-rw-r--r-- | ui/app/components/pending-tx-details.js | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/ui/app/components/pending-tx-details.js b/ui/app/components/pending-tx-details.js index b1ab9576b..e92ce575f 100644 --- a/ui/app/components/pending-tx-details.js +++ b/ui/app/components/pending-tx-details.js @@ -32,10 +32,8 @@ PTXP.render = function () { var account = props.accounts[address] var balance = account ? account.balance : '0x0' - const gas = state.gas || txParams.gas - const gasPrice = state.gasPrice || txData.gasPrice - const gasDefault = txParams.gas - const gasPriceDefault = txData.gasPrice + const gas = (state.gas === undefined) ? txParams.gas : state.gas + const gasPrice = (state.gasPrice === undefined) ? txData.gasPrice : state.gasPrice var txFee = state.txFee || txData.txFee || '' var maxCost = state.maxCost || txData.maxCost || '' @@ -131,11 +129,7 @@ PTXP.render = function () { }, onChange: (newHex) => { log.info(`Gas limit changed to ${newHex}`) - if (newHex === '0x0') { - this.setState({gas: gasDefault}) - } else { - this.setState({ gas: newHex }) - } + this.setState({ gas: newHex }) }, }), ]), @@ -155,11 +149,7 @@ PTXP.render = function () { }, onChange: (newHex) => { log.info(`Gas price changed to: ${newHex}`) - if (newHex === '0x0') { - this.setState({gasPrice: gasPriceDefault}) - } else { - this.setState({ gasPrice: newHex }) - } + this.setState({ gasPrice: newHex }) }, }), ]), @@ -316,7 +306,6 @@ PTXP.gatherParams = function () { const state = this.state || {} const txData = state.txData || props.txData const txParams = txData.txParams - const gas = state.gas || txParams.gas const gasPrice = state.gasPrice || txParams.gasPrice const resultTx = extend(txParams, { @@ -330,6 +319,16 @@ PTXP.gatherParams = function () { return resultTxMeta } +PTXP.verifyGasParams = function () { + // We call this in case the gas has not been modified at all + if (!this.state) { return true } + return this._notZeroOrEmptyString(this.state.gas) && this._notZeroOrEmptyString(this.state.gasPrice) +} + +PTXP._notZeroOrEmptyString = function (obj) { + return obj !== '' && obj !== '0x0' +} + function forwardCarrat () { return ( |