Links
🗃

NFT & POAP Holders

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

🗃 NFT & POAP Holders

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 (free)
  • 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:
npm
yarn
pnpm
pip
React
npm install @airstack/airstack-react
Node
npm install @airstack/node
React
yarn add @airstack/airstack-react
Node
yarn add @airstack/node
React
pnpm install @airstack/airstack-react
Node
pnpm install @airstack/node
pip install airstack
Then, add the following snippets to your code:
React
Node
Python
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>;
}
};
import { init, fetchQuery } from "@airstack/node";
init("YOUR_AIRSTACK_API_KEY");
const query = `YOUR_QUERY`; // Replace with GraphQL Query
const { data, error } = await fetchQuery(query);
console.log("data:", data);
console.log("error:", error);
import asyncio
from airstack.execute_query import AirstackClient
api_client = AirstackClient(api_key="YOUR_AIRSTACK_API_KEY")
query = """YOUR_QUERY""" # Replace with GraphQL Query
async def main():
execute_query_client = api_client.create_execute_query_object(
query=query)
query_response = await execute_query_client.execute_query()
print(query_response.data)
asyncio.run(main())
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.
Airstack AI (Demo)

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

https://app.airstack.xyz/query/203pV6Pyns
Get the NFT holders that have XMTP (Demo)

Code

Query
Response
query MyQuery {
TokenBalances(
input: {
filter: {
tokenAddress: { _eq: "0xc0f95066899efd7c0540b9474f81355a83e6f578" }
}
blockchain: ethereum
}
) {
TokenBalance {
owner {
xmtp {
isXMTPEnabled
}
addresses
}
}
}
}
{
"data": {
"TokenBalances": {
"TokenBalance": [
{
"owner": {
"xmtp": [
{
"isXMTPEnabled": true // XMTP is enabled
}
],
"addresses": ["0xa64af7f78de39a238ecd4fff7d6d410dbace2df0"]
}
},
{
"owner": {
"xmtp": [], // XMTP is not enabled
"addresses": ["0x7a3c17937749780432db64f6569b6671c0b45e1b"]
}
}
]
}
}
}

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

https://app.airstack.xyz/query/EtrCwWln2c
Get the POAP holders that have XMTP (Demo)

Code

Query
Response
query POAPEventHoldersWithXMTP {
Poaps(input: { filter: { eventId: { _eq: "141910" } }, blockchain: ALL }) {
Poap {
owner {
addresses
xmtp {
isXMTPEnabled
}
}
}
}
}
{
"data": {
"Poaps": {
"Poap": [
{
"owner": {
"addresses": ["0xda85048c977134b09fc05cd3d1abd3a63e8edf4d"],
"xmtp": [] // XMTP is not enabled
}
},
{
"owner": {
"addresses": ["0x546457bbddf5e09929399768ab5a9d588cb0334d"],
"xmtp": [
{
"isXMTPEnabled": true // XMTP is enabled
}
]
}
}
]
}
}
}

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