Skip to content

Commit 9528baa

Browse files
committed
hack fix for PT routing
1 parent 9b06693 commit 9528baa

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/swapService/strategies/balmySDK/sources/pendleQuoteSource.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export class CustomPendleQuoteSource
180180
)
181181
}
182182
// swap
183-
const queryParams = {
183+
const queryParams: any = {
184184
receiver: recipient || takeFrom,
185185
slippage: slippagePercentage / 100, // 1 = 100%
186186
enableAggregator: true,
@@ -189,6 +189,15 @@ export class CustomPendleQuoteSource
189189
amountIn: order.sellAmount.toString(),
190190
}
191191

192+
if (
193+
isAddressEqual(
194+
tokenIn.addressInfo,
195+
"0x1135b22d6e8FD0809392478eEDcd8c107dB6aF9D",
196+
)
197+
) {
198+
queryParams.aggregators = "paraswap"
199+
}
200+
192201
const queryString = qs.stringify(queryParams, {
193202
skipNulls: true,
194203
arrayFormat: "comma",
@@ -197,7 +206,7 @@ export class CustomPendleQuoteSource
197206
const pendleMarket =
198207
tokenIn?.meta?.pendleMarket || tokenOut?.meta?.pendleMarket
199208

200-
url = `${getUrl()}/sdk/${chainId}/markets/${pendleMarket}/swap?${queryString}`
209+
url = `${getUrl(2)}/sdk/${chainId}/markets/${pendleMarket}/swap?${queryString}`
201210
}
202211

203212
const response = await fetchService.fetch(url, {
@@ -277,8 +286,8 @@ export class CustomPendleQuoteSource
277286
}
278287
}
279288

280-
function getUrl() {
281-
return "https://api-v2.pendle.finance/core/v1"
289+
function getUrl(v = 1) {
290+
return `https://api-v2.pendle.finance/core/v${v}`
282291
}
283292

284293
function getHeaders(config: PendleConfig) {

0 commit comments

Comments
 (0)