⚖ī¸POAP Balances

Learn how to fetch POAPs held by various web3 identities, such as 0x addresses, ENS domains, Lens profiles, and Farcasters. You will also learn how to fetch commonly held POAPs between multiple users.

Airstack provides easy-to-use APIs for enriching POAP applications and for integrating POAP on-chain data indexed directly from both Ethereum and Gnosis.

Table Of Contents

In this guide you will learn how to use Airstack to:

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 (data) {
    return <p>Data: {JSON.stringify(data)}</p>;
  }

  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.

🤖 AI Natural Language​

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 POAPs Held By 0x Address(es)

You can fetch all the POAPs held by by providing it as an input to the owner filter input:

Try Demo

Code

query MyQuery {
  Poaps(
    input: {
      filter: { owner: { _in: ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"] } }
      blockchain: ALL
    }
  ) {
    Poap {
      eventId
      tokenId
      poapEvent {
        eventName
        description
      }
    }
  }
}

Get POAPs Held By ENS Domain(s)

You can fetch all the POAPs held by ENS Domain(s) by providing it as an input to the owner filter input:

Try Demo

Code

query MyQuery {
  Poaps(
    input: { filter: { owner: { _in: ["vitalik.eth"] } }, blockchain: ALL }
  ) {
    Poap {
      eventId
      tokenId
      poapEvent {
        eventName
        description
      }
    }
  }
}

Get POAPs Held By Lens Profile(s)

You can fetch all the POAPs held by Lens profile(s) by providing either the Lens profile name or ID as an input to the owner filter input:

Try Demo

Code

query MyQuery {
  Poaps(
    input: { filter: { owner: { _in: ["lens/@vitalik"] } }, blockchain: ALL }
  ) {
    Poap {
      eventId
      tokenId
      poapEvent {
        eventName
        description
      }
    }
  }
}

Get POAPs Held By Farcaster User(s)

You can fetch all the POAPs held by Farcaster(s) by providing the of fid as an input to the owner filter input:

Try Demo

Code

query MyQuery {
  Poaps(
    input: {
      filter: { owner: { _in: ["fc_fname:vitalik.eth", "fc_fid:602"] } }
      blockchain: ALL
      limit: 200
    }
  ) {
    Poap {
      eventId
      tokenId
      poapEvent {
        eventName
        description
      }
    }
  }
}

Get POAPs In Common Held By Multiple Users

You can fetch all the POAPs commonly held by multiple users, in the following example take 2 users betashop.eth and ipeciura.eth:

Try Demo

Code

query CommonPOAPs {
  Poaps(
    input: {
      filter: { owner: { _eq: "betashop.eth" } }
      blockchain: ALL
      limit: 200
    }
  ) {
    Poap {
      poapEvent {
        poaps(input: { filter: { owner: { _eq: "ipeciura.eth" } } }) {
          poapEvent {
            eventName
            eventId
            endDate
            country
            city
          }
        }
      }
    }
    pageInfo {
      nextCursor
      prevCursor
    }
  }
}

Developer Support

If you have any questions or need help regarding fetching POAP balances, please join our Airstack's Telegram group.

More Resources

Last updated

Was this helpful?