@obolnetwork/obol-sdk 2.0.1 → 2.1.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 (49) hide show
  1. package/README.md +6 -0
  2. package/dist/cjs/package.json +1 -1
  3. package/dist/cjs/src/abi/Multicall.js +148 -0
  4. package/dist/cjs/src/abi/OWR.js +304 -0
  5. package/dist/cjs/src/abi/SplitMain.js +929 -0
  6. package/dist/cjs/src/ajv.js +17 -2
  7. package/dist/cjs/src/bytecodes.js +9 -0
  8. package/dist/cjs/src/constants.js +48 -1
  9. package/dist/cjs/src/index.js +166 -0
  10. package/dist/cjs/src/schema.js +52 -5
  11. package/dist/cjs/src/splitHelpers.js +187 -0
  12. package/dist/cjs/src/utils.js +22 -1
  13. package/dist/cjs/test/fixtures.js +1 -1
  14. package/dist/cjs/test/methods.test.js +215 -11
  15. package/dist/esm/package.json +1 -1
  16. package/dist/esm/src/abi/Multicall.js +145 -0
  17. package/dist/esm/src/abi/OWR.js +301 -0
  18. package/dist/esm/src/abi/SplitMain.js +926 -0
  19. package/dist/esm/src/ajv.js +17 -2
  20. package/dist/esm/src/bytecodes.js +6 -0
  21. package/dist/esm/src/constants.js +47 -0
  22. package/dist/esm/src/index.js +168 -2
  23. package/dist/esm/src/schema.js +51 -4
  24. package/dist/esm/src/splitHelpers.js +177 -0
  25. package/dist/esm/src/utils.js +19 -0
  26. package/dist/esm/test/fixtures.js +1 -1
  27. package/dist/esm/test/methods.test.js +193 -12
  28. package/dist/types/src/abi/Multicall.d.ts +35 -0
  29. package/dist/types/src/abi/OWR.d.ts +96 -0
  30. package/dist/types/src/abi/SplitMain.d.ts +1159 -0
  31. package/dist/types/src/bytecodes.d.ts +6 -0
  32. package/dist/types/src/constants.d.ts +25 -0
  33. package/dist/types/src/index.d.ts +41 -1
  34. package/dist/types/src/schema.d.ts +85 -4
  35. package/dist/types/src/splitHelpers.d.ts +66 -0
  36. package/dist/types/src/types.d.ts +50 -2
  37. package/dist/types/src/utils.d.ts +3 -0
  38. package/package.json +1 -1
  39. package/src/abi/Multicall.ts +145 -0
  40. package/src/abi/OWR.ts +302 -0
  41. package/src/abi/SplitMain.ts +927 -0
  42. package/src/ajv.ts +33 -2
  43. package/src/bytecodes.ts +12 -0
  44. package/src/constants.ts +59 -0
  45. package/src/index.ts +267 -2
  46. package/src/schema.ts +67 -4
  47. package/src/splitHelpers.ts +360 -0
  48. package/src/types.ts +63 -2
  49. package/src/utils.ts +21 -0
