useClaimConditions

Hook for fetching all claim conditions for a given drop contract.

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

Example

import { useClaimConditions, useContract } from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress);
const { data, isLoading, error } = useClaimConditions(contract);
}
function useClaimConditions(
contract: RequiredParam<DropContract>,
tokenId?: BigNumberish,
): UseQueryResult<Array<ClaimCondition>>;

Parameters

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

Type

let contract: RequiredParam<DropContract>;

When using the hook with ERC1155 contracts, pass the tokenId parameter; as each token can have unique claim conditions.

Pass undefined , or leave this field out if you are using ERC721 or ERC20 drop contracts.

import { useClaimConditions, useContract } from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress);
const { data, isLoading, error } = useClaimConditions(
contract,
0, // Token ID required for ERC1155 contracts here.
);
}

Type

let tokenId: BigNumberish;

additional options to pass to the claim condition fetch

withAllowlist

By default, the hook will not include the allowlist in the returned data. To include the allowlist in the returned data, set the withAllowlist option to true.

This will add a snapshot property to the returned data, which contains the allowlist in an array.

import { useClaimConditions, useContract } from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress);
// "data" now includes a "snapshot" property that contains the allowlist.
const { data, isLoading, error } = useClaimConditions(
contract,
undefined, // Token ID required for ERC1155 contracts here.
{
withAllowlist: true,
},
);
}

Type

Returns

let returnType: UseQueryResult<Array<ClaimCondition>>;

Query Result object with the list of claim conditions