@xyo-network/xl1-protocol-sdk 3.0.16 → 3.1.0

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.
@@ -6781,41 +6781,13 @@ RestSyncViewer = __decorateClass([
6781
6781
  creatableProvider()
6782
6782
  ], RestSyncViewer);
6783
6783
 
6784
- // src/simple/systemStatus/ConsoleSystemStatusPublisher.ts
6785
- import { assertEx as assertEx50 } from "@xylabs/sdk-js";
6786
- import { SystemStatusPublisherMoniker } from "@xyo-network/xl1-protocol-lib";
6787
- var ConsoleSystemStatusPublisher = class extends AbstractCreatableProvider {
6788
- moniker = ConsoleSystemStatusPublisher.defaultMoniker;
6789
- async startHandler() {
6790
- await super.startHandler();
6791
- const runner = assertEx50(
6792
- this.context.statusReporter,
6793
- () => "ConsoleSystemStatusPublisher requires a SystemStatusRunner (context.statusReporter)"
6794
- );
6795
- runner.onGlobalTransition({ to: "started" }, () => {
6796
- this.logger?.info("All services started.");
6797
- });
6798
- runner.onGlobalTransition({ to: "error" }, () => {
6799
- this.logger?.error("A service entered an error state.");
6800
- });
6801
- }
6802
- };
6803
- __publicField(ConsoleSystemStatusPublisher, "connectionTypes", ["memory"]);
6804
- __publicField(ConsoleSystemStatusPublisher, "defaultMoniker", SystemStatusPublisherMoniker);
6805
- __publicField(ConsoleSystemStatusPublisher, "dependencies", []);
6806
- __publicField(ConsoleSystemStatusPublisher, "monikers", [SystemStatusPublisherMoniker]);
6807
- __publicField(ConsoleSystemStatusPublisher, "surface", "node");
6808
- ConsoleSystemStatusPublisher = __decorateClass([
6809
- creatableProvider()
6810
- ], ConsoleSystemStatusPublisher);
6811
-
6812
6784
  // src/simple/systemStatus/SimpleSystemStatusViewer.ts
6813
- import { assertEx as assertEx51 } from "@xylabs/sdk-js";
6785
+ import { assertEx as assertEx50 } from "@xylabs/sdk-js";
6814
6786
  import { SystemStatusViewerMoniker } from "@xyo-network/xl1-protocol-lib";
