@xyo-network/xl1-protocol-sdk 1.26.31 → 1.26.33

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.
@@ -107,7 +107,7 @@ var ActorV3 = class extends AbstractCreatable {
107
107
  this._intervals.set(timerName, intervalId);
108
108
  }, dueTimeMs);
109
109
  this._timeouts.set(timerName, timeoutId);
110
- this.logger?.log(
110
+ this.logger?.debug(
111
111
  `Timer '${this.name}:${timerName}' registered: first call after ${dueTimeMs}ms, recurring every ${periodMs}ms.`
112
112
  );
113
113
  }
@@ -117,11 +117,11 @@ var ActorV3 = class extends AbstractCreatable {
117
117
  */
118
118
  async stopHandler() {
119
119
  await super.stopHandler();
120
- this.logger?.log("Stopping all timers...");
120
+ this.logger?.debug("Stopping all timers...");
121
121
  await Promise.all(
122
122
  [...this._semaphores.values()].map(async (semaphore) => {
123
123
  while (semaphore.isLocked()) {
124
- this.logger?.log("Waiting for running timer task to complete...");
124
+ this.logger?.debug("Waiting for running timer task to complete...");
125
125
  await delay(500);
126
126
  }
127
127
  await semaphore.acquire();
@@ -136,7 +136,7 @@ var ActorV3 = class extends AbstractCreatable {
136
136
  clearInterval(intervalRef);
137
137
  }
138
138
  this._intervals.clear();
139
- this.logger?.log("Stopped.");
139
+ this.logger?.debug("Stopped.");
140
140
  }
141
141
  };
142
142
  var Actor = class extends ActorV3 {
@@ -1074,9 +1074,7 @@ var blockRate = (startBlock, endBlock, timeUnit) => {
1074
1074
  };
1075
1075
  var getBlockRateBlocks = async (viewer, startBlockHeight, endBlockHeight) => {
1076
1076
  if (endBlockHeight <= startBlockHeight) {
1077
- console.error("startBlockHeight", startBlockHeight);
1078
- console.error("endBlockHeight", endBlockHeight);
1079
- throw new Error("End block height must be greater than start block height");
1077
+ throw new Error(`End block height must be greater than start block height [start=${startBlockHeight}, end=${endBlockHeight}]`);
1080
1078
  }
1081
1079
  const startingBlock = await viewer.blockByNumber(startBlockHeight);
1082
1080
  const endingBlock = await viewer.blockByNumber(endBlockHeight);
@@ -1145,7 +1143,6 @@ var calculateTimeRate = async (viewer, timeConfig, startBlockNumber, timeUnit, t
1145
1143
  );
1146
1144
  };
1147
1145
  var findEndBlockRecursive = async (viewer, startBlock, targetTimeMs, estimatedBlocksBack, toleranceMs, attemptsRemaining) => {
1148
- console.log(`Attempts remaining: ${attemptsRemaining}, Estimated blocks back: ${estimatedBlocksBack}`);
1149
1146
  assertEx9(attemptsRemaining >= 0, () => "Maximum attempts reached while searching for end block");
1150
1147
  const startBlockEpoch = startBlock.$epoch;
1151
1148
  const estimatedEndBlockNumber = asXL1BlockNumber3(startBlock.block - estimatedBlocksBack, true);
@@ -2199,12 +2196,12 @@ var DEFAULT_CONFIRMATION_ATTEMPTS = 20;
2199
2196
  var DEFAULT_DELAY_BETWEEN_ATTEMPTS = 1e3;
2200
2197
  var confirmSubmittedTransaction = async (viewer, txHash, options) => {
2201
2198
  const { attempts: maxAttempts = DEFAULT_CONFIRMATION_ATTEMPTS, delay: attemptDelay = DEFAULT_DELAY_BETWEEN_ATTEMPTS } = options ?? {};
2202
- options?.logger?.log("\u{1F680} confirming transaction:", txHash, "\n");
2199
+ options?.logger?.debug("Confirming transaction", txHash);
2203
2200
  let attempts = 0;
2204
2201
  while (true) {
2205
2202
  const tx = await viewer.transaction.byHash(txHash) ?? void 0;
2206
2203
  if (isDefined14(tx)) {
2207
- options?.logger?.log("\u2705 Transaction confirmed:", txHash, "\n");
2204
+ options?.logger?.debug("Transaction confirmed", txHash);
2208
2205
  return tx;
2209
2206
  } else {
2210
2207
  attempts++;
@@ -2212,7 +2209,7 @@ var confirmSubmittedTransaction = async (viewer, txHash, options) => {
2212
2209
  options?.logger?.error(`\u26A0\uFE0F Transaction not confirmed after ${maxAttempts} attempts`);
2213
2210
  throw new Error(`Transaction ${txHash} not confirmed after ${maxAttempts} attempts`);
2214
2211
  } else {
2215
- options?.logger?.log(`\u{1F504} Transaction not confirmed yet, attempt ${attempts}. Retrying...`, "\n");
2212
+ options?.logger?.debug(`Transaction not confirmed yet, attempt ${attempts}. Retrying...`, txHash);
2216
2213
  await delay2(attemptDelay);
2217
2214
  }
2218
2215
  }
@@ -2712,7 +2709,7 @@ var registerCreatableProviderFactory = (registry, factory, labels, primary = fal
2712
2709
  const primaryMonikers = primary !== true && isTruthy(primary) ? Array.isArray(primary) ? primary : [primary] : [];
2713
2710
  for (const primaryMoniker of primaryMonikers) {
2714
2711
  if (!factory.monikers.includes(primaryMoniker)) {
2715
- console.warn(`Primary moniker ${String(primary)} not found in factory monikers`);
2712
+ throw new Error(`Primary moniker ${String(primaryMoniker)} not found in factory monikers`);
2716
2713
  }
2717
2714
  }
2718
2715
  const isPrimaryForMoniker = (moniker) => {
@@ -2853,7 +2850,7 @@ var ProviderFactoryLocator = class _ProviderFactoryLocator {
2853
2850
  if (this.context.singletons[factory.uniqueId]) {
2854
2851
  return this.context.singletons[factory.uniqueId];
2855
2852
  }
2856
- this.logger?.info(`Creating provider instance for moniker [${moniker}]${labels ? ` with labels [${JSON.stringify(labels)}]` : ""} using factory [${factory.uniqueId.description}]`);
2853
+ this.logger?.debug(`Creating provider instance for moniker [${moniker}]${labels ? ` with labels [${JSON.stringify(labels)}]` : ""} using factory [${factory.uniqueId.description}]`);
2857
2854
  const result = await factory.getInstance(resolvedParams, { start });
2858
2855
  this.context.singletons[factory.uniqueId] = result;
2859
2856
  return result;
@@ -3734,6 +3731,7 @@ var prettifyZodError = (error) => {
3734
3731
  };
3735
3732
 
3736
3733
  // src/simple/block/SimpleBlockViewer.ts
3734
+ var MIN_HEAD_POLL_INTERVAL_MS = 5e3;
3737
3735
  var SimpleBlockViewer = class extends AbstractCreatableProvider {
3738
3736
  moniker = SimpleBlockViewer.defaultMoniker;
3739
3737
  _store;
@@ -3741,10 +3739,16 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
3741
3739
  finalizationViewer;
3742
3740
  payloadCache = new LruCacheMap({ max: 1e4 });
3743
3741
  signedHydratedBlockWithDataLakePayloadsCache = new LruCacheMap({ max: 2e3, ttl: 1e3 * 60 * 60 });
3742
+ _headPollHash;
3743
+ _headPollInProgress = false;
3744
+ _headPollTimer = null;
3744
3745
  _signedHydratedBlockCache;
3745
3746
  get finalizedArchivist() {
3746
3747
  return this.params.finalizedArchivist;
3747
3748
  }
3749
+ get headPollIntervalMs() {
3750
+ return this.params.headPollIntervalMs;
3751
+ }
3748
3752
  get hydratedBlockCache() {
3749
3753
  if (this._signedHydratedBlockCache) return this._signedHydratedBlockCache;
3750
3754
  const context = this.getBlockContextRead();
@@ -3758,9 +3762,14 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
3758
3762
  return this._store;
3759
3763
  }
3760
3764
  static async paramsHandler(params) {
3765
+ const headPollIntervalMs = params.headPollIntervalMs;
3766
+ if (headPollIntervalMs !== void 0) {
3767
+ assertEx32(headPollIntervalMs >= MIN_HEAD_POLL_INTERVAL_MS, () => `headPollIntervalMs must be at least ${MIN_HEAD_POLL_INTERVAL_MS}ms`);
3768
+ }
3761
3769
  return {
3762
3770
  ...await super.paramsHandler(params),
3763
- finalizedArchivist: assertEx32(params.finalizedArchivist, () => "finalizedArchivist is required")
3771
+ finalizedArchivist: assertEx32(params.finalizedArchivist, () => "finalizedArchivist is required"),
3772
+ headPollIntervalMs
3764
3773
  };
3765
3774
  }
3766
3775
  async blockByHash(hash) {
@@ -3879,11 +3888,57 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
3879
3888
  head: (await this.finalizationViewer.head())[0]
3880
3889
  };
3881
3890
  }
3891
+ async startHandler() {
3892
+ await super.startHandler();
3893
+ if (this.headPollIntervalMs === void 0) return;
3894
+ await this.pollHead(false);
3895
+ this.startHeadPolling();
3896
+ }
3897
+ async stopHandler() {
3898
+ this.stopHeadPolling();
3899
+ this._headPollHash = void 0;
3900
+ await super.stopHandler();
3901
+ }
3882
3902
  async blockByNumberWithContext(chainContext, blockNumber) {
3883
3903
  const block = asSignedHydratedBlockWithHashMeta(await hydratedBlockByNumber(chainContext, blockNumber)) ?? null;
3884
3904
  const [result] = block ? await addDataLakePayloads(block, this.dataLakeViewer) : [null, []];
3885
3905
  return result;
3886
3906
  }
3907
+ async pollHead(emitOnChange) {
3908
+ if (this._headPollInProgress) return;
3909
+ this._headPollInProgress = true;
3910
+ try {
3911
+ const block = await this.currentBlock();
3912
+ const hash = block[0]._hash;
3913
+ if (this._headPollHash === void 0) {
3914
+ this._headPollHash = hash;
3915
+ return;
3916
+ }
3917
+ if (hash !== this._headPollHash) {
3918
+ this._headPollHash = hash;
3919
+ if (emitOnChange) {
3920
+ await this.emit("headUpdated", { block });
3921
+ }
3922
+ }
3923
+ } catch (ex) {
3924
+ this.logger?.error("Error polling block head", ex);
3925
+ } finally {
3926
+ this._headPollInProgress = false;
3927
+ }
3928
+ }
3929
+ startHeadPolling() {
3930
+ if (this.headPollIntervalMs === void 0) return;
3931
+ this.stopHeadPolling();
3932
+ this._headPollTimer = setInterval(() => {
3933
+ void this.pollHead(true);
3934
+ }, this.headPollIntervalMs);
3935
+ }
3936
+ stopHeadPolling() {
3937
+ if (this._headPollTimer) {
3938
+ clearInterval(this._headPollTimer);
3939
+ this._headPollTimer = null;
3940
+ }
3941
+ }
3887
3942
  };
3888
3943
  __publicField(SimpleBlockViewer, "defaultMoniker", BlockViewerMoniker2);
3889
3944
  __publicField(SimpleBlockViewer, "dependencies", [FinalizationViewerMoniker]);
@@ -4015,7 +4070,9 @@ var SimpleBlockValidationViewer = class extends AbstractCreatableProvider {
4015
4070
  const windowedUncleChain = await this.updateWindowedChainCache();
4016
4071
  const uncles = findUncles(this.context, windowedUncleChain, blocks);
4017
4072
  if (uncles.length !== 1) {
4018
- this.logger?.warn(JSON.stringify({ uncles, blocks: blocks.length }, null, 2));
4073
+ this.logger?.warn(`Unexpected uncle count during block validation [uncles=${uncles.length}, blocks=${blocks.length}]`);
4074
+ this.logger?.debug(JSON.stringify({ uncles, blocks: blocks.length }, null, 2));
4075
+ this.logger?.debug(JSON.stringify(windowedUncleChain, null, 2));
4019
4076
  throw new Error(`No uncles or greater than one uncle found in block validation, which is not supported [${uncles.length}, ${blocks.length}]`);
4020
4077
  }
4021
4078
  return await Promise.all(uncles[0].map(async (block) => {
@@ -4381,7 +4438,7 @@ var SimpleFinalizationViewer = class extends AbstractCreatableProvider {
4381
4438
  const cache = this.hydratedBlockCache;
4382
4439
  const block = await cache.get(currentHead._hash);
4383
4440
  if (!block) {
4384
- console.log(`Could not find current block with hash ${currentHead._hash}`);
4441
+ this.logger?.error(`Could not find current block with hash ${currentHead._hash}`);
4385
4442
  }
4386
4443
  return assertEx36(block, () => "Could not find current block");
4387
4444
  }, this.context);
@@ -4623,7 +4680,7 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
4623
4680
  cursor,
4624
4681
  order: "desc"
4625
4682
  });
4626
- this.logger?.info(`Starting prunePendingBlocks with batchSize=${batchSize}, maxPrune=${maxPrune}, maxCheck=${maxCheck}`);
4683
+ this.logger?.debug(`Starting prunePendingBlocks with batchSize=${batchSize}, maxPrune=${maxPrune}, maxCheck=${maxCheck}`);
4627
4684
  while (batch.length > 0 && pruned < maxPrune && total < maxCheck) {
4628
4685
  const blocksAndBundles = await this.simpleBlockValidationCheck(batch);
4629
4686
  const blocks = blocksAndBundles.map(([b]) => b);
@@ -4647,8 +4704,8 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
4647
4704
  for (const [i, r] of validationResults.entries()) {
4648
4705
  const validated = isSignedHydratedBlockWithHashMeta(r);
4649
4706
  if (!validated) {
4650
- this.logger?.info(`Pruning block ${bundles[remainingBlockMap[i]]._hash} during block validation`);
4651
- this.logger?.info(` - validation result: ${r.at(0)?.message}`);
4707
+ this.logger?.debug(`Pruning block ${bundles[remainingBlockMap[i]]._hash} during block validation`);
4708
+ this.logger?.debug(` - validation result: ${r.at(0)?.message}`);
4652
4709
  }
4653
4710
  valid[remainingBlockMap[i]] = validated;
4654
4711
  }
@@ -4667,7 +4724,7 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
4667
4724
  order: "desc"
4668
4725
  }) : [];
4669
4726
  }
4670
- this.logger?.info(`prunePendingBlocks completed: pruned=${pruned}, totalChecked=${total}`);
4727
+ this.logger?.debug(`prunePendingBlocks completed: pruned=${pruned}, totalChecked=${total}`);
4671
4728
  return [pruned, total];
4672
4729
  }
4673
4730
  async prunePendingTransactions({
@@ -4683,7 +4740,7 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
4683
4740
  cursor,
4684
4741
  order: "desc"
4685
4742
  });
4686
- this.logger?.info(`Starting prunePendingTransactions with batchSize=${batchSize}, maxPrune=${maxPrune}, maxCheck=${maxCheck}`);
4743
+ this.logger?.debug(`Starting prunePendingTransactions with batchSize=${batchSize}, maxPrune=${maxPrune}, maxCheck=${maxCheck}`);
4687
4744
  while (batch.length > 0 && pruned < maxPrune && total < maxCheck) {
4688
4745
  const transactionsAndBundles = await this.simpleTransactionValidationCheck(batch);
4689
4746
  const transactions = transactionsAndBundles.map(([t]) => t);
@@ -4707,8 +4764,8 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
4707
4764
  for (const [i, r] of validationResults.entries()) {
4708
4765
  const validated = isSignedHydratedTransactionWithHashMeta(r);
4709
4766
  if (!validated) {
4710
- this.logger?.info(`Pruning transaction ${bundles[remainingTransactionMap[i]]._hash} during transaction validation`);
4711
- this.logger?.info(` - validation result: ${r.at(0)?.message}`);
4767
+ this.logger?.debug(`Pruning transaction ${bundles[remainingTransactionMap[i]]._hash} during transaction validation`);
4768
+ this.logger?.debug(` - validation result: ${r.at(0)?.message}`);
4712
4769
  }
4713
4770
  valid[remainingTransactionMap[i]] = validated;
4714
4771
  }
@@ -4727,7 +4784,7 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
4727
4784
  order: "desc"
4728
4785
  }) : [];
4729
4786
  }
4730
- this.logger?.info(`prunePendingTransactions completed: pruned=${pruned}, totalChecked=${total}`);
4787
+ this.logger?.debug(`prunePendingTransactions completed: pruned=${pruned}, totalChecked=${total}`);
4731
4788
  return [pruned, total];
4732
4789
  }
4733
4790
  async submitBlocks(blocks) {
@@ -4745,7 +4802,7 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
4745
4802
  const maxExp = headNumber + this.maxExpAhead;
4746
4803
  const validTransactions = transactions.filter(([tx]) => {
4747
4804
  if (tx.exp > maxExp) {
4748
- this.logger?.info(`Rejecting transaction with exp ${tx.exp} exceeding max allowed ${maxExp}`);
4805
+ this.logger?.debug(`Rejecting transaction with exp ${tx.exp} exceeding max allowed ${maxExp}`);
4749
4806
  return false;
4750
4807
  }
4751
4808
  return true;
@@ -4789,11 +4846,11 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
4789
4846
  const validationPassed = blockCheckPassed && chainIdPassed && blockNumberPassed && typeCheckPassed;
4790
4847
  const validatedBlock = validationPassed ? block : void 0;
4791
4848
  if (!validationPassed) {
4792
- this.logger?.info(`Pruning block bundle ${bundle3._hash} during simpleValidationCheck`);
4793
- this.logger?.info(` - chainId match: ${chainIdPassed}`);
4794
- this.logger?.info(` - blockNumber check: ${blockNumberPassed} [${headNumber}|${block?.[0].block}]`);
4795
- this.logger?.info(` - typeCheck: ${typeCheckPassed}`);
4796
- this.logger?.info(` - bundle hash: ${bundle3._hash}`);
4849
+ this.logger?.debug(`Pruning block bundle ${bundle3._hash} during simpleValidationCheck`);
4850
+ this.logger?.debug(` - chainId match: ${chainIdPassed}`);
4851
+ this.logger?.debug(` - blockNumber check: ${blockNumberPassed} [${headNumber}|${block?.[0].block}]`);
4852
+ this.logger?.debug(` - typeCheck: ${typeCheckPassed}`);
4853
+ this.logger?.debug(` - bundle hash: ${bundle3._hash}`);
4797
4854
  }
4798
4855
  return [validatedBlock, bundle3];
4799
4856
  });
@@ -4814,18 +4871,18 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
4814
4871
  await validateTransactionsOpcodes(transaction ? [transaction] : []);
4815
4872
  opcodeCheckPassed = true;
4816
4873
  } catch (e) {
4817
- this.logger?.info(`Opcode validation failed for transaction ${bundle3._hash} during simpleValidationCheck`);
4818
- this.logger?.info(` - error: ${e.message}`);
4874
+ this.logger?.debug(`Opcode validation failed for transaction ${bundle3._hash} during simpleValidationCheck`);
4875
+ this.logger?.debug(` - error: ${e.message}`);
4819
4876
  }
4820
4877
  const validationPassed = transactionCheckPassed && chainIdPassed && expPassed && typeCheckPassed && opcodeCheckPassed;
4821
4878
  const validatedTransaction = validationPassed ? transaction : void 0;
4822
4879
  if (!validationPassed) {
4823
- this.logger?.info(`Pruning block bundle ${bundle3._hash} during simpleValidationCheck`);
4824
- this.logger?.info(` - chainId match: ${chainIdPassed}`);
4825
- this.logger?.info(` - exp check: ${expPassed}`);
4826
- this.logger?.info(` - opcode check: ${opcodeCheckPassed}`);
4827
- this.logger?.info(` - typeCheck: ${typeCheckPassed}`);
4828
- this.logger?.info(` - bundle hash: ${bundle3._hash}`);
4880
+ this.logger?.debug(`Pruning block bundle ${bundle3._hash} during simpleValidationCheck`);
4881
+ this.logger?.debug(` - chainId match: ${chainIdPassed}`);
4882
+ this.logger?.debug(` - exp check: ${expPassed}`);
4883
+ this.logger?.debug(` - opcode check: ${opcodeCheckPassed}`);
4884
+ this.logger?.debug(` - typeCheck: ${typeCheckPassed}`);
4885
+ this.logger?.debug(` - bundle hash: ${bundle3._hash}`);
4829
4886
  }
4830
4887
  return [validatedTransaction, bundle3];
4831
4888
  }));
@@ -4835,7 +4892,7 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
4835
4892
  if (externalBlocks.length === 0) return;
4836
4893
  const bundles = externalBlocks.map((block) => hydratedBlockToPayloadBundle(block));
4837
4894
  await this.pendingBlocksArchivist.insert(bundles);
4838
- this.logger?.info(`Synced ${externalBlocks.length} blocks from external mempool`);
4895
+ this.logger?.debug(`Synced ${externalBlocks.length} blocks from external mempool`);
4839
4896
  }
4840
4897
  async syncFromExternal() {
4841
4898
  if (this._syncMutex.isLocked()) return;
@@ -4855,7 +4912,7 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
4855
4912
  if (externalTxs.length === 0) return;
4856
4913
  const bundles = externalTxs.map((tx) => hydratedTransactionToPayloadBundle(tx));
4857
4914
  await this.pendingTransactionsArchivist.insert(bundles);
4858
- this.logger?.info(`Synced ${externalTxs.length} transactions from external mempool`);
4915
+ this.logger?.debug(`Synced ${externalTxs.length} transactions from external mempool`);
4859
4916
  }
4860
4917
  };
4861
4918
  __publicField(SimpleMempoolRunner, "defaultMoniker", MempoolRunnerMoniker);
@@ -4920,13 +4977,13 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
4920
4977
  cursor = p._sequence;
4921
4978
  }
4922
4979
  }
4923
- this.logger?.info(`Fetching pending transactions from cursor: ${cursor}`);
4980
+ this.logger?.debug(`Fetching pending transactions from cursor: ${cursor}`);
4924
4981
  const bundles = await this.pendingTransactionsArchivist.next({
4925
4982
  order: "asc",
4926
4983
  limit: limit * 5,
4927
4984
  cursor
4928
4985
  });
4929
- this.logger?.info(`Fetched pending transactions: ${bundles.length} bundles`);
4986
+ this.logger?.debug(`Fetched pending transactions: ${bundles.length} bundles`);
4930
4987
  const filteredBundles = bundles.filter(isPayloadBundle2).filter(isHashMeta2);
4931
4988
  const hydratedWithBundle = (await Promise.all(
4932
4989
  filteredBundles.map(async (bundle3) => {
@@ -4944,11 +5001,11 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
4944
5001
  );
4945
5002
  const validTransactions = evaluated.filter((x) => !x.deletable);
4946
5003
  const deletionCandidates = evaluated.filter((x) => x.deletable);
4947
- this.logger?.info(`Pending transactions: ${validTransactions.length} valid, ${deletionCandidates.length} not deletable`);
5004
+ this.logger?.debug(`Pending transactions: ${validTransactions.length} valid, ${deletionCandidates.length} not deletable`);
4948
5005
  await Promise.all(
4949
5006
  deletionCandidates.map(async ({ bundle: bundle3, tx }) => {
4950
5007
  await this.deleteBundledTransaction(bundle3);
4951
- this.logger?.info(`Purged completed/expired bundled transaction: ${bundle3._hash}/${tx[0]._hash}`);
5008
+ this.logger?.debug(`Purged completed/expired bundled transaction: ${bundle3._hash}/${tx[0]._hash}`);
4952
5009
  })
4953
5010
  );
4954
5011
  const inclusionCandidates = (await Promise.all(validTransactions.map((x) => x.tx).map(async (tx) => {
@@ -4961,7 +5018,7 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
4961
5018
  inclusionCandidates.filter(() => Math.random() < selectionRatio)
4962
5019
  ).slice(0, effectiveLimit);
4963
5020
  const result = randomInclusionCandidates.length > 0 ? randomInclusionCandidates : deduplicateBySigner(inclusionCandidates).slice(0, 1);
4964
- this.logger?.info(`Inclusion candidates: ${inclusionCandidates.length}`);
5021
+ this.logger?.debug(`Inclusion candidates: ${inclusionCandidates.length}`);
4965
5022
  return result;
4966
5023
  }
4967
5024
  async deleteBundledTransaction(bundle3) {
@@ -5055,10 +5112,15 @@ var StatusNetworks = {
5055
5112
 
5056
5113
  // src/simple/network/SimpleXyoNetwork.ts
5057
5114
  var SimpleXyoNetwork = class {
5115
+ _logger;
5058
5116
  _networkId;
5059
- constructor(networkId) {
5117
+ constructor(networkId, logger) {
5118
+ this._logger = logger;
5060
5119
  this._networkId = networkId;
5061
5120
  }
5121
+ get logger() {
5122
+ return this._logger;
5123
+ }
5062
5124
  async status() {
5063
5125
  const statusNetwork = StatusNetworks[this._networkId];
5064
5126
  if (isUndefined7(statusNetwork)) {
@@ -5073,13 +5135,13 @@ var SimpleXyoNetwork = class {
5073
5135
  return response.data;
5074
5136
  } else {
5075
5137
  if (response.status === 200) {
5076
- console.error("Unknown network status response:", response.data);
5138
+ this.logger?.error("Unknown network status response", response.data);
5077
5139
  return unknownStatus;
5078
5140
  }
5079
5141
  return errorStatus;
5080
5142
  }
5081
5143
  } catch (error) {
5082
- console.error("Error fetching network status:", error);
5144
+ this.logger?.error("Error fetching network status", error);
5083
5145
  return errorStatus;
5084
5146
  }
5085
5147
  }
@@ -6030,7 +6092,7 @@ var SimpleWindowedBlockViewer = class extends AbstractCreatableProvider {
6030
6092
  this.addBlock(block);
6031
6093
  }
6032
6094
  } catch (ex) {
6033
- console.error("Error during sync:", ex);
6095
+ this.logger?.error("Error during sync", ex);
6034
6096
  }
6035
6097
  });
6036
6098
  }