From f7414cdf9fc2a36f050291e3292a0709c94379b4 Mon Sep 17 00:00:00 2001 From: ben2x4 <86395884+ben2x4@users.noreply.github.com> Date: Sun, 27 Nov 2022 22:19:07 -0800 Subject: [PATCH] prefer direct swaps (#286) --- .../util/selectEligiblePoolsForTokenToTokenSwap.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/queries/useQueryMatchingPoolForSwap/util/selectEligiblePoolsForTokenToTokenSwap.ts b/queries/useQueryMatchingPoolForSwap/util/selectEligiblePoolsForTokenToTokenSwap.ts index 0e8c567..c369643 100644 --- a/queries/useQueryMatchingPoolForSwap/util/selectEligiblePoolsForTokenToTokenSwap.ts +++ b/queries/useQueryMatchingPoolForSwap/util/selectEligiblePoolsForTokenToTokenSwap.ts @@ -14,7 +14,7 @@ export function selectEligiblePoolsForTokenToTokenSwap({ tokenB, poolsList, }: SelectEligiblePoolsForTokenToTokenSwapArgs) { - return poolsList.reduce( + let eligiblePools = poolsList.reduce( (result, pool) => { const [poolAssetA, poolAssetB] = pool.pool_assets @@ -98,4 +98,12 @@ export function selectEligiblePoolsForTokenToTokenSwap({ passThroughPools: [], } as MatchingPoolsForTokenToTokenSwap ) + if ( + eligiblePools.poolForDirectTokenAToTokenBSwap || + eligiblePools.poolForDirectTokenBToTokenASwap + ) { + eligiblePools.passThroughPools = [] + } + console.log(eligiblePools) + return eligiblePools }