Search code examples
graphqluniswap

How to wire nested queries in Graph QL?


I would like to include the token names in results when querying the Uniswap v3 Subgraph, using the following query:

{
    pools (top: 10) {
      id,
    feesUSD,
    token0 {
      id        // do something like Token(id: token0.id) {symbol, name},
      },
    token1 {
      id
    }
    }
}

Renders data like this:

{
  "data": {
    "pools": [
      {
        "feesUSD": "0.001849193372604300017804758202164034",
        "id": "0x0001fcbba8eb491c3ccfeddc5a5caba1a98c4c28",
        "token0": {
          "id": "0xbef81556ef066ec840a540595c8d12f516b6378f"
        },
        "token1": {
          "id": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
        }
      },

The token0 and token1 hash IDs are returned and would like to return the Token.symbol values by passing in the token ID.

I only see single-level type queries on the Uniswap Subquery Examples page. How can this be accomplished?


Solution

  • Response from Graph QL is that this feature has been requested and is being considered.