@defisaver/automation-sdk 1.0.6 → 1.0.8
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.
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { addToObjectIf, isDefined
|
|
10
|
+
import { addToObjectIf, isDefined } from '../../services/utils';
|
|
11
11
|
import { getAbiItem, makeSubStorageContract } from '../../services/contractService';
|
|
12
12
|
import { getEventsFromContract, multicall } from '../../services/ethereumService';
|
|
13
13
|
import Automation from './Automation';
|
|
@@ -61,7 +61,7 @@ export default class StrategiesAutomation extends Automation {
|
|
|
61
61
|
var _a;
|
|
62
62
|
let latestUpdate = subscriptionEvents[index];
|
|
63
63
|
if (latestUpdate.subHash !== (sub === null || sub === void 0 ? void 0 : sub.strategySubHash)) {
|
|
64
|
-
const updates = yield this.getUpdateDataEventsFromSubStorage({ filter: latestUpdate.subId });
|
|
64
|
+
const updates = yield this.getUpdateDataEventsFromSubStorage(Object.assign(Object.assign({}, addToObjectIf(!!_options, _options)), { filter: latestUpdate.subId }));
|
|
65
65
|
latestUpdate = Object.assign(Object.assign({}, latestUpdate), (_a = updates === null || updates === void 0 ? void 0 : updates[updates.length - 1]) === null || _a === void 0 ? void 0 : _a.returnValues);
|
|
66
66
|
}
|
|
67
67
|
return this.getParsedSubscriptions({
|
|
@@ -30,5 +30,5 @@ export function multicall(web3, chainId, calls, block = 'latest') {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
export function getEventsFromContract(contractWithMeta, event, options) {
|
|
33
|
-
return contractWithMeta.contract.getPastEvents(event, Object.assign(
|
|
33
|
+
return contractWithMeta.contract.getPastEvents(event, Object.assign({ fromBlock: contractWithMeta.createdBlock }, addToObjectIf(isDefined(options), options)));
|
|
34
34
|
}
|
package/package.json
CHANGED
|
@@ -8,9 +8,7 @@ import type {
|
|
|
8
8
|
Subscribe, StrategyModel, SubStorage, UpdateData,
|
|
9
9
|
} from '../../types/contracts/generated/SubStorage';
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
addToArrayIf, addToObjectIf, isDefined,
|
|
13
|
-
} from '../../services/utils';
|
|
11
|
+
import { addToObjectIf, isDefined } from '../../services/utils';
|
|
14
12
|
import { getAbiItem, makeSubStorageContract } from '../../services/contractService';
|
|
15
13
|
import { getEventsFromContract, multicall } from '../../services/ethereumService';
|
|
16
14
|
|
|
@@ -86,7 +84,7 @@ export default class StrategiesAutomation extends Automation {
|
|
|
86
84
|
let latestUpdate = subscriptionEvents[index];
|
|
87
85
|
|
|
88
86
|
if (latestUpdate.subHash !== sub?.strategySubHash) {
|
|
89
|
-
const updates = await this.getUpdateDataEventsFromSubStorage({ filter: latestUpdate.subId as any as Filter });
|
|
87
|
+
const updates = await this.getUpdateDataEventsFromSubStorage({ ...addToObjectIf(!!_options, _options), filter: latestUpdate.subId as any as Filter });
|
|
90
88
|
latestUpdate = {
|
|
91
89
|
...latestUpdate, // Update is missing proxy, hence this
|
|
92
90
|
...updates?.[updates.length - 1]?.returnValues,
|
|
@@ -48,8 +48,8 @@ export function getEventsFromContract<T extends BaseContract>(
|
|
|
48
48
|
return contractWithMeta.contract.getPastEvents(
|
|
49
49
|
event,
|
|
50
50
|
{
|
|
51
|
-
...addToObjectIf(isDefined(options), options),
|
|
52
51
|
fromBlock: contractWithMeta.createdBlock,
|
|
52
|
+
...addToObjectIf(isDefined(options), options),
|
|
53
53
|
},
|
|
54
54
|
);
|
|
55
55
|
}
|
package/umd/index.js
CHANGED
|
@@ -991,9 +991,9 @@ function _multicall() {
|
|
|
991
991
|
return _multicall.apply(this, arguments);
|
|
992
992
|
}
|
|
993
993
|
function getEventsFromContract(contractWithMeta, event, options) {
|
|
994
|
-
return contractWithMeta.contract.getPastEvents(event, _objectSpread(
|
|
994
|
+
return contractWithMeta.contract.getPastEvents(event, _objectSpread({
|
|
995
995
|
fromBlock: contractWithMeta.createdBlock
|
|
996
|
-
}));
|
|
996
|
+
}, (0,_utils__WEBPACK_IMPORTED_MODULE_1__.addToObjectIf)((0,_utils__WEBPACK_IMPORTED_MODULE_1__.isDefined)(options), options)));
|
|
997
997
|
}
|
|
998
998
|
|
|
999
999
|
/***/ }),
|
|
@@ -1221,9 +1221,9 @@ class StrategiesAutomation extends _Automation__WEBPACK_IMPORTED_MODULE_3__["def
|
|
|
1221
1221
|
var latestUpdate = subscriptionEvents[index];
|
|
1222
1222
|
if (latestUpdate.subHash !== (sub === null || sub === void 0 ? void 0 : sub.strategySubHash)) {
|
|
1223
1223
|
var _updates;
|
|
1224
|
-
var updates = yield _this5.getUpdateDataEventsFromSubStorage({
|
|
1224
|
+
var updates = yield _this5.getUpdateDataEventsFromSubStorage(_objectSpread(_objectSpread({}, (0,_services_utils__WEBPACK_IMPORTED_MODULE_0__.addToObjectIf)(!!_options, _options)), {}, {
|
|
1225
1225
|
filter: latestUpdate.subId
|
|
1226
|
-
});
|
|
1226
|
+
}));
|
|
1227
1227
|
latestUpdate = _objectSpread(_objectSpread({}, latestUpdate), updates === null || updates === void 0 ? void 0 : (_updates = updates[updates.length - 1]) === null || _updates === void 0 ? void 0 : _updates.returnValues);
|
|
1228
1228
|
}
|
|
1229
1229
|
return _this5.getParsedSubscriptions({
|