@defisaver/automation-sdk 3.0.8-dev2 → 3.0.8-dev3

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.
@@ -592,9 +592,22 @@ function parseMorphoBlueLeverageManagement(position, parseData) {
592
592
  function parseAaveV3OpenOrderFromCollateral(position, parseData) {
593
593
  const _position = (0, lodash_1.cloneDeep)(position);
594
594
  const { subStruct } = parseData.subscriptionEventData;
595
- _position.strategyData.decoded.triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
596
- _position.strategyData.decoded.subData = subDataService.aaveV3OpenOrderSubData.decode(subStruct.subData);
595
+ const triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
596
+ const subData = subDataService.aaveV3OpenOrderSubData.decode(subStruct.subData);
597
+ _position.strategyData.decoded.triggerData = triggerData;
598
+ _position.strategyData.decoded.subData = subData;
597
599
  _position.positionId = (0, utils_1.getPositionId)(_position.chainId, _position.protocol.id, _position.owner, Math.random());
600
+ _position.specific = {
601
+ collAsset: subData.collAsset,
602
+ debtAsset: subData.debtAsset,
603
+ baseToken: triggerData.baseTokenAddress,
604
+ quoteToken: triggerData.quoteTokenAddress,
605
+ price: triggerData.price,
606
+ ratioState: triggerData.ratioState,
607
+ debtAssetId: subData.debtAssetId,
608
+ collAssetId: subData.collAssetId,
609
+ ratio: subData.targetRatio,
610
+ };
598
611
  return _position;
599
612
  }
600
613
  const parsingMethodsMapping = {
@@ -120,6 +120,9 @@ export declare namespace Position {
120
120
  price: string;
121
121
  ratioState: RatioState;
122
122
  }
123
+ interface BoostOnPriceAave extends CloseOnPriceAave {
124
+ ratio: number;
125
+ }
123
126
  interface CloseOnPriceWithMaximumGasPriceAave extends Base {
124
127
  collAsset: EthereumAddress;
125
128
  collAssetId: number;
@@ -145,7 +148,7 @@ export declare namespace Position {
145
148
  subHashRepay?: string;
146
149
  }
147
150
  }
148
- type SpecificAny = Specific.CloseOnPrice | Specific.TrailingStop | Specific.RatioProtection | Specific.CloseOnPriceAave | Specific.CloseOnPriceWithMaximumGasPriceAave | Specific.DebtInFrontRepay | Specific.LeverageManagementCrvUSD;
151
+ type SpecificAny = Specific.CloseOnPrice | Specific.TrailingStop | Specific.RatioProtection | Specific.CloseOnPriceAave | Specific.BoostOnPriceAave | Specific.CloseOnPriceWithMaximumGasPriceAave | Specific.DebtInFrontRepay | Specific.LeverageManagementCrvUSD;
149
152
  interface Automated {
150
153
  chainId: ChainId;
151
154
  positionId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/automation-sdk",
3
- "version": "3.0.8-dev2",
3
+ "version": "3.0.8-dev3",
4
4
  "description": "",
5
5
  "main": "./umd/index.js",
6
6
  "module": "./esm/index.js",
@@ -782,10 +782,25 @@ function parseAaveV3OpenOrderFromCollateral(position: Position.Automated, parseD
782
782
 
783
783
  const { subStruct } = parseData.subscriptionEventData;
784
784
 
785
- _position.strategyData.decoded.triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
786
- _position.strategyData.decoded.subData = subDataService.aaveV3OpenOrderSubData.decode(subStruct.subData);
785
+ const triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
786
+ const subData = subDataService.aaveV3OpenOrderSubData.decode(subStruct.subData);
787
+
788
+ _position.strategyData.decoded.triggerData = triggerData;
789
+ _position.strategyData.decoded.subData = subData;
787
790
  _position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, Math.random());
788
791
 
792
+ _position.specific = {
793
+ collAsset: subData.collAsset,
794
+ debtAsset: subData.debtAsset,
795
+ baseToken: triggerData.baseTokenAddress,
796
+ quoteToken: triggerData.quoteTokenAddress,
797
+ price: triggerData.price,
798
+ ratioState: triggerData.ratioState,
799
+ debtAssetId: subData.debtAssetId,
800
+ collAssetId: subData.collAssetId,
801
+ ratio: subData.targetRatio,
802
+ };
803
+
789
804
  return _position;
790
805
  }
791
806
 
@@ -145,6 +145,9 @@ export declare namespace Position {
145
145
  price: string,
146
146
  ratioState: RatioState,
147
147
  }
148
+ interface BoostOnPriceAave extends CloseOnPriceAave {
149
+ ratio: number,
150
+ }
148
151
 
149
152
  interface CloseOnPriceWithMaximumGasPriceAave extends Base {
150
153
  collAsset: EthereumAddress,
@@ -175,7 +178,15 @@ export declare namespace Position {
175
178
  }
176
179
  }
177
180
 
178
- type SpecificAny = Specific.CloseOnPrice | Specific.TrailingStop | Specific.RatioProtection | Specific.CloseOnPriceAave | Specific.CloseOnPriceWithMaximumGasPriceAave | Specific.DebtInFrontRepay | Specific.LeverageManagementCrvUSD;
181
+ type SpecificAny =
182
+ Specific.CloseOnPrice
183
+ | Specific.TrailingStop
184
+ | Specific.RatioProtection
185
+ | Specific.CloseOnPriceAave
186
+ | Specific.BoostOnPriceAave
187
+ | Specific.CloseOnPriceWithMaximumGasPriceAave
188
+ | Specific.DebtInFrontRepay
189
+ | Specific.LeverageManagementCrvUSD;
179
190
 
180
191
  export interface Automated {
181
192
  chainId: ChainId,
package/umd/index.js CHANGED
@@ -2392,9 +2392,22 @@ function parseAaveV3OpenOrderFromCollateral(position, parseData) {
2392
2392
  var {
2393
2393
  subStruct
2394
2394
  } = parseData.subscriptionEventData;
2395
- _position.strategyData.decoded.triggerData = _triggerService__WEBPACK_IMPORTED_MODULE_6__.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
2396
- _position.strategyData.decoded.subData = _subDataService__WEBPACK_IMPORTED_MODULE_5__.aaveV3OpenOrderSubData.decode(subStruct.subData);
2395
+ var triggerData = _triggerService__WEBPACK_IMPORTED_MODULE_6__.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
2396
+ var subData = _subDataService__WEBPACK_IMPORTED_MODULE_5__.aaveV3OpenOrderSubData.decode(subStruct.subData);
2397
+ _position.strategyData.decoded.triggerData = triggerData;
2398
+ _position.strategyData.decoded.subData = subData;
2397
2399
  _position.positionId = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.getPositionId)(_position.chainId, _position.protocol.id, _position.owner, Math.random());
2400
+ _position.specific = {
2401
+ collAsset: subData.collAsset,
2402
+ debtAsset: subData.debtAsset,
2403
+ baseToken: triggerData.baseTokenAddress,
2404
+ quoteToken: triggerData.quoteTokenAddress,
2405
+ price: triggerData.price,
2406
+ ratioState: triggerData.ratioState,
2407
+ debtAssetId: subData.debtAssetId,
2408
+ collAssetId: subData.collAssetId,
2409
+ ratio: subData.targetRatio
2410
+ };
2398
2411
  return _position;
2399
2412
  }
2400
2413
  var parsingMethodsMapping = {