Skip to main content

useClaimNFT() function

This feature is currently in beta and may change based on feedback that we receive.

Use this to claim a NFT on your DropContract

Example

const Component = () => {
const { contract } = useContract(<ContractAddress>);
const {
mutate: claimNft,
isLoading,
error,
} = useClaimNFT(contract);

if (error) {
console.error("failed to claim nft", error);
}

return (
<button
disabled={isLoading}
onClick={() => claimNft({ to: "0x...", quantity: 1 })}
>
Claim NFT!
</button>
);
};

Signature:

export declare function useClaimNFT<TContract extends DropContract>(
contract: RequiredParam<TContract>,
): import("@tanstack/react-query").UseMutationResult<
ClaimNFTReturnType,
unknown,
ClaimNFTParams,
unknown
>;

Parameters

ParameterTypeDescription
contractRequiredParam<TContract>an instance of a DropContract

Returns:

import("@tanstack/react-query").UseMutationResult<ClaimNFTReturnType, unknown, ClaimNFTParams, unknown>

a mutation object that can be used to claim a NFT to the wallet specificed in the params