Lock a previously-reserved nonce
This method is invoked differently, depending on how reservation was done:
// An ID was provided during reservation
lock({ reservedFor: "<ID>" });
// Otherwise, lock by address and supply the ID now
lock({ address, lockedBy: "<ID>" })
ID
OptionallockedBy?: stringID
ID
Locked nonces must be released.
Ideally this should be invoked in a finally logic to ensure it
is executed regardless of errors.
ID
The value the account holds now: read on-chain once a transaction using it has landed, or the reserved value when nothing was sent.
Reserve a nonce for later locking.
If it is not locked in the reservation period, the pool sync returns it to the pool.
Remember to sign the transaction that includes this nonce, with the nonce authority via sign
OptionalexpiresAt?: DateHow long the reservation is valid for. Default: 5 minutes
The ID of what will be using the nonce, or alternatively
<domain>[.<domain model>][.<purpose>], e.g. SWAP, or
DEPOSIT.US_CASH.MINT
The latter is informational only and won't be used in code logic.
A pool of Solana nonce accounts, used for durable transactions
A nonce is reserved for a period of time. During this time, it can be locked for usage and will remain locked indefinitely until released. If a nonce is not locked within the reservation period, the
fillSolanaNoncePoolWorkflowsync returns it to the pool.The pool stores each account's current nonce value, so building a durable transaction needs no RPC read: reserve hands the value out, and release takes the value the account holds afterwards.
This service can be used in two ways:
a) We know who will be locking the nonce at reservation time:
b) We do not know the ID of locker upfront:
In this scenario, you have to carry forward the nonce address in code so it can be supplied to
lock().ATTENTION: If you are using this service in an application, please ensure
fillSolanaNoncePoolWorkflowis added to the same worker where the durable transaction will be executed