@obolnetwork/obol-sdk 2.4.6 → 2.5.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-sdk",
3
- "version": "2.4.6",
3
+ "version": "2.5.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"
@@ -49,6 +49,8 @@
49
49
  "@safe-global/safe-core-sdk-types": "5.1.0",
50
50
  "@types/pdf-parse": "^1.1.4",
51
51
  "ajv": "^8.12.0",
52
+ "ajv-formats": "^3.0.1",
53
+ "ajv-keywords": "^5.1.0",
52
54
  "cross-fetch": "^3.1.5",
53
55
  "dotenv": "^16.4.7",
54
56
  "elliptic": "^6.5.4",
@@ -3,58 +3,84 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.validatePayload = void 0;
7
- const ajv_1 = __importDefault(require("ajv"));
6
+ exports.validatePayload = exports.VALID_NON_COMPOUNDING_AMOUNTS = exports.VALID_DEPOSIT_AMOUNTS = void 0;
7
+ const ajv_formats_1 = __importDefault(require("ajv-formats"));
8
+ const ajv_keywords_1 = __importDefault(require("ajv-keywords"));
8
9
  const ethers_1 = require("ethers");
10
+ const ajv_1 = __importDefault(require("ajv"));
9
11
  const constants_1 = require("./constants");
10
- const validDepositAmounts = (data, deposits) => {
11
- let sum = 0;
12
- // from ether togwei is same as from gwei to wei
13
- const maxDeposit = Number((0, ethers_1.parseUnits)('32', 'gwei'));
14
- const minDeposit = Number((0, ethers_1.parseUnits)('1', 'gwei'));
15
- for (const element of deposits) {
16
- const amountInGWei = Number(element);
17
- if (!Number.isInteger(amountInGWei) ||
18
- amountInGWei > maxDeposit ||
19
- amountInGWei < minDeposit) {
20
- return false;
21
- }
22
- sum += amountInGWei;
12
+ exports.VALID_DEPOSIT_AMOUNTS = [
13
+ (0, ethers_1.parseUnits)('1', 'gwei').toString(),
14
+ (0, ethers_1.parseUnits)('32', 'gwei').toString(),
15
+ (0, ethers_1.parseUnits)('8', 'gwei').toString(),
16
+ (0, ethers_1.parseUnits)('256', 'gwei').toString(),
17
+ ];
18
+ exports.VALID_NON_COMPOUNDING_AMOUNTS = [
19
+ (0, ethers_1.parseUnits)('1', 'gwei').toString(),
20
+ (0, ethers_1.parseUnits)('32', 'gwei').toString(),
21
+ ];
22
+ // They dont see defaults set in schema
23
+ const validateRewardsSplitRecipients = (_, data) => {
24
+ var _a;
25
+ const obolRAFSplit = (_a = data.ObolRAFSplit) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_RETROACTIVE_FUNDING_REWARDS_ONLY_SPLIT;
26
+ const splitPercentage = data.splitRecipients.reduce((acc, curr) => acc + curr.percentAllocation, 0);
27
+ return splitPercentage + obolRAFSplit === 100;
28
+ };
29
+ const validateTotalSplitRecipients = (_, data) => {
30
+ var _a;
31
+ const obolRAFSplit = (_a = data.ObolRAFSplit) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_RETROACTIVE_FUNDING_TOTAL_SPLIT;
32
+ const splitPercentage = data.splitRecipients.reduce((acc, curr) => acc + curr.percentAllocation, 0);
33
+ return splitPercentage + obolRAFSplit === 100;
34
+ };
35
+ const validateUniqueAddresses = (_, operators) => {
36
+ if (!operators) {
37
+ return false;
23
38
  }
24
- if (sum / minDeposit !== 32) {
39
+ if (operators.length < 4) {
25
40
  return false;
26
41
  }
27
- else {
42
+ if (operators.every(op => op.address === '')) {
28
43
  return true;
29
44
  }
45
+ if (operators.some(op => op.address.length !== 42)) {
46
+ return false;
47
+ }
48
+ const addresses = operators.map(op => op.address);
49
+ const uniqueAddresses = new Set(addresses);
50
+ const isUnique = uniqueAddresses.size === addresses.length;
51
+ return isUnique;
30
52
  };
31
- const validateSplitRecipients = (_, data) => {
32
- const splitPercentage = data.splitRecipients.reduce((acc, curr) => acc + curr.percentAllocation, 0);
33
- const ObolRAFSplitParam = data.ObolRAFSplit
34
- ? data.ObolRAFSplit
35
- : 'principalRecipient' in data
36
- ? constants_1.DEFAULT_RETROACTIVE_FUNDING_REWARDS_ONLY_SPLIT
37
- : constants_1.DEFAULT_RETROACTIVE_FUNDING_TOTAL_SPLIT;
38
- return splitPercentage + ObolRAFSplitParam === 100;
39
- };
53
+ const ajv = new ajv_1.default({
54
+ allErrors: true,
55
+ useDefaults: true,
56
+ strict: false,
57
+ $data: true,
58
+ });
59
+ (0, ajv_formats_1.default)(ajv);
60
+ (0, ajv_keywords_1.default)(ajv, ['patternRequired']);
61
+ ajv.addKeyword({
62
+ keyword: 'validateRewardsSplitRecipients',
63
+ validate: validateRewardsSplitRecipients,
64
+ schemaType: 'boolean',
65
+ });
66
+ ajv.addKeyword({
67
+ keyword: 'validateTotalSplitRecipients',
68
+ validate: validateTotalSplitRecipients,
69
+ schemaType: 'boolean',
70
+ });
71
+ ajv.addKeyword({
72
+ keyword: 'validateUniqueAddresses',
73
+ validate: validateUniqueAddresses,
74
+ schemaType: 'boolean',
75
+ });
40
76
  function validatePayload(data, schema) {
41
77
  var _a;
42
- const ajv = new ajv_1.default();
43
- ajv.addKeyword({
44
- keyword: 'validDepositAmounts',
45
- validate: validDepositAmounts,
46
- errors: true,
47
- });
48
- ajv.addKeyword({
49
- keyword: 'validateSplitRecipients',
50
- validate: validateSplitRecipients,
51
- errors: true,
52
- });
53
78
  const validate = ajv.compile(schema);
54
- const isValid = validate(data);
55
- if (!isValid) {
56
- throw new Error(`Schema compilation errors', ${(_a = validate.errors) === null || _a === void 0 ? void 0 : _a[0].message}`);
79
+ const valid = validate(data);
80
+ if (!valid) {
81
+ const errors = (_a = validate.errors) === null || _a === void 0 ? void 0 : _a.map(e => `${e.instancePath} ${e.message}`).join(', ');
82
+ throw new Error(`Validation failed: ${errors}`);
57
83
  }
58
- return isValid;
84
+ return data;
59
85
  }
60
86
  exports.validatePayload = validatePayload;
@@ -110,7 +110,7 @@ const signEnrPayload = (payload, chainId) => {
110
110
  };
111
111
  exports.signEnrPayload = signEnrPayload;
112
112
  exports.DKG_ALGORITHM = 'default';
113
- exports.CONFIG_VERSION = 'v1.8.0';
113
+ exports.CONFIG_VERSION = 'v1.10.0';
114
114
  exports.SDK_VERSION = package_json_1.default.version;
115
115
  exports.DOMAIN_APPLICATION_BUILDER = '00000001';
116
116
  exports.DOMAIN_DEPOSIT = '03000000';
@@ -24,7 +24,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.Client = exports.Incentives = void 0;
27
- const ethers_1 = require("ethers");
28
27
  const uuid_1 = require("uuid");
29
28
  const base_js_1 = require("./base.js");
30
29
  const constants_js_1 = require("./constants.js");
@@ -39,6 +38,7 @@ __exportStar(require("./types.js"), exports);
39
38
  __exportStar(require("./services.js"), exports);
40
39
  __exportStar(require("./verification/signature-validator.js"), exports);
41
40
  __exportStar(require("./verification/common.js"), exports);
41
+ __exportStar(require("./constants.js"), exports);
42
42
  var incentives_js_2 = require("./incentives.js");
43
43
  Object.defineProperty(exports, "Incentives", { enumerable: true, get: function () { return incentives_js_2.Incentives; } });
44
44
  /**
@@ -120,13 +120,13 @@ class Client extends base_js_1.Base {
120
120
  * [createObolRewardsSplit](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L141)
121
121
  */
122
122
  // add the example reference
123
- createObolRewardsSplit({ splitRecipients, principalRecipient, etherAmount, ObolRAFSplit = constants_js_1.DEFAULT_RETROACTIVE_FUNDING_REWARDS_ONLY_SPLIT, distributorFee = 0, controllerAddress = ethers_1.ZeroAddress, recoveryAddress = ethers_1.ZeroAddress, }) {
123
+ createObolRewardsSplit({ splitRecipients, principalRecipient, etherAmount, ObolRAFSplit = constants_js_1.DEFAULT_RETROACTIVE_FUNDING_REWARDS_ONLY_SPLIT, distributorFee, controllerAddress, recoveryAddress, }) {
124
124
  return __awaiter(this, void 0, void 0, function* () {
125
125
  // This method doesnt require T&C signature
126
126
  if (!this.signer) {
127
127
  throw new Error('Signer is required in createObolRewardsSplit');
128
128
  }
129
- (0, ajv_js_1.validatePayload)({
129
+ const validatedPayload = (0, ajv_js_1.validatePayload)({
130
130
  splitRecipients,
131
131
  principalRecipient,
132
132
  etherAmount,
@@ -149,9 +149,9 @@ class Client extends base_js_1.Base {
149
149
  }
150
150
  const retroActiveFundingRecipient = {
151
151
  account: constants_js_1.CHAIN_CONFIGURATION[this.chainId].RETROACTIVE_FUNDING_ADDRESS.address,
152
- percentAllocation: ObolRAFSplit,
152
+ percentAllocation: validatedPayload.ObolRAFSplit,
153
153
  };
154
- const copiedSplitRecipients = [...splitRecipients];
154
+ const copiedSplitRecipients = [...validatedPayload.splitRecipients];
155
155
  copiedSplitRecipients.push(retroActiveFundingRecipient);
156
156
  const { accounts, percentAllocations } = (0, splitHelpers_js_1.formatSplitRecipients)(copiedSplitRecipients);
157
157
  const predictedSplitterAddress = yield (0, splitHelpers_js_1.predictSplitterAddress)({
@@ -159,8 +159,8 @@ class Client extends base_js_1.Base {
159
159
  accounts,
160
160
  percentAllocations,
161
161
  chainId: this.chainId,
162
- distributorFee,
163
- controllerAddress,
162
+ distributorFee: validatedPayload.distributorFee,
163
+ controllerAddress: validatedPayload.controllerAddress,
164
164
  });
165
165
  const isSplitterDeployed = yield (0, utils_js_1.isContractAvailable)(predictedSplitterAddress, this.signer.provider);
166
166
  const { withdrawal_address, fee_recipient_address } = yield (0, splitHelpers_js_1.handleDeployOWRAndSplitter)({
@@ -169,12 +169,12 @@ class Client extends base_js_1.Base {
169
169
  predictedSplitterAddress,
170
170
  accounts,
171
171
  percentAllocations,
172
- principalRecipient,
173
- etherAmount,
172
+ principalRecipient: validatedPayload.principalRecipient,
173
+ etherAmount: validatedPayload.etherAmount,
174
174
  chainId: this.chainId,
175
- distributorFee,
176
- controllerAddress,
177
- recoveryAddress,
175
+ distributorFee: validatedPayload.distributorFee,
176
+ controllerAddress: validatedPayload.controllerAddress,
177
+ recoveryAddress: validatedPayload.recoveryAddress,
178
178
  });
179
179
  return { withdrawal_address, fee_recipient_address };
180
180
  });
@@ -193,13 +193,13 @@ class Client extends base_js_1.Base {
193
193
  * [createObolTotalSplit](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L168)
194
194
  */
195
195
  // add the example reference
196
- createObolTotalSplit({ splitRecipients, ObolRAFSplit = constants_js_1.DEFAULT_RETROACTIVE_FUNDING_TOTAL_SPLIT, distributorFee = 0, controllerAddress = ethers_1.ZeroAddress, }) {
196
+ createObolTotalSplit({ splitRecipients, ObolRAFSplit, distributorFee, controllerAddress, }) {
197
197
  return __awaiter(this, void 0, void 0, function* () {
198
198
  // This method doesnt require T&C signature
199
199
  if (!this.signer) {
200
200
  throw new Error('Signer is required in createObolTotalSplit');
201
201
  }
202
- (0, ajv_js_1.validatePayload)({
202
+ const validatedPayload = (0, ajv_js_1.validatePayload)({
203
203
  splitRecipients,
204
204
  ObolRAFSplit,
205
205
  distributorFee,
@@ -215,9 +215,9 @@ class Client extends base_js_1.Base {
215
215
  }
216
216
  const retroActiveFundingRecipient = {
217
217
  account: constants_js_1.CHAIN_CONFIGURATION[this.chainId].RETROACTIVE_FUNDING_ADDRESS.address,
218
- percentAllocation: ObolRAFSplit,
218
+ percentAllocation: validatedPayload.ObolRAFSplit,
219
219
  };
220
- const copiedSplitRecipients = [...splitRecipients];
220
+ const copiedSplitRecipients = [...validatedPayload.splitRecipients];
221
221
  copiedSplitRecipients.push(retroActiveFundingRecipient);
222
222
  const { accounts, percentAllocations } = (0, splitHelpers_js_1.formatSplitRecipients)(copiedSplitRecipients);
223
223
  const predictedSplitterAddress = yield (0, splitHelpers_js_1.predictSplitterAddress)({
@@ -225,8 +225,8 @@ class Client extends base_js_1.Base {
225
225
  accounts,
226
226
  percentAllocations,
227
227
  chainId: this.chainId,
228
- distributorFee,
229
- controllerAddress,
228
+ distributorFee: validatedPayload.distributorFee,
229
+ controllerAddress: validatedPayload.controllerAddress,
230
230
  });
231
231
  const isSplitterDeployed = yield (0, utils_js_1.isContractAvailable)(predictedSplitterAddress, this.signer.provider);
232
232
  if (!isSplitterDeployed) {
@@ -235,8 +235,8 @@ class Client extends base_js_1.Base {
235
235
  accounts,
236
236
  percentAllocations,
237
237
  chainId: this.chainId,
238
- distributorFee,
239
- controllerAddress,
238
+ distributorFee: validatedPayload.distributorFee,
239
+ controllerAddress: validatedPayload.controllerAddress,
240
240
  });
241
241
  return {
242
242
  withdrawal_address: splitterAddress,
@@ -283,10 +283,8 @@ class Client extends base_js_1.Base {
283
283
  if (!this.signer) {
284
284
  throw new Error('Signer is required in createClusterDefinition');
285
285
  }
286
- (0, ajv_js_1.validatePayload)(newCluster, schema_js_1.definitionSchema);
287
- const clusterConfig = Object.assign(Object.assign({}, newCluster), { fork_version: this.fork_version, dkg_algorithm: constants_js_1.DKG_ALGORITHM, version: constants_js_1.CONFIG_VERSION, uuid: (0, uuid_1.v4)(), timestamp: new Date().toISOString(), threshold: Math.ceil((2 * newCluster.operators.length) / 3), num_validators: newCluster.validators.length, deposit_amounts: newCluster.deposit_amounts
288
- ? newCluster.deposit_amounts
289
- : ['32000000000'] });
286
+ const validatedCluster = (0, ajv_js_1.validatePayload)(newCluster, schema_js_1.definitionSchema);
287
+ const clusterConfig = Object.assign(Object.assign({}, validatedCluster), { fork_version: this.fork_version, dkg_algorithm: constants_js_1.DKG_ALGORITHM, version: constants_js_1.CONFIG_VERSION, uuid: (0, uuid_1.v4)(), timestamp: new Date().toISOString(), threshold: Math.ceil((2 * validatedCluster.operators.length) / 3), num_validators: validatedCluster.validators.length });
290
288
  try {
291
289
  const address = yield this.signer.getAddress();
292
290
  clusterConfig.creator = { address };
@@ -325,12 +323,12 @@ class Client extends base_js_1.Base {
325
323
  if (!this.signer) {
326
324
  throw new Error('Signer is required in acceptClusterDefinition');
327
325
  }
328
- (0, ajv_js_1.validatePayload)(operatorPayload, schema_js_1.operatorPayloadSchema);
326
+ const validatedPayload = (0, ajv_js_1.validatePayload)(operatorPayload, schema_js_1.operatorPayloadSchema);
329
327
  try {
330
328
  const address = yield this.signer.getAddress();
331
329
  const operatorConfigSignature = yield this.signer.signTypedData((0, constants_js_1.Domain)(this.chainId), constants_js_1.OperatorConfigHashSigningTypes, { operator_config_hash: configHash });
332
- const operatorENRSignature = yield this.signer.signTypedData((0, constants_js_1.Domain)(this.chainId), constants_js_1.EnrSigningTypes, { enr: operatorPayload.enr });
333
- const operatorData = Object.assign(Object.assign({}, operatorPayload), { address, enr_signature: operatorENRSignature, fork_version: this.fork_version });
330
+ const operatorENRSignature = yield this.signer.signTypedData((0, constants_js_1.Domain)(this.chainId), constants_js_1.EnrSigningTypes, { enr: validatedPayload.enr });
331
+ const operatorData = Object.assign(Object.assign({}, validatedPayload), { address, enr_signature: operatorENRSignature, fork_version: this.fork_version });
334
332
  const clusterDefinition = yield this.request(`/${constants_js_1.DEFAULT_BASE_VERSION}/definition/${configHash}`, {
335
333
  method: 'PUT',
336
334
  body: JSON.stringify(operatorData),
@@ -1,40 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.rewardsSplitterPayloadSchema = exports.totalSplitterPayloadSchema = exports.definitionSchema = exports.operatorPayloadSchema = void 0;
4
+ const ethers_1 = require("ethers");
4
5
  const constants_1 = require("./constants");
6
+ const ajv_1 = require("./ajv");
5
7
  exports.operatorPayloadSchema = {
6
8
  type: 'object',
7
9
  properties: {
8
- version: {
9
- type: 'string',
10
- },
11
- enr: {
12
- type: 'string',
13
- },
10
+ version: { type: 'string' },
11
+ enr: { type: 'string' },
14
12
  },
15
13
  required: ['version', 'enr'],
16
14
  };
17
15
  exports.definitionSchema = {
18
16
  type: 'object',
19
17
  properties: {
20
- name: {
21
- type: 'string',
22
- },
18
+ name: { type: 'string' },
23
19
  operators: {
24
20
  type: 'array',
25
21
  minItems: 4,
26
- uniqueItems: true,
27
22
  items: {
28
23
  type: 'object',
29
24
  properties: {
30
25
  address: {
31
26
  type: 'string',
32
- minLength: 42,
33
- maxLength: 42,
34
27
  },
35
28
  },
36
29
  required: ['address'],
37
30
  },
31
+ validateUniqueAddresses: true,
38
32
  },
39
33
  validators: {
40
34
  type: 'array',
@@ -55,12 +49,39 @@ exports.definitionSchema = {
55
49
  },
56
50
  },
57
51
  deposit_amounts: {
58
- type: 'array',
52
+ type: ['array', 'null'],
59
53
  items: {
60
54
  type: 'string',
61
55
  pattern: '^[0-9]+$',
62
56
  },
63
- validDepositAmounts: true,
57
+ if: {
58
+ $data: '1/compounding',
59
+ },
60
+ then: {
61
+ items: {
62
+ enum: ajv_1.VALID_DEPOSIT_AMOUNTS,
63
+ },
64
+ },
65
+ else: {
66
+ items: {
67
+ enum: ajv_1.VALID_NON_COMPOUNDING_AMOUNTS,
68
+ },
69
+ },
70
+ default: null,
71
+ },
72
+ compounding: {
73
+ type: 'boolean',
74
+ default: false,
75
+ },
76
+ target_gas_limit: {
77
+ type: 'number',
78
+ minimum: 1,
79
+ default: 36000000,
80
+ },
81
+ consensus_protocol: {
82
+ type: 'string',
83
+ enum: ['qbft', ''],
84
+ default: '',
64
85
  },
65
86
  },
66
87
  required: ['name', 'operators', 'validators'],
@@ -77,9 +98,7 @@ exports.totalSplitterPayloadSchema = {
77
98
  type: 'string',
78
99
  pattern: '^0x[a-fA-F0-9]{40}$',
79
100
  },
80
- percentAllocation: {
81
- type: 'number',
82
- },
101
+ percentAllocation: { type: 'number' },
83
102
  },
84
103
  required: ['account', 'percentAllocation'],
85
104
  },
@@ -87,29 +106,37 @@ exports.totalSplitterPayloadSchema = {
87
106
  ObolRAFSplit: {
88
107
  type: 'number',
89
108
  minimum: constants_1.DEFAULT_RETROACTIVE_FUNDING_TOTAL_SPLIT,
109
+ default: constants_1.DEFAULT_RETROACTIVE_FUNDING_TOTAL_SPLIT,
90
110
  },
91
111
  distributorFee: {
92
112
  type: 'number',
93
113
  maximum: 10,
94
114
  multipleOf: 0.01,
115
+ default: 0,
95
116
  },
96
117
  controllerAddress: {
97
118
  type: 'string',
98
119
  pattern: '^0x[a-fA-F0-9]{40}$',
120
+ default: ethers_1.ZeroAddress,
99
121
  },
100
- validateSplitRecipients: true,
101
122
  },
123
+ validateTotalSplitRecipients: true,
102
124
  required: ['splitRecipients'],
103
125
  };
104
- exports.rewardsSplitterPayloadSchema = Object.assign(Object.assign({}, exports.totalSplitterPayloadSchema), { properties: Object.assign(Object.assign({}, exports.totalSplitterPayloadSchema.properties), { ObolRAFSplit: {
126
+ exports.rewardsSplitterPayloadSchema = {
127
+ type: 'object',
128
+ properties: Object.assign(Object.assign({}, exports.totalSplitterPayloadSchema.properties), { ObolRAFSplit: {
105
129
  type: 'number',
106
130
  minimum: constants_1.DEFAULT_RETROACTIVE_FUNDING_REWARDS_ONLY_SPLIT,
131
+ default: constants_1.DEFAULT_RETROACTIVE_FUNDING_REWARDS_ONLY_SPLIT,
107
132
  }, recoveryAddress: {
108
133
  type: 'string',
109
134
  pattern: '^0x[a-fA-F0-9]{40}$',
110
- }, etherAmount: {
111
- type: 'number',
112
- }, principalRecipient: {
135
+ default: ethers_1.ZeroAddress,
136
+ }, etherAmount: { type: 'number' }, principalRecipient: {
113
137
  type: 'string',
114
138
  pattern: '^0x[a-fA-F0-9]{40}$',
115
- } }), required: ['splitRecipients', 'principalRecipient', 'etherAmount'] });
139
+ } }),
140
+ validateRewardsSplitRecipients: true,
141
+ required: ['splitRecipients', 'principalRecipient', 'etherAmount'],
142
+ };
@@ -147,6 +147,24 @@ const verifyDVV1X8 = (clusterLock) => {
147
147
  for (const element of validatorPublicShares) {
148
148
  pubShares.push((0, ssz_1.fromHexString)(element));
149
149
  }
150
+ // Check deposit amounts match exactly if they are defined
151
+ const depositAmounts = clusterLock.cluster_definition.deposit_amounts;
152
+ if (depositAmounts !== null) {
153
+ const partialDepositAmounts = validator.partial_deposit_data.map(d => d.amount);
154
+ if ((depositAmounts === null || depositAmounts === void 0 ? void 0 : depositAmounts.length) !== partialDepositAmounts.length) {
155
+ return false;
156
+ }
157
+ // Check that both arrays contain exactly the same elements
158
+ const sortedDepositAmounts = [...depositAmounts]
159
+ .map(Number)
160
+ .sort((a, b) => a - b);
161
+ const sortedPartialAmounts = [...partialDepositAmounts]
162
+ .map(Number)
163
+ .sort((a, b) => a - b);
164
+ if (!sortedDepositAmounts.every((amount, index) => amount === sortedPartialAmounts[index])) {
165
+ return false;
166
+ }
167
+ }
150
168
  // Deposit Data Verification
151
169
  for (const element of validator.partial_deposit_data) {
152
170
  const depositData = element;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.clusterLockWithCompoundingWithdrawals = exports.clusterLockV1X10 = exports.clusterLockWithSafe = exports.nullDepositAmountsClusterLockV1X8 = exports.clusterLockV1X8 = exports.clusterConfigV1X8 = exports.clusterLockV1X7 = exports.clusterConfigV1X7 = exports.clusterLockV1X6 = exports.enr = void 0;
3
+ exports.clusterLockWithCompoundingWithdrawalss = exports.clusterLockWithCompoundingWithdrawals = exports.clusterLockV1X10 = exports.soloClusterConfigV1X10 = exports.clusterConfigV1X10 = exports.clusterLockWithSafe = exports.nullDepositAmountsClusterLockV1X8 = exports.clusterLockV1X8 = exports.clusterLockV1X7 = exports.clusterConfigV1X7 = exports.clusterLockV1X6 = exports.enr = void 0;
4
4
  exports.enr = 'enr:-HW4QLlrtMjFLGkFT1bwdGbvZQlH8hLi0M2g44JAxEYP3BZmYpcsy9Q56HPPD87fMucjvLv4-obEFacpsg0ehRilbHeAgmlkgnY0iXNlY3AyNTZrMaEDRaa5o2aSgqyFq_ERZcQTztrOij1mFtXX1bJuVI6ieak';
5
5
  // v1.6.0
6
6
  exports.clusterLockV1X6 = {
@@ -173,22 +173,6 @@ exports.clusterLockV1X7 = {
173
173
  ],
174
174
  };
175
175
  // v1.8.0
176
- exports.clusterConfigV1X8 = {
177
- name: 'testSDK',
178
- operators: [
179
- { address: '0xC35CfCd67b9C27345a54EDEcC1033F2284148c81' },
180
- { address: '0x33807D6F1DCe44b9C599fFE03640762A6F08C496' },
181
- { address: '0xc6e76F72Ea672FAe05C357157CfC37720F0aF26f' },
182
- { address: '0xf6fF1a7A14D01e86a175bA958d3B6C75f2213966' },
183
- ],
184
- validators: [
185
- {
186
- fee_recipient_address: '0x3CD4958e76C317abcEA19faDd076348808424F99',
187
- withdrawal_address: '0xE0C5ceA4D3869F156717C66E188Ae81C80914a6e',
188
- },
189
- ],
190
- deposit_amounts: ['8000000000', '16000000000', '8000000000'],
191
- };
192
176
  exports.clusterLockV1X8 = {
193
177
  cluster_definition: {
194
178
  name: 'xxxx',
@@ -510,6 +494,40 @@ exports.clusterLockWithSafe = {
510
494
  '0x4067921a5257efe4ceb103f2129faaa7a502781157b3b54e5efca559c558c2b43b89f30962e87df88fbf62250049a31888fcd62735d54b7553e5dc75c3b6ae0901',
511
495
  ],
512
496
  };
497
+ exports.clusterConfigV1X10 = {
498
+ name: 'testSDK',
499
+ operators: [
500
+ { address: '0xC35CfCd67b9C27345a54EDEcC1033F2284148c81' },
501
+ { address: '0x33807D6F1DCe44b9C599fFE03640762A6F08C496' },
502
+ { address: '0xc6e76F72Ea672FAe05C357157CfC37720F0aF26f' },
503
+ { address: '0xf6fF1a7A14D01e86a175bA958d3B6C75f2213966' },
504
+ ],
505
+ validators: [
506
+ {
507
+ fee_recipient_address: '0x3CD4958e76C317abcEA19faDd076348808424F99',
508
+ withdrawal_address: '0xE0C5ceA4D3869F156717C66E188Ae81C80914a6e',
509
+ },
510
+ ],
511
+ deposit_amounts: ['8000000000', '32000000000', '8000000000'],
512
+ compounding: true,
513
+ target_gas_limit: 36000000,
514
+ consensus_protocol: '',
515
+ };
516
+ exports.soloClusterConfigV1X10 = {
517
+ name: 'testSDK',
518
+ operators: [
519
+ { address: '' },
520
+ { address: '' },
521
+ { address: '' },
522
+ { address: '' },
523
+ ],
524
+ validators: [
525
+ {
526
+ fee_recipient_address: '0x3CD4958e76C317abcEA19faDd076348808424F99',
527
+ withdrawal_address: '0xE0C5ceA4D3869F156717C66E188Ae81C80914a6e',
528
+ },
529
+ ],
530
+ };
513
531
  exports.clusterLockV1X10 = {
514
532
  cluster_definition: {
515
533
  name: 'test',
@@ -774,3 +792,93 @@ exports.clusterLockWithCompoundingWithdrawals = {
774
792
  '0x3e2548c3c35df90bd7af34f9cc439e7ec4e4fa5619f74ca393bde8e05942dfde0c2e5d95249f478533fe11581b794e5de55446452e4dd1648c33b319a987461701',
775
793
  ],
776
794
  };
795
+ exports.clusterLockWithCompoundingWithdrawalss = {
796
+ cluster_definition: {
797
+ name: 'test v1.10.0',
798
+ creator: {
799
+ address: '0xc6e76F72Ea672FAe05C357157CfC37720F0aF26f',
800
+ config_signature: '0x62b609c3a56439fe60785895d60a36912b85d50c14a41fce36795c65d6263bb207467a4d4be7dc292bfd1c636332b1c409feaec6ce2ae9488ae1ad622264a7a81c',
801
+ },
802
+ operators: [
803
+ {
804
+ address: '0xc6e76F72Ea672FAe05C357157CfC37720F0aF26f',
805
+ enr: 'enr:-HW4QLlrtMjFLGkFT1bwdGbvZQlH8hLi0M2g44JAxEYP3BZmYpcsy9Q56HPPD87fMucjvLv4-obEFacpsg0ehRilbHeAgmlkgnY0iXNlY3AyNTZrMaEDRaa5o2aSgqyFq_ERZcQTztrOij1mFtXX1bJuVI6ieak',
806
+ config_signature: '0x58c31787cf1f9680f736713f4ce039c8bf69467e5128edb2888d380451bd757367665c1ba04dc7656eb0b77eac39f776780710e603372f2a41bd40f4d297c7fa1c',
807
+ enr_signature: '0x4df48b8fc16deb2441022a019b72976524f4ce3dd674ee70561fb9eb52985d3b0d9528532d3e5be7a44548be27e9e96c5358b9f6756c7c7a97e2126f9c2c9b071b',
808
+ },
809
+ {
810
+ address: '0xa084D9095BcBdFe8014B68fa52D73DCeb16C5129',
811
+ enr: 'enr:-Iu4QNbiUUUwT18LynBbVPJhNxvzQsaSpUr40mQTWscnZaqKb6vAlvV8j-eDDR3E0wjMQumGRbGm2IAb5_k4bVWJiVGAgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPOiodUji0ohgJb5sNK1hgv8g6xO5_znZz3NkkBkyYyKIN0Y3CCDhqDdWRwgg4u',
812
+ config_signature: '0xc76b2f067a65c9cc6110ab99471b03f47545581e79164758114c98825d5440891843790ce92ca24ee7b3568b839cc88c2b3824587f8f260fca15bb852f69a3af1c',
813
+ enr_signature: '0x49e2a07424e412ed904fd47381c36203cb8c5575a31ba260b3f8420dc89a86fc0d7fbc087160a60690be2f6fb212423d467e212494992ab9a72f10319779a2cc1c',
814
+ },
815
+ {
816
+ address: '0xb1D2740Ee055693FE21bbCfc780729472C3f6B84',
817
+ enr: 'enr:-Iu4QJyserRukhG0Vgi2csu7GjpHYUGufNEbZ8Q7ZBrcZUb0KqpL5QzHonkh1xxHlxatTxrIcX_IS5J3SEWR_sa0ptGAgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQMAUgEqczOjevyculnUIofhCj0DkgJudErM7qCYIvIkzIN0Y3CCDhqDdWRwgg4u',
818
+ config_signature: '0x8b0cea21e065d25faa3b9d3b9e8f497d3c2d8baf800a1c5ecbde64c041745b7e15131d28f7ab917bdcead3225dda16987f2fd160546e087987cbb483bd187cb11b',
819
+ enr_signature: '0x805f38269379087168900a37569f1108b9d4253a03c2650a4e8d69228cb4cc616b94988e4b218a8d47113063270c4a894e873a5070c7ef0f4d44ee3359eec51b1b',
820
+ },
821
+ {
822
+ address: '0x69D39e2d0Fb6fb80CCd5d49a75416cB7d1BC6DB6',
823
+ enr: 'enr:-HW4QKJTwXC6Chw6zbnA3HFZi6Jo0DkIgjKy4eUBpsSOGnAeWE6ChEjEyk_6R6Qrm7jI-iqfs3_HYxiKde8vFgvHHrCAgmlkgnY0iXNlY3AyNTZrMaECfFKQH4spdZCHqrKVz1Q02xYla6J_RQECDNNYBRWdzv8',
824
+ config_signature: '0x9e21c2308738fb17b38d1850b83312c25306c0bcbd575e0417e311d5fc1697807291328a299859df70ac3efb402207067dbb0559bc4fef4e6ca2fd77fa4c2a321c',
825
+ enr_signature: '0x3a6590600b2dc27b042aabd3fa4654f1064b42e8f850d1fac13394a6786463be2a2727623e4e9e98453113f7024e73d652d1c6288ef82ede7acbb08e25ff00751b',
826
+ },
827
+ ],
828
+ uuid: '34036642-9d45-4b6f-817d-f8d5aa0110d4',
829
+ version: 'v1.10.0',
830
+ timestamp: '2025-04-03T17:27:27.767Z',
831
+ num_validators: 1,
832
+ threshold: 3,
833
+ validators: [
834
+ {
835
+ fee_recipient_address: '0xc6e76F72Ea672FAe05C357157CfC37720F0aF26f',
836
+ withdrawal_address: '0xc6e76F72Ea672FAe05C357157CfC37720F0aF26f',
837
+ },
838
+ ],
839
+ dkg_algorithm: 'default',
840
+ fork_version: '0x10000910',
841
+ deposit_amounts: ['32000000000'],
842
+ consensus_protocol: 'abft',
843
+ target_gas_limit: 30000000,
844
+ compounding: true,
845
+ config_hash: '0xe6d2e8fe49d722f55ced8a028c62ffbde16a05bc74d7d9703b675ecc8c820b4b',
846
+ definition_hash: '0xb5d81494f98df23cdff33909888080054f1068c11bbee5ec39aeb95edfa3b37c',
847
+ },
848
+ distributed_validators: [
849
+ {
850
+ distributed_public_key: '0x8368525a657df38fd3d774a08f1a54f008ae3340e8441a2bbb2d2051a9a8f46d4eeb8610bbc088e7402cba6b138c7b70',
851
+ public_shares: [
852
+ '0xae455c727456238fadd7b84ded0f0fb700d0e2fa028fff34e3fc73d0279ee9a5aa9843f8af00c9518ea781d8d823cc0d',
853
+ '0x91a7cfa9682464dff7324c0907fdff41df3f2643fd97d30559d82fbbfa354dae1e3f9176d8562b5ab47d3460240004cb',
854
+ '0xac8c0ffdb9ea7ce63bbed67122123c86ffa669a5027da5f96ab85b68c3a491253ebf0308cf4e237ea4eaf8543064c8a8',
855
+ '0x85385ef7cf1b1d9cd648ceb45e92516ef9612c9830b0abf808ea7996ad9369764bb9ac27c3cd730497e12e394ab48d16',
856
+ ],
857
+ builder_registration: {
858
+ message: {
859
+ fee_recipient: '0xc6e76f72ea672fae05c357157cfc37720f0af26f',
860
+ gas_limit: 30000000,
861
+ timestamp: 1742213400,
862
+ pubkey: '0x8368525a657df38fd3d774a08f1a54f008ae3340e8441a2bbb2d2051a9a8f46d4eeb8610bbc088e7402cba6b138c7b70',
863
+ },
864
+ signature: '0xb73c4d55c17bdbbb53790fee3294ef2c69b2a6e4c700eb30603e437308005edacbe76591f917aa82cfcf60da2d669ccd101ae9b3dc4b1ae61ab7ad1794620adbdc0b4ea5f91fc5e790833537c610a57ccdc4c95ca53cb6dedec2be2ad8acf266',
865
+ },
866
+ partial_deposit_data: [
867
+ {
868
+ pubkey: '0x8368525a657df38fd3d774a08f1a54f008ae3340e8441a2bbb2d2051a9a8f46d4eeb8610bbc088e7402cba6b138c7b70',
869
+ withdrawal_credentials: '0x020000000000000000000000c6e76f72ea672fae05c357157cfc37720f0af26f',
870
+ amount: '32000000000',
871
+ signature: '0xa7c5c2417f5afd089b87df0eff10855b748d621749879b6087c8a1dbfcbb95aa79a2c8f4d637ecb283426b9c5af07c30080c19a245ea614ff3f609a92994e9a29f3c0f8c4bf1a4e7ef58615ff80586b40e36859c9fd935b68ae55670e29ea5d7',
872
+ },
873
+ ],
874
+ },
875
+ ],
876
+ signature_aggregate: '0x8b9f884ab3ab89d63f49437cae09e2b77757787f2c54bb52bc51df1d565bc6d63ef9fc4e0ea76bd72a58618651b827a611d8e96de238fad4616420b4cd393ad62428ac9db2e01a4e8dd8ae835845e7530f9e1b3b4ebf5ba2da3c77aec70d06b2',
877
+ lock_hash: '0xaf6b0d989fdd82f7f9683d62b9f797af129f9afae2a4b453a0bef1814b21ae5d',
878
+ node_signatures: [
879
+ '0xc059b3920fc107a909feb16217c7372911c5cb386954ed899b5d8e782d6d71e17a5dde1c2d4825b7c2b5edd63b4eb9c306afd4afd5dbce3f8db9c13d06d6cebf01',
880
+ '0x051a72e5f2a66a85aabd635a210350f82924350170981575f3cb67e7699791d7118ab7c284f10b52f3604a89aa0bc43ad2d2537a7b19b109610324926475d30900',
881
+ '0xa28a23de3703c3eeb9a091d4f47302a96079759baf1afca428cbd298b46c40fe103df0006dfd5a0ffd15ee7c5fa436d70d7a03d4537dd8292a6152734e5f689601',
882
+ '0x992ab5c73d30d10cc5c8f6d462ba387fd5a698e206b0dfdd0224d17117f85a2077fcaa62fd6d5170ff678249288fcd82877e2987ed5564df5dbd9d51370871c800',
883
+ ],
884
+ };