6815
6787
  var SimpleSystemStatusViewer = class extends AbstractCreatableProvider {
6816
6788
  moniker = SimpleSystemStatusViewer.defaultMoniker;
6817
6789
  get runner() {
6818
- return assertEx51(this.context.statusReporter, () => "SystemStatusViewer requires a SystemStatusRunner (context.statusReporter)");
6790
+ return assertEx50(this.context.statusReporter, () => "SystemStatusViewer requires a SystemStatusRunner (context.statusReporter)");
6819
6791
  }
6820
6792
  getGlobalStatus() {
6821
6793
  return this.runner.getGlobalStatus();
@@ -6845,7 +6817,7 @@ SimpleSystemStatusViewer = __decorateClass([
6845
6817
  // src/simple/timeSync2/SimpleTimeSyncViewer.ts
6846
6818
  import {
6847
6819
  asHash as asHash5,
6848
- assertEx as assertEx52,
6820
+ assertEx as assertEx51,
6849
6821
  isDefined as isDefined22
6850
6822
  } from "@xylabs/sdk-js";
6851
6823
  import {
@@ -6867,7 +6839,7 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
6867
6839
  async convertTime(fromDomain, toDomain, from) {
6868
6840
  switch (fromDomain) {
6869
6841
  case "xl1": {
6870
- const [block, payloads] = assertEx52(await this.blockViewer.blockByNumber(asXL1BlockNumber11(from, true)), () => "Block not found");
6842
+ const [block, payloads] = assertEx51(await this.blockViewer.blockByNumber(asXL1BlockNumber11(from, true)), () => "Block not found");
6871
6843
  const timeSchemaIndex = block.payload_schemas.indexOf(TimeSchema);
6872
6844
  const hash = timeSchemaIndex === -1 ? void 0 : block.payload_hashes[timeSchemaIndex];
6873
6845
  const timePayload = asTimePayload2(isDefined22(hash) ? payloads.find((p) => p._hash === hash) : void 0);
@@ -6923,10 +6895,10 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
6923
6895
  return [Date.now(), null];
6924
6896
  }
6925
6897
  case "ethereum": {
6926
- const provider = assertEx52(this.ethProvider, () => "Ethereum provider not configured");
6898
+ const provider = assertEx51(this.ethProvider, () => "Ethereum provider not configured");
6927
6899
  const blockNumber = await provider.getBlockNumber() ?? 0;
6928
6900
  const block = await provider.getBlock(blockNumber);
6929
- const blockHash = asHash5(assertEx52(block?.hash, () => "Block hash not found"), true);
6901
+ const blockHash = asHash5(assertEx51(block?.hash, () => "Block hash not found"), true);
6930
6902
  return [blockNumber, blockHash];
6931
6903
  }
6932
6904
  default: {
@@ -6941,7 +6913,7 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
6941
6913
  // this is for the previous block
6942
6914
  xl1,
6943
6915
  // this is for the previous block
6944
- xl1Hash: assertEx52(xl1Hash, () => "No xl1 hash available from time sync service"),
6916
+ xl1Hash: assertEx51(xl1Hash, () => "No xl1 hash available from time sync service"),
6945
6917
  epoch: Date.now()
6946
6918
  };
6947
6919
  if (isDefined22(this.ethProvider)) {
@@ -6963,7 +6935,7 @@ SimpleTimeSyncViewer = __decorateClass([
6963
6935
  ], SimpleTimeSyncViewer);
6964
6936
 
6965
6937
  // src/simple/transactionValidation/SimpleTransactionValidationViewer.ts
6966
- import { assertEx as assertEx53 } from "@xylabs/sdk-js";
6938
+ import { assertEx as assertEx52 } from "@xylabs/sdk-js";
6967
6939
  import { PayloadBuilder as PayloadBuilder24 } from "@xyo-network/sdk-js";
6968
6940
  import {
6969
6941
  AccountBalanceViewerMoniker as AccountBalanceViewerMoniker3,
@@ -7017,7 +6989,7 @@ var SimpleTransactionValidationViewer = class extends AbstractCreatableProvider
7017
6989
  let head;
7018
6990
  if (isChainQualifiedHeadConfig6(config)) {
7019
6991
  const headBlockResult = await this.blockViewer.blockByHash(config.head);
7020
- head = headBlockResult == null ? assertEx53(
6992
+ head = headBlockResult == null ? assertEx52(
7021
6993
  void 0,
7022
6994
  () => `Specified a head that is not in the chain [${config.head}]`
7023
6995
  ) : headBlockResult[0];
@@ -7089,7 +7061,7 @@ SimpleTransactionValidationViewer = __decorateClass([
7089
7061
  ], SimpleTransactionValidationViewer);
7090
7062
 
7091
7063
  // src/simple/TransactionViewer/SimpleTransactionViewer.ts
7092
- import { assertEx as assertEx54, exists as exists10 } from "@xylabs/sdk-js";
7064
+ import { assertEx as assertEx53, exists as exists10 } from "@xylabs/sdk-js";
7093
7065
  import { BoundWitnessSchema } from "@xyo-network/sdk-js";
7094
7066
  import {
7095
7067
  asSignedHydratedTransactionWithHashMeta as asSignedHydratedTransactionWithHashMeta2,
@@ -7106,7 +7078,7 @@ var SimpleTransactionViewer = class extends AbstractCreatableProvider {
7106
7078
  }
7107
7079
  async byBlockHashAndIndex(blockHash, transactionIndex) {
7108
7080
  return await this.spanAsync("byBlockHashAndIndex", async () => {
7109
- assertEx54(transactionIndex >= 0, () => "transactionIndex must be greater than or equal to 0");
7081
+ assertEx53(transactionIndex >= 0, () => "transactionIndex must be greater than or equal to 0");
7110
7082
  try {
7111
7083
  const block = await this.blockViewer.blockByHash(blockHash);
7112
7084
  if (!block) return null;
@@ -7171,7 +7143,7 @@ SimpleTransactionViewer = __decorateClass([
7171
7143
 
7172
7144
  // src/simple/windowedBlock/SimpleWindowedBlockViewer.ts
7173
7145
  import {
7174
- assertEx as assertEx55,
7146
+ assertEx as assertEx54,
7175
7147
  exists as exists11,
7176
7148
  isNull as isNull2
7177
7149
  } from "@xylabs/sdk-js";
@@ -7253,7 +7225,7 @@ var SimpleWindowedBlockViewer = class extends AbstractCreatableProvider {
7253
7225
  }
7254
7226
  async createHandler() {
7255
7227
  await super.createHandler();
7256
- this._blockViewer = assertEx55(
7228
+ this._blockViewer = assertEx54(
7257
7229
  this.params.blockViewer ?? await this.locator.getInstance(BlockViewerMoniker7),
7258
7230
  () => "BlockViewer instance is required"
7259
7231
  );
@@ -7262,13 +7234,13 @@ var SimpleWindowedBlockViewer = class extends AbstractCreatableProvider {
7262
7234
  this._transactionHashMap = new MemoryMap2();
7263
7235
  }
7264
7236
  currentBlock() {
7265
- return assertEx55(this._chain.at(-1));
7237
+ return assertEx54(this._chain.at(-1));
7266
7238
  }
7267
7239
  currentBlockHash() {
7268
- return assertEx55(this._chain.at(-1)?.[0]._hash);
7240
+ return assertEx54(this._chain.at(-1)?.[0]._hash);
7269
7241
  }
7270
7242
  currentBlockNumber() {
7271
- return assertEx55(this._chain.at(-1)?.[0].block);
7243
+ return assertEx54(this._chain.at(-1)?.[0].block);
7272
7244
  }
7273
7245
  async payloadByHash(hash) {
7274
7246
  const payloads = await this.payloadsByHash([hash]);
@@ -7363,7 +7335,16 @@ var LoggerStatusReporter = class {
7363
7335
  };
7364
7336
 
7365
7337
  // src/status/SimpleSystemStatusRunner.ts
7366
- import { SystemStatusRunnerMoniker } from "@xyo-network/xl1-protocol-lib";
7338
+ import {
7339
+ SystemStatusPublisherMoniker,
7340
+ SystemStatusRunnerMoniker,
7341
+ SystemStatusViewerMoniker as SystemStatusViewerMoniker2
7342
+ } from "@xyo-network/xl1-protocol-lib";
7343
+ var STATUS_INFRASTRUCTURE_NAMES = /* @__PURE__ */ new Set([
7344
+ SystemStatusRunnerMoniker,
7345
+ SystemStatusViewerMoniker2,
7346
+ SystemStatusPublisherMoniker
7347
+ ]);
7367
7348
  var statusPriority = {
7368
7349
  error: 0,
7369
7350
  stopped: 1,
@@ -7396,7 +7377,7 @@ var SimpleSystemStatusRunner = class extends LoggerStatusReporter {
7396
7377
  transitions = [];
7397
7378
  updatedAtMap = {};
7398
7379
  getGlobalStatus() {
7399
- const statuses = Object.values(this.statusMap);
7380
+ const statuses = Object.entries(this.statusMap).filter(([name]) => !STATUS_INFRASTRUCTURE_NAMES.has(name)).map(([, status]) => status);
7400
7381
  if (statuses.length === 0) return SENTINEL_STATUS;
7401
7382
  return reduceToMinimumStatus(statuses);
7402
7383
  }
@@ -7476,7 +7457,7 @@ var SimpleSystemStatusRunner = class extends LoggerStatusReporter {
7476
7457
  };
7477
7458
 
7478
7459
  // src/test/buildRandomChain.ts
7479
- import { asAddress as asAddress2, assertEx as assertEx58 } from "@xylabs/sdk-js";
7460
+ import { asAddress as asAddress2, assertEx as assertEx57 } from "@xylabs/sdk-js";
7480
7461
  import {
7481
7462
  Account as Account4,
7482
7463
  asSchema as asSchema9,
@@ -7495,7 +7476,7 @@ import {
7495
7476
  } from "@xyo-network/xl1-protocol-lib";
7496
7477
 
7497
7478
  // src/test/buildBlock.ts
7498
- import { assertEx as assertEx56, isDefined as isDefined23 } from "@xylabs/sdk-js";
7479
+ import { assertEx as assertEx55, isDefined as isDefined23 } from "@xylabs/sdk-js";
7499
7480
  import {
7500
7481
  asAnyPayload as asAnyPayload5,
7501
7482
  BoundWitnessBuilder as BoundWitnessBuilder4,
@@ -7578,7 +7559,7 @@ function buildStepHashes(blockNumber, inStepHashes, previousBlockHash, chainStep
7578
7559
  const completedStepReward = calculateCompletedStepReward(i, stepRewardPoolBalance);
7579
7560
  completedStepRewardTransfers.push(createTransferPayload(chainStepRewardAddress2, { [completedStepRewardHolderAddress]: completedStepReward }));
7580
7561
  }
7581
- step_hashes.push(assertEx56(previousBlockHash, () => `Previous block hash is required for step ${step} at block ${blockNumber}`));
7562
+ step_hashes.push(assertEx55(previousBlockHash, () => `Previous block hash is required for step ${step} at block ${blockNumber}`));
7582
7563
  } else if (isDefined23(inStepHashes.at(i))) {
7583
7564
  step_hashes.push(inStepHashes[i]);
7584
7565
  }
@@ -7632,7 +7613,7 @@ async function buildBlock(options) {
7632
7613
  protocol
7633
7614
  }).meta({ $epoch: Date.now(), $signatures: [] }).signers(signers).payloads(await PayloadBuilder25.addStorageMeta(payloads));
7634
7615
  const [bw, txPayloads] = await builder.build();
7635
- assertEx56(isBlockBoundWitness(bw), () => "Build of BlockBoundWitness failed");
7616
+ assertEx55(isBlockBoundWitness(bw), () => "Build of BlockBoundWitness failed");
7636
7617
  return [await PayloadBuilder25.addStorageMeta(bw), txPayloads.map((p) => asAnyPayload5(p, true))];
7637
7618
  }
7638
7619
 
@@ -7653,7 +7634,7 @@ async function buildNextBlock(previousBlock, txs, blockPayloads, signers, chainS
7653
7634
  }
7654
7635
 
7655
7636
  // src/test/buildRandomGenesisBlock.ts
7656
- import { asAddress, assertEx as assertEx57 } from "@xylabs/sdk-js";
7637
+ import { asAddress, assertEx as assertEx56 } from "@xylabs/sdk-js";
7657
7638
  import {
7658
7639
  Account as Account3,
7659
7640
  asAnyPayload as asAnyPayload6,
@@ -7697,7 +7678,7 @@ var buildRandomTransaction = async (chain, payloads, account, nbf = asXL1BlockNu
7697
7678
  };
7698
7679
 
7699
7680
  // src/test/buildRandomGenesisBlock.ts
7700
- var TestChainId = assertEx57(asAddress("c5fe2e6F6841Cbab12d8C0618Be2DF8C6156cC44"));
7681
+ var TestChainId = assertEx56(asAddress("c5fe2e6F6841Cbab12d8C0618Be2DF8C6156cC44"));
7701
7682
 
7702
7683
  // src/test/createGenesisBlock.ts
7703
7684
  import { PayloadBuilder as PayloadBuilder28 } from "@xyo-network/sdk-js";
@@ -7752,7 +7733,7 @@ var createGenesisBlock = async (initialBlockProducer, nextContractAddress, genes
7752
7733
  };
7753
7734
 
7754
7735
  // src/test/buildRandomChain.ts
7755
- var TestGenesisBlockRewardAddress = assertEx58(asAddress2("fa7f0bb865a4bfff3d5e2c726d3e063297014da9"));
7736
+ var TestGenesisBlockRewardAddress = assertEx57(asAddress2("fa7f0bb865a4bfff3d5e2c726d3e063297014da9"));
7756
7737
  var buildRandomChain = async (blockProducer, count = 10, previousBlock, chainId, transactionAccount, receiverAddresses) => {
7757
7738
  const chainIdToUse = chainId ?? TestChainId;
7758
7739
  const blocks = [];
@@ -7796,7 +7777,7 @@ var buildRandomChain = async (blockProducer, count = 10, previousBlock, chainId,
7796
7777
  receiverAddress
7797
7778
  ));
7798
7779
  }
7799
- const previousBlock2 = assertEx58(lastBlock?.[0], () => new Error("No last block"));
7780
+ const previousBlock2 = assertEx57(lastBlock?.[0], () => new Error("No last block"));
7800
7781
  const block = await buildNextBlock(previousBlock2, txs, [], [blockProducer], transactionAccountToUse.address);
7801
7782
  blocks.push(block);
7802
7783
  remaining = remaining - 1;
@@ -7857,13 +7838,13 @@ function getTestProviderContext2(config) {
7857
7838
  }
7858
7839
 
7859
7840
  // src/time/primitives/xl1BlockNumberToEthBlockNumber.ts
7860
- import { assertEx as assertEx59 } from "@xylabs/sdk-js";
7841
+ import { assertEx as assertEx58 } from "@xylabs/sdk-js";
7861
7842
  import { asTimePayload as asTimePayload3, TimeSchema as TimeSchema2 } from "@xyo-network/xl1-protocol-lib";
7862
7843
  async function xl1BlockNumberToEthBlockNumber(context, xl1BlockNumber) {
7863
7844
  const blockHash = await hashFromBlockNumber(context, xl1BlockNumber);
7864
7845
  const hydratedBlock = await hydrateBlock(context, blockHash);
7865
7846
  const timePayload = asTimePayload3(hydratedBlock[1].find((p) => p.schema === TimeSchema2), { required: true });
7866
- return assertEx59(timePayload.ethereum, () => "No ethereum timestamp found on block");
7847
+ return assertEx58(timePayload.ethereum, () => "No ethereum timestamp found on block");
7867
7848
  }
7868
7849
 
7869
7850
  // src/validation/lib/isLocalhost.ts
@@ -7929,7 +7910,6 @@ export {
7929
7910
  ConfigZod,
7930
7911
  ConnectionConfigZod,
7931
7912
  ConnectionsConfigZod,
7932
- ConsoleSystemStatusPublisher,
7933
7913
  CreatableProviderContextZod,
7934
7914
  DEFAULT_BACKOFF_MS,
7935
7915
  DEFAULT_MAX_ATTEMPTS,