Search
K
Comment on page

XP Subgraph

The HUDDLN XP subgraph allows you to access any XP data submitted by our partners.
The data is also accessible on-chain with smart contract calls, but for a majority of use cases accessing the data through a subgraph is the best option.

Here are some example queries for common use cases:

Search for a user's score based on their wallet address:
{
scoreboards(where: {project: "0xe8472970fa4c25d53db67811a25a31e037a7168f719b645da63e99984701666d", address: "0xc7e8ac5caccbe263e09638c8069c85513e23ffbb"}) {
id
totalScore
address
}
}
The HUDDLN XP subgraph allows you to access any XP data submitted by our partners.
The data is also accessible on-chain with smart contract calls, but for a majority of use cases accessing the data through a subgraph is the best option.

Here are some example queries for common use cases:

Search for a user's score based on their score type and wallet address:
{
scores(where: {project: "PROJECT_ID_HERE", scoreType: "SCORE_TYPE_HERE", address: "USER_ADDRESS_HERE"}) {
id
points
scoreType
address
}
}
List all users within a project based on their total score (all score types added together) in descending order:
{
scoreboards(where: {project: "PROJECT_ID_HERE"}, orderBy: totalScore, orderDirection: desc) {
id
address
totalScore
}
}
List all scoreboards for a particular project (scoreboard includes all of a user's scores within that project):
{
scoreboards(where: {project: "PROJECT_ID_HERE"}) {
id
address
scores {
id
points
scoreType
}
}
}
List all actions for a particular project (action includes a name, how many points received for it and a direction. Direction of 0 is increasing, the direction of 1 is decreasing):
{
actions(where: {project: "PROJECT_ID_HERE"}) {
id
name
points
direction
}
}
Find the total score for a user within a particular project, based on their wallet address:
{
scoreboards(where: {project: "PROJECT_ID_HERE", address: "USER_ADDRESS_HERE"}) {
id
address
totalScore
}
}