@@ -15,7 +15,7 @@ import {
15
15
} from "@uniswap/smart-order-router"
16
16
import { Route , encodeRouteToPath } from "@uniswap/v3-sdk"
17
17
import { ethers } from "ethers"
18
- import { type Hex , parseUnits } from "viem"
18
+ import { type Hex , encodeAbiParameters , parseUnits } from "viem"
19
19
import { SWAP_DEFAULT_DEADLINE } from "../config/constants"
20
20
import { SwapperMode } from "../interface"
21
21
import type { SwapParams , SwapQuote } from "../types"
@@ -100,9 +100,9 @@ export async function fetchUniswapQuote(
100
100
) ,
101
101
tradeType === TradeType . EXACT_OUTPUT ,
102
102
)
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 ) ] ,
106
106
) ,
107
107
// quoteRequest: route?.methodParameters?.data,
108
108
priceImpact : route . trade . priceImpact . toFixed ( 6 ) ,
@@ -124,7 +124,7 @@ export async function fetchUniswapQuote(
124
124
amountIn,
125
125
amountOut,
126
126
data : data . path as Hex ,
127
- protocol : "Uniswap" ,
127
+ protocol : data . protocol ,
128
128
}
129
129
} catch ( e ) {
130
130
if ( e instanceof RangeError ) {
0 commit comments