@xyo-network/xl1-cli-lib 1.19.7 → 1.19.8

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.
@@ -2,12 +2,11 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
4
  // src/runCLI.ts
5
- import { isDefined as isDefined3, toAddress } from "@xylabs/sdk-js";
5
+ import { deepMerge, isDefined as isDefined3, toAddress } from "@xylabs/sdk-js";
6
6
  import { runApi } from "@xyo-network/chain-api";
7
7
  import { Orchestrator } from "@xyo-network/chain-orchestration";
8
8
  import { runProducer } from "@xyo-network/chain-producer";
9
9
  import { ConfigZod as ConfigZod2, isZodError } from "@xyo-network/xl1-sdk";
10
- import { merge as deepMerge } from "ts-deepmerge";
11
10
  import yargs from "yargs";
12
11
  import { hideBin } from "yargs/helpers";
13
12
 
@@ -56,12 +55,12 @@ var XL1LogoColorizedAscii = `\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\
56
55
  import { Base, ConsoleLogger, isDefined, LogLevel, SilentLogger } from "@xylabs/sdk-js";
57
56
  var initLogger = /* @__PURE__ */ __name((config2) => {
58
57
  let logger;
59
- if (config2.silent) {
58
+ if (config2.log.silent) {
60
59
  logger = new SilentLogger();
61
60
  } else {
62
61
  let level;
63
- if (isDefined(config2.logLevel)) {
64
- const parsed = LogLevel[config2.logLevel.toLowerCase()];
62
+ if (isDefined(config2.log.logLevel)) {
63
+ const parsed = LogLevel[config2.log.logLevel.toLowerCase()];
65
64
  if (isDefined(parsed)) level = parsed;
66
65
  }
67
66
  logger = new ConsoleLogger(level);
@@ -70,6 +69,189 @@ var initLogger = /* @__PURE__ */ __name((config2) => {
70
69
  return logger;
71
70
  }, "initLogger");
72
71
 
72
+ // src/locatorFromConfig.ts
73
+ import { asAddress, assertEx, isString } from "@xylabs/sdk-js";
74
+ import { initApiWallet, initBalanceSummaryMap, initEvmProvidersIfAvailable, initFinalizationArchivistIfNeeded, initProducerAccount, initServerNode, initStatusReporter, initTransferSummaryMap } from "@xyo-network/chain-orchestration";
75
+ import { SimpleBlockRunner } from "@xyo-network/chain-services";
76
+ import { initTelemetry } from "@xyo-network/chain-telemetry";
77
+ import { validateHydratedBlock, validateHydratedBlockState } from "@xyo-network/chain-validation";
78
+ import { ProviderFactoryLocator, SimpleAccountBalanceViewer, SimpleBlockRewardViewer, SimpleBlockValidationViewer, SimpleBlockViewer, SimpleFinalizationViewer, SimpleMempoolRunner, SimpleMempoolViewer, SimpleNetworkStakeViewer, SimpleStepRewardsByPositionViewer, SimpleStepRewardsByStakerViewer, SimpleStepRewardsByStepViewer, SimpleStepRewardsTotalViewer, SimpleStepRewardsViewer, SimpleStepViewer, SimpleTimeSyncViewer, SimpleWindowedBlockViewer, SimpleXyoViewer } from "@xyo-network/xl1-sdk";
79
+ async function telemetryContextFromConfig(config2, serviceName, serviceVersion) {
80
+ const { otlpEndpoint } = config2.telemetry?.otel ?? {};
81
+ const { path: endpoint = "/metrics", port = 9466 } = config2.telemetry?.metrics?.scrape ?? {};
82
+ return await initTelemetry({
83
+ attributes: {
84
+ serviceName,
85
+ serviceVersion
86
+ },
87
+ otlpEndpoint,
88
+ metricsConfig: {
89
+ endpoint,
90
+ port
91
+ }
92
+ });
93
+ }
94
+ __name(telemetryContextFromConfig, "telemetryContextFromConfig");
95
+ async function contextFromConfigWithoutLocator(config2, logger, serviceName, serviceVersion) {
96
+ const singletons = {};
97
+ const caches = {};
98
+ const telemetryConfig = await telemetryContextFromConfig(config2, serviceName, serviceVersion);
99
+ const statusReporter = initStatusReporter({
100
+ logger
101
+ });
102
+ return {
103
+ ...telemetryConfig,
104
+ config: config2,
105
+ singletons,
106
+ caches,
107
+ logger,
108
+ statusReporter
109
+ };
110
+ }
111
+ __name(contextFromConfigWithoutLocator, "contextFromConfigWithoutLocator");
112
+ async function rootLocatorFromConfig(config2, context) {
113
+ let locator = new ProviderFactoryLocator(context);
114
+ locator.registerMany([
115
+ SimpleNetworkStakeViewer.factory(SimpleNetworkStakeViewer.dependencies, {}),
116
+ SimpleTimeSyncViewer.factory(SimpleTimeSyncViewer.dependencies, {}),
117
+ SimpleStepViewer.factory(SimpleStepViewer.dependencies, {}),
118
+ SimpleStepRewardsViewer.factory(SimpleStepRewardsViewer.dependencies, {}),
119
+ SimpleStepRewardsByPositionViewer.factory(SimpleStepRewardsByPositionViewer.dependencies, {}),
120
+ SimpleStepRewardsByStakerViewer.factory(SimpleStepRewardsByStakerViewer.dependencies, {}),
121
+ SimpleStepRewardsByStepViewer.factory(SimpleStepRewardsByStepViewer.dependencies, {}),
122
+ SimpleStepRewardsTotalViewer.factory(SimpleStepRewardsTotalViewer.dependencies, {}),
123
+ SimpleBlockValidationViewer.factory(SimpleBlockValidationViewer.dependencies, {
124
+ state: validateHydratedBlockState,
125
+ protocol: validateHydratedBlock
126
+ })
127
+ ]);
128
+ locator = await initEvmProvidersIfAvailable(locator);
129
+ locator = await (isString(config2.remote.rpc?.url) ? remoteLocatorFromConfig(config2, {
130
+ ...context,
131
+ locator
132
+ }) : localLocatorFromConfig(config2, {
133
+ ...context,
134
+ locator
135
+ }));
136
+ locator.freeze();
137
+ return locator;
138
+ }
139
+ __name(rootLocatorFromConfig, "rootLocatorFromConfig");
140
+ async function localLocatorFromConfig(config2, context) {
141
+ const balancesSummaryMap = assertEx(await initBalanceSummaryMap(context), () => "Balance Summary Map not initialized");
142
+ const transfersSummaryMap = assertEx(await initTransferSummaryMap(context), () => "Transfer Summary Map not initialized");
143
+ const wallet = await initApiWallet(context);
144
+ const { writableChainArchivist, readonlyChainArchivist, pendingTransactionsArchivist, pendingBlocksArchivist } = await initServerNode({
145
+ ...context,
146
+ wallet,
147
+ transfersSummaryMap,
148
+ balancesSummaryMap
149
+ });
150
+ await initFinalizationArchivistIfNeeded(writableChainArchivist, config2, wallet);
151
+ const locator = new ProviderFactoryLocator(context);
152
+ locator.registerMany([
153
+ SimpleMempoolViewer.factory(SimpleMempoolViewer.dependencies, {
154
+ pendingTransactionsArchivist,
155
+ pendingBlocksArchivist
156
+ }),
157
+ SimpleMempoolRunner.factory(SimpleMempoolRunner.dependencies, {
158
+ pendingTransactionsArchivist,
159
+ pendingBlocksArchivist
160
+ }),
161
+ SimpleAccountBalanceViewer.factory(SimpleAccountBalanceViewer.dependencies, {
162
+ balancesSummaryMap,
163
+ transfersSummaryMap
164
+ }),
165
+ SimpleFinalizationViewer.factory(SimpleFinalizationViewer.dependencies, {
166
+ finalizedArchivist: readonlyChainArchivist
167
+ }),
168
+ SimpleBlockViewer.factory(SimpleBlockViewer.dependencies, {
169
+ finalizedArchivist: readonlyChainArchivist
170
+ }),
171
+ SimpleWindowedBlockViewer.factory(SimpleWindowedBlockViewer.dependencies, {
172
+ maxWindowSize: 1e4,
173
+ syncInterval: 1e4
174
+ }),
175
+ SimpleXyoViewer.factory(SimpleXyoViewer.dependencies, {})
176
+ ]);
177
+ locator.freeze();
178
+ return locator;
179
+ }
180
+ __name(localLocatorFromConfig, "localLocatorFromConfig");
181
+ async function remoteLocatorFromConfig(config2, context) {
182
+ const balancesSummaryMap = assertEx(await initBalanceSummaryMap(context), () => "Balance Summary Map not initialized");
183
+ const transfersSummaryMap = assertEx(await initTransferSummaryMap(context), () => "Transfer Summary Map not initialized");
184
+ const wallet = await initApiWallet(context);
185
+ const { readonlyChainArchivist, pendingTransactionsArchivist, pendingBlocksArchivist } = await initServerNode({
186
+ ...context,
187
+ wallet,
188
+ transfersSummaryMap,
189
+ balancesSummaryMap
190
+ });
191
+ const locator = new ProviderFactoryLocator(context);
192
+ locator.registerMany([
193
+ SimpleMempoolViewer.factory(SimpleMempoolViewer.dependencies, {
194
+ pendingTransactionsArchivist,
195
+ pendingBlocksArchivist
196
+ }),
197
+ SimpleMempoolRunner.factory(SimpleMempoolRunner.dependencies, {
198
+ pendingTransactionsArchivist,
199
+ pendingBlocksArchivist
200
+ }),
201
+ SimpleAccountBalanceViewer.factory(SimpleAccountBalanceViewer.dependencies, {
202
+ balancesSummaryMap,
203
+ transfersSummaryMap
204
+ }),
205
+ SimpleFinalizationViewer.factory(SimpleFinalizationViewer.dependencies, {
206
+ finalizedArchivist: readonlyChainArchivist
207
+ }),
208
+ SimpleBlockViewer.factory(SimpleBlockViewer.dependencies, {
209
+ finalizedArchivist: readonlyChainArchivist
210
+ }),
211
+ SimpleWindowedBlockViewer.factory(SimpleWindowedBlockViewer.dependencies, {
212
+ maxWindowSize: 1e4,
213
+ syncInterval: 1e4
214
+ }),
215
+ SimpleXyoViewer.factory(SimpleXyoViewer.dependencies, {})
216
+ ]);
217
+ locator.freeze();
218
+ return locator;
219
+ }
220
+ __name(remoteLocatorFromConfig, "remoteLocatorFromConfig");
221
+ async function producerLocatorFromConfig(config2, context) {
222
+ const { logger } = context;
223
+ const account = await initProducerAccount({
224
+ config: config2
225
+ });
226
+ const locator = new ProviderFactoryLocator(context);
227
+ const rewardAddress = asAddress(config2.actors.producer.rewardAddress ?? account.address, true);
228
+ logger?.info(`Using reward address ${rewardAddress}`);
229
+ if (rewardAddress === account.address) {
230
+ logger?.warn(`Using producer account address as reward address: ${account.address}`);
231
+ }
232
+ locator.registerMany([
233
+ SimpleBlockRewardViewer.factory(SimpleBlockRewardViewer.dependencies, {}),
234
+ SimpleBlockRunner.factory(SimpleBlockRunner.dependencies, {
235
+ account,
236
+ rewardAddress
237
+ })
238
+ ]);
239
+ locator.freeze();
240
+ return locator;
241
+ }
242
+ __name(producerLocatorFromConfig, "producerLocatorFromConfig");
243
+ async function locatorsFromConfig(actors, config2, context) {
244
+ const result = {
245
+ _root: await rootLocatorFromConfig(config2, context)
246
+ };
247
+ const producer = actors.includes("producer") ? await producerLocatorFromConfig(config2, result._root.context) : void 0;
248
+ if (producer) {
249
+ result.producer = producer;
250
+ }
251
+ return result;
252
+ }
253
+ __name(locatorsFromConfig, "locatorsFromConfig");
254
+
73
255
  // src/optionsFromGlobalZodRegistry.ts
74
256
  import { isUsageMeta } from "@xyo-network/xl1-sdk";
75
257
  import { globalRegistry } from "zod";
@@ -128,7 +310,7 @@ var waitForHostPort = /* @__PURE__ */ __name((host, port) => {
128
310
 
129
311
  // src/runCLI.ts
130
312
  var configuration;
131
- var version = isDefined3("1.19.6") ? "1.19.6" : "unknown";
313
+ var version = isDefined3("1.19.7") ? "1.19.7" : "unknown";
132
314
  function resolveConfig(config2) {
133
315
  const logger = console;
134
316
  const defaultChainId = toAddress("1");
@@ -163,6 +345,31 @@ var getContextFromConfig = /* @__PURE__ */ __name(async (configuration2) => {
163
345
  orchestrator
164
346
  };
165
347
  }, "getContextFromConfig");
348
+ var getLocatorsFromConfig = /* @__PURE__ */ __name(async (actors, configuration2) => {
349
+ const logger = initLogger(configuration2);
350
+ const orchestrator = await Orchestrator.create({
351
+ logger
352
+ });
353
+ const context = await contextFromConfigWithoutLocator(configuration2, logger, "xl1-cli", version);
354
+ const locators = await locatorsFromConfig(actors, configuration2, context);
355
+ process.on("SIGINT", () => {
356
+ void (async () => {
357
+ try {
358
+ logger.log("\nSIGINT received. Attempting graceful shutdown...");
359
+ await orchestrator?.stop();
360
+ logger.log("Orchestrator stopped, exiting now.");
361
+ process.exit(0);
362
+ } catch (err) {
363
+ logger.error("Error stopping orchestrator:", err);
364
+ process.exit(1);
365
+ }
366
+ })();
367
+ });
368
+ return {
369
+ locators,
370
+ orchestrator
371
+ };
372
+ }, "getLocatorsFromConfig");
166
373
  async function runCLI() {
167
374
  const y = yargs(hideBin(process.argv));
168
375
  const argv = y.usage(`
