@defisaver/automation-sdk 3.0.1 → 3.0.2-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/esm/automation/private/LegacyAutomation.js +2 -2
- package/esm/automation/private/StrategiesAutomation.js +7 -1
- package/esm/automation/private/StrategiesAutomation.test.d.ts +1 -1
- package/esm/automation/private/StrategiesAutomation.test.js +500 -499
- package/esm/constants/index.js +10 -0
- package/esm/services/ethereumService.test.d.ts +1 -1
- package/esm/services/ethereumService.test.js +1 -0
- package/esm/services/strategiesService.js +37 -0
- package/esm/services/strategiesService.test.d.ts +1 -1
- package/esm/services/strategiesService.test.js +1 -0
- package/esm/services/strategySubService.d.ts +3 -0
- package/esm/services/strategySubService.js +11 -1
- package/esm/services/strategySubService.test.d.ts +1 -1
- package/esm/services/strategySubService.test.js +74 -0
- package/esm/services/subDataService.d.ts +12 -0
- package/esm/services/subDataService.js +33 -1
- package/esm/services/subDataService.test.d.ts +1 -1
- package/esm/services/subDataService.test.js +89 -0
- package/esm/services/triggerService.d.ts +9 -0
- package/esm/services/triggerService.js +17 -1
- package/esm/services/triggerService.test.d.ts +1 -1
- package/esm/services/triggerService.test.js +37 -0
- package/esm/services/utils.test.d.ts +1 -1
- package/esm/services/utils.test.js +1 -0
- package/esm/types/enums.d.ts +5 -2
- package/esm/types/enums.js +3 -0
- package/package.json +2 -2
- package/scripts/generateContractTypes.js +1 -1
- package/src/automation/private/LegacyAutomation.ts +2 -2
- package/src/automation/private/StrategiesAutomation.test.ts +503 -501
- package/src/automation/private/StrategiesAutomation.ts +7 -0
- package/src/constants/index.ts +10 -0
- package/src/services/ethereumService.test.ts +1 -0
- package/src/services/strategiesService.test.ts +1 -0
- package/src/services/strategiesService.ts +42 -0
- package/src/services/strategySubService.test.ts +90 -1
- package/src/services/strategySubService.ts +25 -0
- package/src/services/subDataService.test.ts +97 -1
- package/src/services/subDataService.ts +43 -0
- package/src/services/triggerService.test.ts +40 -0
- package/src/services/triggerService.ts +23 -0
- package/src/services/utils.test.ts +1 -0
- package/src/types/enums.ts +3 -0
- package/umd/index.js +126 -3
- package/.env +0 -4
- package/.yarn/releases/yarn-1.22.1.cjs +0 -147386
- package/.yarnrc.yml +0 -3
|
@@ -83,11 +83,11 @@ class LegacyAutomation extends Automation_1.default {
|
|
|
83
83
|
}
|
|
84
84
|
getParsedSubscriptions(addresses, options) {
|
|
85
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
|
|
86
|
+
const legacyAutomationSunset = 18213086;
|
|
87
87
|
if (!(options === null || options === void 0 ? void 0 : options.fromBlock)
|
|
88
88
|
|| (options === null || options === void 0 ? void 0 : options.fromBlock) === 'latest'
|
|
89
89
|
|| (options === null || options === void 0 ? void 0 : options.fromBlock) === 'pending'
|
|
90
|
-
|| ((options === null || options === void 0 ? void 0 : options.fromBlock) && new decimal_js_1.default(options === null || options === void 0 ? void 0 : options.fromBlock.toString()).
|
|
90
|
+
|| ((options === null || options === void 0 ? void 0 : options.fromBlock) && new decimal_js_1.default(options === null || options === void 0 ? void 0 : options.fromBlock.toString()).gte(legacyAutomationSunset))) {
|
|
91
91
|
return [];
|
|
92
92
|
}
|
|
93
93
|
const subscriptions = yield this._getSubscriptions(addresses, options);
|
|
@@ -30,7 +30,11 @@ class StrategiesAutomation extends Automation_1.default {
|
|
|
30
30
|
this.assert();
|
|
31
31
|
}
|
|
32
32
|
getEventFromSubStorage(event, options) {
|
|
33
|
+
var _a;
|
|
33
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
if (new decimal_js_1.default(this.subStorageContract.createdBlock.toString()).gt(((_a = options === null || options === void 0 ? void 0 : options.fromBlock) === null || _a === void 0 ? void 0 : _a.toString()) || 0)) {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
34
38
|
return (0, ethereumService_1.getEventsFromContract)(this.subStorageContract, this.subStorageContractFork, event, options);
|
|
35
39
|
});
|
|
36
40
|
}
|
|
@@ -95,7 +99,9 @@ class StrategiesAutomation extends Automation_1.default {
|
|
|
95
99
|
&& (s.protocol.id !== enums_1.ProtocolIdentifiers.StrategiesAutomation.MakerDAO // reflexer needs to get added if we have it
|
|
96
100
|
|| s.strategyData.decoded.subData.vaultId === current.strategyData.decoded.triggerData.vaultId)
|
|
97
101
|
&& (s.protocol.id !== enums_1.ProtocolIdentifiers.StrategiesAutomation.CrvUSD // merge only crvUSD leverage management for the same market
|
|
98
|
-
|| s.strategyData.decoded.subData.controller.toLowerCase() === current.strategyData.decoded.triggerData.controller.toLowerCase())
|
|
102
|
+
|| s.strategyData.decoded.subData.controller.toLowerCase() === current.strategyData.decoded.triggerData.controller.toLowerCase())
|
|
103
|
+
&& (s.protocol.id !== enums_1.ProtocolIdentifiers.StrategiesAutomation.MorphoBlue // merge morpho blue with the same marketId
|
|
104
|
+
|| s.strategyData.decoded.triggerData.marketId.toLowerCase() === current.strategyData.decoded.triggerData.marketId.toLowerCase());
|
|
99
105
|
}
|
|
100
106
|
mergeSubs(_subscriptions) {
|
|
101
107
|
const mergeBase = _subscriptions.filter(s => (0, utils_1.isDefined)(s) && (0, utils_1.isDefined)(s.specific.mergeWithId));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import '../../configuration';
|