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 { contract } = useContract(<ContractAddress>);
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>
);
};

Signature:

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

Parameters

ParameterTypeDescription
contractRequiredParam<TokenContract>an instance of a TokenContract

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