mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #3808 from MetaMask/txMeta-origin
transactions - add origin to txMeta
This commit is contained in:
commit
e99a707e3d
@ -161,9 +161,11 @@ module.exports = class TransactionController extends EventEmitter {
|
|||||||
this.emit(`${txMeta.id}:unapproved`, txMeta)
|
this.emit(`${txMeta.id}:unapproved`, txMeta)
|
||||||
}
|
}
|
||||||
|
|
||||||
async newUnapprovedTransaction (txParams) {
|
async newUnapprovedTransaction (txParams, opts = {}) {
|
||||||
log.debug(`MetaMaskController newUnapprovedTransaction ${JSON.stringify(txParams)}`)
|
log.debug(`MetaMaskController newUnapprovedTransaction ${JSON.stringify(txParams)}`)
|
||||||
const initialTxMeta = await this.addUnapprovedTransaction(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)
|
// listen for tx completion (success, fail)
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.txStateManager.once(`${initialTxMeta.id}:finished`, (finishedTxMeta) => {
|
this.txStateManager.once(`${initialTxMeta.id}:finished`, (finishedTxMeta) => {
|
||||||
|
@ -57,7 +57,6 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
this.defaultMaxListeners = 20
|
this.defaultMaxListeners = 20
|
||||||
|
|
||||||
this.sendUpdate = debounce(this.privateSendUpdate.bind(this), 200)
|
this.sendUpdate = debounce(this.privateSendUpdate.bind(this), 200)
|
||||||
|
|
||||||
this.opts = opts
|
this.opts = opts
|
||||||
const initState = opts.initState || {}
|
const initState = opts.initState || {}
|
||||||
this.recordFirstTimeInfo(initState)
|
this.recordFirstTimeInfo(initState)
|
||||||
@ -242,6 +241,11 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
static: {
|
static: {
|
||||||
eth_syncing: false,
|
eth_syncing: false,
|
||||||
web3_clientVersion: `MetaMask/v${version}`,
|
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
|
// account mgmt
|
||||||
getAccounts: (cb) => {
|
getAccounts: (cb) => {
|
||||||
@ -256,7 +260,6 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
cb(null, result)
|
cb(null, result)
|
||||||
},
|
},
|
||||||
// tx signing
|
// tx signing
|
||||||
processTransaction: nodeify(async (txParams) => await this.txController.newUnapprovedTransaction(txParams), this),
|
|
||||||
// old style msg signing
|
// old style msg signing
|
||||||
processMessage: this.newUnsignedMessage.bind(this),
|
processMessage: this.newUnsignedMessage.bind(this),
|
||||||
// personal_sign msg signing
|
// personal_sign msg signing
|
||||||
|
24
package-lock.json
generated
24
package-lock.json
generated
@ -5747,7 +5747,7 @@
|
|||||||
"ethereumjs-vm": "2.3.2",
|
"ethereumjs-vm": "2.3.2",
|
||||||
"through2": "2.0.3",
|
"through2": "2.0.3",
|
||||||
"treeify": "1.1.0",
|
"treeify": "1.1.0",
|
||||||
"web3-provider-engine": "13.6.0"
|
"web3-provider-engine": "13.8.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ethereum-common": {
|
"ethereum-common": {
|
||||||
@ -19306,9 +19306,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"solc": {
|
"solc": {
|
||||||
"version": "0.4.20",
|
"version": "0.4.21",
|
||||||
"resolved": "https://registry.npmjs.org/solc/-/solc-0.4.20.tgz",
|
"resolved": "https://registry.npmjs.org/solc/-/solc-0.4.21.tgz",
|
||||||
"integrity": "sha512-LrP3Jp4FS3y8sduIR67y8Ss1riR3fggk5sMnx4OSCcU88Ro0e51+KVXyfH3NP6ghLo7COrLx/lGUaDDugCzdgA==",
|
"integrity": "sha512-8lJmimVjOG9AJOQRWS2ph4rSctPMsPGZ4H360HLs5iI+euUlt7iAvUxSLeFZZzwk0kas4Qta7HmlMXNU3yYwhw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"fs-extra": "0.30.0",
|
"fs-extra": "0.30.0",
|
||||||
"memorystream": "0.3.1",
|
"memorystream": "0.3.1",
|
||||||
@ -22309,9 +22309,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"web3-provider-engine": {
|
"web3-provider-engine": {
|
||||||
"version": "13.6.0",
|
"version": "13.8.0",
|
||||||
"resolved": "https://registry.npmjs.org/web3-provider-engine/-/web3-provider-engine-13.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/web3-provider-engine/-/web3-provider-engine-13.8.0.tgz",
|
||||||
"integrity": "sha512-iCsAlAeLWHxgx6EXuBm5GNg5VBqKtzmnrhEOfJBv8Cetukush7yOvo4RPjDZIynKxg9jfAlMmWqCk6wLxA6coQ==",
|
"integrity": "sha512-fZXhX5VWwWpoFfrfocslyg6P7cN3YWPG/ASaevNfeO80R+nzgoPUBXcWQekSGSsNDkeRTis4aMmpmofYf1TNtQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"async": "2.6.0",
|
"async": "2.6.0",
|
||||||
"clone": "2.1.1",
|
"clone": "2.1.1",
|
||||||
@ -22319,7 +22319,7 @@
|
|||||||
"eth-sig-util": "1.4.2",
|
"eth-sig-util": "1.4.2",
|
||||||
"ethereumjs-block": "1.7.0",
|
"ethereumjs-block": "1.7.0",
|
||||||
"ethereumjs-tx": "1.3.3",
|
"ethereumjs-tx": "1.3.3",
|
||||||
"ethereumjs-util": "5.1.4",
|
"ethereumjs-util": "5.1.5",
|
||||||
"ethereumjs-vm": "2.3.2",
|
"ethereumjs-vm": "2.3.2",
|
||||||
"fetch-ponyfill": "4.1.0",
|
"fetch-ponyfill": "4.1.0",
|
||||||
"json-rpc-error": "2.0.0",
|
"json-rpc-error": "2.0.0",
|
||||||
@ -22328,16 +22328,16 @@
|
|||||||
"readable-stream": "2.3.3",
|
"readable-stream": "2.3.3",
|
||||||
"request": "2.83.0",
|
"request": "2.83.0",
|
||||||
"semaphore": "1.1.0",
|
"semaphore": "1.1.0",
|
||||||
"solc": "0.4.20",
|
"solc": "0.4.21",
|
||||||
"tape": "4.8.0",
|
"tape": "4.8.0",
|
||||||
"xhr": "2.4.1",
|
"xhr": "2.4.1",
|
||||||
"xtend": "4.0.1"
|
"xtend": "4.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ethereumjs-util": {
|
"ethereumjs-util": {
|
||||||
"version": "5.1.4",
|
"version": "5.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.1.5.tgz",
|
||||||
"integrity": "sha512-wbeTc5prEzIWFSQUcEsCAZbqubtJKy6yS+oZMY1cGG6GLYzLjm4YhC2RNrWIg8hRYnclWpnZmx2zkiufQkmd3w==",
|
"integrity": "sha512-xPaSEATYJpMTCGowIt0oMZwFP4R1bxd6QsWgkcDvFL0JtXsr39p32WEcD14RscCjfP41YXZPCVWA4yAg0nrJmw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"bn.js": "4.11.8",
|
"bn.js": "4.11.8",
|
||||||
"create-hash": "1.1.3",
|
"create-hash": "1.1.3",
|
||||||
|
@ -185,7 +185,7 @@
|
|||||||
"valid-url": "^1.0.9",
|
"valid-url": "^1.0.9",
|
||||||
"vreme": "^3.0.2",
|
"vreme": "^3.0.2",
|
||||||
"web3": "^0.20.1",
|
"web3": "^0.20.1",
|
||||||
"web3-provider-engine": "^13.5.6",
|
"web3-provider-engine": "^13.8.0",
|
||||||
"web3-stream-provider": "^3.0.1",
|
"web3-stream-provider": "^3.0.1",
|
||||||
"xtend": "^4.0.1"
|
"xtend": "^4.0.1"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user