@pendle/sdk-boros 1.0.12 → 1.0.13-cross-deposit-2

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.
Files changed (98) hide show
  1. package/dist/addresses.d.ts +11 -1
  2. package/dist/addresses.js +23 -1
  3. package/dist/addresses.js.map +1 -1
  4. package/dist/backend/secrettune/BorosCoreSDK.d.ts +257 -21
  5. package/dist/backend/secrettune/BorosCoreSDK.js +125 -7
  6. package/dist/backend/secrettune/BorosCoreSDK.js.map +1 -1
  7. package/dist/backend/secrettune/BorosSendTxsBotSDK.d.ts +10 -4
  8. package/dist/backend/secrettune/BorosSendTxsBotSDK.js +1 -1
  9. package/dist/backend/secrettune/BorosSendTxsBotSDK.js.map +1 -1
  10. package/dist/backend/secrettune/PendleV2SDK.d.ts +2281 -0
  11. package/dist/backend/secrettune/PendleV2SDK.js +970 -0
  12. package/dist/backend/secrettune/PendleV2SDK.js.map +1 -0
  13. package/dist/backend/secrettune/module.d.ts +6 -0
  14. package/dist/backend/secrettune/module.js +25 -0
  15. package/dist/backend/secrettune/module.js.map +1 -1
  16. package/dist/common/chainId.d.ts +12 -0
  17. package/dist/common/chainId.js +17 -0
  18. package/dist/common/chainId.js.map +1 -0
  19. package/dist/contracts/abis/viemAbiDepositBoxFactory.d.ts +75 -0
  20. package/dist/contracts/abis/viemAbiDepositBoxFactory.js +103 -0
  21. package/dist/contracts/abis/viemAbiDepositBoxFactory.js.map +1 -0
  22. package/dist/contracts/abis/viemAbiRouter.d.ts +1983 -0
  23. package/dist/contracts/abis/viemAbiRouter.js +2549 -0
  24. package/dist/contracts/abis/viemAbiRouter.js.map +1 -0
  25. package/dist/contracts/contracts.factory.d.ts +9 -3
  26. package/dist/contracts/contracts.factory.js +16 -4
  27. package/dist/contracts/contracts.factory.js.map +1 -1
  28. package/dist/contracts/deposit-box-factory.d.ts +86 -0
  29. package/dist/contracts/deposit-box-factory.js +16 -0
  30. package/dist/contracts/deposit-box-factory.js.map +1 -0
  31. package/dist/contracts/erc20.d.ts +158 -0
  32. package/dist/contracts/erc20.js +52 -0
  33. package/dist/contracts/erc20.js.map +1 -0
  34. package/dist/contracts/router.d.ts +1987 -0
  35. package/dist/contracts/router.js +12 -0
  36. package/dist/contracts/router.js.map +1 -0
  37. package/dist/entities/crossChainDeposit/AggregatorHelper.d.ts +119 -0
  38. package/dist/entities/crossChainDeposit/AggregatorHelper.js +26 -0
  39. package/dist/entities/crossChainDeposit/AggregatorHelper.js.map +1 -0
  40. package/dist/entities/crossChainDeposit/AggregatorHelperErrors.d.ts +83 -0
  41. package/dist/entities/crossChainDeposit/AggregatorHelperErrors.js +116 -0
  42. package/dist/entities/crossChainDeposit/AggregatorHelperErrors.js.map +1 -0
  43. package/dist/entities/crossChainDeposit/Depositor.d.ts +32 -0
  44. package/dist/entities/crossChainDeposit/Depositor.js +67 -0
  45. package/dist/entities/crossChainDeposit/Depositor.js.map +1 -0
  46. package/dist/entities/crossChainDeposit/Withdrawer.d.ts +28 -0
  47. package/dist/entities/crossChainDeposit/Withdrawer.js +59 -0
  48. package/dist/entities/crossChainDeposit/Withdrawer.js.map +1 -0
  49. package/dist/entities/crossChainDeposit/aggregators/Boros/BorosHelper.d.ts +51 -0
  50. package/dist/entities/crossChainDeposit/aggregators/Boros/BorosHelper.js +268 -0
  51. package/dist/entities/crossChainDeposit/aggregators/Boros/BorosHelper.js.map +1 -0
  52. package/dist/entities/crossChainDeposit/aggregators/Boros/index.d.ts +2 -0
  53. package/dist/entities/crossChainDeposit/aggregators/Boros/index.js +19 -0
  54. package/dist/entities/crossChainDeposit/aggregators/Boros/index.js.map +1 -0
  55. package/dist/entities/crossChainDeposit/aggregators/Boros/types.d.ts +10 -0
  56. package/dist/entities/crossChainDeposit/aggregators/Boros/types.js +3 -0
  57. package/dist/entities/crossChainDeposit/aggregators/Boros/types.js.map +1 -0
  58. package/dist/entities/crossChainDeposit/aggregators/Lifi/index.d.ts +52 -0
  59. package/dist/entities/crossChainDeposit/aggregators/Lifi/index.js +231 -0
  60. package/dist/entities/crossChainDeposit/aggregators/Lifi/index.js.map +1 -0
  61. package/dist/entities/crossChainDeposit/aggregators/Lifi/types.d.ts +186 -0
  62. package/dist/entities/crossChainDeposit/aggregators/Lifi/types.js +28 -0
  63. package/dist/entities/crossChainDeposit/aggregators/Lifi/types.js.map +1 -0
  64. package/dist/entities/crossChainDeposit/aggregators/Pendle/index.d.ts +54 -0
  65. package/dist/entities/crossChainDeposit/aggregators/Pendle/index.js +250 -0
  66. package/dist/entities/crossChainDeposit/aggregators/Pendle/index.js.map +1 -0
  67. package/dist/entities/crossChainDeposit/helpers/TokenHelper.d.ts +29 -0
  68. package/dist/entities/crossChainDeposit/helpers/TokenHelper.js +116 -0
  69. package/dist/entities/crossChainDeposit/helpers/TokenHelper.js.map +1 -0
  70. package/dist/entities/crossChainDeposit/helpers/utils.d.ts +4 -0
  71. package/dist/entities/crossChainDeposit/helpers/utils.js +25 -0
  72. package/dist/entities/crossChainDeposit/helpers/utils.js.map +1 -0
  73. package/dist/entities/crossChainDeposit/index.d.ts +3 -0
  74. package/dist/entities/crossChainDeposit/index.js +20 -0
  75. package/dist/entities/crossChainDeposit/index.js.map +1 -0
  76. package/dist/entities/index.d.ts +2 -0
  77. package/dist/entities/index.js +2 -0
  78. package/dist/entities/index.js.map +1 -1
  79. package/dist/entities/token/Token.d.ts +34 -0
  80. package/dist/entities/token/Token.js +65 -0
  81. package/dist/entities/token/Token.js.map +1 -0
  82. package/dist/entities/token/index.d.ts +1 -0
  83. package/dist/entities/token/index.js +18 -0
  84. package/dist/entities/token/index.js.map +1 -0
  85. package/dist/errors/PendleSdkError.d.ts +7 -0
  86. package/dist/errors/PendleSdkError.js +15 -0
  87. package/dist/errors/PendleSdkError.js.map +1 -0
  88. package/dist/index.d.ts +1 -1
  89. package/dist/index.js +1 -1
  90. package/dist/index.js.map +1 -1
  91. package/dist/types/common.d.ts +24 -0
  92. package/dist/utils/signing/index.d.ts +1 -1
  93. package/dist/utils/signing/index.js +2 -1
  94. package/dist/utils/signing/index.js.map +1 -1
  95. package/dist/utils/signing/sensitive.d.ts +2 -1
  96. package/dist/utils/signing/sensitive.js +29 -0
  97. package/dist/utils/signing/sensitive.js.map +1 -1
  98. package/package.json +1 -1
@@ -0,0 +1,186 @@
1
+ import { Address, Hex } from 'viem';
2
+ import { AggregatorRouteStatus } from '../../AggregatorHelper';
3
+ export declare enum ChainType {
4
+ EVM = "EVM",
5
+ SVM = "SVM",
6
+ UTXO = "UTXO",
7
+ MVM = "MVM"
8
+ }
9
+ export type LifiTokenResponse = {
10
+ address: Address;
11
+ decimals: number;
12
+ symbol: string;
13
+ chainId: number;
14
+ name: string;
15
+ coinKey?: string;
16
+ logoURI?: string;
17
+ priceUSD?: string;
18
+ };
19
+ export type GetChainRequest = {
20
+ chainTypes?: string;
21
+ };
22
+ export type GetChainsResponse = {
23
+ chains: {
24
+ key: string;
25
+ name: string;
26
+ coin: string;
27
+ id: number;
28
+ mainnet: boolean;
29
+ logoURI: string;
30
+ nativeToken: LifiTokenResponse;
31
+ }[];
32
+ };
33
+ export type GetTokensRequest = {
34
+ chains?: string;
35
+ chainTypes?: string;
36
+ minPriceUSD?: number;
37
+ };
38
+ export type GetTokensResponse = {
39
+ tokens: Record<number, LifiTokenResponse[]>;
40
+ };
41
+ export declare enum GetRoutesOrder {
42
+ FASTEST = "FASTEST",
43
+ CHEAPEST = "CHEAPEST"
44
+ }
45
+ export type LifiGetChainsRequest = {
46
+ chainTypes: ChainType[];
47
+ };
48
+ export type LifiGetRoutesRequest = {
49
+ fromChainId: number;
50
+ fromAmount: string;
51
+ fromTokenAddress: Address;
52
+ toChainId: number;
53
+ toTokenAddress: Address;
54
+ options?: {
55
+ integrator?: string;
56
+ slippage?: number;
57
+ order?: GetRoutesOrder;
58
+ allowSwitchChain?: boolean;
59
+ allowDestinationCall?: boolean;
60
+ referrer?: string;
61
+ fee?: number;
62
+ maxPriceImpact?: number;
63
+ };
64
+ fromAddress: Address;
65
+ toAddress: Address;
66
+ };
67
+ export declare enum LifiGetRoutesType {
68
+ SWAP = "swap",
69
+ CROSS = "cross",
70
+ LIFI = "lifi"
71
+ }
72
+ export type LifiGetRoutesFeeCost = {
73
+ name: string;
74
+ percentage: string;
75
+ token: LifiTokenResponse;
76
+ amountUSD: string;
77
+ included: boolean;
78
+ description?: string;
79
+ amount?: string;
80
+ };
81
+ export declare enum LifiLifiGetRoutesGasCostType {
82
+ SEND = "SEND",
83
+ APPROVE = "APPROVE",
84
+ SUM = "SUM"
85
+ }
86
+ export type LifiGetRoutesGasCost = {
87
+ type: LifiLifiGetRoutesGasCostType;
88
+ amount: string;
89
+ token: LifiTokenResponse;
90
+ price?: string;
91
+ estimate?: string;
92
+ limit?: string;
93
+ amountUSD?: string;
94
+ };
95
+ export type LifiGetRoutesAction = {
96
+ fromChainId: number;
97
+ fromAmount: string;
98
+ fromToken: LifiTokenResponse;
99
+ toChainId: number;
100
+ toToken: LifiTokenResponse;
101
+ slippage?: number;
102
+ fromAddress?: Address;
103
+ toAddress?: Address;
104
+ };
105
+ export type LifiGetRoutesEstimate = {
106
+ tool: string;
107
+ fromAmount: string;
108
+ toAmount: string;
109
+ toAmountMin: string;
110
+ approvalAddress: Address;
111
+ executionDuration: number;
112
+ fromAmountUSD?: string;
113
+ toAmountUSD?: string;
114
+ feeCosts?: LifiGetRoutesFeeCost[];
115
+ gasCosts?: LifiGetRoutesGasCost[];
116
+ };
117
+ export type LifiGetRoutesIncludedStep = {
118
+ id: string;
119
+ type: LifiGetRoutesType;
120
+ tool: string;
121
+ toolDetails: {
122
+ key?: string;
123
+ name?: string;
124
+ logoURI?: string;
125
+ };
126
+ action: LifiGetRoutesAction;
127
+ estimate: LifiGetRoutesEstimate;
128
+ };
129
+ export type LifiGetRoutesStep = {
130
+ id: string;
131
+ type: LifiGetRoutesType;
132
+ tool: string;
133
+ action: LifiGetRoutesAction;
134
+ toolDetails: {
135
+ key?: string;
136
+ name?: string;
137
+ logoURI?: string;
138
+ };
139
+ estimate: LifiGetRoutesEstimate;
140
+ integrator: string;
141
+ includedSteps: LifiGetRoutesIncludedStep[];
142
+ referrer?: string;
143
+ execution?: any;
144
+ transactionRequest?: any;
145
+ };
146
+ export type LifiGetRouteResponse = {
147
+ id: string;
148
+ fromChainId: number;
149
+ fromAmountUSD: string;
150
+ fromAmount: string;
151
+ fromToken: LifiTokenResponse;
152
+ toChainId: number;
153
+ toAmountUSD: string;
154
+ toAmount: string;
155
+ toAmountMin: string;
156
+ toToken: LifiTokenResponse;
157
+ steps: LifiGetRoutesStep[];
158
+ gasCostUSD?: string;
159
+ fromAddress?: Address;
160
+ toAddress?: Address;
161
+ containsSwitchChain?: boolean;
162
+ };
163
+ export type LifiGetRoutesResponse = {
164
+ routes: LifiGetRouteResponse[];
165
+ };
166
+ export type LifiGetRouteStatusRequest = {
167
+ txHash: Hex;
168
+ fromChain?: number;
169
+ toChain?: number;
170
+ };
171
+ export type LifiGetRouteStatusResponse = {
172
+ sending: {
173
+ txHash: Hex;
174
+ txLink: string;
175
+ amount: string;
176
+ chainId: number;
177
+ };
178
+ status: AggregatorRouteStatus;
179
+ tool: string;
180
+ receiving?: {
181
+ txHash: Hex;
182
+ txLink: string;
183
+ amount: string;
184
+ chainId: number;
185
+ };
186
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LifiLifiGetRoutesGasCostType = exports.LifiGetRoutesType = exports.GetRoutesOrder = exports.ChainType = void 0;
4
+ var ChainType;
5
+ (function (ChainType) {
6
+ ChainType["EVM"] = "EVM";
7
+ ChainType["SVM"] = "SVM";
8
+ ChainType["UTXO"] = "UTXO";
9
+ ChainType["MVM"] = "MVM";
10
+ })(ChainType || (exports.ChainType = ChainType = {}));
11
+ var GetRoutesOrder;
12
+ (function (GetRoutesOrder) {
13
+ GetRoutesOrder["FASTEST"] = "FASTEST";
14
+ GetRoutesOrder["CHEAPEST"] = "CHEAPEST";
15
+ })(GetRoutesOrder || (exports.GetRoutesOrder = GetRoutesOrder = {}));
16
+ var LifiGetRoutesType;
17
+ (function (LifiGetRoutesType) {
18
+ LifiGetRoutesType["SWAP"] = "swap";
19
+ LifiGetRoutesType["CROSS"] = "cross";
20
+ LifiGetRoutesType["LIFI"] = "lifi";
21
+ })(LifiGetRoutesType || (exports.LifiGetRoutesType = LifiGetRoutesType = {}));
22
+ var LifiLifiGetRoutesGasCostType;
23
+ (function (LifiLifiGetRoutesGasCostType) {
24
+ LifiLifiGetRoutesGasCostType["SEND"] = "SEND";
25
+ LifiLifiGetRoutesGasCostType["APPROVE"] = "APPROVE";
26
+ LifiLifiGetRoutesGasCostType["SUM"] = "SUM";
27
+ })(LifiLifiGetRoutesGasCostType || (exports.LifiLifiGetRoutesGasCostType = LifiLifiGetRoutesGasCostType = {}));
28
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/entities/crossChainDeposit/aggregators/Lifi/types.ts"],"names":[],"mappings":";;;AAGA,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,wBAAW,CAAA;IACX,0BAAa,CAAA;IACb,wBAAW,CAAA;AACb,CAAC,EALW,SAAS,yBAAT,SAAS,QAKpB;AAuCD,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,uCAAqB,CAAA;AACvB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AA0BD,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,kCAAa,CAAA;IACb,oCAAe,CAAA;IACf,kCAAa,CAAA;AACf,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B;AAYD,IAAY,4BAIX;AAJD,WAAY,4BAA4B;IACtC,6CAAa,CAAA;IACb,mDAAmB,CAAA;IACnB,2CAAW,CAAA;AACb,CAAC,EAJW,4BAA4B,4CAA5B,4BAA4B,QAIvC"}
@@ -0,0 +1,54 @@
1
+ import { Hex, PublicClient } from 'viem';
2
+ import { PendleSwapResponse } from '../../../../backend/secrettune/PendleV2SDK';
3
+ import { BorosCoreSdk, PendleV2Sdk } from '../../../../backend/secrettune/module';
4
+ import { DepositBoxFactoryContract } from '../../../../contracts/deposit-box-factory';
5
+ import { AggregatorChain, AggregatorHelper, AggregatorName, AggregatorResult, AggregatorRoute, AggregatorRouteStatus, AggregatorSwapData, AggregatorTransferData, QuoteDepositParams, QuoteWithdrawParams } from '../../AggregatorHelper';
6
+ import { TokenHelper, TokenLookupTable } from '../../helpers/TokenHelper';
7
+ export declare class PendleSwapResult implements AggregatorResult {
8
+ routes: AggregatorRoute[];
9
+ private rawResult;
10
+ private req;
11
+ private helper;
12
+ constructor(params: {
13
+ req: QuoteDepositParams;
14
+ res: PendleSwapResponse;
15
+ tokenLookupTable: TokenLookupTable;
16
+ helper: PendleSwapHelper;
17
+ });
18
+ getAggregatorName(): AggregatorName;
19
+ selectRoute(): PendleSwapResponse | undefined;
20
+ getRouteData(): Promise<{
21
+ transferData: AggregatorTransferData;
22
+ swapData: AggregatorSwapData;
23
+ }>;
24
+ }
25
+ export declare class PendleWithdrawResult implements AggregatorResult {
26
+ routes: AggregatorRoute[];
27
+ private rawResult;
28
+ private req;
29
+ constructor(params: {
30
+ req: QuoteWithdrawParams;
31
+ res: PendleSwapResponse;
32
+ tokenLookupTable: TokenLookupTable;
33
+ });
34
+ getAggregatorName(): AggregatorName;
35
+ selectRoute(): PendleSwapResponse | undefined;
36
+ getRouteData(_routeId: string): Promise<{
37
+ transferData: AggregatorTransferData;
38
+ }>;
39
+ }
40
+ export declare class PendleSwapHelper implements AggregatorHelper {
41
+ private readonly pendleV2Sdk;
42
+ private readonly coreSdk;
43
+ private readonly publicClient;
44
+ private readonly tokenHelper;
45
+ private readonly depositBoxFactoryContract;
46
+ aggregatorName: AggregatorName;
47
+ constructor(pendleV2Sdk: PendleV2Sdk, coreSdk: BorosCoreSdk, publicClient: PublicClient, tokenHelper: TokenHelper, depositBoxFactoryContract: DepositBoxFactoryContract);
48
+ getChains(): Promise<AggregatorChain[]>;
49
+ getTokenLookupTable(): Promise<TokenLookupTable>;
50
+ getRouteStatus(txHash: Hex): Promise<AggregatorRouteStatus>;
51
+ quoteDeposit(params: QuoteDepositParams): Promise<PendleSwapResult>;
52
+ quoteWithdraw(params: QuoteWithdrawParams): Promise<PendleWithdrawResult>;
53
+ prepareTransferCall(params: QuoteDepositParams): Promise<AggregatorTransferData>;
54
+ }
@@ -0,0 +1,250 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.PendleSwapHelper = exports.PendleWithdrawResult = exports.PendleSwapResult = void 0;
10
+ const viem_1 = require("viem");
11
+ const chains_1 = require("viem/chains");
12
+ const addresses_1 = require("../../../../addresses");
13
+ const cacheDecorators_1 = require("../../../../common/cacheDecorators");
14
+ const constants_1 = require("../../../../multicall/constants");
15
+ const Token_1 = require("../../../token/Token");
16
+ const AggregatorHelper_1 = require("../../AggregatorHelper");
17
+ const AggregatorHelperErrors_1 = require("../../AggregatorHelperErrors");
18
+ const utils_1 = require("../../helpers/utils");
19
+ class PendleSwapResult {
20
+ routes = [];
21
+ rawResult;
22
+ req;
23
+ helper;
24
+ constructor(params) {
25
+ const { req, res, tokenLookupTable, helper } = params;
26
+ this.helper = helper;
27
+ this.req = req;
28
+ const fromToken = tokenLookupTable.lookup(chains_1.arbitrum.id, req.fromToken, true);
29
+ const toToken = tokenLookupTable.lookup(chains_1.arbitrum.id, req.toToken, true);
30
+ this.routes = [
31
+ {
32
+ id: 'pendle',
33
+ inputTokenAmount: new Token_1.TokenAmount(fromToken, BigInt(req.fromAmount)),
34
+ outputTokenAmount: new Token_1.TokenAmount(toToken, BigInt(res.data.amountOut)),
35
+ minOutputTokenAmount: new Token_1.TokenAmount(toToken, BigInt(res.data.amountOut)).slipDown(req.slippage),
36
+ steps: [
37
+ {
38
+ fromTokenAmount: new Token_1.TokenAmount(fromToken, BigInt(req.fromAmount)),
39
+ toTokenAmount: new Token_1.TokenAmount(toToken, BigInt(res.data.amountOut)),
40
+ executionDuration: 0.25,
41
+ feeCosts: [],
42
+ gasCosts: [],
43
+ tool: {
44
+ key: 'pendle',
45
+ name: 'Pendle Swap',
46
+ logoURI: 'https://storage.googleapis.com/prod-pendle-bucket-a/images/assets/pro/ea33e392-1876-46a5-b7ce-c8434b5a7e71.svg',
47
+ },
48
+ },
49
+ ],
50
+ },
51
+ ];
52
+ this.rawResult = res;
53
+ }
54
+ getAggregatorName() {
55
+ return AggregatorHelper_1.AggregatorName.PENDLE;
56
+ }
57
+ selectRoute() {
58
+ return this.rawResult;
59
+ }
60
+ async getRouteData() {
61
+ const transferData = await this.helper.prepareTransferCall(this.req);
62
+ return {
63
+ transferData,
64
+ swapData: {
65
+ tokenSpent: this.req.fromToken,
66
+ amountSpent: BigInt(this.req.fromAmount),
67
+ minAmountSpent: BigInt(this.req.fromAmount),
68
+ extRouter: (0, addresses_1.toAddress)(this.rawResult.tx.to),
69
+ extCalldata: this.rawResult.tx.data,
70
+ },
71
+ };
72
+ }
73
+ }
74
+ exports.PendleSwapResult = PendleSwapResult;
75
+ class PendleWithdrawResult {
76
+ routes = [];
77
+ rawResult;
78
+ req;
79
+ constructor(params) {
80
+ const { req, res, tokenLookupTable } = params;
81
+ this.req = req;
82
+ this.rawResult = res;
83
+ const fromToken = tokenLookupTable.lookup(chains_1.arbitrum.id, req.fromToken, true);
84
+ const toToken = tokenLookupTable.lookup(chains_1.arbitrum.id, req.toToken, true);
85
+ this.routes = [
86
+ {
87
+ id: 'pendle',
88
+ inputTokenAmount: new Token_1.TokenAmount(fromToken, BigInt(req.fromAmount)),
89
+ outputTokenAmount: new Token_1.TokenAmount(toToken, BigInt(res.data.amountOut)),
90
+ minOutputTokenAmount: new Token_1.TokenAmount(toToken, BigInt(res.data.amountOut)).slipDown(req.slippage),
91
+ steps: [
92
+ {
93
+ fromTokenAmount: new Token_1.TokenAmount(fromToken, BigInt(req.fromAmount)),
94
+ toTokenAmount: new Token_1.TokenAmount(toToken, BigInt(res.data.amountOut)),
95
+ executionDuration: 0.25,
96
+ feeCosts: [],
97
+ gasCosts: [],
98
+ tool: {
99
+ key: 'pendle',
100
+ name: 'Pendle Swap',
101
+ logoURI: 'https://storage.googleapis.com/prod-pendle-bucket-a/images/assets/pro/ea33e392-1876-46a5-b7ce-c8434b5a7e71.svg',
102
+ },
103
+ },
104
+ ],
105
+ },
106
+ ];
107
+ }
108
+ getAggregatorName() {
109
+ return AggregatorHelper_1.AggregatorName.PENDLE;
110
+ }
111
+ selectRoute() {
112
+ return this.rawResult;
113
+ }
114
+ async getRouteData(_routeId) {
115
+ return {
116
+ transferData: {
117
+ aggregatorName: AggregatorHelper_1.AggregatorName.PENDLE,
118
+ approvalAddress: (0, addresses_1.toAddress)(this.rawResult.tx.to),
119
+ calldata: this.rawResult.tx.data,
120
+ value: BigInt(this.rawResult.tx.value ?? 0),
121
+ from: this.req.fromAddress,
122
+ to: (0, addresses_1.toAddress)(this.rawResult.tx.to),
123
+ chainId: chains_1.arbitrum.id,
124
+ },
125
+ };
126
+ }
127
+ }
128
+ exports.PendleWithdrawResult = PendleWithdrawResult;
129
+ class PendleSwapHelper {
130
+ pendleV2Sdk;
131
+ coreSdk;
132
+ publicClient;
133
+ tokenHelper;
134
+ depositBoxFactoryContract;
135
+ aggregatorName = AggregatorHelper_1.AggregatorName.PENDLE;
136
+ constructor(pendleV2Sdk, coreSdk, publicClient, tokenHelper, depositBoxFactoryContract) {
137
+ this.pendleV2Sdk = pendleV2Sdk;
138
+ this.coreSdk = coreSdk;
139
+ this.publicClient = publicClient;
140
+ this.tokenHelper = tokenHelper;
141
+ this.depositBoxFactoryContract = depositBoxFactoryContract;
142
+ }
143
+ async getChains() {
144
+ return [
145
+ {
146
+ chainId: chains_1.arbitrum.id,
147
+ name: 'Arbitrum',
148
+ key: 'arbitrum',
149
+ coin: 'ETH',
150
+ logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/arbitrum.svg',
151
+ },
152
+ ];
153
+ }
154
+ async getTokenLookupTable() {
155
+ return this.tokenHelper.getTokenLookupTable();
156
+ }
157
+ async getRouteStatus(txHash) {
158
+ try {
159
+ const receipt = await this.publicClient.getTransactionReceipt({ hash: txHash });
160
+ return receipt.status === 'success' ? AggregatorHelper_1.AggregatorRouteStatus.DONE : AggregatorHelper_1.AggregatorRouteStatus.FAILED;
161
+ }
162
+ catch (error) {
163
+ if (error instanceof viem_1.TransactionReceiptNotFoundError) {
164
+ return AggregatorHelper_1.AggregatorRouteStatus.NOT_FOUND;
165
+ }
166
+ throw (0, AggregatorHelperErrors_1.classifyAggregatorError)(AggregatorHelper_1.AggregatorName.PENDLE, error, [500, 502, 503, 504], 'getRouteStatus', txHash, () => undefined);
167
+ }
168
+ }
169
+ async quoteDeposit(params) {
170
+ const { box } = await this.depositBoxFactoryContract.computeDepositBox(params.fromAddress, params.boxId);
171
+ const req = {
172
+ receiver: box,
173
+ inputs: [
174
+ {
175
+ token: params.fromToken,
176
+ amount: params.fromAmount.toString(),
177
+ },
178
+ ],
179
+ tokenOut: params.toToken,
180
+ slippage: params.slippage,
181
+ aggregators: 'kyberswap,okx',
182
+ };
183
+ (0, utils_1.ensureDepositBoxAddress)(params.fromAddress, params.boxId, req.receiver);
184
+ try {
185
+ const [{ data }, tokenLookupTable] = await Promise.all([
186
+ this.pendleV2Sdk.sdk.sdkControllerPendleSwapV2(chains_1.arbitrum.id, req),
187
+ this.getTokenLookupTable(),
188
+ ]);
189
+ return new PendleSwapResult({ req: params, res: data, tokenLookupTable, helper: this });
190
+ }
191
+ catch (error) {
192
+ throw (0, AggregatorHelperErrors_1.classifyAggregatorError)(AggregatorHelper_1.AggregatorName.PENDLE, error, [500, 502, 503, 504], 'quote', req, () => undefined);
193
+ }
194
+ }
195
+ async quoteWithdraw(params) {
196
+ const req = {
197
+ receiver: params.fromAddress,
198
+ inputs: [
199
+ {
200
+ token: params.fromToken,
201
+ amount: params.fromAmount.toString(),
202
+ },
203
+ ],
204
+ tokenOut: params.toToken,
205
+ slippage: params.slippage,
206
+ aggregators: 'kyberswap,okx',
207
+ };
208
+ try {
209
+ const [{ data }, tokenLookupTable] = await Promise.all([
210
+ this.pendleV2Sdk.sdk.sdkControllerPendleSwapV2(chains_1.arbitrum.id, req),
211
+ this.getTokenLookupTable(),
212
+ ]);
213
+ return new PendleWithdrawResult({ req: params, res: data, tokenLookupTable });
214
+ }
215
+ catch (error) {
216
+ throw (0, AggregatorHelperErrors_1.classifyAggregatorError)(AggregatorHelper_1.AggregatorName.PENDLE, error, [500, 502, 503, 504], 'quote', req, () => undefined);
217
+ }
218
+ }
219
+ async prepareTransferCall(params) {
220
+ try {
221
+ const { data } = await this.coreSdk.depositBox.depositBoxControllerPrepareTransferToBox({
222
+ chainId: chains_1.arbitrum.id,
223
+ token: params.fromToken,
224
+ amount: params.fromAmount.toString(),
225
+ root: params.fromAddress,
226
+ boxId: params.boxId,
227
+ });
228
+ return {
229
+ aggregatorName: AggregatorHelper_1.AggregatorName.BOROS,
230
+ approvalAddress: viem_1.zeroAddress,
231
+ chainId: chains_1.arbitrum.id,
232
+ calldata: data.calldata,
233
+ value: BigInt(data.value),
234
+ from: params.fromAddress,
235
+ to: (0, addresses_1.toAddress)(data.to),
236
+ };
237
+ }
238
+ catch (error) {
239
+ throw (0, AggregatorHelperErrors_1.classifyAggregatorError)(AggregatorHelper_1.AggregatorName.BOROS, error, [500, 502, 503, 504], 'prepareTransferCall', params, () => undefined);
240
+ }
241
+ }
242
+ }
243
+ exports.PendleSwapHelper = PendleSwapHelper;
244
+ __decorate([
245
+ (0, cacheDecorators_1.GlobalCache)({
246
+ generateLookupKey: () => 'PendleSwapHelper.getTokenLookupTable',
247
+ ttl_ms: constants_1.MILLISECONDS_IN_A_MINUTE * 10,
248
+ })
249
+ ], PendleSwapHelper.prototype, "getTokenLookupTable", null);
250
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/entities/crossChainDeposit/aggregators/Pendle/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+BAAgG;AAChG,wCAAuC;AACvC,qDAAkD;AAGlD,wEAAiE;AAEjE,+DAA2E;AAC3E,gDAAmD;AACnD,6DAWgC;AAChC,yEAAuE;AAEvE,+CAA8D;AAE9D,MAAa,gBAAgB;IAC3B,MAAM,GAAsB,EAAE,CAAC;IACvB,SAAS,CAAqB;IAC9B,GAAG,CAAqB;IACxB,MAAM,CAAmB;IAEjC,YAAY,MAKX;QACC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QACtD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC,iBAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,SAAoB,EAAE,IAAI,CAAC,CAAC;QACvF,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,iBAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,OAAkB,EAAE,IAAI,CAAC,CAAC;QAEnF,IAAI,CAAC,MAAM,GAAG;YACZ;gBACE,EAAE,EAAE,QAAQ;gBACZ,gBAAgB,EAAE,IAAI,mBAAW,CAAC,SAAS,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O;gBACL,cAAc,EAAE,iCAAc,CAAC,KAAK;gBACpC,eAAe,EAAE,kBAAW;gBAC5B,OAAO,EAAE,iBAAQ,CAAC,EAAE;gBACpB,QAAQ,EAAE,IAAI,CAAC,QAAe;gBAC9B,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;gBACzB,IAAI,EAAE,MAAM,CAAC,WAAW;gBACxB,EAAE,EAAE,IAAA,qBAAS,EAAC,IAAI,CAAC,EAAE,CAAC;aACvB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAA,gDAAuB,EAC3B,iCAAc,CAAC,KAAK,EACpB,KAAK,EACL,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACpB,qBAAqB,EACrB,MAAM,EACN,GAAG,EAAE,CAAC,SAAS,CAChB,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAtID,4CAsIC;AA3GO;IAJL,IAAA,6BAAW,EAA0C;QACpD,iBAAiB,EAAE,GAAG,EAAE,CAAC,sCAAsC;QAC/D,MAAM,EAAE,oCAAwB,GAAG,EAAE;KACtC,CAAC;2DAGD"}
@@ -0,0 +1,29 @@
1
+ import { Address } from 'viem';
2
+ import { Token } from '../..';
3
+ import { BorosCoreSdk } from '../../../backend/secrettune/module';
4
+ import { ChainId } from '../../../common/chainId';
5
+ import { TokenId } from '../../../types';
6
+ export declare class TokenHelper {
7
+ private readonly borosCoreSdk;
8
+ constructor(borosCoreSdk: BorosCoreSdk);
9
+ getTokens(params?: {
10
+ dstTokenId?: TokenId;
11
+ srcChainId?: ChainId;
12
+ }): Promise<Token[]>;
13
+ getWithdrawerTokens(params?: {
14
+ srcTokenId?: TokenId;
15
+ dstChainId?: ChainId;
16
+ }): Promise<Token[]>;
17
+ getTokenLookupTable(params?: {
18
+ dstTokenId?: TokenId;
19
+ }): Promise<TokenLookupTable>;
20
+ getDepositableTokenIds(chainId: ChainId, tokenAddress: Address): Promise<TokenId[]>;
21
+ }
22
+ export declare class TokenLookupTable {
23
+ private readonly tokens;
24
+ private readonly tokenMap;
25
+ constructor(tokens: Token[]);
26
+ lookup(chainId: ChainId, tokenAddress: Address, checked?: false): Token | undefined;
27
+ lookup(chainId: ChainId, tokenAddress: Address, checked: true): Token;
28
+ lookupTokenId(chainId: ChainId, tokenAddress: Address): number;
29
+ }