diff options
author | kumavis <kumavis@users.noreply.github.com> | 2017-03-29 05:48:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-29 05:48:03 +0800 |
commit | 0f1ea5861f10193ab958fea6ba10a5e2aed4c839 (patch) | |
tree | 35755083efcb9bedad73bdcd340432c298866125 /ui/app/conf-tx.js | |
parent | 731f6654094fb6cac832d4092471c51b554a34d4 (diff) | |
parent | 5d38792910147dfcc00028a2f8b262a47cab295f (diff) | |
download | tangerine-wallet-browser-0f1ea5861f10193ab958fea6ba10a5e2aed4c839.tar tangerine-wallet-browser-0f1ea5861f10193ab958fea6ba10a5e2aed4c839.tar.gz tangerine-wallet-browser-0f1ea5861f10193ab958fea6ba10a5e2aed4c839.tar.bz2 tangerine-wallet-browser-0f1ea5861f10193ab958fea6ba10a5e2aed4c839.tar.lz tangerine-wallet-browser-0f1ea5861f10193ab958fea6ba10a5e2aed4c839.tar.xz tangerine-wallet-browser-0f1ea5861f10193ab958fea6ba10a5e2aed4c839.tar.zst tangerine-wallet-browser-0f1ea5861f10193ab958fea6ba10a5e2aed4c839.zip |
Merge pull request #1276 from MetaMask/ImproveGasEstimates
Improve UI gas calculation logic
Diffstat (limited to 'ui/app/conf-tx.js')
-rw-r--r-- | ui/app/conf-tx.js | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index 54c171a8a..3b8618992 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -7,8 +7,6 @@ const actions = require('./actions') const NetworkIndicator = require('./components/network') const txHelper = require('../lib/tx-helper') const isPopupOrNotification = require('../../app/scripts/lib/is-popup-or-notification') -const ethUtil = require('ethereumjs-util') -const BN = ethUtil.BN const PendingTx = require('./components/pending-tx') const PendingMsg = require('./components/pending-msg') @@ -104,9 +102,6 @@ ConfirmTxScreen.prototype.render = function () { selectedAddress: props.selectedAddress, accounts: props.accounts, identities: props.identities, - insufficientBalance: this.checkBalanceAgainstTx(txData), - // State actions - onTxChange: this.onTxChange.bind(this), // Actions buyEth: this.buyEth.bind(this, txParams.from || props.selectedAddress), sendTransaction: this.sendTransaction.bind(this, txData), @@ -145,37 +140,14 @@ function currentTxView (opts) { } } -ConfirmTxScreen.prototype.checkBalanceAgainstTx = function (txData) { - if (!txData.txParams) return false - var props = this.props - var address = txData.txParams.from || props.selectedAddress - var account = props.accounts[address] - var balance = account ? account.balance : '0x0' - var maxCost = new BN(txData.maxCost, 16) - - var balanceBn = new BN(ethUtil.stripHexPrefix(balance), 16) - return maxCost.gt(balanceBn) -} - ConfirmTxScreen.prototype.buyEth = function (address, event) { this.stopPropagation(event) this.props.dispatch(actions.buyEthView(address)) } -// Allows the detail view to update the gas calculations, -// for manual gas controls. -ConfirmTxScreen.prototype.onTxChange = function (txData) { - log.debug(`conf-tx onTxChange triggered with ${JSON.stringify(txData)}`) - this.setState({ txData }) -} - -// Must default to any local state txData, -// to allow manual override of gas calculations. ConfirmTxScreen.prototype.sendTransaction = function (txData, event) { this.stopPropagation(event) - const state = this.state || {} - const txMeta = state.txData - this.props.dispatch(actions.updateAndApproveTx(txMeta || txData)) + this.props.dispatch(actions.updateAndApproveTx(txData)) } ConfirmTxScreen.prototype.cancelTransaction = function (txData, event) { |