|
|
@ -43,6 +43,18 @@ module.exports = class TransactionController extends EventEmitter { |
|
|
|
txHistoryLimit: opts.txHistoryLimit, |
|
|
|
txHistoryLimit: opts.txHistoryLimit, |
|
|
|
getNetwork: this.getNetwork.bind(this), |
|
|
|
getNetwork: this.getNetwork.bind(this), |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.txStateManager.getFilteredTxList({ |
|
|
|
|
|
|
|
status: 'unapproved', |
|
|
|
|
|
|
|
loadingDefaults: true, |
|
|
|
|
|
|
|
}).forEach((tx) => { |
|
|
|
|
|
|
|
this.addTxDefaults(tx) |
|
|
|
|
|
|
|
.then((txMeta) => { |
|
|
|
|
|
|
|
txMeta.loadingDefaults = false |
|
|
|
|
|
|
|
this.txStateManager.updateTx(txMeta, 'transactions: gas estimation for tx on boot') |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
this.store = this.txStateManager.store |
|
|
|
this.store = this.txStateManager.store |
|
|
|
this.txStateManager.on('tx:status-update', this.emit.bind(this, 'tx:status-update')) |
|
|
|
this.txStateManager.on('tx:status-update', this.emit.bind(this, 'tx:status-update')) |
|
|
|
this.nonceTracker = new NonceTracker({ |
|
|
|
this.nonceTracker = new NonceTracker({ |
|
|
@ -171,11 +183,17 @@ module.exports = class TransactionController extends EventEmitter { |
|
|
|
this.addTx(txMeta) |
|
|
|
this.addTx(txMeta) |
|
|
|
this.emit('newUnapprovedTx', txMeta) |
|
|
|
this.emit('newUnapprovedTx', txMeta) |
|
|
|
// add default tx params
|
|
|
|
// add default tx params
|
|
|
|
|
|
|
|
try { |
|
|
|
await this.addTxDefaults(txMeta) |
|
|
|
await this.addTxDefaults(txMeta) |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
|
|
console.log(error) |
|
|
|
|
|
|
|
this.txStateManager.setTxStatusFailed(txMeta.id, error) |
|
|
|
|
|
|
|
throw error |
|
|
|
|
|
|
|
} |
|
|
|
txMeta.loadingDefaults = false |
|
|
|
txMeta.loadingDefaults = false |
|
|
|
// save txMeta
|
|
|
|
// save txMeta
|
|
|
|
this.txStateManager.updateTx(txMeta) |
|
|
|
this.txStateManager.updateTx(txMeta) |
|
|
|
|
|
|
|
|
|
|
|
return txMeta |
|
|
|
return txMeta |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|