Class AccountSequenceNumber

Constructors

Properties

account: Account
aptosConfig: AptosConfig
currentNumber: null | bigint = null
lastUncommintedNumber: null | bigint = null
lock: boolean = false

We 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 a incremental integer. When they complete, they increment that number and that entity is able to enter the lock. That would guarantee ordering.

maxWaitTime: number
maximumInFlight: number
sleepTime: number

Methods

  • Synchronizes local sequence number with the seqeunce number on chain for this account.

    Poll the network until all submitted transactions have either been committed or until the maximum wait time has elapsed

    Returns Promise<void>