Skip to main content

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 Erc721OrErc1155

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);

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

Parameters

ParameterTypeDescription
contractRequiredParam<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, unknown>

a mutation object that can be used to burn an NFT token from the connected wallet