removeProviderSync
removeProviderSync(
client,options):Promise<OutputType>
Defined in: packages/synapse-core/src/sp-registry/remove-provider.ts:121
Remove a service provider and wait for confirmation
Removes the calling provider from the registry and waits for the transaction to be confirmed. Returns the receipt with the event.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
client | Client<Transport, Chain, Account> | The viem client with account to use for the transaction. |
options | { contractAddress?: `0x${string}`; onHash?: (hash) => void; } | removeProviderSync.OptionsType |
options.contractAddress? | `0x${string}` | Service provider registry contract address. If not provided, the default is the registry contract address for the chain. |
options.onHash? | (hash) => void | Callback function called with the transaction hash before waiting for the receipt. |
Returns
Section titled “Returns”The transaction receipt and extracted event removeProviderSync.OutputType
Throws
Section titled “Throws”Errors removeProviderSync.ErrorType
Example
Section titled “Example”import { removeProviderSync } from '@filoz/synapse-core/sp-registry'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 removeProviderSync(client, { onHash: (hash) => console.log('Transaction sent:', hash),})
console.log('Removed provider ID:', event.args.providerId)