useGetClaimAmount
Submits a transaction (costs gas) to grant the caller decrypt access to the claim amount as an euint64 handle. The handle is granted persistent ACL on-chain via FHE.allow(handle, msg.sender); the SDK extracts it from the receipt's ACL.Allowed event (NOT from simulation — that returns a divergent, ACL-less handle; see CLAUDE.md Pitfall #1).
@tokenops/sdk/fhe-airdrop/react{ mutate, mutateAsync, isPending, error, data }Description
Submits a transaction (costs gas) to grant the caller decrypt access to
the claim amount as an `euint64` handle. The handle is granted persistent
ACL on-chain via FHE.allow(handle, msg.sender); the SDK extracts it from
the receipt's ACL.Allowed event (NOT from simulation — that returns a
divergent, ACL-less handle; see CLAUDE.md Pitfall #1).
Pass data.handle to the Zama relayer's userDecrypt to obtain the
plaintext amount. The handle is only valid after the tx lands.
Does not consume the claim (the claimedSignatures bit is not set).
Call useClaim when the user is ready to transfer tokens.
Submits the admin-issued { encryptedInput, signature } pair verbatim. The
SDK does NOT re-encrypt — the signature commits to the exact handle.
Signature
function useGetClaimAmount(options: AirdropHookOptions): UseMutationResult<EncryptedViewResult, Error, GetClaimAmountArgs>;Parameters
Shape of the object you pass to .mutate(args) is the SDK type GetClaimAmountArgs. Inspect the type for the full shape (discriminated unions collapse to a tagged variant at call time).
Example
// `encryptedInput` + `signature` are the admin-issued payload delivered to
// the recipient (same pair the recipient passes to `useClaim`). Sourced
// from your server API or, for admin-dashboard flows, by combining
// `encryptUint64({ userAddress: recipient, ... })` with
// `useSignClaimAuthorization`.
const view = useGetClaimAmount({ address: airdropAddress });
view.mutate({ encryptedInput, signature });
// view.data → { handle: "0x...", hash: "0x..." }Pulled directly from the hook's TSDoc block — the same snippet your IDE shows on hover.
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 getClaimAmount = useGetClaimAmount(/* options */);
getClaimAmount.mutate(args, {
onSuccess() {
// Coarse invalidation: refresh every cached read on this product surface.
queryClient.invalidateQueries({
queryKey: ["tokenops-sdk", "fhe-airdrop"],
});
},
});