Provides a simple framework for receiving payloads to be processed.
a config object
OptionalmaxWaitTime: numberthe max wait time to wait before resyncing the sequence number to the current on-chain state, default to 30
OptionalmaximumInFlight: numbersubmit up to maximumInFlight transactions per account.
Mempool limits the number of transactions per account to 100, hence why we default to 100.
OptionalsleepTime: numberIf maximumInFlight are in flight, wait sleepTime seconds before re-evaluating, default to 10
ReadonlyaccountReadonlyaccountReadonlyaptostransactions that have been committed to chain
signed transactions waiting to be submitted
transactions that have been submitted to chain
Readonlytasktransactions payloads waiting to be generated and signed
TODO support entry function payload from ABI builder
StaticprefixedRest...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optionalcontext: anyOnce transaction has been sent to chain, we check for its execution status.
transactions that were sent to chain and are now waiting to be executed
the account's sequence number that was sent with the transaction
Calls each of the listeners registered for a given event.
Rest...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Return an array listing the events for which the emitter has registered listeners.
Generates a signed transaction that can be submitted to chain
an Aptos account
a sequence number the transaction will be generated with
Return the number of listeners listening to a given event.
Return the listeners registered for a given event.
Optionalfn: ((...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]) => void)Rest...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optionalcontext: anyOptionalonce: booleanAdd a listener for a given event.
Rest...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optionalcontext: anyAdd a one-time listener for a given event.
Rest...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optionalcontext: anyReads the outstanding transaction queue and submits the transaction to chain.
If the transaction has fulfilled, it pushes the transaction to the processed transactions queue and fires a transactionsFulfilled event.
If the transaction has failed, it pushes the transaction to the processed transactions queue with the failure reason and fires a transactionsFailed event.
Push transaction to the transactions queue
Transaction payload
Optionaloptions: InputGenerateTransactionOptionsRemove the listeners of a given event.
Optionalfn: ((...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]) => void)Rest...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optionalcontext: anyOptionalonce: boolean
TransactionWorker provides a simple framework for receiving payloads to be processed.
Once one
start()the process and pushes a new transaction, the worker acquires the current account's next sequence number (by using the AccountSequenceNumber class), generates a signed transaction and pushes an async submission process into theoutstandingTransactionsqueue. At the same time, the worker processes transactions by reading theoutstandingTransactionsqueue and submits the next transaction to chain, it