diff --git a/src/entities/nestedJoin/doQueryNestedJoin.ts b/src/entities/nestedJoin/doQueryNestedJoin.ts index 1db8f30b..f6f765c8 100644 --- a/src/entities/nestedJoin/doQueryNestedJoin.ts +++ b/src/entities/nestedJoin/doQueryNestedJoin.ts @@ -30,7 +30,6 @@ export async function doQueryNestedJoin( data: data as Hex, }); - // TODO: extend logic for multiple peek calls in the context of non-leaf joins const peekedValue = decodeAbiParameters( [{ type: 'uint256' }], result[result.length - 1], diff --git a/src/entities/nestedJoin/parseNestedJoinCall.ts b/src/entities/nestedJoin/parseNestedJoinCall.ts index 1cea3fcc..d1d1ef9c 100644 --- a/src/entities/nestedJoin/parseNestedJoinCall.ts +++ b/src/entities/nestedJoin/parseNestedJoinCall.ts @@ -25,8 +25,8 @@ export function parseNestedJoinCall({ let value = 0n; if (chainId && useNativeAssetAsWrappedAmountIn) { tokensIn = replaceWrapped([...sortedTokens], chainId); - const nativeAssetIndex = tokensIn.findIndex( - (t) => t.address === ZERO_ADDRESS, + const nativeAssetIndex = tokensIn.findIndex((t) => + t.isSameAddress(ZERO_ADDRESS), ); if (nativeAssetIndex > -1) { value = maxAmountsIn[nativeAssetIndex].amount; @@ -37,8 +37,8 @@ export function parseNestedJoinCall({ const _maxAmountsIn = maxAmountsIn.map((a) => a.isRef ? Relayer.toChainedReference(a.amount) : a.amount, ); - const amountsInWithoutBpt = _maxAmountsIn.filter( - (_, i) => sortedTokens[i].address !== poolAddress, // TODO: lowercase? + const amountsInWithoutBpt = _maxAmountsIn.filter((_, i) => + sortedTokens[i].isSameAddress(poolAddress), ); let userData: Hex; switch (poolType) { diff --git a/test/nestedJoin.integration.test.ts b/test/nestedJoin.integration.test.ts index a6856a2e..7ac45704 100644 --- a/test/nestedJoin.integration.test.ts +++ b/test/nestedJoin.integration.test.ts @@ -136,7 +136,7 @@ describe('nested join test', () => { } }); - test('leaf join - single token', async () => { + test('single asset join', async () => { const amountIn = { address: '0x6b175474e89094c44da98b954eedeac495271d0f' as Address, // DAI rawAmount: parseUnits('1', 18), @@ -153,7 +153,7 @@ describe('nested join test', () => { }); }); - test('leaf join - all tokens', async () => { + test('all assets join', async () => { const amountsIn = [ { address: