To ease development on top of the Proof-of-Talent protocol, developers can plug into the Proof-of-Talent subgraph via GraphQL. A subgraph extracts data from a blockchain making querying underlying data effortlessly.
Subgraph Instances of Proof Of Talent Protocol
GitHub repository
Useful links
- For in-depth documentation on Graph Node, see theΒ Graph Node documentation.
Query Example
1. All Badges
This query returns a list of badges, along with a list of claimers for each badge.
Arguments
first
(Numbers): The number of badges to retrieve.orderBy
(String): The field to use for ordering the badges. Possible values areid
,claimersCount
,collectionId
,issuer
,source
, andtype
.orderDirection
(String): The direction to use for ordering the badges. Possible values areasc
for ascending anddesc
for descending.skip
(Numbers): The number of badges to skip before returning the results.
Fields
issuer
(String): The issuer of the badge.id
(ID): The ID of the badge.claimersCount
(Int): The number of claimers for the badge.collectionId
(ID): The ID of the collection to which the badge belongs.issuer
(String): The issuer of the badge.source
(String): The source of the badge.type
(String): The type of the badge.uri
(String): The URI of the badge image.claimers
(Claimer[]): A list of claimers for the badge.
{
badges(first: Numbers) {
id
collectionId
uri
issuer
}
}
2. Badges User own
This query returns a user and a list of badges that have been claimed by the user.
Arguments for the query
id
(ID): The ID of the user to retrieve.
Fields
id
(ID): The ID of the user.address
(String): The address of the user.badges
(BadgeClaim[]): A list of badges that have been claimed by the user.
BadgeClaim fields
id
(ID): The ID of the badge claim.timestamp
(String): The timestamp of the claim.value
(String): The value of the claim.badge
(Badge): The badge that was claimed.
Badge fields
id
(ID): The ID of the badge.source
(String): The source of the badge.type
(String): The type of the badge.uri
(String): The URI of the badge image.
query MyQuery {
user(id: "abc123") {
id
address
badges(first: 10) {
id
timestamp
value
badge {
id
source
type
uri
}
}
}
}
Get badge URI (Metadata)
This query returns the URI of a badge.
- Arguments
- Fields
id
(ID): The ID of the badge to retrieve.
uri
(String): The URI of the badge image.
query MyQuery {
badge(id: "") {
uri
}
}
Advanced cases
How to create a query of over 5000 objects?