1

Is it possible to retrieve all ERC-721 tokens and associated contract addresses from a connected wallet in javascript?

I would like to do this without using an API like Alchemy (because I use a Ganache local area network for the moment).

Can we do this with ethers.js or web3.js libraries for example?

3 Answers 3

0

EOA account state does not contain anything besides nonce and ETH balance. That means that ERC721 and ERC20 tokens aren't in there either. Those are stored in storage areas of contracts that implement those standards. You can try scanning for all the event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId); twice for both when the address is the sender and the receiver to deduce the current status of NFTs in their possession.

0

This is possible but for that you need to index the full node of the blockchain networks

Then only you can get the Data.

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Dec 21, 2022 at 12:27
0

You can get all the NFTs owned by an address using Moralis NFT API.

Here is an example step-by-step: https://docs.moralis.io/web3-data-api/evm/how-to-get-all-nfts-owned-by-an-address

Let me know if you need any help!

Disclosure: I work at Moralis

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.