Skip to main content

NFTCollection.mintTo() method

Mint a unique NFT

Example

// Address of the wallet you want to mint the NFT to
const walletAddress = "{{wallet_address}}";

// Custom metadata of the NFT, note that you can fully customize this metadata with other properties.
const metadata = {
name: "Cool NFT",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
};

const tx = await contract.mintTo(walletAddress, metadata);
const receipt = tx.receipt; // the transaction receipt
const tokenId = tx.id; // the id of the NFT minted
const nft = await tx.data(); // (optional) fetch details of minted NFT

Signature:

mintTo(walletAddress: string, metadata: NFTMetadataOrUri): Promise<TransactionResultWithId<NFTMetadataOwner>>;

Parameters

ParameterTypeDescription
walletAddressstring
metadataNFTMetadataOrUri

Returns:

Promise<TransactionResultWithId<NFTMetadataOwner>>

Remarks

Mint a unique NFT to a specified wallet.