Fix issue where old txMeta object was being used to pass the txHash to the cb

feature/default_network_editable
Frankie 8 years ago
parent f162a11585
commit b84f1b0532
  1. 8
      app/scripts/metamask-controller.js
  2. 2
      app/scripts/transaction-manager.js

@ -414,14 +414,14 @@ module.exports = class MetamaskController extends EventEmitter {
self.sendUpdate()
self.opts.showUnapprovedTx(txMeta)
// listen for tx completion (success, fail)
self.txManager.once(`${txMeta.id}:finished`, (status) => {
switch (status) {
self.txManager.once(`${txMeta.id}:finished`, (completedTx) => {
switch (completedTx.status) {
case 'submitted':
return cb(null, txMeta.hash)
return cb(null, completedTx.hash)
case 'rejected':
return cb(new Error('MetaMask Tx Signature: User denied transaction signature.'))
default:
return cb(new Error(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(txMeta.txParams)}`))
return cb(new Error(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(completedTx.txParams)}`))
}
})
})

@ -353,7 +353,7 @@ module.exports = class TransactionManager extends EventEmitter {
txMeta.status = status
this.emit(`${txMeta.id}:${status}`, txId)
if (status === 'submitted' || status === 'rejected') {
this.emit(`${txMeta.id}:finished`, status)
this.emit(`${txMeta.id}:finished`, txMeta)
}
this.updateTx(txMeta)
this.emit('updateBadge')

Loading…
Cancel
Save