1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 09:23:21 +01:00

Merge branch 'master' into merge-master

This commit is contained in:
Chi Kei Chan 2017-11-15 12:03:13 -08:00
commit e61ba93194
8 changed files with 48 additions and 16 deletions

View File

@ -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

View File

@ -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'

View File

@ -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({

View File

@ -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

View File

@ -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)

View File

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

View File

@ -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) {

View File

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