Given a specific public key of a wallet, how do I get all NFTs that the wallet owns?

Calling Metaplex doesn't work, it always returns the NFTs of a specific wallet I can't understand why even though I provide a different wallet on multiple attempts.

  • How did you try to get the NFTs through metaplex? Nov 7, 2022 at 22:11

1 Answer 1


The Method that I would recommend is using the metaplex JS SDK.

This example is ripped from Solana Cookbook.

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

(async () => {
  const connection = new Connection(clusterApiUrl("mainnet-beta"), "confirmed");
  const keypair = Keypair.generate();

  const metaplex = new Metaplex(connection);

  const owner = new PublicKey("2R4bHmSBHkHAskerTHE6GE1Fxbn31kaD5gHqpsPySVd7");
  const allNFTs = await metaplex.nfts().findAllByOwner(owner);


This example will only work locally, since it's using the keypair identity it will only work locally. Instead you can also use the connected wallets identity (e.g. like in this metaplex example). If you then want to find all NFTs of that wallet just call findAllByOwner(metaplex.identity().publicKey)

  • this method doesn't work, because no matter which wallet owner you specify, the returned NFT list is always from the same NFT wallet. For example if I specify 3 different wallet in 3 different tries, metaplex return the NFT list of the same wallet each time, and this wallet is not even one of the 3 that was tested.
    – 2095377
    Nov 8, 2022 at 13:26
  • Also mainnet-beta rpc refuses the connection with this kind of request
    – 2095377
    Nov 8, 2022 at 14:22
  • Are you using exactly this code? Which part are you changing to get different results? Nov 9, 2022 at 14:03
  • Also you should never use the default rpc in your programs. It has too many limitations Nov 9, 2022 at 14:03
  • const allNFTs = await metaplex.nfts().findAllByOwner({ owner: owner }); This worked for me, while the solution above never returned anything.
    – Fussinger
    Dec 6, 2022 at 12:48

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.