0

I am trying to get Pancake-Pair data by quering the subgraph (Hosted at : https://thegraph.com/hosted-service/subgraph/mmontes11/pancakeswap) .

I want to filter data by pair-contract address . I thought of writing it in the where clause .

Something like this :

pairHourDatas(
    first: 24
    where: { pair: "Pancake_lp_address" }
    orderBy: hourStartUnix
    orderDirection: desc
  ) {
    id
    hourStartUnix
    reserve0
    reserve1
    reserveUSD
    pair {
      token0 {
        id
      }
      token1 {
        id
      }
    }
  }

But the query is incorrect . Is this the correct query format . If not how can I query this specific endpoint .

1 Answer 1

1

Your query is correct, just note that addresses in The Graph are all lowercase.

For example, for the pair 0x0002D9a4Af937b6c85497a77906b44f6ADfC8702 you cannot use the checksummed address; instead, you must use 0x0002d9a4af937b6c85497a77906b44f6adfc8702.

This works on the graph you linked:

{
  pairHourDatas(
    first: 24
    where: { pair: "0x0002d9a4af937b6c85497a77906b44f6adfc8702" }
    orderBy: hourStartUnix
    orderDirection: desc
  ) {
    id
    hourStartUnix
    reserve0
    reserve1
    reserveUSD
    pair {
      token0 {
        id
      }
      token1 {
        id
      }
    }
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.