diff options
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.` |