From 998128d4dfd246ecf7bc206536f6143da4c97bbd Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Sun, 7 May 2017 15:20:56 -0700 Subject: [PATCH 01/12] allow copy(logState()) to copy to clipboard --- ui/app/reducers.js | 1 + 1 file changed, 1 insertion(+) 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) { From a09dca68a456ba0406b9d88556e44f9a1e0f8c57 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Sun, 7 May 2017 16:44:23 -0700 Subject: [PATCH 02/12] Fix changelog formatting --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d552e6ab8..627f13aea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,6 @@ ## 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. From f17c6b4eef8defe55e316ee782b499072e1e795a Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Sun, 7 May 2017 16:44:43 -0700 Subject: [PATCH 03/12] Fix ens iterated element without key error --- ui/app/components/ens-input.js | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js index f1cf49998..001c227c4 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, }) }), ]), From 80d8a4e73ef2d55dd9024f6e4f8cf94f263703cc Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Sun, 7 May 2017 16:51:57 -0700 Subject: [PATCH 04/12] Input gas in gwei Also enforces "safe low gas" minimum recommended by this article by eth-gas-station: https://medium.com/@ethgasstation/the-safe-low-gas-price-fb44fdc85b91 Fixes #1381 --- ui/app/components/pending-tx.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index 4b28ae099..c381066a9 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(Math.pow(10, 9)) +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(new BN(Math.pow(10, 9))) 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) }, From 17accd3a200109b286fda0920b1a73edeeedfaa2 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Sun, 7 May 2017 16:53:14 -0700 Subject: [PATCH 05/12] Bump changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 627f13aea..8a57cc217 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Current Master +- Input gas price in Gwei. +- Enforce Safe Gas Minimum recommended by EthGasStation. + ## 3.6.1 2017-4-30 - Made fox less nosy. From 0d39de6d66aab2b87ea7415cb5451ac61c055fd8 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 8 May 2017 09:53:30 -0700 Subject: [PATCH 06/12] Run install before dist --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6e83b3560..8e63c2467 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", From 469648239fc94a6599a0b2483364a8a74d66e5a1 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 8 May 2017 09:55:14 -0700 Subject: [PATCH 07/12] Linted --- app/scripts/lib/config-manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js index 340ad4292..ab9410842 100644 --- a/app/scripts/lib/config-manager.js +++ b/app/scripts/lib/config-manager.js @@ -155,7 +155,7 @@ ConfigManager.prototype.getCurrentRpcAddress = function () { case 'kovan': return KOVAN_RPC - + case 'rinkeby': return RINKEBY_RPC From d7a2d29e6c6fadae5fa7f94d1bd2762560534463 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 8 May 2017 12:04:57 -0700 Subject: [PATCH 08/12] fix block polling changelog note --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a57cc217..c94799a8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,12 @@ - Input gas price in Gwei. - Enforce Safe Gas Minimum recommended by EthGasStation. +- Fix bug where block-tracker could stop polling for new blocks. ## 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 From e921f7f13a81bbf2e10fb996a001f16daf944940 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 8 May 2017 13:32:45 -0700 Subject: [PATCH 09/12] Add changelog entry for 1390 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c94799a8a..157c4186a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - 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 From c7b2f2f2e986981496168dbf57cee787882ffd59 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 8 May 2017 13:34:01 -0700 Subject: [PATCH 10/12] Cleanup --- ui/app/components/pending-tx.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index c381066a9..71d4d767a 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -16,7 +16,7 @@ const nameForAddress = require('../../lib/contract-namer') const HexInput = require('./hex-as-decimal-input') const MIN_GAS_PRICE_GWEI_BN = new BN(2) -const GWEI_FACTOR = new BN(Math.pow(10, 9)) +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) @@ -54,7 +54,7 @@ PendingTx.prototype.render = function () { // Gas Price const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(16) const gasPriceBn = hexToBn(gasPrice) - const gasPriceGweiBn = gasPriceBn.div(new BN(Math.pow(10, 9))) + const gasPriceGweiBn = gasPriceBn.div(GWEI_FACTOR) const txFeeBn = gasBn.mul(gasPriceBn) const valueBn = hexToBn(txParams.value) From d61b587f3014823fcd23b1e5becce7949e88d952 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 8 May 2017 16:02:41 -0700 Subject: [PATCH 11/12] Redefine txmeta when submitting. --- ui/app/components/pending-tx.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index 71d4d767a..5ea885195 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -76,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() @@ -418,4 +419,3 @@ function forwardCarrat () { ) } - From f131f59c82ed7446d98c4d2301ce83aa25877d49 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 8 May 2017 16:03:28 -0700 Subject: [PATCH 12/12] Changelog bump --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 157c4186a..2d3c1513a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - 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