2.0 RC docsView 1.x docs
v2.0.0-rc.1 release candidate
The API is frozen and later candidates carry fixes only, except the receipt-free and Safe create surface of /fhe-airdrop, which is @beta. Published on the next dist-tag; latest stays on 1.6.0 until 2.0.0.
ReaduseQuery

useIsOperator

Read spender's ERC-7984 operator status for holder on token.

Import
@tokenops/sdk/fhe/react
Return
{ data, isLoading, error, refetch }
Lifecycle
Read

Description

Read spender's ERC-7984 operator status for holder on token.

Typical use: gate the "create" call-to-action behind the operator prerequisite so builders never hit OperatorNotApprovedError — the SDK's mapping of the on-chain ERC7984UnauthorizedSpender revert, whose message names the holder, the spender and the setOperator call to make:

Signature

@tokenops/sdk/fhe/react
ts
function useIsOperator(options?: UseIsOperatorOptions): UseQueryResult<boolean, Error>;

Parameters

Shape of the options object passed to the hook itself.

PropertyTypeDescription
tokenAddress | undefinedERC-7984 token contract address. Query stays disabled while undefined.
spenderAddress | undefinedAddress whose operator status is being checked — typically a manager clone, an airdrop factory/clone, or the disperse singleton. Query stays disabled while undefined.
holderAddress | undefinedAccount that owns the tokens. Defaults to the connected wallet's account. Query stays disabled while neither is available.
chainIdnumber | undefinedOverride the chain id used for client resolution.
enabledboolean | undefinedSet false to pause the query without unmounting. Defaults to true.
telemetrySdkTelemetry | undefinedOptional telemetry adapter — forwarded to the headless helper.
Want to run a similar shape interactively? The Playground ships 12 ready presets across vesting / airdrop / disperse / faucet — deploy a manager, create a vesting, claim, and run the product equivalents. The deep-link above auto-selects the closest preset to useIsOperator; pick another from the dropdown if you'd rather start there.

Example

@tokenops/sdk/fhe/react · @example
tsx
const { data: authorized } = useIsOperator({ token, spender: manager });
return authorized
  ? <CreateVestingButton />
  : <ApproveOperatorButton />; // wire to useEnsureOperator
```

After a successful {@link useEnsureOperator} / `setOperator` mutation,
invalidate this query (its key starts with
`["tokenops-sdk", "fhe", "isOperator", ...]`) or refetch it.

Pulled directly from the hook's TSDoc block — the same snippet your IDE shows on hover.

See also