aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js23
1 files changed, 2 insertions, 21 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 46a01c900..794ca1a9b 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -108,6 +108,7 @@ module.exports = class MetamaskController extends EventEmitter {
ethQuery: this.ethQuery,
ethStore: this.ethStore,
})
+ this.txController.on('newUnaprovedTx', opts.showUnapprovedTx.bind(opts))
// notices
this.noticeController = new NoticeController({
@@ -195,7 +196,7 @@ module.exports = class MetamaskController extends EventEmitter {
cb(null, result)
},
// tx signing
- processTransaction: nodeify(this.newUnapprovedTransaction, this),
+ processTransaction: nodeify(async (txParams) => await this.txController.newUnapprovedTransaction(txParams), this),
// old style msg signing
processMessage: this.newUnsignedMessage.bind(this),
@@ -440,26 +441,6 @@ module.exports = class MetamaskController extends EventEmitter {
// Identity Management
//
- async newUnapprovedTransaction (txParams) {
- log.debug(`MetaMaskController newUnapprovedTransaction ${JSON.stringify(txParams)}`)
- const txMeta = await this.txController.addUnapprovedTransaction(txParams)
- this.sendUpdate()
- this.opts.showUnapprovedTx(txMeta)
- // listen for tx completion (success, fail)
- return new Promise((resolve, reject) => {
- this.txController.once(`${txMeta.id}:finished`, (completedTx) => {
- switch (completedTx.status) {
- case 'submitted':
- return resolve(completedTx.hash)
- case 'rejected':
- return reject(new Error('MetaMask Tx Signature: User denied transaction signature.'))
- default:
- return reject(new Error(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(completedTx.txParams)}`))
- }
- })
- })
- }
-
newUnsignedMessage (msgParams, cb) {
const msgId = this.messageManager.addUnapprovedMessage(msgParams)
this.sendUpdate()