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 { mutate: claimNft, isLoading, error } = useClaimNFT(DropContract);

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<TContract>,
unknown,
ClaimNFTParams<TContract>,
unknown
>;

Parameters

ParameterTypeDescription
contractRequiredParam<TContract>an instance of a DropContract

Returns:

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

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