Skip to main content

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, namespace: String, first: Int, after: String) [UserIdentityPage]!

For input params:

FieldTypeDescription
networkNetworkThe blockchain network for the queried address. Default is ETH.
typeConnectionTypeInput the connection type that serves as the basis of this ranking. You can use FOLLOW, LIKE, REPORT, WATCH, or VOTE.
namespaceStringRankings in a certain namespace.
firstIntInput the number of entries this query should return. The default is 20 and the maximum value is 50.
afterStringInput after which index this query should begin. The default is "-1".

For the usage of namespace, 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:

FieldTypeDescription
pageInfoPageInfoOutput 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 TopFiveRankings{
rankings(network: ETH, type: FOLLOW, namespace: "CyberConnect", first: 5) {
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
list {
address
domain
followerCount
}
}
}