@defisaver/automation-sdk 1.0.1

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 (123) hide show
  1. package/.babelrc +3 -0
  2. package/.editorconfig +9 -0
  3. package/.eslintignore +7 -0
  4. package/.eslintrc.js +104 -0
  5. package/esm/abis/Erc20.json +223 -0
  6. package/esm/abis/SubStorage.json +17 -0
  7. package/esm/abis/UniMulticall.json +14 -0
  8. package/esm/abis/index.d.ts +9 -0
  9. package/esm/abis/index.js +18 -0
  10. package/esm/abis/legacy_AaveV2Subscriptions.json +8 -0
  11. package/esm/abis/legacy_AuthCheck.json +8 -0
  12. package/esm/abis/legacy_CompoundV2Subscriptions.json +9 -0
  13. package/esm/abis/legacy_MakerSubscriptions.json +9 -0
  14. package/esm/automation/private/Automation.d.ts +12 -0
  15. package/esm/automation/private/Automation.js +39 -0
  16. package/esm/automation/private/LegacyAutomation.d.ts +25 -0
  17. package/esm/automation/private/LegacyAutomation.js +102 -0
  18. package/esm/automation/private/LegacyProtocol.d.ts +20 -0
  19. package/esm/automation/private/LegacyProtocol.js +34 -0
  20. package/esm/automation/private/Protocol.d.ts +20 -0
  21. package/esm/automation/private/Protocol.js +34 -0
  22. package/esm/automation/private/StrategiesAutomation.d.ts +24 -0
  23. package/esm/automation/private/StrategiesAutomation.js +111 -0
  24. package/esm/automation/public/ArbitrumStrategies.d.ts +5 -0
  25. package/esm/automation/public/ArbitrumStrategies.js +7 -0
  26. package/esm/automation/public/EthereumStrategies.d.ts +5 -0
  27. package/esm/automation/public/EthereumStrategies.js +7 -0
  28. package/esm/automation/public/OptimismStrategies.d.ts +5 -0
  29. package/esm/automation/public/OptimismStrategies.js +7 -0
  30. package/esm/automation/public/legacy/LegacyAaveAutomation.d.ts +6 -0
  31. package/esm/automation/public/legacy/LegacyAaveAutomation.js +14 -0
  32. package/esm/automation/public/legacy/LegacyCompoundAutomation.d.ts +6 -0
  33. package/esm/automation/public/legacy/LegacyCompoundAutomation.js +14 -0
  34. package/esm/automation/public/legacy/LegacyMakerAutomation.d.ts +6 -0
  35. package/esm/automation/public/legacy/LegacyMakerAutomation.js +14 -0
  36. package/esm/configuration.d.ts +1 -0
  37. package/esm/configuration.js +9 -0
  38. package/esm/constants/index.d.ts +23 -0
  39. package/esm/constants/index.js +153 -0
  40. package/esm/index.d.ts +20 -0
  41. package/esm/index.js +22 -0
  42. package/esm/services/contractService.d.ts +11 -0
  43. package/esm/services/contractService.js +40 -0
  44. package/esm/services/ethereumService.d.ts +7 -0
  45. package/esm/services/ethereumService.js +34 -0
  46. package/esm/services/strategiesService.d.ts +2 -0
  47. package/esm/services/strategiesService.js +244 -0
  48. package/esm/services/strategySubService.d.ts +32 -0
  49. package/esm/services/strategySubService.js +91 -0
  50. package/esm/services/subDataService.d.ts +62 -0
  51. package/esm/services/subDataService.js +148 -0
  52. package/esm/services/triggerService.d.ts +89 -0
  53. package/esm/services/triggerService.js +141 -0
  54. package/esm/services/utils.d.ts +24 -0
  55. package/esm/services/utils.js +78 -0
  56. package/esm/types/contracts/generated/Erc20.d.ts +53 -0
  57. package/esm/types/contracts/generated/Erc20.js +4 -0
  58. package/esm/types/contracts/generated/Legacy_AaveV2Subscriptions.d.ts +129 -0
  59. package/esm/types/contracts/generated/Legacy_AaveV2Subscriptions.js +4 -0
  60. package/esm/types/contracts/generated/Legacy_AuthCheck.d.ts +20 -0
  61. package/esm/types/contracts/generated/Legacy_AuthCheck.js +4 -0
  62. package/esm/types/contracts/generated/Legacy_CompoundV2Subscriptions.d.ts +128 -0
  63. package/esm/types/contracts/generated/Legacy_CompoundV2Subscriptions.js +4 -0
  64. package/esm/types/contracts/generated/Legacy_MakerSubscriptions.d.ts +246 -0
  65. package/esm/types/contracts/generated/Legacy_MakerSubscriptions.js +4 -0
  66. package/esm/types/contracts/generated/SubStorage.d.ts +114 -0
  67. package/esm/types/contracts/generated/SubStorage.js +4 -0
  68. package/esm/types/contracts/generated/UniMulticall.d.ts +55 -0
  69. package/esm/types/contracts/generated/UniMulticall.js +4 -0
  70. package/esm/types/contracts/generated/index.d.ts +7 -0
  71. package/esm/types/contracts/generated/index.js +1 -0
  72. package/esm/types/contracts/generated/types.d.ts +54 -0
  73. package/esm/types/contracts/generated/types.js +1 -0
  74. package/esm/types/enums.d.ts +97 -0
  75. package/esm/types/enums.js +113 -0
  76. package/esm/types/index.d.ts +180 -0
  77. package/esm/types/index.js +1 -0
  78. package/package.json +66 -0
  79. package/scripts/generateContractTypes.js +39 -0
  80. package/src/abis/Erc20.json +223 -0
  81. package/src/abis/SubStorage.json +17 -0
  82. package/src/abis/UniMulticall.json +14 -0
  83. package/src/abis/index.ts +28 -0
  84. package/src/abis/legacy_AaveV2Subscriptions.json +8 -0
  85. package/src/abis/legacy_AuthCheck.json +8 -0
  86. package/src/abis/legacy_CompoundV2Subscriptions.json +9 -0
  87. package/src/abis/legacy_MakerSubscriptions.json +9 -0
  88. package/src/automation/private/Automation.ts +44 -0
  89. package/src/automation/private/LegacyAutomation.ts +124 -0
  90. package/src/automation/private/LegacyProtocol.ts +45 -0
  91. package/src/automation/private/Protocol.ts +45 -0
  92. package/src/automation/private/StrategiesAutomation.ts +157 -0
  93. package/src/automation/public/ArbitrumStrategies.ts +10 -0
  94. package/src/automation/public/EthereumStrategies.ts +10 -0
  95. package/src/automation/public/OptimismStrategies.ts +10 -0
  96. package/src/automation/public/legacy/LegacyAaveAutomation.ts +20 -0
  97. package/src/automation/public/legacy/LegacyCompoundAutomation.ts +20 -0
  98. package/src/automation/public/legacy/LegacyMakerAutomation.ts +20 -0
  99. package/src/configuration.ts +11 -0
  100. package/src/constants/index.ts +173 -0
  101. package/src/index.ts +38 -0
  102. package/src/services/contractService.ts +65 -0
  103. package/src/services/ethereumService.ts +55 -0
  104. package/src/services/strategiesService.ts +336 -0
  105. package/src/services/strategySubService.ts +202 -0
  106. package/src/services/subDataService.ts +212 -0
  107. package/src/services/triggerService.ts +173 -0
  108. package/src/services/utils.ts +101 -0
  109. package/src/types/contracts/generated/Erc20.ts +95 -0
  110. package/src/types/contracts/generated/Legacy_AaveV2Subscriptions.ts +207 -0
  111. package/src/types/contracts/generated/Legacy_AuthCheck.ts +41 -0
  112. package/src/types/contracts/generated/Legacy_CompoundV2Subscriptions.ts +205 -0
  113. package/src/types/contracts/generated/Legacy_MakerSubscriptions.ts +338 -0
  114. package/src/types/contracts/generated/SubStorage.ts +196 -0
  115. package/src/types/contracts/generated/UniMulticall.ts +83 -0
  116. package/src/types/contracts/generated/index.ts +10 -0
  117. package/src/types/contracts/generated/types.ts +73 -0
  118. package/src/types/enums.ts +108 -0
  119. package/src/types/index.ts +217 -0
  120. package/src/types/typings/process.d.ts +9 -0
  121. package/tsconfig.json +79 -0
  122. package/umd/web3.d.ts +28961 -0
  123. package/webpack.umd.js +52 -0
