How do I get all the NFTs (ERC-721 & 1155) and Tokens (ERC-20) for a wallet address? Is there an API for this?
Irwing Tello
erc-1155erc-20erc-721nft
How do I get all the NFTs (ERC-721 & 1155) and Tokens (ERC-20) for a wallet address? Is there an API for this?
Irwing Tello
Best Answer
You can get this data using the
balanceOf
function of the token smart contracts. But doing this for each token and NFT is not a nice experience.Using a solution like QuickNode, which provides two solutions for this would be way easier.
The First option is using QuickNode custom RPCs
To use this, enable the Token and NFT API bundle Add-on on your QuickNode Ethereum endpoint.
Here's an example in ethersv6:
The second option is QuickNode Graph API
By using the following GraphQL query:
With the wallet address as a variable: