Initializes a new instance of the class, providing a framework for receiving payloads to be processed.
A configuration object for Aptos.
The account that will be used for sending transactions.
The maximum wait time to wait before re-syncing the sequence number to the current on-chain state, default is 30 seconds.
The maximum number of transactions that can be submitted per account, default is 100.
The time to wait in seconds before re-evaluating if the maximum number of transactions are in flight, default is 10 seconds.
Reads the outstanding transaction queue and submits the transactions to the chain. This function processes each transaction, checking their status and emitting events based on whether they were successfully sent or failed.
Throws an error if the process execution fails. TransactionWorkerEventsEnum.TransactionSent - Emitted when a transaction has been successfully committed to the chain. TransactionWorkerEventsEnum.TransactionSendFailed - Emitted when a transaction fails to commit, along with the error reason. TransactionWorkerEventsEnum.ExecutionFinish - Emitted when the execution of transactions is complete.
Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyOnce a transaction has been sent to the chain, this function checks for its execution status.
The transaction that was sent to the chain and is 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 the chain.
An Aptos account used as the sender of the transaction.
A sequence number the transaction will be generated with.
A signed transaction object or undefined if the transaction queue is empty.
Return the number of listeners listening to a given event.
Return the listeners registered for a given event.
Optional
fn: ((...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]) => void)Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyOptional
once: booleanAdd a listener for a given event.
Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyAdd a one-time listener for a given event.
Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyPushes a transaction to the transactions queue for processing.
The transaction payload containing necessary details.
Optional
options: InputGenerateTransactionOptionsOptional parameters for transaction configuration.
Remove the listeners of a given event.
Optional
fn: ((...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]) => void)Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyOptional
once: booleanSubmits the next transaction for the account by generating it with the current sequence number and adding it to the outstanding transaction queue for processing. This function continues to submit transactions until there are no more to process.
Readonly
accountReadonly
accountReadonly
aptostransactions that have been committed to chain
signed transactions waiting to be submitted
transactions that have been submitted to chain
Readonly
tasktransactions payloads waiting to be generated and signed
TODO support entry function payload from ABI builder
Static
prefixed
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 theoutstandingTransactions
queue. At the same time, the worker processes transactions by reading theoutstandingTransactions
queue and submits the next transaction to chain, it