useClaimerProofs
Hook to get the claimer proofs for an address for ERC20, ERC721, and ERC1155 drop contracts.
A claimer proof is a set of data about a claimer's claim condition, including the claimer's address, the claimer's proof, and the claimer's max claimable amount, price, and currency address.
Available for contracts that implement the claim conditions interface; such as NFT Drop, Edition Drop, and Token Drop.
import { useClaimerProofs } from "@thirdweb-dev/react";
Usage
Provide your Drop contract as the first argument and the claimer's address as the second argument.
import { useClaimerProofs, useContract } from "@thirdweb-dev/react";
// Your smart contract address
const contractAddress = "{{contract_address}}";
function App() {
const { contract } = useContract(contractAddress);
const {
data: proof,
isLoading,
error,
} = useClaimerProofs(contract, "{{claimer_address}}");
}
Configuration
claimerAddress (required)
The second parameter is the claimerAddress
. This is the address of the user you want to get the proof for.
Likely, you will want to check proofs of the currently connected wallet address.
You can use the useAddress hook to get this value.
import { useAddress, useClaimerProofs, useContract } from "@thirdweb-dev/react";
// Your smart contract address
const contractAddress = "{{contract_address}}";
function App() {
const { contract } = useContract(contractAddress);
const address = useAddress();
const {
data: proof,
isLoading,
error,
} = useClaimerProofs(
contract,
address, // Use useAddress hook to get current wallet 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 { useClaimerProofs, useContract } from "@thirdweb-dev/react";
// Your smart contract address
const contractAddress = "{{contract_address}}";
function App() {
const { contract } = useContract(contractAddress);
const {
data: proof,
isLoading,
error,
} = useClaimerProofs(
contract,
"{{claimer_address}}",
0, // Token ID required for ERC1155 contracts here.
);
}
claimConditionID (optional)
The fourth parameter is claimConditionId
. This is the ID of the claim condition you want to get the proof for.
import { useClaimerProofs, useContract } from "@thirdweb-dev/react";
// Your smart contract address
const contractAddress = "{{contract_address}}";
function App() {
const { contract } = useContract(contractAddress);
// "data" now includes a proof for the claim condition with ID 0.
const {
data: proof,
isLoading,
error,
} = useClaimerProofs(
contract,
"{{claimer_address}}",
undefined,
0, // Claim condition ID here.
);
}
Return Value
The hook's data
property, once loaded, contains the following properties:
{
price?: string | undefined;
currencyAddress?: string | undefined;
address: string;
proof: string[];
maxClaimable: string;
}