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

migrate pool graph query

This commit is contained in:
Matthias Kretschmann 2022-01-13 19:26:15 +00:00
parent 0dca59ac64
commit ca32de2dd7
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -107,13 +107,14 @@ const poolHistory = gql`
query PoolHistory($id: String!, $block: Int) { query PoolHistory($id: String!, $block: Int) {
poolTransactions( poolTransactions(
first: 1000 first: 1000
where: { poolAddress: $id, block_gt: $block } where: { pool: $id, block_gt: $block }
orderBy: block orderBy: block
subgraphError: deny
) { ) {
block block
spotPrice
timestamp timestamp
oceanReserve baseTokenValue
datatokenValue
} }
} }
` `
@ -200,16 +201,16 @@ export default function Graph(): ReactElement {
] ]
setTimestamps(latestTimestamps) setTimestamps(latestTimestamps)
const latestLiquidtyHistory = [ const latestLiquidityHistory = [
...liquidityHistory, ...liquidityHistory,
...data.poolTransactions.map((item) => item.oceanReserve) ...data.poolTransactions.map((item) => item.baseTokenValue)
] ]
setLiquidityHistory(latestLiquidtyHistory) setLiquidityHistory(latestLiquidityHistory)
const latestPriceHistory = [ const latestPriceHistory = [
...priceHistory, ...priceHistory,
...data.poolTransactions.map((item) => item.spotPrice) ...data.poolTransactions.map((item) => item.datatokenValue)
] ]
setPriceHistory(latestPriceHistory) setPriceHistory(latestPriceHistory)
@ -230,7 +231,7 @@ export default function Graph(): ReactElement {
label: 'Liquidity (OCEAN)', label: 'Liquidity (OCEAN)',
data: data:
graphType === 'liquidity' graphType === 'liquidity'
? latestLiquidtyHistory.slice(0) ? latestLiquidityHistory.slice(0)
: latestPriceHistory.slice(0), : latestPriceHistory.slice(0),
borderColor: `#8b98a9`, borderColor: `#8b98a9`,
pointBackgroundColor: `#8b98a9` pointBackgroundColor: `#8b98a9`