Skip to content

operatorApprovals

operatorApprovals(client, options): Promise<OutputType>

Defined in: packages/synapse-core/src/pay/operator-approvals.ts:80

Get operator approval information from the Filecoin Pay contract

Returns the approval status and allowances for an operator acting on behalf of a client. Operators can create and manage payment rails within their approved allowances.

ParameterTypeDescription
clientClient<Transport, Chain>The viem client to use for the contract call.
optionsOptionsTypeoperatorApprovals.OptionsType

Promise<OutputType>

The operator approval information operatorApprovals.OutputType

Errors operatorApprovals.ErrorType

import { operatorApprovals } from '@filoz/synapse-core/pay'
import { createPublicClient, http } from 'viem'
import { calibration } from '@filoz/synapse-core/chains'
const client = createPublicClient({
chain: calibration,
transport: http(),
})
const approval = await operatorApprovals(client, {
address: '0x1234567890123456789012345678901234567890',
})
console.log(approval.isApproved)
console.log(approval.rateAllowance)
console.log(approval.lockupAllowance)