json field is always null
mellosti opened this issue · 2 comments
mellosti commented
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 commented
me too have this error
rohanasif commented
Same here