Skip to content

Commit 6925e0b

Browse files
committed
fix combined uni v2
1 parent ab184c5 commit 6925e0b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/swapService/quoters/quoterUniswap.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from "@uniswap/smart-order-router"
1616
import { Route, encodeRouteToPath } from "@uniswap/v3-sdk"
1717
import { ethers } from "ethers"
18-
import { type Hex, parseUnits } from "viem"
18+
import { type Hex, encodeAbiParameters, parseUnits } from "viem"
1919
import { SWAP_DEFAULT_DEADLINE } from "../config/constants"
2020
import { SwapperMode } from "../interface"
2121
import type { SwapParams, SwapQuote } from "../types"
@@ -100,9 +100,9 @@ export async function fetchUniswapQuote(
100100
),
101101
tradeType === TradeType.EXACT_OUTPUT,
102102
)
103-
: route.trade.routes[0].path.reduce(
104-
(path, token) => path + token.wrapped.address.substring(2),
105-
"0x",
103+
: encodeAbiParameters(
104+
[{ type: "address[]" }],
105+
[route.trade.routes[0].path.map((t) => t.wrapped.address as Hex)],
106106
),
107107
// quoteRequest: route?.methodParameters?.data,
108108
priceImpact: route.trade.priceImpact.toFixed(6),
@@ -124,7 +124,7 @@ export async function fetchUniswapQuote(
124124
amountIn,
125125
amountOut,
126126
data: data.path as Hex,
127-
protocol: "Uniswap",
127+
protocol: data.protocol,
128128
}
129129
} catch (e) {
130130
if (e instanceof RangeError) {

src/swapService/runner.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export async function runPipeline(
5858
)
5959
}
6060

61+
// console.log('finalResult.response: ', JSON.stringify(finalResult.response, null, 2));
6162
return finalResult.response
6263
}
6364

0 commit comments

Comments
 (0)