Skip to content

getPiecesWithMetadata

getPiecesWithMetadata(client, options): Promise<OutputType>

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

Get pieces with metadata 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; }getPiecesWithMetadata.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 getPiecesWithMetadata.OutputType

import { getPiecesWithMetadata } 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 getPiecesWithMetadata(client, {
dataSetId: 1n,
})

Errors getPiecesWithMetadata.ErrorType