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.
IntrospectionuseQuery

useAirdropRoleConstants

Read an airdrop instance's role identifiers in one fan-out.

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

Description

Read an airdrop instance's role identifiers in one fan-out.

Every value is a bytecode constant, so this is cacheable indefinitely (staleTime: Infinity by default, overridable through query). Feed the results into useAirdropHasRole, useAirdropRoleMembers, useAirdropRoleAdmin and the role mutations - hand-hashing keccak256("PAUSER_ROLE") client-side would turn a constant renamed in a future contract version into a grantRole that silently grants a role nothing checks.

One bundled hook rather than ten one-liners nobody would call separately: a UI needs the whole palette to render a role panel at all.

Signature

@tokenops/sdk/fhe-airdrop/react
ts
function useAirdropRoleConstants(args: UseAirdropRoleConstantsArgs): UseQueryResult<AirdropRoleConstants, Error>;

Parameters

Shape of the options object passed to the hook itself.

PropertyTypeDescription
variant"ecdsa" | "merkle"Also read the variant-only role: MERKLE_ADMIN_ROLE or SIGNER_ROLE. Omit it for the eight shared constants and neither extra read fires.
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 useAirdropRoleConstants; pick another from the dropdown if you'd rather start there.

Example

@tokenops/sdk/fhe-airdrop/react · @example
tsx
const { data: roles } = useAirdropRoleConstants({ address, variant: "merkle" });
const { data: isPauser } = useAirdropHasRole({ address, role: roles?.PAUSER_ROLE, holder });

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

See also

Other Introspection hooks in airdrop v2: