getClientNonce
getClientNonce(
client,options):Promise<bigint>
Defined in: packages/synapse-core/src/warm-storage/get-client-nonce.ts:67
Read the raw value FWSS stores for a used replay-protection nonce.
Prefer getAddPiecesResult, getCreateDataSetResult or getCreateDataSetAndAddPiecesResult, which decode it.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
client |
Client<Transport, Chain> |
The client to use to read the nonce. |
options |
OptionsType |
getClientNonce.OptionsType |
Returns
Section titled “Returns”Promise<bigint>
The stored value getClientNonce.OutputType
Throws
Section titled “Throws”Errors getClientNonce.ErrorType
Example
Section titled “Example”import { getClientNonce } from '@filoz/synapse-core/warm-storage'
import { createPublicClient, http } from 'viem'
import { calibration } from '@filoz/synapse-core/chains'
const client = createPublicClient({
chain: calibration,
transport: http(),
})
const value = await getClientNonce(client, {
payer: '0x0000000000000000000000000000000000000000',
nonce: 1n,
})
console.log(value === 0n ? 'unused' : 'used')