Skip to content

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.

Parameter Type Description
client Client<Transport, Chain> The client to use to read the nonce.
options OptionsType getClientNonce.OptionsType

Promise<bigint>

The stored value getClientNonce.OutputType

Errors getClientNonce.ErrorType

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')