Function useMintToken

  • Beta

    Mint tokens

    Parameters

    Returns UseMutationResult<Omit<{
        data: (() => Promise<unknown>);
        receipt: providers.TransactionReceipt;
    }, "data">, unknown, TokenParams, unknown>

    a mutation object that can be used to mint new tokens to the connected wallet

    Example

    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>
    );
    };

    Twfeature

    ERC20Mintable

    See

    Documentation

Generated using TypeDoc