removeApprovedProvider
removeApprovedProvider(
client,options):Promise<`0x${string}`>
Defined in: packages/synapse-core/src/warm-storage/remove-approved-provider.ts:85
Remove an approved provider for the client
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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
client |
Client<Transport, Chain, Account> |
The client to use to remove the approved provider. |
options |
OptionsType |
removeApprovedProvider.OptionsType |
Returns
Section titled “Returns”Promise<`0x${string}`>
The transaction hash removeApprovedProvider.OutputType
Throws
Section titled “Throws”Errors removeApprovedProvider.ErrorType
Example
Section titled “Example”import { removeApprovedProvider, 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 index
const providers = await getApprovedProviders(publicClient, {
client: account.address,
})
const providerId = 1n
const index = providers.findIndex((id) => id === providerId)
const txHash = await removeApprovedProvider(walletClient, {
providerId,
index: BigInt(index),
})
console.log(txHash)