πŸͺ™ERC20s

Learn how to fetch ERC20 tokens in common from multiple users.

Airstack provides easy-to-use APIs for enriching dapps and integrating on-chain and off-chain data from Ethereum, Base, Degen Chain, and other Airstack-supported chains.

In this guide, you will learn how to use Airstack to fetch ERC20 Tokens In Common.

Pre-requisites

  • An Airstack account

  • Basic knowledge of GraphQL

Get Started

JavaScript/TypeScript/Python

If you are using JavaScript/TypeScript or Python, Install the Airstack SDK:

React

npm install @airstack/airstack-react

Node

npm install @airstack/node

Then, add the following snippets to your code:

import { init, useQuery } from "@airstack/airstack-react";

init("YOUR_AIRSTACK_API_KEY");

const query = "YOUR_QUERY"; // Replace with GraphQL Query

const Component = () => {
  const { data, loading, error } = useQuery(query);

  if (loading) {
    return <p>Loading...</p>;
  }

  if (error) {
    return <p>Error: {error.message}</p>;
  }
};

Other Programming Languages

To access the Airstack APIs in other languages, you can use https://api.airstack.xyz/gql as your GraphQL endpoint.

ERC20 Tokens In Common

You can fetch common ERC20 tokens of multiple user(s) provided the user's 0x address, Farcaster name or ID, ENS domains, or Lens profile:

Try Demo

Code

query MyQuery {
  TokenBalances(
    input: {
      filter: { owner: { _eq: "betashop.eth" }, tokenType: { _eq: ERC20 } }
      blockchain: base
    }
  ) {
    TokenBalance {
      token {
        tokenBalances(
          input: {
            filter: {
              owner: { _eq: "tokenstaker.eth" }
              tokenType: { _eq: ERC20 }
            }
          }
        ) {
          id
          token {
            address
            symbol
            name
          }
        }
      }
    }
  }
}

Developer Support

If you have any questions or need help regarding fetching common ERC20 tokens of multiple users, please join our Airstack's Telegram group.

More Resources

Last updated

Was this helpful?