1

Im using Metaplex JavaScript SDK and sometimes in uri link has a collection field, but what other way is there to get nft collection name when i have a similar data enter image description here

1
  • please replace screenshots with text in code blocks so the indexer can improve discoverability of this post
    – trent.sol
    Aug 18, 2022 at 21:46

1 Answer 1

3

The collection field acts as a link to another NFT that represent the collection, so if you want the collection name you have to run findByMint() with the collection.key in order to decode the collection metadata and get its name. Also, there are NFTs without an onchain collection setted and thats why you have some NFTs with collection and other without it.

Remember that js-sdk is now at version 0.14 where the NFT object changes a bit and there are some other functions, so try to use the latest version of the sdk.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.