diff --git a/CHANGELOG.md b/CHANGELOG.md index 671bb7a6f..ee9548606 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,12 @@ ## Current Master +## 3.12.0 2017-10-25 + - Add support for alternative ENS TLDs (Ethereum Name Service Top-Level Domains). - Lower minimum gas price to 0.1 GWEI. - Remove web3 injection message from production (thanks to @ChainsawBaby) +- Add additional debugging info to our state logs, specifically OS version and browser version. ## 3.11.2 2017-10-21 diff --git a/app/manifest.json b/app/manifest.json index 65d7a4811..ff595c717 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,7 +1,7 @@ { "name": "MetaMask", "short_name": "Metamask", - "version": "4.0.3", + "version": "4.0.4", "manifest_version": 2, "author": "https://metamask.io", "description": "Ethereum Browser Extension", diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js index ef659a300..a861c0342 100644 --- a/app/scripts/controllers/transactions.js +++ b/app/scripts/controllers/transactions.js @@ -133,7 +133,7 @@ module.exports = class TransactionController extends EventEmitter { async newUnapprovedTransaction (txParams) { log.debug(`MetaMaskController newUnapprovedTransaction ${JSON.stringify(txParams)}`) const txMeta = await this.addUnapprovedTransaction(txParams) - this.emit('newUnaprovedTx', txMeta) + this.emit('newUnapprovedTx', txMeta) // listen for tx completion (success, fail) return new Promise((resolve, reject) => { this.txStateManager.once(`${txMeta.id}:finished`, (completedTx) => { @@ -170,6 +170,7 @@ module.exports = class TransactionController extends EventEmitter { async addTxDefaults (txMeta) { const txParams = txMeta.txParams // ensure value + txMeta.gasPriceSpecified = Boolean(txParams.gasPrice) const gasPrice = txParams.gasPrice || await this.query.gasPrice() txParams.gasPrice = ethUtil.addHexPrefix(gasPrice.toString(16)) txParams.value = txParams.value || '0x0' diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index a8a10e106..bd71da8e0 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -128,7 +128,7 @@ module.exports = class MetamaskController extends EventEmitter { blockTracker: this.blockTracker, ethQuery: this.ethQuery, }) - this.txController.on('newUnaprovedTx', opts.showUnapprovedTx.bind(opts)) + this.txController.on('newUnapprovedTx', opts.showUnapprovedTx.bind(opts)) // computed balances (accounting for pending transactions) this.balancesController = new BalancesController({ diff --git a/app/scripts/platforms/extension.js b/app/scripts/platforms/extension.js index 0afe04b74..2f47512eb 100644 --- a/app/scripts/platforms/extension.js +++ b/app/scripts/platforms/extension.js @@ -17,6 +17,15 @@ class ExtensionPlatform { return extension.runtime.getManifest().version } + getPlatformInfo (cb) { + try { + extension.runtime.getPlatformInfo((platform) => { + cb(null, platform) + }) + } catch (e) { + cb(e) + } + } } module.exports = ExtensionPlatform diff --git a/test/unit/tx-controller-test.js b/test/unit/tx-controller-test.js index bb51ab01f..aeefd5ec6 100644 --- a/test/unit/tx-controller-test.js +++ b/test/unit/tx-controller-test.js @@ -118,8 +118,8 @@ describe('Transaction Controller', function () { stub.restore() }) - it('should emit newUnaprovedTx event and pass txMeta as the first argument', function (done) { - txController.once('newUnaprovedTx', (txMetaFromEmit) => { + it('should emit newUnapprovedTx event and pass txMeta as the first argument', function (done) { + txController.once('newUnapprovedTx', (txMetaFromEmit) => { assert(txMetaFromEmit, 'txMeta is falsey') assert.equal(txMetaFromEmit.id, 1, 'the right txMeta was passed') done() @@ -129,7 +129,7 @@ describe('Transaction Controller', function () { }) it('should resolve when finished and status is submitted and resolve with the hash', function (done) { - txController.once('newUnaprovedTx', (txMetaFromEmit) => { + txController.once('newUnapprovedTx', (txMetaFromEmit) => { setTimeout(() => { txController.setTxHash(txMetaFromEmit.id, '0x0') txController.txStateManager.setTxStatusSubmitted(txMetaFromEmit.id) @@ -145,7 +145,7 @@ describe('Transaction Controller', function () { }) it('should reject when finished and status is rejected', function (done) { - txController.once('newUnaprovedTx', (txMetaFromEmit) => { + txController.once('newUnapprovedTx', (txMetaFromEmit) => { setTimeout(() => { txController.txStateManager.setTxStatusRejected(txMetaFromEmit.id) }, 10) diff --git a/ui/app/accounts/import/index.js b/ui/app/accounts/import/index.js index c66dcfc66..b7d9a9537 100644 --- a/ui/app/accounts/import/index.js +++ b/ui/app/accounts/import/index.js @@ -75,6 +75,7 @@ AccountImportSubview.prototype.render = function () { } }), onChange: (opt) => { + props.dispatch(actions.showImportPage()) this.setState({ type: opt.value }) }, }), diff --git a/ui/app/reducers.js b/ui/app/reducers.js index e1a890535..70b7e71dc 100644 --- a/ui/app/reducers.js +++ b/ui/app/reducers.js @@ -1,4 +1,5 @@ const extend = require('xtend') +const copyToClipboard = require('copy-to-clipboard') // // Sub-Reducers take in the complete state and return their sub-state @@ -41,17 +42,33 @@ function rootReducer (state, action) { return state } -window.logState = function () { +window.logStateString = function (cb) { const state = window.METAMASK_CACHED_LOG_STATE - let version - try { - version = global.platform.getVersion() - } catch (e) { - version = 'unable to load version.' - } - state.version = version - const stateString = JSON.stringify(state, removeSeedWords, 2) - return stateString + const version = global.platform.getVersion() + const browser = window.navigator.userAgent + return global.platform.getPlatformInfo((err, platform) => { + if (err) { + return cb(err) + } + state.version = version + state.platform = platform + state.browser = browser + const stateString = JSON.stringify(state, removeSeedWords, 2) + return cb(null, stateString) + }) +} + +window.logState = function (toClipboard) { + return window.logStateString((err, result) => { + if (err) { + console.error(err.message) + } else if (toClipboard) { + copyToClipboard(result) + console.log('State log copied') + } else { + console.log(result) + } + }) } function removeSeedWords (key, value) { diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index d84f264c9..3a4fb536d 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -175,6 +175,7 @@ function reduceApp (state, action) { name: 'import-menu', }, transForward: true, + warning: null, }) case actions.SHOW_INFO_PAGE: diff --git a/yarn.lock b/yarn.lock index 8f63c1fff..f8bd06cab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8379,6 +8379,10 @@ redux-logger@^3.0.6: dependencies: deep-diff "^0.3.5" +redux-test-utils@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/redux-test-utils/-/redux-test-utils-0.1.3.tgz#0d89100f100f86c7c7214976eaece88e7e45bf74" + redux-thunk@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.2.0.tgz#e615a16e16b47a19a515766133d1e3e99b7852e5"