getProviderWithProduct
getProviderWithProduct(
client,options):Promise<OutputType>
Defined in: packages/synapse-core/src/sp-registry/get-provider-with-product.ts:78
Get provider details with specific product information
The underlying contract method is guarded by the providerExists modifier
and will revert for unknown provider IDs. This wrapper normalizes those
reverts to null. Reverts from any other source (e.g. RPC failures) still
propagate.
Note: the contract does not revert when the provider exists but the
requested product is missing or inactive — in that case it returns a
default-initialized product and callers must inspect product.isActive
and product.capabilityKeys.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
client | Client<Transport, Chain> | The client to use to get the provider details. |
options | OptionsType | getProviderWithProduct.OptionsType |
Returns
Section titled “Returns”The provider with product details, or null when the provider does not exist getProviderWithProduct.OutputType
Throws
Section titled “Throws”Errors getProviderWithProduct.ErrorType
Example
Section titled “Example”import { getProviderWithProduct } 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 provider = await getProviderWithProduct(client, { providerId: 1n, productType: 0, // ProductType.PDP})
if (provider) { console.log(provider.providerInfo.name)}