@obolnetwork/obol-sdk 2.7.0 → 2.8.0

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 (50) hide show
  1. package/dist/cjs/package.json +4 -2
  2. package/dist/cjs/src/abi/OVMFactory.js +620 -0
  3. package/dist/cjs/src/ajv.js +33 -6
  4. package/dist/cjs/src/bytecodes.js +8 -1
  5. package/dist/cjs/src/constants.js +55 -7
  6. package/dist/cjs/src/index.js +21 -9
  7. package/dist/cjs/src/schema.js +71 -1
  8. package/dist/cjs/src/splits/splitHelpers.js +218 -12
  9. package/dist/cjs/src/splits/splits.js +261 -0
  10. package/dist/cjs/src/types.js +0 -1
  11. package/dist/cjs/test/client/ajv.spec.js +269 -0
  12. package/dist/cjs/test/client/methods.spec.js +418 -0
  13. package/dist/cjs/test/fixtures.js +13 -1
  14. package/dist/cjs/test/splits/splits.spec.js +239 -0
  15. package/dist/esm/package.json +4 -2
  16. package/dist/esm/src/abi/OVMFactory.js +617 -0
  17. package/dist/esm/src/ajv.js +33 -6
  18. package/dist/esm/src/bytecodes.js +7 -0
  19. package/dist/esm/src/constants.js +54 -7
  20. package/dist/esm/src/index.js +20 -9
  21. package/dist/esm/src/schema.js +71 -1
  22. package/dist/esm/src/splits/splitHelpers.js +213 -13
  23. package/dist/esm/src/splits/splits.js +257 -0
  24. package/dist/esm/src/types.js +0 -1
  25. package/dist/esm/test/client/ajv.spec.js +267 -0
  26. package/dist/esm/test/client/methods.spec.js +393 -0
  27. package/dist/esm/test/fixtures.js +12 -0
  28. package/dist/esm/test/splits/splits.spec.js +237 -0
  29. package/dist/types/src/abi/OVMFactory.d.ts +662 -0
  30. package/dist/types/src/bytecodes.d.ts +7 -0
  31. package/dist/types/src/constants.d.ts +10 -21
  32. package/dist/types/src/index.d.ts +7 -0
  33. package/dist/types/src/schema.d.ts +145 -0
  34. package/dist/types/src/splits/splitHelpers.d.ts +40 -1
  35. package/dist/types/src/splits/splits.d.ts +51 -0
  36. package/dist/types/src/types.d.ts +83 -2
  37. package/dist/types/test/client/ajv.spec.d.ts +1 -0
  38. package/dist/types/test/client/methods.spec.d.ts +1 -0
  39. package/dist/types/test/fixtures.d.ts +10 -0
  40. package/dist/types/test/splits/splits.spec.d.ts +1 -0
  41. package/package.json +4 -2
  42. package/src/abi/OVMFactory.ts +617 -0
  43. package/src/ajv.ts +55 -13
  44. package/src/bytecodes.ts +15 -0
  45. package/src/constants.ts +66 -8
  46. package/src/index.ts +36 -15
  47. package/src/schema.ts +80 -0
  48. package/src/splits/splitHelpers.ts +360 -14
  49. package/src/splits/splits.ts +355 -0
  50. package/src/types.ts +96 -3
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-sdk",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
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"
@@ -40,6 +40,7 @@
40
40
  "access": "public"
41
41
  },
42
42
  "dependencies": {
43
+ "@0xsplits/splits-sdk": "^5.1.0",
43
44
  "@chainsafe/bls": "6.0.3",
44
45
  "@chainsafe/blst": "^0.2.9",
45
46
  "@chainsafe/discv5": "^0.5.1",
@@ -63,7 +64,8 @@
63
64
  "pdf-parse": "^1.1.1",
64
65
  "semver": "^7.6.0",
65
66
  "typescript-eslint": "^7.1.0",
66
- "uuid": "^9.0.0"
67
+ "uuid": "^9.0.0",
68
+ "viem": "^2.31.4"
67
69
  },
