@defisaver/automation-sdk 3.0.3 → 3.0.5

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.
Files changed (143) hide show
  1. package/.babelrc +3 -3
  2. package/.editorconfig +9 -9
  3. package/.env.dev +4 -4
  4. package/.eslintignore +6 -6
  5. package/.eslintrc.js +41 -41
  6. package/.tests.sh +2 -2
  7. package/README.md +41 -41
  8. package/esm/abis/Erc20.json +223 -223
  9. package/esm/abis/SubStorage.json +17 -17
  10. package/esm/abis/UniMulticall.json +14 -14
  11. package/esm/abis/index.d.ts +9 -9
  12. package/esm/abis/index.js +30 -30
  13. package/esm/abis/legacy_AaveV2Subscriptions.json +8 -8
  14. package/esm/abis/legacy_AuthCheck.json +8 -8
  15. package/esm/abis/legacy_CompoundV2Subscriptions.json +9 -9
  16. package/esm/abis/legacy_MakerSubscriptions.json +9 -9
  17. package/esm/automation/private/Automation.d.ts +12 -12
  18. package/esm/automation/private/Automation.js +42 -42
  19. package/esm/automation/private/LegacyAutomation.d.ts +25 -25
  20. package/esm/automation/private/LegacyAutomation.js +118 -118
  21. package/esm/automation/private/LegacyProtocol.d.ts +22 -22
  22. package/esm/automation/private/LegacyProtocol.js +41 -41
  23. package/esm/automation/private/LegacyProtocol.test.d.ts +1 -1
  24. package/esm/automation/private/LegacyProtocol.test.js +25 -25
  25. package/esm/automation/private/Protocol.d.ts +22 -22
  26. package/esm/automation/private/Protocol.js +41 -41
  27. package/esm/automation/private/Protocol.test.d.ts +1 -1
  28. package/esm/automation/private/Protocol.test.js +25 -25
  29. package/esm/automation/private/StrategiesAutomation.d.ts +33 -33
  30. package/esm/automation/private/StrategiesAutomation.js +181 -181
  31. package/esm/automation/private/StrategiesAutomation.test.d.ts +1 -1
  32. package/esm/automation/private/StrategiesAutomation.test.js +671 -671
  33. package/esm/automation/public/ArbitrumStrategies.d.ts +5 -5
  34. package/esm/automation/public/ArbitrumStrategies.js +13 -13
  35. package/esm/automation/public/EthereumStrategies.d.ts +5 -5
  36. package/esm/automation/public/EthereumStrategies.js +13 -13
  37. package/esm/automation/public/OptimismStrategies.d.ts +5 -5
  38. package/esm/automation/public/OptimismStrategies.js +13 -13
  39. package/esm/automation/public/legacy/LegacyAaveAutomation.d.ts +6 -6
  40. package/esm/automation/public/legacy/LegacyAaveAutomation.js +20 -20
  41. package/esm/automation/public/legacy/LegacyCompoundAutomation.d.ts +6 -6
  42. package/esm/automation/public/legacy/LegacyCompoundAutomation.js +20 -20
  43. package/esm/automation/public/legacy/LegacyMakerAutomation.d.ts +6 -6
  44. package/esm/automation/public/legacy/LegacyMakerAutomation.js +20 -20
  45. package/esm/configuration.d.ts +1 -1
  46. package/esm/configuration.js +12 -12
  47. package/esm/constants/index.d.ts +45 -45
  48. package/esm/constants/index.js +395 -365
  49. package/esm/index.d.ts +22 -22
  50. package/esm/index.js +63 -63
  51. package/esm/services/contractService.d.ts +12 -12
  52. package/esm/services/contractService.js +54 -54
  53. package/esm/services/ethereumService.d.ts +7 -7
  54. package/esm/services/ethereumService.js +49 -49
  55. package/esm/services/ethereumService.test.d.ts +1 -1
  56. package/esm/services/ethereumService.test.js +242 -242
  57. package/esm/services/strategiesService.d.ts +2 -2
  58. package/esm/services/strategiesService.js +701 -698
  59. package/esm/services/strategiesService.test.d.ts +1 -1
  60. package/esm/services/strategiesService.test.js +110 -110
  61. package/esm/services/strategySubService.d.ts +87 -87
  62. package/esm/services/strategySubService.js +257 -252
  63. package/esm/services/strategySubService.test.d.ts +1 -1
  64. package/esm/services/strategySubService.test.js +892 -890
  65. package/esm/services/subDataService.d.ts +181 -181
  66. package/esm/services/subDataService.js +442 -442
  67. package/esm/services/subDataService.test.d.ts +1 -1
  68. package/esm/services/subDataService.test.js +1223 -1223
  69. package/esm/services/triggerService.d.ts +191 -191
  70. package/esm/services/triggerService.js +367 -367
  71. package/esm/services/triggerService.test.d.ts +1 -1
  72. package/esm/services/triggerService.test.js +926 -926
  73. package/esm/services/utils.d.ts +25 -25
  74. package/esm/services/utils.js +131 -131
  75. package/esm/services/utils.test.d.ts +1 -1
  76. package/esm/services/utils.test.js +376 -376
  77. package/esm/types/contracts/generated/Erc20.d.ts +53 -53
  78. package/esm/types/contracts/generated/Erc20.js +5 -5
  79. package/esm/types/contracts/generated/Legacy_AaveV2Subscriptions.d.ts +129 -129
  80. package/esm/types/contracts/generated/Legacy_AaveV2Subscriptions.js +5 -5
  81. package/esm/types/contracts/generated/Legacy_AuthCheck.d.ts +20 -20
  82. package/esm/types/contracts/generated/Legacy_AuthCheck.js +5 -5
  83. package/esm/types/contracts/generated/Legacy_CompoundV2Subscriptions.d.ts +128 -128
  84. package/esm/types/contracts/generated/Legacy_CompoundV2Subscriptions.js +5 -5
  85. package/esm/types/contracts/generated/Legacy_MakerSubscriptions.d.ts +246 -246
  86. package/esm/types/contracts/generated/Legacy_MakerSubscriptions.js +5 -5
  87. package/esm/types/contracts/generated/SubStorage.d.ts +114 -114
  88. package/esm/types/contracts/generated/SubStorage.js +5 -5
  89. package/esm/types/contracts/generated/UniMulticall.d.ts +55 -55
  90. package/esm/types/contracts/generated/UniMulticall.js +5 -5
  91. package/esm/types/contracts/generated/index.d.ts +7 -7
  92. package/esm/types/contracts/generated/index.js +2 -2
  93. package/esm/types/contracts/generated/types.d.ts +54 -54
  94. package/esm/types/contracts/generated/types.js +2 -2
  95. package/esm/types/enums.d.ts +160 -154
  96. package/esm/types/enums.js +180 -174
  97. package/esm/types/index.d.ts +217 -217
  98. package/esm/types/index.js +2 -2
  99. package/package.json +71 -71
  100. package/scripts/generateContractTypes.js +39 -39
  101. package/src/abis/Erc20.json +222 -222
  102. package/src/abis/SubStorage.json +17 -17
  103. package/src/abis/UniMulticall.json +14 -14
  104. package/src/abis/index.ts +28 -28
  105. package/src/abis/legacy_AaveV2Subscriptions.json +7 -7
  106. package/src/abis/legacy_AuthCheck.json +7 -7
  107. package/src/abis/legacy_CompoundV2Subscriptions.json +8 -8
  108. package/src/abis/legacy_MakerSubscriptions.json +8 -8
  109. package/src/automation/private/Automation.ts +44 -44
  110. package/src/automation/private/LegacyAutomation.ts +135 -135
  111. package/src/automation/private/LegacyProtocol.test.ts +23 -23
  112. package/src/automation/private/LegacyProtocol.ts +51 -51
  113. package/src/automation/private/Protocol.test.ts +23 -23
  114. package/src/automation/private/Protocol.ts +51 -51
  115. package/src/automation/private/StrategiesAutomation.test.ts +663 -663
  116. package/src/automation/private/StrategiesAutomation.ts +242 -242
  117. package/src/automation/public/ArbitrumStrategies.ts +10 -10
  118. package/src/automation/public/EthereumStrategies.ts +10 -10
  119. package/src/automation/public/OptimismStrategies.ts +10 -10
  120. package/src/automation/public/legacy/LegacyAaveAutomation.ts +20 -20
  121. package/src/automation/public/legacy/LegacyCompoundAutomation.ts +20 -20
  122. package/src/automation/public/legacy/LegacyMakerAutomation.ts +20 -20
  123. package/src/configuration.ts +8 -8
  124. package/src/constants/index.ts +409 -379
  125. package/src/index.ts +38 -38
  126. package/src/services/contractService.ts +77 -77
  127. package/src/services/ethereumService.test.ts +257 -257
  128. package/src/services/ethereumService.ts +69 -69
  129. package/src/services/strategiesService.test.ts +105 -105
  130. package/src/services/strategiesService.ts +905 -901
  131. package/src/services/strategySubService.test.ts +1063 -1060
  132. package/src/services/strategySubService.ts +496 -492
  133. package/src/services/subDataService.test.ts +1324 -1324
  134. package/src/services/subDataService.ts +594 -593
  135. package/src/services/triggerService.test.ts +1004 -1004
  136. package/src/services/triggerService.ts +449 -449
  137. package/src/services/utils.test.ts +430 -430
  138. package/src/services/utils.ts +103 -103
  139. package/src/types/enums.ts +174 -168
  140. package/src/types/index.ts +262 -262
  141. package/tsconfig.json +79 -79
  142. package/umd/index.js +65 -24
  143. package/webpack.umd.js +52 -52
