1

I am trying to pull the collection info for some NFTs and getting different metadata back than what is on solscan. Here is my sample code using something from the Genopet Cracked Egg collection.

const { Connection, PublicKey } = require('@solana/web3.js');
const { Metaplex } = require('@metaplex-foundation/js');

(async () => {
    const metaplex = new Metaplex(new Connection('https://rpc.helius.xyz/?api-key=foobar'));
    const mintAddress = new PublicKey("FMK7JqQkbqHyKM3gV5o8GznbquzQqaGwSMX6KPhFtD5r");

    const nft = await metaplex.nfts().findByMint({ mintAddress });
    console.log(JSON.stringify(nft, null, 2));
})();

It returns this result which gives the collection name and family in json but the collection attribute is null.

{
  "model": "nft",
  "updateAuthorityAddress": "GenoS3ck8xbDvYEZ8RxMG3Ln2qcyoAN8CTeZuaWgAoEA",
  "json": {
    "name": "Cracked Genopet Egg #2572",
    "symbol": "CRACKED",
    "description": "This egg has cracked and can no longer be hatched into a Genopet.",
    "seller_fee_basis_points": 500,
    "image": "https://arweave.net/h9fUMsvnWV8X3DOHz_fMwLoYCacL5AQYAHOM5sswXqA",
    "external_url": "https://genopets.me",
    "attributes": [
      {
        "display_type": "number",
        "trait_type": "sequence",
        "value": 2572
      }
    ],
    "collection": {
      "name": "Genopet Eggs",
      "family": "Genopets"
    },
    "properties": {
      "category": "image",
      "files": [
        {
          "uri": "https://arweave.net/h9fUMsvnWV8X3DOHz_fMwLoYCacL5AQYAHOM5sswXqA",
          "type": "image/png"
        }
      ],
      "creators": [
        {
          "address": "GenoS3ck8xbDvYEZ8RxMG3Ln2qcyoAN8CTeZuaWgAoEA",
          "share": 100
        }
      ]
    }
  },
  "jsonLoaded": true,
  "name": "Cracked Genopet Egg #2572",
  "symbol": "CRACKED",
  "uri": "https://arweave.net/bwuxDCy0X5yl3Vbtc_mtcTZWwSsNHaaJ-Z-Jg3F7pF0",
  "isMutable": true,
  "primarySaleHappened": true,
  "sellerFeeBasisPoints": 500,
  "editionNonce": 254,
  "creators": [
    {
      "address": "GenoS3ck8xbDvYEZ8RxMG3Ln2qcyoAN8CTeZuaWgAoEA",
      "verified": true,
      "share": 100
    }
  ],
  "tokenStandard": null,
  "collection": null,
  "collectionDetails": null,
  "uses": null,
  "programmableConfig": null,
  "address": "FMK7JqQkbqHyKM3gV5o8GznbquzQqaGwSMX6KPhFtD5r",
  "metadataAddress": "EsTsvN1fQz9V6oro1vW1fTA6XfeC9bRg4sRpKZ9QeuMe",
  "mint": {
    "model": "mint",
    "address": "FMK7JqQkbqHyKM3gV5o8GznbquzQqaGwSMX6KPhFtD5r",
    "mintAuthorityAddress": "BTp82p6baoBhLfVt4zkCZfJdgnztLTTQkwuyDxbw1zK",
    "freezeAuthorityAddress": "BTp82p6baoBhLfVt4zkCZfJdgnztLTTQkwuyDxbw1zK",
    "decimals": 0,
    "supply": {
      "basisPoints": "01",
      "currency": {
        "symbol": "CRACKED",
        "decimals": 0,
        "namespace": "spl-token"
      }
    },
    "isWrappedSol": false,
    "currency": {
      "symbol": "CRACKED",
      "decimals": 0,
      "namespace": "spl-token"
    }
  },
  "edition": {
    "model": "nftEdition",
    "isOriginal": true,
    "address": "BTp82p6baoBhLfVt4zkCZfJdgnztLTTQkwuyDxbw1zK",
    "supply": "00",
    "maxSupply": "00"
  }
}

Looking at the same FMK7JqQkbqHyKM3gV5o8GznbquzQqaGwSMX6KPhFtD5r token in solscan I can see collection.key is populated as I would expect.

"collection": {
    "verified": 78
    "key": "BuL27W2awQ3ETiSAgWhQbPthrTR9kQwJB9JtFJtb6DnP"
}

How can I get that collection.key in my code?

Thanks!

1 Answer 1

0

The very interesting thing here is

"verified": 78

This should normally set to be either 1 or 0 (Boolean style). The is most likely why the js sdk does not see it as verified: it should be verified:1

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.