@argonprotocol/mainchain 1.4.9-dev.8f82736f → 1.4.9-dev.c17ec6c5

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.
package/lib/index.cjs CHANGED
@@ -220,6 +220,7 @@ var TxResult = (_class = class {
220
220
  }
221
221
  #isBroadcast = false;
222
222
  #submissionError;
223
+ #pendingInBlock;
223
224
  set isBroadcast(value) {
224
225
  this.#isBroadcast = value;
225
226
  this.updateProgress();
@@ -265,21 +266,44 @@ var TxResult = (_class = class {
265
266
 
266
267
 
267
268
  async setSeenInBlock(block) {
268
- const { blockHash, blockNumber, events } = block;
269
- if (blockHash !== this.blockHash) {
270
- this.parseEvents(events);
271
- this.blockHash = blockHash;
272
- this.blockNumber = await _asyncNullishCoalesce(blockNumber, async () => ( await this.client.rpc.chain.getHeader(blockHash).then((h) => h.number.toNumber())));
273
- this.extrinsicIndex = block.extrinsicIndex;
274
- this.updateProgress();
275
- if (this.extrinsicError) {
276
- this.inBlockReject(this.extrinsicError);
277
- } else {
278
- this.inBlockResolve(blockHash);
279
- }
269
+ if (block.blockNumber === void 0) {
270
+ this.#pendingInBlock = {
271
+ blockHash: block.blockHash,
272
+ extrinsicIndex: block.extrinsicIndex,
273
+ events: block.events
274
+ };
275
+ return;
276
+ }
277
+ if (this.blockHash && this.blockNumber === block.blockNumber && this.extrinsicIndex === block.extrinsicIndex && _util.u8aEq.call(void 0, this.blockHash, block.blockHash)) {
278
+ this.#pendingInBlock = void 0;
279
+ return;
280
+ }
281
+ this.#pendingInBlock = void 0;
282
+ this.parseEvents(block.events);
283
+ this.blockHash = block.blockHash;
284
+ this.blockNumber = block.blockNumber;
285
+ this.extrinsicIndex = block.extrinsicIndex;
286
+ this.updateProgress();
287
+ if (this.extrinsicError) {
288
+ this.inBlockReject(this.extrinsicError);
289
+ } else {
290
+ this.inBlockResolve(block.blockHash);
280
291
  }
281
292
  }
282
- setFinalized() {
293
+ async setFinalized() {
294
+ const pendingInBlock = this.#pendingInBlock;
295
+ if (pendingInBlock) {
296
+ await this.publishSeenInBlock(pendingInBlock);
297
+ } else if (this.blockHash && this.blockNumber === void 0) {
298
+ if (this.extrinsicIndex === void 0) {
299
+ throw new Error("Cannot finalize transaction before extrinsic index is known");
300
+ }
301
+ await this.publishSeenInBlock({
302
+ blockHash: this.blockHash,
303
+ extrinsicIndex: this.extrinsicIndex,
304
+ events: this.events
305
+ });
306
+ }
283
307
  this.isFinalized = true;
284
308
  this.updateProgress();
285
309
  let error = _nullishCoalesce(this.extrinsicError, () => ( this.submissionError));
@@ -302,33 +326,73 @@ var TxResult = (_class = class {
302
326
  if (result2.internalError) this.submissionError = result2.internalError;
303
327
  }
304
328
  if (status.isInBlock) {
305
- void this.setSeenInBlock({
306
- blockHash: Uint8Array.from(status.asInBlock),
307
- events: extrinsicEvents,
308
- extrinsicIndex: txIndex
309
- });
329
+ try {
330
+ const pendingInBlock = createPendingInBlock(
331
+ Uint8Array.from(status.asInBlock),
332
+ txIndex,
333
+ extrinsicEvents
334
+ );
335
+ this.#pendingInBlock = pendingInBlock;
336
+ void this.publishSeenInBlock(pendingInBlock).catch((error) => {
337
+ if (!isMissingBlockHeaderError(error)) {
338
+ this.submissionError = error;
339
+ }
340
+ });
341
+ } catch (error) {
342
+ this.submissionError = error;
343
+ }
310
344
  }
311
345
  if (status.isUsurped) {
346
+ this.#pendingInBlock = void 0;
312
347
  this.submissionError = new TxSubmissionError(
313
348
  TxSubmissionErrorCode.Usurped,
314
349
  `Transaction was usurped by ${status.asUsurped.toHex()}.`
315
350
  );
316
351
  }
317
352
  if (status.isDropped) {
353
+ this.#pendingInBlock = void 0;
318
354
  this.submissionError = new TxSubmissionError(
319
355
  TxSubmissionErrorCode.Dropped,
320
356
  "Transaction was dropped before it was included in a block."
321
357
  );
322
358
  }
323
359
  if (status.isInvalid) {
360
+ this.#pendingInBlock = void 0;
324
361
  this.submissionError = new TxSubmissionError(
325
362
  TxSubmissionErrorCode.Invalid,
326
363
  "Transaction was rejected as invalid by the node."
327
364
  );
328
365
  }
329
366
  if (isFinalized) {
330
- this.setFinalized();
367
+ try {
368
+ this.#pendingInBlock = createPendingInBlock(
369
+ Uint8Array.from(status.asFinalized),
370
+ _nullishCoalesce(_nullishCoalesce(txIndex, () => ( _optionalChain([this, 'access', _ => _.#pendingInBlock, 'optionalAccess', _2 => _2.extrinsicIndex]))), () => ( this.extrinsicIndex)),
371
+ extrinsicEvents.length ? extrinsicEvents : this.events
372
+ );
373
+ } catch (error) {
374
+ this.submissionError = error;
375
+ return;
376
+ }
377
+ void this.setFinalized().catch((error) => {
378
+ this.submissionError = error;
379
+ });
380
+ }
381
+ }
382
+ async publishSeenInBlock(block) {
383
+ const pendingInBlock = this.#pendingInBlock;
384
+ if (!pendingInBlock || pendingInBlock.extrinsicIndex !== block.extrinsicIndex || !_util.u8aEq.call(void 0, pendingInBlock.blockHash, block.blockHash)) {
385
+ return;
331
386
  }
387
+ const blockNumber = await this.client.rpc.chain.getHeader(block.blockHash).then((h) => h.number.toNumber());
388
+ const currentPendingInBlock = this.#pendingInBlock;
389
+ if (!currentPendingInBlock || currentPendingInBlock.extrinsicIndex !== block.extrinsicIndex || !_util.u8aEq.call(void 0, currentPendingInBlock.blockHash, block.blockHash)) {
390
+ return;
391
+ }
392
+ await this.setSeenInBlock({
393
+ ...block,
394
+ blockNumber
395
+ });
332
396
  }
333
397
  updateProgress() {
334
398
  if (this.isFinalized || this.submissionError) {
@@ -342,7 +406,7 @@ var TxResult = (_class = class {
342
406
  } else if (this.extrinsic.submittedAtBlockNumber) {
343
407
  this.txProgress = 10;
344
408
  }
345
- _optionalChain([this, 'access', _ => _.txProgressCallback, 'optionalCall', _2 => _2(this.txProgress)]);
409
+ _optionalChain([this, 'access', _3 => _3.txProgressCallback, 'optionalCall', _4 => _4(this.txProgress)]);
346
410
  }
347
411
  parseEvents(events) {
348
412
  let encounteredError;
@@ -375,6 +439,19 @@ var TxResult = (_class = class {
375
439
  this.events = events;
376
440
  }
377
441
  }, _class);
442
+ function createPendingInBlock(blockHash, extrinsicIndex, events) {
443
+ if (extrinsicIndex === void 0) {
444
+ throw new Error("Cannot publish transaction block state before extrinsic index is known");
445
+ }
446
+ return {
447
+ blockHash,
448
+ extrinsicIndex,
449
+ events
450
+ };
451
+ }
452
+ function isMissingBlockHeaderError(error) {
453
+ return String(error).includes("Unable to retrieve header and parent from supplied hash");
454
+ }
378
455
 
379
456
  // src/TxSubmitter.ts
380
457
  var TxSubmitter = class {
@@ -591,7 +668,7 @@ var Vault = class _Vault {
591
668
  PERMILL_DECIMALS
592
669
  ),
593
670
  treasuryBonusProfitSharing: fromFixedNumber(
594
- _nullishCoalesce(_optionalChain([currentBonusSharingPercent, 'optionalAccess', _3 => _3.toBigInt, 'call', _4 => _4()]), () => ( 0n)),
671
+ _nullishCoalesce(_optionalChain([currentBonusSharingPercent, 'optionalAccess', _5 => _5.toBigInt, 'call', _6 => _6()]), () => ( 0n)),
595
672
  PERMILL_DECIMALS
596
673
  )
597
674
  };
@@ -624,7 +701,7 @@ var Vault = class _Vault {
624
701
  PERMILL_DECIMALS
625
702
  ),
626
703
  treasuryBonusProfitSharing: fromFixedNumber(
627
- _nullishCoalesce(_optionalChain([pendingBonusSharingPercent, 'optionalAccess', _5 => _5.toBigInt, 'call', _6 => _6()]), () => ( 0n)),
704
+ _nullishCoalesce(_optionalChain([pendingBonusSharingPercent, 'optionalAccess', _7 => _7.toBigInt, 'call', _8 => _8()]), () => ( 0n)),
628
705
  PERMILL_DECIMALS
629
706
  )
630
707
  };
@@ -636,7 +713,7 @@ var Vault = class _Vault {
636
713
  this.lastNameChangeTick = vault.lastNameChangeTick.unwrap().toNumber();
637
714
  }
638
715
  const legacyDelegateAccount = vault.bitcoinLockDelegateAccount;
639
- if (_optionalChain([legacyDelegateAccount, 'optionalAccess', _7 => _7.isSome])) {
716
+ if (_optionalChain([legacyDelegateAccount, 'optionalAccess', _9 => _9.isSome])) {
640
717
  this.delegateAccountId = legacyDelegateAccount.unwrap().toHuman();
641
718
  }
642
719
  if ("delegateAccountId" in vault && vault.delegateAccountId.isSome) {
@@ -1091,7 +1168,7 @@ var BitcoinLock = class _BitcoinLock {
1091
1168
  const atHeight = header.number.toNumber();
1092
1169
  this.getVaultCosignSignature(client, atHeight).then((signature) => {
1093
1170
  if (signature) {
1094
- _optionalChain([unsub, 'optionalCall', _8 => _8()]);
1171
+ _optionalChain([unsub, 'optionalCall', _10 => _10()]);
1095
1172
  clearTimeout(timeout);
1096
1173
  resolve({ signature, blockHeight: atHeight });
1097
1174
  }
@@ -1101,7 +1178,7 @@ var BitcoinLock = class _BitcoinLock {
1101
1178
  });
1102
1179
  if (waitForSignatureMillis !== -1) {
1103
1180
  timeout = setTimeout(() => {
1104
- _optionalChain([unsub, 'optionalCall', _9 => _9()]);
1181
+ _optionalChain([unsub, 'optionalCall', _11 => _11()]);
1105
1182
  reject(new Error(`Timeout waiting for cosign signature for UTXO ID ${this.utxoId}`));
1106
1183
  }, waitForSignatureMillis);
1107
1184
  }
@@ -1165,11 +1242,11 @@ var BitcoinLock = class _BitcoinLock {
1165
1242
  pendingConfirmationExpirationBlocks: client.consts.bitcoinUtxos.maxPendingConfirmationBlocks.toNumber(),
1166
1243
  tickDurationMillis: await client.query.ticks.genesisTicker().then((x) => x.tickDurationMillis.toNumber()),
1167
1244
  bitcoinNetwork,
1168
- lockSatoshiAllowedVariance: _nullishCoalesce(_optionalChain([client, 'access', _10 => _10.consts, 'access', _11 => _11.bitcoinUtxos, 'access', _12 => _12.maximumSatoshiThresholdFromExpected, 'optionalAccess', _13 => _13.toNumber, 'call', _14 => _14()]), () => ( 1e4))
1245
+ lockSatoshiAllowedVariance: _nullishCoalesce(_optionalChain([client, 'access', _12 => _12.consts, 'access', _13 => _13.bitcoinUtxos, 'access', _14 => _14.maximumSatoshiThresholdFromExpected, 'optionalAccess', _15 => _15.toNumber, 'call', _16 => _16()]), () => ( 1e4))
1169
1246
  };
1170
1247
  }
1171
1248
  static async getBitcoinConfirmedBlockHeight(client) {
1172
- return await client.query.bitcoinUtxos.confirmedBitcoinBlockTip().then((x) => _nullishCoalesce(_optionalChain([x, 'access', _15 => _15.value, 'optionalAccess', _16 => _16.blockHeight, 'access', _17 => _17.toNumber, 'call', _18 => _18()]), () => ( 0)));
1249
+ return await client.query.bitcoinUtxos.confirmedBitcoinBlockTip().then((x) => _nullishCoalesce(_optionalChain([x, 'access', _17 => _17.value, 'optionalAccess', _18 => _18.blockHeight, 'access', _19 => _19.toNumber, 'call', _20 => _20()]), () => ( 0)));
1173
1250
  }
1174
1251
  static async submitVaultSignature(args) {
1175
1252
  const { utxoId, vaultSignature, txSigner, client } = args;
@@ -1186,15 +1263,15 @@ var BitcoinLock = class _BitcoinLock {
1186
1263
  static async createIncreaseSecuritizationTx(args) {
1187
1264
  const { client, newSatoshis, utxoId } = args;
1188
1265
  const txBuilder = client.tx.bitcoinLocks.increaseSecuritization;
1189
- if (!_optionalChain([txBuilder, 'optionalAccess', _19 => _19.meta])) {
1266
+ if (!_optionalChain([txBuilder, 'optionalAccess', _21 => _21.meta])) {
1190
1267
  return void 0;
1191
1268
  }
1192
1269
  return txBuilder(utxoId, newSatoshis);
1193
1270
  }
1194
1271
  static async createFundWithUtxoCandidateTx(args) {
1195
1272
  const { client, utxoId, utxoRef } = args;
1196
- const txBuilder = _optionalChain([client, 'access', _20 => _20.tx, 'access', _21 => _21.bitcoinUtxos, 'optionalAccess', _22 => _22.fundWithUtxoCandidate]);
1197
- if (!_optionalChain([txBuilder, 'optionalAccess', _23 => _23.meta])) {
1273
+ const txBuilder = _optionalChain([client, 'access', _22 => _22.tx, 'access', _23 => _23.bitcoinUtxos, 'optionalAccess', _24 => _24.fundWithUtxoCandidate]);
1274
+ if (!_optionalChain([txBuilder, 'optionalAccess', _25 => _25.meta])) {
1198
1275
  return void 0;
1199
1276
  }
1200
1277
  return txBuilder(utxoId, normalizeUtxoRef(utxoRef));
@@ -1209,7 +1286,7 @@ var BitcoinLock = class _BitcoinLock {
1209
1286
  throw new Error("toScriptPubkey must be a hex string starting with 0x");
1210
1287
  }
1211
1288
  const txBuilder = client.tx.bitcoinLocks.requestOrphanedUtxoRelease;
1212
- if (!_optionalChain([txBuilder, 'optionalAccess', _24 => _24.meta])) {
1289
+ if (!_optionalChain([txBuilder, 'optionalAccess', _26 => _26.meta])) {
1213
1290
  return void 0;
1214
1291
  }
1215
1292
  return txBuilder(normalizeUtxoRef(utxoRef), toScriptPubkey, bitcoinNetworkFee);
@@ -1221,7 +1298,7 @@ var BitcoinLock = class _BitcoinLock {
1221
1298
  `Invalid vault signature length: ${vaultSignature.byteLength}. Must be 70-73 bytes.`
1222
1299
  );
1223
1300
  }
1224
- if (!_optionalChain([client, 'access', _25 => _25.tx, 'access', _26 => _26.bitcoinLocks, 'access', _27 => _27.cosignOrphanedUtxoRelease, 'optionalAccess', _28 => _28.meta])) {
1301
+ if (!_optionalChain([client, 'access', _27 => _27.tx, 'access', _28 => _28.bitcoinLocks, 'access', _29 => _29.cosignOrphanedUtxoRelease, 'optionalAccess', _30 => _30.meta])) {
1225
1302
  return void 0;
1226
1303
  }
1227
1304
  const signature = _util.u8aToHex.call(void 0, vaultSignature);
@@ -1248,7 +1325,7 @@ var BitcoinLock = class _BitcoinLock {
1248
1325
  const liquidityPromised = utxo.liquidityPromised.toBigInt();
1249
1326
  const ownerAccount = utxo.ownerAccount.toHuman();
1250
1327
  const satoshis = utxo.satoshis.toBigInt();
1251
- const utxoSatoshis = _optionalChain([utxo, 'access', _29 => _29.utxoSatoshis, 'optionalAccess', _30 => _30.isSome]) ? utxo.utxoSatoshis.value.toBigInt() : void 0;
1328
+ const utxoSatoshis = _optionalChain([utxo, 'access', _31 => _31.utxoSatoshis, 'optionalAccess', _32 => _32.isSome]) ? utxo.utxoSatoshis.value.toBigInt() : void 0;
1252
1329
  const vaultPubkey = utxo.vaultPubkey.toHex();
1253
1330
  const vaultClaimPubkey = utxo.vaultClaimPubkey.toHex();
1254
1331
  const ownerPubkey = utxo.ownerPubkey.toHex();
@@ -1258,16 +1335,16 @@ var BitcoinLock = class _BitcoinLock {
1258
1335
  cosignHdIndex: cosign_hd_index.toNumber(),
1259
1336
  claimHdIndex: claim_hd_index.toNumber()
1260
1337
  };
1261
- const createdAtArgonBlock = _nullishCoalesce(_optionalChain([utxo, 'access', _31 => _31.createdAtArgonBlock, 'optionalAccess', _32 => _32.toNumber, 'call', _33 => _33()]), () => ( 0));
1338
+ const createdAtArgonBlock = _nullishCoalesce(_optionalChain([utxo, 'access', _33 => _33.createdAtArgonBlock, 'optionalAccess', _34 => _34.toNumber, 'call', _35 => _35()]), () => ( 0));
1262
1339
  const securityFees = utxo.securityFees.toBigInt();
1263
1340
  const vaultClaimHeight = utxo.vaultClaimHeight.toNumber();
1264
1341
  const openClaimHeight = utxo.openClaimHeight.toNumber();
1265
1342
  const createdAtHeight = utxo.createdAtHeight.toNumber();
1266
- const isFunded = (_nullishCoalesce(_optionalChain([utxo, 'optionalAccess', _34 => _34.isVerified]), () => ( utxo.isFunded))).toJSON();
1343
+ const isFunded = (_nullishCoalesce(_optionalChain([utxo, 'optionalAccess', _36 => _36.isVerified]), () => ( utxo.isFunded))).toJSON();
1267
1344
  const fundHoldExtensionsByBitcoinExpirationHeight = Object.fromEntries(
1268
1345
  [...utxo.fundHoldExtensions.entries()].map(([x, y]) => [x.toNumber(), y.toBigInt()])
1269
1346
  );
1270
- const couponFeesPaid = _nullishCoalesce(_optionalChain([utxo, 'access', _35 => _35.couponPaidFees, 'optionalAccess', _36 => _36.toBigInt, 'call', _37 => _37()]), () => ( 0n));
1347
+ const couponFeesPaid = _nullishCoalesce(_optionalChain([utxo, 'access', _37 => _37.couponPaidFees, 'optionalAccess', _38 => _38.toBigInt, 'call', _39 => _39()]), () => ( 0n));
1271
1348
  return new _BitcoinLock({
1272
1349
  utxoId,
1273
1350
  p2wshScriptHashHex,
@@ -7499,7 +7576,7 @@ var gatewayActivityEvents = [
7499
7576
  function findEthereumTransferToArgonStartedLogIndexes(receipt, gatewayAddress) {
7500
7577
  const normalizedGatewayAddress = _viem.getAddress.call(void 0, gatewayAddress).toLowerCase();
7501
7578
  const indexes = receipt.logs.flatMap(
7502
- (log, index) => log.address.toLowerCase() === normalizedGatewayAddress && _optionalChain([log, 'access', _38 => _38.topics, 'access', _39 => _39[0], 'optionalAccess', _40 => _40.toLowerCase, 'call', _41 => _41()]) === MintingGatewayEvents.TransferToArgonStarted.topic ? [index] : []
7579
+ (log, index) => log.address.toLowerCase() === normalizedGatewayAddress && _optionalChain([log, 'access', _40 => _40.topics, 'access', _41 => _41[0], 'optionalAccess', _42 => _42.toLowerCase, 'call', _43 => _43()]) === MintingGatewayEvents.TransferToArgonStarted.topic ? [index] : []
7503
7580
  );
7504
7581
  if (indexes.length === 0) {
7505
7582
  throw new Error(
@@ -7519,7 +7596,7 @@ function decodeEthereumTransferToArgonStartedLog(log) {
7519
7596
  return transfer;
7520
7597
  }
7521
7598
  function decodeEthereumGatewayActivityLog(log) {
7522
- const topic = _optionalChain([log, 'access', _42 => _42.topics, 'access', _43 => _43[0], 'optionalAccess', _44 => _44.toLowerCase, 'call', _45 => _45()]);
7599
+ const topic = _optionalChain([log, 'access', _44 => _44.topics, 'access', _45 => _45[0], 'optionalAccess', _46 => _46.toLowerCase, 'call', _47 => _47()]);
7523
7600
  if (!topic) {
7524
7601
  throw new Error("Gateway activity log is missing an event signature topic");
7525
7602
  }
@@ -7890,8 +7967,8 @@ async function loadRetainedExecutionHeaderAnchorAtOrAfterBlock(client, earliestB
7890
7967
  args: [],
7891
7968
  pageSize: 1,
7892
7969
  startKey: executionHeaderAnchorsByBlockNumber.key(scanBlockNumberKey)
7893
- })), 'access', async _46 => _46[0], 'optionalAccess', async _47 => _47[1]]);
7894
- const scannedAnchor = _optionalChain([matchingEntry, 'optionalAccess', _48 => _48.isSome]) ? matchingEntry.unwrap() : null;
7970
+ })), 'access', async _48 => _48[0], 'optionalAccess', async _49 => _49[1]]);
7971
+ const scannedAnchor = _optionalChain([matchingEntry, 'optionalAccess', _50 => _50.isSome]) ? matchingEntry.unwrap() : null;
7895
7972
  if (!scannedAnchor) {
7896
7973
  return null;
7897
7974
  }
@@ -7917,9 +7994,9 @@ async function collectProofChunksForArgonFinalizedExecutionHeader(executionClien
7917
7994
  if (blockNumber > plan.argonFinalizedExecutionHeader.blockNumber) {
7918
7995
  break;
7919
7996
  }
7920
- let targetHeader = _optionalChain([loadedTargetHeaders, 'access', _49 => _49.find, 'call', _50 => _50(
7997
+ let targetHeader = _optionalChain([loadedTargetHeaders, 'access', _51 => _51.find, 'call', _52 => _52(
7921
7998
  (loadedHeader) => loadedHeader.blockHash.toLowerCase() === blockHash.toLowerCase()
7922
- ), 'optionalAccess', _51 => _51.targetHeader]);
7999
+ ), 'optionalAccess', _53 => _53.targetHeader]);
7923
8000
  if (!targetHeader) {
7924
8001
  targetHeader = await loadExecutionHeader(executionClient, blockHash);
7925
8002
  loadedTargetHeaders.push({ blockHash, targetHeader });
@@ -7992,7 +8069,7 @@ function buildExecutionPayloadHeader(header) {
7992
8069
 
7993
8070
  // src/EthereumGatewayBackfill.ts
7994
8071
  async function buildGatewayExecutionHeaderBackfill(client, options) {
7995
- const targetExecutionBlockNumber = await _asyncNullishCoalesce(options.targetExecutionBlockNumber, async () => ( await _asyncOptionalChain([(await discoverGatewayActivities(client, options)), 'optionalAccess', async _52 => _52.activities, 'access', async _53 => _53[0], 'optionalAccess', async _54 => _54.blockNumber])));
8072
+ const targetExecutionBlockNumber = await _asyncNullishCoalesce(options.targetExecutionBlockNumber, async () => ( await _asyncOptionalChain([(await discoverGatewayActivities(client, options)), 'optionalAccess', async _54 => _54.activities, 'access', async _55 => _55[0], 'optionalAccess', async _56 => _56.blockNumber])));
7996
8073
  if (targetExecutionBlockNumber == null) {
7997
8074
  return null;
7998
8075
  }
@@ -8261,7 +8338,7 @@ async function getNextEthereumBeaconSyncTxs(client, beaconApiUrl) {
8261
8338
  await new Promise((resolve) => setTimeout(resolve, lightClientUpdateRetryIntervalMs));
8262
8339
  continue;
8263
8340
  }
8264
- const periodUpdate = _optionalChain([periodUpdates, 'access', _55 => _55[0], 'optionalAccess', _56 => _56.data]);
8341
+ const periodUpdate = _optionalChain([periodUpdates, 'access', _57 => _57[0], 'optionalAccess', _58 => _58.data]);
8265
8342
  const periodUpdateFinalizedSlot = periodUpdate ? BigInt(periodUpdate.finalized_header.beacon.slot) : void 0;
8266
8343
  const hasBridgeablePeriodUpdate = periodUpdateFinalizedSlot !== void 0 && periodUpdateFinalizedSlot <= maxBridgeableFinalizedSlot;
8267
8344
  let periodUpdateHasRequiredCommittee = !needsCommitteeData;
@@ -8361,7 +8438,7 @@ function buildFork(spec, name) {
8361
8438
  };
8362
8439
  }
8363
8440
  function hasNextSyncCommitteeUpdate(update) {
8364
- return !!_optionalChain([update, 'optionalAccess', _57 => _57.next_sync_committee]) && !!_optionalChain([update, 'optionalAccess', _58 => _58.next_sync_committee_branch]);
8441
+ return !!_optionalChain([update, 'optionalAccess', _59 => _59.next_sync_committee]) && !!_optionalChain([update, 'optionalAccess', _60 => _60.next_sync_committee_branch]);
8365
8442
  }
8366
8443
  function getRequiredCommitteePeriod({
8367
8444
  storedPeriod,