@pendle/sdk-boros 1.0.11-strategies → 1.0.12-cross-deposit-1

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 (107) 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 +165 -21
  5. package/dist/backend/secrettune/BorosCoreSDK.js +72 -6
  6. package/dist/backend/secrettune/BorosCoreSDK.js.map +1 -1
  7. package/dist/backend/secrettune/BorosSendTxsBotSDK.d.ts +4 -3
  8. package/dist/backend/secrettune/BorosSendTxsBotSDK.js.map +1 -1
  9. package/dist/backend/secrettune/PendleV2SDK.d.ts +2281 -0
  10. package/dist/backend/secrettune/PendleV2SDK.js +970 -0
  11. package/dist/backend/secrettune/PendleV2SDK.js.map +1 -0
  12. package/dist/backend/secrettune/module.d.ts +6 -0
  13. package/dist/backend/secrettune/module.js +25 -0
  14. package/dist/backend/secrettune/module.js.map +1 -1
  15. package/dist/common/chainId.d.ts +12 -0
  16. package/dist/common/chainId.js +17 -0
  17. package/dist/common/chainId.js.map +1 -0
  18. package/dist/contracts/abis/viemAbiDepositBoxFactory.d.ts +75 -0
  19. package/dist/contracts/abis/viemAbiDepositBoxFactory.js +103 -0
  20. package/dist/contracts/abis/viemAbiDepositBoxFactory.js.map +1 -0
  21. package/dist/contracts/abis/viemAbiRouter.d.ts +1983 -0
  22. package/dist/contracts/abis/viemAbiRouter.js +2549 -0
  23. package/dist/contracts/abis/viemAbiRouter.js.map +1 -0
  24. package/dist/contracts/contracts.factory.d.ts +8 -2
  25. package/dist/contracts/contracts.factory.js +16 -4
  26. package/dist/contracts/contracts.factory.js.map +1 -1
  27. package/dist/contracts/deposit-box-factory.d.ts +86 -0
  28. package/dist/contracts/deposit-box-factory.js +16 -0
  29. package/dist/contracts/deposit-box-factory.js.map +1 -0
  30. package/dist/contracts/erc20.d.ts +158 -0
  31. package/dist/contracts/erc20.js +52 -0
  32. package/dist/contracts/erc20.js.map +1 -0
  33. package/dist/contracts/router.d.ts +1987 -0
  34. package/dist/contracts/router.js +12 -0
  35. package/dist/contracts/router.js.map +1 -0
  36. package/dist/entities/crossChainDeposit/AggregatorHelper.d.ts +109 -0
  37. package/dist/entities/crossChainDeposit/AggregatorHelper.js +26 -0
  38. package/dist/entities/crossChainDeposit/AggregatorHelper.js.map +1 -0
  39. package/dist/entities/crossChainDeposit/AggregatorHelperErrors.d.ts +80 -0
  40. package/dist/entities/crossChainDeposit/AggregatorHelperErrors.js +116 -0
  41. package/dist/entities/crossChainDeposit/AggregatorHelperErrors.js.map +1 -0
  42. package/dist/entities/crossChainDeposit/Depositor.d.ts +31 -0
  43. package/dist/entities/crossChainDeposit/Depositor.js +64 -0
  44. package/dist/entities/crossChainDeposit/Depositor.js.map +1 -0
  45. package/dist/entities/crossChainDeposit/aggregators/Boros/index.d.ts +36 -0
  46. package/dist/entities/crossChainDeposit/aggregators/Boros/index.js +191 -0
  47. package/dist/entities/crossChainDeposit/aggregators/Boros/index.js.map +1 -0
  48. package/dist/entities/crossChainDeposit/aggregators/Boros/types.d.ts +10 -0
  49. package/dist/entities/crossChainDeposit/aggregators/Boros/types.js.map +1 -0
  50. package/dist/entities/crossChainDeposit/aggregators/Lifi/index.d.ts +39 -0
  51. package/dist/entities/crossChainDeposit/aggregators/Lifi/index.js +159 -0
  52. package/dist/entities/crossChainDeposit/aggregators/Lifi/index.js.map +1 -0
  53. package/dist/entities/crossChainDeposit/aggregators/Lifi/types.d.ts +186 -0
  54. package/dist/entities/crossChainDeposit/aggregators/Lifi/types.js +28 -0
  55. package/dist/entities/crossChainDeposit/aggregators/Lifi/types.js.map +1 -0
  56. package/dist/entities/crossChainDeposit/aggregators/Pendle/index.d.ts +38 -0
  57. package/dist/entities/crossChainDeposit/aggregators/Pendle/index.js +171 -0
  58. package/dist/entities/crossChainDeposit/aggregators/Pendle/index.js.map +1 -0
  59. package/dist/entities/crossChainDeposit/helpers/TokenHelper.d.ts +23 -0
  60. package/dist/entities/crossChainDeposit/helpers/TokenHelper.js +67 -0
  61. package/dist/entities/crossChainDeposit/helpers/TokenHelper.js.map +1 -0
  62. package/dist/entities/crossChainDeposit/helpers/utils.d.ts +4 -0
  63. package/dist/entities/crossChainDeposit/helpers/utils.js +25 -0
  64. package/dist/entities/crossChainDeposit/helpers/utils.js.map +1 -0
  65. package/dist/entities/crossChainDeposit/index.d.ts +2 -0
  66. package/dist/entities/{Calculator → crossChainDeposit}/index.js +2 -6
  67. package/dist/entities/crossChainDeposit/index.js.map +1 -0
  68. package/dist/entities/index.d.ts +2 -1
  69. package/dist/entities/index.js +2 -1
  70. package/dist/entities/index.js.map +1 -1
  71. package/dist/entities/token/Token.d.ts +31 -0
  72. package/dist/entities/token/Token.js +61 -0
  73. package/dist/entities/token/Token.js.map +1 -0
  74. package/dist/entities/token/index.d.ts +1 -0
  75. package/dist/entities/token/index.js +18 -0
  76. package/dist/entities/token/index.js.map +1 -0
  77. package/dist/errors/PendleSdkError.d.ts +7 -0
  78. package/dist/errors/PendleSdkError.js +15 -0
  79. package/dist/errors/PendleSdkError.js.map +1 -0
  80. package/dist/types/common.d.ts +16 -0
  81. package/dist/utils/signing/index.d.ts +1 -1
  82. package/dist/utils/signing/index.js +2 -1
  83. package/dist/utils/signing/index.js.map +1 -1
  84. package/dist/utils/signing/sensitive.d.ts +2 -1
  85. package/dist/utils/signing/sensitive.js +29 -0
  86. package/dist/utils/signing/sensitive.js.map +1 -1
  87. package/package.json +1 -1
  88. package/dist/entities/Calculator/exchangeFees.d.ts +0 -47
  89. package/dist/entities/Calculator/exchangeFees.js +0 -93
  90. package/dist/entities/Calculator/exchangeFees.js.map +0 -1
  91. package/dist/entities/Calculator/index.d.ts +0 -6
  92. package/dist/entities/Calculator/index.js.map +0 -1
  93. package/dist/entities/Calculator/marginCalculator.d.ts +0 -10
  94. package/dist/entities/Calculator/marginCalculator.js +0 -67
  95. package/dist/entities/Calculator/marginCalculator.js.map +0 -1
  96. package/dist/entities/Calculator/strategyApr.d.ts +0 -30
  97. package/dist/entities/Calculator/strategyApr.js +0 -94
  98. package/dist/entities/Calculator/strategyApr.js.map +0 -1
  99. package/dist/entities/Calculator/strategyExecution.d.ts +0 -28
  100. package/dist/entities/Calculator/strategyExecution.js +0 -130
  101. package/dist/entities/Calculator/strategyExecution.js.map +0 -1
  102. package/dist/entities/Calculator/strategyFinder.d.ts +0 -11
  103. package/dist/entities/Calculator/strategyFinder.js +0 -162
  104. package/dist/entities/Calculator/strategyFinder.js.map +0 -1
  105. package/dist/entities/Calculator/types.d.ts +0 -84
  106. package/dist/entities/Calculator/types.js.map +0 -1
  107. /package/dist/entities/{Calculator → crossChainDeposit/aggregators/Boros}/types.js +0 -0
