Search…
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 score type and wallet address:
1
​
Copied!
​ ​
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:
1
{
2
scores(where: {project: "PROJECT_ID_HERE", scoreType: "SCORE_TYPE_HERE", address: "USER_ADDRESS_HERE"}) {
3
id
4
points
5
scoreType
6
address
7
}
8
}
Copied!
List all users within a project based on their total score (all score types added together) in descending order:
1
{
2
scoreboards(where: {project: "PROJECT_ID_HERE"}, orderBy: totalScore, orderDirection: desc) {
3
id
4
address
5
totalScore
6
}
7
}
Copied!
List all scoreboards for a particular project (scoreboard includes all of a user's scores within that project):
1
{
2
scoreboards(where: {project: "PROJECT_ID_HERE"}) {
3
id
4
address
5
scores {
6
id
7
points
8
scoreType
9
}
10
}
11
}
Copied!
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, direction of 1 is decreasing):
1
{
2
actions(where: {project: "PROJECT_ID_HERE"}) {
3
id
4
name
5
points
6
direction
7
}
8
}
9
​
Copied!
Find the total score for a user within a particular project, based on their wallet address:
1
{
2
scoreboards(where: {project: "PROJECT_ID_HERE", address: "USER_ADDRESS_HERE"}) {
3
id
4
address
5
totalScore
6
}
7
}
Copied!
​
Copy link
Contents