mint
Last updated
Was this helpful?
Last updated
Was this helpful?
This method works on NFT smart contracts v1. If you want to mint on a v2 smart contract, please , then .
Mint a token for a specified reference material on a contract of your choice. You need to have been given minting permission.
The reference material is typically uploaded to IPFS or Arweave and can be easily done through our uploadReference
method found in the storage module. Follow to learn how to handle permanent uploads!
Royalties can be configured to provide a customized flow of funds as explained below.
It is possible to configure the amount of copies you want to mint through the amount
field, but currently they will all share the same reference material.
The nftContactId can be supplied as an argument or through the TOKEN_CONTRACT
environment variable.
As with all new SDK api methods, this call should be wrapped in and passed a signing method. For a guide showing how to make a contract call with mintbase-js click
mint
takes a single argument of type MintArgs
contractAddress
(optional): The address of the contract where the token will be minted. If not provided, the TOKEN_CONTRACT environment variable will be used.
ownerId
: The NEAR account ID of the owner of the token that will be minted.
metadata
: An object containing the metadata of the token. It includes properties like title, description, media, etc.
royalties
(optional): An object that specifies how the funds from the sale of the token will be split among different parties.
amount
(optional): The number of copies of the token that you want to mint. If not provided, only one copy will be minted.
noMedia
(optional): If you mint a token with metadata.media = null
, this method will throw an error. While the Mintbase Market can generally deal with media in the reference material, many third parties, most notably wallets, cannot. To disable this check and explicitly mint with the risk of breaking third-party compatibility, use noMedia: true
noReference
(optional): Similar to noMedia
, but with respect to the metadata.reference
field. This is less crucial for NFT display, but Mintbase NFTs usually come with rich data that does not fit into the NEAR metadata standards, and are thus stored using the reference
URI.
Example usage of mint method in a hypothetical React component: