ERC721 - Burn NFTs
You can utilize these features of the SDK if your contract implements the ERC721Burnable standard.
Burn NFTs
Burn (transfer to a non-recoverable address) an NFT.
Burning
Burning does not "delete" the NFT; the token ID and metadata will still be available on-chain.
- React
- Javascript
- Python
- Go
- Unity
const Component = () => {
const { contract } = useContract("{{contract_address}}");
const {
mutate: burnNFT,
isLoading,
error,
} = useBurnNFT(contract);
if (error) {
console.error("failed to burn NFT", error);
}
return (
<button
disabled={isLoading}
onClick={() => burnNFT({ tokenId: 0, amount: 1 })}
>
Burn!
</button>
);
};
This snippet is for v3 of the SDK. Learn how to upgrade.
View in React SDK Documentationconst result = await contract.erc721.burn(tokenId);
This snippet is for v3 of the SDK. Learn how to upgrade.
View in Javascript SDK DocumentationThis feature is missing a code snippet or might not be supported yet.
Check the Python SDK documentation for more information.
Reach out on Discord for further assistance!
View Python SDK DocumentationThis feature is missing a code snippet or might not be supported yet.
Check the Go SDK documentation for more information.
Reach out on Discord for further assistance!
View Go SDK Documentationvar tokenId = "0";
var result = await contract.ERC721.Burn(tokenId);