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

usePreflightCreateAirdrop

Read-only preflight for useCreateEcdsaAirdrop / useCreateMerkleAirdrop.

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

Description

Read-only preflight for useCreateEcdsaAirdrop / useCreateMerkleAirdrop. Runs every create-time guardrail the write path enforces - chain support, the Merkle/UUPS refusal, params the new instance's initializer would revert on (zero token, an endTime less than a minute past the latest block's timestamp, a window that does not open before it closes, a zero immutable Merkle root, a zero ECDSA signer), the resolved fee against the factory's ceiling and the creator's bound, the creator's effective upgradeability policy for mode: "uups", the stock-wrapper probe when params.common.unwrappable is set, a salt collision on the predicted address, a pinned expected commitment that drifted from the fresh quote, and implementation drift when expectedInitCodeHash (or a Merkle plan) is supplied.

The point is disabling the submit button, not catching after the fact. blockers carries the same typed errors create* would have thrown, so a UI branches on error.code here exactly as it does in onError. commitments is what the create would be sent with, for showing the creator before they sign.

Disabled until variant, params, mode, creator and userSalt are all set. Factory writes made through this SDK's admin hooks invalidate it; refetch after a factory change made anywhere else.

Signature

@tokenops/sdk/fhe-airdrop/react
ts
function usePreflightCreateAirdrop(args?: UsePreflightCreateAirdropArgs): UseQueryResult<PreflightCreateResult, Error>;
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 usePreflightCreateAirdrop; pick another from the dropdown if you'd rather start there.

Example

@tokenops/sdk/fhe-airdrop/react · @example
tsx
const { data: report } = usePreflightCreateAirdrop({
  variant: "merkle", params, mode: "clone", creator, userSalt, plan,
});
const canSubmit = report?.ready === true;

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

See also

Other Read hooks in airdrop v2: