Skip to main content

useActiveClaimConditionForWallet

Hook for getting the active claim condition on a drop contract for a specific wallet address.

As part of our improved claim conditions update, each wallet address can have unique claim conditions at any given time. This hook allows you to get the active claim condition for a specific wallet address at this time.

Available for contracts that implement the claim conditions interface; such as NFT Drop, Edition Drop, and Token Drop.

import { useActiveClaimConditionForWallet } from "@thirdweb-dev/react";

Usage

Provide your drop contract as the first argument to the hook.

  • Returns the claim condition specific to the wallet address if found in the claimer snapshot.
  • Returns the default claim condition on the contract if the address is not found in the claimer snapshot.
  • Populates the error field if there is no active claim condition on the contract.
import {
useActiveClaimConditionForWallet,
useContract,
useAddress,
} from "@thirdweb-dev/react";

// Your smart contract address
const contractAddress = "{{contract_address}}";

function App() {
// Contract can be any contract that implements claim conditions.
// Including ERC721, ERC1155, and ERC20 drop contracts.
const address = useAddress();
const { contract } = useContract(contractAddress);
const { data, isLoading, error } = useActiveClaimConditionForWallet(
contract,
address,
);
}

Configuration

address (required)

The second parameter is the address of the wallet you want to get the active claim condition for.

Use the useAddress hook to get the currently connected wallet address.

import {
useActiveClaimConditionForWallet,
useContract,
useAddress,
} from "@thirdweb-dev/react";

// Your smart contract address
const contractAddress = "{{contract_address}}";

function App() {
const { contract } = useContract(contractAddress);
const address = useAddress();

const { data, isLoading, error } = useActiveClaimConditionForWallet(
contract,
address,
);
}

tokenId (ERC1155 only)

When using the hook with ERC1155 contracts, pass the tokenId as the third 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 {
useActiveClaimConditionForWallet,
useContract,
useAddress,
} from "@thirdweb-dev/react";

// Your smart contract address
const contractAddress = "{{contract_address}}";

function App() {
const { contract } = useContract(contractAddress);
const address = useAddress();

const { data, isLoading, error } = useActiveClaimConditionForWallet(
contract,
address,
0, // Token ID required for ERC1155 contracts here.
);
}

Return Value

The hook's data property, once loaded, contains the following properties:

{
maxClaimableSupply: string;
startTime: Date;
price: BigNumber;
currencyAddress: string;
maxClaimablePerWallet: string;
waitInSeconds: BigNumber;
merkleRootHash: string | number[];
availableSupply: string;
currentMintSupply: string;
currencyMetadata: {
symbol: string;
value: BigNumber;
name: string;
decimals: number;
displayValue: string;
};
}