Skip to content

operatorApprovals

operatorApprovals(client, options): Promise<OutputType>

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

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.

Parameter Type Description
client Client<Transport, Chain> The client to use to get the operator approvals.
options OptionsType operatorApprovals.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)