@@ -0,0 +1,191 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.BorosLzBridgeHelper = exports.BorosLzBridgeResult = exports.LAYER_ZERO_SCAN_API = void 0;
13
+ const axios_1 = __importDefault(require("axios"));
14
+ const viem_1 = require("viem");
15
+ const chains_1 = require("viem/chains");
16
+ const addresses_1 = require("../../../../addresses");
17
+ const cacheDecorators_1 = require("../../../../common/cacheDecorators");
18
+ const constants_1 = require("../../../../multicall/constants");
19
+ const token_1 = require("../../../token");
20
+ const AggregatorHelper_1 = require("../../AggregatorHelper");
21
+ const AggregatorHelperErrors_1 = require("../../AggregatorHelperErrors");
22
+ const utils_1 = require("../../helpers/utils");
23
+ exports.LAYER_ZERO_SCAN_API = 'https://scan.layerzero-api.com/v1';
24
+ class BorosLzBridgeResult {
25
+ routes = [];
26
+ rawResult;
27
+ req;
28
+ isDeposit;
29
+ constructor(params) {
30
+ const { isDeposit, req, res, tokenLookupTable } = params;
31
+ this.isDeposit = isDeposit;
32
+ this.req = req;
33
+ this.rawResult = res;
34
+ const fromToken = tokenLookupTable.lookup(chains_1.bsc.id, res.fromToken, true);
35
+ const toToken = tokenLookupTable.lookup(chains_1.arbitrum.id, res.toToken, true);
36
+ this.routes = [
37
+ {
38
+ id: 'boros',
39
+ inputTokenAmount: new token_1.TokenAmount(fromToken, BigInt(res.fromAmount)),
40
+ outputTokenAmount: new token_1.TokenAmount(toToken, BigInt(res.toAmount)),
41
+ minOutputTokenAmount: new token_1.TokenAmount(toToken, BigInt(res.minToAmount)),
42
+ steps: [
43
+ {
44
+ fromTokenAmount: new token_1.TokenAmount(fromToken, BigInt(res.fromAmount)),
45
+ toTokenAmount: new token_1.TokenAmount(toToken, BigInt(res.toAmount)),
46
+ executionDuration: 20,
47
+ feeCosts: res.feeCosts.map((feeCost) => ({
48
+ name: feeCost.name,
49
+ amountUSD: Number(feeCost.amountUsd),
50
+ })),
51
+ gasCosts: res.gasCosts.flatMap((gasCost) => {
52
+ const token = tokenLookupTable.lookup(gasCost.chainId, gasCost.token);
53
+ if (token == null) {
54
+ return [];
55
+ }
56
+ return {
57
+ tokenAmount: new token_1.TokenAmount(token, BigInt(gasCost.amount)),
58
+ amountUSD: Number(gasCost.amountUsd),
59
+ };
60
+ }),
61
+ tool: {
62
+ key: 'boros',
63
+ name: 'LayerZero',
64
+ logoURI: 'https://storage.googleapis.com/prod-pendle-bucket-a/images/assets/pro/ea33e392-1876-46a5-b7ce-c8434b5a7e71.svg',
65
+ },
66
+ },
67
+ ],
68
+ },
69
+ ];
70
+ }
71
+ getAggregatorName() {
72
+ return AggregatorHelper_1.AggregatorName.BOROS;
73
+ }
74
+ selectRoute() {
75
+ return this.rawResult;
76
+ }
77
+ async getRouteData() {
78
+ if (this.isDeposit) {
79
+ (0, utils_1.ensureDepositBoxAddress)(this.req.fromAddress, this.req.boxId, this.rawResult.tx.to);
80
+ }
81
+ return {
82
+ transferData: {
83
+ aggregatorName: AggregatorHelper_1.AggregatorName.BOROS,
84
+ approvalAddress: (0, addresses_1.toAddress)(this.rawResult.tx.to),
85
+ calldata: this.rawResult.tx.calldata,
86
+ value: BigInt(this.rawResult.tx.value),
87
+ from: (0, addresses_1.toAddress)(this.rawResult.tx.from),
88
+ to: (0, addresses_1.toAddress)(this.rawResult.tx.to),
89
+ chainId: chains_1.bsc.id,
90
+ },
91
+ swapData: {
92
+ tokenSpent: (0, addresses_1.toAddress)(this.req.toToken),
93
+ amountSpent: BigInt(this.rawResult.toAmount),
94
+ extRouter: viem_1.zeroAddress,
95
+ extCalldata: '0x',
96
+ },
97
+ };
98
+ }
99
+ }
100
+ exports.BorosLzBridgeResult = BorosLzBridgeResult;
101
+ class BorosLzBridgeHelper {
102
+ borosCoreSdk;
103
+ tokenHelper;
104
+ layerZeroApiUrl;
105
+ aggregatorName = AggregatorHelper_1.AggregatorName.BOROS;
106
+ axios;
107
+ constructor(borosCoreSdk, tokenHelper, layerZeroApiUrl = exports.LAYER_ZERO_SCAN_API) {
108
+ this.borosCoreSdk = borosCoreSdk;
109
+ this.tokenHelper = tokenHelper;
110
+ this.layerZeroApiUrl = layerZeroApiUrl;
111
+ this.axios = axios_1.default.create();
112
+ }
113
+ async getChains() {
114
+ return [
115
+ {
116
+ chainId: chains_1.bsc.id,
117
+ name: 'Binance Smart Chain',
118
+ key: 'bsc',
119
+ coin: 'BNB',
120
+ logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/bsc.svg',
121
+ },
122
+ ];
123
+ }
124
+ async getTokenLookupTable() {
125
+ return this.tokenHelper.getTokenLookupTable();
126
+ }
127
+ async getRouteStatus(txHash) {
128
+ try {
129
+ const data = {
130
+ bridgeTxHash: undefined,
131
+ status: AggregatorHelper_1.AggregatorRouteStatus.PENDING,
132
+ };
133
+ if (data.bridgeTxHash == null) {
134
+ return data.status;
135
+ }
136
+ let lzData;
137
+ try {
138
+ const response = await this.axios.get(`${this.layerZeroApiUrl}/messages/tx/${data.bridgeTxHash}`);
139
+ lzData = response.data;
140
+ }
141
+ catch (lzError) {
142
+ if (axios_1.default.isAxiosError(lzError) && lzError.response?.status === 404) {
143
+ return AggregatorHelper_1.AggregatorRouteStatus.PENDING;
144
+ }
145
+ throw lzError;
146
+ }
147
+ switch (lzData.data[0].status.name) {
148
+ case 'DELIVERED':
149
+ return AggregatorHelper_1.AggregatorRouteStatus.DONE;
150
+ case 'FAILED':
151
+ return AggregatorHelper_1.AggregatorRouteStatus.FAILED;
152
+ case 'UNKNOWN':
153
+ return AggregatorHelper_1.AggregatorRouteStatus.NOT_FOUND;
154
+ case 'PAYLOAD_STORED':
155
+ case 'CONFIRMING':
156
+ case 'INFLIGHT':
157
+ return AggregatorHelper_1.AggregatorRouteStatus.PENDING;
158
+ }
159
+ }
160
+ catch (error) {
161
+ throw (0, AggregatorHelperErrors_1.classifyAggregatorError)(AggregatorHelper_1.AggregatorName.BOROS, error, [500, 502, 503, 504], 'getRouteStatus', txHash, () => undefined);
162
+ }
163
+ }
164
+ async quoteDeposit(params) {
165
+ const req = {
166
+ fromToken: params.fromToken,
167
+ toToken: params.toToken,
168
+ amount: params.fromAmount.toString(),
169
+ fromAddress: params.fromAddress,
170
+ boxId: params.boxId,
171
+ };
172
+ try {
173
+ const [{ data }, tokenLookupTable] = await Promise.all([
174
+ this.borosCoreSdk.depositBox.depositBoxControllerQuoteBscBridgeV2(req),
175
+ this.getTokenLookupTable(),
176
+ ]);
177
+ return new BorosLzBridgeResult({ isDeposit: true, req, res: data, tokenLookupTable });
178
+ }
179
+ catch (error) {
180
+ throw (0, AggregatorHelperErrors_1.classifyAggregatorError)(AggregatorHelper_1.AggregatorName.BOROS, error, [500, 502, 503, 504], 'quote', req, () => undefined);
181
+ }
182
+ }
183
+ }
184
+ exports.BorosLzBridgeHelper = BorosLzBridgeHelper;
185
+ __decorate([
186
+ (0, cacheDecorators_1.GlobalCache)({
187
+ generateLookupKey: () => 'BorosLzBridgeHelper.getTokenLookupTable',
188
+ ttl_ms: constants_1.MILLISECONDS_IN_A_MINUTE * 10,
189
+ })
190
+ ], BorosLzBridgeHelper.prototype, "getTokenLookupTable", null);
191
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/entities/crossChainDeposit/aggregators/Boros/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA6C;AAC7C,+BAAiD;AACjD,wCAA4C;AAC5C,qDAAkD;AAGlD,wEAAiE;AAEjE,+DAA2E;AAC3E,0CAA6C;AAC7C,6DAUgC;AAChC,yEAAuE;AAEvE,+CAA8D;AAGjD,QAAA,mBAAmB,GAAG,mCAAmC,CAAC;AAEvE,MAAa,mBAAmB;IAC9B,MAAM,GAAsB,EAAE,CAAC;IACvB,SAAS,CAAyB;IAClC,GAAG,CAAsB;IACzB,SAAS,CAAU;IAE3B,YAAY,MAKX;QACC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC;QACzD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC;QAErB,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC,YAAG,CAAC,EAAE,EAAE,GAAG,CAAC,SAAoB,EAAE,IAAI,CAAC,CAAC;QAClF,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,iBAAQ,CA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AAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;gBACrD,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,oCAAoC,CAAC,GAAG,CAAC;gBACtE,IAAI,CAAC,mBAAmB,EAAE;aAC3B,CAAC,CAAC;YAEH,OAAO,IAAI,mBAAmB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC;QACxF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAA,gDAAuB,EAAC,iCAAc,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAClH,CAAC;IACH,CAAC;CACF;AAtGD,kDAsGC;AAzEO;IAJL,IAAA,6BAAW,EAA6C;QACvD,iBAAiB,EAAE,GAAG,EAAE,CAAC,yCAAyC;QAClE,MAAM,EAAE,oCAAwB,GAAG,EAAE;KACtC,CAAC;8DAGD"}
@@ -0,0 +1,10 @@
1
+ export type LayerZeroMessageStatus = 'UNKNOWN' | 'CONFIRMING' | 'INFLIGHT' | 'DELIVERED' | 'FAILED' | 'PAYLOAD_STORED';
2
+ export type LayerZeroMessageResponse = {
3
+ data: [
4
+ {
5
+ status: {
6
+ name: LayerZeroMessageStatus;
7
+ };
8
+ }
9
+ ];
10
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/entities/crossChainDeposit/aggregators/Boros/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ import { Hex } from 'viem';
2
+ import { DepositBoxFactoryContract } from '../../../../contracts/deposit-box-factory';
3
+ import { AggregatorTransferData, AggregatorHelper, AggregatorName, AggregatorResult, AggregatorRoute, AggregatorRouteStatus, AggregatorSwapData, QuoteDepositParams } from '../../AggregatorHelper';
4
+ import { LifiGetRoutesRequest, LifiGetRoutesResponse, LifiGetRoutesStep } from './types';
5
+ export declare const LIFI_API = "https://li.quest/v1";
6
+ export declare class LifiAggregatorResult implements AggregatorResult {
7
+ private readonly aggregatorHelper;
8
+ routes: AggregatorRoute[];
9
+ private rawResult;
10
+ private req;
11
+ private isDeposit;
12
+ constructor(params: {
13
+ isDeposit: boolean;
14
+ req: LifiGetRoutesRequest;
15
+ res: LifiGetRoutesResponse;
16
+ aggregatorHelper: LifiAggregatorHelper;
17
+ });
18
+ private isValidRoute;
19
+ getAggregatorName(): AggregatorName;
20
+ getRouteData: (routeId: string) => Promise<{
21
+ transferData: AggregatorTransferData;
22
+ swapData: AggregatorSwapData;
23
+ }>;
24
+ }
25
+ export declare class LifiAggregatorHelper implements AggregatorHelper {
26
+ private readonly depositBoxFactoryContract;
27
+ private readonly apiUrl;
28
+ aggregatorName: AggregatorName;
29
+ private readonly axios;
30
+ constructor(depositBoxFactoryContract: DepositBoxFactoryContract, apiUrl?: string);
31
+ quoteDeposit(params: QuoteDepositParams): Promise<LifiAggregatorResult>;
32
+ quote(callParams: LifiGetRoutesRequest, params: {
33
+ isDeposit: boolean;
34
+ }): Promise<LifiAggregatorResult>;
35
+ assemble(params: LifiGetRoutesStep): Promise<AggregatorTransferData>;
36
+ getRouteStatus(txHash: Hex, options?: {
37
+ fromChain: number;
38
+ }): Promise<AggregatorRouteStatus>;
39
+ }
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LifiAggregatorHelper = exports.LifiAggregatorResult = exports.LIFI_API = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const viem_1 = require("viem");
9
+ const chains_1 = require("viem/chains");
10
+ const Token_1 = require("../../../token/Token");
11
+ const AggregatorHelper_1 = require("../../AggregatorHelper");
12
+ const AggregatorHelperErrors_1 = require("../../AggregatorHelperErrors");
13
+ const utils_1 = require("../../helpers/utils");
14
+ const types_1 = require("./types");
15
+ const addresses_1 = require("../../../../addresses");
16
+ exports.LIFI_API = 'https://li.quest/v1';
17
+ class LifiAggregatorResult {
18
+ aggregatorHelper;
19
+ routes;
20
+ rawResult;
21
+ req;
22
+ isDeposit;
23
+ constructor(params) {
24
+ const { isDeposit, req, res, aggregatorHelper } = params;
25
+ this.isDeposit = isDeposit;
26
+ this.req = req;
27
+ const validRoutes = res.routes.filter((route) => this.isValidRoute(route));
28
+ this.routes = validRoutes.map(({ id, fromAmount, fromToken, toAmount, toToken, steps, toAmountMin }) => ({
29
+ id,
30
+ inputTokenAmount: Token_1.TokenAmount.createFromLifi(fromToken, fromAmount),
31
+ outputTokenAmount: Token_1.TokenAmount.createFromLifi(toToken, toAmount),
32
+ minOutputTokenAmount: Token_1.TokenAmount.createFromLifi(toToken, toAmountMin),
33
+ steps: steps.map((step) => ({
34
+ fromTokenAmount: Token_1.TokenAmount.createFromLifi(step.action.fromToken, step.action.fromAmount),
35
+ toTokenAmount: Token_1.TokenAmount.createFromLifi(step.action.toToken, step.estimate.toAmount),
36
+ executionDuration: step.estimate.executionDuration,
37
+ feeCosts: step.estimate.feeCosts?.map((feeCost) => ({
38
+ name: feeCost.name,
39
+ amountUSD: Number(feeCost.amountUSD),
40
+ })),
41
+ gasCosts: step.estimate.gasCosts?.map((gasCost) => ({
42
+ tokenAmount: Token_1.TokenAmount.createFromLifi(gasCost.token, gasCost.amount),
43
+ amountUSD: Number(gasCost.amountUSD),
44
+ })),
45
+ tool: {
46
+ key: step.toolDetails.key,
47
+ name: step.toolDetails.name,
48
+ logoURI: step.toolDetails.logoURI,
49
+ },
50
+ })),
51
+ }));
52
+ this.rawResult = validRoutes;
53
+ this.aggregatorHelper = aggregatorHelper;
54
+ }
55
+ isValidRoute(route) {
56
+ return route.steps.length === 1;
57
+ }
58
+ getAggregatorName() {
59
+ return AggregatorHelper_1.AggregatorName.LIFI;
60
+ }
61
+ getRouteData = async (routeId) => {
62
+ const route = this.rawResult.find((route) => route.id === routeId);
63
+ if (route == null) {
64
+ throw new Error(`Route not found: ${routeId}`);
65
+ }
66
+ const [step] = route.steps;
67
+ const result = await this.aggregatorHelper.assemble(step);
68
+ if (this.isDeposit) {
69
+ (0, utils_1.ensureCalldataHasBoxAddress)(result.calldata, this.req.toAddress);
70
+ }
71
+ return {
72
+ transferData: result,
73
+ swapData: {
74
+ tokenSpent: (0, addresses_1.toAddress)(this.req.toTokenAddress),
75
+ amountSpent: BigInt(step.action.fromAmount),
76
+ extRouter: viem_1.zeroAddress,
77
+ extCalldata: '0x',
78
+ },
79
+ };
80
+ };
81
+ }
82
+ exports.LifiAggregatorResult = LifiAggregatorResult;
83
+ class LifiAggregatorHelper {
84
+ depositBoxFactoryContract;
85
+ apiUrl;
86
+ aggregatorName = AggregatorHelper_1.AggregatorName.LIFI;
87
+ axios;
88
+ constructor(depositBoxFactoryContract, apiUrl = exports.LIFI_API) {
89
+ this.depositBoxFactoryContract = depositBoxFactoryContract;
90
+ this.apiUrl = apiUrl;
91
+ this.axios = axios_1.default.create();
92
+ }
93
+ async quoteDeposit(params) {
94
+ const { box } = await this.depositBoxFactoryContract.computeDepositBox(params.fromAddress, params.boxId);
95
+ const callParams = {
96
+ fromChainId: params.fromChainId,
97
+ toChainId: chains_1.arbitrum.id,
98
+ fromTokenAddress: params.fromToken,
99
+ toTokenAddress: params.toToken,
100
+ fromAmount: params.fromAmount.toString(),
101
+ fromAddress: params.fromAddress,
102
+ toAddress: box,
103
+ options: {
104
+ integrator: 'pendle',
105
+ allowDestinationCall: false,
106
+ order: types_1.GetRoutesOrder.FASTEST,
107
+ slippage: params.slippage,
108
+ maxPriceImpact: 0.005,
109
+ },
110
+ };
111
+ (0, utils_1.ensureDepositBoxAddress)(callParams.fromAddress, params.boxId, callParams.toAddress);
112
+ return this.quote(callParams, { isDeposit: true });
113
+ }
114
+ async quote(callParams, params) {
115
+ try {
116
+ const { data } = await this.axios.post(`${this.apiUrl}/advanced/routes`, callParams);
117
+ return new LifiAggregatorResult({
118
+ isDeposit: params.isDeposit,
119
+ req: callParams,
120
+ res: data,
121
+ aggregatorHelper: this,
122
+ });
123
+ }
124
+ catch (error) {
125
+ throw (0, AggregatorHelperErrors_1.classifyAggregatorError)(AggregatorHelper_1.AggregatorName.LIFI, error, [500, 502, 503, 504], 'quote', callParams, () => undefined);
126
+ }
127
+ }
128
+ async assemble(params) {
129
+ try {
130
+ const { data } = await this.axios.post(`${this.apiUrl}/advanced/stepTransaction`, params);
131
+ return {
132
+ aggregatorName: AggregatorHelper_1.AggregatorName.LIFI,
133
+ approvalAddress: params.estimate.approvalAddress,
134
+ calldata: data.transactionRequest.data,
135
+ value: BigInt(data.transactionRequest.value),
136
+ from: data.transactionRequest.from,
137
+ to: data.transactionRequest.to,
138
+ chainId: data.transactionRequest.chainId,
139
+ gasPrice: BigInt(data.transactionRequest.gasPrice),
140
+ gasLimit: BigInt(data.transactionRequest.gasLimit),
141
+ };
142
+ }
143
+ catch (error) {
144
+ throw (0, AggregatorHelperErrors_1.classifyAggregatorError)(AggregatorHelper_1.AggregatorName.LIFI, error, [500, 502, 503, 504], 'assemble', params, () => undefined);
145
+ }
146
+ }
147
+ async getRouteStatus(txHash, options) {
148
+ const params = { txHash, fromChain: options?.fromChain };
149
+ try {
150
+ const { data } = await this.axios.get(`${this.apiUrl}/status`, { params });
151
+ return data.status;
152
+ }
153
+ catch (error) {
154
+ throw (0, AggregatorHelperErrors_1.classifyAggregatorError)(AggregatorHelper_1.AggregatorName.LIFI, error, [500, 502, 503, 504], 'getRouteStatus', { txHash }, () => undefined);
155
+ }
156
+ }
157
+ }
158
+ exports.LifiAggregatorHelper = LifiAggregatorHelper;
159
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/entities/crossChainDeposit/aggregators/Lifi/index.ts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CAAC;QACpF,IAAI,CAAC;YACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAA6B,GAAG,IAAI,CAAC,MAAM,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;YACvG,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAA,gDAAuB,EAC3B,iCAAc,CAAC,IAAI,EACnB,KAAK,EACL,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACpB,gBAAgB,EAChB,EAAE,MAAM,EAAE,EACV,GAAG,EAAE,CAAC,SAAS,CAChB,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AArGD,oDAqGC"}
@@ -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"}