đĒToken Gating
Learn how to enable users to access certain features only if they hold certain POAP(s) or have common POAPs with a given user.
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
Node
Then, add the following snippets to your code:
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.
Gating Only User(s) That Have A Given POAP
You can gate certain feature access only to users that have attended a certain POAP event, e.g. EthCC[6] - Attendee POAP:
Try Demo
Code
If Poaps.Poap
returned a non-empty array, filled with mintHash
and mintOrder
data, it indicates that the POAP has been minted under the given user account and thus showing that the user have attended the POAP event.
In such case, the user shall be granted feature access. Otherwise, no access shall be given.
Gating Only User(s) That Have Multiple Given POAP(s)
You can gate certain feature access only to users that have attended multiple given POAP events, e.g. EthCC[6] - Attendee POAP and EthDenver 2023 POAP:
If you would like to add more POAP events to check, then you can simply add another owner.poaps
nesting under the innermost poaps
field with the newly added POAPs eventId
as an input .
To see more details and example demos, check out Combinations of Multiple POAPs.
Try Demo
Code
If the innermost owner.poaps
return a non-empty array, then it implies that the user has attended the given multiple events and thus feature access can be given to the user.
Otherwise, no feature access shall be given to the user.
Gating Only User(s) That Have Common POAP(s) With A Given User
You can gate certain feature access only to users that have attended the same POAP event as a given user.
In other words, have common POAP(s) with the given user, e.g. checking if nich.eth
can be given any access by checking any common POAP with another user sponnet.eth
:
If you would like to add more users, then you can simply add another poapEvent.poaps
nesting under the innermost poaps
field with the newly added POAPs owner
as an input .
To see more details and example demos, check out POAPs in Common.
Try Demo
Code
If nich.eth
have at least 1 common POAP with sponnet.eth
as shown in the sample response, then nich.eth
can be given access to the gated feature.
Otherwise, no feature access shall be given to nich.eth
.
Developer Support
If you have any questions or need help building token gating with POAPs, please join our Airstack's Telegram group.
More Resources
Last updated
Was this helpful?