@obolnetwork/obol-sdk 2.2.3 → 2.2.4

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.2.3",
3
+ "version": "2.2.4",
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"
@@ -239,18 +239,13 @@ const computeDomain = (domainType, lockForkVersion, genesisValidatorsRoot = (0,
239
239
  * @param {string} withdrawalAddress - withdrawal address in definition file.
240
240
  * @returns {boolean} - return if deposit data is valid.
241
241
  */
242
- const verifyDepositData = (distributedPublicKey, depositData, withdrawalAddress, forkVersion) => {
242
+ const verifyDepositData = (distributedPublicKey, depositData, withdrawalAddress, forkVersion, compounding) => {
243
243
  const depositDomain = computeDomain((0, ssz_1.fromHexString)(constants_js_1.DOMAIN_DEPOSIT), forkVersion);
244
- const eth1AddressWithdrawalPrefix = '0x01';
245
- const compoundingWithdrawalPrefix = '0x02';
246
- if (eth1AddressWithdrawalPrefix +
244
+ const withdrawalPrefix = compounding ? '0x02' : '0x01';
245
+ const expectedWithdrawalCredentials = withdrawalPrefix +
247
246
  '0'.repeat(22) +
248
- withdrawalAddress.toLowerCase().slice(2) !==
249
- depositData.withdrawal_credentials &&
250
- compoundingWithdrawalPrefix +
251
- '0'.repeat(22) +
252
- withdrawalAddress.toLowerCase().slice(2) !==
253
- depositData.withdrawal_credentials) {
247
+ withdrawalAddress.toLowerCase().slice(2);
248
+ if (expectedWithdrawalCredentials !== depositData.withdrawal_credentials) {
254
249
  return { isValidDepositData: false, depositDataMsg: new Uint8Array(0) };
255
250
  }
256
251
  if (distributedPublicKey !== depositData.pubkey) {
@@ -27,6 +27,7 @@ const clusterDefinitionContainerTypeV1X10 = (configOnly) => {
27
27
  deposit_amounts: new ssz_1.ListBasicType(new uint_1.UintNumberType(8), 256),
28
28
  consensus_protocol: new ssz_1.ByteListType(256),
29
29
  target_gas_limit: new uint_1.UintNumberType(8),
30
+ compounding: new ssz_1.BooleanType(),
30
31
  };
31
32
  if (!configOnly) {
32
33
  returnedContainerType = Object.assign(Object.assign({}, returnedContainerType), { config_hash: new ssz_1.ByteVectorType(32) });
@@ -79,6 +80,9 @@ const hashClusterDefinitionV1X10 = (cluster, configOnly) => {
79
80
  if (cluster.target_gas_limit) {
80
81
  val.target_gas_limit = cluster.target_gas_limit;
81
82
  }
83
+ if (cluster.compounding) {
84
+ val.compounding = cluster.compounding;
85
+ }
82
86
  if (!configOnly) {
83
87
  val.config_hash = (0, ssz_1.fromHexString)(cluster.config_hash);
84
88
  }
@@ -150,7 +150,7 @@ const verifyDVV1X8 = (clusterLock) => {
150
150
  // Deposit Data Verification
151
151
  for (const element of validator.partial_deposit_data) {
152
152
  const depositData = element;
153
- const { isValidDepositData, depositDataMsg } = (0, common_1.verifyDepositData)(distributedPublicKey, depositData, clusterLock.cluster_definition.validators[i].withdrawal_address, clusterLock.cluster_definition.fork_version);
153
+ const { isValidDepositData, depositDataMsg } = (0, common_1.verifyDepositData)(distributedPublicKey, depositData, clusterLock.cluster_definition.validators[i].withdrawal_address, clusterLock.cluster_definition.fork_version, clusterLock.cluster_definition.compounding);
154
154
  if (!isValidDepositData) {
155
155
  return false;
156
156
  }