All Collections
Credentials and Eligibility
Custom Credential Sources
Creating Customized Credentials with Subgraph Credential: A How-To Guide
Creating Customized Credentials with Subgraph Credential: A How-To Guide
How to Create a Credential Using Subgraph Credential
Ashley avatar
Written by Ashley
Updated this week

Unlock the full potential of data with Galxe Customized Credentials with Subgraphs!

Subgraphs offer an efficient way to define and query custom data schemas, providing you with targeted access to specific data subsets.

We also offer Subgraph Credential, a seamless solution for creating credentials using subgraphs. With our Subgraph Examples, you can streamline data management and gain valuable insights tailored to your needs.

Whether you're managing NFT Holder data or tracking Campaign Participants, Subgraph Credential simplifies the credential creation process. Please note that Subgraph Credential is designed specifically for on-chain credentials, and you can conveniently update the holder list from thegraph.com.

Experience the ease and effectiveness of subgraph integration with our Subgraph Examples: NFT Holder and Campaign Participant. Start organizing and accessing your data with precision and efficiency.


  • Select "On-Chain" and find "Subgraph" from the Credential Dashboard

When creating a Subgraph Credential, there are three required fields that need to be filled: Endpoint, Query, and Expression.

  • Endpoint: This is the endpoint where the query will be executed.

  • Query: Use this query to test whether an address is eligible for the Credential. It defines the conditions and criteria for determining eligibility.

  • Expression: In this section, you should include JavaScript code that converts the results of the Query into 0/1 outputs. A value of 0 represents non-eligible queried addresses, while a value of 1 indicates eligible Credentials.

Here are some Subgraph Credential Source examples for you to refer to:


Subgraph Examples for NFT Holder and Campaign Participant Data

Notes:

  • Taking XXXX as the campaign id (from end of campaign URL

  • These examples are only meant for OAT/NFT campaigns based on Galxe


Campaign Participants

Endpoint

http://galaxy-graphigo.galaxy-app:8080/query

Query

query userInfo($address: String!) {
campaign(id: "xxxx") {
claimedTimes(address: $address)
}
}

Expression

function(data) {
if (data != null && data.campaign != null && data.campaign.claimedTimes > 0) {
return 1
}
return 0
}

NFT Holders

Endpoint

http://galaxy-graphigo.galaxy-app:8080/query

Query

query isNFTHolder($address: String!) {
campaign(id: “XXXX”) {
isNFTHolder(address: $address)
}
}

Expression

function(data) {
if (data.campaign != null && data.campaign.isNFTHolder) {
return 1;
}
return 0;
}

Did this answer your question?