From 1eb4a5d62c4fdc8a16c7913c9027e0b11c01da52 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 27 Feb 2017 18:25:46 -0800 Subject: [PATCH] Add background method for updating and approving a tx in one call --- app/scripts/metamask-controller.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index f172c67a8..105bb3d19 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -276,8 +276,9 @@ module.exports = class MetamaskController extends EventEmitter { exportAccount: nodeify(keyringController.exportAccount).bind(keyringController), // txManager - approveTransaction: txManager.approveTransaction.bind(txManager), - cancelTransaction: txManager.cancelTransaction.bind(txManager), + approveTransaction: txManager.approveTransaction.bind(txManager), + cancelTransaction: txManager.cancelTransaction.bind(txManager), + updateAndApproveTransaction: this.updateAndApproveTx.bind(this), // messageManager signMessage: nodeify(this.signMessage).bind(this), @@ -462,6 +463,12 @@ module.exports = class MetamaskController extends EventEmitter { }) } + updateAndApproveTx(txMeta, cb) { + const txManager = this.txManager + txManager.updateTx(txMeta) + txManager.approveTransaction(txMeta.id, cb) + } + signMessage (msgParams, cb) { log.info('MetaMaskController - signMessage') const msgId = msgParams.metamaskId