diff options
author | Frances Pangilinan <frankie.diamond@gmail.com> | 2016-12-21 05:12:14 +0800 |
---|---|---|
committer | Frances Pangilinan <frankie.diamond@gmail.com> | 2016-12-22 05:41:49 +0800 |
commit | 1ebcbe296b060c9cf431d485d7bb84f696edbdf5 (patch) | |
tree | 0b9cf46894b54f61476b2ebc74d069cab6dc46cd /app/scripts/metamask-controller.js | |
parent | 6e78494846c9032fbf1264a0225c0df4df0867cb (diff) | |
download | tangerine-wallet-browser-1ebcbe296b060c9cf431d485d7bb84f696edbdf5.tar tangerine-wallet-browser-1ebcbe296b060c9cf431d485d7bb84f696edbdf5.tar.gz tangerine-wallet-browser-1ebcbe296b060c9cf431d485d7bb84f696edbdf5.tar.bz2 tangerine-wallet-browser-1ebcbe296b060c9cf431d485d7bb84f696edbdf5.tar.lz tangerine-wallet-browser-1ebcbe296b060c9cf431d485d7bb84f696edbdf5.tar.xz tangerine-wallet-browser-1ebcbe296b060c9cf431d485d7bb84f696edbdf5.tar.zst tangerine-wallet-browser-1ebcbe296b060c9cf431d485d7bb84f696edbdf5.zip |
Migrate all tx mutation code out of keyring controller and
Fix up txManager to reflect code review requests
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r-- | app/scripts/metamask-controller.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index d5b70c647..7798a6a60 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -39,6 +39,8 @@ module.exports = class MetamaskController { }) this.publicConfigStore = this.initPublicConfigStore() + + var currentFiat = this.configManager.getCurrentFiat() || 'USD' this.configManager.setCurrentFiat(currentFiat) this.configManager.updateConversionRate() @@ -152,8 +154,8 @@ module.exports = class MetamaskController { // tx signing approveTransaction: this.newUnsignedTransaction.bind(this), signTransaction: (...args) => { - var signedTxPromise = keyringController.signTransaction(...args) - this.txManager.resolveSignedTransaction(signedTxPromise) + this.setupSigningListners(...args) + this.txManager.formatTxForSigining(...args) this.sendUpdate() }, @@ -232,6 +234,14 @@ module.exports = class MetamaskController { }) } + setupSigningListners (txParams) { + var txId = txParams.metamaskId + // apply event listeners for signing and formating events + this.txManager.once(`${txId}:formated`, this.keyringController.signTransaction.bind(this.keyringController)) + this.keyringController.once(`${txId}:signed`, this.txManager.resolveSignedTransaction.bind(this.txManager)) + } + + enforceTxValidations (txParams) { if (('value' in txParams) && txParams.value.indexOf('-') === 0) { const msg = `Invalid transaction value of ${txParams.value} not a positive number.` |