Skip to content

Commit 0f56c2a

Browse files
committed
fix pendle only routes
1 parent db509e9 commit 0f56c2a

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type CustomOrAPIKeyConfig =
3333
| { customUrl: string; apiKey?: undefined }
3434
| { customUrl?: undefined; apiKey: string }
3535
type PendleConfig = CustomOrAPIKeyConfig
36-
type PendleData = { tx: SourceQuoteTransaction }
36+
type PendleData = { tx: SourceQuoteTransaction; pendleAggregator: string }
3737

3838
export class CustomPendleQuoteSource
3939
implements IQuoteSource<PendleSupport, PendleConfig, PendleData>
@@ -64,7 +64,7 @@ export class CustomPendleQuoteSource
6464
async quote(
6565
params: QuoteParams<PendleSupport, PendleConfig>,
6666
): Promise<SourceQuoteResponse<PendleData>> {
67-
const { dstAmount, to, data } = await this.getQuote(params)
67+
const { dstAmount, to, data, aggregator } = await this.getQuote(params)
6868
const quote = {
6969
sellAmount: params.request.order.sellAmount,
7070
buyAmount: BigInt(dstAmount),
@@ -74,6 +74,7 @@ export class CustomPendleQuoteSource
7474
to,
7575
calldata: data,
7676
},
77+
pendleAggregator: aggregator,
7778
},
7879
}
7980

@@ -166,14 +167,14 @@ export class CustomPendleQuoteSource
166167

167168
failed(this.getMetadata(), chainId, sellToken, buyToken, msg)
168169
}
169-
170170
const { routes } = await response.json()
171171

172172
const dstAmount = routes[0].outputs[0].amount
173173
const to = routes[0].tx.to
174174
const data = routes[0].tx.data
175+
const aggregator = routes[0].data.aggregatorType
175176

176-
return { dstAmount, to, data }
177+
return { dstAmount, to, data, aggregator }
177178
}
178179

179180
isConfigAndContextValidForQuoting(

src/swapService/strategies/strategyBalmySDK.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,10 @@ export class StrategyBalmySDK {
548548
amountOut: sdkQuote.buyAmount.amount,
549549
amountOutMin: sdkQuote.minBuyAmount.amount,
550550
data,
551-
protocol: sdkQuote.source.name,
551+
protocol:
552+
sdkQuote.customData.pendleAggregator === "VOID"
553+
? "Pendle"
554+
: sdkQuote.source.name,
552555
shouldTransferToReceiver,
553556
allowanceTarget,
554557
}

0 commit comments

Comments
 (0)