In the Uniswap v3 subgraph https://thegraph.com/hosted-service/subgraph/uniswap/uniswap-v3:
{
pools(first:10, where: {
token0:"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
}){
token0{
name
symbol
id
}
token1{
name
symbol
id
}
}
}
Returns:
{
"data": {
"pools": [
{
"token0": {
"id": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"name": "Wrapped Ether",
"symbol": "WETH"
},
"token1": {
"id": "0xd1063ee5ec2891991a29fefb52bcc448cd386844",
"name": "BanD ...
I can only query for the token0.ID or token1.ID in two separate queries. What I would like to do is query for the token0.SYMBOL in the query.
The only way I can see this possible is to first query:
{
tokens(
first: 100, skip: 0,
where:{symbol: "WETH"},
) {
id
symbol
name
}
}
Returns:
{
"data": {
"tokens": [
{
"id": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"name": "Tether USD",
"symbol": "USDT"
}
]
}
}
Then grab that ID in the next two queries to find if there is a matching token0 or token1 in any liquidity pools.
Is there a simpler way of executing this?