feature/default_network_editable
Alexander Tseung 7 years ago
commit 51ad2b03c8
  1. 4
      app/scripts/controllers/transactions.js
  2. 7
      app/scripts/metamask-controller.js
  3. 11
      gulpfile.js
  4. 24
      package-lock.json
  5. 3
      package.json

@ -161,9 +161,11 @@ module.exports = class TransactionController extends EventEmitter {
this.emit(`${txMeta.id}:unapproved`, txMeta)
}
async newUnapprovedTransaction (txParams) {
async newUnapprovedTransaction (txParams, opts = {}) {
log.debug(`MetaMaskController newUnapprovedTransaction ${JSON.stringify(txParams)}`)
const initialTxMeta = await this.addUnapprovedTransaction(txParams)
initialTxMeta.origin = opts.origin
this.txStateManager.updateTx(initialTxMeta, '#newUnapprovedTransaction - adding the origin')
// listen for tx completion (success, fail)
return new Promise((resolve, reject) => {
this.txStateManager.once(`${initialTxMeta.id}:finished`, (finishedTxMeta) => {

@ -57,7 +57,6 @@ module.exports = class MetamaskController extends EventEmitter {
this.defaultMaxListeners = 20
this.sendUpdate = debounce(this.privateSendUpdate.bind(this), 200)
this.opts = opts
const initState = opts.initState || {}
this.recordFirstTimeInfo(initState)
@ -242,6 +241,11 @@ module.exports = class MetamaskController extends EventEmitter {
static: {
eth_syncing: false,
web3_clientVersion: `MetaMask/v${version}`,
eth_sendTransaction: (payload, next, end) => {
const origin = payload.origin
const txParams = payload.params[0]
nodeify(this.txController.newUnapprovedTransaction, this.txController)(txParams, { origin }, end)
},
},
// account mgmt
getAccounts: (cb) => {
@ -256,7 +260,6 @@ module.exports = class MetamaskController extends EventEmitter {
cb(null, result)
},
// tx signing
processTransaction: nodeify(async (txParams) => await this.txController.newUnapprovedTransaction(txParams), this),
// old style msg signing
processMessage: this.newUnsignedMessage.bind(this),
// personal_sign msg signing

@ -16,7 +16,6 @@ const eslint = require('gulp-eslint')
const fs = require('fs')
const path = require('path')
const manifest = require('./app/manifest.json')
const gulpif = require('gulp-if')
const replace = require('gulp-replace')
const mkdirp = require('mkdirp')
const asyncEach = require('async/each')
@ -31,8 +30,6 @@ const debug = require('gulp-debug')
const pify = require('pify')
const endOfStream = pify(require('end-of-stream'))
const disableDebugTools = gutil.env.disableDebugTools
const debugMode = gutil.env.debug
const browserPlatforms = [
'firefox',
@ -181,12 +178,12 @@ gulp.task('manifest:production', function() {
],{base: './dist/'})
// Exclude chromereload script in production:
.pipe(gulpif(!debugMode,jsoneditor(function(json) {
.pipe(jsoneditor(function(json) {
json.background.scripts = json.background.scripts.filter((script) => {
return !script.includes('chromereload')
})
return json
})))
}))
.pipe(gulp.dest('./dist/', { overwrite: true }))
})
@ -311,6 +308,7 @@ function createTasksForBuildJsExtension({ buildJsFiles, taskPrefix, devMode, bun
minifyBuild: !devMode,
buildWithFullPaths: devMode,
watch: devMode,
devMode,
}, bundleTaskOpts)
createTasksForBuildJs({ rootDir, taskPrefix, bundleTaskOpts, destinations, buildPhase1, buildPhase2 })
}
@ -326,6 +324,7 @@ function createTasksForBuildJsMascara({ taskPrefix, devMode, bundleTaskOpts = {}
minifyBuild: !devMode,
buildWithFullPaths: devMode,
watch: devMode,
devMode,
}, bundleTaskOpts)
createTasksForBuildJs({ rootDir, taskPrefix, bundleTaskOpts, destinations, buildPhase1 })
}
@ -541,7 +540,7 @@ function bundleTask(opts) {
// convert bundle stream to gulp vinyl stream
.pipe(source(opts.filename))
// inject variables into bundle
.pipe(replace('\'GULP_METAMASK_DEBUG\'', debugMode))
.pipe(replace('\'GULP_METAMASK_DEBUG\'', opts.devMode))
// buffer file contents (?)
.pipe(buffer())

24
package-lock.json generated

@ -5747,7 +5747,7 @@
"ethereumjs-vm": "2.3.2",
"through2": "2.0.3",
"treeify": "1.1.0",
"web3-provider-engine": "13.6.0"
"web3-provider-engine": "13.8.0"
}
},
"ethereum-common": {
@ -19306,9 +19306,9 @@
}
},
"solc": {
"version": "0.4.20",
"resolved": "https://registry.npmjs.org/solc/-/solc-0.4.20.tgz",
"integrity": "sha512-LrP3Jp4FS3y8sduIR67y8Ss1riR3fggk5sMnx4OSCcU88Ro0e51+KVXyfH3NP6ghLo7COrLx/lGUaDDugCzdgA==",
"version": "0.4.21",
"resolved": "https://registry.npmjs.org/solc/-/solc-0.4.21.tgz",
"integrity": "sha512-8lJmimVjOG9AJOQRWS2ph4rSctPMsPGZ4H360HLs5iI+euUlt7iAvUxSLeFZZzwk0kas4Qta7HmlMXNU3yYwhw==",
"requires": {
"fs-extra": "0.30.0",
"memorystream": "0.3.1",
@ -22309,9 +22309,9 @@
}
},
"web3-provider-engine": {
"version": "13.6.0",
"resolved": "https://registry.npmjs.org/web3-provider-engine/-/web3-provider-engine-13.6.0.tgz",
"integrity": "sha512-iCsAlAeLWHxgx6EXuBm5GNg5VBqKtzmnrhEOfJBv8Cetukush7yOvo4RPjDZIynKxg9jfAlMmWqCk6wLxA6coQ==",
"version": "13.8.0",
"resolved": "https://registry.npmjs.org/web3-provider-engine/-/web3-provider-engine-13.8.0.tgz",
"integrity": "sha512-fZXhX5VWwWpoFfrfocslyg6P7cN3YWPG/ASaevNfeO80R+nzgoPUBXcWQekSGSsNDkeRTis4aMmpmofYf1TNtQ==",
"requires": {
"async": "2.6.0",
"clone": "2.1.1",
@ -22319,7 +22319,7 @@
"eth-sig-util": "1.4.2",
"ethereumjs-block": "1.7.0",
"ethereumjs-tx": "1.3.3",
"ethereumjs-util": "5.1.4",
"ethereumjs-util": "5.1.5",
"ethereumjs-vm": "2.3.2",
"fetch-ponyfill": "4.1.0",
"json-rpc-error": "2.0.0",
@ -22328,16 +22328,16 @@
"readable-stream": "2.3.3",
"request": "2.83.0",
"semaphore": "1.1.0",
"solc": "0.4.20",
"solc": "0.4.21",
"tape": "4.8.0",
"xhr": "2.4.1",
"xtend": "4.0.1"
},
"dependencies": {
"ethereumjs-util": {
"version": "5.1.4",
"resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.1.4.tgz",
"integrity": "sha512-wbeTc5prEzIWFSQUcEsCAZbqubtJKy6yS+oZMY1cGG6GLYzLjm4YhC2RNrWIg8hRYnclWpnZmx2zkiufQkmd3w==",
"version": "5.1.5",
"resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.1.5.tgz",
"integrity": "sha512-xPaSEATYJpMTCGowIt0oMZwFP4R1bxd6QsWgkcDvFL0JtXsr39p32WEcD14RscCjfP41YXZPCVWA4yAg0nrJmw==",
"requires": {
"bn.js": "4.11.8",
"create-hash": "1.1.3",

@ -187,7 +187,7 @@
"valid-url": "^1.0.9",
"vreme": "^3.0.2",
"web3": "^0.20.1",
"web3-provider-engine": "^13.5.6",
"web3-provider-engine": "^13.8.0",
"web3-stream-provider": "^3.0.1",
"xtend": "^4.0.1"
},
@ -223,7 +223,6 @@
"gulp": "github:gulpjs/gulp#6d71a658c61edb3090221579d8f97dbe086ba2ed",
"gulp-babel": "^7.0.0",
"gulp-eslint": "^4.0.0",
"gulp-if": "^2.0.2",
"gulp-json-editor": "^2.2.1",
"gulp-livereload": "^3.8.1",
"gulp-replace": "^0.6.1",

Loading…
Cancel
Save