addApprovedProviderSync
addApprovedProviderSync(
client,options):Promise<OutputType>
Defined in: packages/synapse-core/src/warm-storage/add-approved-provider.ts:134
Add an approved provider for the client and wait for confirmation
This function approves a provider so that the client can create data sets with them. Waits for the transaction to be confirmed and returns the receipt with the event.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
client | Client<Transport, Chain, Account> | The client to use to add the approved provider. |
options | OptionsType | addApprovedProviderSync.OptionsType |
Returns
Section titled “Returns”The transaction receipt and extracted event addApprovedProviderSync.OutputType
Throws
Section titled “Throws”Errors addApprovedProviderSync.ErrorType
Example
Section titled “Example”import { addApprovedProviderSync } from '@filoz/synapse-core/warm-storage'import { createWalletClient, http } from 'viem'import { privateKeyToAccount } from 'viem/accounts'import { calibration } from '@filoz/synapse-core/chains'
const account = privateKeyToAccount('0x...')const client = createWalletClient({ account, chain: calibration, transport: http(),})
const { receipt, event } = await addApprovedProviderSync(client, { providerId: 1n, onHash: (hash) => console.log('Transaction sent:', hash),})
console.log('Provider ID:', event.args.providerId)