Skip to main content

useBurnToken() function

This feature is currently in beta and may change based on feedback that we receive.

Use this to burn tokens on your contract

Example

const Component = () => {
const {
mutate: burnTokens,
isLoading,
error,
} = useBurnToken(">>YourERC20ContractInstance<<");

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

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

Signature:

export declare function useBurnToken(
contract: RequiredParam<Erc20>,
): import("@tanstack/react-query").UseMutationResult<
Omit<
{
receipt: import("@ethersproject/abstract-provider").TransactionReceipt;
data: () => Promise<unknown>;
},
"data"
>,
unknown,
TokenBurnParams,
unknown
>;

Parameters

ParameterTypeDescription
contractRequiredParam<Erc20>an instance of a contract that extends the ERC20 spec (token, token drop, custom contract that follows the ERC20 spec)

Returns:

import("@tanstack/react-query").UseMutationResult<Omit<{ receipt: import("@ethersproject/abstract-provider").TransactionReceipt; data: () => Promise<unknown>; }, "data">, unknown, TokenBurnParams, unknown>

a mutation object that can be used to burn tokens from the connected wallet