Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json field is always null #509

Open
mellosti opened this issue May 5, 2023 · 2 comments
Open

json field is always null #509

mellosti opened this issue May 5, 2023 · 2 comments

Comments

@mellosti
Copy link

mellosti commented May 5, 2023

I followed this guide to create a React app with Vite and metaplex. My code looks like this:

import { Metaplex, Nft, PublicKey } from "@metaplex-foundation/js";
import { connection } from "../config/network";

const METAPLEX = Metaplex.make(connection);
const NFTS_CLIENT = METAPLEX.nfts();

export async function getNFTsByOwner(owner: PublicKey): Promise<Nft[]> {
  const metadatas = await NFTS_CLIENT.findAllByOwner({
    owner: new PublicKey(owner),
  });

  const nftsAndSfts = await Promise.all(
    metadatas.map((metadata) =>
      metadata.model === "metadata" ? NFTS_CLIENT.load({ metadata }) : metadata
    )
  );

  return nftsAndSfts.filter((nft) => nft.model === "nft") as Nft[];
}

However, the json field in Nft is always null, even though jsonLoaded is true. I have included "@metaplex-foundation/js": "^0.19.1", in my package.json. No error in the console.

@viandwi24
Copy link

me too have this error

@rohanasif
Copy link

Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants