@obolnetwork/obol-sdk 2.11.4 → 2.11.5-rc.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 (144) hide show
  1. package/README.md +33 -0
  2. package/dist/browser/src/index.js +18280 -0
  3. package/dist/browser/src/index.js.map +1 -0
  4. package/dist/cjs/src/index.js +17470 -382
  5. package/dist/cjs/src/index.js.map +1 -0
  6. package/dist/esm/src/index.js +17437 -361
  7. package/dist/esm/src/index.js.map +1 -0
  8. package/dist/types/src/constants.d.ts +1 -2
  9. package/dist/types/src/eoa/eoaHelpers.d.ts +1 -1
  10. package/dist/types/src/exits/verificationHelpers.d.ts +0 -2
  11. package/dist/types/src/incentives/incentiveHelpers.d.ts +1 -1
  12. package/dist/types/src/splits/splitHelpers.d.ts +3 -3
  13. package/dist/types/src/utils.d.ts +2 -2
  14. package/dist/types/src/verification/common.d.ts +0 -2
  15. package/dist/types/src/verification/signature-validator.d.ts +4 -4
  16. package/dist/types/src/verification/v1.10.0.d.ts +1 -1
  17. package/dist/types/src/verification/v1.6.0.d.ts +1 -1
  18. package/dist/types/src/verification/v1.7.0.d.ts +1 -1
  19. package/dist/types/src/verification/v1.8.0.d.ts +1 -1
  20. package/dist/types/test/client/methods.spec.d.ts +17 -0
  21. package/dist/types/tsconfig.types.tsbuildinfo +1 -0
  22. package/dist/types/tsup.config.d.ts +2 -0
  23. package/package.json +96 -58
  24. package/dist/cjs/package.json +0 -139
  25. package/dist/cjs/src/abi/BatchDeposit.js +0 -120
  26. package/dist/cjs/src/abi/MerkleDistributorWithDeadline.js +0 -73
  27. package/dist/cjs/src/abi/Multicall3.js +0 -253
  28. package/dist/cjs/src/abi/OVM.js +0 -627
  29. package/dist/cjs/src/abi/OWR.js +0 -304
  30. package/dist/cjs/src/abi/SplitMain.js +0 -929
  31. package/dist/cjs/src/abi/splitV2FactoryAbi.js +0 -420
  32. package/dist/cjs/src/ajv.js +0 -136
  33. package/dist/cjs/src/base.js +0 -42
  34. package/dist/cjs/src/bytecodes.js +0 -19
  35. package/dist/cjs/src/constants.js +0 -272
  36. package/dist/cjs/src/eoa/eoa.js +0 -132
  37. package/dist/cjs/src/eoa/eoaHelpers.js +0 -82
  38. package/dist/cjs/src/errors.js +0 -11
  39. package/dist/cjs/src/exits/ethUtils.js +0 -57
  40. package/dist/cjs/src/exits/exit.js +0 -502
  41. package/dist/cjs/src/exits/verificationHelpers.js +0 -86
  42. package/dist/cjs/src/incentives/incentiveHelpers.js +0 -39
  43. package/dist/cjs/src/incentives/incentives.js +0 -119
  44. package/dist/cjs/src/schema.js +0 -352
  45. package/dist/cjs/src/services.js +0 -33
  46. package/dist/cjs/src/splits/splitHelpers.js +0 -571
  47. package/dist/cjs/src/splits/splits.js +0 -366
  48. package/dist/cjs/src/types.js +0 -29
  49. package/dist/cjs/src/utils.js +0 -77
  50. package/dist/cjs/src/verification/common.js +0 -355
  51. package/dist/cjs/src/verification/signature-validator.js +0 -73
  52. package/dist/cjs/src/verification/sszTypes.js +0 -69
  53. package/dist/cjs/src/verification/termsAndConditions.js +0 -40
  54. package/dist/cjs/src/verification/v1.10.0.js +0 -146
  55. package/dist/cjs/src/verification/v1.6.0.js +0 -149
  56. package/dist/cjs/src/verification/v1.7.0.js +0 -173
  57. package/dist/cjs/src/verification/v1.8.0.js +0 -196
  58. package/dist/cjs/test/client/ajv.spec.js +0 -320
  59. package/dist/cjs/test/client/methods.spec.js +0 -418
  60. package/dist/cjs/test/eoa/eoa.spec.js +0 -176
  61. package/dist/cjs/test/exit/ethUtils.spec.js +0 -83
  62. package/dist/cjs/test/exit/exit.spec.js +0 -399
  63. package/dist/cjs/test/exit/verificationHelpers.spec.js +0 -68
  64. package/dist/cjs/test/fixtures.js +0 -896
  65. package/dist/cjs/test/incentives/incentives.spec.js +0 -202
  66. package/dist/cjs/test/splits/splits.spec.js +0 -402
  67. package/dist/esm/package.json +0 -139
  68. package/dist/esm/src/abi/BatchDeposit.js +0 -117
  69. package/dist/esm/src/abi/MerkleDistributorWithDeadline.js +0 -70
  70. package/dist/esm/src/abi/Multicall3.js +0 -250
  71. package/dist/esm/src/abi/OVM.js +0 -624
  72. package/dist/esm/src/abi/OWR.js +0 -301
  73. package/dist/esm/src/abi/SplitMain.js +0 -926
  74. package/dist/esm/src/abi/splitV2FactoryAbi.js +0 -417
  75. package/dist/esm/src/ajv.js +0 -129
  76. package/dist/esm/src/base.js +0 -38
  77. package/dist/esm/src/bytecodes.js +0 -16
  78. package/dist/esm/src/constants.js +0 -238
  79. package/dist/esm/src/eoa/eoa.js +0 -128
  80. package/dist/esm/src/eoa/eoaHelpers.js +0 -77
  81. package/dist/esm/src/errors.js +0 -7
  82. package/dist/esm/src/exits/ethUtils.js +0 -52
  83. package/dist/esm/src/exits/exit.js +0 -475
  84. package/dist/esm/src/exits/verificationHelpers.js +0 -81
  85. package/dist/esm/src/incentives/incentiveHelpers.js +0 -34
  86. package/dist/esm/src/incentives/incentives.js +0 -115
  87. package/dist/esm/src/schema.js +0 -349
  88. package/dist/esm/src/services.js +0 -29
  89. package/dist/esm/src/splits/splitHelpers.js +0 -554
  90. package/dist/esm/src/splits/splits.js +0 -362
  91. package/dist/esm/src/types.js +0 -26
  92. package/dist/esm/src/utils.js +0 -68
  93. package/dist/esm/src/verification/common.js +0 -319
  94. package/dist/esm/src/verification/signature-validator.js +0 -64
  95. package/dist/esm/src/verification/sszTypes.js +0 -64
  96. package/dist/esm/src/verification/termsAndConditions.js +0 -33
  97. package/dist/esm/src/verification/v1.10.0.js +0 -140
  98. package/dist/esm/src/verification/v1.6.0.js +0 -142
  99. package/dist/esm/src/verification/v1.7.0.js +0 -166
  100. package/dist/esm/src/verification/v1.8.0.js +0 -189
  101. package/dist/esm/test/client/ajv.spec.js +0 -318
  102. package/dist/esm/test/client/methods.spec.js +0 -393
  103. package/dist/esm/test/eoa/eoa.spec.js +0 -174
  104. package/dist/esm/test/exit/ethUtils.spec.js +0 -81
  105. package/dist/esm/test/exit/exit.spec.js +0 -374
  106. package/dist/esm/test/exit/verificationHelpers.spec.js +0 -66
  107. package/dist/esm/test/fixtures.js +0 -893
  108. package/dist/esm/test/incentives/incentives.spec.js +0 -177
  109. package/dist/esm/test/splits/splits.spec.js +0 -400
  110. package/dist/types/src/verification/termsAndConditions.d.ts +0 -1
  111. package/src/abi/BatchDeposit.ts +0 -117
  112. package/src/abi/MerkleDistributorWithDeadline.ts +0 -70
  113. package/src/abi/Multicall3.ts +0 -250
  114. package/src/abi/OVM.ts +0 -624
  115. package/src/abi/OWR.ts +0 -302
  116. package/src/abi/SplitMain.ts +0 -927
  117. package/src/abi/splitV2FactoryAbi.ts +0 -417
  118. package/src/ajv.ts +0 -191
  119. package/src/base.ts +0 -54
  120. package/src/bytecodes.ts +0 -32
  121. package/src/constants.ts +0 -309
  122. package/src/eoa/eoa.ts +0 -153
  123. package/src/eoa/eoaHelpers.ts +0 -112
  124. package/src/errors.ts +0 -8
  125. package/src/exits/ethUtils.ts +0 -49
  126. package/src/exits/exit.ts +0 -661
  127. package/src/exits/verificationHelpers.ts +0 -110
  128. package/src/incentives/incentiveHelpers.ts +0 -55
  129. package/src/incentives/incentives.ts +0 -153
  130. package/src/index.ts +0 -614
  131. package/src/schema.ts +0 -376
  132. package/src/services.ts +0 -24
  133. package/src/splits/splitHelpers.ts +0 -1032
  134. package/src/splits/splits.ts +0 -504
  135. package/src/types.ts +0 -687
  136. package/src/utils.ts +0 -88
  137. package/src/verification/common.ts +0 -532
  138. package/src/verification/signature-validator.ts +0 -103
  139. package/src/verification/sszTypes.ts +0 -88
  140. package/src/verification/termsAndConditions.ts +0 -32
  141. package/src/verification/v1.10.0.ts +0 -245
  142. package/src/verification/v1.6.0.ts +0 -256
  143. package/src/verification/v1.7.0.ts +0 -309
  144. package/src/verification/v1.8.0.ts +0 -340
@@ -1,272 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.CHAIN_PUBLIC_RPC_URL = exports.CAPELLA_FORK_MAPPING = exports.PROVIDER_MAP = exports.OBOL_SDK_EMAIL = exports.PRINCIPAL_THRESHOLD = exports.SPLITS_V2_SALT = exports.DEFAULT_RETROACTIVE_FUNDING_TOTAL_SPLIT = exports.DEFAULT_RETROACTIVE_FUNDING_REWARDS_ONLY_SPLIT = exports.CHAIN_CONFIGURATION = exports.isChainSupportedForSplitters = exports.AVAILABLE_SPLITTER_CHAINS = exports.TERMS_AND_CONDITIONS_HASH = exports.TERMS_AND_CONDITIONS_URL = exports.TERMS_AND_CONDITIONS_VERSION = exports.ETHER_TO_GWEI = exports.DEFAULT_CHAIN_ID = exports.DEFAULT_BASE_VERSION = exports.DEFAULT_BASE_URL = exports.DefinitionFlow = exports.GENESIS_VALIDATOR_ROOT = exports.DOMAIN_DEPOSIT = exports.DOMAIN_APPLICATION_BUILDER = exports.SDK_VERSION = exports.CONFIG_VERSION = exports.DKG_ALGORITHM = exports.signEnrPayload = exports.signOperatorConfigHashPayload = exports.signCreatorConfigHashPayload = exports.ENRTypedMessage = exports.OperatorTypedMessage = exports.OperatorConfigHashSigningTypes = exports.EnrSigningTypes = exports.CreatorTypedMessage = exports.Domain = exports.TermsAndConditionsSigningTypes = exports.CreatorConfigHashSigningTypes = exports.EIP712_DOMAIN_VERSION = exports.EIP712_DOMAIN_NAME = exports.CONFLICT_ERROR_MSG = void 0;
30
- const package_json_1 = __importDefault(require("../package.json"));
31
- const types_1 = require("./types");
32
- const bytecodes_1 = require("./bytecodes");
33
- const dotenv = __importStar(require("dotenv"));
34
- dotenv.config();
35
- exports.CONFLICT_ERROR_MSG = 'Conflict';
36
- exports.EIP712_DOMAIN_NAME = 'Obol';
37
- exports.EIP712_DOMAIN_VERSION = '1';
38
- exports.CreatorConfigHashSigningTypes = {
39
- CreatorConfigHash: [{ name: 'creator_config_hash', type: 'string' }],
40
- };
41
- exports.TermsAndConditionsSigningTypes = {
42
- TermsAndConditions: [
43
- { name: 'terms_and_conditions_hash', type: 'string' },
44
- { name: 'version', type: 'uint256' },
45
- ],
46
- };
47
- const EIP712Domain = [
48
- { name: 'name', type: 'string' },
49
- { name: 'version', type: 'string' },
50
- { name: 'chainId', type: 'uint256' },
51
- ];
52
- const Domain = (chainId) => {
53
- const typeDataDomain = {
54
- name: exports.EIP712_DOMAIN_NAME,
55
- version: exports.EIP712_DOMAIN_VERSION,
56
- };
57
- if (chainId) {
58
- typeDataDomain.chainId = chainId;
59
- }
60
- return typeDataDomain;
61
- };
62
- exports.Domain = Domain;
63
- exports.CreatorTypedMessage = Object.assign({ EIP712Domain }, exports.CreatorConfigHashSigningTypes);
64
- // A conflict once updateDefinition is merged
65
- exports.EnrSigningTypes = {
66
- ENR: [{ name: 'enr', type: 'string' }],
67
- };
68
- exports.OperatorConfigHashSigningTypes = {
69
- OperatorConfigHash: [{ name: 'operator_config_hash', type: 'string' }],
70
- };
71
- exports.OperatorTypedMessage = Object.assign({ EIP712Domain }, exports.OperatorConfigHashSigningTypes);
72
- exports.ENRTypedMessage = Object.assign({ EIP712Domain }, exports.EnrSigningTypes);
73
- const signCreatorConfigHashPayload = (payload, chainId) => {
74
- return {
75
- types: exports.CreatorTypedMessage,
76
- primaryType: 'CreatorConfigHash',
77
- domain: {
78
- name: exports.EIP712_DOMAIN_NAME,
79
- version: exports.EIP712_DOMAIN_VERSION,
80
- chainId,
81
- },
82
- message: payload,
83
- };
84
- };
85
- exports.signCreatorConfigHashPayload = signCreatorConfigHashPayload;
86
- const signOperatorConfigHashPayload = (payload, chainId) => {
87
- return {
88
- types: exports.OperatorTypedMessage,
89
- primaryType: 'OperatorConfigHash',
90
- domain: {
91
- name: exports.EIP712_DOMAIN_NAME,
92
- version: exports.EIP712_DOMAIN_VERSION,
93
- chainId,
94
- },
95
- message: payload,
96
- };
97
- };
98
- exports.signOperatorConfigHashPayload = signOperatorConfigHashPayload;
99
- const signEnrPayload = (payload, chainId) => {
100
- return {
101
- types: exports.ENRTypedMessage,
102
- primaryType: 'ENR',
103
- domain: {
104
- name: exports.EIP712_DOMAIN_NAME,
105
- version: exports.EIP712_DOMAIN_VERSION,
106
- chainId,
107
- },
108
- message: payload,
109
- };
110
- };
111
- exports.signEnrPayload = signEnrPayload;
112
- exports.DKG_ALGORITHM = 'default';
113
- exports.CONFIG_VERSION = 'v1.10.0';
114
- exports.SDK_VERSION = package_json_1.default.version;
115
- exports.DOMAIN_APPLICATION_BUILDER = '00000001';
116
- exports.DOMAIN_DEPOSIT = '03000000';
117
- exports.GENESIS_VALIDATOR_ROOT = '0000000000000000000000000000000000000000000000000000000000000000';
118
- // Flow used to create definition
119
- var DefinitionFlow;
120
- (function (DefinitionFlow) {
121
- DefinitionFlow["Group"] = "LP-Group";
122
- DefinitionFlow["Solo"] = "LP-Solo";
123
- DefinitionFlow["Charon"] = "Charon-Command";
124
- })(DefinitionFlow || (exports.DefinitionFlow = DefinitionFlow = {}));
125
- exports.DEFAULT_BASE_URL = 'https://api.obol.tech';
126
- exports.DEFAULT_BASE_VERSION = 'v1';
127
- exports.DEFAULT_CHAIN_ID = 17000;
128
- exports.ETHER_TO_GWEI = 10 ** 9;
129
- exports.TERMS_AND_CONDITIONS_VERSION = 1;
130
- exports.TERMS_AND_CONDITIONS_URL = exports.TERMS_AND_CONDITIONS_VERSION === 1
131
- ? 'https://obol.org/terms.pdf'
132
- : `https://obol.org/${exports.TERMS_AND_CONDITIONS_VERSION}/terms.pdf`;
133
- exports.TERMS_AND_CONDITIONS_HASH = '0xd33721644e8f3afab1495a74abe3523cec12d48b8da6cb760972492ca3f1a273';
134
- exports.AVAILABLE_SPLITTER_CHAINS = {
135
- [types_1.FORK_MAPPING['0x00000000']]: true, // Mainnet
136
- [types_1.FORK_MAPPING['0x01017000']]: true, // Holesky
137
- [types_1.FORK_MAPPING['0x10000910']]: true, // Hoodi
138
- };
139
- const isChainSupportedForSplitters = (chainId) => {
140
- return chainId in exports.AVAILABLE_SPLITTER_CHAINS;
141
- };
142
- exports.isChainSupportedForSplitters = isChainSupportedForSplitters;
143
- exports.CHAIN_CONFIGURATION = {
144
- [types_1.FORK_MAPPING['0x00000000']]: {
145
- SPLITMAIN_CONTRACT: {
146
- address: '0x2ed6c4B5dA6378c7897AC67Ba9e43102Feb694EE',
147
- bytecode: bytecodes_1.MAINNET_SPLITMAIN_BYTECODE,
148
- },
149
- MULTICALL3_CONTRACT: {
150
- address: '0xcA11bde05977b3631167028862bE2a173976CA11',
151
- bytecode: bytecodes_1.MAINNET_MULTICALL3_BYTECODE,
152
- },
153
- OWR_FACTORY_CONTRACT: {
154
- address: '0x119acd7844cbdd5fc09b1c6a4408f490c8f7f522',
155
- bytecode: bytecodes_1.MAINNET_OWR_FACTORY_BYTECODE,
156
- },
157
- RETROACTIVE_FUNDING_CONTRACT: {
158
- address: '0xDe5aE4De36c966747Ea7DF13BD9589642e2B1D0d',
159
- bytecode: '',
160
- },
161
- // OVM and SplitV2 Contract Addresses
162
- OVM_FACTORY_CONTRACT: {
163
- address: '0xA755669f314022ED2158e93867af5183E88370fe',
164
- bytecode: bytecodes_1.MAINNET_OVM_FACTORY_BYTECODE,
165
- },
166
- WAREHOUSE_CONTRACT: {
167
- address: '0x8fb66F38cF86A3d5e8768f8F1754A24A6c661Fb8',
168
- bytecode: bytecodes_1.MAINNET_WAREHOUSE_BYTECODE,
169
- },
170
- SPLIT_V2_FACTORY_CONTRACT: {
171
- address: '0x5cbA88D55Cec83caD5A105Ad40C8c9aF20bE21d1',
172
- bytecode: bytecodes_1.MAINNET_SPLIT_V2_FACTORY_BYTECODE,
173
- },
174
- EOA_WITHDRAWAL_CONTRACT: {
175
- address: '0x00000961Ef480Eb55e80D19ad83579A64c007002',
176
- },
177
- BATCH_DEPOSIT_CONTRACT: {
178
- address: '0xcD7a6C118Ac8F6544BC5076F2D8Fb86D2C546756',
179
- },
180
- },
181
- [types_1.FORK_MAPPING['0x01017000']]: {
182
- SPLITMAIN_CONTRACT: {
183
- address: '0xfC8a305728051367797DADE6Aa0344E0987f5286',
184
- bytecode: bytecodes_1.HOLESKY_SPLITMAIN_BYTECODE,
185
- },
186
- MULTICALL3_CONTRACT: {
187
- address: '0xcA11bde05977b3631167028862bE2a173976CA11',
188
- bytecode: bytecodes_1.HOLESKY_MULTICALL3_BYTECODE,
189
- },
190
- OWR_FACTORY_CONTRACT: {
191
- address: '0xc0961353fcc43a99e3041db07ac646720e116256',
192
- bytecode: bytecodes_1.HOLESKY_OWR_FACTORY_BYTECODE,
193
- },
194
- RETROACTIVE_FUNDING_CONTRACT: {
195
- address: '0x43F641fA70e09f0326ac66b4Ef0C416EaEcBC6f5',
196
- bytecode: '',
197
- },
198
- EOA_WITHDRAWAL_CONTRACT: {
199
- address: '0x00000961Ef480Eb55e80D19ad83579A64c007002',
200
- },
201
- OVM_FACTORY_CONTRACT: {
202
- address: '0x4B157b79277E44D12C234680ACE17Db028075EA5',
203
- bytecode: bytecodes_1.HOLESKY_OVM_FACTORY_BYTECODE,
204
- },
205
- },
206
- [types_1.FORK_MAPPING['0x10000910']]: {
207
- SPLITMAIN_CONTRACT: {
208
- address: '0xc05ae267291705ac16F75283572294ed2a91CBc7',
209
- bytecode: bytecodes_1.HOODI_SPLITMAIN_BYTECODE,
210
- },
211
- MULTICALL3_CONTRACT: {
212
- address: '0xcA11bde05977b3631167028862bE2a173976CA11',
213
- bytecode: bytecodes_1.HOODI_MULTICALL3_BYTECODE,
214
- },
215
- OWR_FACTORY_CONTRACT: {
216
- address: '0x9ff0c649d0bf5fe7efa4d72e94bed7302ed5c8d7',
217
- bytecode: bytecodes_1.HOODI_OWR_FACTORY_BYTECODE,
218
- },
219
- RETROACTIVE_FUNDING_CONTRACT: {
220
- address: '0x43F641fA70e09f0326ac66b4Ef0C416EaEcBC6f5',
221
- bytecode: '',
222
- },
223
- // OVM and SplitV2 Contract Addresses
224
- OVM_FACTORY_CONTRACT: {
225
- address: '0x885E7D97E3987BA57EF0d693C508d675e4Bf82FC',
226
- bytecode: bytecodes_1.HOODI_OVM_FACTORY_BYTECODE,
227
- },
228
- WAREHOUSE_CONTRACT: {
229
- address: '0x8fb66F38cF86A3d5e8768f8F1754A24A6c661Fb8',
230
- bytecode: bytecodes_1.HOODI_WAREHOUSE_BYTECODE,
231
- },
232
- SPLIT_V2_FACTORY_CONTRACT: {
233
- address: '0x5cbA88D55Cec83caD5A105Ad40C8c9aF20bE21d1',
234
- bytecode: bytecodes_1.HOODI_SPLIT_V2_FACTORY_BYTECODE,
235
- },
236
- EOA_WITHDRAWAL_CONTRACT: {
237
- address: '0x00000961Ef480Eb55e80D19ad83579A64c007002',
238
- },
239
- BATCH_DEPOSIT_CONTRACT: {
240
- address: '0x4c9506eE2fCd962f03022D9d8ebf6f7828abEfaf',
241
- },
242
- },
243
- };
244
- exports.DEFAULT_RETROACTIVE_FUNDING_REWARDS_ONLY_SPLIT = 1;
245
- exports.DEFAULT_RETROACTIVE_FUNDING_TOTAL_SPLIT = 0.1;
246
- // OVM and SplitV2 Default Constants
247
- exports.SPLITS_V2_SALT = '0x2fa740d39f3b04b2c7ef4e9f9e1a6e38f4c72c1a91d8595d5d31a3adf17c6b12';
248
- exports.PRINCIPAL_THRESHOLD = 16;
249
- exports.OBOL_SDK_EMAIL = 'sdk@dvlabs.tech';
250
- exports.PROVIDER_MAP = {
251
- 1: `${process.env.RPC_MAINNET}`, // Mainnet
252
- 17000: `${process.env.RPC_HOLESKY}`, // Holesky
253
- 11155111: `${process.env.RPC_SEPOLIA}`, // Sepolia
254
- 100: `${process.env.RPC_GNOSIS}`, // Gnosis
255
- 560048: `${process.env.RPC_HOODI}`, // Hoodi
256
- };
257
- /**
258
- * Maps base fork versions to their corresponding Capella fork versions.
259
- * Example: Mainnet Capella fork version.
260
- */
261
- exports.CAPELLA_FORK_MAPPING = {
262
- '0x00000000': '0x03000000', // Mainnet
263
- '0x00001020': '0x03001020', // Goerli
264
- '0x00000064': '0x03000064', // Gnosis
265
- '0x90000069': '0x90000072', // Sepolia
266
- '0x01017000': '0x04017000', // Holesky
267
- '0x10000910': '0x40000910', // Hoodi
268
- };
269
- exports.CHAIN_PUBLIC_RPC_URL = {
270
- 1: 'https://ethereum-rpc.publicnode.com', // Mainnet
271
- 560048: 'https://ethereum-hoodi-rpc.publicnode.com', // Hoodi
272
- };
@@ -1,132 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.EOA = void 0;
13
- const eoaHelpers_1 = require("./eoaHelpers");
14
- const ajv_1 = require("../ajv");
15
- const schema_1 = require("../schema");
16
- const constants_1 = require("../constants");
17
- /**
18
- * EOA can be used for managing EOA (Externally Owned Account) operations like withdrawals.
19
- * @class
20
- * @internal Access it through Client.eoa.
21
- * @example
22
- * const obolClient = new Client(config);
23
- * await obolClient.eoa.requestWithdrawal(EOAWithdrawalPayload);
24
- */
25
- class EOA {
26
- constructor(signer, chainId, provider) {
27
- this.signer = signer;
28
- this.chainId = chainId;
29
- this.provider = provider;
30
- }
31
- /**
32
- * Requests withdrawal from an EOA contract.
33
- *
34
- * This method allows requesting withdrawal of validator funds.
35
- * The withdrawal request includes validator public key and corresponding withdrawal amount.
36
- *
37
- * @remarks
38
- * **⚠️ Important:** If you're storing the private key in an `.env` file, ensure it is securely managed
39
- * and not pushed to version control.
40
- *
41
- * @param {EOAWithdrawalPayload} payload - Data needed to request withdrawal
42
- * @returns {Promise<{txHash: string}>} Transaction hash of the withdrawal request
43
- * @throws Will throw an error if the signer is not provided or the request fails
44
- *
45
- * An example of how to use requestWithdrawal:
46
- * ```typescript
47
- * const result = await client.eoa.requestWithdrawal({
48
- * pubkey: '0x123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456',
49
- * allocation: 32, // 32 ETH
50
- * requiredFee: '1' // in wei
51
- * });
52
- * console.log('Withdrawal requested:', result.txHash);
53
- * ```
54
- */
55
- requestWithdrawal(payload) {
56
- var _a;
57
- return __awaiter(this, void 0, void 0, function* () {
58
- if (!this.signer) {
59
- throw new Error('Signer is required in requestWithdrawal');
60
- }
61
- if (!this.provider) {
62
- throw new Error('Provider is required in requestWithdrawal');
63
- }
64
- const chainConfig = constants_1.CHAIN_CONFIGURATION[this.chainId];
65
- if (!((_a = chainConfig === null || chainConfig === void 0 ? void 0 : chainConfig.EOA_WITHDRAWAL_CONTRACT) === null || _a === void 0 ? void 0 : _a.address)) {
66
- throw new Error(`EOA withdrawal contract is not configured for chain ${this.chainId}`);
67
- }
68
- const validatedPayload = (0, ajv_1.validatePayload)(payload, schema_1.eoaWithdrawalPayloadSchema);
69
- const withdrawalAddress = yield this.signer.getAddress();
70
- return yield (0, eoaHelpers_1.submitEOAWithdrawalRequest)({
71
- pubkey: validatedPayload.pubkey,
72
- allocation: validatedPayload.allocation,
73
- withdrawalAddress,
74
- withdrawalContractAddress: chainConfig.EOA_WITHDRAWAL_CONTRACT.address,
75
- requiredFee: validatedPayload.requiredFee,
76
- chainId: this.chainId,
77
- signer: this.signer,
78
- provider: this.provider,
79
- });
80
- });
81
- }
82
- /**
83
- * Deposits to batch deposit contract.
84
- *
85
- * This method allows depositing multiple validators to the Ethereum beacon chain
86
- * using the Pier Two batch deposit contract for gas efficiency.
87
- * Each deposit includes validator public key, withdrawal credentials, signature, and amount.
88
- *
89
- * @remarks
90
- * **⚠️ Important:** If you're storing the private key in an `.env` file, ensure it is securely managed
91
- * and not pushed to version control.
92
- *
93
- * **⚠️ Gas Limit:** Due to EVM constraints, it is recommended to deposit in batches of up to 500 at a time.
94
- *
95
- * @param {EOADepositPayload} payload - Data needed to deposit to batch contract
96
- * @returns {Promise<{txHashes: string[]}>} Array of transaction hashes for all batches
97
- * @throws Will throw an error if the signer is not provided, contract is not configured, or the deposit fails
98
- *
99
- * An example of how to use deposit:
100
- * ```typescript
101
- * const result = await client.eoa.deposit({
102
- * deposits: [{
103
- * pubkey: '0x123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456',
104
- * withdrawal_credentials: '0x1234567890123456789012345678901234567890',
105
- * deposit_data_root: '0x1234567890123456789012345678901234567890123456789012345678901234',
106
- * signature: '0x123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456',
107
- * amount: '32000000000000000000' // 32 ETH in wei
108
- * }]
109
- * });
110
- * console.log('Deposits completed:', result.txHashes);
111
- * ```
112
- */
113
- deposit(payload) {
114
- var _a;
115
- return __awaiter(this, void 0, void 0, function* () {
116
- if (!this.signer) {
117
- throw new Error('Signer is required in deposit');
118
- }
119
- const chainConfig = constants_1.CHAIN_CONFIGURATION[this.chainId];
120
- if (!((_a = chainConfig === null || chainConfig === void 0 ? void 0 : chainConfig.BATCH_DEPOSIT_CONTRACT) === null || _a === void 0 ? void 0 : _a.address)) {
121
- throw new Error(`Batch deposit contract is not configured for chain ${this.chainId}`);
122
- }
123
- const validatedPayload = (0, ajv_1.validatePayload)(payload, schema_1.eoaDepositPayloadSchema);
124
- return yield (0, eoaHelpers_1.submitEOABatchDeposit)({
125
- deposits: validatedPayload.deposits,
126
- batchDepositContractAddress: chainConfig.BATCH_DEPOSIT_CONTRACT.address,
127
- signer: this.signer,
128
- });
129
- });
130
- }
131
- }
132
- exports.EOA = EOA;
@@ -1,82 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.submitEOABatchDeposit = exports.submitEOAWithdrawalRequest = void 0;
13
- const constants_1 = require("../constants");
14
- const ethers_1 = require("ethers");
15
- const BatchDeposit_1 = require("../abi/BatchDeposit");
16
- /**
17
- * Helper function to submit withdrawal request for EOA
18
- */
19
- function submitEOAWithdrawalRequest({ pubkey, allocation, withdrawalAddress, withdrawalContractAddress, requiredFee, chainId, signer, provider, }) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- if (!withdrawalAddress)
22
- throw new Error('No withdrawal address provided');
23
- if (!allocation)
24
- throw new Error('No allocation provided');
25
- const amountInGwei = BigInt(Math.floor(Number(allocation) * constants_1.ETHER_TO_GWEI));
26
- const data = `0x${pubkey.slice(2)}${amountInGwei.toString(16).padStart(16, '0')}`;
27
- const tx = yield signer.sendTransaction({
28
- to: withdrawalContractAddress,
29
- chainId,
30
- value: BigInt(requiredFee),
31
- data: data,
32
- });
33
- const receipt = yield tx.wait();
34
- if (!receipt)
35
- return { txHash: null };
36
- return { txHash: receipt.hash };
37
- });
38
- }
39
- exports.submitEOAWithdrawalRequest = submitEOAWithdrawalRequest;
40
- /**
41
- * Helper function to submit batch deposit request for EOA
42
- */
43
- function submitEOABatchDeposit({ deposits, batchDepositContractAddress, signer, }) {
44
- return __awaiter(this, void 0, void 0, function* () {
45
- if (!deposits || deposits.length === 0) {
46
- throw new Error('No deposits provided');
47
- }
48
- // Create contract instance
49
- const batchDepositContract = new ethers_1.Contract(batchDepositContractAddress, BatchDeposit_1.BatchDepositContract.abi, signer);
50
- const BATCH_SIZE = 500;
51
- const txHashes = [];
52
- try {
53
- // Process deposits in batches of 500
54
- for (let i = 0; i < deposits.length; i += BATCH_SIZE) {
55
- const batchDeposits = deposits.slice(i, i + BATCH_SIZE);
56
- // Calculate total value needed for this batch
57
- const totalValue = batchDeposits.reduce((sum, deposit) => sum + BigInt(deposit.amount), BigInt(0));
58
- // Prepare deposit data for this batch
59
- const depositData = batchDeposits.map(deposit => ({
60
- pubKey: deposit.pubkey,
61
- withdrawalCredentials: deposit.withdrawal_credentials,
62
- signature: deposit.signature,
63
- depositDataRoot: deposit.deposit_data_root,
64
- amount: BigInt(deposit.amount),
65
- }));
66
- // Execute batch deposit for this batch
67
- const tx = yield batchDepositContract.batchDeposit(depositData, {
68
- value: totalValue,
69
- });
70
- const receipt = yield tx.wait();
71
- if (receipt === null || receipt === void 0 ? void 0 : receipt.hash) {
72
- txHashes.push(receipt.hash);
73
- }
74
- }
75
- return { txHashes };
76
- }
77
- catch (error) {
78
- throw new Error("Failed to submit batch deposit'}");
79
- }
80
- });
81
- }
82
- exports.submitEOABatchDeposit = submitEOABatchDeposit;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConflictError = void 0;
4
- class ConflictError extends Error {
5
- constructor() {
6
- super('This Cluster has been already posted.');
7
- this.name = 'ConflictError';
8
- Object.setPrototypeOf(this, ConflictError.prototype);
9
- }
10
- }
11
- exports.ConflictError = ConflictError;
@@ -1,57 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getGenesisValidatorsRoot = exports.getCapellaFork = void 0;
13
- const constants_1 = require("../constants");
14
- /**
15
- * Retrieves the Capella fork version for a given base fork version.
16
- * @param fork_version - The base fork version string (e.g., '0x00000000' for mainnet).
17
- * @returns A promise that resolves to the Capella fork version string, or null if not found.
18
- */
19
- function getCapellaFork(fork_version) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- // Ensure the CAPELLA_FORK_MAPPING uses the base fork_version as key
22
- if (constants_1.CAPELLA_FORK_MAPPING[fork_version]) {
23
- return constants_1.CAPELLA_FORK_MAPPING[fork_version];
24
- }
25
- return null;
26
- });
27
- }
28
- exports.getCapellaFork = getCapellaFork;
29
- /**
30
- * Fetches the genesis validators root from a beacon node.
31
- * @param beaconNodeApiUrl - The base URL of the beacon node API (e.g., http://localhost:5052).
32
- * @returns A promise that resolves to the genesis_validators_root string, or null on error.
33
- * @throws Will throw an error if the network corresponding to the fork_version is not supported or if the HTTP request fails.
34
- */
35
- function getGenesisValidatorsRoot(beaconNodeApiUrl) {
36
- var _a;
37
- return __awaiter(this, void 0, void 0, function* () {
38
- const genesisEndpoint = `${beaconNodeApiUrl}/eth/v1/beacon/genesis`;
39
- try {
40
- const response = yield fetch(genesisEndpoint, {
41
- method: 'GET',
42
- });
43
- const json = yield response.json();
44
- if ((_a = json.data) === null || _a === void 0 ? void 0 : _a.genesis_validators_root) {
45
- return json.data.genesis_validators_root;
46
- }
47
- console.error('Invalid response structure from genesis endpoint', json);
48
- return null;
49
- }
50
- catch (e) {
51
- console.error(`Error fetching genesis validators root from ${genesisEndpoint}:`, e);
52
- const errorMessage = e instanceof Error ? e.message : String(e);
53
- throw new Error(`Failed to fetch genesis validators root: ${errorMessage}`);
54
- }
55
- });
56
- }
57
- exports.getGenesisValidatorsRoot = getGenesisValidatorsRoot;