Skip to content

getPieces(client, options): Promise<OutputType>

Defined in: packages/synapse-core/src/pdp-verifier/get-pieces.ts:55

Get pieces for a data set with pagination

ParameterTypeDescription
clientClient<Transport, Chain>The client to use to get the active pieces.
options{ address: `0x${string}`; contractAddress?: `0x${string}`; dataSet: PdpDataSet; limit?: bigint; offset?: bigint; }getPieces.OptionsType
options.address`0x${string}`The address of the user.
options.contractAddress?`0x${string}`PDP Verifier contract address. If not provided, the default is the PDP Verifier contract address for the chain.
options.dataSetPdpDataSetThe data set to get the pieces from.
options.limit?bigintThe limit for pagination. Default 100n
options.offset?bigintThe offset for pagination. Default 0n

Promise<OutputType>

The active pieces for the data set getPieces.OutputType

import { getPieces } 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 [piecesData, pieceIds, hasMore] = await getPieces(client, {
dataSetId: 1n,
})

Errors getPieces.ErrorType