68
70
  "devDependencies": {
69
71
  "@release-it/conventional-changelog": "^8.0.1",
@@ -0,0 +1,620 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OVMContract = exports.OVMFactoryContract = void 0;
4
+ exports.OVMFactoryContract = {
5
+ abi: [
6
+ {
7
+ inputs: [
8
+ {
9
+ internalType: 'address',
10
+ name: '_consolidationSystemContract',
11
+ type: 'address',
12
+ },
13
+ {
14
+ internalType: 'address',
15
+ name: '_withdrawalSystemContract',
16
+ type: 'address',
17
+ },
18
+ {
19
+ internalType: 'address',
20
+ name: '_depositSystemContract',
21
+ type: 'address',
22
+ },
23
+ ],
24
+ stateMutability: 'nonpayable',
25
+ type: 'constructor',
26
+ },
27
+ { inputs: [], name: 'Invalid_Owner', type: 'error' },
28
+ { inputs: [], name: 'Invalid__Recipients', type: 'error' },
29
+ { inputs: [], name: 'Invalid__ThresholdTooLarge', type: 'error' },
30
+ { inputs: [], name: 'Invalid__ZeroThreshold', type: 'error' },
31
+ {
32
+ anonymous: false,
33
+ inputs: [
34
+ {
35
+ indexed: true,
36
+ internalType: 'address',
37
+ name: 'ovm',
38
+ type: 'address',
39
+ },
40
+ {
41
+ indexed: true,
42
+ internalType: 'address',
43
+ name: 'owner',
44
+ type: 'address',
45
+ },
46
+ {
47
+ indexed: false,
48
+ internalType: 'address',
49
+ name: 'principalRecipient',
50
+ type: 'address',
51
+ },
52
+ {
53
+ indexed: false,
54
+ internalType: 'address',
55
+ name: 'rewardRecipient',
56
+ type: 'address',
57
+ },
58
+ {
59
+ indexed: false,
60
+ internalType: 'uint64',
61
+ name: 'principalThreshold',
62
+ type: 'uint64',
63
+ },
64
+ ],
65
+ name: 'CreateObolValidatorManager',
66
+ type: 'event',
67
+ },
68
+ {
69
+ inputs: [],
70
+ name: 'consolidationSystemContract',
71
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
72
+ stateMutability: 'view',
73
+ type: 'function',
74
+ },
75
+ {
76
+ inputs: [
77
+ { internalType: 'address', name: 'owner', type: 'address' },
78
+ {
79
+ internalType: 'address',
80
+ name: 'principalRecipient',
81
+ type: 'address',
82
+ },
83
+ { internalType: 'address', name: 'rewardRecipient', type: 'address' },
84
+ { internalType: 'uint64', name: 'principalThreshold', type: 'uint64' },
85
+ ],
86
+ name: 'createObolValidatorManager',
87
+ outputs: [
88
+ {
89
+ internalType: 'contract ObolValidatorManager',
90
+ name: 'ovm',
91
+ type: 'address',
92
+ },
93
+ ],
94
+ stateMutability: 'nonpayable',
95
+ type: 'function',
96
+ },
97
+ {
98
+ inputs: [],
99
+ name: 'depositSystemContract',
100
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
101
+ stateMutability: 'view',
102
+ type: 'function',
103
+ },
104
+ {
105
+ inputs: [],
106
+ name: 'withdrawalSystemContract',
107
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
108
+ stateMutability: 'view',
109
+ type: 'function',
110
+ },
111
+ ],
112
+ };
113
+ exports.OVMContract = {
114
+ abi: [
115
+ {
116
+ type: 'constructor',
117
+ inputs: [
118
+ {
119
+ name: '_consolidationSystemContract',
120
+ type: 'address',
121
+ internalType: 'address',
122
+ },
123
+ {
124
+ name: '_withdrawalSystemContract',
125
+ type: 'address',
126
+ internalType: 'address',
127
+ },
128
+ {
129
+ name: '_depositSystemContract',
130
+ type: 'address',
131
+ internalType: 'address',
132
+ },
133
+ { name: '_owner', type: 'address', internalType: 'address' },
134
+ {
135
+ name: '_principalRecipient',
136
+ type: 'address',
137
+ internalType: 'address',
138
+ },
139
+ { name: '_rewardRecipient', type: 'address', internalType: 'address' },
140
+ { name: '_principalThreshold', type: 'uint64', internalType: 'uint64' },
141
+ ],
142
+ stateMutability: 'nonpayable',
143
+ },
144
+ { type: 'receive', stateMutability: 'payable' },
145
+ {
146
+ type: 'function',
147
+ name: 'CONSOLIDATION_ROLE',
148
+ inputs: [],
149
+ outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],
150
+ stateMutability: 'view',
151
+ },
152
+ {
153
+ type: 'function',
154
+ name: 'RECOVER_FUNDS_ROLE',
155
+ inputs: [],
156
+ outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],
157
+ stateMutability: 'view',
158
+ },
159
+ {
160
+ type: 'function',
161
+ name: 'SET_PRINCIPAL_ROLE',
162
+ inputs: [],
163
+ outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],
164
+ stateMutability: 'view',
165
+ },
166
+ {
167
+ type: 'function',
168
+ name: 'WITHDRAWAL_ROLE',
169
+ inputs: [],
170
+ outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],
171
+ stateMutability: 'view',
172
+ },
173
+ {
174
+ type: 'function',
175
+ name: 'amountOfPrincipalStake',
176
+ inputs: [],
177
+ outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],
178
+ stateMutability: 'view',
179
+ },
180
+ {
181
+ type: 'function',
182
+ name: 'cancelOwnershipHandover',
183
+ inputs: [],
184
+ outputs: [],
185
+ stateMutability: 'payable',
186
+ },
187
+ {
188
+ type: 'function',
189
+ name: 'completeOwnershipHandover',
190
+ inputs: [
191
+ { name: 'pendingOwner', type: 'address', internalType: 'address' },
192
+ ],
193
+ outputs: [],
194
+ stateMutability: 'payable',
195
+ },
196
+ {
197
+ type: 'function',
198
+ name: 'consolidationSystemContract',
199
+ inputs: [],
200
+ outputs: [{ name: '', type: 'address', internalType: 'address' }],
201
+ stateMutability: 'view',
202
+ },
203
+ {
204
+ type: 'function',
205
+ name: 'deposit',
206
+ inputs: [
207
+ { name: 'pubkey', type: 'bytes', internalType: 'bytes' },
208
+ {
209
+ name: 'withdrawal_credentials',
210
+ type: 'bytes',
211
+ internalType: 'bytes',
212
+ },
213
+ { name: 'signature', type: 'bytes', internalType: 'bytes' },
214
+ { name: 'deposit_data_root', type: 'bytes32', internalType: 'bytes32' },
215
+ ],
216
+ outputs: [],
217
+ stateMutability: 'payable',
218
+ },
219
+ {
220
+ type: 'function',
221
+ name: 'depositSystemContract',
222
+ inputs: [],
223
+ outputs: [{ name: '', type: 'address', internalType: 'address' }],
224
+ stateMutability: 'view',
225
+ },
226
+ {
227
+ type: 'function',
228
+ name: 'distributeFunds',
229
+ inputs: [],
230
+ outputs: [],
231
+ stateMutability: 'nonpayable',
232
+ },
233
+ {
234
+ type: 'function',
235
+ name: 'distributeFundsPull',
236
+ inputs: [],
237
+ outputs: [],
238
+ stateMutability: 'nonpayable',
239
+ },
240
+ {
241
+ type: 'function',
242
+ name: 'fundsPendingWithdrawal',
243
+ inputs: [],
244
+ outputs: [{ name: '', type: 'uint128', internalType: 'uint128' }],
245
+ stateMutability: 'view',
246
+ },
247
+ {
248
+ type: 'function',
249
+ name: 'getPullBalance',
250
+ inputs: [{ name: 'account', type: 'address', internalType: 'address' }],
251
+ outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],
252
+ stateMutability: 'view',
253
+ },
254
+ {
255
+ type: 'function',
256
+ name: 'grantRoles',
257
+ inputs: [
258
+ { name: 'user', type: 'address', internalType: 'address' },
259
+ { name: 'roles', type: 'uint256', internalType: 'uint256' },
260
+ ],
261
+ outputs: [],
262
+ stateMutability: 'payable',
263
+ },
264
+ {
265
+ type: 'function',
266
+ name: 'hasAllRoles',
267
+ inputs: [
268
+ { name: 'user', type: 'address', internalType: 'address' },
269
+ { name: 'roles', type: 'uint256', internalType: 'uint256' },
270
+ ],
271
+ outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
272
+ stateMutability: 'view',
273
+ },
274
+ {
275
+ type: 'function',
276
+ name: 'hasAnyRole',
277
+ inputs: [
278
+ { name: 'user', type: 'address', internalType: 'address' },
279
+ { name: 'roles', type: 'uint256', internalType: 'uint256' },
280
+ ],
281
+ outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
282
+ stateMutability: 'view',
283
+ },
284
+ {
285
+ type: 'function',
286
+ name: 'owner',
287
+ inputs: [],
288
+ outputs: [{ name: 'result', type: 'address', internalType: 'address' }],
289
+ stateMutability: 'view',
290
+ },
291
+ {
292
+ type: 'function',
293
+ name: 'ownershipHandoverExpiresAt',
294
+ inputs: [
295
+ { name: 'pendingOwner', type: 'address', internalType: 'address' },
296
+ ],
297
+ outputs: [{ name: 'result', type: 'uint256', internalType: 'uint256' }],
298
+ stateMutability: 'view',
299
+ },
300
+ {
301
+ type: 'function',
302
+ name: 'principalRecipient',
303
+ inputs: [],
304
+ outputs: [{ name: '', type: 'address', internalType: 'address' }],
305
+ stateMutability: 'view',
306
+ },
307
+ {
308
+ type: 'function',
309
+ name: 'principalThreshold',
310
+ inputs: [],
311
+ outputs: [{ name: '', type: 'uint64', internalType: 'uint64' }],
312
+ stateMutability: 'view',
313
+ },
314
+ {
315
+ type: 'function',
316
+ name: 'recoverFunds',
317
+ inputs: [
318
+ { name: 'nonOVMToken', type: 'address', internalType: 'address' },
319
+ { name: 'recipient', type: 'address', internalType: 'address' },
320
+ ],
321
+ outputs: [],
322
+ stateMutability: 'nonpayable',
323
+ },
324
+ {
325
+ type: 'function',
326
+ name: 'renounceOwnership',
327
+ inputs: [],
328
+ outputs: [],
329
+ stateMutability: 'payable',
330
+ },
331
+ {
332
+ type: 'function',
333
+ name: 'renounceRoles',
334
+ inputs: [{ name: 'roles', type: 'uint256', internalType: 'uint256' }],
335
+ outputs: [],
336
+ stateMutability: 'payable',
337
+ },
338
+ {
339
+ type: 'function',
340
+ name: 'requestConsolidation',
341
+ inputs: [
342
+ { name: 'sourcePubKeys', type: 'bytes[]', internalType: 'bytes[]' },
343
+ { name: 'targetPubKey', type: 'bytes', internalType: 'bytes' },
344
+ ],
345
+ outputs: [],
346
+ stateMutability: 'payable',
347
+ },
348
+ {
349
+ type: 'function',
350
+ name: 'requestOwnershipHandover',
351
+ inputs: [],
352
+ outputs: [],
353
+ stateMutability: 'payable',
354
+ },
355
+ {
356
+ type: 'function',
357
+ name: 'requestWithdrawal',
358
+ inputs: [
359
+ { name: 'pubKeys', type: 'bytes[]', internalType: 'bytes[]' },
360
+ { name: 'amounts', type: 'uint64[]', internalType: 'uint64[]' },
361
+ ],
362
+ outputs: [],
363
+ stateMutability: 'payable',
364
+ },
365
+ {
366
+ type: 'function',
367
+ name: 'revokeRoles',
368
+ inputs: [
369
+ { name: 'user', type: 'address', internalType: 'address' },
370
+ { name: 'roles', type: 'uint256', internalType: 'uint256' },
371
+ ],
372
+ outputs: [],
373
+ stateMutability: 'payable',
374
+ },
375
+ {
376
+ type: 'function',
377
+ name: 'rewardRecipient',
378
+ inputs: [],
379
+ outputs: [{ name: '', type: 'address', internalType: 'address' }],
380
+ stateMutability: 'view',
381
+ },
382
+ {
383
+ type: 'function',
384
+ name: 'rolesOf',
385
+ inputs: [{ name: 'user', type: 'address', internalType: 'address' }],
386
+ outputs: [{ name: 'roles', type: 'uint256', internalType: 'uint256' }],
387
+ stateMutability: 'view',
388
+ },
389
+ {
390
+ type: 'function',
391
+ name: 'setPrincipalRecipient',
392
+ inputs: [
393
+ {
394
+ name: 'newPrincipalRecipient',
395
+ type: 'address',
396
+ internalType: 'address',
397
+ },
398
+ ],
399
+ outputs: [],
400
+ stateMutability: 'nonpayable',
401
+ },
402
+ {
403
+ type: 'function',
404
+ name: 'transferOwnership',
405
+ inputs: [{ name: 'newOwner', type: 'address', internalType: 'address' }],
406
+ outputs: [],
407
+ stateMutability: 'payable',
408
+ },
409
+ {
410
+ type: 'function',
411
+ name: 'withdraw',
412
+ inputs: [{ name: 'account', type: 'address', internalType: 'address' }],
413
+ outputs: [],
414
+ stateMutability: 'nonpayable',
415
+ },
416
+ {
417
+ type: 'function',
418
+ name: 'withdrawalSystemContract',
419
+ inputs: [],
420
+ outputs: [{ name: '', type: 'address', internalType: 'address' }],
421
+ stateMutability: 'view',
422
+ },
423
+ {
424
+ type: 'event',
425
+ name: 'ConsolidationRequested',
426
+ inputs: [
427
+ {
428
+ name: 'requester',
429
+ type: 'address',
430
+ indexed: true,
431
+ internalType: 'address',
432
+ },
433
+ { name: 'source', type: 'bytes', indexed: true, internalType: 'bytes' },
434
+ { name: 'target', type: 'bytes', indexed: true, internalType: 'bytes' },
435
+ ],
436
+ anonymous: false,
437
+ },
438
+ {
439
+ type: 'event',
440
+ name: 'DistributeFunds',
441
+ inputs: [
442
+ {
443
+ name: 'principalPayout',
444
+ type: 'uint256',
445
+ indexed: false,
446
+ internalType: 'uint256',
447
+ },
448
+ {
449
+ name: 'rewardPayout',
450
+ type: 'uint256',
451
+ indexed: false,
452
+ internalType: 'uint256',
453
+ },
454
+ {
455
+ name: 'pullOrPush',
456
+ type: 'uint256',
457
+ indexed: false,
458
+ internalType: 'uint256',
459
+ },
460
+ ],
461
+ anonymous: false,
462
+ },
463
+ {
464
+ type: 'event',
465
+ name: 'NewPrincipalRecipient',
466
+ inputs: [
467
+ {
468
+ name: 'newPrincipalRecipient',
469
+ type: 'address',
470
+ indexed: true,
471
+ internalType: 'address',
472
+ },
473
+ {
474
+ name: 'oldPrincipalRecipient',
475
+ type: 'address',
476
+ indexed: true,
477
+ internalType: 'address',
478
+ },
479
+ ],
480
+ anonymous: false,
481
+ },
482
+ {
483
+ type: 'event',
484
+ name: 'OwnershipHandoverCanceled',
485
+ inputs: [
486
+ {
487
+ name: 'pendingOwner',
488
+ type: 'address',
489
+ indexed: true,
490
+ internalType: 'address',
491
+ },
492
+ ],
493
+ anonymous: false,
494
+ },
495
+ {
496
+ type: 'event',
497
+ name: 'OwnershipHandoverRequested',
498
+ inputs: [
499
+ {
500
+ name: 'pendingOwner',
501
+ type: 'address',
502
+ indexed: true,
503
+ internalType: 'address',
504
+ },
505
+ ],
506
+ anonymous: false,
507
+ },
508
+ {
509
+ type: 'event',
510
+ name: 'OwnershipTransferred',
511
+ inputs: [
512
+ {
513
+ name: 'oldOwner',
514
+ type: 'address',
515
+ indexed: true,
516
+ internalType: 'address',
517
+ },
518
+ {
519
+ name: 'newOwner',
520
+ type: 'address',
521
+ indexed: true,
522
+ internalType: 'address',
523
+ },
524
+ ],
525
+ anonymous: false,
526
+ },
527
+ {
528
+ type: 'event',
529
+ name: 'RecoverNonOVMFunds',
530
+ inputs: [
531
+ {
532
+ name: 'nonOVMToken',
533
+ type: 'address',
534
+ indexed: true,
535
+ internalType: 'address',
536
+ },
537
+ {
538
+ name: 'recipient',
539
+ type: 'address',
540
+ indexed: true,
541
+ internalType: 'address',
542
+ },
543
+ {
544
+ name: 'amount',
545
+ type: 'uint256',
546
+ indexed: false,
547
+ internalType: 'uint256',
548
+ },
549
+ ],
550
+ anonymous: false,
551
+ },
552
+ {
553
+ type: 'event',
554
+ name: 'RolesUpdated',
555
+ inputs: [
556
+ {
557
+ name: 'user',
558
+ type: 'address',
559
+ indexed: true,
560
+ internalType: 'address',
561
+ },
562
+ {
563
+ name: 'roles',
564
+ type: 'uint256',
565
+ indexed: true,
566
+ internalType: 'uint256',
567
+ },
568
+ ],
569
+ anonymous: false,
570
+ },
571
+ {
572
+ type: 'event',
573
+ name: 'Withdrawal',
574
+ inputs: [
575
+ {
576
+ name: 'account',
577
+ type: 'address',
578
+ indexed: true,
579
+ internalType: 'address',
580
+ },
581
+ {
582
+ name: 'amount',
583
+ type: 'uint256',
584
+ indexed: false,
585
+ internalType: 'uint256',
586
+ },
587
+ ],
588
+ anonymous: false,
589
+ },
590
+ {
591
+ type: 'event',
592
+ name: 'WithdrawalRequested',
593
+ inputs: [
594
+ {
595
+ name: 'requester',
596
+ type: 'address',
597
+ indexed: true,
598
+ internalType: 'address',
599
+ },
600
+ { name: 'pubKey', type: 'bytes', indexed: true, internalType: 'bytes' },
601
+ {
602
+ name: 'amount',
603
+ type: 'uint256',
604
+ indexed: false,
605
+ internalType: 'uint256',
606
+ },
607
+ ],
608
+ anonymous: false,
609
+ },
610
+ { type: 'error', name: 'InvalidConsolidation_Failed', inputs: [] },
611
+ { type: 'error', name: 'InvalidDistribution_TooLarge', inputs: [] },
612
+ { type: 'error', name: 'InvalidRequest_NotEnoughFee', inputs: [] },
613
+ { type: 'error', name: 'InvalidRequest_Params', inputs: [] },
614
+ { type: 'error', name: 'InvalidRequest_SystemGetFee', inputs: [] },
615
+ { type: 'error', name: 'InvalidWithdrawal_Failed', inputs: [] },
616
+ { type: 'error', name: 'NewOwnerIsZeroAddress', inputs: [] },
617
+ { type: 'error', name: 'NoHandoverRequest', inputs: [] },
618
+ { type: 'error', name: 'Unauthorized', inputs: [] },
619
+ ],
620
+ };