Skip to main content

ERC20 - Burn Tokens

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

Burn Tokens

Burn tokens held by the specified wallet

const Component = () => {
const { contract } = useContract("{{contract_address}}");
const {
mutate: burnTokens,
isLoading,
error,
} = useBurnToken(contract);

if (error) {
console.error("failed to burn tokens", error);
}

return (
<button
disabled={isLoading}
onClick={() => burnTokens({ amount: 1000 })}
>
Burn!
</button>
);
};

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

View in React SDK Documentation

Burn Tokens

Burn tokens held by the connected wallet

// Address of the wallet sending the tokens
const holderAddress = "{{wallet_address}}";

// The amount of this token you want to burn
const amount = 1.2;

await contract.erc20.burnFrom(holderAddress, amount);

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

View in React SDK Documentation