0

my users wants to share full NFT inventory in my app, including Tokens that aren't wide known and/or without supportted dapps (end of dapp's life). In brief, a complete NFT gallery for any user.

I understand that server must have database pairing control and regular block checks over already-in-database per-user nfts, etc...

My question is about the workflow to query every NFT that a public address owns, and then, if anyone can explain me what kind of data expected, and how to get the nft picture (if any) from where it is...

It's really a mess to try to easy undestand that chaos of thecnical documents, proposals and improvements...

1 Answer 1

2

This should be helpful for you:

You can get all the NFTs owned by a wallet and the metadata with the image link using Moralis NFT API. Here is an example

const Moralis = require("moralis").default;

const runApp = async () => {
  const { EvmChain } = Moralis.EvmUtils;

  await Moralis.start({
    apiKey: "YOUR_API_KEY",
    // ...and any other configuration
  });

  const chain = EvmChain.ETHEREUM;
  const address = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  const response = await Moralis.EvmApi.nft.getWalletNFTs({
    address,
    chain,
  });

  console.log(response.raw);
};

runApp();

And this is what the results will look like.

    {
      "token_address": "0x60f80121c31a0d46b5279700f9df786054aa5ee5",
      "token_id": "243505",
      "amount": "1",
      "owner_of": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "token_hash": "d60c9b8b29f229f20dffd567160bf823",
      "block_number_minted": "11970126",
      "block_number": "17999875",
      "possible_spam": true,
      "contract_type": "ERC721",
      "name": "Rarible",
      "symbol": "RARI",
      "token_uri": "https://ipfs.moralis.io:2053/ipfs/QmQ8Ltyq5k9PasVbdVJMBsuGfeyV3omcyRWCTrPSuoxLGd",
      "metadata": "{\"name\":\"Fearless Wolf howling in the night \",\"description\":\"A unique art which describes a fearless wolf which is looking at the sky and calling its pack.\",\"image\":\"ipfs://ipfs/QmTu4i8BvLf2Y6VVU2TZnqxqWuRfxes3UA5XCXFZ2x3YTw/image.png\",\"external_url\":\"https://app.rarible.com/token/0x60f80121c31a0d46b5279700f9df786054aa5ee5:243505\",\"attributes\":[]}",
      "last_token_uri_sync": "2023-07-09T16:24:18.721Z",
      "last_metadata_sync": "2023-09-03T23:45:47.520Z",
      "minter_address": "0x31148e9423e6abdcdcf4cd6b13cbebdeca29a9fe",
      "verified_collection": false
    },
    {
      "token_address": "0x765c1d9b32bb20c143aeebfe56e6e7f15d2e8af0",
      "token_id": "240",
      "amount": "1",
      "owner_of": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "token_hash": "d28dfd1f155784070ee485ae9128a09f",
      "block_number_minted": "17955094",
      "block_number": "17998800",
      "possible_spam": false,
      "contract_type": "ERC721",
      "name": "Calendar For Every Day",
      "symbol": "CFED",
      "token_uri": "https://ipfs.moralis.io:2053/ipfs/QmWLRc117eCUPPgqx47x64nCdnLSTALJFQ6LVrRRF9SAKJ/192.json",
      "metadata": "{\"name\":\"July 10\",\"description\":\"Hello! I hasten to congratulate you on your birthday! You were born on the same day as Ilya Oleinikov and Yuri Stoyanov (yes, the hosts of Gorodok were born on the same day with a difference of exactly 10 years), inventor and scientist Nikola Tesla and designer Harvey Ball, who created the yellow emoticon, one of the most vivid visual images of the 20th century! I wish you smiles, happiness and light!\",\"image\":\"https://aqua-quiet-smelt-745.mypinata.cloud/ipfs/QmRZTvUaZ9Gp7NZvGGki2CWEcEsxbkCupYQkSzw6Yb9aPy/192.jpg\",\"edition\":192,\"date\":1680889097877,\"attributes\":[{\"trait_type\":\"Calendar\",\"value\":\"Happy Birthday\"}]}",
      "last_token_uri_sync": "2023-08-20T09:34:30.974Z",
      "last_metadata_sync": "2023-09-03T23:48:02.911Z",
      "minter_address": null,
      "verified_collection": false
    },

You can find a guide here: How to get all the NFTs owned by an address

Disclosure: I work at Moralis

1
  • I try to create an account at moralis, but the resut is that my email is invalid, think due it's @xxx.com with only 3 chars as domain name so validator isn't working. can I contact anyone to solve that, all my developer accounts are under that mail. EDIT: It's also my google account so, optional methods fails too...
    – ManOguaR
    Oct 5, 2023 at 4:27

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.