@@ -194,6 +401,15 @@ $0 <command> [options]`).parserConfiguration({
194
401
  throw validatedConfigResult.error;
195
402
  }
196
403
  configuration = validatedConfigResult.data;
404
+ const { actors, ...rootConfig } = configuration;
405
+ const actorNames = Object.keys(actors);
406
+ for (const actorName of actorNames) {
407
+ configuration.actors[actorName] = deepMerge(rootConfig ?? {}, configuration.actors[actorName] ?? {});
408
+ }
409
+ if (argv2["dump-config"]) {
410
+ console.log(JSON.stringify(configuration, null, 2));
411
+ process.exit(0);
412
+ }
197
413
  } catch (err) {
198
414
  if (isZodError(err)) {
199
415
  console.error(`Zod error: ${err.message}`);
@@ -234,12 +450,10 @@ $0 <command> [options]`).parserConfiguration({
234
450
  }).command("producer", "Run a XL1 Producer Node", (yargs2) => {
235
451
  return yargs2.command("$0", "Run a XL1 Producer Node", () => {
236
452
  }, async () => {
237
- const context = await getContextFromConfig(configuration);
238
- await runProducer({
239
- ...context,
240
- config: configuration,
241
- singletons: {}
242
- });
453
+ const { locators, orchestrator } = await getLocatorsFromConfig([
454
+ "producer"
455
+ ], configuration);
456
+ await runProducer(configuration, orchestrator, locators["producer"]);
243
457
  });
244
458
  }).command("reward-redemption-api", "Run a XL1 Rewards Redemption API Node", (yargs2) => {
245
459
  return yargs2.command("$0", "Run a XL1 Rewards Redemption API Node", () => {
@@ -252,25 +466,37 @@ $0 <command> [options]`).parserConfiguration({
252
466
  });
253
467
  }).command("$0", "Run a full XL1 Node", () => {
254
468
  }, async () => {
469
+ const actors = [
470
+ "producer",
471
+ "api"
472
+ ];
473
+ if (configuration.actors.mempool.enabled) {
474
+ actors.push("mempool");
475
+ }
255
476
  const context = await getContextFromConfig(configuration);
256
- if (configuration.mempool.enabled) {
477
+ const { locators, orchestrator } = await getLocatorsFromConfig([
478
+ "producer"
479
+ ], configuration);
480
+ if (configuration.actors.mempool.enabled) {
257
481
  runMempool({
258
482
  ...context,
259
483
  config: configuration
260
484
  });
261
- await waitForHostPort(configuration.mempool.host, configuration.mempool.port);
485
+ await waitForHostPort(configuration.actors.mempool.host, configuration.actors.mempool.port);
262
486
  }
263
487
  await runApi({
264
488
  ...context,
265
489
  config: configuration,
266
490
  singletons: {}
267
491
  });
268
- await waitForHostPort(configuration.api.host, configuration.api.port);
269
- await runProducer({
270
- ...context,
271
- config: configuration,
272
- singletons: {}
273
- });
492
+ await waitForHostPort(configuration.actors.api.host, configuration.actors.api.port);
493
+ await runProducer(configuration, orchestrator, locators["producer"]);
494
+ }).options({
495
+ "dump-config": {
496
+ type: "boolean",
497
+ description: "Just process the configuration and print the resolved config to stdout, then exit.",
498
+ default: false
499
+ }
274
500
  }).help().alias("help", "h").version(version).argv;
275
501
  await argv;
276
502
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runCLI.ts","../../src/commands/bridge/runBridge.ts","../../src/commands/mempool/runMempool.ts","../../src/commands/rewardRedemption/runRewardRedemptionApi.ts","../../src/images.ts","../../src/initLogger.ts","../../src/optionsFromGlobalZodRegistry.ts","../../src/tryParseConfig.ts","../../src/waitForHostPort.ts","../../src/start.ts"],"sourcesContent":["import type { Logger } from '@xylabs/sdk-js'\nimport { isDefined, toAddress } from '@xylabs/sdk-js'\nimport { runApi } from '@xyo-network/chain-api'\nimport { Orchestrator } from '@xyo-network/chain-orchestration'\nimport { runProducer } from '@xyo-network/chain-producer'\nimport type { Config } from '@xyo-network/xl1-sdk'\nimport { ConfigZod, isZodError } from '@xyo-network/xl1-sdk'\nimport { merge as deepMerge } from 'ts-deepmerge'\nimport type { Argv } from 'yargs'\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\n\nimport {\n runBridge, runMempool, runRewardRedemptionApi,\n} from './commands/index.ts'\nimport { XL1LogoColorizedAscii } from './images.ts'\nimport { initLogger } from './initLogger.ts'\nimport { optionsFromGlobalZodRegistry } from './optionsFromGlobalZodRegistry.ts'\nimport { tryParseConfig } from './tryParseConfig.ts'\nimport { waitForHostPort } from './waitForHostPort.ts'\n\n/** Version string injected by Rollup at build time. */\ndeclare const __VERSION__: string\n\ninterface RunCliContext {\n logger: Logger\n orchestrator: Orchestrator\n}\n\n/**\n * The configuration that will be used throughout the CLI.\n * This is materialized after parsing the command-line arguments,\n * environment variables, and defaults.\n */\nlet configuration: Config\n\nconst version = isDefined(__VERSION__) ? __VERSION__ : 'unknown'\n\nfunction resolveConfig(config: Config): Config {\n const logger = console\n const defaultChainId = toAddress('1')\n const resolved = structuredClone(config)\n if (!resolved.chain.id) {\n logger.warn(`No chain ID specified in configuration; defaulting to ${defaultChainId}`)\n resolved.chain.id = defaultChainId\n }\n return resolved\n}\n\nconst getContextFromConfig = async (configuration: Config): Promise<RunCliContext> => {\n const logger = initLogger(configuration)\n const orchestrator = await Orchestrator.create({ logger })\n // Handle cancellation (Ctrl+C)\n process.on('SIGINT', () => {\n void (async () => {\n try {\n logger.log('\\nSIGINT received. Attempting graceful shutdown...')\n await orchestrator?.stop()\n logger.log('Orchestrator stopped, exiting now.')\n process.exit(0)\n } catch (err) {\n logger.error('Error stopping orchestrator:', err)\n process.exit(1)\n }\n })()\n })\n return { logger, orchestrator }\n}\n\n// Main entry point\nexport async function runCLI() {\n // Parse command-line arguments using Yargs\n const y = yargs(hideBin(process.argv)) as Argv<Config>\n const argv = y\n .usage(`\n🚀 XL1 Node CLI (${version})\n${XL1LogoColorizedAscii}\nRun various components of the XL1 ecosystem.\n\nUsage:\n$0 <command> [options]`)\n .parserConfiguration({\n 'dot-notation': true, // foo.bar → { foo: { bar } }\n 'parse-numbers': false, // Don't auto-parse numbers to allow strings like \"0x1\"\n 'populate--': true, // Populate -- with all options so we can detected user-supplied vs defaults\n })\n .env('XL1')\n .scriptName('xl1')\n .middleware((argv) => {\n try {\n // Parse the various config sources\n const parsedConfigFile = tryParseConfig() // Config file\n const parsedConfigArgs = argv // Command-line arguments & ENV VARs\n const parseResult = ConfigZod.safeParse(parsedConfigFile)\n if (!parseResult.success) {\n throw parseResult.error\n }\n // Deep merge with precedence\n // TODO: Would like precedence to be defaults < file < ENV < CLI Args\n // but there is currently no way to determine which are defaults vs\n // user-supplied CLI Args since we set the CLI args to the defaults\n // and receive a flattened object. We might need to manually invoke\n // the parser without the defaults to achieve this.\n // const mergedConfig = deepMerge(parsedConfigArgs, parsedConfigFile)\n const mergedConfig = deepMerge(parsedConfigArgs)\n const validatedMergedConfigResult = ConfigZod.safeParse(mergedConfig)\n if (!validatedMergedConfigResult.success) {\n throw validatedMergedConfigResult.error\n }\n const resolvedConfig = resolveConfig(validatedMergedConfigResult.data)\n // Validate the merged configuration\n const validatedConfigResult = ConfigZod.safeParse(resolvedConfig)\n if (!validatedConfigResult.success) {\n throw validatedConfigResult.error\n }\n configuration = validatedConfigResult.data\n } catch (err) {\n if (isZodError(err)) {\n console.error(`Zod error: ${err.message}`)\n } else {\n console.error(`Error parsing configuration: ${err}`)\n }\n console.error(`Stack: ${err instanceof Error ? err.stack : 'N/A'}`)\n throw new Error('Invalid configuration')\n }\n })\n .options(optionsFromGlobalZodRegistry())\n // .commandDir('./command/commands', opts) // Not yet supported for ESM\n .wrap(y.terminalWidth())\n .command('api', 'Run a XL1 API Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 API Node', () => {}, async () => {\n const context = await getContextFromConfig(configuration)\n await runApi({\n ...context, config: configuration, singletons: {},\n })\n })\n })\n .command('bridge', 'Run a XL1 Bridge Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 Bridge Node', () => {}, async () => {\n const context = await getContextFromConfig(configuration)\n runBridge({ ...context, config: configuration })\n })\n })\n .command('mempool', 'Run a XL1 Mempool Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 Mempool Node', () => {}, async () => {\n const context = await getContextFromConfig(configuration)\n runMempool({ ...context, config: configuration })\n })\n })\n .command('producer', 'Run a XL1 Producer Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 Producer Node', () => {}, async () => {\n const context = await getContextFromConfig(configuration)\n await runProducer({\n ...context, config: configuration, singletons: {},\n })\n })\n })\n .command('reward-redemption-api', 'Run a XL1 Rewards Redemption API Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 Rewards Redemption API Node', () => {}, async () => {\n const context = await getContextFromConfig(configuration)\n runRewardRedemptionApi({ ...context, config: configuration })\n })\n })\n .command('$0', 'Run a full XL1 Node', () => {}, async () => {\n const context = await getContextFromConfig(configuration)\n if (configuration.mempool.enabled) {\n // Start Mempool but do not block\n runMempool({ ...context, config: configuration })\n // Wait for Mempool to be ready\n await waitForHostPort(configuration.mempool.host, configuration.mempool.port)\n }\n // Start API but do not block\n await runApi({\n ...context, config: configuration, singletons: {},\n })\n // Wait for API to be ready\n await waitForHostPort(configuration.api.host, configuration.api.port)\n // Start Producer and block on it\n await runProducer({\n ...context, config: configuration, singletons: {},\n })\n })\n .help()\n .alias('help', 'h')\n .version(version)\n .argv\n\n await argv\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { getServer } from '@xyo-network/chain-bridge'\nimport type { Config } from '@xyo-network/xl1-sdk'\n\ninterface RunBridgeContext {\n config: Config\n logger?: Logger\n}\n\nexport function runBridge(context: RunBridgeContext) {\n void getServer(context)\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { getServer } from '@xyo-network/chain-mempool'\nimport type { Config } from '@xyo-network/xl1-sdk'\n\ninterface RunMempoolContext {\n config: Config\n logger: Logger\n}\n\nexport function runMempool(context: RunMempoolContext) {\n void getServer(context)\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { getServer } from '@xyo-network/chain-reward-redemption'\nimport type { Config } from '@xyo-network/xl1-sdk'\n\ninterface RunRewardRedemptionApiContext {\n config: Config\n logger?: Logger\n}\n\nexport function runRewardRedemptionApi(context: RunRewardRedemptionApiContext) {\n void getServer(context)\n}\n","/* eslint-disable @stylistic/max-len */\nexport const XL1LogoColorizedAscii = `\u001b[38;2;128;128;128m                    \u001b[0m\u001b[38;2;118;111;144m_\u001b[0m\n\u001b[38;2;128;128;128m                   \u001b[0m\u001b[38;2;72;32;223m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\n\u001b[38;2;128;128;128m                   ╠╠\u001b[0m\u001b[38;2;103;85;170m_\u001b[0m\n\u001b[38;2;128;128;128m        \u001b[0m\u001b[38;2;79;121;152m╦\u001b[0m\u001b[38;2;82;121;151m╦\u001b[0m\u001b[38;2;112;125;136m_       \u001b[0m\u001b[38;2;88;59;196m[\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;73;34;221m▒       \u001b[0m\u001b[38;2;121;121;127m_\u001b[0m\u001b[38;2;100;101;128m╔\u001b[0m\u001b[38;2;93;94;127m╦\u001b[0m\n\u001b[38;2;128;128;128m        \u001b[0m\u001b[38;2;82;121;151m²\u001b[0m\u001b[38;2;44;116;170m╠\u001b[0m\u001b[38;2;44;116;171m▒\u001b[0m\u001b[38;2;51;117;167mD\u001b[0m\u001b[38;2;80;121;152m╦\u001b[0m\u001b[38;2;111;125;136m_    \u001b[0m\u001b[38;2;67;23;232m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠    \u001b[0m\u001b[38;2;120;121;128m_\u001b[0m\u001b[38;2;100;101;127m╔\u001b[0m\u001b[38;2;79;81;127mR\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;88;90;127m╙\u001b[0m\n\u001b[38;2;128;128;128m          \u001b[0m\u001b[38;2;55;117;165m╚\u001b[0m\u001b[38;2;44;116;171m▒\u001b[0m\u001b[38;2;44;116;171m▒▒\u001b[0m\u001b[38;2;50;116;167mD\u001b[0m\u001b[38;2;80;121;152m╦ \u001b[0m\u001b[38;2;106;90;165mj\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠\u001b[0m\u001b[38;2;89;61;194mH \u001b[0m\u001b[38;2;99;100;127m╔\u001b[0m\u001b[38;2;79;80;127mD\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;71;73;128m▒▒╠\u001b[0m\n\u001b[38;2;128;128;128m           \u001b[0m\u001b[38;2;83;121;150m²\u001b[0m\u001b[38;2;44;116;170m▒\u001b[0m\u001b[38;2;44;116;171m▒▒▒ \u001b[0m\u001b[38;2;76;38;217m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠ \u001b[0m\u001b[38;2;74;76;128m╠\u001b[0m\u001b[38;2;71;73;128m▒▒▒\u001b[0m\u001b[38;2;89;90;128m╙\u001b[0m\n\u001b[38;2;128;128;128m             \u001b[0m\u001b[38;2;90;118;148m\\`\u001b[0m\u001b[38;2;89;107;153m_\u001b[0m\u001b[38;2;93;97;154m,\u001b[0m\u001b[38;2;105;89;166m╓\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠\u001b[0m\u001b[38;2;95;72;183m╓\u001b[0m\u001b[38;2;106;96;152m_\u001b[0m\u001b[38;2;100;94;143m\\`\u001b[0m\u001b[38;2;101;100;133m\\`\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;122;118;137m_\u001b[0m\u001b[38;2;113;102;153m,\u001b[0m\u001b[38;2;108;94;161m╓\u001b[0m\u001b[38;2;104;86;169m╓\u001b[0m\u001b[38;2;98;77;178m╔\u001b[0m\u001b[38;2;93;67;188m╗\u001b[0m\u001b[38;2;88;59;196mφ\u001b[0m\u001b[38;2;83;51;204m@\u001b[0m\u001b[38;2;78;42;213mD\u001b[0m\u001b[38;2;72;32;223m▒\u001b[0m\u001b[38;2;68;24;231m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠\u001b[0m\u001b[38;2;71;30;225m▒\u001b[0m\u001b[38;2;77;40;215m▒\u001b[0m\u001b[38;2;82;49;206mK\u001b[0m\u001b[38;2;87;57;198mφ\u001b[0m\u001b[38;2;91;65;190m╗\u001b[0m\u001b[38;2;97;75;180m╦\u001b[0m\u001b[38;2;103;84;171m╖\u001b[0m\u001b[38;2;107;92;163m²\u001b[0m\u001b[38;2;112;101;154m_\u001b[0m\u001b[38;2;119;112;143m_\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;106;91;164m\\`\u001b[0m\u001b[38;2;94;70;185m^\u001b[0m\u001b[38;2;89;62;193m╙\u001b[0m\u001b[38;2;85;54;201m╙\u001b[0m\u001b[38;2;80;45;210m╚\u001b[0m\u001b[38;2;74;35;220m╝\u001b[0m\u001b[38;2;69;26;229m╠\u001b[0m\u001b[38;2;66;22;233m╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠\u001b[0m\u001b[38;2;73;33;222m╝\u001b[0m\u001b[38;2;79;43;212m╩\u001b[0m\u001b[38;2;84;52;203m╜\u001b[0m\u001b[38;2;88;60;195m╙\u001b[0m\u001b[38;2;93;68;187m^\u001b[0m\u001b[38;2;100;80;175m\\`\u001b[0m\n\u001b[38;2;128;128;128m             \u001b[0m\u001b[38;2;113;84;152m\\`\u001b[0m\u001b[38;2;103;79;169m'\u001b[0m\u001b[38;2;95;72;183m\"\u001b[0m\u001b[38;2;87;57;198m╙\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠\u001b[0m\u001b[38;2;80;46;209m╜\u001b[0m\u001b[38;2;94;70;185m^\u001b[0m\u001b[38;2;102;77;175m^\u001b[0m\u001b[38;2;112;81;162m\\`\u001b[0m\u001b[38;2;115;92;155m\\`\u001b[0m\n\u001b[38;2;128;128;128m           \u001b[0m\u001b[38;2;145;116;107m,\u001b[0m\u001b[38;2;199;82;45m╠\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒╠ \u001b[0m\u001b[38;2;70;28;227m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠ \u001b[0m\u001b[38;2;189;49;97må\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠\u001b[0m\u001b[38;2;155;92;114m,\u001b[0m\n\u001b[38;2;128;128;128m          \u001b[0m\u001b[38;2;175;98;73m╔\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒▒▒\u001b[0m\u001b[38;2;197;83;47m╩ \u001b[0m\u001b[38;2;98;76;179m[\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠\u001b[0m\u001b[38;2;81;48;207mH \u001b[0m\u001b[38;2;188;51;98m╚\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠╠\u001b[0m\u001b[38;2;183;57;100mH\u001b[0m\n\u001b[38;2;128;128;128m        \u001b[0m\u001b[38;2;146;116;106m,\u001b[0m\u001b[38;2;199;82;44m╠\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;196;84;48m╩\u001b[0m\u001b[38;2;168;102;81m^    \u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠    \u001b[0m\u001b[38;2;160;87;111m'\u001b[0m\u001b[38;2;187;52;98m╚\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠\u001b[0m\u001b[38;2;156;91;113m,\u001b[0m\n\u001b[38;2;128;128;128m        \u001b[0m\u001b[38;2;198;83;46m╩\u001b[0m\u001b[38;2;194;85;50m╩\u001b[0m\u001b[38;2;167;102;82m^       \u001b[0m\u001b[38;2;81;46;209m╚\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠       \u001b[0m\u001b[38;2;159;88;112m'\u001b[0m\u001b[38;2;186;53;98m╚\u001b[0m\u001b[38;2;197;40;93m╩\u001b[0m\n\u001b[38;2;128;128;128m                  \u001b[0m\u001b[38;2;110;97;158m'\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;94;69;186mH\u001b[0m\n\u001b[38;2;128;128;128m                   \u001b[0m\u001b[38;2;68;25;230m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\n\u001b[38;2;128;128;128m                   \u001b[0m\u001b[38;2;108;93;162m²\u001b[0m\u001b[38;2;99;79;176m^\u001b[0m`\n","import type { Logger, LogLevelValue } from '@xylabs/sdk-js'\nimport {\n Base,\n ConsoleLogger, isDefined,\n LogLevel, SilentLogger,\n} from '@xylabs/sdk-js'\nimport type { Config } from '@xyo-network/xl1-sdk'\n\nexport const initLogger = (config: Config): Logger => {\n let logger: Logger\n if (config.silent) {\n logger = new SilentLogger()\n } else {\n let level: LogLevelValue | undefined\n if (isDefined(config.logLevel)) {\n const parsed = LogLevel[config.logLevel.toLowerCase() as keyof typeof LogLevel]\n if (isDefined(parsed)) level = parsed\n }\n logger = new ConsoleLogger(level)\n }\n Base.defaultLogger = logger\n return logger\n}\n","import type { UsageMeta } from '@xyo-network/xl1-sdk'\nimport { isUsageMeta } from '@xyo-network/xl1-sdk'\nimport type { Options } from 'yargs'\nimport { globalRegistry } from 'zod'\n\nconst usageMetaToOptions = (meta: UsageMeta): Options => {\n return meta\n}\n\nexport const optionsFromGlobalZodRegistry = (): Record<string, Options> => {\n const opts: Record<string, Options> = {}\n for (const schema of Object.values(globalRegistry._map)) {\n if (isUsageMeta(schema)) {\n if (schema.hidden) continue // skip hidden options\n opts[schema.title] = usageMetaToOptions(schema)\n }\n }\n return opts\n}\n","import { isDefined, isNull } from '@xylabs/sdk-js'\nimport { ConfigZod } from '@xyo-network/xl1-sdk'\nimport { cosmiconfigSync } from 'cosmiconfig'\n\n/**\n * The name of the configuration file to search for.\n */\nconst configName = 'xyo'\n\n/**\n * The name of the section within the configuration file to parse.\n */\nconst configSection = 'xl1' // Default section in the config file\n\n/**\n * Attempts to parse the configuration from a file using cosmiconfig.\n * @returns The parsed configuration object if found and valid, otherwise undefined.\n */\nexport const tryParseConfig = () => {\n const explorer = cosmiconfigSync(\n configName,\n /* {\n searchPlaces: [\n 'package.json', // Looks under `xyo` key in package.json\n '.xyorc.json', // Supports common dotfile format\n 'xyo.config.json', // Supports custom-named config file\n ],\n loaders: {\n '.json': defaultLoaders['.json'],\n 'noExt': defaultLoaders['.json'],\n },\n }, */\n )\n const result = explorer.search()\n if (!isNull(result)) {\n const section = result?.config?.[configSection]\n if (isDefined(section) && typeof section === 'object') {\n return ConfigZod.parse(section)\n }\n }\n return ConfigZod.parse({})\n}\n","import net from 'node:net'\n\nexport const waitForHostPort = (host: string, port: number): Promise<void> => {\n return new Promise((resolve) => {\n const tryConnect = () => {\n const socket = new net.Socket()\n\n socket\n .setTimeout(1000)\n .once('error', () => {\n socket.destroy()\n setTimeout(tryConnect, 500) // retry after 500ms\n })\n .once('timeout', () => {\n socket.destroy()\n setTimeout(tryConnect, 500)\n })\n .connect(port, host, () => {\n socket.end()\n resolve()\n })\n }\n\n tryConnect()\n })\n}\n","import { config } from 'dotenv'\n\nimport { runCLI } from './runCLI.ts'\n\nexport const start = async () => {\n config({ quiet: true })\n await runCLI()\n}\n"],"mappings":";;;;AACA,SAASA,aAAAA,YAAWC,iBAAiB;AACrC,SAASC,cAAc;AACvB,SAASC,oBAAoB;AAC7B,SAASC,mBAAmB;AAE5B,SAASC,aAAAA,YAAWC,kBAAkB;AACtC,SAASC,SAASC,iBAAiB;AAEnC,OAAOC,WAAW;AAClB,SAASC,eAAe;;;ACTxB,SAASC,iBAAiB;AAQnB,SAASC,UAAUC,SAAyB;AACjD,OAAKC,UAAUD,OAAAA;AACjB;AAFgBD;;;ACRhB,SAASG,aAAAA,kBAAiB;AAQnB,SAASC,WAAWC,SAA0B;AACnD,OAAKC,WAAUD,OAAAA;AACjB;AAFgBD;;;ACRhB,SAASG,aAAAA,kBAAiB;AAQnB,SAASC,uBAAuBC,SAAsC;AAC3E,OAAKC,WAAUD,OAAAA;AACjB;AAFgBD;;;ACRT,IAAMG,wBAAwB;;;;;;;;;;;;;;;;;;;;ACArC,SACEC,MACAC,eAAeC,WACfC,UAAUC,oBACL;AAGA,IAAMC,aAAa,wBAACC,YAAAA;AACzB,MAAIC;AACJ,MAAID,QAAOE,QAAQ;AACjBD,aAAS,IAAIE,aAAAA;EACf,OAAO;AACL,QAAIC;AACJ,QAAIC,UAAUL,QAAOM,QAAQ,GA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E,cAAcmE,QAAQI,IAAI;IAC9E;AAEA,UAAMV,OAAO;MACX,GAAGD;MAASvD,QAAQL;MAAe8D,YAAY,CAAC;IAClD,CAAA;AAEA,UAAMO,gBAAgBrE,cAAcwE,IAAIF,MAAMtE,cAAcwE,IAAID,IAAI;AAEpE,UAAMN,YAAY;MAChB,GAAGL;MAASvD,QAAQL;MAAe8D,YAAY,CAAC;IAClD,CAAA;EACF,CAAA,EACCW,KAAI,EACJC,MAAM,QAAQ,GAAA,EACdzE,QAAQA,OAAAA,EACR8B;AAEH,QAAMA;AACR;AA3HsBJ;;;AStEtB,SAASgD,cAAc;AAIhB,IAAMC,QAAQ,mCAAA;AACnBC,SAAO;IAAEC,OAAO;EAAK,CAAA;AACrB,QAAMC,OAAAA;AACR,GAHqB;","names":["isDefined","toAddress","runApi","Orchestrator","runProducer","ConfigZod","isZodError","merge","deepMerge","yargs","hideBin","getServer","runBridge","context","getServer","getServer","runMempool","context","getServer","getServer","runRewardRedemptionApi","context","getServer","XL1LogoColorizedAscii","Base","ConsoleLogger","isDefined","LogLevel","SilentLogger","initLogger","config","logger","silent","SilentLogger","level","isDefined","logLevel","parsed","LogLevel","toLowerCase","ConsoleLogger","Base","defaultLogger","isUsageMeta","globalRegistry","usageMetaToOptions","meta","optionsFromGlobalZodRegistry","opts","schema","Object","values","globalRegistry","_map","isUsageMeta","hidden","title","isDefined","isNull","ConfigZod","cosmiconfigSync","configName","configSection","tryParseConfig","explorer","cosmiconfigSync","result","search","isNull","section","config","isDefined","ConfigZod","parse","net","waitForHostPort","host","port","Promise","resolve","tryConnect","socket","net","Socket","setTimeout","once","destroy","connect","end","configuration","version","isDefined","__VERSION__","resolveConfig","config","logger","console","defaultChainId","toAddress","resolved","structuredClone","chain","id","warn","getContextFromConfig","initLogger","orchestrator","Orchestrator","create","process","on","log","stop","exit","err","error","runCLI","y","yargs","hideBin","argv","usage","XL1LogoColorizedAscii","parserConfiguration","env","scriptName","middleware","parsedConfigFile","tryParseConfig","parsedConfigArgs","parseResult","ConfigZod","safeParse","success","mergedConfig","deepMerge","validatedMergedConfigResult","resolvedConfig","data","validatedConfigResult","isZodError","message","Error","stack","options","optionsFromGlobalZodRegistry","wrap","terminalWidth","command","context","runApi","singletons","runBridge","runMempool","runProducer","runRewardRedemptionApi","mempool","enabled","waitForHostPort","host","port","api","help","alias","config","start","config","quiet","runCLI"]}
1
+ {"version":3,"sources":["../../src/runCLI.ts","../../src/commands/bridge/runBridge.ts","../../src/commands/mempool/runMempool.ts","../../src/commands/rewardRedemption/runRewardRedemptionApi.ts","../../src/images.ts","../../src/initLogger.ts","../../src/locatorFromConfig.ts","../../src/optionsFromGlobalZodRegistry.ts","../../src/tryParseConfig.ts","../../src/waitForHostPort.ts","../../src/start.ts"],"sourcesContent":["import type { Logger } from '@xylabs/sdk-js'\nimport {\n deepMerge, isDefined, toAddress,\n} from '@xylabs/sdk-js'\nimport { runApi } from '@xyo-network/chain-api'\nimport { Orchestrator } from '@xyo-network/chain-orchestration'\nimport { runProducer } from '@xyo-network/chain-producer'\nimport type { ActorName, Config } from '@xyo-network/xl1-sdk'\nimport { ConfigZod, isZodError } from '@xyo-network/xl1-sdk'\nimport type { Argv } from 'yargs'\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\n\nimport {\n runBridge, runMempool, runRewardRedemptionApi,\n} from './commands/index.ts'\nimport { XL1LogoColorizedAscii } from './images.ts'\nimport { initLogger } from './initLogger.ts'\nimport { contextFromConfigWithoutLocator, locatorsFromConfig } from './locatorFromConfig.ts'\nimport { optionsFromGlobalZodRegistry } from './optionsFromGlobalZodRegistry.ts'\nimport { tryParseConfig } from './tryParseConfig.ts'\nimport { waitForHostPort } from './waitForHostPort.ts'\n\ninterface RunCliContext {\n logger: Logger\n orchestrator: Orchestrator\n}\n\n/** Version string injected by Rollup at build time. */\ndeclare const __VERSION__: string\n\n/**\n * The configuration that will be used throughout the CLI.\n * This is materialized after parsing the command-line arguments,\n * environment variables, and defaults.\n */\nlet configuration: Config\n\nconst version = isDefined(__VERSION__) ? __VERSION__ : 'unknown'\n\nfunction resolveConfig(config: Config): Config {\n const logger = console\n const defaultChainId = toAddress('1')\n const resolved = structuredClone(config)\n if (!resolved.chain.id) {\n logger.warn(`No chain ID specified in configuration; defaulting to ${defaultChainId}`)\n resolved.chain.id = defaultChainId\n }\n return resolved\n}\n\nconst getContextFromConfig = async (configuration: Config): Promise<RunCliContext> => {\n const logger = initLogger(configuration)\n const orchestrator = await Orchestrator.create({ logger })\n // Handle cancellation (Ctrl+C)\n process.on('SIGINT', () => {\n void (async () => {\n try {\n logger.log('\\nSIGINT received. Attempting graceful shutdown...')\n await orchestrator?.stop()\n logger.log('Orchestrator stopped, exiting now.')\n process.exit(0)\n } catch (err) {\n logger.error('Error stopping orchestrator:', err)\n process.exit(1)\n }\n })()\n })\n return { logger, orchestrator }\n}\n\nconst getLocatorsFromConfig = async (actors: string[], configuration: Config) => {\n const logger = initLogger(configuration)\n const orchestrator = await Orchestrator.create({ logger })\n const context = await contextFromConfigWithoutLocator(configuration, logger, 'xl1-cli', version)\n const locators = await locatorsFromConfig(actors, configuration, context)\n // Handle cancellation (Ctrl+C)\n process.on('SIGINT', () => {\n void (async () => {\n try {\n logger.log('\\nSIGINT received. Attempting graceful shutdown...')\n await orchestrator?.stop()\n logger.log('Orchestrator stopped, exiting now.')\n process.exit(0)\n } catch (err) {\n logger.error('Error stopping orchestrator:', err)\n process.exit(1)\n }\n })()\n })\n return { locators, orchestrator }\n}\n\n// Main entry point\nexport async function runCLI() {\n // Parse command-line arguments using Yargs\n const y = yargs(hideBin(process.argv)) as Argv<Config>\n const argv = y\n .usage(`\n🚀 XL1 Node CLI (${version})\n${XL1LogoColorizedAscii}\nRun various components of the XL1 ecosystem.\n\nUsage:\n$0 <command> [options]`)\n .parserConfiguration({\n 'dot-notation': true, // foo.bar → { foo: { bar } }\n 'parse-numbers': false, // Don't auto-parse numbers to allow strings like \"0x1\"\n 'populate--': true, // Populate -- with all options so we can detected user-supplied vs defaults\n })\n .env('XL1')\n .scriptName('xl1')\n .middleware((argv) => {\n try {\n // Parse the various config sources\n const parsedConfigFile = tryParseConfig() // Config file\n const parsedConfigArgs = argv // Command-line arguments & ENV VARs\n const parseResult = ConfigZod.safeParse(parsedConfigFile)\n if (!parseResult.success) {\n throw parseResult.error\n }\n // Deep merge with precedence\n // TODO: Would like precedence to be defaults < file < ENV < CLI Args\n // but there is currently no way to determine which are defaults vs\n // user-supplied CLI Args since we set the CLI args to the defaults\n // and receive a flattened object. We might need to manually invoke\n // the parser without the defaults to achieve this.\n // const mergedConfig = deepMerge(parsedConfigArgs, parsedConfigFile)\n const mergedConfig = deepMerge(parsedConfigArgs)\n const validatedMergedConfigResult = ConfigZod.safeParse(mergedConfig)\n if (!validatedMergedConfigResult.success) {\n throw validatedMergedConfigResult.error\n }\n const resolvedConfig = resolveConfig(validatedMergedConfigResult.data)\n // Validate the merged configuration\n const validatedConfigResult = ConfigZod.safeParse(resolvedConfig)\n if (!validatedConfigResult.success) {\n throw validatedConfigResult.error\n }\n configuration = validatedConfigResult.data\n\n const { actors, ...rootConfig } = configuration\n const actorNames = Object.keys(actors) as ActorName[]\n\n for (const actorName of actorNames) {\n configuration.actors[actorName] = deepMerge(\n rootConfig ?? {},\n configuration.actors[actorName] ?? {},\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) as any\n }\n\n // Check if user wants to dump config and exit\n if (argv['dump-config']) {\n console.log(JSON.stringify(configuration, null, 2))\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0)\n }\n } catch (err) {\n if (isZodError(err)) {\n console.error(`Zod error: ${err.message}`)\n } else {\n console.error(`Error parsing configuration: ${err}`)\n }\n console.error(`Stack: ${err instanceof Error ? err.stack : 'N/A'}`)\n throw new Error('Invalid configuration')\n }\n })\n .options(optionsFromGlobalZodRegistry())\n // .commandDir('./command/commands', opts) // Not yet supported for ESM\n .wrap(y.terminalWidth())\n .command('api', 'Run a XL1 API Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 API Node', () => {}, async () => {\n const context = await getContextFromConfig(configuration)\n await runApi({\n ...context, config: configuration, singletons: {},\n })\n })\n })\n .command('bridge', 'Run a XL1 Bridge Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 Bridge Node', () => {}, async () => {\n const context = await getContextFromConfig(configuration)\n runBridge({ ...context, config: configuration })\n })\n })\n .command('mempool', 'Run a XL1 Mempool Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 Mempool Node', () => {}, async () => {\n const context = await getContextFromConfig(configuration)\n runMempool({ ...context, config: configuration })\n })\n })\n .command('producer', 'Run a XL1 Producer Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 Producer Node', () => {}, async () => {\n const { locators, orchestrator } = await getLocatorsFromConfig(['producer'], configuration)\n await runProducer(configuration, orchestrator, locators['producer'])\n })\n })\n .command('reward-redemption-api', 'Run a XL1 Rewards Redemption API Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 Rewards Redemption API Node', () => {}, async () => {\n const context = await getContextFromConfig(configuration)\n runRewardRedemptionApi({ ...context, config: configuration })\n })\n })\n .command('$0', 'Run a full XL1 Node', () => {}, async () => {\n const actors = ['producer', 'api']\n if (configuration.actors.mempool.enabled) {\n actors.push('mempool')\n }\n const context = await getContextFromConfig(configuration)\n const { locators, orchestrator } = await getLocatorsFromConfig(['producer'], configuration)\n if (configuration.actors.mempool.enabled) {\n // Start Mempool but do not block\n runMempool({ ...context, config: configuration })\n // Wait for Mempool to be ready\n await waitForHostPort(configuration.actors.mempool.host, configuration.actors.mempool.port)\n }\n // Start API but do not block\n await runApi({\n ...context, config: configuration, singletons: {},\n })\n // Wait for API to be ready\n await waitForHostPort(configuration.actors.api.host, configuration.actors.api.port)\n // Start Producer and block on it\n await runProducer(configuration, orchestrator, locators['producer'])\n })\n .options({\n 'dump-config': {\n type: 'boolean',\n description: 'Just process the configuration and print the resolved config to stdout, then exit.',\n default: false,\n },\n })\n .help()\n .alias('help', 'h')\n .version(version)\n .argv\n\n await argv\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { getServer } from '@xyo-network/chain-bridge'\nimport type { Config } from '@xyo-network/xl1-sdk'\n\ninterface RunBridgeContext {\n config: Config\n logger?: Logger\n}\n\nexport function runBridge(context: RunBridgeContext) {\n void getServer(context)\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { getServer } from '@xyo-network/chain-mempool'\nimport type { Config } from '@xyo-network/xl1-sdk'\n\ninterface RunMempoolContext {\n config: Config\n logger: Logger\n}\n\nexport function runMempool(context: RunMempoolContext) {\n void getServer(context)\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { getServer } from '@xyo-network/chain-reward-redemption'\nimport type { Config } from '@xyo-network/xl1-sdk'\n\ninterface RunRewardRedemptionApiContext {\n config: Config\n logger?: Logger\n}\n\nexport function runRewardRedemptionApi(context: RunRewardRedemptionApiContext) {\n void getServer(context)\n}\n","/* eslint-disable @stylistic/max-len */\nexport const XL1LogoColorizedAscii = `\u001b[38;2;128;128;128m                    \u001b[0m\u001b[38;2;118;111;144m_\u001b[0m\n\u001b[38;2;128;128;128m                   \u001b[0m\u001b[38;2;72;32;223m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\n\u001b[38;2;128;128;128m                   ╠╠\u001b[0m\u001b[38;2;103;85;170m_\u001b[0m\n\u001b[38;2;128;128;128m        \u001b[0m\u001b[38;2;79;121;152m╦\u001b[0m\u001b[38;2;82;121;151m╦\u001b[0m\u001b[38;2;112;125;136m_       \u001b[0m\u001b[38;2;88;59;196m[\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;73;34;221m▒       \u001b[0m\u001b[38;2;121;121;127m_\u001b[0m\u001b[38;2;100;101;128m╔\u001b[0m\u001b[38;2;93;94;127m╦\u001b[0m\n\u001b[38;2;128;128;128m        \u001b[0m\u001b[38;2;82;121;151m²\u001b[0m\u001b[38;2;44;116;170m╠\u001b[0m\u001b[38;2;44;116;171m▒\u001b[0m\u001b[38;2;51;117;167mD\u001b[0m\u001b[38;2;80;121;152m╦\u001b[0m\u001b[38;2;111;125;136m_    \u001b[0m\u001b[38;2;67;23;232m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠    \u001b[0m\u001b[38;2;120;121;128m_\u001b[0m\u001b[38;2;100;101;127m╔\u001b[0m\u001b[38;2;79;81;127mR\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;88;90;127m╙\u001b[0m\n\u001b[38;2;128;128;128m          \u001b[0m\u001b[38;2;55;117;165m╚\u001b[0m\u001b[38;2;44;116;171m▒\u001b[0m\u001b[38;2;44;116;171m▒▒\u001b[0m\u001b[38;2;50;116;167mD\u001b[0m\u001b[38;2;80;121;152m╦ \u001b[0m\u001b[38;2;106;90;165mj\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠\u001b[0m\u001b[38;2;89;61;194mH \u001b[0m\u001b[38;2;99;100;127m╔\u001b[0m\u001b[38;2;79;80;127mD\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;71;73;128m▒▒╠\u001b[0m\n\u001b[38;2;128;128;128m           \u001b[0m\u001b[38;2;83;121;150m²\u001b[0m\u001b[38;2;44;116;170m▒\u001b[0m\u001b[38;2;44;116;171m▒▒▒ \u001b[0m\u001b[38;2;76;38;217m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠ \u001b[0m\u001b[38;2;74;76;128m╠\u001b[0m\u001b[38;2;71;73;128m▒▒▒\u001b[0m\u001b[38;2;89;90;128m╙\u001b[0m\n\u001b[38;2;128;128;128m             \u001b[0m\u001b[38;2;90;118;148m\\`\u001b[0m\u001b[38;2;89;107;153m_\u001b[0m\u001b[38;2;93;97;154m,\u001b[0m\u001b[38;2;105;89;166m╓\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠\u001b[0m\u001b[38;2;95;72;183m╓\u001b[0m\u001b[38;2;106;96;152m_\u001b[0m\u001b[38;2;100;94;143m\\`\u001b[0m\u001b[38;2;101;100;133m\\`\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;122;118;137m_\u001b[0m\u001b[38;2;113;102;153m,\u001b[0m\u001b[38;2;108;94;161m╓\u001b[0m\u001b[38;2;104;86;169m╓\u001b[0m\u001b[38;2;98;77;178m╔\u001b[0m\u001b[38;2;93;67;188m╗\u001b[0m\u001b[38;2;88;59;196mφ\u001b[0m\u001b[38;2;83;51;204m@\u001b[0m\u001b[38;2;78;42;213mD\u001b[0m\u001b[38;2;72;32;223m▒\u001b[0m\u001b[38;2;68;24;231m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠\u001b[0m\u001b[38;2;71;30;225m▒\u001b[0m\u001b[38;2;77;40;215m▒\u001b[0m\u001b[38;2;82;49;206mK\u001b[0m\u001b[38;2;87;57;198mφ\u001b[0m\u001b[38;2;91;65;190m╗\u001b[0m\u001b[38;2;97;75;180m╦\u001b[0m\u001b[38;2;103;84;171m╖\u001b[0m\u001b[38;2;107;92;163m²\u001b[0m\u001b[38;2;112;101;154m_\u001b[0m\u001b[38;2;119;112;143m_\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;106;91;164m\\`\u001b[0m\u001b[38;2;94;70;185m^\u001b[0m\u001b[38;2;89;62;193m╙\u001b[0m\u001b[38;2;85;54;201m╙\u001b[0m\u001b[38;2;80;45;210m╚\u001b[0m\u001b[38;2;74;35;220m╝\u001b[0m\u001b[38;2;69;26;229m╠\u001b[0m\u001b[38;2;66;22;233m╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠\u001b[0m\u001b[38;2;73;33;222m╝\u001b[0m\u001b[38;2;79;43;212m╩\u001b[0m\u001b[38;2;84;52;203m╜\u001b[0m\u001b[38;2;88;60;195m╙\u001b[0m\u001b[38;2;93;68;187m^\u001b[0m\u001b[38;2;100;80;175m\\`\u001b[0m\n\u001b[38;2;128;128;128m             \u001b[0m\u001b[38;2;113;84;152m\\`\u001b[0m\u001b[38;2;103;79;169m'\u001b[0m\u001b[38;2;95;72;183m\"\u001b[0m\u001b[38;2;87;57;198m╙\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠\u001b[0m\u001b[38;2;80;46;209m╜\u001b[0m\u001b[38;2;94;70;185m^\u001b[0m\u001b[38;2;102;77;175m^\u001b[0m\u001b[38;2;112;81;162m\\`\u001b[0m\u001b[38;2;115;92;155m\\`\u001b[0m\n\u001b[38;2;128;128;128m           \u001b[0m\u001b[38;2;145;116;107m,\u001b[0m\u001b[38;2;199;82;45m╠\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒╠ \u001b[0m\u001b[38;2;70;28;227m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠ \u001b[0m\u001b[38;2;189;49;97må\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠\u001b[0m\u001b[38;2;155;92;114m,\u001b[0m\n\u001b[38;2;128;128;128m          \u001b[0m\u001b[38;2;175;98;73m╔\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒▒▒\u001b[0m\u001b[38;2;197;83;47m╩ \u001b[0m\u001b[38;2;98;76;179m[\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠\u001b[0m\u001b[38;2;81;48;207mH \u001b[0m\u001b[38;2;188;51;98m╚\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠╠\u001b[0m\u001b[38;2;183;57;100mH\u001b[0m\n\u001b[38;2;128;128;128m        \u001b[0m\u001b[38;2;146;116;106m,\u001b[0m\u001b[38;2;199;82;44m╠\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;196;84;48m╩\u001b[0m\u001b[38;2;168;102;81m^    \u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠    \u001b[0m\u001b[38;2;160;87;111m'\u001b[0m\u001b[38;2;187;52;98m╚\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠\u001b[0m\u001b[38;2;156;91;113m,\u001b[0m\n\u001b[38;2;128;128;128m        \u001b[0m\u001b[38;2;198;83;46m╩\u001b[0m\u001b[38;2;194;85;50m╩\u001b[0m\u001b[38;2;167;102;82m^       \u001b[0m\u001b[38;2;81;46;209m╚\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠       \u001b[0m\u001b[38;2;159;88;112m'\u001b[0m\u001b[38;2;186;53;98m╚\u001b[0m\u001b[38;2;197;40;93m╩\u001b[0m\n\u001b[38;2;128;128;128m                  \u001b[0m\u001b[38;2;110;97;158m'\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;94;69;186mH\u001b[0m\n\u001b[38;2;128;128;128m                   \u001b[0m\u001b[38;2;68;25;230m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\n\u001b[38;2;128;128;128m                   \u001b[0m\u001b[38;2;108;93;162m²\u001b[0m\u001b[38;2;99;79;176m^\u001b[0m`\n","import type { Logger, LogLevelValue } from '@xylabs/sdk-js'\nimport {\n Base,\n ConsoleLogger, isDefined,\n LogLevel, SilentLogger,\n} from '@xylabs/sdk-js'\nimport type { Config } from '@xyo-network/xl1-sdk'\n\nexport const initLogger = (config: Config): Logger => {\n let logger: Logger\n if (config.log.silent) {\n logger = new SilentLogger()\n } else {\n let level: LogLevelValue | undefined\n if (isDefined(config.log.logLevel)) {\n const parsed = LogLevel[config.log.logLevel.toLowerCase() as keyof typeof LogLevel]\n if (isDefined(parsed)) level = parsed\n }\n logger = new ConsoleLogger(level)\n }\n Base.defaultLogger = logger\n return logger\n}\n","import {\n asAddress, assertEx, isString, type Logger,\n} from '@xylabs/sdk-js'\nimport {\n initApiWallet,\n initBalanceSummaryMap,\n initEvmProvidersIfAvailable, initFinalizationArchivistIfNeeded, initProducerAccount, initServerNode, initStatusReporter,\n initTransferSummaryMap,\n} from '@xyo-network/chain-orchestration'\nimport { SimpleBlockRunner } from '@xyo-network/chain-services'\nimport { initTelemetry } from '@xyo-network/chain-telemetry'\nimport { validateHydratedBlock, validateHydratedBlockState } from '@xyo-network/chain-validation'\nimport type {\n Config, CreatableProviderContext, ProviderFactoryLocatorInstance,\n} from '@xyo-network/xl1-sdk'\nimport {\n ProviderFactoryLocator, SimpleAccountBalanceViewer, SimpleBlockRewardViewer, SimpleBlockValidationViewer,\n SimpleBlockViewer,\n SimpleFinalizationViewer,\n SimpleMempoolRunner,\n SimpleMempoolViewer,\n SimpleNetworkStakeViewer,\n SimpleStepRewardsByPositionViewer,\n SimpleStepRewardsByStakerViewer,\n SimpleStepRewardsByStepViewer,\n SimpleStepRewardsTotalViewer,\n SimpleStepRewardsViewer,\n SimpleStepViewer,\n SimpleTimeSyncViewer,\n SimpleWindowedBlockViewer,\n SimpleXyoViewer,\n} from '@xyo-network/xl1-sdk'\n\nexport async function telemetryContextFromConfig(config: Config, serviceName: string, serviceVersion: string) {\n const { otlpEndpoint } = config.telemetry?.otel ?? {}\n const { path: endpoint = '/metrics', port: port = 9466 } = config.telemetry?.metrics?.scrape ?? {}\n return await initTelemetry({\n attributes: {\n serviceName,\n serviceVersion,\n },\n otlpEndpoint,\n metricsConfig: { endpoint, port },\n })\n}\n\nexport async function contextFromConfigWithoutLocator(\n config: Config,\n logger: Logger,\n serviceName: string,\n serviceVersion: string,\n): Promise<Omit<CreatableProviderContext, 'locator'>> {\n const singletons = {}\n const caches = {}\n const telemetryConfig = await telemetryContextFromConfig(config, serviceName, serviceVersion)\n const statusReporter = initStatusReporter({ logger })\n return {\n ...telemetryConfig,\n config,\n singletons,\n caches,\n logger,\n statusReporter,\n }\n}\n\nexport async function rootLocatorFromConfig(\n config: Config,\n context: Omit<CreatableProviderContext, 'locator'>,\n): Promise<ProviderFactoryLocatorInstance> {\n let locator: ProviderFactoryLocatorInstance = new ProviderFactoryLocator(context)\n\n locator.registerMany([\n SimpleNetworkStakeViewer.factory<SimpleNetworkStakeViewer>(SimpleNetworkStakeViewer.dependencies, {}),\n SimpleTimeSyncViewer.factory<SimpleTimeSyncViewer>(SimpleTimeSyncViewer.dependencies, {}),\n SimpleStepViewer.factory<SimpleStepViewer>(SimpleStepViewer.dependencies, {}),\n SimpleStepRewardsViewer.factory<SimpleStepRewardsViewer>(SimpleStepRewardsViewer.dependencies, {}),\n SimpleStepRewardsByPositionViewer.factory<SimpleStepRewardsByPositionViewer>(SimpleStepRewardsByPositionViewer.dependencies, {}),\n SimpleStepRewardsByStakerViewer.factory<SimpleStepRewardsByStakerViewer>(SimpleStepRewardsByStakerViewer.dependencies, {}),\n SimpleStepRewardsByStepViewer.factory<SimpleStepRewardsByStepViewer>(SimpleStepRewardsByStepViewer.dependencies, {}),\n SimpleStepRewardsTotalViewer.factory<SimpleStepRewardsTotalViewer>(SimpleStepRewardsTotalViewer.dependencies, {}),\n SimpleBlockValidationViewer.factory<SimpleBlockValidationViewer>(\n SimpleBlockValidationViewer.dependencies,\n { state: validateHydratedBlockState, protocol: validateHydratedBlock },\n ),\n ])\n locator = await initEvmProvidersIfAvailable(locator)\n locator = await (isString(config.remote.rpc?.url)\n ? remoteLocatorFromConfig(config, { ...context, locator })\n : localLocatorFromConfig(config, { ...context, locator }))\n locator.freeze()\n return locator\n}\n\nexport async function localLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<ProviderFactoryLocatorInstance> {\n const balancesSummaryMap = assertEx(await initBalanceSummaryMap(context), () => 'Balance Summary Map not initialized')\n const transfersSummaryMap = assertEx(await initTransferSummaryMap(context), () => 'Transfer Summary Map not initialized')\n\n // TODO: this should not be an api wallet, but a server wallet\n const wallet = await initApiWallet(context)\n\n const {\n writableChainArchivist, readonlyChainArchivist, pendingTransactionsArchivist, pendingBlocksArchivist,\n } = await initServerNode({\n ...context,\n wallet,\n transfersSummaryMap,\n balancesSummaryMap,\n })\n\n await initFinalizationArchivistIfNeeded(writableChainArchivist, config, wallet)\n\n const locator = new ProviderFactoryLocator(context)\n locator.registerMany([\n SimpleMempoolViewer.factory<SimpleMempoolViewer>(SimpleMempoolViewer.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleMempoolRunner.factory<SimpleMempoolRunner>(SimpleMempoolRunner.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleAccountBalanceViewer.factory<SimpleAccountBalanceViewer>(SimpleAccountBalanceViewer.dependencies, { balancesSummaryMap, transfersSummaryMap }),\n SimpleFinalizationViewer.factory<SimpleFinalizationViewer>(SimpleFinalizationViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleBlockViewer.factory<SimpleBlockViewer>(SimpleBlockViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleWindowedBlockViewer.factory<SimpleWindowedBlockViewer>(SimpleWindowedBlockViewer.dependencies, { maxWindowSize: 10_000, syncInterval: 10_000 }),\n SimpleXyoViewer.factory<SimpleXyoViewer>(SimpleXyoViewer.dependencies, {}),\n ])\n locator.freeze()\n return locator\n}\n\nexport async function remoteLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<ProviderFactoryLocatorInstance> {\n const balancesSummaryMap = assertEx(await initBalanceSummaryMap(context), () => 'Balance Summary Map not initialized')\n const transfersSummaryMap = assertEx(await initTransferSummaryMap(context), () => 'Transfer Summary Map not initialized')\n\n // TODO: this should not be an api wallet, but a server wallet\n const wallet = await initApiWallet(context)\n\n const {\n readonlyChainArchivist, pendingTransactionsArchivist, pendingBlocksArchivist,\n } = await initServerNode({\n ...context,\n wallet,\n transfersSummaryMap,\n balancesSummaryMap,\n })\n\n const locator = new ProviderFactoryLocator(context)\n locator.registerMany([\n SimpleMempoolViewer.factory<SimpleMempoolViewer>(SimpleMempoolViewer.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleMempoolRunner.factory<SimpleMempoolRunner>(SimpleMempoolRunner.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleAccountBalanceViewer.factory<SimpleAccountBalanceViewer>(SimpleAccountBalanceViewer.dependencies, { balancesSummaryMap, transfersSummaryMap }),\n SimpleFinalizationViewer.factory<SimpleFinalizationViewer>(SimpleFinalizationViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleBlockViewer.factory<SimpleBlockViewer>(SimpleBlockViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleWindowedBlockViewer.factory<SimpleWindowedBlockViewer>(SimpleWindowedBlockViewer.dependencies, { maxWindowSize: 10_000, syncInterval: 10_000 }),\n SimpleXyoViewer.factory<SimpleXyoViewer>(SimpleXyoViewer.dependencies, {}),\n ])\n locator.freeze()\n return locator\n}\n\nexport async function producerLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<ProviderFactoryLocatorInstance> {\n const { logger } = context\n const account = await initProducerAccount({ config })\n const locator = new ProviderFactoryLocator(context)\n const rewardAddress = asAddress(config.actors.producer.rewardAddress ?? account.address, true)\n logger?.info(`Using reward address ${rewardAddress}`)\n if (rewardAddress === account.address) {\n logger?.warn(`Using producer account address as reward address: ${account.address}`)\n }\n\n locator.registerMany([\n SimpleBlockRewardViewer.factory<SimpleBlockRewardViewer>(SimpleBlockRewardViewer.dependencies, {}),\n SimpleBlockRunner.factory<SimpleBlockRunner>(\n SimpleBlockRunner.dependencies,\n { account, rewardAddress },\n )])\n locator.freeze()\n return locator\n}\n\nexport async function locatorsFromConfig(\n actors: string[],\n config: Config,\n context: Omit<CreatableProviderContext, 'locator'>,\n): Promise<Record<string, ProviderFactoryLocatorInstance>> {\n const result: Record<string, ProviderFactoryLocatorInstance> = { _root: await rootLocatorFromConfig(config, context) }\n const producer = actors.includes('producer') ? await producerLocatorFromConfig(config, result._root.context) : undefined\n if (producer) {\n result.producer = producer\n }\n return result\n}\n","import type { UsageMeta } from '@xyo-network/xl1-sdk'\nimport { isUsageMeta } from '@xyo-network/xl1-sdk'\nimport type { Options } from 'yargs'\nimport { globalRegistry } from 'zod'\n\nconst usageMetaToOptions = (meta: UsageMeta): Options => {\n return meta\n}\n\nexport const optionsFromGlobalZodRegistry = (): Record<string, Options> => {\n const opts: Record<string, Options> = {}\n for (const schema of Object.values(globalRegistry._map)) {\n if (isUsageMeta(schema)) {\n if (schema.hidden) continue // skip hidden options\n opts[schema.title] = usageMetaToOptions(schema)\n }\n }\n return opts\n}\n","import { isDefined, isNull } from '@xylabs/sdk-js'\nimport { ConfigZod } from '@xyo-network/xl1-sdk'\nimport { cosmiconfigSync } from 'cosmiconfig'\n\n/**\n * The name of the configuration file to search for.\n */\nconst configName = 'xyo'\n\n/**\n * The name of the section within the configuration file to parse.\n */\nconst configSection = 'xl1' // Default section in the config file\n\n/**\n * Attempts to parse the configuration from a file using cosmiconfig.\n * @returns The parsed configuration object if found and valid, otherwise undefined.\n */\nexport const tryParseConfig = () => {\n const explorer = cosmiconfigSync(\n configName,\n /* {\n searchPlaces: [\n 'package.json', // Looks under `xyo` key in package.json\n '.xyorc.json', // Supports common dotfile format\n 'xyo.config.json', // Supports custom-named config file\n ],\n loaders: {\n '.json': defaultLoaders['.json'],\n 'noExt': defaultLoaders['.json'],\n },\n }, */\n )\n const result = explorer.search()\n if (!isNull(result)) {\n const section = result?.config?.[configSection]\n if (isDefined(section) && typeof section === 'object') {\n return ConfigZod.parse(section)\n }\n }\n return ConfigZod.parse({})\n}\n","import net from 'node:net'\n\nexport const waitForHostPort = (host: string, port: number): Promise<void> => {\n return new Promise((resolve) => {\n const tryConnect = () => {\n const socket = new net.Socket()\n\n socket\n .setTimeout(1000)\n .once('error', () => {\n socket.destroy()\n setTimeout(tryConnect, 500) // retry after 500ms\n })\n .once('timeout', () => {\n socket.destroy()\n setTimeout(tryConnect, 500)\n })\n .connect(port, host, () => {\n socket.end()\n resolve()\n })\n }\n\n tryConnect()\n })\n}\n","import { config } from 'dotenv'\n\nimport { runCLI } from './runCLI.ts'\n\nexport const start = async () => {\n config({ quiet: true })\n await runCLI()\n}\n"],"mappings":";;;;AACA,SACEA,WAAWC,aAAAA,YAAWC,iBACjB;AACP,SAASC,cAAc;AACvB,SAASC,oBAAoB;AAC7B,SAASC,mBAAmB;AAE5B,SAASC,aAAAA,YAAWC,kBAAkB;AAEtC,OAAOC,WAAW;AAClB,SAASC,eAAe;;;ACVxB,SAASC,iBAAiB;AAQnB,SAASC,UAAUC,SAAyB;AACjD,OAAKC,UAAUD,OAAAA;AACjB;AAFgBD;;;ACRhB,SAASG,aAAAA,kBAAiB;AAQnB,SAASC,WAAWC,SAA0B;AACnD,OAAKC,WAAUD,OAAAA;AACjB;AAFgBD;;;ACRhB,SAASG,aAAAA,kBAAiB;AAQnB,SAASC,uBAAuBC,SAAsC;AAC3E,OAAKC,WAAUD,OAAAA;AACjB;AAFgBD;;;ACRT,IAAMG,wBAAwB;;;;;;;;;;;;;;;;;;;;ACArC,SACEC,MACAC,eAAeC,WACfC,UAAUC,oBACL;AAGA,IAAMC,aAAa,wBAACC,YAAAA;AACzB,MAAIC;AACJ,MAAID,QAAOE,IAAIC,QAAQ;AACrBF,aAAS,IAAIG,aAAAA;EACf,OAAO;AACL,QAAIC;AACJ,QAAIC,UAAUN,QAAOE,IAAIK,QAAQ,GAAG;AAClC,YAAMC,SAASC,SAAST,QAAOE,IAAIK,SAASG,YAAW,CAAA;AACvD,UAAIJ,UAAUE,MAAAA,EAASH,SAAQG;IACjC;AACA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CAAA,EACCqC,QAAQ;IACP,eAAe;MACbkB,MAAM;MACNC,aAAa;MACbC,SAAS;IACX;EACF,CAAA,EACCC,KAAI,EACJC,MAAM,QAAQ,GAAA,EACdzF,QAAQA,OAAAA,EACRoC;AAEH,QAAMA;AACR;AArJsBJ;;;AU9FtB,SAAS0D,cAAc;AAIhB,IAAMC,QAAQ,mCAAA;AACnBC,SAAO;IAAEC,OAAO;EAAK,CAAA;AACrB,QAAMC,OAAAA;AACR,GAHqB;","names":["deepMerge","isDefined","toAddress","runApi","Orchestrator","runProducer","ConfigZod","isZodError","yargs","hideBin","getServer","runBridge","context","getServer","getServer","runMempool","context","getServer","getServer","runRewardRedemptionApi","context","getServer","XL1LogoColorizedAscii","Base","ConsoleLogger","isDefined","LogLevel","SilentLogger","initLogger","config","logger","log","silent","SilentLogger","level","isDefined","logLevel","parsed","LogLevel","toLowerCase","ConsoleLogger","Base","defaultLogger","asAddress","assertEx","isString","initApiWallet","initBalanceSummaryMap","initEvmProvidersIfAvailable","initFinalizationArchivistIfNeeded","initProducerAccount","initServerNode","initStatusReporter","initTransferSummaryMap","SimpleBlockRunner","initTelemetry","validateHydratedBlock","validateHydratedBlockState","ProviderFactoryLocator","SimpleAccountBalanceViewer","SimpleBlockRewardViewer","SimpleBlockValidationViewer","SimpleBlockViewer","SimpleFinalizationViewer","SimpleMempoolRunner","SimpleMempoolViewer","SimpleNetworkStakeViewer","SimpleStepRewardsByPositionViewer","SimpleStepRewardsByStakerViewer","SimpleStepRewardsByStepViewer","SimpleStepRewardsTotalViewer","SimpleStepRewardsViewer","SimpleStepViewer","SimpleTimeSyncViewer","SimpleWindowedBlockViewer","SimpleXyoViewer","telemetryContextFromConfig","config","serviceName","serviceVersion","otlpEndpoint","telemetry","otel","path","endpoint","port","metrics","scrape","initTelemetry","attributes","metricsConfig","contextFromConfigWithoutLocator","logger","singletons","caches","telemetryConfig","statusReporter","initStatusReporter","rootLocatorFromConfig","context","locator","ProviderFactoryLocator","registerMany","SimpleNetworkStakeViewer","factory","dependencies","SimpleTimeSyncViewer","SimpleStepViewer","SimpleStepRewardsViewer","SimpleStepRewardsByPositionViewer","SimpleStepRewardsByStakerViewer","SimpleStepRewardsByStepViewer","SimpleStepRewardsTotalViewer","SimpleBlockValidationViewer","state","validateHydratedBlockState","protocol","validateHydratedBlock","initEvmProvidersIfAvailable","isString","remote","rpc","url","remoteLocatorFromConfig","localLocatorFromConfig","freeze","balancesSummaryMap","assertEx","initBalanceSummaryMap","transfersSummaryMap","initTransferSummaryMap","wallet","initApiWallet","writableChainArchivist","readonlyChainArchivist","pendingTransactionsArchivist","pendingBlocksArchivist","initServerNode","initFinalizationArchivistIfNeeded","SimpleMempoolViewer","SimpleMempoolRunner","SimpleAccountBalanceViewer","SimpleFinalizationViewer","finalizedArchivist","SimpleBlockViewer","SimpleWindowedBlockViewer","maxWindowSize","syncInterval","SimpleXyoViewer","producerLocatorFromConfig","account","initProducerAccount","rewardAddress","asAddress","actors","producer","address","info","warn","SimpleBlockRewardViewer","SimpleBlockRunner","locatorsFromConfig","result","_root","includes","undefined","isUsageMeta","globalRegistry","usageMetaToOptions","meta","optionsFromGlobalZodRegistry","opts","schema","Object","values","globalRegistry","_map","isUsageMeta","hidden","title","isDefined","isNull","ConfigZod","cosmiconfigSync","configName","configSection","tryParseConfig","explorer","cosmiconfigSync","result","search","isNull","section","config","isDefined","ConfigZod","parse","net","waitForHostPort","host","port","Promise","resolve","tryConnect","socket","net","Socket","setTimeout","once","destroy","connect","end","configuration","version","isDefined","__VERSION__","resolveConfig","config","logger","console","defaultChainId","toAddress","resolved","structuredClone","chain","id","warn","getContextFromConfig","initLogger","orchestrator","Orchestrator","create","process","on","log","stop","exit","err","error","getLocatorsFromConfig","actors","context","contextFromConfigWithoutLocator","locators","locatorsFromConfig","runCLI","y","yargs","hideBin","argv","usage","XL1LogoColorizedAscii","parserConfiguration","env","scriptName","middleware","parsedConfigFile","tryParseConfig","parsedConfigArgs","parseResult","ConfigZod","safeParse","success","mergedConfig","deepMerge","validatedMergedConfigResult","resolvedConfig","data","validatedConfigResult","rootConfig","actorNames","Object","keys","actorName","JSON","stringify","isZodError","message","Error","stack","options","optionsFromGlobalZodRegistry","wrap","terminalWidth","command","runApi","singletons","runBridge","runMempool","runProducer","runRewardRedemptionApi","mempool","enabled","push","waitForHostPort","host","port","api","type","description","default","help","alias","config","start","config","quiet","runCLI"]}
@@ -0,0 +1,10 @@
1
+ import { type Logger } from '@xylabs/sdk-js';
2
+ import type { Config, CreatableProviderContext, ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk';
3
+ export declare function telemetryContextFromConfig(config: Config, serviceName: string, serviceVersion: string): Promise<import("@xyo-network/chain-telemetry").TelemetryProviders>;
4
+ export declare function contextFromConfigWithoutLocator(config: Config, logger: Logger, serviceName: string, serviceVersion: string): Promise<Omit<CreatableProviderContext, 'locator'>>;
5
+ export declare function rootLocatorFromConfig(config: Config, context: Omit<CreatableProviderContext, 'locator'>): Promise<ProviderFactoryLocatorInstance>;
6
+ export declare function localLocatorFromConfig(config: Config, context: CreatableProviderContext): Promise<ProviderFactoryLocatorInstance>;
7
+ export declare function remoteLocatorFromConfig(config: Config, context: CreatableProviderContext): Promise<ProviderFactoryLocatorInstance>;
8
+ export declare function producerLocatorFromConfig(config: Config, context: CreatableProviderContext): Promise<ProviderFactoryLocatorInstance>;
9
+ export declare function locatorsFromConfig(actors: string[], config: Config, context: Omit<CreatableProviderContext, 'locator'>): Promise<Record<string, ProviderFactoryLocatorInstance>>;
10
+ //# sourceMappingURL=locatorFromConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locatorFromConfig.d.ts","sourceRoot":"","sources":["../../src/locatorFromConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAC0B,KAAK,MAAM,EAC3C,MAAM,gBAAgB,CAAA;AAUvB,OAAO,KAAK,EACV,MAAM,EAAE,wBAAwB,EAAE,8BAA8B,EACjE,MAAM,sBAAsB,CAAA;AAmB7B,wBAAsB,0BAA0B,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,sEAW3G;AAED,wBAAsB,+BAA+B,CACnD,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAC,CAapD;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,SAAS,CAAC,GACjD,OAAO,CAAC,8BAA8B,CAAC,CAuBzC;AAED,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,8BAA8B,CAAC,CA8BzC;AAED,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,8BAA8B,CAAC,CA4BzC;AAED,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,8BAA8B,CAAC,CAkBzC;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EAAE,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,SAAS,CAAC,GACjD,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAC,CAOzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"runCLI.d.ts","sourceRoot":"","sources":["../../src/runCLI.ts"],"names":[],"mappings":"AAsEA,wBAAsB,MAAM,kBA2H3B"}
1
+ {"version":3,"file":"runCLI.d.ts","sourceRoot":"","sources":["../../src/runCLI.ts"],"names":[],"mappings":"AA8FA,wBAAsB,MAAM,kBAqJ3B"}