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

Merge pull request #2590 from MetaMask/merge-master

Merge master
This commit is contained in:
Chi Kei Chan 2017-11-15 12:39:34 -08:00 committed by GitHub
commit fbd04a6af6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 53 additions and 17 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

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

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.'
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 stateString
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:

View File

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