Merge branch 'master' into merge-master

feature/default_network_editable
Chi Kei Chan 7 years ago
commit e61ba93194
  1. 3
      CHANGELOG.md
  2. 3
      app/scripts/controllers/transactions.js
  3. 2
      app/scripts/metamask-controller.js
  4. 9
      app/scripts/platforms/extension.js
  5. 8
      test/unit/tx-controller-test.js
  6. 1
      ui/app/accounts/import/index.js
  7. 37
      ui/app/reducers.js
  8. 1
      ui/app/reducers/app.js

@ -2,9 +2,12 @@
## Current Master ## Current Master
## 3.12.0 2017-10-25
- Add support for alternative ENS TLDs (Ethereum Name Service Top-Level Domains). - Add support for alternative ENS TLDs (Ethereum Name Service Top-Level Domains).
- Lower minimum gas price to 0.1 GWEI. - Lower minimum gas price to 0.1 GWEI.
- Remove web3 injection message from production (thanks to @ChainsawBaby) - 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 ## 3.11.2 2017-10-21

@ -133,7 +133,7 @@ module.exports = class TransactionController extends EventEmitter {
async newUnapprovedTransaction (txParams) { async newUnapprovedTransaction (txParams) {
log.debug(`MetaMaskController newUnapprovedTransaction ${JSON.stringify(txParams)}`) log.debug(`MetaMaskController newUnapprovedTransaction ${JSON.stringify(txParams)}`)
const txMeta = await this.addUnapprovedTransaction(txParams) const txMeta = await this.addUnapprovedTransaction(txParams)
this.emit('newUnaprovedTx', txMeta) this.emit('newUnapprovedTx', txMeta)
// listen for tx completion (success, fail) // listen for tx completion (success, fail)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.txStateManager.once(`${txMeta.id}:finished`, (completedTx) => { this.txStateManager.once(`${txMeta.id}:finished`, (completedTx) => {
@ -170,6 +170,7 @@ module.exports = class TransactionController extends EventEmitter {
async addTxDefaults (txMeta) { async addTxDefaults (txMeta) {
const txParams = txMeta.txParams const txParams = txMeta.txParams
// ensure value // ensure value
txMeta.gasPriceSpecified = Boolean(txParams.gasPrice)
const gasPrice = txParams.gasPrice || await this.query.gasPrice() const gasPrice = txParams.gasPrice || await this.query.gasPrice()
txParams.gasPrice = ethUtil.addHexPrefix(gasPrice.toString(16)) txParams.gasPrice = ethUtil.addHexPrefix(gasPrice.toString(16))
txParams.value = txParams.value || '0x0' txParams.value = txParams.value || '0x0'

@ -128,7 +128,7 @@ module.exports = class MetamaskController extends EventEmitter {
blockTracker: this.blockTracker, blockTracker: this.blockTracker,
ethQuery: this.ethQuery, 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) // computed balances (accounting for pending transactions)
this.balancesController = new BalancesController({ this.balancesController = new BalancesController({

@ -17,6 +17,15 @@ class ExtensionPlatform {
return extension.runtime.getManifest().version return extension.runtime.getManifest().version
} }
getPlatformInfo (cb) {
try {
extension.runtime.getPlatformInfo((platform) => {
cb(null, platform)
})
} catch (e) {
cb(e)
}
}
} }
module.exports = ExtensionPlatform module.exports = ExtensionPlatform

@ -118,8 +118,8 @@ describe('Transaction Controller', function () {
stub.restore() stub.restore()
}) })
it('should emit newUnaprovedTx event and pass txMeta as the first argument', function (done) { it('should emit newUnapprovedTx event and pass txMeta as the first argument', function (done) {
txController.once('newUnaprovedTx', (txMetaFromEmit) => { txController.once('newUnapprovedTx', (txMetaFromEmit) => {
assert(txMetaFromEmit, 'txMeta is falsey') assert(txMetaFromEmit, 'txMeta is falsey')
assert.equal(txMetaFromEmit.id, 1, 'the right txMeta was passed') assert.equal(txMetaFromEmit.id, 1, 'the right txMeta was passed')
done() 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) { 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(() => { setTimeout(() => {
txController.setTxHash(txMetaFromEmit.id, '0x0') txController.setTxHash(txMetaFromEmit.id, '0x0')
txController.txStateManager.setTxStatusSubmitted(txMetaFromEmit.id) txController.txStateManager.setTxStatusSubmitted(txMetaFromEmit.id)
@ -145,7 +145,7 @@ describe('Transaction Controller', function () {
}) })
it('should reject when finished and status is rejected', function (done) { it('should reject when finished and status is rejected', function (done) {
txController.once('newUnaprovedTx', (txMetaFromEmit) => { txController.once('newUnapprovedTx', (txMetaFromEmit) => {
setTimeout(() => { setTimeout(() => {
txController.txStateManager.setTxStatusRejected(txMetaFromEmit.id) txController.txStateManager.setTxStatusRejected(txMetaFromEmit.id)
}, 10) }, 10)

@ -75,6 +75,7 @@ AccountImportSubview.prototype.render = function () {
} }
}), }),
onChange: (opt) => { onChange: (opt) => {
props.dispatch(actions.showImportPage())
this.setState({ type: opt.value }) this.setState({ type: opt.value })
}, },
}), }),

@ -1,4 +1,5 @@
const extend = require('xtend') const extend = require('xtend')
const copyToClipboard = require('copy-to-clipboard')
// //
// Sub-Reducers take in the complete state and return their sub-state // Sub-Reducers take in the complete state and return their sub-state
@ -41,17 +42,33 @@ function rootReducer (state, action) {
return state return state
} }
window.logState = function () { window.logStateString = function (cb) {
const state = window.METAMASK_CACHED_LOG_STATE const state = window.METAMASK_CACHED_LOG_STATE
let version const version = global.platform.getVersion()
try { const browser = window.navigator.userAgent
version = global.platform.getVersion() return global.platform.getPlatformInfo((err, platform) => {
} catch (e) { if (err) {
version = 'unable to load version.' return cb(err)
} }
state.version = version state.version = version
const stateString = JSON.stringify(state, removeSeedWords, 2) state.platform = platform
return stateString 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) { function removeSeedWords (key, value) {

@ -175,6 +175,7 @@ function reduceApp (state, action) {
name: 'import-menu', name: 'import-menu',
}, },
transForward: true, transForward: true,
warning: null,
}) })
case actions.SHOW_INFO_PAGE: case actions.SHOW_INFO_PAGE:

Loading…
Cancel
Save