Skip to content

Commit

Permalink
Merge pull request #199 from jediswaplabs/125-while-adding-liquidity-…
Browse files Browse the repository at this point in the history
…sometimes-the-pool-info-is-not-correctly-fetched

125 while adding liquidity sometimes the pool info is not correctly fetched
  • Loading branch information
vnaysngh-mudrex authored Apr 15, 2024
2 parents fc10999 + 5f84094 commit 680b40c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/hooks/usePools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,11 @@ export function usePools(

const sqrtPriceHex = sqrtPriceX96 && JSBI.BigInt(num.toHex(sqrtPriceX96 as BigNumberish))
const liquidityHex = Boolean(liquidity) ? JSBI.BigInt(num.toHex(liquidity as BigNumberish)) : JSBI.BigInt('0x0')

return useMemo(() => {
return poolKeys.map((_key, index) => {
const tokens = poolTokens[index]

if (!tokens) return [PoolState.INVALID, null]
const [token0, token1, fee] = tokens
if (!liquidityHex || !sqrtPriceHex) return [PoolState.NOT_EXISTS, null]
Expand All @@ -200,7 +202,7 @@ export function usePools(
return [PoolState.NOT_EXISTS, null]
}
})
}, [liquidity, poolKeys, tickCurrent, poolTokens])
}, [liquidityHex, poolKeys, tickCurrent, poolTokens, sqrtPriceHex])
}

export function usePoolsForSwap(results: any): [PoolState, Pool | null][] {
Expand Down

0 comments on commit 680b40c

Please sign in to comment.