Learn how to get ERC20 token balances of user(s) on Ethereum, Base, Zora, and other Airstack-supported chains.
Airstack provides easy-to-use APIs for enriching Web3 applications and integrating ERC20 token balance data from Ethereum, Base, Degen Chain, and other Airstack-supported chains.
Airstack provides an AI solution for you to build GraphQL queries to fulfill your use case easily. You can find the AI prompt of each query in the demo's caption or title for yourself to try.
Get All ERC20s Owned By User(s)
You can fetch all ERC20 tokens owned by any user(s) across multiple chains, e.g. Ethereum, Base, Degen Chain, and other Airstack-supported chains, using the TokenBalances API:
For fetching ERC20 token balances data from multiple chains, check out Cross-Chain Queries.
Try Demo
Code
queryMyQuery { TokenBalances( input: {filter: {owner: {_in: ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045""vitalik.eth""lens/@vitalik""fc_fname:vitalik" ] }tokenType: { _eq: ERC20 } }blockchain: ethereum # Can be changed to other Airstack-supported chainslimit: 50 } ) { TokenBalance { owner { addresses domains { name isPrimary } socials { profileName profileTokenId profileTokenIdHex userAssociatedAddresses } xmtp { isXMTPEnabled } } amount tokenAddress token { name symbol } } pageInfo { nextCursor prevCursor } }}