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

useIsAirdrop

Ask the canonical factory whether it created candidate - the genuineness check.

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

Description

Ask the canonical factory whether it created candidate - the genuineness check.

Run this before trusting an address a user pasted, a link carried, or an indexer returned. A look-alike instance with the same ABI, the same events and a pool the attacker controls is cheap to deploy, and nothing readable at the instance tells it apart. A claim against one succeeds and delivers nothing.

The factory this asks is the one resolved from src/core/addresses.ts for the connected chain, which is what makes the answer worth anything: an instance that names its own factory names a fake one.

Only a `true` is cached. The registry is append-only, so a true can never become false and is safe to hold forever. A false is not stable: the address can be created later by another tab, another service, or the headless client, none of which reaches this hook's invalidations - so caching it would serve a stale false negative indefinitely and, for a security check, in the direction that blocks a legitimate claim. Negative answers therefore stay fresh and refetch normally. Override either with query.staleTime.

The `address` override is the trust root. Like every factory hook this accepts address, and useMemoAirdropFactoryClient prefers it over src/core/addresses.ts. That is what makes the hook usable on a local chain, but it also means an attacker-supplied factory address would answer true for its own look-alike. Pass address only from a source you trust at least as much as the registry; when in doubt, omit it.

Signature

@tokenops/sdk/fhe-airdrop/react
ts
function useIsAirdrop(args?: UseIsAirdropArgs): UseQueryResult<boolean, Error>;

Parameters

Shape of the options object passed to the hook itself.

PropertyTypeDescription
candidateAddressThe address to check against the factory's registry.
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 useIsAirdrop; pick another from the dropdown if you'd rather start there.

Example

@tokenops/sdk/fhe-airdrop/react · @example
tsx
const { data: genuine } = useIsAirdrop({ candidate: fromUrl });
if (genuine === false) return <Warning address={fromUrl} />;

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

See also

Other Read hooks in airdrop v2: