@defisaver/automation-sdk 1.0.7 → 1.0.9

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, } from '../../services/utils';
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: { subId: 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({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/automation-sdk",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "",
5
5
  "main": "./umd/index.js",
6
6
  "module": "./esm/index.js",
@@ -1,5 +1,5 @@
1
1
  import type Web3 from 'web3';
2
- import type { PastEventOptions, Filter } from 'web3-eth-contract';
2
+ import type { PastEventOptions } from 'web3-eth-contract';
3
3
  import type {
4
4
  Position, Interfaces, EthereumAddress,
5
5
  SubscriptionOptions, Contract, ParseData, PlaceholderType,
@@ -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,10 @@ 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({
88
+ ...addToObjectIf(!!_options, _options),
89
+ filter: { subId: latestUpdate.subId },
90
+ });
90
91
  latestUpdate = {
91
92
  ...latestUpdate, // Update is missing proxy, hence this
92
93
  ...updates?.[updates.length - 1]?.returnValues,
package/umd/index.js CHANGED
@@ -1221,9 +1221,11 @@ 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({
1225
- filter: latestUpdate.subId
1226
- });
1224
+ var updates = yield _this5.getUpdateDataEventsFromSubStorage(_objectSpread(_objectSpread({}, (0,_services_utils__WEBPACK_IMPORTED_MODULE_0__.addToObjectIf)(!!_options, _options)), {}, {
1225
+ filter: {
1226
+ subId: latestUpdate.subId
1227
+ }
1228
+ }));
1227
1229
  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
1230
  }
1229
1231
  return _this5.getParsedSubscriptions({