Fetching NFT Data
Learn how to fetch your NFT data
Since most NFTs are stored on-chain, retrieving metadata can be a complex process. There are two main options for retrieving data.
Directly from the Source Network
From Koii Nodes
Using Koii-X custom query hook
Directly from the Source Network
Reading data from the source network directly means that we can often only read one NFT at a time and that the data will be missing contextual information. This can still be useful for certain applications and during testing.
Atomic NFTs (from Arweave)
Atomic NFTs are some of the easiest to read into an application, since Arweave has a number of supported REST APIs. The arweave.net gateway provides easy CORS-compatible services for pulling in contract data, but it will need to be reconstructed using the SmartWeave libraries client-side to get the latest state.
Ethereum NFTs (from Ethereum, Polygon, or Avalanche)
Ethereum NFTs are coming soon to Koii-X Templates.
From the Koii Nodes via the Mainnet API
If you are using Atomic NFTs, there is often a lot of additional information such as attention tracking counts, total KOII rewards, and bridging information. To fetch full NFT records, you can query the Koii Mainnet Gateway APIs as shown below:
Using Koii-X custom query hook
This is the easiest way to fetch the data of an NFT:
Import useNft
query hook
Pass your NFT id to useNft
That's it. You should have this NFT content in data
Last updated