aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2017-05-09 07:07:34 +0800
committerGitHub <noreply@github.com>2017-05-09 07:07:34 +0800
commitea4e4a32645f4123ec4e933fdb4db91d1ca8b92e (patch)
tree4f50cad1cbd43992143886c01d7d27d6ca0cf63c
parent09a0e7ed89c25698161e1952e93160c99456f656 (diff)
parentf131f59c82ed7446d98c4d2301ce83aa25877d49 (diff)
downloadtangerine-wallet-browser-ea4e4a32645f4123ec4e933fdb4db91d1ca8b92e.tar
tangerine-wallet-browser-ea4e4a32645f4123ec4e933fdb4db91d1ca8b92e.tar.gz
tangerine-wallet-browser-ea4e4a32645f4123ec4e933fdb4db91d1ca8b92e.tar.bz2
tangerine-wallet-browser-ea4e4a32645f4123ec4e933fdb4db91d1ca8b92e.tar.lz
tangerine-wallet-browser-ea4e4a32645f4123ec4e933fdb4db91d1ca8b92e.tar.xz
tangerine-wallet-browser-ea4e4a32645f4123ec4e933fdb4db91d1ca8b92e.tar.zst
tangerine-wallet-browser-ea4e4a32645f4123ec4e933fdb4db91d1ca8b92e.zip
Merge pull request #1382 from MetaMask/i1381-GasPriceInGwei
Set gas price in gwei
-rw-r--r--CHANGELOG.md9
-rw-r--r--package.json2
-rw-r--r--ui/app/components/ens-input.js1
-rw-r--r--ui/app/components/pending-tx.js23
-rw-r--r--ui/app/reducers.js1
5 files changed, 24 insertions, 12 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d552e6ab8..2d3c1513a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,13 +2,16 @@
## 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.
+- Fix bug where gas parameters would not properly update on adjustment.
+
## 3.6.1 2017-4-30
- Made fox less nosy.
-
-
- 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
diff --git a/package.json b/package.json
index 1ec784a69..e2268d20a 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"start": "npm run dev",
"dev": "gulp dev --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-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",
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..5ea885195 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)
@@ -70,6 +76,7 @@ PendingTx.prototype.render = function () {
h('form#pending-tx-form', {
onSubmit: (event) => {
+ const txMeta = this.gatherTxMeta()
event.preventDefault()
const form = document.querySelector('form#pending-tx-form')
const valid = form.checkValidity()
@@ -187,17 +194,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) },
@@ -411,4 +419,3 @@ function forwardCarrat () {
)
}
-
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) {