@continuumdao/ctm-mpc-defi 0.2.35 → 0.2.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,463 @@
1
+ import { b as KeyGenSubsetForPermit, M as MultisignBuildResult, e as ProtocolModule } from '../../../types-PZrvtjv8.js';
2
+ import { Address } from 'viem';
3
+ import { E as EvmChainDetail } from '../../../types-RZWOTm8c.js';
4
+ import { b as buildEvmMultisignBatch } from '../../../buildBatch-CngvebiD.js';
5
+ import '../../../envelope-C_bfuKab.js';
6
+
7
+ declare const PENDLE_PROTOCOL_ID = "pendle";
8
+ declare const PENDLE_CORE_API_BASE = "https://api-v2.pendle.finance/core";
9
+ /** Official Hosted SDK / Convert native placeholder. */
10
+ declare const PENDLE_NATIVE_PLACEHOLDER = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
11
+ declare const PENDLE_LISTING_CAP = 100;
12
+ /** `/v2/markets/all` returns oldest first — scan enough pages to find live markets. */
13
+ declare const PENDLE_LISTING_MAX_PAGES = 8;
14
+ declare const PENDLE_SEARCH_EXTRA_PAGES = 3;
15
+ declare const PENDLE_ICON_CACHE_MS: number;
16
+ declare const PENDLE_CHAIN_CACHE_MS: number;
17
+ declare const PENDLE_CONVERT_DEFAULT_GAS_UNITS = 650000n;
18
+ declare function parsePendleAssetId(id: string): {
19
+ chainId: number;
20
+ address: string;
21
+ } | null;
22
+ declare function pendleAssetId(chainId: number, address: string): string;
23
+ declare function isPendleNativeToken(token: string): boolean;
24
+ declare function normalizePendleTokenAddress(token: string): string;
25
+
26
+ declare class PendleApiError extends Error {
27
+ readonly status: number;
28
+ readonly path: string;
29
+ constructor(message: string, status: number, path: string);
30
+ }
31
+ declare function pendleCoreFetch<T>(args: {
32
+ path: string;
33
+ method?: 'GET' | 'POST';
34
+ query?: Record<string, string | number | boolean | undefined>;
35
+ body?: unknown;
36
+ apiKey?: string;
37
+ }): Promise<T>;
38
+
39
+ type PendlePointCampaign = {
40
+ name: string;
41
+ type: string | null;
42
+ pendleAsset: string | null;
43
+ value: number | null;
44
+ };
45
+ type PendleMarketRow = {
46
+ chainId: number;
47
+ name: string;
48
+ address: string;
49
+ expiry: string | null;
50
+ pt: string;
51
+ yt: string;
52
+ sy: string;
53
+ underlying: string;
54
+ underlyingSymbol: string | null;
55
+ ptSymbol: string | null;
56
+ ytSymbol: string | null;
57
+ impliedApy: number | null;
58
+ tvlUsd: number | null;
59
+ liquidityUsd: number | null;
60
+ points: PendlePointCampaign[];
61
+ };
62
+ type PendleAssetRow = {
63
+ id: string;
64
+ chainId: number;
65
+ address: string;
66
+ symbol: string;
67
+ name: string;
68
+ decimals: number;
69
+ expiry: string | null;
70
+ };
71
+ declare function pendleMarketExpiryMs(expiry: string | null | undefined): number | null;
72
+ declare function isPendleMarketExpired(row: {
73
+ expiry: string | null;
74
+ }, nowMs?: number): boolean;
75
+ /** Mint PY, YT/PT swap, and add LP revert after maturity. Redeem PT / remove LP / SY / rewards stay valid. */
76
+ declare function pendleActionNeedsLiveMarket(kind: 'swap' | 'mintPy' | 'redeemPy' | 'mintSy' | 'redeemSy' | 'addLiquidity' | 'removeLiquidity' | 'redeemRewards' | string): boolean;
77
+ declare function selectPendleListingMarkets(rows: PendleMarketRow[], args?: {
78
+ nowMs?: number;
79
+ cap?: number;
80
+ query?: string;
81
+ pointsOnly?: boolean;
82
+ includeAddresses?: string[];
83
+ includeExpired?: boolean;
84
+ }): PendleMarketRow[];
85
+ declare function marketTvlUsd(row: PendleMarketRow): number;
86
+ declare function sortPendleMarketsByTvl(a: PendleMarketRow, b: PendleMarketRow): number;
87
+ declare function parsePendleMarket(raw: unknown): PendleMarketRow | null;
88
+ declare function parsePendleAsset(raw: unknown): PendleAssetRow | null;
89
+ declare function pendleFetchSupportedChainIds(): Promise<number[]>;
90
+ declare function isPendleChainSupported(chainId: number): Promise<boolean>;
91
+ declare function pendleFetchMarketsPage(args: {
92
+ skip?: number;
93
+ limit?: number;
94
+ chainId?: number;
95
+ }): Promise<PendleMarketRow[]>;
96
+ declare function pendleFetchMarketsForChain(chainId: number): Promise<PendleMarketRow[]>;
97
+ declare function pendleFetchMarketsSummary(args: {
98
+ chainId: number;
99
+ query?: string;
100
+ pointsOnly?: boolean;
101
+ includeAddresses?: string[];
102
+ }): Promise<{
103
+ chainId: number;
104
+ markets: PendleMarketRow[];
105
+ notes: string;
106
+ }>;
107
+ declare function pendleFetchAssetsByIds(ids: string[]): Promise<PendleAssetRow[]>;
108
+ declare function pendleFetchPricesSummary(args: {
109
+ chainId: number;
110
+ ids?: string[];
111
+ query?: string;
112
+ }): Promise<{
113
+ chainId: number;
114
+ prices: {
115
+ id: string;
116
+ usd: number | null;
117
+ }[];
118
+ notes: string;
119
+ }>;
120
+ declare function collectPendleMarketAddresses(row: PendleMarketRow): string[];
121
+ declare function pendleIconAddressesForChain(chainId: number): Promise<string[]>;
122
+ declare function pendleSearchAssets(args: {
123
+ chainId: number;
124
+ query: string;
125
+ }): Promise<{
126
+ chainId: number;
127
+ results: PendleMarketRow[];
128
+ notes: string;
129
+ }>;
130
+
131
+ type PendleTokenAmount = {
132
+ token: string;
133
+ amount: string;
134
+ };
135
+ type PendleConvertTx = {
136
+ to: string;
137
+ data: `0x${string}`;
138
+ value: string;
139
+ from?: string;
140
+ };
141
+ type PendleConvertQuote = {
142
+ action: string;
143
+ inputs: PendleTokenAmount[];
144
+ outputs: PendleTokenAmount[];
145
+ requiredApprovals: PendleTokenAmount[];
146
+ priceImpact: number | null;
147
+ impliedApyBefore: number | null;
148
+ impliedApyAfter: number | null;
149
+ effectiveApy: number | null;
150
+ tx: PendleConvertTx;
151
+ };
152
+ type PendleConvertActionKind = 'swap' | 'mint_py' | 'redeem_py' | 'mint_sy' | 'redeem_sy' | 'add_liquidity' | 'remove_liquidity' | 'convert';
153
+ /** Infer Convert action from token sets. Market / PT / YT / SY roles come from the catalog, never constants. */
154
+ declare function classifyPendleConvertAction(args: {
155
+ tokensIn: string[];
156
+ tokensOut: string[];
157
+ roles?: {
158
+ market?: string;
159
+ pt?: string;
160
+ yt?: string;
161
+ sy?: string;
162
+ };
163
+ }): PendleConvertActionKind;
164
+ declare function slippagePercentToConvert(slippagePercent: number): number;
165
+ declare function resolvePendleTokenDecimals(args: {
166
+ chainId: number;
167
+ rpcUrl?: string;
168
+ token: string;
169
+ decimals?: number;
170
+ }): Promise<number>;
171
+ declare function parsePendleConvertResponse(raw: unknown): PendleConvertQuote;
172
+ declare function pendleConvert(args: {
173
+ chainId: number;
174
+ receiver: string;
175
+ slippagePercent: number;
176
+ tokensIn: {
177
+ token: string;
178
+ amountWei: string;
179
+ }[];
180
+ tokensOut: string[];
181
+ enableAggregator?: boolean;
182
+ additionalData?: string;
183
+ }): Promise<PendleConvertQuote>;
184
+ declare function pendleQuoteConvert(args: {
185
+ chainId: number;
186
+ rpcUrl?: string;
187
+ receiver?: string;
188
+ slippagePercent: number;
189
+ tokensIn: {
190
+ token: string;
191
+ amountHuman: string;
192
+ decimals?: number;
193
+ }[];
194
+ tokensOut: string[];
195
+ enableAggregator?: boolean;
196
+ }): Promise<PendleConvertQuote>;
197
+ declare function pendleQuoteSwap(args: {
198
+ chainId: number;
199
+ rpcUrl?: string;
200
+ tokenIn: string;
201
+ tokenOut: string;
202
+ amountHuman: string;
203
+ slippagePercent: number;
204
+ receiver?: string;
205
+ enableAggregator?: boolean;
206
+ tokenInDecimals?: number;
207
+ }): Promise<PendleConvertQuote>;
208
+ declare function pendleQuoteMintPy(args: {
209
+ chainId: number;
210
+ rpcUrl?: string;
211
+ tokenIn: string;
212
+ pt: string;
213
+ yt: string;
214
+ amountHuman: string;
215
+ slippagePercent: number;
216
+ receiver?: string;
217
+ tokenInDecimals?: number;
218
+ }): Promise<PendleConvertQuote>;
219
+ declare function pendleQuoteRedeemPy(args: {
220
+ chainId: number;
221
+ rpcUrl?: string;
222
+ pt: string;
223
+ yt: string;
224
+ tokenOut: string;
225
+ amountPtHuman: string;
226
+ amountYtHuman?: string;
227
+ slippagePercent: number;
228
+ receiver?: string;
229
+ }): Promise<PendleConvertQuote>;
230
+ declare function pendleQuoteMintSy(args: {
231
+ chainId: number;
232
+ rpcUrl?: string;
233
+ tokenIn: string;
234
+ sy: string;
235
+ amountHuman: string;
236
+ slippagePercent: number;
237
+ receiver?: string;
238
+ }): Promise<PendleConvertQuote>;
239
+ declare function pendleQuoteRedeemSy(args: {
240
+ chainId: number;
241
+ rpcUrl?: string;
242
+ sy: string;
243
+ tokenOut: string;
244
+ amountHuman: string;
245
+ slippagePercent: number;
246
+ receiver?: string;
247
+ }): Promise<PendleConvertQuote>;
248
+ declare function pendleQuoteAddLiquidity(args: {
249
+ chainId: number;
250
+ rpcUrl?: string;
251
+ tokensIn: {
252
+ token: string;
253
+ amountHuman: string;
254
+ }[];
255
+ market: string;
256
+ keepYt?: boolean;
257
+ yt?: string;
258
+ slippagePercent: number;
259
+ receiver?: string;
260
+ }): Promise<PendleConvertQuote>;
261
+ declare function pendleQuoteRemoveLiquidity(args: {
262
+ chainId: number;
263
+ rpcUrl?: string;
264
+ market: string;
265
+ lpAmountHuman: string;
266
+ tokensOut: string[];
267
+ slippagePercent: number;
268
+ receiver?: string;
269
+ enableAggregator?: boolean;
270
+ }): Promise<PendleConvertQuote>;
271
+
272
+ declare function buildPendlePurposePrefill(args: {
273
+ action: string;
274
+ detail: string;
275
+ chainId: number;
276
+ slippagePercent?: number;
277
+ }): string;
278
+
279
+ declare function isPendleConvertEvmSignRequest(extra: Record<string, unknown> | null | undefined): boolean;
280
+ declare function buildEvmMultisignBodyPendleFromConvert(args: {
281
+ keyGen: KeyGenSubsetForPermit;
282
+ chainId: number;
283
+ rpcUrl: string;
284
+ chainDetail: EvmChainDetail;
285
+ useCustomGas: boolean;
286
+ customGasChainDetails?: Record<string, unknown> | null;
287
+ executorAddress: Address | string;
288
+ purposeText: string;
289
+ expiryDate?: number;
290
+ quote: PendleConvertQuote;
291
+ purposeAction: string;
292
+ }): Promise<ReturnType<typeof buildEvmMultisignBatch>>;
293
+ type PendleMultisignCommon = {
294
+ keyGen: KeyGenSubsetForPermit;
295
+ chainId: number;
296
+ rpcUrl: string;
297
+ chainDetail: EvmChainDetail;
298
+ useCustomGas: boolean;
299
+ customGasChainDetails?: Record<string, unknown> | null;
300
+ executorAddress: Address | string;
301
+ purposeText: string;
302
+ expiryDate?: number;
303
+ convertSnapshot?: PendleConvertQuote;
304
+ };
305
+ declare function buildEvmMultisignBodyPendleSwapBatch(args: PendleMultisignCommon & {
306
+ tokenIn: string;
307
+ tokenOut: string;
308
+ amountHuman: string;
309
+ slippagePercent: number;
310
+ enableAggregator?: boolean;
311
+ tokenInDecimals?: number;
312
+ }): Promise<MultisignBuildResult>;
313
+ declare function buildEvmMultisignBodyPendleMintPyBatch(args: PendleMultisignCommon & {
314
+ tokenIn: string;
315
+ pt: string;
316
+ yt: string;
317
+ amountHuman: string;
318
+ slippagePercent: number;
319
+ tokenInDecimals?: number;
320
+ }): Promise<MultisignBuildResult>;
321
+ declare function buildEvmMultisignBodyPendleRedeemPyBatch(args: PendleMultisignCommon & {
322
+ pt: string;
323
+ yt: string;
324
+ tokenOut: string;
325
+ amountPtHuman: string;
326
+ amountYtHuman?: string;
327
+ slippagePercent: number;
328
+ }): Promise<MultisignBuildResult>;
329
+ declare function buildEvmMultisignBodyPendleMintSyBatch(args: PendleMultisignCommon & {
330
+ tokenIn: string;
331
+ sy: string;
332
+ amountHuman: string;
333
+ slippagePercent: number;
334
+ }): Promise<MultisignBuildResult>;
335
+ declare function buildEvmMultisignBodyPendleRedeemSyBatch(args: PendleMultisignCommon & {
336
+ sy: string;
337
+ tokenOut: string;
338
+ amountHuman: string;
339
+ slippagePercent: number;
340
+ }): Promise<MultisignBuildResult>;
341
+ declare function buildEvmMultisignBodyPendleAddLiquidityBatch(args: PendleMultisignCommon & {
342
+ tokensIn: {
343
+ token: string;
344
+ amountHuman: string;
345
+ }[];
346
+ market: string;
347
+ keepYt?: boolean;
348
+ yt?: string;
349
+ slippagePercent: number;
350
+ }): Promise<MultisignBuildResult>;
351
+ declare function buildEvmMultisignBodyPendleRemoveLiquidityBatch(args: PendleMultisignCommon & {
352
+ market: string;
353
+ lpAmountHuman: string;
354
+ tokensOut: string[];
355
+ slippagePercent: number;
356
+ enableAggregator?: boolean;
357
+ }): Promise<MultisignBuildResult>;
358
+ declare function buildEvmMultisignBodyPendleConvertBatch(args: PendleMultisignCommon & {
359
+ tokensIn: {
360
+ token: string;
361
+ amountHuman: string;
362
+ }[];
363
+ tokensOut: string[];
364
+ slippagePercent: number;
365
+ enableAggregator?: boolean;
366
+ }): Promise<MultisignBuildResult>;
367
+
368
+ type PendleMerkleRewardRow = {
369
+ user: string;
370
+ token: string;
371
+ merkleRoot: string;
372
+ chainId: number;
373
+ assetId: string;
374
+ amount: string;
375
+ fromTimestamp: string | null;
376
+ toTimestamp: string | null;
377
+ };
378
+ declare function parsePendleMerkleRewardRow(raw: unknown): PendleMerkleRewardRow | null;
379
+ declare function pendleFetchMerkleRewards(args: {
380
+ user: string;
381
+ }): Promise<{
382
+ user: string;
383
+ claimableRewards: PendleMerkleRewardRow[];
384
+ claimedRewards: PendleMerkleRewardRow[];
385
+ notes: string;
386
+ }>;
387
+
388
+ type PendleLpHolding = {
389
+ chainId: number;
390
+ marketId: string;
391
+ market: string;
392
+ name: string;
393
+ symbol: string;
394
+ decimals: number;
395
+ expiry: string | null;
396
+ matured: boolean;
397
+ closed: boolean;
398
+ lpBalanceWei: string;
399
+ lpAmountHuman: string;
400
+ lpUsd: number | null;
401
+ ptBalanceWei: string;
402
+ ytBalanceWei: string;
403
+ };
404
+ declare function weiToHumanAmount(wei: string, decimals: number): string;
405
+ declare function parsePendlePositionToken(raw: unknown): {
406
+ balanceWei: string;
407
+ usd: number | null;
408
+ };
409
+ declare function collectPendleMarketPositions(raw: unknown, closed: boolean): Array<{
410
+ marketId: string;
411
+ chainId: number;
412
+ market: string;
413
+ closed: boolean;
414
+ lp: {
415
+ balanceWei: string;
416
+ usd: number | null;
417
+ };
418
+ pt: {
419
+ balanceWei: string;
420
+ usd: number | null;
421
+ };
422
+ yt: {
423
+ balanceWei: string;
424
+ usd: number | null;
425
+ };
426
+ }>;
427
+ declare function pendleFetchPositions(args: {
428
+ user: string;
429
+ chainId?: number;
430
+ filterUsd?: number;
431
+ }): Promise<{
432
+ user: string;
433
+ chainId: number | null;
434
+ lp: PendleLpHolding[];
435
+ notes: string;
436
+ }>;
437
+
438
+ declare function pendleRedeemInterestsAndRewards(args: {
439
+ chainId: number;
440
+ receiver: string;
441
+ sys?: string[];
442
+ yts?: string[];
443
+ markets?: string[];
444
+ }): Promise<PendleConvertQuote>;
445
+ declare function buildEvmMultisignBodyPendleRedeemRewardsBatch(args: {
446
+ keyGen: KeyGenSubsetForPermit;
447
+ chainId: number;
448
+ rpcUrl: string;
449
+ chainDetail: EvmChainDetail;
450
+ useCustomGas: boolean;
451
+ customGasChainDetails?: Record<string, unknown> | null;
452
+ executorAddress: Address | string;
453
+ purposeText: string;
454
+ expiryDate?: number;
455
+ sys?: string[];
456
+ yts?: string[];
457
+ markets?: string[];
458
+ convertSnapshot?: PendleConvertQuote;
459
+ }): Promise<MultisignBuildResult>;
460
+
461
+ declare const pendleProtocolModule: ProtocolModule;
462
+
463
+ export { PENDLE_CHAIN_CACHE_MS, PENDLE_CONVERT_DEFAULT_GAS_UNITS, PENDLE_CORE_API_BASE, PENDLE_ICON_CACHE_MS, PENDLE_LISTING_CAP, PENDLE_LISTING_MAX_PAGES, PENDLE_NATIVE_PLACEHOLDER, PENDLE_PROTOCOL_ID, PENDLE_SEARCH_EXTRA_PAGES, PendleApiError, type PendleAssetRow, type PendleConvertActionKind, type PendleConvertQuote, type PendleConvertTx, type PendleLpHolding, type PendleMarketRow, type PendleMerkleRewardRow, type PendleMultisignCommon, type PendlePointCampaign, type PendleTokenAmount, buildEvmMultisignBodyPendleAddLiquidityBatch, buildEvmMultisignBodyPendleConvertBatch, buildEvmMultisignBodyPendleFromConvert, buildEvmMultisignBodyPendleMintPyBatch, buildEvmMultisignBodyPendleMintSyBatch, buildEvmMultisignBodyPendleRedeemPyBatch, buildEvmMultisignBodyPendleRedeemRewardsBatch, buildEvmMultisignBodyPendleRedeemSyBatch, buildEvmMultisignBodyPendleRemoveLiquidityBatch, buildEvmMultisignBodyPendleSwapBatch, buildPendlePurposePrefill, classifyPendleConvertAction, collectPendleMarketAddresses, collectPendleMarketPositions, isPendleChainSupported, isPendleConvertEvmSignRequest, isPendleMarketExpired, isPendleNativeToken, marketTvlUsd, normalizePendleTokenAddress, parsePendleAsset, parsePendleAssetId, parsePendleConvertResponse, parsePendleMarket, parsePendleMerkleRewardRow, parsePendlePositionToken, pendleActionNeedsLiveMarket, pendleAssetId, pendleConvert, pendleCoreFetch, pendleFetchAssetsByIds, pendleFetchMarketsForChain, pendleFetchMarketsPage, pendleFetchMarketsSummary, pendleFetchMerkleRewards, pendleFetchPositions, pendleFetchPricesSummary, pendleFetchSupportedChainIds, pendleIconAddressesForChain, pendleMarketExpiryMs, pendleProtocolModule, pendleQuoteAddLiquidity, pendleQuoteConvert, pendleQuoteMintPy, pendleQuoteMintSy, pendleQuoteRedeemPy, pendleQuoteRedeemSy, pendleQuoteRemoveLiquidity, pendleQuoteSwap, pendleRedeemInterestsAndRewards, pendleSearchAssets, resolvePendleTokenDecimals, selectPendleListingMarkets, slippagePercentToConvert, sortPendleMarketsByTvl, weiToHumanAmount };