useBurnNFT
Description
Hook for burning an NFT
Parameters
| Name | Type | Description |
|---|---|---|
| tokenId | number | The ID of the token to transfer. |
| [overrides] | Overrides | Optional overrides for the contract call. |
Example
import { useContract, useBurnNFT } from "@openformat/react";
// address of a created NFT (ERC721) contract. You can get this from the subgraph.
const address = "0x123...";
// the ID of the token you want to burn.
const tokenId = 123;
// returns an instance of the NFT.
const { data: nft } = useContract(address);
const { data, burn, isLoading, error } = useBurnNFT(nft);
async function handleBurn() {
await burn({ tokenId: tokenId });
}