SDK 2.0 RC is out. Read the docs
ReaduseQuery

usePreflightCreateAirdrop

Read-only preflight for useCreateConfidentialAirdrop / useCreateAndFundConfidentialAirdrop — wraps ConfidentialAirdropFactoryClient.preflightCreateAirdrop as a TanStack query.

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

Description

Read-only preflight for useCreateConfidentialAirdrop / useCreateAndFundConfidentialAirdrop — wraps ConfidentialAirdropFactoryClient.preflightCreateAirdrop as a TanStack query.

The report carries isFactoryOperator, gasFee, predictedAirdrop, alreadyDeployed, ready, blockers (human-readable strings) and blockerErrors (typed TokenOpsSdkErrors, index-aligned with blockers — branch on error.code).

Checks: structural params validation (non-zero token/admin, timestamp ordering, end time in the future), ERC-7984 operator approval of the factory on params.token (blocker only with funding: true), and — when userSalt is set — whether a clone already exists at the predicted CREATE2 address. The creator's confidential token balance is NOT checked (encrypted; an underfunded create-and-fund silently moves an encrypted zero) — see the headless method's TSDoc.

Hook is disabled until params and creator are both set. Refetch after the user calls setOperator (e.g. via queryClient.invalidateQueries or a refetchInterval).

Signature

@tokenops/sdk/fhe-airdrop/react
ts
function usePreflightCreateAirdrop(args?: UsePreflightCreateAirdropArgs): UseQueryResult<CreateAirdropPreflightReport, Error>;

Parameters

Shape of the options object passed to the hook itself.

PropertyTypeDescription
paramsAirdropParamsThe airdrop parameters that will be passed to the create call.
creatorAddressThe address that will send the create transaction (msg.sender).
userSaltHexThe userSalt planned for the create call. Optional — when supplied, the report also carries predictedAirdrop and alreadyDeployed.
fundingbooleanSet true when the plan is useCreateAndFundConfidentialAirdrop — a missing factory-operator approval then becomes a blocker instead of informational isFactoryOperator state.
Want to run a similar shape interactively? The Playground ships 8 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 usePreflightCreateAirdrop; pick another from the dropdown if you'd rather start there.

Example

@tokenops/sdk/fhe-airdrop/react · @example
tsx
const { data: report } = usePreflightCreateAirdrop({
  params, creator, userSalt, funding: true,
});
if (report?.ready) { /* enable submit *\/ }

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

See also

Other Read hooks in airdrop: