removeApprovedProviderSync
removeApprovedProviderSync(
client,options):Promise<OutputType>
Defined in: packages/synapse-core/src/warm-storage/remove-approved-provider.ts:167
Remove an approved provider for the client and wait for confirmation
Removes a provider ID from the approved list using a swap-and-pop pattern. After removal, the client can no longer create data sets with this provider. 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 remove the approved provider. |
options | OptionsType | removeApprovedProviderSync.OptionsType |
Returns
Section titled “Returns”The transaction receipt and extracted event removeApprovedProviderSync.OutputType
Throws
Section titled “Throws”Errors removeApprovedProviderSync.ErrorType
Example
Section titled “Example”import { removeApprovedProviderSync, getApprovedProviders } from '@filoz/synapse-core/warm-storage'import { createWalletClient, createPublicClient, http } from 'viem'import { privateKeyToAccount } from 'viem/accounts'import { calibration } from '@filoz/synapse-core/chains'
const account = privateKeyToAccount('0x...')const walletClient = createWalletClient({ account, chain: calibration, transport: http(),})const publicClient = createPublicClient({ chain: calibration, transport: http(),})
// First, get the list to find the indexconst providers = await getApprovedProviders(publicClient, { client: account.address,})const providerId = 1nconst index = providers.findIndex((id) => id === providerId)
const { receipt, event } = await removeApprovedProviderSync(walletClient, { providerId, index: BigInt(index), onHash: (hash) => console.log('Transaction sent:', hash),})
console.log('Removed provider ID:', event.args.providerId)