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
- React
- Javascript
- Python
- Go
- Unity
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// The amount of this token you want to burn
const amount = 1.2;
await contract.erc20.burn(amount);
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 Documentation// The amount of this token you want to burn
var amount = "1.2";
await contract.ERC20.Burn(amount);
Burn Tokens
Burn tokens held by the connected wallet
- React
- Javascript
- Python
- Go
- Unity
// 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// 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 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 Documentation// BurnFrom in Unity is coming soon. Reach out to us in Discord if you need this feature!