useActiveClaimCondition
Hook for getting the active claim condition for a given drop contract.
Available for contracts that implement the "ClaimConditions" interface; such as NFT Drop , Edition Drop , and Token Drop .
import { useActiveClaimCondition, useContract,} from "@thirdweb-dev/react"; function App() { const { contract } = useContract(contractAddress); const { data, isLoading, error } = useActiveClaimCondition(contract);}
function useActiveClaimCondition( tokenId?: BigNumberish,
Instance of contract that implement the "ClaimConditions" interface; such as NFT Drop , Edition Drop , and Token Drop .
When using the hook with ERC1155 contracts such as the Edition Drop , pass the tokenId
as the second 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 { useActiveClaimCondition, 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 } = useActiveClaimCondition( contract, 0, // Token ID required for ERC1155 contracts here. );}
let tokenId: BigNumberish;
Additional options to pass to the claim condition fetch
withAllowlist
By default, the hook will not include the allowlist or "snapshot" in the returned data. To include the allowlist in the returned data, pass withAllowlist: true
in options object.
This will add a snapshot property to the returned data, which contains the allowlist in an array.
import { useActiveClaimCondition, 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 } = useActiveClaimCondition( contract, undefined, // Token ID required for ERC1155 contracts here. { withAllowlist: true, }, );}
A query result object with the currently active claim condition