đī¸ POAP HoldersLearn how to fetch holders of a given POAP(s) and how to fetch common holders of multiple given POAP(s) in a single API call using the Airstack API.
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
Basic knowledge of GraphQL
Get Started
JavaScript/TypeScript/Python
If you are using JavaScript/TypeScript or Python, Install the Airstack SDK:
npm yarn pnpm pip
React
Copy npm install @airstack/airstack-react
Node
Copy npm install @airstack/node
React
Copy yarn add @airstack/airstack-react
Node
Copy yarn add @airstack/node
React
Copy pnpm install @airstack/airstack-react
Node
Copy pnpm install @airstack/node
Then, add the following snippets to your code:
React Node Python
Copy 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 >;
}
};
Copy 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);
Copy 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.
Get POAP Holders Of A Given POAP(s)
You can fetch all POAP holders of a given POAP(s) by specifying the eventId
of the POAP, e.g. 14190
for EthCC[6] â Attendee POAP :
Try Demo
Code
Query Response
Copy query MyQuery {
Poaps(
input: {
filter : { eventId : { _in : [ "141910" ] } }
blockchain : ALL
limit : 200
}
) {
Poap {
owner {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userAssociatedAddresses
}
xmtp {
isXMTPEnabled
}
}
}
pageInfo {
nextCursor
prevCursor
}
}
}
Copy {
"data" : {
"Poaps" : {
"Poap" : [
{
"owner" : {
"addresses" : [ "0x7123ba74a7da85704c05021c421a8316930218e6" ] ,
"domains" : [
{
"name" : "molpy.eth"
}
] ,
"socials" : null ,
"xmtp" : null
}
} ,
{
"owner" : {
"addresses" : [ "0x49ea3ca642e40a26cecc9789fc7da37c90cef943" ] ,
"domains" : [
{
"name" : "delivan.eth"
}
] ,
"socials" : [
{
"dappName" : "lens" ,
"profileName" : "lens/@delivan" ,
"profileTokenId" : "121757" ,
"profileTokenIdHex" : "" ,
"userAssociatedAddresses" : [
"0x49ea3ca642e40a26cecc9789fc7da37c90cef943"
]
}
] ,
"xmtp" : [
{
"isXMTPEnabled" : true
}
]
}
} ,
{
"owner" : {
"addresses" : [ "0x3e3127478fdcca6dbb3f010882b91520e2b88fce" ] ,
"domains" : [
{
"name" : "ppolo.eth"
}
] ,
"socials" : null ,
"xmtp" : null
}
}
// other EthCC[6] POAP holders
]
}
}
}
Get POAP Common Holders Of Multiple POAPs
You can fetch the common holders of multiple POAPs by providing the eventId
s of each POAPs on every level of the Poaps
API.
The more POAPs you would like to use as an input, the more Poaps.owner
nesting you will need:
Try Demo
Code
Query Response
Copy query MyQuery {
Poaps(input: { filter : { eventId : { _eq : "141910" }}, blockchain : ALL, limit : 200 }) {
Poap {
owner {
poaps(input: { filter : { eventId : { _eq : "103093" }}}) {
owner {
addresses
domains {
name
}
socials {
dappName
profileName
profileTokenId
profileTokenIdHex
userAssociatedAddresses
}
xmtp {
isXMTPEnabled
}
}
}
}
}
}
}
Copy {
"data" : {
"Poaps" : {
"Poap" : [
{
"owner" : {
"poaps" : [
{
"owner" : { // Hold both EthCC[6] and EthDenver POAP
"addresses" : [
"0x5cb4ea65e7622f3746680451b36c3641e096ab99"
] ,
"domains" : [
{
"name" : "ponnet.eth"
} ,
{
"name" : "sponn.eth"
} ,
{
"name" : "sponnet.eth"
} ,
{
"name" : "avadao.eth"
}
] ,
"socials" : [
{
"dappName" : "lens" ,
"profileName" : "lens/@sponnet" ,
"profileTokenId" : "107203" ,
"profileTokenIdHex" : "" ,
"userAssociatedAddresses" : [
"0x5cb4ea65e7622f3746680451b36c3641e096ab99"
]
}
] ,
"xmtp" : null
}
}
]
}
} ,
{
"owner" : {
"poaps" : null // Holder of EthCC[6] POAP, but does not hold EthDenver POAP
}
}
]
}
}
}
Developer Support
If you have any questions or need help regarding fetching POAP balances, please join our Airstack's Telegram group.
More Resources