Skip to content

getNextPieceId

getNextPieceId(client, options): Promise<bigint>

Defined in: packages/synapse-core/src/pdp-verifier/get-next-piece-id.ts:46

Get the next piece ID for a data set

Total pieces ever added; does not decrease when pieces are removed

Parameter Type Description
client Client<Transport, Chain> The client to use to get the next piece ID.
options OptionsType getNextPieceId.OptionsType

Promise<bigint>

The next piece ID for the data set getNextPieceId.OutputType

import { getNextPieceId } from '@filoz/synapse-core/pdp-verifier'
import { calibration } from '@filoz/synapse-core/chains'
import { createPublicClient, http } from 'viem'

const client = createPublicClient({
  chain: calibration,
  transport: http(),
})

const nextPieceId = await getNextPieceId(client, { dataSetId: 1n })

Errors getNextPieceId.ErrorType