diff options
author | Kevin Serrano <kevin.serrano@consensys.net> | 2017-05-09 04:58:46 +0800 |
---|---|---|
committer | Kevin Serrano <kevin.serrano@consensys.net> | 2017-05-09 04:58:46 +0800 |
commit | 53a88b319b928510c9922fb3d02da05aed6b101a (patch) | |
tree | 45c1a425eb49743cf7c3bb178ee6f47c78ee5d96 /ui | |
parent | 09a0e7ed89c25698161e1952e93160c99456f656 (diff) | |
parent | c7b2f2f2e986981496168dbf57cee787882ffd59 (diff) | |
download | tangerine-wallet-browser-53a88b319b928510c9922fb3d02da05aed6b101a.tar tangerine-wallet-browser-53a88b319b928510c9922fb3d02da05aed6b101a.tar.gz tangerine-wallet-browser-53a88b319b928510c9922fb3d02da05aed6b101a.tar.bz2 tangerine-wallet-browser-53a88b319b928510c9922fb3d02da05aed6b101a.tar.lz tangerine-wallet-browser-53a88b319b928510c9922fb3d02da05aed6b101a.tar.xz tangerine-wallet-browser-53a88b319b928510c9922fb3d02da05aed6b101a.tar.zst tangerine-wallet-browser-53a88b319b928510c9922fb3d02da05aed6b101a.zip |
Merge branch 'i1381-GasPriceInGwei' of github.com:MetaMask/metamask-plugin into i1381-GasPriceInGwei
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/components/ens-input.js | 1 | ||||
-rw-r--r-- | ui/app/components/pending-tx.js | 21 | ||||
-rw-r--r-- | ui/app/reducers.js | 1 |
3 files changed, 16 insertions, 7 deletions
diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js index 0457bde2e..ec3cd60ed 100644 --- a/ui/app/components/ens-input.js +++ b/ui/app/components/ens-input.js @@ -63,6 +63,7 @@ EnsInput.prototype.render = function () { return h('option', { value: identity.address, label: identity.name, + key: identity.address, }) }), ]), diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index 4b28ae099..71d4d767a 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -15,7 +15,9 @@ const addressSummary = util.addressSummary const nameForAddress = require('../../lib/contract-namer') const HexInput = require('./hex-as-decimal-input') -const MIN_GAS_PRICE_BN = new BN(20000000) +const MIN_GAS_PRICE_GWEI_BN = new BN(2) +const GWEI_FACTOR = new BN(1e9) +const MIN_GAS_PRICE_BN = MIN_GAS_PRICE_GWEI_BN.mul(GWEI_FACTOR) const MIN_GAS_LIMIT_BN = new BN(21000) module.exports = connect(mapStateToProps)(PendingTx) @@ -39,16 +41,20 @@ PendingTx.prototype.render = function () { const txMeta = this.gatherTxMeta() const txParams = txMeta.txParams || {} + // Account Details const address = txParams.from || props.selectedAddress const identity = props.identities[address] || { address: address } const account = props.accounts[address] const balance = account ? account.balance : '0x0' + // Gas const gas = txParams.gas - const gasPrice = txParams.gasPrice - const gasBn = hexToBn(gas) + + // Gas Price + const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(16) const gasPriceBn = hexToBn(gasPrice) + const gasPriceGweiBn = gasPriceBn.div(GWEI_FACTOR) const txFeeBn = gasBn.mul(gasPriceBn) const valueBn = hexToBn(txParams.value) @@ -187,17 +193,18 @@ PendingTx.prototype.render = function () { }, [ h(HexInput, { name: 'Gas Price', - value: gasPrice, - suffix: 'WEI', - min: MIN_GAS_PRICE_BN.toString(10), + value: gasPriceGweiBn.toString(16), + suffix: 'GWEI', + min: MIN_GAS_PRICE_GWEI_BN.toString(10), style: { position: 'relative', top: '5px', }, onChange: (newHex) => { log.info(`Gas price changed to: ${newHex}`) + const inWei = hexToBn(newHex).mul(GWEI_FACTOR) const txMeta = this.gatherTxMeta() - txMeta.txParams.gasPrice = newHex + txMeta.txParams.gasPrice = inWei.toString(16) this.setState({ txData: txMeta }) }, ref: (hexInput) => { this.inputs.push(hexInput) }, diff --git a/ui/app/reducers.js b/ui/app/reducers.js index c656af849..11efca529 100644 --- a/ui/app/reducers.js +++ b/ui/app/reducers.js @@ -44,6 +44,7 @@ function rootReducer (state, action) { window.logState = function () { var stateString = JSON.stringify(window.METAMASK_CACHED_LOG_STATE, removeSeedWords, 2) console.log(stateString) + return stateString } function removeSeedWords (key, value) { |