@obolnetwork/obol-sdk 2.0.1 → 2.1.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 (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 +133 -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 +146 -0
  10. package/dist/cjs/src/schema.js +52 -5
  11. package/dist/cjs/src/splitHelpers.js +177 -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 +130 -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 +148 -2
  23. package/dist/esm/src/schema.js +51 -4
  24. package/dist/esm/src/splitHelpers.js +168 -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 +52 -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 +29 -1
  34. package/dist/types/src/schema.d.ts +85 -4
  35. package/dist/types/src/splitHelpers.d.ts +62 -0
  36. package/dist/types/src/types.d.ts +39 -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 +130 -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 +244 -2
  46. package/src/schema.ts +67 -4
  47. package/src/splitHelpers.ts +341 -0
  48. package/src/types.ts +49 -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.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"
@@ -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,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ 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
+ };