@defisaver/automation-sdk 3.3.16 → 3.3.17-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 (35) hide show
  1. package/cjs/constants/index.js +190 -0
  2. package/cjs/index.d.ts +2 -2
  3. package/cjs/index.js +5 -2
  4. package/cjs/services/strategiesService.js +169 -12
  5. package/cjs/services/strategySubService.d.ts +22 -17
  6. package/cjs/services/strategySubService.js +115 -38
  7. package/cjs/services/strategySubService.test.js +111 -41
  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/types/enums.d.ts +48 -6
  12. package/cjs/types/enums.js +42 -0
  13. package/esm/constants/index.js +190 -0
  14. package/esm/index.d.ts +2 -2
  15. package/esm/index.js +5 -2
  16. package/esm/services/strategiesService.js +169 -12
  17. package/esm/services/strategySubService.d.ts +22 -17
  18. package/esm/services/strategySubService.js +113 -37
  19. package/esm/services/strategySubService.test.js +112 -39
  20. package/esm/services/subDataService.d.ts +70 -20
  21. package/esm/services/subDataService.js +21 -77
  22. package/esm/services/subDataService.test.js +18 -200
  23. package/esm/types/enums.d.ts +48 -6
  24. package/esm/types/enums.js +42 -0
  25. package/package.json +1 -1
  26. package/src/constants/index.ts +192 -1
  27. package/src/index.ts +22 -6
  28. package/src/services/strategiesService.ts +234 -12
  29. package/src/services/strategySubService.test.ts +147 -47
  30. package/src/services/strategySubService.ts +246 -47
  31. package/src/services/subDataService.test.ts +18 -214
  32. package/src/services/subDataService.ts +42 -106
  33. package/src/services/utils.test.ts +1 -1
  34. package/src/services/utils.ts +3 -1
  35. package/src/types/enums.ts +42 -2
@@ -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,5 @@ export function getStopLossAndTakeProfitTypeByCloseStrategyType(
171
172
  default:
172
173
  throw new Error('CloseStrategyType not supported');
173
174
  }
174
- }
175
+ }
176
+
@@ -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,7 +244,21 @@ 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,
259
+ MORPHO_BLUE_EOA_BOOST_ON_PRICE = 85,
260
+ MORPHO_BLUE_EOA_REPAY_ON_PRICE = 86,
261
+ MORPHO_BLUE_EOA_CLOSE = 87,
244
262
  }
245
263
 
246
264
  export enum OptimismIds {
@@ -255,6 +273,8 @@ export namespace Bundles {
255
273
  AAVE_V3_EOA_REPAY_ON_PRICE = 8,
256
274
  AAVE_V3_EOA_BOOST_ON_PRICE = 9,
257
275
  AAVE_V3_EOA_CLOSE = 10,
276
+ AAVE_V3_SW_LIQUIDATION_PROTECTION = 11,
277
+ AAVE_V3_EOA_LIQUIDATION_PROTECTION = 12,
258
278
  }
259
279
 
260
280
  export enum BaseIds {
@@ -285,7 +305,19 @@ export namespace Bundles {
285
305
  AAVE_V3_EOA_BOOST_ON_PRICE = 26,
286
306
  AAVE_V3_EOA_CLOSE = 27,
287
307
  MORPHO_BLUE_CLOSE = 28,
308
+ AAVE_V3_SW_LIQUIDATION_PROTECTION = 29,
309
+ FLUID_T1_SW_LIQUIDATION_PROTECTION = 30,
310
+ COMP_V3_SW_LIQUIDATION_PROTECTION = 32,
311
+ COMP_V3_EOA_LIQUIDATION_PROTECTION = 33,
312
+ AAVE_V3_EOA_LIQUIDATION_PROTECTION = 34,
313
+ MORPHO_BLUE_SW_LIQUIDATION_PROTECTION = 35,
288
314
  MORPHO_BLUE_REPAY_ON_PRICE = 36,
315
+ MORPHO_BLUE_EOA_REPAY = 37,
316
+ MORPHO_BLUE_EOA_BOOST = 38,
317
+ MORPHO_BLUE_EOA_BOOST_ON_PRICE = 39,
318
+ MORPHO_BLUE_EOA_REPAY_ON_PRICE = 40,
319
+ MORPHO_BLUE_EOA_CLOSE = 41,
320
+ MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION = 42,
289
321
  }
290
322
 
291
323
  export enum ArbitrumIds {
@@ -318,8 +350,16 @@ export namespace Bundles {
318
350
  MORPHO_BLUE_EOA_REPAY = 26,
319
351
  MORPHO_BLUE_EOA_BOOST = 27,
320
352
  MORPHO_BLUE_CLOSE = 28,
353
+ AAVE_V3_SW_LIQUIDATION_PROTECTION = 29,
354
+ FLUID_T1_SW_LIQUIDATION_PROTECTION = 30,
355
+ MORPHO_BLUE_SW_LIQUIDATION_PROTECTION = 31,
356
+ COMP_V3_SW_LIQUIDATION_PROTECTION = 32,
357
+ COMP_V3_EOA_LIQUIDATION_PROTECTION = 33,
358
+ AAVE_V3_EOA_LIQUIDATION_PROTECTION = 34,
359
+ MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION = 35,
321
360
  MORPHO_BLUE_REPAY_ON_PRICE = 36,
361
+ MORPHO_BLUE_EOA_BOOST_ON_PRICE = 37,
362
+ MORPHO_BLUE_EOA_REPAY_ON_PRICE = 38,
363
+ MORPHO_BLUE_EOA_CLOSE = 39,
322
364
  }
323
365
  }
324
-
325
-