# setOperatorApprovalSync

> **setOperatorApprovalSync**(`client`, `options`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`OutputType`](/reference/filoz/synapse-core/pay/namespaces/setoperatorapprovalsync/type-aliases/outputtype/)\>

Defined in: [packages/synapse-core/src/pay/set-operator-approval.ts:157](https://github.com/FilOzone/synapse-sdk/blob/6cf8b3ed2dd3ae76ed05cb86995d711a08a298a6/packages/synapse-core/src/pay/set-operator-approval.ts#L157)

Set operator approval on the Filecoin Pay contract and wait for confirmation

Approves or revokes an operator to act on behalf of the caller's account.
Waits for the transaction to be confirmed and returns the receipt with the event.

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `client` | `Client`\<`Transport`, `Chain`, `Account`\> | The viem client with account to use for the transaction. |
| `options` | [`OptionsType`](/reference/filoz/synapse-core/pay/namespaces/setoperatorapprovalsync/type-aliases/optionstype/) | [setOperatorApprovalSync.OptionsType](/reference/filoz/synapse-core/pay/namespaces/setoperatorapprovalsync/type-aliases/optionstype/) |

## Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`OutputType`](/reference/filoz/synapse-core/pay/namespaces/setoperatorapprovalsync/type-aliases/outputtype/)\>

The transaction receipt and extracted event [setOperatorApprovalSync.OutputType](/reference/filoz/synapse-core/pay/namespaces/setoperatorapprovalsync/type-aliases/outputtype/)

## Throws

Errors [setOperatorApprovalSync.ErrorType](/reference/filoz/synapse-core/pay/namespaces/setoperatorapprovalsync/type-aliases/errortype/)

## Example

```ts
import { setOperatorApprovalSync } from '@filoz/synapse-core/pay'
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 setOperatorApprovalSync(client, {
  approve: true,
  onHash: (hash) => console.log('Transaction sent:', hash),
})

console.log('Approved:', event.args.approved)
console.log('Rate allowance:', event.args.rateAllowance)
```