From 98f9d47915908c1a977aee8b72ff6c745f567c62 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Wed, 14 Aug 2024 15:28:09 +0700 Subject: [PATCH] short code --- packages/oraiswap-v3/src/handler.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/oraiswap-v3/src/handler.ts b/packages/oraiswap-v3/src/handler.ts index 4f6bb983..3638f05d 100644 --- a/packages/oraiswap-v3/src/handler.ts +++ b/packages/oraiswap-v3/src/handler.ts @@ -315,14 +315,13 @@ export class OraiswapV3Handler { return await Promise.all(promises); } - public async getPairLiquidityValues(pool: PoolWithPoolKey, positionList?: Position[]): Promise<{ liquidityX: bigint; liquidityY: bigint }> { - let positions: Position[]; - if (!positionList) { - const allPositions = await this.allPositions(); - positions = allPositions.filter((pos) => poolKeyToString(pos.pool_key) === poolKeyToString(pool.pool_key)); - } else { - positions = positionList.filter((pos) => poolKeyToString(pos.pool_key) === poolKeyToString(pool.pool_key)); - } + public async getPairLiquidityValues( + pool: PoolWithPoolKey, + positionList?: Position[] + ): Promise<{ liquidityX: bigint; liquidityY: bigint }> { + const positions = (positionList || (await this.allPositions())).filter( + (pos) => poolKeyToString(pos.pool_key) === poolKeyToString(pool.pool_key) + ); let liquidityX = 0n; let liquidityY = 0n;