Merge branch 'i1381-GasPriceInGwei' of github.com:MetaMask/metamask-plugin into i1381-GasPriceInGwei

feature/default_network_editable
Kevin Serrano 8 years ago
commit 53a88b319b
No known key found for this signature in database
GPG Key ID: BF999DEFC7371BA1
  1. 8
      CHANGELOG.md
  2. 2
      package.json
  3. 1
      ui/app/components/ens-input.js
  4. 21
      ui/app/components/pending-tx.js
  5. 1
      ui/app/reducers.js

@ -2,13 +2,15 @@
## Current Master ## Current Master
- Input gas price in Gwei.
- Enforce Safe Gas Minimum recommended by EthGasStation.
- Fix bug where block-tracker could stop polling for new blocks.
- Reduce UI size by removing internal web3.
## 3.6.1 2017-4-30 ## 3.6.1 2017-4-30
- Made fox less nosy. - Made fox less nosy.
- Fix bug where error was reported in debugger console when Chrome opened a new window. - Fix bug where error was reported in debugger console when Chrome opened a new window.
- Fix bug where block-tracker could stop polling for new blocks.
## 3.6.0 2017-4-26 ## 3.6.0 2017-4-26

@ -7,7 +7,7 @@
"start": "npm run dev", "start": "npm run dev",
"dev": "gulp dev --debug", "dev": "gulp dev --debug",
"disc": "gulp disc --debug", "disc": "gulp disc --debug",
"dist": "gulp dist --disableLiveReload", "dist": "npm install && gulp dist --disableLiveReload",
"test": "npm run lint && npm run test-unit && npm run test-integration", "test": "npm run lint && npm run test-unit && npm run test-integration",
"test-unit": "METAMASK_ENV=test mocha --require test/helper.js --recursive \"test/unit/**/*.js\"", "test-unit": "METAMASK_ENV=test mocha --require test/helper.js --recursive \"test/unit/**/*.js\"",
"test-integration": "npm run buildMock && npm run buildCiUnits && testem ci -P 2", "test-integration": "npm run buildMock && npm run buildCiUnits && testem ci -P 2",

@ -63,6 +63,7 @@ EnsInput.prototype.render = function () {
return h('option', { return h('option', {
value: identity.address, value: identity.address,
label: identity.name, label: identity.name,
key: identity.address,
}) })
}), }),
]), ]),

@ -15,7 +15,9 @@ const addressSummary = util.addressSummary
const nameForAddress = require('../../lib/contract-namer') const nameForAddress = require('../../lib/contract-namer')
const HexInput = require('./hex-as-decimal-input') 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) const MIN_GAS_LIMIT_BN = new BN(21000)
module.exports = connect(mapStateToProps)(PendingTx) module.exports = connect(mapStateToProps)(PendingTx)
@ -39,16 +41,20 @@ PendingTx.prototype.render = function () {
const txMeta = this.gatherTxMeta() const txMeta = this.gatherTxMeta()
const txParams = txMeta.txParams || {} const txParams = txMeta.txParams || {}
// Account Details
const address = txParams.from || props.selectedAddress const address = txParams.from || props.selectedAddress
const identity = props.identities[address] || { address: address } const identity = props.identities[address] || { address: address }
const account = props.accounts[address] const account = props.accounts[address]
const balance = account ? account.balance : '0x0' const balance = account ? account.balance : '0x0'
// Gas
const gas = txParams.gas const gas = txParams.gas
const gasPrice = txParams.gasPrice
const gasBn = hexToBn(gas) const gasBn = hexToBn(gas)
// Gas Price
const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(16)
const gasPriceBn = hexToBn(gasPrice) const gasPriceBn = hexToBn(gasPrice)
const gasPriceGweiBn = gasPriceBn.div(GWEI_FACTOR)
const txFeeBn = gasBn.mul(gasPriceBn) const txFeeBn = gasBn.mul(gasPriceBn)
const valueBn = hexToBn(txParams.value) const valueBn = hexToBn(txParams.value)
@ -187,17 +193,18 @@ PendingTx.prototype.render = function () {
}, [ }, [
h(HexInput, { h(HexInput, {
name: 'Gas Price', name: 'Gas Price',
value: gasPrice, value: gasPriceGweiBn.toString(16),
suffix: 'WEI', suffix: 'GWEI',
min: MIN_GAS_PRICE_BN.toString(10), min: MIN_GAS_PRICE_GWEI_BN.toString(10),
style: { style: {
position: 'relative', position: 'relative',
top: '5px', top: '5px',
}, },
onChange: (newHex) => { onChange: (newHex) => {
log.info(`Gas price changed to: ${newHex}`) log.info(`Gas price changed to: ${newHex}`)
const inWei = hexToBn(newHex).mul(GWEI_FACTOR)
const txMeta = this.gatherTxMeta() const txMeta = this.gatherTxMeta()
txMeta.txParams.gasPrice = newHex txMeta.txParams.gasPrice = inWei.toString(16)
this.setState({ txData: txMeta }) this.setState({ txData: txMeta })
}, },
ref: (hexInput) => { this.inputs.push(hexInput) }, ref: (hexInput) => { this.inputs.push(hexInput) },

@ -44,6 +44,7 @@ function rootReducer (state, action) {
window.logState = function () { window.logState = function () {
var stateString = JSON.stringify(window.METAMASK_CACHED_LOG_STATE, removeSeedWords, 2) var stateString = JSON.stringify(window.METAMASK_CACHED_LOG_STATE, removeSeedWords, 2)
console.log(stateString) console.log(stateString)
return stateString
} }
function removeSeedWords (key, value) { function removeSeedWords (key, value) {

Loading…
Cancel
Save