2

I'm interested in retrieving all the NFTs associated with a specific creator address. I'm looking for a method or approach to gather comprehensive information about the NFTs owned or created by a particular address. If you have any suggestions or recommendations on how to achieve this, I would appreciate your insights - elchuo160

3 Answers 3

5

You should be able to use the Metaplex SDK with an RPC provider like QuickNode.

Here's an example:

const connection = new Connection(clusterApiUrl("rpc_url_here"));
const keypair = Keypair.generate();

const metaplex = new Metaplex(connection);
metaplex.use(keypairIdentity(keypair));

const mintAddress = new PublicKey(
  "address_here"
);

const nft = await metaplex.nfts().findByMint({ mintAddress });

console.log(nft.json);

You can get the data using that route, but to get it faster without any hassle, you can use a custom method qn_fetchNFTsByCreator from QuickNode. In that way you can use the RPC endpoint to call the native Solana JSON-RPC methods too.

Here's the code example in JavaScript:

const axios = require("axios");
(() => {
  const config = {
    headers: {
      "Content-Type": "application/json",
    },
  };
  const data = {
    jsonrpc: "2.0",
    id: 1,
    method: "qn_fetchNFTsByCreator",
    params: [
      {
        creator: "DznU28LgherhU2JwC2db3KmAeWPqoF9Yx2aVtNUudW6R",
        page: 1,
        perPage: 3,
      },
    ],
  };
  axios
    .post("quicknode_rpc_url", data, config)
    .then(function (response) {
      // handle success
      console.log(response.data);
    })
    .catch((err) => {
      // handle error
      console.log(err);
    });
})();
1

You can use the findAllByCreator method from @metaplex-foundation/js

import { Metaplex } from "@metaplex-foundation/js";
import { Connection, clusterApiUrl } from "@solana/web3.js";

const connection = new Connection(clusterApiUrl("mainnet-beta"));
const metaplex = new Metaplex(connection);

const nfts = await metaplex.nfts().findAllByCreator({ creator });

https://github.com/metaplex-foundation/js#findallbycreator

The findAllByCreator method accepts a public key and returns all NFTs that have that public key registered as their first creator. Additionally, you may provide an optional position parameter to match the public key at a specific position in the creator list.

0

Metaplex function might fail if creator has too many NFTs. If you get stuck with that, you can use metaboss alternatively. That's Cli tool.

https://metaboss.rs/snapshot.html

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.