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

Restore highest liquidity tab (#1077)

* get highest liquidity pools WIP

* logs deleted

* order fix

* query fix

Co-authored-by: ClaudiaHolhos <claudia@oceanprotocol.com>
This commit is contained in:
claudiaHash 2022-02-10 16:41:07 +02:00 committed by GitHub
parent e2c468c128
commit aec34dc712
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -71,6 +71,7 @@ const HighestLiquidityAssets = gql`
symbol symbol
} }
baseTokenLiquidity baseTokenLiquidity
datatokenLiquidity
} }
} }
` `
@ -294,6 +295,7 @@ export async function getHighestLiquidityDatatokens(
highestLiquidityAssets.sort( highestLiquidityAssets.sort(
(a, b) => b.baseTokenLiquidity - a.baseTokenLiquidity (a, b) => b.baseTokenLiquidity - a.baseTokenLiquidity
) )
for (let i = 0; i < highestLiquidityAssets.length; i++) { for (let i = 0; i < highestLiquidityAssets.length; i++) {
if (!highestLiquidityAssets[i]?.datatoken?.address) continue if (!highestLiquidityAssets[i]?.datatoken?.address) continue
dtList.push(highestLiquidityAssets[i].datatoken.address) dtList.push(highestLiquidityAssets[i].datatoken.address)

View File

@ -24,10 +24,9 @@ async function getQueryHighest(
esPaginationOptions: { esPaginationOptions: {
size: dtList.length > 0 ? dtList.length : 1 size: dtList.length > 0 ? dtList.length : 1
}, },
filters: [getFilterTerm('dataToken', dtList)] filters: [getFilterTerm('services.datatokenAddress', dtList)]
} as BaseQueryParams } as BaseQueryParams
const queryHighest = generateBaseQuery(baseQueryParams) const queryHighest = generateBaseQuery(baseQueryParams)
return [queryHighest, dtList] return [queryHighest, dtList]
} }

View File

@ -17,7 +17,6 @@ async function getPoolSharesLiquidity(
poolShares: PoolShare[] poolShares: PoolShare[]
): Promise<number> { ): Promise<number> {
let totalLiquidity = 0 let totalLiquidity = 0
for (const poolShare of poolShares) { for (const poolShare of poolShares) {
const poolLiquidity = calculateUserLiquidity(poolShare) const poolLiquidity = calculateUserLiquidity(poolShare)
totalLiquidity += poolLiquidity totalLiquidity += poolLiquidity