opts.protocol (string)(required) - blockchain protocol must be SOLANA.
opts.wallet (Wallet)(required) - wallet to sign the transaction with.
opts.name (string)(required) - token name.
opts.symbol (string)(required) - token symbol.
opts.maxSupply (number) - maximum supply for this token (0 for unlimited; 1 for unique; 2 or more for multiple editions). Required to create master edition and copies with limited supply.
opts.amount (string) - token amount to be first minted. Required only if maxSupply is 0 or undefined.
opts.uri (string)(required) - URI containing NFT metadata.
opts.creators (array of SolanaCreators)(optional) - list of creators.
// Creating NFT with master edition and max supply of 10 copiesconst { hash } =awaitsdk.nft.create({ protocol:'SOLANA', wallet, name:'NFT', symbol:'NFT', uri:'https://....', maxSupply:'10',})// Creating NFT without master edition and no max supplyconst { hash } =awaitsdk.nft.create({ protocol:'SOLANA', wallet, name:'NFT', symbol:'NFT', uri:'https://....', amount:'100000',})
Mint NFTs
Mint an additional amount of an existing token.
sdk.nft.mint(opts)
opts.protocol (string)(required) - blockchain protocol must be SOLANA.
opts.wallet (Wallet)(required) - wallet to sign the transaction with.
opts.token (string)(required) - token address to be minted. If this token is a master edition, this is the address of the master edition token that will be used to create copies (editions).
Solana NFTs use the Metaplex Standard to add metadata information to regular SPL Tokens.
SPL stands for Solana Program Library, which is a collection of on-chain programs that interact with the Solana blockchain.
You can think of SPL Tokens as equivalent to Ethereum's ERC-20 tokens. The Metaplex protocol is responsible for adjoining extra data onto these ERC-20-like tokens, effectively making them NFTs. If their max supply is set to 1, then it can be seen as an ERC-721 token. For higher or unlimited supplies the NFT can be compared to an ERC-1155 token. But in the end, they're the same thing!
What do I need in order to mint an NFT?
A Cryptum API key is the only requirement to create your brand new NFT for Solana. However, you probably want to add images, titles, symbols, attributes, etc. to your token. This information should be hosted in a service like Pinata or arweave, and not on the token itself.
For this example, we'll suppose you already managed to upload a JSON object to Pinata according to the Metaplex standard:
Field
Type
Description
Make sure to check the latest specifications in the official Metaplex documentation here.
Creating NFTs Programmatically with Cryptum SDK
Step 1
The first prerequisite you will need is the creation of an account and a Project (API Key) on Cryptum Dashboard.
PS: Our dashboard is almost ready! To generate an API Key, contact hello@blockforce.in
Step 2
With a valid Cryptum API Key, you can then instantiate the SDK as follows:
constwallet=awaitsdk.wallet.generateWallet({ protocol:'SOLANA', mnemonic:'lorem ipsum dolor sit amet consectetur adipiscing.....', derivation: { account:0, address:0 }})
Make sure the wallet has sufficient funds to pay for the transactions.
Step 4
Call sdk.nft.create function passing your wallet, the desired supply, and the URI to create NFT with limited supply and a master edition.
// Creating NFT with master edition and max supply of 10 copiesconst { hash } =awaitsdk.nft.create({ protocol:'SOLANA', wallet, name:'NFT', symbol:'NFT', uri:'https://....', maxSupply:'10', creators: [{ address:'Er...4h', share:10, verified:true }],// optional royaltiesFee:10,// optional collection:null// optional})
name is the token name;
symbol is the token symbol;
uri is the metadata URI;
maxSupply is the maximum supply for this NFT (0 for unlimited; 1 for unique; 2 or more for multiple editions). Required if you want to create a master edition and copies with limited supply;
amount is the NFT amount to be first minted. Required only if maxSupply is 0 or undefined;
creators is an optional parameter which consists of an array of creator information;
royaltiesFee is an optional parameter which represents a fee in percentage;
collection is an optional collection address;
To create NFT without limited supply and master edition do this:
// Creating NFT without master edition and no max supplyconst { hash } =awaitsdk.nft.create({ protocol:'SOLANA', wallet, name:'NFT', symbol:'NFT', uri:'https://....', amount:'100000'})
There you go! The hash variable now holds the token address, which you can inspect in an explorer such as this one or this other one.
Minting NFTs
To mint more NFTs on Solana you have to pass the wallet with the token's mint authority, the token address, destination address and the amount.
The amount must be 1 or null if this NFT has a master edition.