From 64f47510d8ff9fb1f3ee145c7d0e134370cb279f Mon Sep 17 00:00:00 2001 From: Alice <34962750+hensha256@users.noreply.github.com> Date: Fri, 27 Sep 2024 20:30:05 -0400 Subject: [PATCH] fix(v4-sdk): Fix route encoding v4 (#118) --- sdks/v4-sdk/src/entities/route.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sdks/v4-sdk/src/entities/route.ts b/sdks/v4-sdk/src/entities/route.ts index 2cc99bac9..fcc1dcdc2 100644 --- a/sdks/v4-sdk/src/entities/route.ts +++ b/sdks/v4-sdk/src/entities/route.ts @@ -28,8 +28,12 @@ export class Route { const chainId = pools[0].chainId const allOnSameChain = pools.every((pool) => pool.chainId === chainId) invariant(allOnSameChain, 'CHAIN_IDS') - invariant(pools[0].involvesCurrency(input), 'INPUT') - invariant(pools[pools.length - 1].involvesCurrency(output), 'OUTPUT') + + invariant(pools[0].involvesCurrency(input) || pools[0].involvesCurrency(input.wrapped), 'INPUT') + invariant( + pools[pools.length - 1].involvesCurrency(output) || pools[pools.length - 1].involvesCurrency(output.wrapped), + 'OUTPUT' + ) /** * Normalizes currency0-currency1 order and selects the next currency/fee step to add to the path