1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

mv updateAndApproveTx to txController

This commit is contained in:
frankiebee 2017-07-12 15:07:56 -07:00
parent da35f6744e
commit bd26ec46aa

View File

@ -183,7 +183,7 @@ module.exports = class TransactionController extends EventEmitter {
}, {}) }, {})
} }
async approveTransaction (txId, cb = warn) { async approveTransaction (txId) {
let nonceLock let nonceLock
try { try {
// approve // approve
@ -199,7 +199,6 @@ module.exports = class TransactionController extends EventEmitter {
await this.publishTransaction(txId, rawTx) await this.publishTransaction(txId, rawTx)
// must set transaction to submitted/failed before releasing lock // must set transaction to submitted/failed before releasing lock
nonceLock.releaseLock() nonceLock.releaseLock()
cb()
} catch (err) { } catch (err) {
this.setTxStatusFailed(txId, { this.setTxStatusFailed(txId, {
errCode: err.errCode || err, errCode: err.errCode || err,
@ -208,7 +207,7 @@ module.exports = class TransactionController extends EventEmitter {
// must set transaction to submitted/failed before releasing lock // must set transaction to submitted/failed before releasing lock
if (nonceLock) nonceLock.releaseLock() if (nonceLock) nonceLock.releaseLock()
// continue with error chain // continue with error chain
cb(err) throw err
} }
} }
@ -217,6 +216,11 @@ module.exports = class TransactionController extends EventEmitter {
cb() cb()
} }
async updateAndApproveTransaction (txMeta) {
this.updateTx(txMeta)
await this.approveTransaction(txMeta.id)
}
getChainId () { getChainId () {
const networkState = this.networkStore.getState() const networkState = this.networkStore.getState()
const getChainId = parseInt(networkState) const getChainId = parseInt(networkState)