useBurnNFT() function
This feature is currently in beta and may change based on feedback that we receive.
Use this to burn an NFT on your NFTContract
Example 1
const Component = () => {
const nftDrop = useNFTDrop(<ContractAddress>);
const {
mutate: burnNft,
isLoading,
error,
} = useBurnNFT(nftDrop);
if (error) {
console.error("failed to burn nft", error);
}
return (
<button
disabled={isLoading}
onClick={() => burnNft({ tokenId: 0 })}
>
Burn!
</button>
);
};
Example 2
const Component = () => {
const { contract } = useContract(<ContractAddress>);
const {
mutate: burnNft,
isLoading,
error,
} = useBurnNFT(contract?.nft);
if (error) {
console.error("failed to burn nft", error);
}
return (
<button
disabled={isLoading}
onClick={() => burnNft({ tokenId: 0 })}
>
Burn!
</button>
);
};
Signature:
export declare function useBurnNFT<TContract extends NFTContract>(
contract: RequiredParam<TContract>,
): import("@tanstack/react-query").UseMutationResult<
Omit<
{
receipt: import("@ethersproject/abstract-provider").TransactionReceipt;
data: () => Promise<unknown>;
},
"data"
>,
unknown,
BurnNFTParams<TContract>,
unknown
>;
Parameters
Parameter | Type | Description |
---|---|---|
contract | RequiredParam<TContract> | an instance of a NFTContract |
Returns:
import("@tanstack/react-query").UseMutationResult<Omit<{ receipt: import("@ethersproject/abstract-provider").TransactionReceipt; data: () => Promise<unknown>; }, "data">, unknown, BurnNFTParams<TContract>, unknown>
a mutation object that can be used to burn an NFT token from the connected wallet