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
1 Answer
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.