Transaction Worker
class TransactionWorker(scope: CoroutineScope, sequenceManager: AccountSequenceManager, capacity: Int = DEFAULT_CAPACITY, submitTransaction: suspend (UnsignedTransaction) -> AptosResult<PendingTransactionResponse>, isSequenceMismatch: (AptosError) -> Boolean = ::defaultSequenceMismatch)
Bounded, single-sender transaction pipeline.
The worker reserves sequence numbers only after dequeuing work, retries once after a recognized sequence mismatch, and never blocks callers from observing an individual submission result.
Constructors
Link copied to clipboard
constructor(scope: CoroutineScope, sequenceManager: AccountSequenceManager, capacity: Int = DEFAULT_CAPACITY, submitTransaction: suspend (UnsignedTransaction) -> AptosResult<PendingTransactionResponse>, isSequenceMismatch: (AptosError) -> Boolean = ::defaultSequenceMismatch)
Properties
Functions
Link copied to clipboard
Drains queued submissions or cancels them immediately, then waits for termination.
Link copied to clipboard
suspend fun submit(build: suspend (sequenceNumber: ULong) -> AptosResult<UnsignedTransaction>): Deferred<AptosResult<PendingTransactionResponse>>
Queues a transaction factory and returns its independently awaitable result.