๐Ÿ–ผ
SolanaAPI.nft
You can query NFTs and get their metadata on Solana
All the methods extend from Moralis.SolanaAPI.nft

getNFTMetadata

Returns the metadata of a SPL NFT.

Options:

  • network: The network cluster to get data from. Valid values are listed on the Supported Networks. Default value mainnet.
  • address: A SPL NFT address (i.e. HsXZnAba2...).
JS
React
curl
Unity
1
// get devnet metadata for a given SPL NFT address
2
const options = {
3
network: "devnet",
4
address: "6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe",
5
};
6
const nftMetadata = await Moralis.SolanaAPI.nft.getNFTMetadata(options);
Copied!
1
import { useMoralisSolanaApi, useMoralisSolanaCall } from "react-moralis";
2
โ€‹
3
const { nft } = useMoralisSolanaApi();
4
โ€‹
5
// get devnet SPL NFT metadata for a given address
6
const options = {
7
network: "devnet",
8
address: "6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe",
9
};
10
const { fetch, data, isLoading } = useMoralisSolanaCall(
11
nft.getNFTMetadata,
12
options
13
);
Copied!
1
curl -X 'GET' \
2
'https://solana-gateway.moralis.io/nft/devnet/6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe/metadata' \
3
-H 'accept: application/json' \
4
-H 'X-API-Key: MY-API-KEY'
Copied!
1
using MoralisUnity;
2
using MoralisUnity.SolanaApi.Models;
3
using UnityEngine;
4
โ€‹
5
public class Example
6
{
7
// get mainnet metadata for a given SPL NFT address
8
public async void GetSPLNftMetadata()
9
{
10
NftMetadata nftmetadata = await Moralis.SolanaApi.Nft.GetNFTMetadata(NetworkTypes.mainnet, "6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe");
11
Debug.Log(nftmetadata);
12
}
13
}
Copied!

Example result:

1
{
2
"mint": "string",
3
"standard": "string",
4
"name": "string",
5
"symbol": "string",
6
"metaplex": {
7
"metadataUri": "string",
8
"masterEdition": true,
9
"isMutable": true,
10
"primarySaleHappened": true,
11
"sellerFeeBasisPoints": 0,
12
"updateAuthority": "string"
13
}
14
}
Copied!
Copy link