Skip to main content

ERC20 - Mint Tokens

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

Mint Tokens

Mint tokens to a specified address.

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

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

return (
<button
disabled={isLoading}
onClick={() => mintTokens({ to: "{{wallet_address}}", amount: 1000 })}
>
Mint!
</button>
);
};

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

View in React SDK Documentation