ReaduseQuery
useIsOperator
Read spender's ERC-7984 operator status for holder on token.
Import
@tokenops/sdk/fhe-airdrop/reactReturn
{ data, isLoading, error, refetch }Lifecycle
ReadDescription
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 is the canonical OPERATOR_NOT_APPROVED_REMEDIATION copy:
Signature
@tokenops/sdk/fhe-airdrop/react
ts
function useIsOperator(options?: UseIsOperatorOptions): UseQueryResult<boolean, Error>;Parameters
Shape of the options object passed to the hook itself.
| Property | Type | Description |
|---|---|---|
| token | Address | undefined | ERC-7984 token contract address. Query stays disabled while undefined. |
| spender | Address | undefined | Address whose operator status is being checked — typically a manager clone, an airdrop factory/clone, or the disperse singleton. Query stays disabled while undefined. |
| holder | Address | undefined | Account that owns the tokens. Defaults to the connected wallet's account. Query stays disabled while neither is available. |
| chainId | number | undefined | Override the chain id used for client resolution. |
| enabled | boolean | undefined | Set false to pause the query without unmounting. Defaults to true. |
| telemetry | SdkTelemetry | undefined | Optional telemetry adapter — forwarded to the headless helper. |
Example
@tokenops/sdk/fhe-airdrop/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
Other Read hooks in airdrop:
useFactoryDefaultGasFeeRead the factory-wide default per-claim gas fee (in wei) — applied to new airdrop clones at deployment when the creator has no custom override.useFactoryFeeCollectorRead the factory's current fee collector address — the account authorized to call withdrawGasFee on each deployed airdrop clone.useFactoryCustomFeeRead the per-creator fee override set on the factory for creator.usePreflightCreateAirdropRead-only preflight for useCreateConfidentialAirdrop / useCreateAndFundConfidentialAirdrop — wraps ConfidentialAirdropFactoryClient.preflightCreateAirdrop as a TanStack query.