getPDPProviders
getPDPProviders(
client,options?):Promise<OutputType>
Defined in: packages/synapse-core/src/sp-registry/get-pdp-providers.ts:74
Get one bounded page of PDP providers.
Pass the returned nextCursor back as cursor; treat it as opaque. Use
paginate to traverse every page.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
client | Client<Transport, Chain> | The client to use to get the providers. |
options | OptionsType | getPDPProviders.OptionsType |
Returns
Section titled “Returns”The paginated providers result getPDPProviders.OutputType
Throws
Section titled “Throws”Errors getPDPProviders.ErrorType
Examples
Section titled “Examples”Read the first page
import { getPDPProviders } from '@filoz/synapse-core/sp-registry'import { createPublicClient, http } from 'viem'import { calibration } from '@filoz/synapse-core/chains'
const client = createPublicClient({ chain: calibration, transport: http(),})
const page = await getPDPProviders(client, { onlyActive: true })console.log(page.items, page.nextCursor)Iterate over every page
import { paginate } from '@filoz/synapse-core'import { getPDPProviders } from '@filoz/synapse-core/sp-registry'
for await (const provider of paginate(({ cursor }) => getPDPProviders(client, { onlyActive: true, cursor }))) { console.log(provider.id)}