useClaimIneligibilityReasons

Hook for fetching the reasons a wallet is not eligible to claim tokens from a drop, if any.

This is available for available for contracts that implement the "ClaimConditions" interface; such as NFT Drop , Edition Drop , and Token Drop .

Example

import {
useClaimIneligibilityReasons,
useContract,
} from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress);
const { data, isLoading, error } = useClaimIneligibilityReasons(
contract,
{
walletAddress: "0x123...", // Use useAddress hook to get the user's wallet address
quantity: 1, // Quantity to check eligibility for
},
);
}
function useClaimIneligibilityReasons(
contract: RequiredParam<DropContract>,
tokenId?: BigNumberish,
): UseQueryResult<Array<ClaimEligibility>, unknown>;

Parameters

Instance of a contract that extends the ERC20, ERC721 or ERC1155 spec and implements the "ClaimConditions" extension.

Type

let contract: RequiredParam<DropContract>;

The conditions to check eligibility for. The walletAddress and quantity properties are required.

Use the useAddress hook to get the connected wallet address.

Type

When using ERC1155 contracts, provide a third argument to specify the token ID.

import {
useClaimIneligibilityReasons,
useContract,
} from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress);
const { data, isLoading, error } = useClaimIneligibilityReasons(
contract,
{
walletAddress: "0x123..",
quantity: 1,
},
tokenId,
);
}

Type

let tokenId: BigNumberish;

Returns

let returnType: UseQueryResult<Array<ClaimEligibility>, unknown>;

The hook's data property, once loaded, contains an array of ClaimEligibility strings, which may be empty.

For example, if the user is not in the allowlist, this hook will return ["This address is not on the allowlist."] .

If the user is eligible to claim tokens, the hook will return an empty array.