package/tsconfig.json CHANGED
@@ -1,79 +1,79 @@
1
- {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
-
5
- /* Basic Options */
6
- // "incremental": true, /* Enable incremental compilation */
7
- "target": "ES2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
8
- "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
9
- // "lib": [], /* Specify library files to be included in the compilation. */
10
- "allowJs": true, /* Allow javascript files to be compiled. */
11
- // "checkJs": true, /* Report errors in .js files. */
12
- // "jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
13
- "declaration": true, /* Generates corresponding '.d.ts' file. */
14
- // "emitDeclarationOnly": false,
15
- // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
16
- // "sourceMap": true, /* Generates corresponding '.map' file. */
17
- // "outFile": "./", /* Concatenate and emit output to single file. */
18
- "outDir": "./esm/", /* Redirect output structure to the directory. */
19
- // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
20
- // "composite": true, /* Enable project compilation */
21
- // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
22
- // "removeComments": true, /* Do not emit comments to output. */
23
- // "noEmit": true, /* Do not emit outputs. */
24
- // "importHelpers": true, /* Import emit helpers from 'tslib'. */
25
- // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
26
- // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
27
-
28
- /* Strict Type-Checking Options */
29
- "strict": true, /* Enable all strict type-checking options. */
30
- // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
31
- // "strictNullChecks": true, /* Enable strict null checks. */
32
- // "strictFunctionTypes": true, /* Enable strict checking of function types. */
33
- // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
34
- // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
35
- // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
36
- // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
37
- "resolveJsonModule": true,
38
-
39
- /* Additional Checks */
40
- // "noUnusedLocals": true, /* Report errors on unused locals. */
41
- // "noUnusedParameters": true, /* Report errors on unused parameters. */
42
- // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
43
- // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
44
- // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
45
-
46
- /* Module Resolution Options */
47
- "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
48
- // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
49
- // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
50
- // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
51
- //"typeRoots": ["utils.ts"], /* List of folders to include type definitions from. */
52
- //"types": ["./src/utils.ts"], /* Type declaration files to be included in compilation. */
53
- // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
54
- "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
55
- // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
56
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
57
-
58
- /* Source Map Options */
59
- // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
60
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
61
- // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
62
- // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
63
-
64
- /* Experimental Options */
65
- // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
66
- // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
67
-
68
- /* Advanced Options */
69
- "skipLibCheck": true, /* Skip type checking of declaration files. */
70
- "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
71
- },
72
- "include": [
73
- "./src/**/*",
74
- ],
75
- "typedocOptions": {
76
- "entryPoints": ["./src/index.ts"],
77
- "out": "docs",
78
- }
79
- }
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
+
5
+ /* Basic Options */
6
+ // "incremental": true, /* Enable incremental compilation */
7
+ "target": "ES2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
8
+ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
9
+ // "lib": [], /* Specify library files to be included in the compilation. */
10
+ "allowJs": true, /* Allow javascript files to be compiled. */
11
+ // "checkJs": true, /* Report errors in .js files. */
12
+ // "jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
13
+ "declaration": true, /* Generates corresponding '.d.ts' file. */
14
+ // "emitDeclarationOnly": false,
15
+ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
16
+ // "sourceMap": true, /* Generates corresponding '.map' file. */
17
+ // "outFile": "./", /* Concatenate and emit output to single file. */
18
+ "outDir": "./esm/", /* Redirect output structure to the directory. */
19
+ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
20
+ // "composite": true, /* Enable project compilation */
21
+ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
22
+ // "removeComments": true, /* Do not emit comments to output. */
23
+ // "noEmit": true, /* Do not emit outputs. */
24
+ // "importHelpers": true, /* Import emit helpers from 'tslib'. */
25
+ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
26
+ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
27
+
28
+ /* Strict Type-Checking Options */
29
+ "strict": true, /* Enable all strict type-checking options. */
30
+ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
31
+ // "strictNullChecks": true, /* Enable strict null checks. */
32
+ // "strictFunctionTypes": true, /* Enable strict checking of function types. */
33
+ // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
34
+ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
35
+ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
36
+ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
37
+ "resolveJsonModule": true,
38
+
39
+ /* Additional Checks */
40
+ // "noUnusedLocals": true, /* Report errors on unused locals. */
41
+ // "noUnusedParameters": true, /* Report errors on unused parameters. */
42
+ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
43
+ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
44
+ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
45
+
46
+ /* Module Resolution Options */
47
+ "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
48
+ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
49
+ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
50
+ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
51
+ //"typeRoots": ["utils.ts"], /* List of folders to include type definitions from. */
52
+ //"types": ["./src/utils.ts"], /* Type declaration files to be included in compilation. */
53
+ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
54
+ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
55
+ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
56
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
57
+
58
+ /* Source Map Options */
59
+ // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
60
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
61
+ // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
62
+ // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
63
+
64
+ /* Experimental Options */
65
+ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
66
+ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
67
+
68
+ /* Advanced Options */
69
+ "skipLibCheck": true, /* Skip type checking of declaration files. */
70
+ "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
71
+ },
72
+ "include": [
73
+ "./src/**/*",
74
+ ],
75
+ "typedocOptions": {
76
+ "entryPoints": ["./src/index.ts"],
77
+ "out": "docs",
78
+ }
79
+ }
package/umd/index.js CHANGED
@@ -263,6 +263,26 @@ var MAINNET_BUNDLES_INFO = {
263
263
  strategyId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Strategies.Identifiers.EoaBoost,
264
264
  protocol: PROTOCOLS.CompoundV3
265
265
  },
266
+ [_types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.COMP_V3_SW_REPAY_V2_BUNDLE]: {
267
+ strategyOrBundleId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.COMP_V3_SW_REPAY_V2_BUNDLE,
268
+ strategyId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Strategies.Identifiers.Repay,
269
+ protocol: PROTOCOLS.CompoundV3
270
+ },
271
+ [_types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.COMP_V3_SW_BOOST_V2_BUNDLE]: {
272
+ strategyOrBundleId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.COMP_V3_SW_BOOST_V2_BUNDLE,
273
+ strategyId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Strategies.Identifiers.Boost,
274
+ protocol: PROTOCOLS.CompoundV3
275
+ },
276
+ [_types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.COMP_V3_EOA_REPAY_V2_BUNDLE]: {
277
+ strategyOrBundleId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.COMP_V3_EOA_REPAY_V2_BUNDLE,
278
+ strategyId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Strategies.Identifiers.EoaRepay,
279
+ protocol: PROTOCOLS.CompoundV3
280
+ },
281
+ [_types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.COMP_V3_EOA_BOOST_V2_BUNDLE]: {
282
+ strategyOrBundleId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.COMP_V3_EOA_BOOST_V2_BUNDLE,
283
+ strategyId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Strategies.Identifiers.EoaBoost,
284
+ protocol: PROTOCOLS.CompoundV3
285
+ },
266
286
  [_types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.LIQUITY_PAYBACK_USING_CHICKEN_BOND]: {
267
287
  strategyOrBundleId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.LIQUITY_PAYBACK_USING_CHICKEN_BOND,
268
288
  strategyId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Strategies.Identifiers.BondProtection,
@@ -387,6 +407,16 @@ var MAINNET_BUNDLES_INFO = {
387
407
  strategyOrBundleId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.MORPHO_BLUE_BOOST,
388
408
  strategyId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Strategies.Identifiers.Boost,
389
409
  protocol: PROTOCOLS.MorphoBlue
410
+ },
411
+ [_types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.MORPHO_BLUE_EOA_REPAY]: {
412
+ strategyOrBundleId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.MORPHO_BLUE_EOA_REPAY,
413
+ strategyId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Strategies.Identifiers.EoaRepay,
414
+ protocol: PROTOCOLS.MorphoBlue
415
+ },
416
+ [_types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.MORPHO_BLUE_EOA_BOOST]: {
417
+ strategyOrBundleId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.MORPHO_BLUE_EOA_BOOST,
418
+ strategyId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Strategies.Identifiers.EoaBoost,
419
+ protocol: PROTOCOLS.MorphoBlue
390
420
  }
391
421
  };
392
422
  var OPTIMISM_BUNDLES_INFO = {
@@ -487,12 +517,12 @@ var OrderType;
487
517
  })(OrderType || (OrderType = {}));
488
518
  var BundleProtocols;
489
519
 
490
- /**
491
- * @dev Follow the naming convention:
492
- * - Enum name consists of two parts, name and version
493
- * - Name should be human-readable name of the protocol, it can include spaces or any characters needed
494
- * - Version should be separated from the name with double underscores `__` (If there is no version leave it out)
495
- * - Example `Name of ThePROTOCOL__v1` (Without version `Name of ThePROTOCOL`)
520
+ /**
521
+ * @dev Follow the naming convention:
522
+ * - Enum name consists of two parts, name and version
523
+ * - Name should be human-readable name of the protocol, it can include spaces or any characters needed
524
+ * - Version should be separated from the name with double underscores `__` (If there is no version leave it out)
525
+ * - Example `Name of ThePROTOCOL__v1` (Without version `Name of ThePROTOCOL`)
496
526
  */
497
527
  (function (BundleProtocols) {
498
528
  BundleProtocols["MStable"] = "mstable";
@@ -628,8 +658,14 @@ var Bundles;
628
658
  MainnetIds[MainnetIds["COMP_V2_BOOST"] = 21] = "COMP_V2_BOOST";
629
659
  MainnetIds[MainnetIds["CRVUSD_REPAY"] = 26] = "CRVUSD_REPAY";
630
660
  MainnetIds[MainnetIds["CRVUSD_BOOST"] = 27] = "CRVUSD_BOOST";
661
+ MainnetIds[MainnetIds["COMP_V3_SW_REPAY_V2_BUNDLE"] = 28] = "COMP_V3_SW_REPAY_V2_BUNDLE";
662
+ MainnetIds[MainnetIds["COMP_V3_SW_BOOST_V2_BUNDLE"] = 29] = "COMP_V3_SW_BOOST_V2_BUNDLE";
663
+ MainnetIds[MainnetIds["COMP_V3_EOA_REPAY_V2_BUNDLE"] = 30] = "COMP_V3_EOA_REPAY_V2_BUNDLE";
664
+ MainnetIds[MainnetIds["COMP_V3_EOA_BOOST_V2_BUNDLE"] = 31] = "COMP_V3_EOA_BOOST_V2_BUNDLE";
631
665
  MainnetIds[MainnetIds["MORPHO_BLUE_REPAY"] = 32] = "MORPHO_BLUE_REPAY";
632
666
  MainnetIds[MainnetIds["MORPHO_BLUE_BOOST"] = 33] = "MORPHO_BLUE_BOOST";
667
+ MainnetIds[MainnetIds["MORPHO_BLUE_EOA_REPAY"] = 34] = "MORPHO_BLUE_EOA_REPAY";
668
+ MainnetIds[MainnetIds["MORPHO_BLUE_EOA_BOOST"] = 35] = "MORPHO_BLUE_EOA_BOOST";
633
669
  })(MainnetIds || (MainnetIds = {}));
634
670
  _Bundles.MainnetIds = MainnetIds;
635
671
  var OptimismIds;
@@ -694,8 +730,8 @@ class Protocol {
694
730
  return this.id.split(_classPrivateFieldGet(this, _versionSeparator));
695
731
  }
696
732
 
697
- /**
698
- * @dev See naming convention at ProtocolIdentifiers declaration
733
+ /**
734
+ * @dev See naming convention at ProtocolIdentifiers declaration
699
735
  */
700
736
  getVersion() {
701
737
  return this.hasVersion() ? this.splitId().reverse()[0] : '';
@@ -753,8 +789,8 @@ class Protocol {
753
789
  return this.id.split(_classPrivateFieldGet(this, _versionSeparator));
754
790
  }
755
791
 
756
- /**
757
- * @dev See naming convention at ProtocolIdentifiers declaration
792
+ /**
793
+ * @dev See naming convention at ProtocolIdentifiers declaration
758
794
  */
759
795
  getVersion() {
760
796
  return this.hasVersion() ? this.splitId().reverse()[0] : '';
@@ -1524,8 +1560,8 @@ class StrategiesAutomation extends _Automation__WEBPACK_IMPORTED_MODULE_6__["def
1524
1560
  return (0,_services_strategiesService__WEBPACK_IMPORTED_MODULE_5__.parseStrategiesAutomatedPosition)(parseData);
1525
1561
  }
1526
1562
 
1527
- /**
1528
- * @description Removes expired Limit Order subscriptions
1563
+ /**
1564
+ * @description Removes expired Limit Order subscriptions
1529
1565
  */
1530
1566
  removeExpiredSubscriptions(subscriptions) {
1531
1567
  return subscriptions.filter(subscription => {
@@ -2288,7 +2324,7 @@ function parseMorphoBlueLeverageManagement(position, parseData) {
2288
2324
  _position.strategyData.decoded.triggerData = triggerData;
2289
2325
  _position.strategyData.decoded.subData = subData;
2290
2326
  _position.positionId = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.getPositionId)(_position.chainId, _position.protocol.id, _position.owner, triggerData.marketId);
2291
- var isRepay = _position.strategy.strategyId === _types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.Repay;
2327
+ var isRepay = [_types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.Repay, _types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId);
2292
2328
  if (isRepay) {
2293
2329
  _position.specific = {
2294
2330
  triggerRepayRatio: triggerData.ratio,
@@ -2308,7 +2344,8 @@ function parseMorphoBlueLeverageManagement(position, parseData) {
2308
2344
  mergeId: _types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.Boost
2309
2345
  };
2310
2346
  }
2311
- _position.strategy.strategyId = _types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.IdOverrides.LeverageManagement;
2347
+ var isEOA = _position.strategy.strategyId.includes('eoa');
2348
+ _position.strategy.strategyId = isEOA ? _types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.IdOverrides.EoaLeverageManagement : _types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.IdOverrides.LeverageManagement;
2312
2349
  return _position;
2313
2350
  }
2314
2351
  var parsingMethodsMapping = {
@@ -2377,7 +2414,9 @@ var parsingMethodsMapping = {
2377
2414
  },
2378
2415
  [_types_enums__WEBPACK_IMPORTED_MODULE_3__.ProtocolIdentifiers.StrategiesAutomation.MorphoBlue]: {
2379
2416
  [_types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.Repay]: parseMorphoBlueLeverageManagement,
2380
- [_types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.Boost]: parseMorphoBlueLeverageManagement
2417
+ [_types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.Boost]: parseMorphoBlueLeverageManagement,
2418
+ [_types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.EoaRepay]: parseMorphoBlueLeverageManagement,
2419
+ [_types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.EoaBoost]: parseMorphoBlueLeverageManagement
2381
2420
  }
2382
2421
  };
2383
2422
  function getParsingMethod(id, strategy) {
@@ -19919,10 +19958,10 @@ var cBondsRebondSubData = {
19919
19958
  }
19920
19959
  };
19921
19960
  var liquityPaybackUsingChickenBondSubData = {
19922
- /**
19923
- * @param sourceId bondId or subId
19924
- * @param sourceType 0 for bond, 1 for subId
19925
- * @param chainId
19961
+ /**
19962
+ * @param sourceId bondId or subId
19963
+ * @param sourceType 0 for bond, 1 for subId
19964
+ * @param chainId
19926
19965
  */
19927
19966
  encode: function encode(sourceId, sourceType) {
19928
19967
  var chainId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _types_enums__WEBPACK_IMPORTED_MODULE_5__.ChainId.Ethereum;
@@ -20109,7 +20148,7 @@ var crvUSDPaybackSubData = {
20109
20148
  }
20110
20149
  };
20111
20150
  var morphoBlueLeverageManagementSubData = {
20112
- encode: (loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, user) => {
20151
+ encode: (loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, user, isEOA) => {
20113
20152
  var loanTokenEncoded = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().encodeParameter('address', loanToken);
20114
20153
  var collTokenEncoded = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().encodeParameter('address', collToken);
20115
20154
  var oracleEncoded = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().encodeParameter('address', oracle);
@@ -20118,7 +20157,7 @@ var morphoBlueLeverageManagementSubData = {
20118
20157
  var ratioStateEncoded = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().encodeParameter('uint8', ratioState);
20119
20158
  var targetRatioEncoded = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().encodeParameter('uint256', (0,_utils__WEBPACK_IMPORTED_MODULE_7__.ratioPercentageToWei)(targetRatio));
20120
20159
  var userEncoded = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().encodeParameter('address', user);
20121
- return [loanTokenEncoded, collTokenEncoded, oracleEncoded, irmEncoded, lltvEncoded, ratioStateEncoded, targetRatioEncoded, userEncoded];
20160
+ return [loanTokenEncoded, collTokenEncoded, oracleEncoded, irmEncoded, lltvEncoded, ratioStateEncoded, targetRatioEncoded, userEncoded, isEOA];
20122
20161
  },
20123
20162
  decode: subData => {
20124
20163
  var loanToken = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().decodeParameter('address', subData[0]);
@@ -33903,12 +33942,14 @@ var crvUSDEncode = {
33903
33942
  }
33904
33943
  };
33905
33944
  var morphoBlueEncode = {
33906
- leverageManagement(marketId, loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, triggerRatio, user) {
33907
- var subData = _subDataService__WEBPACK_IMPORTED_MODULE_4__.morphoBlueLeverageManagementSubData.encode(loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, user);
33945
+ leverageManagement(marketId, loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, triggerRatio, user, isEOA) {
33946
+ var subData = _subDataService__WEBPACK_IMPORTED_MODULE_4__.morphoBlueLeverageManagementSubData.encode(loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, user, isEOA);
33908
33947
  var triggerData = _triggerService__WEBPACK_IMPORTED_MODULE_5__.morphoBlueRatioTrigger.encode(marketId, user, triggerRatio, ratioState);
33909
33948
 
33910
33949
  // over is boost, under is repay
33911
- var strategyOrBundleId = ratioState === _types_enums__WEBPACK_IMPORTED_MODULE_2__.RatioState.OVER ? _types_enums__WEBPACK_IMPORTED_MODULE_2__.Bundles.MainnetIds.MORPHO_BLUE_BOOST : _types_enums__WEBPACK_IMPORTED_MODULE_2__.Bundles.MainnetIds.MORPHO_BLUE_REPAY;
33950
+ var isBoost = ratioState === _types_enums__WEBPACK_IMPORTED_MODULE_2__.RatioState.OVER;
33951
+ var strategyOrBundleId;
33952
+ if (isBoost) strategyOrBundleId = isEOA ? _types_enums__WEBPACK_IMPORTED_MODULE_2__.Bundles.MainnetIds.MORPHO_BLUE_EOA_BOOST : _types_enums__WEBPACK_IMPORTED_MODULE_2__.Bundles.MainnetIds.MORPHO_BLUE_BOOST;else strategyOrBundleId = isEOA ? _types_enums__WEBPACK_IMPORTED_MODULE_2__.Bundles.MainnetIds.MORPHO_BLUE_EOA_REPAY : _types_enums__WEBPACK_IMPORTED_MODULE_2__.Bundles.MainnetIds.MORPHO_BLUE_REPAY;
33912
33953
  var isBundle = true;
33913
33954
  return [strategyOrBundleId, isBundle, triggerData, subData];
33914
33955
  }
package/webpack.umd.js CHANGED
@@ -1,52 +1,52 @@
1
- const path = require('path');
2
-
3
- module.exports = {
4
- mode: "none",
5
- entry: './src/index.ts',
6
- target: 'node',
7
- output: {
8
- library: 'defisaver-sdk',
9
- libraryTarget: 'umd',
10
- path: path.resolve(__dirname, 'umd'),
11
- filename: 'index.js',
12
- globalObject: 'this'
13
- },
14
- module: {
15
- rules: [
16
- {
17
- test: /\.[tj]s$/,
18
- exclude: /node_modules/,
19
- use: {
20
- loader: "babel-loader",
21
- options: {
22
- presets: [
23
- '@babel/preset-typescript',
24
- [
25
- "@babel/preset-env",
26
- {
27
- "targets": {
28
- "esmodules": true
29
- }
30
- },
31
- ],
32
- ]
33
- }
34
- }
35
- },
36
- ]
37
- },
38
- externals: [
39
- "decimal.js",
40
- 'web3',
41
- "web3-eth-abi",
42
- "web3-utils",
43
- "@defisaver/tokens",
44
- "@ethersproject/address",
45
- "@ethersproject/solidity",
46
- "@types/web3-eth-abi",
47
- '@types/web3',
48
- "axios"],
49
- resolve: {
50
- extensions: ['.ts', '.js'],
51
- },
52
- };
1
+ const path = require('path');
2
+
3
+ module.exports = {
4
+ mode: "none",
5
+ entry: './src/index.ts',
6
+ target: 'node',
7
+ output: {
8
+ library: 'defisaver-sdk',
9
+ libraryTarget: 'umd',
10
+ path: path.resolve(__dirname, 'umd'),
11
+ filename: 'index.js',
12
+ globalObject: 'this'
13
+ },
14
+ module: {
15
+ rules: [
16
+ {
17
+ test: /\.[tj]s$/,
18
+ exclude: /node_modules/,
19
+ use: {
20
+ loader: "babel-loader",
21
+ options: {
22
+ presets: [
23
+ '@babel/preset-typescript',
24
+ [
25
+ "@babel/preset-env",
26
+ {
27
+ "targets": {
28
+ "esmodules": true
29
+ }
30
+ },
31
+ ],
32
+ ]
33
+ }
34
+ }
35
+ },
36
+ ]
37
+ },
38
+ externals: [
39
+ "decimal.js",
40
+ 'web3',
41
+ "web3-eth-abi",
42
+ "web3-utils",
43
+ "@defisaver/tokens",
44
+ "@ethersproject/address",
45
+ "@ethersproject/solidity",
46
+ "@types/web3-eth-abi",
47
+ '@types/web3',
48
+ "axios"],
49
+ resolve: {
50
+ extensions: ['.ts', '.js'],
51
+ },
52
+ };