Balances of only 2 tokens in an ethereum address

I am trying to get the balance of ONLY 2 tokens in a Liquidity Pool address. I know that you can do this to get ALL the tokens in an address

{
  ethereum(network: ethereum) {
    address(address: {is: "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640"}) {
      balances {
        currency {
          address
          symbol
        }
      }
    }
  }
}


but I’m only interested, in this example, WETH and USDC.

I tried

{
  ethereum(network: ethereum) {
    address(address: {is: "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640"}) {
      balances(currency: {in: ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"]})
    }
  }
}

and balances(currency {is: [“etc etc”]}) and the IDE was throwing errors.

this query is working for me:

{
  ethereum(network: ethereum) {
    address(address: {is: "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640"}) {
      balances(
        currency: {in: ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"]}
      ) {
        currency {
          address
          symbol
        }
        value
      }
    }
  }
}

I can see the result:

{
  "ethereum": {
    "ethereum": {
      "address": [
        {
          "balances": [
            {
              "currency": {
                "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
                "symbol": "USDC"
              },
              "value": 102146375.665024
            },
            {
              "currency": {
                "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
                "symbol": "WETH"
              },
              "value": 67762.28003756491
            }
          ]
        }
      ]
    }
  }
}
1 Like

Thank you very much :slight_smile: I guess my problem was I didn’t realize the purple currency was to filter, and the blue one was to specify an output for the result, and that they were both required for the query.

1 Like