getPdpDataSets
getPdpDataSets(
client,options):Promise<OutputType>
Defined in: packages/synapse-core/src/warm-storage/get-pdp-data-sets.ts:84
Get one bounded page of enriched PDP data sets.
Only the current source page is enriched, in bounded batches with source
order preserved. Pass nextCursor back as cursor; treat it as
opaque. Use paginate to traverse every page. Results report piece
presence from a non-zero getDataSetLeafCount read, which is an O(1)
storage lookup, rather than scanning piece IDs. Exact active-piece counts are
omitted because the contract’s count getter performs a linear scan and can
fail for large data sets. To derive a count explicitly, traverse
getActivePiecesByCursor and count the yielded pieces.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
client | Client<Transport, Chain> | The client to use to get data sets for a client address. |
options | OptionsType | getPdpDataSets.OptionsType |
Returns
Section titled “Returns”A page of PDP data set info entries getPdpDataSets.OutputType
Throws
Section titled “Throws”Errors getPdpDataSets.ErrorType
Examples
Section titled “Examples”Read the first page
import { getPdpDataSets } 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 address = '0x0000000000000000000000000000000000000000'const page = await getPdpDataSets(client, { address })console.log(page.items, page.nextCursor)Iterate over every page
import { paginate } from '@filoz/synapse-core'import { getPdpDataSets } from '@filoz/synapse-core/warm-storage'
for await (const dataSet of paginate(({ cursor }) => getPdpDataSets(client, { address, cursor }))) { console.log(dataSet.dataSetId)}