Provides a simple framework for receiving payloads to be processed.
a config object
the max wait time to wait before resyncing the sequence number to the current on-chain state, default to 30
submit up to maximumInFlight
transactions per account.
Mempool limits the number of transactions per account to 100, hence why we default to 100.
If maximumInFlight
are in flight, wait sleepTime
seconds before re-evaluating, default to 10
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
prefixedRest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: 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.
Optional
fn: ((...args) => 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: 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
Optional
options: InputGenerateTransactionOptionsRemove the listeners of a given event.
Optional
fn: ((...args) => void)Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyOptional
once: booleanGenerated using TypeDoc
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