Update txRunner.ts

pull/5498/merge
fuder.eth 2 weeks ago committed by Aniket
parent 05832f5129
commit e61ed52672
  1. 10
      libs/remix-lib/src/execution/txRunner.ts

@ -16,7 +16,7 @@ export type Transaction = {
export class TxRunner { export class TxRunner {
event event
pendingTxs pendingTxs
queusTxs queueTxs
opt opt
internalRunner internalRunner
constructor (internalRunner, opt) { constructor (internalRunner, opt) {
@ -25,7 +25,7 @@ export class TxRunner {
this.event = new EventManager() this.event = new EventManager()
this.pendingTxs = {} this.pendingTxs = {}
this.queusTxs = [] this.queueTxs = []
} }
rawRun (args: Transaction, confirmationCb, gasEstimationForceSend, promptCb, cb) { rawRun (args: Transaction, confirmationCb, gasEstimationForceSend, promptCb, cb) {
@ -42,14 +42,14 @@ export class TxRunner {
function run (self, tx: Transaction, stamp, confirmationCb, gasEstimationForceSend = null, promptCb = null, callback = null) { function run (self, tx: Transaction, stamp, confirmationCb, gasEstimationForceSend = null, promptCb = null, callback = null) {
if (Object.keys(self.pendingTxs).length) { if (Object.keys(self.pendingTxs).length) {
return self.queusTxs.push({ tx, stamp, confirmationCb, gasEstimationForceSend, promptCb, callback }) return self.queueTxs.push({ tx, stamp, confirmationCb, gasEstimationForceSend, promptCb, callback })
} }
self.pendingTxs[stamp] = tx self.pendingTxs[stamp] = tx
self.execute(tx, confirmationCb, gasEstimationForceSend, promptCb, function (error, result) { self.execute(tx, confirmationCb, gasEstimationForceSend, promptCb, function (error, result) {
delete self.pendingTxs[stamp] delete self.pendingTxs[stamp]
if (callback && typeof callback === 'function') callback(error, result) if (callback && typeof callback === 'function') callback(error, result)
if (self.queusTxs.length) { if (self.queueTxs.length) {
const next = self.queusTxs.pop() const next = self.queueTxs.pop()
run(self, next.tx, next.stamp, next.confirmationCb, next.gasEstimationForceSend, next.promptCb, next.callback) run(self, next.tx, next.stamp, next.confirmationCb, next.gasEstimationForceSend, next.promptCb, next.callback)
} }
}) })

Loading…
Cancel
Save