Skip to main content

useMintToken

Description

Hook to mint ERC20 tokens

Parameters

NameTypeDescription
tostringThe address to which the newly minted tokens will be sent.
tokenURIstringThe amount of tokens to mint.
[overrides]OverridesOptional overrides for the contract call.

Example

import { useContract, useMintToken } from "@openformat/react";

// address of a created token (ERC20) contract. You can get this from the subgraph.
const address = "0x123...";

// returns an instance of the token.
const { data: token } = useContract(address);

const { data, mint, isLoading, error } = useMintToken(token);

async function handleMint() {
await mint({ to: "0x123...", amount: 5 });
}