Skip to main content

mint

Description

This function mints a new ERC721 token with the given tokenURI to the specified recipient address.

Parameters

NameTypeDescription
tostringthe wallet address that receives the NFT after mint
tokenURIstringthe URL of the metadata. We recommend using IPFS.
overrides?OverridesOptional overrides for the contract call.

Throws

Throws an Error if the recipient address or tokenURI is invalid or if the transaction fails.

Example

import { ContractType } from "@openformat/sdk";

const contract = sdk.getContract({
contractAddress: "0x123...",
type: ContractType.NFT,
});

const params = {
to: "0x123...",
tokenURI: "ipfs://",
};
const tx = await contract.mint(params);