From 9ebb57d2af2ca4f7b2fa03df4430571193f05e21 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 26 Jan 2022 11:33:38 +0000 Subject: [PATCH] subgraph pool address type workaround --- src/@utils/subgraph.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/@utils/subgraph.ts b/src/@utils/subgraph.ts index 8607c0995..4eb27151d 100644 --- a/src/@utils/subgraph.ts +++ b/src/@utils/subgraph.ts @@ -286,7 +286,12 @@ const TopSalesQuery = gql` ` const poolDataQuery = gql` - query PoolData($pool: ID!, $owner: String!, $user: String) { + query PoolData( + $pool: ID! + $poolAsString: String! + $owner: String! + $user: String + ) { poolData: pool(id: $pool) { id totalShares @@ -310,14 +315,12 @@ const poolDataQuery = gql` shares } } - poolDataUser: pool(id: $pool) { shares(where: { user: $user }) { shares } } - - poolSnapshots(first: 1000, where: { pool: $pool }, orderBy: date) { + poolSnapshots(first: 1000, where: { pool: $poolAsString }, orderBy: date) { date spotPrice baseTokenLiquidity @@ -830,7 +833,10 @@ export async function getPoolData( user: string ) { const queryVariables = { + // Using `pool` & `poolAsString` is a workaround to make the mega query work. + // See https://github.com/oceanprotocol/ocean-subgraph/issues/301 pool: pool.toLowerCase(), + poolAsString: pool.toLowerCase(), owner: owner.toLowerCase(), user: user.toLowerCase() }