Skip to content

Commit

Permalink
feat: my pools if liquidity
Browse files Browse the repository at this point in the history
  • Loading branch information
anukulpandey committed Jul 16, 2024
1 parent bed6ba5 commit 193cce5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/hooks/usePoolLists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export const usePoolsList = ({
const poolsList = queryType === 'User'
? (dataPoolsList as UserPoolsListQuery).userPoolsList
: (dataPoolsList as AllPoolsListQuery).allPoolsList;
return poolsList.map((pool) => ({
const mappedPools = poolsList.map((pool) => ({
address: pool.id,
token1: {
image: !pool.iconUrl1 ? getIconUrl(pool.token1) : pool.iconUrl1,
Expand All @@ -171,6 +171,10 @@ export const usePoolsList = ({
volumeChange24h: calculateVolumeChange(pool, tokenPrices),
myLiquidity: calculateUserLiquidity(pool, tokenPrices),
}));

return queryType === 'User'
? mappedPools.filter(pool => pool.myLiquidity && new BigNumber(pool.myLiquidity).isGreaterThan(0.1))
: mappedPools;
}, [dataPoolsList]);

let count = 0;
Expand All @@ -180,9 +184,10 @@ export const usePoolsList = ({
? (dataPoolsCount as UserPoolsListCountQuery).userPoolsListCount
: (dataPoolsCount as AllPoolsListCountQuery).allPoolsListCount;
}

return [
processed,
loadingPoolsList || loadingPoolsCount,
count,
];
};
};

0 comments on commit 193cce5

Please sign in to comment.