mint
Description
This function mints a new ERC721 token with the given tokenURI to the specified recipient address.
Parameters
| Name | Type | Description |
|---|---|---|
| to | string | the wallet address that receives the NFT after mint |
| tokenURI | string | the URL of the metadata. We recommend using IPFS. |
| overrides? | Overrides | Optional 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);