useAirdropIsSignatureValid
Off-chain check of the signature shape before paying gas to submit it.
@tokenops/sdk/fhe-airdrop/react{ data, isLoading, error, refetch }Description
Check whether an admin-issued claim authorization is valid for a specific caller, without consuming it.
The query has two distinct failure shapes that must be handled separately:
- data === false: the signature is structurally valid but fails the on-chain
check — already claimed, claim window inactive, or signer lacks
DEFAULT_ADMIN_ROLE.
- error?.code === "TOKENOPS_INVALID_SIGNATURE": the signature bytes are
structurally malformed (wrong length, invalid s-value range, unparseable).
The on-chain ECDSA.recover reverts before the boolean logic runs, so this
shows up on error, not on data.
const sig = useAirdropIsSignatureValid({ address, encryptedAmountHandle, signature, caller });
if (sig.error?.code === "TOKENOPS_INVALID_SIGNATURE") {
// malformed signature bytes
} else if (sig.data === false) {
// wrong signer, already claimed, or window closed
} else if (sig.data === true) {
// ready to claim
}The result is caller-specific (the on-chain check binds to msg.sender).
caller defaults to the connected wallet; the query stays disabled until
a caller is available, and the caller is part of the query key so cached
results don't bleed across account switches.
Use this to show a pre-claim validation state in the UI before asking the user to pay gas.
Signature
function useAirdropIsSignatureValid(args: UseAirdropIsSignatureValidArgs): UseQueryResult<boolean, Error>;Parameters
Shape of the options object passed to the hook itself.
| Property | Type | Description |
|---|---|---|
| encryptedAmountHandle | Hex | externalEuint64 handle (as Hex) from the claim payload. |
| signature | Hex | EIP-712 admin signature over Claim(address recipient, bytes32 encryptedAmount). |
| caller | Address | Caller address — the contract recomputes the struct hash over (msg.sender, encryptedAmount), so validity is caller-specific. Defaults to the connected wallet via wagmi's useAccount(); pass explicitly to check on behalf of another address. |
Example
"use client";
import { useAirdropIsSignatureValid } from "@tokenops/sdk/fhe-airdrop/react";
export function Example() {
const { data, isLoading } = useAirdropIsSignatureValid(/* args */);
if (isLoading) return "loading…";
return <pre>{JSON.stringify(data, null, 2)}</pre>;
}Auto-generated from the hook's shape (the SDK doesn't carry a TSDoc @example here yet).
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.