1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

subgraph pool address type workaround

This commit is contained in:
Matthias Kretschmann 2022-01-26 11:33:38 +00:00
parent cc03092d9e
commit 9ebb57d2af
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -286,7 +286,12 @@ const TopSalesQuery = gql`
` `
const poolDataQuery = 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) { poolData: pool(id: $pool) {
id id
totalShares totalShares
@ -310,14 +315,12 @@ const poolDataQuery = gql`
shares shares
} }
} }
poolDataUser: pool(id: $pool) { poolDataUser: pool(id: $pool) {
shares(where: { user: $user }) { shares(where: { user: $user }) {
shares shares
} }
} }
poolSnapshots(first: 1000, where: { pool: $poolAsString }, orderBy: date) {
poolSnapshots(first: 1000, where: { pool: $pool }, orderBy: date) {
date date
spotPrice spotPrice
baseTokenLiquidity baseTokenLiquidity
@ -830,7 +833,10 @@ export async function getPoolData(
user: string user: string
) { ) {
const queryVariables = { 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(), pool: pool.toLowerCase(),
poolAsString: pool.toLowerCase(),
owner: owner.toLowerCase(), owner: owner.toLowerCase(),
user: user.toLowerCase() user: user.toLowerCase()
} }