@defisaver/automation-sdk 3.3.16-dev-13082-morpho-eoa-dev → 3.3.16-liq-prot-dev

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 (39) hide show
  1. package/cjs/constants/index.js +117 -42
  2. package/cjs/index.d.ts +2 -2
  3. package/cjs/index.js +5 -2
  4. package/cjs/services/strategiesService.js +157 -12
  5. package/cjs/services/strategySubService.d.ts +18 -21
  6. package/cjs/services/strategySubService.js +78 -74
  7. package/cjs/services/strategySubService.test.js +3 -149
  8. package/cjs/services/subDataService.d.ts +70 -20
  9. package/cjs/services/subDataService.js +23 -79
  10. package/cjs/services/subDataService.test.js +17 -202
  11. package/cjs/services/utils.d.ts +2 -1
  12. package/cjs/services/utils.js +14 -1
  13. package/cjs/types/enums.d.ts +36 -17
  14. package/cjs/types/enums.js +30 -11
  15. package/esm/constants/index.js +117 -42
  16. package/esm/index.d.ts +2 -2
  17. package/esm/index.js +5 -2
  18. package/esm/services/strategiesService.js +157 -12
  19. package/esm/services/strategySubService.d.ts +18 -21
  20. package/esm/services/strategySubService.js +78 -73
  21. package/esm/services/strategySubService.test.js +4 -147
  22. package/esm/services/subDataService.d.ts +70 -20
  23. package/esm/services/subDataService.js +21 -77
  24. package/esm/services/subDataService.test.js +18 -200
  25. package/esm/services/utils.d.ts +2 -1
  26. package/esm/services/utils.js +13 -1
  27. package/esm/types/enums.d.ts +36 -17
  28. package/esm/types/enums.js +30 -11
  29. package/package.json +1 -1
  30. package/src/constants/index.ts +119 -43
  31. package/src/index.ts +22 -6
  32. package/src/services/strategiesService.ts +221 -12
  33. package/src/services/strategySubService.test.ts +3 -191
  34. package/src/services/strategySubService.ts +173 -121
  35. package/src/services/subDataService.test.ts +18 -214
  36. package/src/services/subDataService.ts +42 -106
  37. package/src/services/utils.test.ts +1 -1
  38. package/src/services/utils.ts +15 -1
  39. package/src/types/enums.ts +30 -13
@@ -2,7 +2,7 @@ import { expect } from 'chai';
2
2
  import { getAssetInfo } from '@defisaver/tokens';
3
3
 
4
4
  import type { EthereumAddress } from '../types';
5
- import { ChainId, ProtocolIdentifiers, RatioState } from '../types/enums';
5
+ import { Bundles, ChainId, ProtocolIdentifiers, RatioState } from '../types/enums';
6
6
 
7
7
  import '../configuration';
8
8
  import {
@@ -5,6 +5,7 @@ import { getAssetInfo, getAssetInfoByAddress } from '@defisaver/tokens';
5
5
 
6
6
  import type { EthereumAddress } from '../types';
7
7
  import {
8
+ Bundles,
8
9
  ChainId, CloseStrategyType, CloseToAssetType, RatioState,
9
10
  } from '../types/enums';
10
11
 
@@ -171,4 +172,17 @@ export function getStopLossAndTakeProfitTypeByCloseStrategyType(
171
172
  default:
172
173
  throw new Error('CloseStrategyType not supported');
173
174
  }
174
- }
175
+ }
176
+
177
+ export function getBundleIdsByNetwork(network: ChainId) {
178
+ switch (Number(network)) {
179
+ case ChainId.Ethereum:
180
+ return Bundles.MainnetIds;
181
+ case ChainId.Arbitrum:
182
+ return Bundles.ArbitrumIds;
183
+ case ChainId.Base:
184
+ return Bundles.BaseIds;
185
+ default:
186
+ throw new Error(`Unsupported network ${network}`);
187
+ }
188
+ }
@@ -153,6 +153,8 @@ export namespace Strategies {
153
153
  EoaRepayOnPrice = 'eoa-repay-on-price',
154
154
  CollateralSwitch = 'collateral-switch',
155
155
  EoaCollateralSwitch = 'eoa-collateral-switch',
156
+ LiquidationProtection = 'liquidation-protection',
157
+ EoaLiquidationProtection = 'liquidation-protection-eoa',
156
158
  }
157
159
  export enum IdOverrides {
158
160
  TakeProfit = 'take-profit',
@@ -164,6 +166,8 @@ export namespace Strategies {
164
166
  EoaLeverageManagement = 'leverage-management-eoa',
165
167
  LeverageManagementOnPrice = 'leverage-management-on-price',
166
168
  EoaLeverageManagementOnPrice = 'leverage-management-on-price-eoa',
169
+ LiquidationProtection = 'liquidation-protection',
170
+ EoaLiquidationProtection = 'liquidation-protection-eoa',
167
171
  }
168
172
  }
