Creates an instance of the class with the specified configuration and account details. This constructor initializes the necessary parameters for managing Aptos transactions.
The configuration settings for Aptos.
The account associated with the Aptos transactions.
The maximum time to wait for a transaction to be processed, in milliseconds.
The maximum number of transactions that can be in flight at the same time.
The time to sleep between transaction checks, in milliseconds.
Readonly
accountReadonly
aptosWe want to guarantee that we preserve ordering of workers to requests.
lock
is used to try to prevent multiple coroutines from accessing a shared resource at the same time,
which can result in race conditions and data inconsistency.
This code actually doesn't do it though, since we aren't giving out a slot, it is still somewhat a race condition.
The ideal solution is likely that each thread grabs the next number from an incremental integer.
When they complete, they increment that number and that entity is able to enter the lock
.
That would guarantee ordering.
Represents an account's sequence number management for transaction handling on the Aptos blockchain. This class provides methods to retrieve the next available sequence number, synchronize with the on-chain sequence number, and manage local sequence numbers while ensuring thread safety.
Param: aptosConfig
The configuration settings for Aptos.
Param: account
The account associated with the sequence number.
Param: maxWaitTime
The maximum time to wait for a transaction to commit.
Param: maximumInFlight
The maximum number of transactions that can be in flight at once.
Param: sleepTime
The time to wait before retrying to get the sequence number.