@@ -0,0 +1,207 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ import type BN from "bn.js";
6
+ import type { ContractOptions } from "web3-eth-contract";
7
+ import type { EventLog } from "web3-core";
8
+ import type { EventEmitter } from "events";
9
+ import type {
10
+ Callback,
11
+ PayableTransactionObject,
12
+ NonPayableTransactionObject,
13
+ BlockType,
14
+ ContractEventLog,
15
+ BaseContract,
16
+ } from "./types";
17
+
18
+ export interface EventOptions {
19
+ filter?: object;
20
+ fromBlock?: BlockType;
21
+ topics?: string[];
22
+ }
23
+
24
+ export declare namespace AaveSubscriptionsV2 {
25
+ export type AaveHolderStruct =
26
+ | [
27
+ string,
28
+ number | string | BN,
29
+ number | string | BN,
30
+ number | string | BN,
31
+ number | string | BN,
32
+ boolean
33
+ ]
34
+ | {
35
+ user: string;
36
+ minRatio: number | string | BN;
37
+ maxRatio: number | string | BN;
38
+ optimalRatioBoost: number | string | BN;
39
+ optimalRatioRepay: number | string | BN;
40
+ boostEnabled: boolean;
41
+ };
42
+
43
+ export type AaveHolderStructOutputArray = [
44
+ string,
45
+ string,
46
+ string,
47
+ string,
48
+ string,
49
+ boolean
50
+ ];
51
+ export type AaveHolderStructOutputStruct = {
52
+ user: string;
53
+ minRatio: string;
54
+ maxRatio: string;
55
+ optimalRatioBoost: string;
56
+ optimalRatioRepay: string;
57
+ boostEnabled: boolean;
58
+ };
59
+ export type AaveHolderStructOutput = AaveHolderStructOutputArray &
60
+ AaveHolderStructOutputStruct;
61
+ }
62
+
63
+ export type ParamUpdates = ContractEventLog<{
64
+ user: string;
65
+ 0: string;
66
+ 1: string;
67
+ 2: string;
68
+ 3: string;
69
+ 4: string;
70
+ 5: boolean;
71
+ }>;
72
+ export type Subscribed = ContractEventLog<{
73
+ user: string;
74
+ 0: string;
75
+ }>;
76
+ export type Unsubscribed = ContractEventLog<{
77
+ user: string;
78
+ 0: string;
79
+ }>;
80
+ export type Updated = ContractEventLog<{
81
+ user: string;
82
+ 0: string;
83
+ }>;
84
+
85
+ export interface Legacy_AaveV2Subscriptions extends BaseContract {
86
+ constructor(
87
+ jsonInterface: any[],
88
+ address?: string,
89
+ options?: ContractOptions
90
+ ): Legacy_AaveV2Subscriptions;
91
+ clone(): Legacy_AaveV2Subscriptions;
92
+ methods: {
93
+ NAME(): NonPayableTransactionObject<string>;
94
+
95
+ admin(): NonPayableTransactionObject<string>;
96
+
97
+ changeIndex(): NonPayableTransactionObject<string>;
98
+
99
+ getHolder(
100
+ _user: string
101
+ ): NonPayableTransactionObject<AaveSubscriptionsV2.AaveHolderStructOutput>;
102
+
103
+ getSubscribers(): NonPayableTransactionObject<
104
+ AaveSubscriptionsV2.AaveHolderStructOutput[]
105
+ >;
106
+
107
+ getSubscribersByPage(
108
+ _page: number | string | BN,
109
+ _perPage: number | string | BN
110
+ ): NonPayableTransactionObject<
111
+ AaveSubscriptionsV2.AaveHolderStructOutput[]
112
+ >;
113
+
114
+ isSubscribed(_user: string): NonPayableTransactionObject<boolean>;
115
+
116
+ kill(): NonPayableTransactionObject<void>;
117
+
118
+ owner(): NonPayableTransactionObject<string>;
119
+
120
+ setAdminByAdmin(_admin: string): NonPayableTransactionObject<void>;
121
+
122
+ setAdminByOwner(_admin: string): NonPayableTransactionObject<void>;
123
+
124
+ setOwnerByAdmin(_owner: string): NonPayableTransactionObject<void>;
125
+
126
+ subscribe(
127
+ _minRatio: number | string | BN,
128
+ _maxRatio: number | string | BN,
129
+ _optimalBoost: number | string | BN,
130
+ _optimalRepay: number | string | BN,
131
+ _boostEnabled: boolean
132
+ ): NonPayableTransactionObject<void>;
133
+
134
+ subscribers(
135
+ arg0: number | string | BN
136
+ ): NonPayableTransactionObject<
137
+ [string, string, string, string, string, boolean] & {
138
+ user: string;
139
+ minRatio: string;
140
+ maxRatio: string;
141
+ optimalRatioBoost: string;
142
+ optimalRatioRepay: string;
143
+ boostEnabled: boolean;
144
+ }
145
+ >;
146
+
147
+ subscribersPos(
148
+ arg0: string
149
+ ): NonPayableTransactionObject<
150
+ [string, boolean] & { arrPos: string; subscribed: boolean }
151
+ >;
152
+
153
+ unsubscribe(): NonPayableTransactionObject<void>;
154
+
155
+ unsubscribeByAdmin(_user: string): NonPayableTransactionObject<void>;
156
+
157
+ withdrawStuckFunds(
158
+ _token: string,
159
+ _amount: number | string | BN
160
+ ): NonPayableTransactionObject<void>;
161
+ };
162
+ events: {
163
+ ParamUpdates(cb?: Callback<ParamUpdates>): EventEmitter;
164
+ ParamUpdates(
165
+ options?: EventOptions,
166
+ cb?: Callback<ParamUpdates>
167
+ ): EventEmitter;
168
+
169
+ Subscribed(cb?: Callback<Subscribed>): EventEmitter;
170
+ Subscribed(options?: EventOptions, cb?: Callback<Subscribed>): EventEmitter;
171
+
172
+ Unsubscribed(cb?: Callback<Unsubscribed>): EventEmitter;
173
+ Unsubscribed(
174
+ options?: EventOptions,
175
+ cb?: Callback<Unsubscribed>
176
+ ): EventEmitter;
177
+
178
+ Updated(cb?: Callback<Updated>): EventEmitter;
179
+ Updated(options?: EventOptions, cb?: Callback<Updated>): EventEmitter;
180
+
181
+ allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
182
+ };
183
+
184
+ once(event: "ParamUpdates", cb: Callback<ParamUpdates>): void;
185
+ once(
186
+ event: "ParamUpdates",
187
+ options: EventOptions,
188
+ cb: Callback<ParamUpdates>
189
+ ): void;
190
+
191
+ once(event: "Subscribed", cb: Callback<Subscribed>): void;
192
+ once(
193
+ event: "Subscribed",
194
+ options: EventOptions,
195
+ cb: Callback<Subscribed>
196
+ ): void;
197
+
198
+ once(event: "Unsubscribed", cb: Callback<Unsubscribed>): void;
199
+ once(
200
+ event: "Unsubscribed",
201
+ options: EventOptions,
202
+ cb: Callback<Unsubscribed>
203
+ ): void;
204
+
205
+ once(event: "Updated", cb: Callback<Updated>): void;
206
+ once(event: "Updated", options: EventOptions, cb: Callback<Updated>): void;
207
+ }
@@ -0,0 +1,41 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ import type BN from "bn.js";
6
+ import type { ContractOptions } from "web3-eth-contract";
7
+ import type { EventLog } from "web3-core";
8
+ import type { EventEmitter } from "events";
9
+ import type {
10
+ Callback,
11
+ PayableTransactionObject,
12
+ NonPayableTransactionObject,
13
+ BlockType,
14
+ ContractEventLog,
15
+ BaseContract,
16
+ } from "./types";
17
+
18
+ export interface EventOptions {
19
+ filter?: object;
20
+ fromBlock?: BlockType;
21
+ topics?: string[];
22
+ }
23
+
24
+ export interface Legacy_AuthCheck extends BaseContract {
25
+ constructor(
26
+ jsonInterface: any[],
27
+ address?: string,
28
+ options?: ContractOptions
29
+ ): Legacy_AuthCheck;
30
+ clone(): Legacy_AuthCheck;
31
+ methods: {
32
+ canCall(
33
+ src: string,
34
+ dst: string,
35
+ sig: string | number[]
36
+ ): NonPayableTransactionObject<boolean>;
37
+ };
38
+ events: {
39
+ allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
40
+ };
41
+ }
@@ -0,0 +1,205 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ import type BN from "bn.js";
6
+ import type { ContractOptions } from "web3-eth-contract";
7
+ import type { EventLog } from "web3-core";
8
+ import type { EventEmitter } from "events";
9
+ import type {
10
+ Callback,
11
+ PayableTransactionObject,
12
+ NonPayableTransactionObject,
13
+ BlockType,
14
+ ContractEventLog,
15
+ BaseContract,
16
+ } from "./types";
17
+
18
+ export interface EventOptions {
19
+ filter?: object;
20
+ fromBlock?: BlockType;
21
+ topics?: string[];
22
+ }
23
+
24
+ export declare namespace CompoundSubscriptions {
25
+ export type CompoundHolderStruct =
26
+ | [
27
+ string,
28
+ number | string | BN,
29
+ number | string | BN,
30
+ number | string | BN,
31
+ number | string | BN,
32
+ boolean
33
+ ]
34
+ | {
35
+ user: string;
36
+ minRatio: number | string | BN;
37
+ maxRatio: number | string | BN;
38
+ optimalRatioBoost: number | string | BN;
39
+ optimalRatioRepay: number | string | BN;
40
+ boostEnabled: boolean;
41
+ };
42
+
43
+ export type CompoundHolderStructOutputArray = [
44
+ string,
45
+ string,
46
+ string,
47
+ string,
48
+ string,
49
+ boolean
50
+ ];
51
+ export type CompoundHolderStructOutputStruct = {
52
+ user: string;
53
+ minRatio: string;
54
+ maxRatio: string;
55
+ optimalRatioBoost: string;
56
+ optimalRatioRepay: string;
57
+ boostEnabled: boolean;
58
+ };
59
+ export type CompoundHolderStructOutput = CompoundHolderStructOutputArray &
60
+ CompoundHolderStructOutputStruct;
61
+ }
62
+
63
+ export type ParamUpdates = ContractEventLog<{
64
+ user: string;
65
+ 0: string;
66
+ 1: string;
67
+ 2: string;
68
+ 3: string;
69
+ 4: string;
70
+ 5: boolean;
71
+ }>;
72
+ export type Subscribed = ContractEventLog<{
73
+ user: string;
74
+ 0: string;
75
+ }>;
76
+ export type Unsubscribed = ContractEventLog<{
77
+ user: string;
78
+ 0: string;
79
+ }>;
80
+ export type Updated = ContractEventLog<{
81
+ user: string;
82
+ 0: string;
83
+ }>;
84
+
85
+ export interface Legacy_CompoundV2Subscriptions extends BaseContract {
86
+ constructor(
87
+ jsonInterface: any[],
88
+ address?: string,
89
+ options?: ContractOptions
90
+ ): Legacy_CompoundV2Subscriptions;
91
+ clone(): Legacy_CompoundV2Subscriptions;
92
+ methods: {
93
+ admin(): NonPayableTransactionObject<string>;
94
+
95
+ changeIndex(): NonPayableTransactionObject<string>;
96
+
97
+ getHolder(
98
+ _user: string
99
+ ): NonPayableTransactionObject<CompoundSubscriptions.CompoundHolderStructOutput>;
100
+
101
+ getSubscribers(): NonPayableTransactionObject<
102
+ CompoundSubscriptions.CompoundHolderStructOutput[]
103
+ >;
104
+
105
+ getSubscribersByPage(
106
+ _page: number | string | BN,
107
+ _perPage: number | string | BN
108
+ ): NonPayableTransactionObject<
109
+ CompoundSubscriptions.CompoundHolderStructOutput[]
110
+ >;
111
+
112
+ isSubscribed(_user: string): NonPayableTransactionObject<boolean>;
113
+
114
+ kill(): NonPayableTransactionObject<void>;
115
+
116
+ owner(): NonPayableTransactionObject<string>;
117
+
118
+ setAdminByAdmin(_admin: string): NonPayableTransactionObject<void>;
119
+
120
+ setAdminByOwner(_admin: string): NonPayableTransactionObject<void>;
121
+
122
+ setOwnerByAdmin(_owner: string): NonPayableTransactionObject<void>;
123
+
124
+ subscribe(
125
+ _minRatio: number | string | BN,
126
+ _maxRatio: number | string | BN,
127
+ _optimalBoost: number | string | BN,
128
+ _optimalRepay: number | string | BN,
129
+ _boostEnabled: boolean
130
+ ): NonPayableTransactionObject<void>;
131
+
132
+ subscribers(
133
+ arg0: number | string | BN
134
+ ): NonPayableTransactionObject<
135
+ [string, string, string, string, string, boolean] & {
136
+ user: string;
137
+ minRatio: string;
138
+ maxRatio: string;
139
+ optimalRatioBoost: string;
140
+ optimalRatioRepay: string;
141
+ boostEnabled: boolean;
142
+ }
143
+ >;
144
+
145
+ subscribersPos(
146
+ arg0: string
147
+ ): NonPayableTransactionObject<
148
+ [string, boolean] & { arrPos: string; subscribed: boolean }
149
+ >;
150
+
151
+ unsubscribe(): NonPayableTransactionObject<void>;
152
+
153
+ unsubscribeByAdmin(_user: string): NonPayableTransactionObject<void>;
154
+
155
+ withdrawStuckFunds(
156
+ _token: string,
157
+ _amount: number | string | BN
158
+ ): NonPayableTransactionObject<void>;
159
+ };
160
+ events: {
161
+ ParamUpdates(cb?: Callback<ParamUpdates>): EventEmitter;
162
+ ParamUpdates(
163
+ options?: EventOptions,
164
+ cb?: Callback<ParamUpdates>
165
+ ): EventEmitter;
166
+
167
+ Subscribed(cb?: Callback<Subscribed>): EventEmitter;
168
+ Subscribed(options?: EventOptions, cb?: Callback<Subscribed>): EventEmitter;
169
+
170
+ Unsubscribed(cb?: Callback<Unsubscribed>): EventEmitter;
171
+ Unsubscribed(
172
+ options?: EventOptions,
173
+ cb?: Callback<Unsubscribed>
174
+ ): EventEmitter;
175
+
176
+ Updated(cb?: Callback<Updated>): EventEmitter;
177
+ Updated(options?: EventOptions, cb?: Callback<Updated>): EventEmitter;
178
+
179
+ allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
180
+ };
181
+
182
+ once(event: "ParamUpdates", cb: Callback<ParamUpdates>): void;
183
+ once(
184
+ event: "ParamUpdates",
185
+ options: EventOptions,
186
+ cb: Callback<ParamUpdates>
187
+ ): void;
188
+
189
+ once(event: "Subscribed", cb: Callback<Subscribed>): void;
190
+ once(
191
+ event: "Subscribed",
192
+ options: EventOptions,
193
+ cb: Callback<Subscribed>
194
+ ): void;
195
+
196
+ once(event: "Unsubscribed", cb: Callback<Unsubscribed>): void;
197
+ once(
198
+ event: "Unsubscribed",
199
+ options: EventOptions,
200
+ cb: Callback<Unsubscribed>
201
+ ): void;
202
+
203
+ once(event: "Updated", cb: Callback<Updated>): void;
204
+ once(event: "Updated", options: EventOptions, cb: Callback<Updated>): void;
205
+ }