Skip to main content

useClaimIneligibilityReasons

Hook for fetching the eligibility reasons of a specific wallet address for a given drop.

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

Usage

Provide your Drop contract as the argument.

import { useClaimIneligibilityReasons, useContract, Web3Button } from "@thirdweb-dev/react";

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

function App() {
const { contract } = useContract(contractAddress);
const { data, isLoading, error } = useClaimIneligibilityReasons(contract, {
walletAddress: "{{wallet_address}}",
quantity: 1,
});

if (error) {
console.error("failed to fetch reasons", error);
}

return (
<Web3Button
contractAddress={contractAddress}
action={() => useClaimIneligibilityReasons(contract, {
walletAddress: "{{wallet_address}}",
quantity: 1,
})}
>
Fetch Reasons
</Web3Button>
);
}

Parameters

walletAddress

The address that you are checking eligibility for.

quantity

The amount of tokens you are trying to claim.

Return

Returns an array of eligibility reasons if the address is not eligible.

import {
useClaimIneligibilityReasons,
useContract,
Web3Button,
} from "@thirdweb-dev/react";

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

function App() {
const { contract } = useContract(contractAddress);
const { data, isLoading, error } = useClaimIneligibilityReasons(contract, {
walletAddress: "{{wallet_address}}",
quantity: 1,
});

if (error) {
console.error("failed to fetch reasons", error);
}

if (data) {
console.log("ineligibility reasons", data);
}

return (
<Web3Button
contractAddress={contractAddress}
action={() => useClaimIneligibilityReasons(contract, {
walletAddress: "{{wallet_address}}",
quantity: 1,
})}
>
Fetch Reasons
</Web3Button>
);
}