useFundConfidentialAirdrop
Encrypt the funding amount and transferFromConfidential into the clone.
@tokenops/sdk/fhe-airdrop/react{ mutate, mutateAsync, isPending, error, data }Description
Fund an existing (or not-yet-deployed) airdrop clone with encrypted tokens
via the factory. The SDK encrypts the plaintext amount into an
externalEuint64 and submits it with an input proof — callers never handle
ciphertext.
Encryptor resolution. The hook-level encryptor (from
FactoryHookOptions) is forwarded lazily to the SDK client. You can
also pass encryptor per-mutation via args.encryptor to override it. If
neither is present, the SDK throws Missing encryptor — pass encryptor…
verbatim.
Prerequisites: caller must have set the factory as an operator on the
token: token.setOperator(factoryAddress, deadline).
`args.gasFee` MUST match the fee active for `deployer` at airdrop creation
time — custom fee if getCustomFee(deployer).enabled, otherwise
defaultGasFee. The factory derives the target clone address from this
value via CREATE2; a mismatch funds the wrong (predicted) address.
Signature
function useFundConfidentialAirdrop(options?: FactoryHookOptions): UseMutationResult<Hex, Error, FundAirdropArgs>;Parameters
Shape of the object you pass to .mutate(args) is the SDK type FundAirdropArgs. Inspect the type for the full shape (discriminated unions collapse to a tagged variant at call time).
Run it
Connect your wallet and click Fund the airdrop — this dispatches a real Sepolia transaction through the same runner the stories use.
Example
"use client";
import { useFundConfidentialAirdrop } from "@tokenops/sdk/fhe-airdrop/react";
export function Example() {
const { mutate, isPending } = useFundConfidentialAirdrop();
return (
<button disabled={isPending} onClick={() => mutate(/* args */)}>
{isPending ? "Sending…" : "FundConfidentialAirdrop"}
</button>
);
}Auto-generated from the hook's shape (the SDK doesn't carry a TSDoc @example here yet).
Errors
This mutation can reject with SDK-level, product-level, or viem-passthrough errors. Product classes carry the offending value as fields — render them inline instead of a generic "transaction failed." See Airdrop › Errors for the per-class recovery table.
Invalidation recipe
After this mutation succeeds, invalidate the queries it affects so consumer UI re-fetches fresh state. The SDK never auto-invalidates — that's a consumer decision (different apps cache different shapes).
import { useQueryClient } from "@tanstack/react-query";
const queryClient = useQueryClient();
const fundConfidentialAirdrop = useFundConfidentialAirdrop(/* options */);
fundConfidentialAirdrop.mutate(args, {
onSuccess() {
// Coarse invalidation: refresh every cached read on this product surface.
queryClient.invalidateQueries({
queryKey: ["tokenops-sdk", "fhe-airdrop"],
});
},
});See also
Other Write hooks in airdrop: