Global protocol stats

📘

Full code example

https://github.com/lens-protocol/api-examples/blob/master/src/protocol-stats/global-protocol-stats.ts

This query returns to you the global protocol stats of key metrics.

API Design

query GlobalProtocolStats {
  globalProtocolStats(request: null) {
    totalProfiles
    totalBurntProfiles
    totalPosts
    totalMirrors
    totalComments
    totalCollects
    totalFollows
    totalRevenue {
      asset {
        name
        symbol
        decimals
        address
      }
      value
    }
  }
}
{
  "data": {
    "globalProtocolStats": {
      "totalProfiles": 291,
      "totalBurntProfiles": 10,
      "totalPosts": 186,
      "totalMirrors": 23,
      "totalComments": 59,
      "totalCollects": 19,
      "totalFollows": 85,
      "totalRevenue": [
        {
          "asset": {
            "name": "Wrapped Matic",
            "symbol": "WMATIC",
            "decimals": 18,
            "address": "0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889"
          },
          "value": "6.94648"
        }
      ]
    }
  }
}
type Query {
    globalProtocolStats(request: GlobalProtocolStatsRequest): GlobalProtocolStats!
}
input GlobalProtocolStatsRequest {
  # Unix time from timestamp - if not supplied it will go from 0 timestamp
  fromTimestamp: UnixTimestamp

  # Unix time to timestamp - if not supplied it go to the present timestamp
  toTimestamp: UnixTimestamp

  # The App Id
  sources: [Sources!]
}
type GlobalProtocolStats {
  totalProfiles: Int!
  totalBurntProfiles: Int!
  totalPosts: Int!
  totalMirrors: Int!
  totalComments: Int!
  totalCollects: Int!
  totalFollows: Int!
  totalRevenue: [Erc20Amount!]!
}

Request

Let's look at the query options we can use here to get for different things.

{
    // if this is not supplied it will not have a from cap
    // it is a unix timestamp
    "fromTimestamp": 1642934933,
    // if this is not supplied it will not have a to cap
    // it is a unix timestamp
    "toTimestamp": 1648032533
    // also dont forget you can filter these stats on sources
    // this will adjust the posts, mirrors and comments stats
    // "sources": ["lost-place-dapp"]
 }

Did this page help you?