package/README.md CHANGED
@@ -11,6 +11,12 @@ Checkout our [docs](https://docs.obol.org/docs/advanced/quickstart-sdk), [exampl
11
11
  ## Terms and Conditions
12
12
  To use obol-sdk and in order to be able to create a cluster definition or accept an invite to join a cluster, you must accept the [latest Obol terms and conditions](https://obol.org/terms.pdf) by calling acceptObolLatestTermsAndConditions.
13
13
 
14
+ ## ⚠️ Important Security Notice:
15
+ If you're integrating this SDK with a **backend** (e.g., in Node.js), and you store a private key for executing splitter transactions, handle it with extreme caution. Ensure that:
16
+
17
+ - The private key is securely stored (e.g., in an `.env` file).
18
+ - Never commit or push your `.env` file containing the private key to version control.
19
+
14
20
  ## Contributing
15
21
 
16
22
  Please review the following guidelines:
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-sdk",
3
- "version": "2.0.1",
3
+ "version": "2.1.1",
4
4
  "description": "A package for creating Distributed Validators using the Obol API.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/obolnetwork/obol-sdk/issues"
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MultiCallContract = void 0;
4
+ exports.MultiCallContract = {
5
+ abi: [
6
+ {
7
+ constant: true,
8
+ inputs: [],
9
+ name: 'getCurrentBlockTimestamp',
10
+ outputs: [
11
+ {
12
+ name: 'timestamp',
13
+ type: 'uint256',
14
+ },
15
+ ],
16
+ payable: false,
17
+ stateMutability: 'view',
18
+ type: 'function',
19
+ },
20
+ {
21
+ constant: false,
22
+ inputs: [
23
+ {
24
+ components: [
25
+ {
26
+ name: 'target',
27
+ type: 'address',
28
+ },
29
+ {
30
+ name: 'callData',
31
+ type: 'bytes',
32
+ },
33
+ ],
34
+ name: 'calls',
35
+ type: 'tuple[]',
36
+ },
37
+ ],
38
+ name: 'aggregate',
39
+ outputs: [
40
+ {
41
+ name: 'blockNumber',
42
+ type: 'uint256',
43
+ },
44
+ {
45
+ name: 'returnData',
46
+ type: 'bytes[]',
47
+ },
48
+ ],
49
+ payable: false,
50
+ stateMutability: 'nonpayable',
51
+ type: 'function',
52
+ },
53
+ {
54
+ constant: true,
55
+ inputs: [],
56
+ name: 'getLastBlockHash',
57
+ outputs: [
58
+ {
59
+ name: 'blockHash',
60
+ type: 'bytes32',
61
+ },
62
+ ],
63
+ payable: false,
64
+ stateMutability: 'view',
65
+ type: 'function',
66
+ },
67
+ {
68
+ constant: true,
69
+ inputs: [
70
+ {
71
+ name: 'addr',
72
+ type: 'address',
73
+ },
74
+ ],
75
+ name: 'getEthBalance',
76
+ outputs: [
77
+ {
78
+ name: 'balance',
79
+ type: 'uint256',
80
+ },
81
+ ],
82
+ payable: false,
83
+ stateMutability: 'view',
84
+ type: 'function',
85
+ },
86
+ {
87
+ constant: true,
88
+ inputs: [],
89
+ name: 'getCurrentBlockDifficulty',
90
+ outputs: [
91
+ {
92
+ name: 'difficulty',
93
+ type: 'uint256',
94
+ },
95
+ ],
96
+ payable: false,
97
+ stateMutability: 'view',
98
+ type: 'function',
99
+ },
100
+ {
101
+ constant: true,
102
+ inputs: [],
103
+ name: 'getCurrentBlockGasLimit',
104
+ outputs: [
105
+ {
106
+ name: 'gaslimit',
107
+ type: 'uint256',
108
+ },
109
+ ],
110
+ payable: false,
111
+ stateMutability: 'view',
112
+ type: 'function',
113
+ },
114
+ {
115
+ constant: true,
116
+ inputs: [],
117
+ name: 'getCurrentBlockCoinbase',
118
+ outputs: [
119
+ {
120
+ name: 'coinbase',
121
+ type: 'address',
122
+ },
123
+ ],
124
+ payable: false,
125
+ stateMutability: 'view',
126
+ type: 'function',
127
+ },
128
+ {
129
+ constant: true,
130
+ inputs: [
131
+ {
132
+ name: 'blockNumber',
133
+ type: 'uint256',
134
+ },
135
+ ],
136
+ name: 'getBlockHash',
137
+ outputs: [
138
+ {
139
+ name: 'blockHash',
140
+ type: 'bytes32',
141
+ },
142
+ ],
143
+ payable: false,
144
+ stateMutability: 'view',
145
+ type: 'function',
146
+ },
147
+ ],
148
+ };
@@ -0,0 +1,304 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OWRContract = exports.OWRFactoryContract = void 0;
4
+ exports.OWRFactoryContract = {
5
+ abi: [
6
+ {
7
+ inputs: [
8
+ {
9
+ internalType: 'string',
10
+ name: '_ensName',
11
+ type: 'string',
12
+ },
13
+ {
14
+ internalType: 'address',
15
+ name: '_ensReverseRegistrar',
16
+ type: 'address',
17
+ },
18
+ {
19
+ internalType: 'address',
20
+ name: '_ensOwner',
21
+ type: 'address',
22
+ },
23
+ ],
24
+ stateMutability: 'nonpayable',
25
+ type: 'constructor',
26
+ },
27
+ {
28
+ inputs: [],
29
+ name: 'Invalid__Recipients',
30
+ type: 'error',
31
+ },
32
+ {
33
+ inputs: [
34
+ {
35
+ internalType: 'uint256',
36
+ name: 'threshold',
37
+ type: 'uint256',
38
+ },
39
+ ],
40
+ name: 'Invalid__ThresholdTooLarge',
41
+ type: 'error',
42
+ },
43
+ {
44
+ inputs: [],
45
+ name: 'Invalid__ZeroThreshold',
46
+ type: 'error',
47
+ },
48
+ {
49
+ anonymous: false,
50
+ inputs: [
51
+ {
52
+ indexed: true,
53
+ internalType: 'address',
54
+ name: 'owr',
55
+ type: 'address',
56
+ },
57
+ {
58
+ indexed: false,
59
+ internalType: 'address',
60
+ name: 'recoveryAddress',
61
+ type: 'address',
62
+ },
63
+ {
64
+ indexed: false,
65
+ internalType: 'address',
66
+ name: 'principalRecipient',
67
+ type: 'address',
68
+ },
69
+ {
70
+ indexed: false,
71
+ internalType: 'address',
72
+ name: 'rewardRecipient',
73
+ type: 'address',
74
+ },
75
+ {
76
+ indexed: false,
77
+ internalType: 'uint256',
78
+ name: 'threshold',
79
+ type: 'uint256',
80
+ },
81
+ ],
82
+ name: 'CreateOWRecipient',
83
+ type: 'event',
84
+ },
85
+ {
86
+ inputs: [
87
+ {
88
+ internalType: 'address',
89
+ name: 'recoveryAddress',
90
+ type: 'address',
91
+ },
92
+ {
93
+ internalType: 'address',
94
+ name: 'principalRecipient',
95
+ type: 'address',
96
+ },
97
+ {
98
+ internalType: 'address',
99
+ name: 'rewardRecipient',
100
+ type: 'address',
101
+ },
102
+ {
103
+ internalType: 'uint256',
104
+ name: 'amountOfPrincipalStake',
105
+ type: 'uint256',
106
+ },
107
+ ],
108
+ name: 'createOWRecipient',
109
+ outputs: [
110
+ {
111
+ internalType: 'contract OptimisticWithdrawalRecipient',
112
+ name: 'owr',
113
+ type: 'address',
114
+ },
115
+ ],
116
+ stateMutability: 'nonpayable',
117
+ type: 'function',
118
+ },
119
+ {
120
+ inputs: [],
121
+ name: 'owrImpl',
122
+ outputs: [
123
+ {
124
+ internalType: 'contract OptimisticWithdrawalRecipient',
125
+ name: '',
126
+ type: 'address',
127
+ },
128
+ ],
129
+ stateMutability: 'view',
130
+ type: 'function',
131
+ },
132
+ ],
133
+ };
134
+ exports.OWRContract = {
135
+ abi: [
136
+ { inputs: [], stateMutability: 'nonpayable', type: 'constructor' },
137
+ { inputs: [], name: 'InvalidDistribution_TooLarge', type: 'error' },
138
+ {
139
+ inputs: [],
140
+ name: 'InvalidTokenRecovery_InvalidRecipient',
141
+ type: 'error',
142
+ },
143
+ {
144
+ anonymous: false,
145
+ inputs: [
146
+ {
147
+ indexed: false,
148
+ internalType: 'uint256',
149
+ name: 'principalPayout',
150
+ type: 'uint256',
151
+ },
152
+ {
153
+ indexed: false,
154
+ internalType: 'uint256',
155
+ name: 'rewardPayout',
156
+ type: 'uint256',
157
+ },
158
+ {
159
+ indexed: false,
160
+ internalType: 'uint256',
161
+ name: 'pullFlowFlag',
162
+ type: 'uint256',
163
+ },
164
+ ],
165
+ name: 'DistributeFunds',
166
+ type: 'event',
167
+ },
168
+ {
169
+ anonymous: false,
170
+ inputs: [
171
+ {
172
+ indexed: false,
173
+ internalType: 'uint256',
174
+ name: 'amount',
175
+ type: 'uint256',
176
+ },
177
+ ],
178
+ name: 'ReceiveETH',
179
+ type: 'event',
180
+ },
181
+ {
182
+ anonymous: false,
183
+ inputs: [
184
+ {
185
+ indexed: false,
186
+ internalType: 'address',
187
+ name: 'recoveryAddressToken',
188
+ type: 'address',
189
+ },
190
+ {
191
+ indexed: false,
192
+ internalType: 'address',
193
+ name: 'recipient',
194
+ type: 'address',
195
+ },
196
+ {
197
+ indexed: false,
198
+ internalType: 'uint256',
199
+ name: 'amount',
200
+ type: 'uint256',
201
+ },
202
+ ],
203
+ name: 'RecoverNonOWRecipientFunds',
204
+ type: 'event',
205
+ },
206
+ {
207
+ anonymous: false,
208
+ inputs: [
209
+ {
210
+ indexed: false,
211
+ internalType: 'address',
212
+ name: 'account',
213
+ type: 'address',
214
+ },
215
+ {
216
+ indexed: false,
217
+ internalType: 'uint256',
218
+ name: 'amount',
219
+ type: 'uint256',
220
+ },
221
+ ],
222
+ name: 'Withdrawal',
223
+ type: 'event',
224
+ },
225
+ {
226
+ inputs: [],
227
+ name: 'claimedPrincipalFunds',
228
+ outputs: [{ internalType: 'uint128', name: '', type: 'uint128' }],
229
+ stateMutability: 'view',
230
+ type: 'function',
231
+ },
232
+ {
233
+ inputs: [],
234
+ name: 'distributeFunds',
235
+ outputs: [],
236
+ stateMutability: 'payable',
237
+ type: 'function',
238
+ },
239
+ {
240
+ inputs: [],
241
+ name: 'distributeFundsPull',
242
+ outputs: [],
243
+ stateMutability: 'payable',
244
+ type: 'function',
245
+ },
246
+ {
247
+ inputs: [],
248
+ name: 'fundsPendingWithdrawal',
249
+ outputs: [{ internalType: 'uint128', name: '', type: 'uint128' }],
250
+ stateMutability: 'view',
251
+ type: 'function',
252
+ },
253
+ {
254
+ inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
255
+ name: 'getPullBalance',
256
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
257
+ stateMutability: 'view',
258
+ type: 'function',
259
+ },
260
+ {
261
+ inputs: [],
262
+ name: 'getTranches',
263
+ outputs: [
264
+ {
265
+ internalType: 'address',
266
+ name: 'principalRecipient',
267
+ type: 'address',
268
+ },
269
+ { internalType: 'address', name: 'rewardRecipient', type: 'address' },
270
+ {
271
+ internalType: 'uint256',
272
+ name: 'amountOfPrincipalStake',
273
+ type: 'uint256',
274
+ },
275
+ ],
276
+ stateMutability: 'pure',
277
+ type: 'function',
278
+ },
279
+ {
280
+ inputs: [
281
+ { internalType: 'address', name: 'nonOWRToken', type: 'address' },
282
+ { internalType: 'address', name: 'recipient', type: 'address' },
283
+ ],
284
+ name: 'recoverFunds',
285
+ outputs: [],
286
+ stateMutability: 'payable',
287
+ type: 'function',
288
+ },
289
+ {
290
+ inputs: [],
291
+ name: 'recoveryAddress',
292
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
293
+ stateMutability: 'pure',
294
+ type: 'function',
295
+ },
296
+ {
297
+ inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
298
+ name: 'withdraw',
299
+ outputs: [],
300
+ stateMutability: 'nonpayable',
301
+ type: 'function',
302
+ },
303
+ ],
304
+ };