Mint your first NFT
Go through API Quickstart before starting this section.
There are a couple of ways you can design and mint an NFT.
Option 1 - Design in Admin Portal, mint using API
Design your NFT
Log into the Admin Portal, and open Collectibles
Create a Set
Create a Collectible inside the Set.
Specify the total supply of the Collectible (i.e. how many NFTs of this shape can be created) as
quantity
Upload media content, which automatically gets uploaded to the InterPlanetary File System (IPFS).
Add any custom metadata you would like to be part of your NFT.
Follow this guide for more information on navigating the Admin Portal.
Query
Let's query what we just created. At this point it's just a blueprint of what an NFT would look like when minted; it doesn't exist on the blockchain yet. This "NFT blueprint" is called an NFTModel
in the API.
The following query returns a paginated list of all the NFTModels you've created for your app so far. Since we just created one, we should get a single item back.
For appId
, pass in your app's client ID (available from the Your App page in Admin Portal).
You can find other ways of querying for NFTs belonging to an app, a user or a wallet in the following guide:
Querying NFTsMint
It's time to mint! Take the id
of the NFTModel
returned by the query above, and execute the following mutation:
This kicks off minting asynchronously, which can be tracked by checking the value of state
on NFTModel
.
Now you can query NFTModel
to see when minting is completed.
Congratulations on making it this far! Don't worry if some of this still doesn't make sense. The next sections will go over the API in more detail. You already have enough context to start adding NFTs to your application.
Option 2 - Create everything with API
This section details how to create an NFT entirely using the API - uploading files, setting metadata, and minting:
Creating NFTsBonus - Transfer NFT to your Wallet
If you created a wallet in the previous guide, you can use the transfer
API to mint and transfer an NFT to your wallet in one go!
Pass in the address
of your Wallet, and the ID of the NFTModel
from the previous section.
This API showcases the benefits of the web2 + web3 approach of the Niftory API: while minting and transfer can be time-consuming operations on the blockchain, you get an NFT
object back instantly, whose state gets updated asynchronously. This allows you as an app developer to build very responsive web3 apps with eventual consistency with the blockchain.
Last updated