usePreflightCreateAirdrop
Read-only preflight for useCreateConfidentialAirdrop / useCreateAndFundConfidentialAirdrop — wraps ConfidentialAirdropFactoryClient.preflightCreateAirdrop as a TanStack query.
@tokenops/sdk/fhe-airdrop/react{ data, isLoading, error, refetch }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
function usePreflightCreateAirdrop(args?: UsePreflightCreateAirdropArgs): UseQueryResult<CreateAirdropPreflightReport, Error>;Parameters
Shape of the options object passed to the hook itself.
| Property | Type | Description |
|---|---|---|
| params | AirdropParams | The airdrop parameters that will be passed to the create call. |
| creator | Address | The address that will send the create transaction (msg.sender). |
| userSalt | Hex | The userSalt planned for the create call. Optional — when supplied, the report also carries predictedAirdrop and alreadyDeployed. |
| funding | boolean | Set true when the plan is useCreateAndFundConfidentialAirdrop — a missing factory-operator approval then becomes a blocker instead of informational isFactoryOperator state. |
Example
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:
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.useAirdropTokenRead the airdrop clone's immutable TOKEN.