Best way to get total count for pagination?

query ($network: EthereumNetwork!, $token: String!, $limit: Int!, $offset: Int!, $since: ISO8601DateTime, $till: ISO8601DateTime) {
ethereum(network: $network) {
dexTrades(
options: {desc: [“tradeAmount”], limit: $limit, offset: $offset}
date: {since: $since, till: $till}
baseCurrency: {is: $token}
) {
block {
timestamp {
time(format: “%Y-%m-%d %H:%M:%S”)
}
height
}
tradeIndex
exchange {
fullName
}
baseAmount
quoteAmount
quoteCurrency {
address
symbol
}
transaction {
hash
txFrom {
address
}
}
tradeAmount(in: USD)
buyAmount(in: USD)
sellAmount(in: USD)
gasPrice
gasValue(in: USD)
baseCurrency {
address
symbol
}
}
}
}

Write a query to get a total count …something like below (Syntax is wrong)

{
ethereum(network: $network) {
 dexTrades(
  date: {since: $since, till: $till}
   baseCurrency: {is: $token}
  ) {
  count
  }
 }
}
1 Like