πŸ—ƒοΈNFT & POAP Holders

Learn how to use Airstack to get all holders of NFT or POAP that have XMTP.

Airstack provides easy-to-use APIs for enriching XMTP applications and integrating on-chain and off-chain data with XMTP.

Table Of Contents

In this guide, you will learn how to use Airstack to check if holders of a given NFT or POAP have XMTP enabled:

Pre-requisites

  • An Airstack account

  • Basic knowledge of GraphQL

  • Basic knowledge of XMTP

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.

NFT Holders

Get the NFT holders that have XMTP using the TokenBalances API and provide an NFT contract address for the $tokenAddress input:

Try Demo

Get the NFT holders that have XMTP (Demo)

Code

query MyQuery {
  TokenBalances(
    input: {
      filter: {
        tokenAddress: { _eq: "0xc0f95066899efd7c0540b9474f81355a83e6f578" }
      }
      blockchain: ethereum
    }
  ) {
    TokenBalance {
      owner {
        xmtp {
          isXMTPEnabled
        }
        addresses
      }
    }
  }
}

POAP Holders

Get the POAP holders that have XMTP using the Poaps API and provide an POAP event ID for the $eventId input:

Try Demo

Get the POAP holders that have XMTP (Demo)

Code

query POAPEventHoldersWithXMTP {
  Poaps(input: { filter: { eventId: { _eq: "141910" } }, blockchain: ALL }) {
    Poap {
      owner {
        addresses
        xmtp {
          isXMTPEnabled
        }
      }
    }
  }
}

Developer Support

If you have any questions or need help regarding checking XMTP for holders of a given NFT or POAP, please join our Airstack's Telegram group.

More Resources

Last updated

Was this helpful?