getDataSetLeafCounts
getDataSetLeafCounts(
client,options):Promise<OutputType>
Defined in: packages/synapse-core/src/pdp-verifier/get-data-set-leaf-counts.ts:52
Get the PDP leaf counts for one or more data sets via a single multicall.
A data set that is not live is represented by 0n, matching
getDataSetLeafCount. Duplicate IDs are read once. The returned leaf
counts are not converted to byte sizes, so callers can aggregate counts
before applying pricing conversions.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
client | Client<Transport, Chain> | The client to use to get the data set leaf counts. |
options | OptionsType | getDataSetLeafCounts.OptionsType |
Returns
Section titled “Returns”Leaf counts indexed by data set ID getDataSetLeafCounts.OutputType
Throws
Section titled “Throws”Errors getDataSetLeafCounts.ErrorType
Example
Section titled “Example”import { getDataSetLeafCounts } 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 leafCounts = await getDataSetLeafCounts(client, { dataSetIds: [1n, 2n, 3n],})
console.log(leafCounts.get(1n))