1

Using TS and there is the code:

let nftMetadata: any[] = [];
let allMetadata: any[] = [];
const owner = new PublicKey(publicKey);
const allNfts = await metaplex.nfts().findAllByOwner({
    owner: owner
});
allNfts.map((nft) => (
    allMetadata.push({
        'mintAddress': nft.mintAddress,
        'uri': nft.uri 
    })
));

for (var i = 0; i < allMetadata.length; i++) {
    await getNftMetadata(allMetadata[i], publicKey)
    .then((data) => {
        nftMetadata.push(data);
    })
    .catch((err) => {
        logError(err);
    })
}
return nftMetadata;

Line 'mintAddress': nft.mintAddress returning Property 'mintAddress' does not exist on type 'Metadata<JsonMetadata<string>> | Nft | Sft'. Property 'mintAddress' does not exist on type 'Nft'. So there is the metadata im receiving:

{
  model: 'metadata',
  address: Pda {
    _bn: <BN: 349b58137ce509a996500f297dcf43fd8050dec2ef4bafb242d87bb3385d8a0d>,
    bump: 253
  },
  mintAddress: PublicKey {
    _bn: <BN: 73400b567ac34be4f2a79e4889dd830e8bf18c79b993776006fe91bdcea33533>
  },
  updateAuthorityAddress: PublicKey {
    _bn: <BN: 5b563cbd973fca8abbbea3017768faaf8504641955cc67ea2e57e62439ed6d2d>
  },
  json: null,
  jsonLoaded: false,
  name: '',
  symbol: 'tSHP',
  uri: 'https://nftstorage.link/ipfs/bafybeicsimixbjpuc7p6w3ttngjtzlxm4m3rxjyanvyfutrk6ou6c6k7xi/823.json',
  isMutable: true,
  primarySaleHappened: true,
  sellerFeeBasisPoints: 600,
  editionNonce: 254,
  creators: [
    { address: [PublicKey], verified: true, share: 0 },
    { address: [PublicKey], verified: false, share: 100 }
  ],
  tokenStandard: 0,
  collection: null,
  collectionDetails: null,
  uses: null
}

1 Answer 1

1

Solved for each Token you received do these checks:

if (item.model = "nft") let mint = item.mint;

if (item.model = "sft") let mint = item.mint;

if (item.model = "metadata")let mint = item.mintAddress;

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.