169
173
 
@@ -240,10 +244,18 @@ export namespace Bundles {
240
244
  AAVE_V4_EOA_REPAY_ON_PRICE = 68,
241
245
  AAVE_V4_EOA_BOOST_ON_PRICE = 69,
242
246
  AAVE_V4_EOA_CLOSE = 70,
247
+ AAVE_V3_SW_LIQUIDATION_PROTECTION = 71,
248
+ SPARK_SW_LIQUIDATION_PROTECTION = 72,
249
+ MAKER_SW_LIQUIDATION_PROTECTION = 75,
250
+ FLUID_T1_SW_LIQUIDATION_PROTECTION = 76,
251
+ AAVE_V4_SW_LIQUIDATION_PROTECTION = 77,
252
+ MORPHO_BLUE_SW_LIQUIDATION_PROTECTION = 78,
253
+ AAVE_V3_EOA_LIQUIDATION_PROTECTION = 79,
254
+ AAVE_V4_EOA_LIQUIDATION_PROTECTION = 80,
255
+ MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION = 81,
256
+ COMP_V3_SW_LIQUIDATION_PROTECTION = 82,
257
+ COMP_V3_EOA_LIQUIDATION_PROTECTION = 83,
243
258
  MORPHO_BLUE_REPAY_ON_PRICE = 84,
244
- MORPHO_BLUE_EOA_BOOST_ON_PRICE = 85,
245
- MORPHO_BLUE_EOA_REPAY_ON_PRICE = 86,
246
- MORPHO_BLUE_EOA_CLOSE = 87,
247
259
  }
248
260
 
249
261
  export enum OptimismIds {
@@ -258,6 +270,8 @@ export namespace Bundles {
258
270
  AAVE_V3_EOA_REPAY_ON_PRICE = 8,
259
271
  AAVE_V3_EOA_BOOST_ON_PRICE = 9,
260
272
  AAVE_V3_EOA_CLOSE = 10,
273
+ AAVE_V3_SW_LIQUIDATION_PROTECTION = 11,
274
+ AAVE_V3_EOA_LIQUIDATION_PROTECTION = 12,
261
275
  }
262
276
 
263
277
  export enum BaseIds {
@@ -288,12 +302,13 @@ export namespace Bundles {
288
302
  AAVE_V3_EOA_BOOST_ON_PRICE = 26,
289
303
  AAVE_V3_EOA_CLOSE = 27,
290
304
  MORPHO_BLUE_CLOSE = 28,
305
+ AAVE_V3_SW_LIQUIDATION_PROTECTION = 29,
306
+ FLUID_T1_SW_LIQUIDATION_PROTECTION = 30,
307
+ COMP_V3_SW_LIQUIDATION_PROTECTION = 32,
308
+ COMP_V3_EOA_LIQUIDATION_PROTECTION = 33,
309
+ AAVE_V3_EOA_LIQUIDATION_PROTECTION = 34,
310
+ MORPHO_BLUE_SW_LIQUIDATION_PROTECTION = 35,
291
311
  MORPHO_BLUE_REPAY_ON_PRICE = 36,
292
- MORPHO_BLUE_EOA_REPAY = 37,
293
- MORPHO_BLUE_EOA_BOOST = 38,
294
- MORPHO_BLUE_EOA_BOOST_ON_PRICE = 39,
295
- MORPHO_BLUE_EOA_REPAY_ON_PRICE = 40,
296
- MORPHO_BLUE_EOA_CLOSE = 41,
297
312
  }
298
313
 
299
314
  export enum ArbitrumIds {
@@ -326,11 +341,13 @@ export namespace Bundles {
326
341
  MORPHO_BLUE_EOA_REPAY = 26,
327
342
  MORPHO_BLUE_EOA_BOOST = 27,
328
343
  MORPHO_BLUE_CLOSE = 28,
344
+ AAVE_V3_SW_LIQUIDATION_PROTECTION = 29,
345
+ FLUID_T1_SW_LIQUIDATION_PROTECTION = 30,
346
+ MORPHO_BLUE_SW_LIQUIDATION_PROTECTION = 31,
347
+ COMP_V3_SW_LIQUIDATION_PROTECTION = 32,
348
+ COMP_V3_EOA_LIQUIDATION_PROTECTION = 33,
349
+ AAVE_V3_EOA_LIQUIDATION_PROTECTION = 34,
350
+ MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION = 35,
329
351
  MORPHO_BLUE_REPAY_ON_PRICE = 36,
330
- MORPHO_BLUE_EOA_BOOST_ON_PRICE = 37,
331
- MORPHO_BLUE_EOA_REPAY_ON_PRICE = 38,
332
- MORPHO_BLUE_EOA_CLOSE = 39,
333
352
  }
334
353
  }
335
-
336
-