Rankings
Rankings API is used for querying a ranked list of addresses on the blockchain network. You can retrieve a ranked list of users and their identities based on different connection types and different namespaces.
Definition
The definition of rankings
query is:
rankings (network: Network, type: ConnectionType, namespaces: [String!], first: Int, after: String) [UserIdentityPage]!
For input params:
Field | Type | Description | Required/Optional |
---|---|---|---|
network | Network | The blockchain network for the queried address. | Optional. Default value is ETH . |
type | ConnectionType | Input the connection type that serves as the basis of this ranking. You can use FOLLOW , LIKE , REPORT , WATCH , or VOTE . | Optional. Default value is FOLLOW . |
namespaces | [String!] | Rankings in several namespaces. | Optional. Default value is [] which gets rank in global |
first | Int | Input the number of entries this query should return. | Optional. Default is 20 and the maximum value is 50 . |
after | String | Input after which index this query should begin. | Optional. Default value is -1 . |
For the usage of namespaces
, please refer to Namespace section for more instructions. For the usage of first
and after
, please refer to Pagination section. For the concept of connection types, please read Connection section.
With correct inputs, you can retrieve a UserIdentityPage
objects with the following fields:
Field | Type | Description |
---|---|---|
pageInfo | PageInfo | Output page information, including startCursor, endCursor, whether this page hasNextPage, and whether this page hasPreviousPage. |
list | [UserIdentity] | Output a ranked list of user identities. |
For the fields of a UserIdentity
object, please refer to Identity section.
Example
In the following example, we demonstrate how to query information about the top five Ethereum addresses with the most followers under the CyberConnect namespace. You can play around with Rankings API in the Playground section.
- Query
- Response
query TopFiveRankings{
rankings(network: ETH, type: FOLLOW, namespaces: ["CyberConnect"], first: 5) {
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
list {
address
domain
followerCount
}
}
}
{
"data": {
"rankings": {
"pageInfo": {
"startCursor": "0",
"endCursor": "4",
"hasNextPage": true,
"hasPreviousPage": false
},
"list": [
{
"address": "0x67205e1715ac70d92a337b91c763c03651434fc7",
"domain": "mycointool.eth",
"followerCount": 150434
},
{
"address": "0x5a0710c803d9467794929c7f697bdfb406bb333a",
"domain": "mctclub.eth",
"followerCount": 131637
},
{
"address": "0xab7824a05ef372c95b9cfeb4a8be487a0d5d8ecb",
"domain": "",
"followerCount": 67603
},
{
"address": "0x3ee24d753c6ff3b7fbd3064208213f46f5d56bc7",
"domain": "cealyn.eth",
"followerCount": 51528
},
{
"address": "0x148d59faf10b52063071eddf4aaf63a395f2d41c",
"domain": "cyberlab.eth",
"followerCount": 23218
}
]
}
}
}