Encrypted readuseMutationencrypted handle

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).

Import
@tokenops/sdk/fhe-airdrop/react
Return
{ mutate, mutateAsync, isPending, error, data }
Lifecycle
Encrypted read

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

@tokenops/sdk/fhe-airdrop/react
ts
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).

Want to run a similar shape interactively? The Playground ships 8 ready presets across vesting / airdrop / disperse — deploy a manager, create a vesting, claim, and the airdrop / disperse equivalents. The deep-link above auto-selects the closest preset to useGetClaimAmount; pick another from the dropdown if you'd rather start there.

Example

@tokenops/sdk/fhe-airdrop/react · @example
tsx
// `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).

patterns/invalidation.ts
ts
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"],
    });
  },
});

See also