@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.
- package/cjs/constants/index.js +190 -0
- package/cjs/index.d.ts +2 -2
- package/cjs/index.js +5 -2
- package/cjs/services/strategiesService.js +169 -12
- package/cjs/services/strategySubService.d.ts +22 -17
- package/cjs/services/strategySubService.js +115 -38
- package/cjs/services/strategySubService.test.js +111 -41
- package/cjs/services/subDataService.d.ts +70 -20
- package/cjs/services/subDataService.js +23 -79
- package/cjs/services/subDataService.test.js +17 -202
- package/cjs/types/enums.d.ts +48 -6
- package/cjs/types/enums.js +42 -0
- package/esm/constants/index.js +190 -0
- package/esm/index.d.ts +2 -2
- package/esm/index.js +5 -2
- package/esm/services/strategiesService.js +169 -12
- package/esm/services/strategySubService.d.ts +22 -17
- package/esm/services/strategySubService.js +113 -37
- package/esm/services/strategySubService.test.js +112 -39
- package/esm/services/subDataService.d.ts +70 -20
- package/esm/services/subDataService.js +21 -77
- package/esm/services/subDataService.test.js +18 -200
- package/esm/types/enums.d.ts +48 -6
- package/esm/types/enums.js +42 -0
- package/package.json +1 -1
- package/src/constants/index.ts +192 -1
- package/src/index.ts +22 -6
- package/src/services/strategiesService.ts +234 -12
- package/src/services/strategySubService.test.ts +147 -47
- package/src/services/strategySubService.ts +246 -47
- package/src/services/subDataService.test.ts +18 -214
- package/src/services/subDataService.ts +42 -106
- package/src/services/utils.test.ts +1 -1
- package/src/services/utils.ts +3 -1
- package/src/types/enums.ts +42 -2
package/src/constants/index.ts
CHANGED
|
@@ -573,11 +573,82 @@ export const MAINNET_BUNDLES_INFO: MainnetBundleInfo = {
|
|
|
573
573
|
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
574
574
|
protocol: PROTOCOLS.AaveV4,
|
|
575
575
|
},
|
|
576
|
+
[Bundles.MainnetIds.MAKER_SW_LIQUIDATION_PROTECTION]: {
|
|
577
|
+
strategyOrBundleId: Bundles.MainnetIds.MAKER_SW_LIQUIDATION_PROTECTION,
|
|
578
|
+
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
579
|
+
protocol: PROTOCOLS.MakerDAO,
|
|
580
|
+
},
|
|
581
|
+
[Bundles.MainnetIds.AAVE_V3_SW_LIQUIDATION_PROTECTION]: {
|
|
582
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V3_SW_LIQUIDATION_PROTECTION,
|
|
583
|
+
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
584
|
+
protocol: PROTOCOLS.AaveV3,
|
|
585
|
+
},
|
|
586
|
+
[Bundles.MainnetIds.AAVE_V4_SW_LIQUIDATION_PROTECTION]: {
|
|
587
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V4_SW_LIQUIDATION_PROTECTION,
|
|
588
|
+
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
589
|
+
protocol: PROTOCOLS.AaveV4,
|
|
590
|
+
},
|
|
591
|
+
[Bundles.MainnetIds.SPARK_SW_LIQUIDATION_PROTECTION]: {
|
|
592
|
+
strategyOrBundleId: Bundles.MainnetIds.SPARK_SW_LIQUIDATION_PROTECTION,
|
|
593
|
+
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
594
|
+
protocol: PROTOCOLS.Spark,
|
|
595
|
+
},
|
|
596
|
+
[Bundles.MainnetIds.COMP_V3_SW_LIQUIDATION_PROTECTION]: {
|
|
597
|
+
strategyOrBundleId: Bundles.MainnetIds.COMP_V3_SW_LIQUIDATION_PROTECTION,
|
|
598
|
+
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
599
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
600
|
+
},
|
|
601
|
+
[Bundles.MainnetIds.COMP_V3_EOA_LIQUIDATION_PROTECTION]: {
|
|
602
|
+
strategyOrBundleId: Bundles.MainnetIds.COMP_V3_EOA_LIQUIDATION_PROTECTION,
|
|
603
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
604
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
605
|
+
},
|
|
606
|
+
[Bundles.MainnetIds.MORPHO_BLUE_SW_LIQUIDATION_PROTECTION]: {
|
|
607
|
+
strategyOrBundleId:
|
|
608
|
+
Bundles.MainnetIds.MORPHO_BLUE_SW_LIQUIDATION_PROTECTION,
|
|
609
|
+
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
610
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
611
|
+
},
|
|
612
|
+
[Bundles.MainnetIds.FLUID_T1_SW_LIQUIDATION_PROTECTION]: {
|
|
613
|
+
strategyOrBundleId: Bundles.MainnetIds.FLUID_T1_SW_LIQUIDATION_PROTECTION,
|
|
614
|
+
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
615
|
+
protocol: PROTOCOLS.FluidT1,
|
|
616
|
+
},
|
|
617
|
+
[Bundles.MainnetIds.AAVE_V3_EOA_LIQUIDATION_PROTECTION]: {
|
|
618
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V3_EOA_LIQUIDATION_PROTECTION,
|
|
619
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
620
|
+
protocol: PROTOCOLS.AaveV3,
|
|
621
|
+
},
|
|
622
|
+
[Bundles.MainnetIds.AAVE_V4_EOA_LIQUIDATION_PROTECTION]: {
|
|
623
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V4_EOA_LIQUIDATION_PROTECTION,
|
|
624
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
625
|
+
protocol: PROTOCOLS.AaveV4,
|
|
626
|
+
},
|
|
627
|
+
[Bundles.MainnetIds.MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION]: {
|
|
628
|
+
strategyOrBundleId: Bundles.MainnetIds.MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION,
|
|
629
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
630
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
631
|
+
},
|
|
576
632
|
[Bundles.MainnetIds.MORPHO_BLUE_REPAY_ON_PRICE]: {
|
|
577
633
|
strategyOrBundleId: Bundles.MainnetIds.MORPHO_BLUE_REPAY_ON_PRICE,
|
|
578
634
|
strategyId: Strategies.Identifiers.RepayOnPrice,
|
|
579
635
|
protocol: PROTOCOLS.MorphoBlue,
|
|
580
636
|
},
|
|
637
|
+
[Bundles.MainnetIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE]: {
|
|
638
|
+
strategyOrBundleId: Bundles.MainnetIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE,
|
|
639
|
+
strategyId: Strategies.Identifiers.EoaBoostOnPrice,
|
|
640
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
641
|
+
},
|
|
642
|
+
[Bundles.MainnetIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE]: {
|
|
643
|
+
strategyOrBundleId: Bundles.MainnetIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE,
|
|
644
|
+
strategyId: Strategies.Identifiers.EoaRepayOnPrice,
|
|
645
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
646
|
+
},
|
|
647
|
+
[Bundles.MainnetIds.MORPHO_BLUE_EOA_CLOSE]: {
|
|
648
|
+
strategyOrBundleId: Bundles.MainnetIds.MORPHO_BLUE_EOA_CLOSE,
|
|
649
|
+
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
650
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
651
|
+
},
|
|
581
652
|
};
|
|
582
653
|
|
|
583
654
|
export const OPTIMISM_BUNDLES_INFO: OptimismBundleInfo = {
|
|
@@ -636,7 +707,16 @@ export const OPTIMISM_BUNDLES_INFO: OptimismBundleInfo = {
|
|
|
636
707
|
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
637
708
|
protocol: PROTOCOLS.AaveV3,
|
|
638
709
|
},
|
|
639
|
-
|
|
710
|
+
[Bundles.OptimismIds.AAVE_V3_SW_LIQUIDATION_PROTECTION]: {
|
|
711
|
+
strategyOrBundleId: Bundles.OptimismIds.AAVE_V3_SW_LIQUIDATION_PROTECTION,
|
|
712
|
+
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
713
|
+
protocol: PROTOCOLS.AaveV3,
|
|
714
|
+
},
|
|
715
|
+
[Bundles.OptimismIds.AAVE_V3_EOA_LIQUIDATION_PROTECTION]: {
|
|
716
|
+
strategyOrBundleId: Bundles.OptimismIds.AAVE_V3_EOA_LIQUIDATION_PROTECTION,
|
|
717
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
718
|
+
protocol: PROTOCOLS.AaveV3,
|
|
719
|
+
},
|
|
640
720
|
};
|
|
641
721
|
|
|
642
722
|
export const BASE_BUNDLES_INFO: BaseBundleInfo = {
|
|
@@ -780,6 +860,66 @@ export const BASE_BUNDLES_INFO: BaseBundleInfo = {
|
|
|
780
860
|
strategyId: Strategies.Identifiers.RepayOnPrice,
|
|
781
861
|
protocol: PROTOCOLS.MorphoBlue,
|
|
782
862
|
},
|
|
863
|
+
[Bundles.BaseIds.AAVE_V3_SW_LIQUIDATION_PROTECTION]: {
|
|
864
|
+
strategyOrBundleId: Bundles.BaseIds.AAVE_V3_SW_LIQUIDATION_PROTECTION,
|
|
865
|
+
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
866
|
+
protocol: PROTOCOLS.AaveV3,
|
|
867
|
+
},
|
|
868
|
+
[Bundles.BaseIds.COMP_V3_SW_LIQUIDATION_PROTECTION]: {
|
|
869
|
+
strategyOrBundleId: Bundles.BaseIds.COMP_V3_SW_LIQUIDATION_PROTECTION,
|
|
870
|
+
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
871
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
872
|
+
},
|
|
873
|
+
[Bundles.BaseIds.COMP_V3_EOA_LIQUIDATION_PROTECTION]: {
|
|
874
|
+
strategyOrBundleId: Bundles.BaseIds.COMP_V3_EOA_LIQUIDATION_PROTECTION,
|
|
875
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
876
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
877
|
+
},
|
|
878
|
+
[Bundles.BaseIds.MORPHO_BLUE_SW_LIQUIDATION_PROTECTION]: {
|
|
879
|
+
strategyOrBundleId: Bundles.BaseIds.MORPHO_BLUE_SW_LIQUIDATION_PROTECTION,
|
|
880
|
+
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
881
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
882
|
+
},
|
|
883
|
+
[Bundles.BaseIds.MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION]: {
|
|
884
|
+
strategyOrBundleId: Bundles.BaseIds.MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION,
|
|
885
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
886
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
887
|
+
},
|
|
888
|
+
[Bundles.BaseIds.FLUID_T1_SW_LIQUIDATION_PROTECTION]: {
|
|
889
|
+
strategyOrBundleId: Bundles.BaseIds.FLUID_T1_SW_LIQUIDATION_PROTECTION,
|
|
890
|
+
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
891
|
+
protocol: PROTOCOLS.FluidT1,
|
|
892
|
+
},
|
|
893
|
+
[Bundles.BaseIds.AAVE_V3_EOA_LIQUIDATION_PROTECTION]: {
|
|
894
|
+
strategyOrBundleId: Bundles.BaseIds.AAVE_V3_EOA_LIQUIDATION_PROTECTION,
|
|
895
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
896
|
+
protocol: PROTOCOLS.AaveV3,
|
|
897
|
+
},
|
|
898
|
+
[Bundles.BaseIds.MORPHO_BLUE_EOA_REPAY]: {
|
|
899
|
+
strategyOrBundleId: Bundles.BaseIds.MORPHO_BLUE_EOA_REPAY,
|
|
900
|
+
strategyId: Strategies.Identifiers.EoaRepay,
|
|
901
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
902
|
+
},
|
|
903
|
+
[Bundles.BaseIds.MORPHO_BLUE_EOA_BOOST]: {
|
|
904
|
+
strategyOrBundleId: Bundles.BaseIds.MORPHO_BLUE_EOA_BOOST,
|
|
905
|
+
strategyId: Strategies.Identifiers.EoaBoost,
|
|
906
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
907
|
+
},
|
|
908
|
+
[Bundles.BaseIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE]: {
|
|
909
|
+
strategyOrBundleId: Bundles.BaseIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE,
|
|
910
|
+
strategyId: Strategies.Identifiers.EoaBoostOnPrice,
|
|
911
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
912
|
+
},
|
|
913
|
+
[Bundles.BaseIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE]: {
|
|
914
|
+
strategyOrBundleId: Bundles.BaseIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE,
|
|
915
|
+
strategyId: Strategies.Identifiers.EoaRepayOnPrice,
|
|
916
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
917
|
+
},
|
|
918
|
+
[Bundles.BaseIds.MORPHO_BLUE_EOA_CLOSE]: {
|
|
919
|
+
strategyOrBundleId: Bundles.BaseIds.MORPHO_BLUE_EOA_CLOSE,
|
|
920
|
+
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
921
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
922
|
+
},
|
|
783
923
|
};
|
|
784
924
|
|
|
785
925
|
export const ARBITRUM_BUNDLES_INFO: ArbitrumBundleInfo = {
|
|
@@ -933,6 +1073,57 @@ export const ARBITRUM_BUNDLES_INFO: ArbitrumBundleInfo = {
|
|
|
933
1073
|
strategyId: Strategies.Identifiers.RepayOnPrice,
|
|
934
1074
|
protocol: PROTOCOLS.MorphoBlue,
|
|
935
1075
|
},
|
|
1076
|
+
[Bundles.ArbitrumIds.AAVE_V3_SW_LIQUIDATION_PROTECTION]: {
|
|
1077
|
+
strategyOrBundleId: Bundles.ArbitrumIds.AAVE_V3_SW_LIQUIDATION_PROTECTION,
|
|
1078
|
+
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
1079
|
+
protocol: PROTOCOLS.AaveV3,
|
|
1080
|
+
},
|
|
1081
|
+
[Bundles.ArbitrumIds.COMP_V3_SW_LIQUIDATION_PROTECTION]: {
|
|
1082
|
+
strategyOrBundleId: Bundles.ArbitrumIds.COMP_V3_SW_LIQUIDATION_PROTECTION,
|
|
1083
|
+
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
1084
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
1085
|
+
},
|
|
1086
|
+
[Bundles.ArbitrumIds.COMP_V3_EOA_LIQUIDATION_PROTECTION]: {
|
|
1087
|
+
strategyOrBundleId: Bundles.ArbitrumIds.COMP_V3_EOA_LIQUIDATION_PROTECTION,
|
|
1088
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
1089
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
1090
|
+
},
|
|
1091
|
+
[Bundles.ArbitrumIds.MORPHO_BLUE_SW_LIQUIDATION_PROTECTION]: {
|
|
1092
|
+
strategyOrBundleId:
|
|
1093
|
+
Bundles.ArbitrumIds.MORPHO_BLUE_SW_LIQUIDATION_PROTECTION,
|
|
1094
|
+
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
1095
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
1096
|
+
},
|
|
1097
|
+
[Bundles.ArbitrumIds.FLUID_T1_SW_LIQUIDATION_PROTECTION]: {
|
|
1098
|
+
strategyOrBundleId: Bundles.ArbitrumIds.FLUID_T1_SW_LIQUIDATION_PROTECTION,
|
|
1099
|
+
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
1100
|
+
protocol: PROTOCOLS.FluidT1,
|
|
1101
|
+
},
|
|
1102
|
+
[Bundles.ArbitrumIds.AAVE_V3_EOA_LIQUIDATION_PROTECTION]: {
|
|
1103
|
+
strategyOrBundleId: Bundles.ArbitrumIds.AAVE_V3_EOA_LIQUIDATION_PROTECTION,
|
|
1104
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
1105
|
+
protocol: PROTOCOLS.AaveV3,
|
|
1106
|
+
},
|
|
1107
|
+
[Bundles.ArbitrumIds.MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION]: {
|
|
1108
|
+
strategyOrBundleId: Bundles.ArbitrumIds.MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION,
|
|
1109
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
1110
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
1111
|
+
},
|
|
1112
|
+
[Bundles.ArbitrumIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE]: {
|
|
1113
|
+
strategyOrBundleId: Bundles.ArbitrumIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE,
|
|
1114
|
+
strategyId: Strategies.Identifiers.EoaBoostOnPrice,
|
|
1115
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
1116
|
+
},
|
|
1117
|
+
[Bundles.ArbitrumIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE]: {
|
|
1118
|
+
strategyOrBundleId: Bundles.ArbitrumIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE,
|
|
1119
|
+
strategyId: Strategies.Identifiers.EoaRepayOnPrice,
|
|
1120
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
1121
|
+
},
|
|
1122
|
+
[Bundles.ArbitrumIds.MORPHO_BLUE_EOA_CLOSE]: {
|
|
1123
|
+
strategyOrBundleId: Bundles.ArbitrumIds.MORPHO_BLUE_EOA_CLOSE,
|
|
1124
|
+
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
1125
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
1126
|
+
},
|
|
936
1127
|
};
|
|
937
1128
|
|
|
938
1129
|
export const BUNDLES_INFO: BundlesInfo = {
|
package/src/index.ts
CHANGED
|
@@ -24,18 +24,34 @@ import * as enums from './types/enums';
|
|
|
24
24
|
import type * as types from './types';
|
|
25
25
|
|
|
26
26
|
import {
|
|
27
|
-
getRatioStateInfoForAaveCloseStrategy,
|
|
27
|
+
getRatioStateInfoForAaveCloseStrategy,
|
|
28
|
+
compareSubHashes,
|
|
29
|
+
encodeSubId,
|
|
30
|
+
getCloseStrategyType,
|
|
28
31
|
} from './services/utils';
|
|
29
32
|
|
|
30
33
|
const utils = {
|
|
31
|
-
|
|
34
|
+
compareSubHashes,
|
|
35
|
+
encodeSubId,
|
|
36
|
+
getCloseStrategyType,
|
|
37
|
+
getRatioStateInfoForAaveCloseStrategy,
|
|
32
38
|
};
|
|
33
39
|
|
|
34
40
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
ArbitrumStrategies,
|
|
42
|
+
BaseStrategies,
|
|
43
|
+
EthereumStrategies,
|
|
44
|
+
LegacyAaveAutomation,
|
|
45
|
+
LegacyCompoundAutomation,
|
|
46
|
+
LegacyMakerAutomation,
|
|
47
|
+
OptimismStrategies,
|
|
48
|
+
constants,
|
|
49
|
+
enums,
|
|
50
|
+
strategiesService,
|
|
51
|
+
strategySubService,
|
|
52
|
+
subDataService,
|
|
53
|
+
triggerService,
|
|
54
|
+
utils,
|
|
39
55
|
};
|
|
40
56
|
|
|
41
57
|
export type { types };
|