Skip to main content

ERC1155 - Burn NFTs

You can utilize these features of the SDK if your contract implements the ERC1155Burnable interface.

Burn NFTs

Burn a specified quantity of an NFT.

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 Documentation

Burn A Batch Of NFTs

Burn a specified quantity of multiple NFTs at once.

// The token IDs to burn NFTs of
const tokenIds = [0, 1];
// The amounts of each NFT you want to burn
const amounts = [2, 2];

const result = await contract.erc1155.burnBatch(tokenIds, amounts);

This snippet is for v3 of the SDK. Learn how to upgrade.

View in React SDK Documentation

Burn NFTs From Another Wallet

Burn a specified quantity of an NFT from another wallet.

// The address of the wallet to burn NFTS from
const account = "0x...";
// The token ID to burn NFTs of
const tokenId = 0;
// The amount of this NFT you want to burn
const amount = 2;

const result = await contract.erc1155.burnFrom(account, tokenId, amount);

This snippet is for v3 of the SDK. Learn how to upgrade.

View in React SDK Documentation

Burn a batch of NFTs

Burn a specified quantity of multiple NFTs at once from another wallet.

// The address of the wallet to burn NFTS from
const account = "0x...";
// The token IDs to burn NFTs of
const tokenIds = [0, 1];
// The amounts of each NFT you want to burn
const amounts = [2, 2];

const result = await contract.erc1155.burnBatchFrom(account, tokenIds, amounts);

This snippet is for v3 of the SDK. Learn how to upgrade.

View in React SDK Documentation