@xyo-network/xl1-cli-lib 1.17.7 → 1.18.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.
@@ -1,10 +1,14 @@
1
1
  import type { Logger } from '@xylabs/sdk-js';
2
- import { type OrchestratorInstance } from '@xyo-network/chain-orchestration';
3
- import type { Config } from '@xyo-network/xl1-protocol-sdk';
2
+ import type { AccountInstance } from '@xyo-network/account-model';
3
+ import type { OrchestratorInstance } from '@xyo-network/chain-orchestration';
4
+ import type { Config, ProviderFactoryLocatorInstance } from '@xyo-network/xl1-protocol-sdk';
4
5
  interface RunValidatorContext {
6
+ account: AccountInstance;
5
7
  config: Config;
8
+ locator: ProviderFactoryLocatorInstance;
6
9
  logger: Logger;
7
10
  orchestrator: OrchestratorInstance;
11
+ singletons: {};
8
12
  }
9
13
  export declare const runValidator: (context: RunValidatorContext) => Promise<void>;
10
14
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"runValidator.d.ts","sourceRoot":"","sources":["../../../../src/commands/validator/runValidator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,KAAK,oBAAoB,EAAkB,MAAM,kCAAkC,CAAA;AAC5F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAI3D,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,oBAAoB,CAAA;CACnC;AAED,eAAO,MAAM,YAAY,GAAU,SAAS,mBAAmB,kBAsB9D,CAAA"}
1
+ {"version":3,"file":"runValidator.d.ts","sourceRoot":"","sources":["../../../../src/commands/validator/runValidator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,kCAAkC,CAAA;AAEzC,OAAO,KAAK,EAAE,MAAM,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAA;AAE3F,UAAU,mBAAmB;IAC3B,OAAO,EAAE,eAAe,CAAA;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,8BAA8B,CAAA;IACvC,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,oBAAoB,CAAA;IAClC,UAAU,EAAE,EAAE,CAAA;CACf;AAED,eAAO,MAAM,YAAY,GAAU,SAAS,mBAAmB,kBAqB9D,CAAA"}
@@ -1,4 +1,3 @@
1
- export * from './orchestration/index.ts';
2
1
  export * from './runCLI.ts';
3
2
  export * from './start.ts';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
@@ -1,175 +1,8 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
- // src/orchestration/initServices.ts
5
- import { asAddress, assertEx, isDefined } from "@xylabs/sdk-js";
6
- import { buildTelemetryConfig, initBalanceSummaryMap, initHealthEndpoints, initProducerAccount, initRejectedTransactionsArchivist, initStatusReporter, initTransferSummaryMap } from "@xyo-network/chain-orchestration";
7
- import { initAccountBalanceService, initBlockProducer, initBlockRewardViewer, initBlockViewer, initChainService, initMempoolRunner, initMempoolViewer, initTimeService } from "@xyo-network/chain-services";
8
- import { initTelemetry } from "@xyo-network/chain-telemetry";
9
- import { startupSpanAsync } from "@xyo-network/chain-utils";
10
- import { validateHydratedBlockState } from "@xyo-network/chain-validation";
11
- import { ChainContractViewerMoniker, ChainStakeViewerMoniker } from "@xyo-network/xl1-protocol-sdk";
12
- var isStartable = /* @__PURE__ */ __name((value) => {
13
- const possibleStartable = value;
14
- return isDefined(possibleStartable.start) && typeof possibleStartable.start === "function" && possibleStartable.status === "created";
15
- }, "isStartable");
16
- var initServices = /* @__PURE__ */ __name(async (context) => {
17
- const { config: config2, logger } = context;
18
- const statusReporter = initStatusReporter({
19
- logger
20
- });
21
- await startupSpanAsync("initHealthEndpoints", () => initHealthEndpoints({
22
- ...context,
23
- statusReporter
24
- }));
25
- const telemetryConfig = buildTelemetryConfig(config2, "xl1-server", "1.0.0");
26
- const [{ traceProvider, meterProvider }, account] = await Promise.all([
27
- startupSpanAsync("initTelemetry", () => initTelemetry(telemetryConfig)),
28
- startupSpanAsync("initProducerAccount", () => initProducerAccount(context))
29
- ]);
30
- const baseParamsFields = {
31
- logger,
32
- meterProvider,
33
- traceProvider
34
- };
35
- const initParams = {
36
- config: config2,
37
- logger,
38
- meterProvider,
39
- statusReporter,
40
- traceProvider
41
- };
42
- const mempoolViewer = await initMempoolViewer({
43
- config: config2,
44
- logger
45
- });
46
- const mempoolRunner = await initMempoolRunner({
47
- config: config2,
48
- logger
49
- });
50
- const [rejectedTransactionsArchivist, chainService, balanceSummaryMap] = await Promise.all([
51
- startupSpanAsync("RejectedTransactionsArchivist", () => initRejectedTransactionsArchivist(initParams)),
52
- startupSpanAsync("ChainService", () => initChainService({
53
- ...initParams,
54
- account,
55
- name: "ChainService"
56
- })),
57
- startupSpanAsync("BalanceSummaryMap", () => initBalanceSummaryMap(initParams)),
58
- startupSpanAsync("TransferSummaryMap", () => initTransferSummaryMap(initParams))
59
- ]);
60
- const chainContractViewer = {
61
- forkedAtBlockNumber: /* @__PURE__ */ __name(function() {
62
- return chainService.forkedAtBlockNumber();
63
- }, "forkedAtBlockNumber"),
64
- forkedAtHash: /* @__PURE__ */ __name(function() {
65
- return chainService.forkedAtHash();
66
- }, "forkedAtHash"),
67
- forkedChainId: /* @__PURE__ */ __name(function() {
68
- return chainService.forkedChainId();
69
- }, "forkedChainId"),
70
- minWithdrawalBlocks: /* @__PURE__ */ __name(function() {
71
- return chainService.minWithdrawalBlocks();
72
- }, "minWithdrawalBlocks"),
73
- rewardsContract: /* @__PURE__ */ __name(function() {
74
- return chainService.rewardsContract();
75
- }, "rewardsContract"),
76
- stakingTokenAddress: /* @__PURE__ */ __name(function() {
77
- return chainService.stakingTokenAddress();
78
- }, "stakingTokenAddress"),
79
- moniker: ChainContractViewerMoniker
80
- };
81
- const chainStakeViewer = {
82
- ...chainContractViewer,
83
- active: /* @__PURE__ */ __name(function() {
84
- return chainService.active();
85
- }, "active"),
86
- activeByStaked: /* @__PURE__ */ __name(function(staked) {
87
- return chainService.activeByStaked(staked);
88
- }, "activeByStaked"),
89
- activeByStaker: /* @__PURE__ */ __name(function(address) {
90
- return chainService.activeByStaker(address);
91
- }, "activeByStaker"),
92
- pending: /* @__PURE__ */ __name(function() {
93
- return chainService.pending();
94
- }, "pending"),
95
- pendingByStaker: /* @__PURE__ */ __name(function(staker) {
96
- return chainService.pendingByStaker(staker);
97
- }, "pendingByStaker"),
98
- withdrawn: /* @__PURE__ */ __name(function() {
99
- return chainService.withdrawn();
100
- }, "withdrawn"),
101
- withdrawnByStaker: /* @__PURE__ */ __name(function(staker) {
102
- return chainService.withdrawnByStaker(staker);
103
- }, "withdrawnByStaker"),
104
- chainId: /* @__PURE__ */ __name(function() {
105
- return chainService.chainId();
106
- }, "chainId"),
107
- moniker: ChainStakeViewerMoniker
108
- };
109
- const blockRewardViewer = await initBlockRewardViewer({
110
- config: config2,
111
- chainContractViewer
112
- });
113
- const chainId = await chainService.chainId();
114
- const blockViewer = await startupSpanAsync("BlockViewer", () => initBlockViewer({
115
- ...initParams
116
- }));
117
- const balanceService = await startupSpanAsync("BalanceService", () => initAccountBalanceService({
118
- ...initParams
119
- }));
120
- const time = await startupSpanAsync("TimeService", () => initTimeService({
121
- name: "TimeService",
122
- blockViewer,
123
- ...initParams
124
- }));
125
- const validatorParams = {
126
- name: "Validator",
127
- blockViewer,
128
- validateHydratedBlockState,
129
- ...initParams
130
- };
131
- const rewardAddress = isDefined(config2.producer.rewardAddress) ? assertEx(asAddress(config2.producer.rewardAddress), () => "Invalid block reward address provided") : account.address;
132
- const producerParams = {
133
- ...validatorParams,
134
- account,
135
- chainId,
136
- name: "Producer",
137
- balanceViewer: balanceService,
138
- blockRewardViewer,
139
- mempoolRunner,
140
- mempoolViewer,
141
- rejectedTransactionsArchivist,
142
- rewardAddress,
143
- time,
144
- ...initParams
145
- };
146
- const producer = await startupSpanAsync("Producer", () => initBlockProducer(producerParams));
147
- const services = {
148
- account,
149
- balance: balanceService,
150
- chainContractViewer,
151
- blockViewer,
152
- chainStakeViewer,
153
- mempoolRunner,
154
- mempoolViewer,
155
- producer,
156
- reward: blockRewardViewer
157
- };
158
- logger?.log("All services created. Starting...");
159
- const startableServices = [
160
- balanceSummaryMap,
161
- ...Object.values(services)
162
- ].filter(isStartable);
163
- assertEx((await Promise.all(startableServices.map((service) => service.start()))).every(Boolean), () => "One or more services failed to start");
164
- logger?.log("All services started successfully.");
165
- return {
166
- ...services,
167
- ...baseParamsFields
168
- };
169
- }, "initServices");
170
-
171
4
  // src/runCLI.ts
172
- import { deepMerge, isDefined as isDefined4 } from "@xylabs/sdk-js";
5
+ import { deepMerge, isDefined as isDefined3 } from "@xylabs/sdk-js";
173
6
  import { Orchestrator } from "@xyo-network/chain-orchestration";
174
7
  import { runProducer } from "@xyo-network/chain-producer";
175
8
  import { ConfigZod } from "@xyo-network/xl1-protocol-sdk";
@@ -226,16 +59,16 @@ var XL1LogoColorizedAscii = `\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\
226
59
  \x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;108;93;162m\xB2\x1B[0m\x1B[38;2;99;79;176m^\x1B[0m`;
227
60
 
228
61
  // src/initLogger.ts
229
- import { Base, ConsoleLogger, isDefined as isDefined2, LogLevel, SilentLogger } from "@xylabs/sdk-js";
62
+ import { Base, ConsoleLogger, isDefined, LogLevel, SilentLogger } from "@xylabs/sdk-js";
230
63
  var initLogger = /* @__PURE__ */ __name((config2) => {
231
64
  let logger;
232
65
  if (config2.silent) {
233
66
  logger = new SilentLogger();
234
67
  } else {
235
68
  let level;
236
- if (isDefined2(config2.logLevel)) {
69
+ if (isDefined(config2.logLevel)) {
237
70
  const parsed = LogLevel[config2.logLevel.toLowerCase()];
238
- if (isDefined2(parsed)) level = parsed;
71
+ if (isDefined(parsed)) level = parsed;
239
72
  }
240
73
  logger = new ConsoleLogger(level);
241
74
  }
@@ -261,7 +94,7 @@ var optionsFromGlobalZodRegistry = /* @__PURE__ */ __name(() => {
261
94
  }, "optionsFromGlobalZodRegistry");
262
95
 
263
96
  // src/tryParseConfig.ts
264
- import { isDefined as isDefined3, isNull } from "@xylabs/sdk-js";
97
+ import { isDefined as isDefined2, isNull } from "@xylabs/sdk-js";
265
98
  import { cosmiconfigSync } from "cosmiconfig";
266
99
  var configName = "xyo";
267
100
  var configSection = "xl1";
@@ -270,7 +103,7 @@ var tryParseConfig = /* @__PURE__ */ __name(() => {
270
103
  const result = explorer.search();
271
104
  if (!isNull(result)) {
272
105
  const section = result?.config?.[configSection];
273
- if (isDefined3(section) && typeof section === "object") {
106
+ if (isDefined2(section) && typeof section === "object") {
274
107
  return section;
275
108
  }
276
109
  }
@@ -300,7 +133,7 @@ var waitForHostPort = /* @__PURE__ */ __name((host, port) => {
300
133
 
301
134
  // src/runCLI.ts
302
135
  var configuration;
303
- var version = isDefined4("1.17.6") ? "1.17.6" : "unknown";
136
+ var version = isDefined3("1.18.0-rc.1") ? "1.18.0-rc.1" : "unknown";
304
137
  var getContextFromConfig = /* @__PURE__ */ __name(async (configuration2) => {
305
138
  const logger = initLogger(configuration2);
306
139
  const orchestrator = await Orchestrator.create({
@@ -426,7 +259,6 @@ var start = /* @__PURE__ */ __name(async () => {
426
259
  await runCLI();
427
260
  }, "start");
428
261
  export {
429
- initServices,
430
262
  runCLI,
431
263
  start
432
264
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/orchestration/initServices.ts","../../src/runCLI.ts","../../src/commands/api/runApi.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 {\n Address,\n BaseParamsFields, CreatableName, Logger,\n Promisable,\n} from '@xylabs/sdk-js'\nimport {\n asAddress, assertEx, isDefined,\n} from '@xylabs/sdk-js'\nimport type { ChainInitializableParams } from '@xyo-network/chain-orchestration'\nimport {\n buildTelemetryConfig,\n initBalanceSummaryMap,\n initHealthEndpoints, initProducerAccount, initRejectedTransactionsArchivist, initStatusReporter, initTransferSummaryMap,\n} from '@xyo-network/chain-orchestration'\nimport type { SimpleBlockRunnerParams, XyoValidatorParams } from '@xyo-network/chain-services'\nimport {\n initAccountBalanceService,\n initBlockProducer, initBlockRewardViewer, initBlockViewer, initChainService,\n initMempoolRunner, initMempoolViewer, initTimeService,\n} from '@xyo-network/chain-services'\nimport { initTelemetry } from '@xyo-network/chain-telemetry'\nimport { startupSpanAsync } from '@xyo-network/chain-utils'\nimport { validateHydratedBlockState } from '@xyo-network/chain-validation'\nimport type { ChainId } from '@xyo-network/xl1-protocol'\nimport {\n type ChainContractViewer, ChainContractViewerMoniker, type ChainServiceCollectionV2, type ChainStakeViewer, ChainStakeViewerMoniker,\n type Config,\n} from '@xyo-network/xl1-protocol-sdk'\n\ninterface Startable {\n start: () => Promise<boolean>\n status: string\n}\n\nconst isStartable = (value: unknown): value is Startable => {\n const possibleStartable = value as Startable\n return isDefined(possibleStartable.start) && (typeof (possibleStartable.start) === 'function') && (possibleStartable.status === 'created')\n}\n\ninterface InitServicesContext {\n config: Config\n logger: Logger\n}\n\nexport const initServices = async (context: InitServicesContext): Promise<ChainServiceCollectionV2 & BaseParamsFields> => {\n const { config, logger } = context\n const statusReporter = initStatusReporter({ logger })\n\n await startupSpanAsync('initHealthEndpoints', () => initHealthEndpoints({ ...context, statusReporter }))\n\n const telemetryConfig = buildTelemetryConfig(config, 'xl1-server', '1.0.0')\n\n const [\n { traceProvider, meterProvider },\n account,\n ] = await Promise.all([\n startupSpanAsync('initTelemetry', () => initTelemetry(telemetryConfig)),\n startupSpanAsync('initProducerAccount', () => initProducerAccount(context)),\n ])\n\n const baseParamsFields: BaseParamsFields = {\n logger, meterProvider, traceProvider,\n }\n const initParams: ChainInitializableParams = {\n config, logger, meterProvider, statusReporter, traceProvider,\n }\n\n const mempoolViewer = await initMempoolViewer({ config, logger })\n const mempoolRunner = await initMempoolRunner({ config, logger })\n\n // Archivists\n const [\n rejectedTransactionsArchivist,\n chainService,\n balanceSummaryMap,\n ] = await Promise.all([\n startupSpanAsync(\n 'RejectedTransactionsArchivist',\n () => initRejectedTransactionsArchivist(initParams),\n ),\n startupSpanAsync(\n 'ChainService',\n () => initChainService({\n ...initParams, account, name: 'ChainService' as CreatableName,\n }),\n ),\n startupSpanAsync(\n 'BalanceSummaryMap',\n () => initBalanceSummaryMap(initParams),\n\n ),\n startupSpanAsync(\n 'TransferSummaryMap',\n () => initTransferSummaryMap(initParams),\n ),\n ])\n\n const chainContractViewer = {\n forkedAtBlockNumber: function (): Promise<bigint> {\n return chainService.forkedAtBlockNumber()\n },\n forkedAtHash: function (): Promise<bigint> {\n return chainService.forkedAtHash()\n },\n forkedChainId: function (): Promise<Address> {\n return chainService.forkedChainId()\n },\n minWithdrawalBlocks: function (): Promise<bigint> {\n return chainService.minWithdrawalBlocks()\n },\n rewardsContract: function (): Promise<string> {\n return chainService.rewardsContract()\n },\n stakingTokenAddress: function (): Promise<string> {\n return chainService.stakingTokenAddress()\n },\n moniker: ChainContractViewerMoniker,\n } satisfies ChainContractViewer\n\n const chainStakeViewer = {\n ...chainContractViewer,\n active: function (): Promisable<bigint> {\n return chainService.active()\n },\n activeByStaked: function (staked: Address): Promisable<bigint> {\n return chainService.activeByStaked(staked)\n },\n activeByStaker: function (address: Address): Promisable<bigint> {\n return chainService.activeByStaker(address)\n },\n pending: function (): Promisable<bigint> {\n return chainService.pending()\n },\n pendingByStaker: function (staker: Address): Promisable<bigint> {\n return chainService.pendingByStaker(staker)\n },\n withdrawn: function (): Promisable<bigint> {\n return chainService.withdrawn()\n },\n withdrawnByStaker: function (staker: Address): Promisable<bigint> {\n return chainService.withdrawnByStaker(staker)\n },\n chainId: function (): Promisable<ChainId> {\n return chainService.chainId()\n },\n moniker: ChainStakeViewerMoniker,\n } satisfies ChainStakeViewer\n\n const blockRewardViewer = await initBlockRewardViewer({ config, chainContractViewer })\n const chainId = await chainService.chainId()\n\n const blockViewer = await startupSpanAsync(\n 'BlockViewer',\n () => initBlockViewer({ ...initParams }),\n )\n\n const balanceService = await startupSpanAsync(\n 'BalanceService',\n () => initAccountBalanceService({ ...initParams }),\n )\n\n const time = await startupSpanAsync(\n 'TimeService',\n () => initTimeService({\n name: 'TimeService' as CreatableName,\n blockViewer,\n ...initParams,\n }),\n )\n\n const validatorParams: XyoValidatorParams = {\n name: 'Validator' as CreatableName,\n blockViewer,\n validateHydratedBlockState,\n ...initParams,\n }\n\n const rewardAddress = isDefined(config.producer.rewardAddress)\n ? assertEx(asAddress(config.producer.rewardAddress), () => 'Invalid block reward address provided')\n : account.address\n const producerParams: SimpleBlockRunnerParams = {\n ...validatorParams,\n account,\n chainId,\n name: 'Producer' as CreatableName,\n balanceViewer: balanceService,\n blockRewardViewer,\n mempoolRunner,\n mempoolViewer,\n rejectedTransactionsArchivist,\n rewardAddress,\n time,\n ...initParams,\n }\n const producer = await startupSpanAsync('Producer', () => initBlockProducer(producerParams))\n const services: ChainServiceCollectionV2 = {\n account,\n balance: balanceService,\n chainContractViewer,\n blockViewer,\n chainStakeViewer,\n mempoolRunner,\n mempoolViewer,\n producer,\n reward: blockRewardViewer,\n }\n\n logger?.log('All services created. Starting...')\n const startableServices = [balanceSummaryMap, ...Object.values(services)].filter(isStartable)\n // Start all services that have a start method and assert that they all started successfully\n assertEx(\n (await Promise.all(startableServices.map(service => service.start()))).every(Boolean),\n () => 'One or more services failed to start',\n )\n logger?.log('All services started successfully.')\n return { ...services, ...baseParamsFields }\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { deepMerge, isDefined } from '@xylabs/sdk-js'\nimport { Orchestrator } from '@xyo-network/chain-orchestration'\nimport { runProducer } from '@xyo-network/chain-producer'\nimport { type Config, ConfigZod } from '@xyo-network/xl1-protocol-sdk'\nimport type { Argv } from 'yargs'\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\nimport { ZodError } from 'zod'\n\nimport {\n runApi, 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\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 // 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 // Validate the merged configuration\n configuration = ConfigZod.parse(mergedConfig)\n } catch (err) {\n if (err instanceof ZodError) {\n console.error(`${err.message}`)\n }\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 runApi({ ...context, config: configuration })\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({ ...context, config: configuration })\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 runApi({ ...context, config: configuration })\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({ ...context, config: configuration })\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-api'\nimport type { Config } from '@xyo-network/xl1-protocol-sdk'\n\ninterface RunApiContext {\n config: Config\n logger?: Logger\n}\n\nexport function runApi(context: RunApiContext) {\n void getServer(context)\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { getServer } from '@xyo-network/chain-bridge'\nimport type { Config } from '@xyo-network/xl1-protocol-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-protocol-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-protocol-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-protocol-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-protocol-sdk'\nimport { isUsageMeta } from '@xyo-network/xl1-protocol-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 { 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 = (): Record<string, unknown> => {\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 section\n }\n }\n return {}\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":";;;;AAKA,SACEA,WA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,iBAAW;QAAE,GAAGJ;QAASE,QAAQ9C;MAAc,CAAA;AAE/C,YAAMqD,gBAAgBrD,cAAcmD,QAAQG,MAAMtD,cAAcmD,QAAQI,IAAI;IAC9E;AAEAV,WAAO;MAAE,GAAGD;MAASE,QAAQ9C;IAAc,CAAA;AAE3C,UAAMqD,gBAAgBrD,cAAcwD,IAAIF,MAAMtD,cAAcwD,IAAID,IAAI;AAEpE,UAAMN,YAAY;MAAE,GAAGL;MAASE,QAAQ9C;IAAc,CAAA;EACxD,CAAA,EACCyD,KAAI,EACJC,MAAM,QAAQ,GAAA,EACdzD,QAAQA,OAAAA,EACRoB;AAEH,QAAMA;AACR;AAlGsBJ;;;AUzDtB,SAAS0C,cAAc;AAIhB,IAAMC,QAAQ,mCAAA;AACnBC,SAAO;IAAEC,OAAO;EAAK,CAAA;AACrB,QAAMC,OAAAA;AACR,GAHqB;","names":["asAddress","assertEx","isDefined","buildTelemetryConfig","initBalanceSummaryMap","initHealthEndpoints","initProducerAccount","initRejectedTransactionsArchivist","initStatusReporter","initTransferSummaryMap","initAccountBalanceService","initBlockProducer","initBlockRewardViewer","initBlockViewer","initChainService","initMempoolRunner","initMempoolViewer","initTimeService","initTelemetry","startupSpanAsync","validateHydratedBlockState","ChainContractViewerMoniker","ChainStakeViewerMoniker","isStartable","value","possibleStartable","isDefined","start","status","initServices","context","config","logger","statusReporter","initStatusReporter","startupSpanAsync","initHealthEndpoints","telemetryConfig","buildTelemetryConfig","traceProvider","meterProvider","account","Promise","all","initTelemetry","initProducerAccount","baseParamsFields","initParams","mempoolViewer","initMempoolViewer","mempoolRunner","initMempoolRunner","rejectedTransactionsArchivist","chainService","balanceSummaryMap","initRejectedTransactionsArchivist","initChainService","name","initBalanceSummaryMap","initTransferSummaryMap","chainContractViewer","forkedAtBlockNumber","forkedAtHash","forkedChainId","minWithdrawalBlocks","rewardsContract","stakingTokenAddress","moniker","ChainContractViewerMoniker","chainStakeViewer","active","activeByStaked","staked","activeByStaker","address","pending","pendingByStaker","staker","withdrawn","withdrawnByStaker","chainId","ChainStakeViewerMoniker","blockRewardViewer","initBlockRewardViewer","blockViewer","initBlockViewer","balanceService","initAccountBalanceService","time","initTimeService","validatorParams","validateHydratedBlockState","rewardAddress","producer","assertEx","asAddress","producerParams","balanceViewer","initBlockProducer","services","balance","reward","log","startableServices","Object","values","filter","map","service","every","Boolean","deepMerge","isDefined","Orchestrator","runProducer","ConfigZod","yargs","hideBin","ZodError","getServer","runApi","context","getServer","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","cosmiconfigSync","configName","configSection","tryParseConfig","explorer","cosmiconfigSync","result","search","isNull","section","config","isDefined","net","waitForHostPort","host","port","Promise","resolve","tryConnect","socket","net","Socket","setTimeout","once","destroy","connect","end","configuration","version","isDefined","__VERSION__","getContextFromConfig","logger","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","mergedConfig","deepMerge","ConfigZod","parse","ZodError","console","message","Error","options","optionsFromGlobalZodRegistry","wrap","terminalWidth","command","context","runApi","config","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/api/runApi.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 { deepMerge, isDefined } from '@xylabs/sdk-js'\nimport { Orchestrator } from '@xyo-network/chain-orchestration'\nimport { runProducer } from '@xyo-network/chain-producer'\nimport { type Config, ConfigZod } from '@xyo-network/xl1-protocol-sdk'\nimport type { Argv } from 'yargs'\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\nimport { ZodError } from 'zod'\n\nimport {\n runApi, 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\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 // 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 // Validate the merged configuration\n configuration = ConfigZod.parse(mergedConfig)\n } catch (err) {\n if (err instanceof ZodError) {\n console.error(`${err.message}`)\n }\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 runApi({ ...context, config: configuration })\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({ ...context, config: configuration })\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 runApi({ ...context, config: configuration })\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({ ...context, config: configuration })\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-api'\nimport type { Config } from '@xyo-network/xl1-protocol-sdk'\n\ninterface RunApiContext {\n config: Config\n logger?: Logger\n}\n\nexport function runApi(context: RunApiContext) {\n void getServer(context)\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { getServer } from '@xyo-network/chain-bridge'\nimport type { Config } from '@xyo-network/xl1-protocol-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-protocol-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-protocol-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-protocol-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-protocol-sdk'\nimport { isUsageMeta } from '@xyo-network/xl1-protocol-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 { 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 = (): Record<string, unknown> => {\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 section\n }\n }\n return {}\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,WAAWC,aAAAA,kBAAiB;AACrC,SAASC,oBAAoB;AAC7B,SAASC,mBAAmB;AAC5B,SAAsBC,iBAAiB;AAEvC,OAAOC,WAAW;AAClB,SAASC,eAAe;AACxB,SAASC,gBAAgB;;;ACPzB,SAASC,iBAAiB;AAQnB,SAASC,OAAOC,SAAsB;AAC3C,OAAKC,UAAUD,OAAAA;AACjB;AAFgBD;;;ACRhB,SAASG,aAAAA,kBAAiB;AAQnB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zDtB,SAAS0C,cAAc;AAIhB,IAAMC,QAAQ,mCAAA;AACnBC,SAAO;IAAEC,OAAO;EAAK,CAAA;AACrB,QAAMC,OAAAA;AACR,GAHqB;","names":["deepMerge","isDefined","Orchestrator","runProducer","ConfigZod","yargs","hideBin","ZodError","getServer","runApi","context","getServer","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","cosmiconfigSync","configName","configSection","tryParseConfig","explorer","cosmiconfigSync","result","search","isNull","section","config","isDefined","net","waitForHostPort","host","port","Promise","resolve","tryConnect","socket","net","Socket","setTimeout","once","destroy","connect","end","configuration","version","isDefined","__VERSION__","getContextFromConfig","logger","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","mergedConfig","deepMerge","ConfigZod","parse","ZodError","console","message","Error","options","optionsFromGlobalZodRegistry","wrap","terminalWidth","command","context","runApi","config","runBridge","runMempool","runProducer","runRewardRedemptionApi","mempool","enabled","waitForHostPort","host","port","api","help","alias","config","start","config","quiet","runCLI"]}
package/dist/node/xl1.mjs CHANGED
@@ -136,7 +136,7 @@ var waitForHostPort = /* @__PURE__ */ __name((host, port) => {
136
136
 
137
137
  // src/runCLI.ts
138
138
  var configuration;
139
- var version = isDefined3("1.17.6") ? "1.17.6" : "unknown";
139
+ var version = isDefined3("1.18.0-rc.1") ? "1.18.0-rc.1" : "unknown";
140
140
  var getContextFromConfig = /* @__PURE__ */ __name(async (configuration2) => {
141
141
  const logger = initLogger(configuration2);
142
142
  const orchestrator = await Orchestrator.create({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/start.ts","../../src/runCLI.ts","../../src/commands/api/runApi.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/xl1.ts"],"sourcesContent":["import { config } from 'dotenv'\n\nimport { runCLI } from './runCLI.ts'\n\nexport const start = async () => {\n config({ quiet: true })\n await runCLI()\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { deepMerge, isDefined } from '@xylabs/sdk-js'\nimport { Orchestrator } from '@xyo-network/chain-orchestration'\nimport { runProducer } from '@xyo-network/chain-producer'\nimport { type Config, ConfigZod } from '@xyo-network/xl1-protocol-sdk'\nimport type { Argv } from 'yargs'\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\nimport { ZodError } from 'zod'\n\nimport {\n runApi, 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\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 // 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 // Validate the merged configuration\n configuration = ConfigZod.parse(mergedConfig)\n } catch (err) {\n if (err instanceof ZodError) {\n console.error(`${err.message}`)\n }\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 runApi({ ...context, config: configuration })\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({ ...context, config: configuration })\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 runApi({ ...context, config: configuration })\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({ ...context, config: configuration })\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-api'\nimport type { Config } from '@xyo-network/xl1-protocol-sdk'\n\ninterface RunApiContext {\n config: Config\n logger?: Logger\n}\n\nexport function runApi(context: RunApiContext) {\n void getServer(context)\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { getServer } from '@xyo-network/chain-bridge'\nimport type { Config } from '@xyo-network/xl1-protocol-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-protocol-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-protocol-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-protocol-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-protocol-sdk'\nimport { isUsageMeta } from '@xyo-network/xl1-protocol-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 { 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 = (): Record<string, unknown> => {\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 section\n }\n }\n return {}\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 { start } from './start.ts'\n\nstart().catch((err) => {\n // If we're in development mode, log the stack trace to the console\n if (process.env.NODE_ENV === 'development') console.error('An error occurred during startup:', err)\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1)\n})\n"],"mappings":";;;;AAAA,SAASA,cAAc;;;ACCvB,SAASC,WAAWC,aAAAA,kBAAiB;AACrC,SAASC,oBAAoB;AAC7B,SAASC,mBAAmB;AAC5B,SAAsBC,iBAAiB;AAEvC,OAAOC,WAAW;AAClB,SAASC,eAAe;AACxB,SAASC,gBAAgB;;;ACPzB,SAASC,iBAAiB;AAQnB,SAASC,OAAOC,SAAsB;AAC3C,OAAKC,UAAUD,OAAAA;AACjB;AAFgBD;;;ACRhB,SAASG,aAAAA,kBAAiB;AAQnB,SAASC,UAAUC,SAAyB;AACjD,OAAKC,WAAUD,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,GAAG;AAC9B,YAAMC,SAASC,SAASR,QAAOM,SAASG,YAAW,CAAA;AACnD,UAAIJ,UAAUE,MAAAA,EAASH,SAAQG;IACjC;AACAN,aAAS,IAAIS,cAAcN,KAAAA;EAC7B;AACAO,OAAKC,gBAAgBX;AACrB,SAAOA;AACT,GAd0B;;;ACP1B,SAASY,mBAAmB;AAE5B,SAASC,sBAAsB;AAE/B,IAAMC,qBAAqB,wBAACC,SAAAA;AAC1B,SAAOA;AACT,GAF2B;AAIpB,IAA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9C;MAAc,CAAA;AAE/C,YAAMqD,gBAAgBrD,cAAcmD,QAAQG,MAAMtD,cAAcmD,QAAQI,IAAI;IAC9E;AAEAV,WAAO;MAAE,GAAGD;MAASE,QAAQ9C;IAAc,CAAA;AAE3C,UAAMqD,gBAAgBrD,cAAcwD,IAAIF,MAAMtD,cAAcwD,IAAID,IAAI;AAEpE,UAAMN,YAAY;MAAE,GAAGL;MAASE,QAAQ9C;IAAc,CAAA;EACxD,CAAA,EACCyD,KAAI,EACJC,MAAM,QAAQ,GAAA,EACdzD,QAAQA,OAAAA,EACRoB;AAEH,QAAMA;AACR;AAlGsBJ;;;ADrDf,IAAM0C,QAAQ,mCAAA;AACnBC,SAAO;IAAEC,OAAO;EAAK,CAAA;AACrB,QAAMC,OAAAA;AACR,GAHqB;;;AWFrBC,MAAAA,EAAQC,MAAM,CAACC,QAAAA;AAEb,MAAIC,QAAQC,IAAIC,aAAa,cAAeC,SAAQC,MAAM,qCAAqCL,GAAAA;AAE/FC,UAAQK,KAAK,CAAA;AACf,CAAA;","names":["config","deepMerge","isDefined","Orchestrator","runProducer","ConfigZod","yargs","hideBin","ZodError","getServer","runApi","context","getServer","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","cosmiconfigSync","configName","configSection","tryParseConfig","explorer","cosmiconfigSync","result","search","isNull","section","config","isDefined","net","waitForHostPort","host","port","Promise","resolve","tryConnect","socket","net","Socket","setTimeout","once","destroy","connect","end","configuration","version","isDefined","__VERSION__","getContextFromConfig","logger","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","mergedConfig","deepMerge","ConfigZod","parse","ZodError","console","message","Error","options","optionsFromGlobalZodRegistry","wrap","terminalWidth","command","context","runApi","config","runBridge","runMempool","runProducer","runRewardRedemptionApi","mempool","enabled","waitForHostPort","host","port","api","help","alias","start","config","quiet","runCLI","start","catch","err","process","env","NODE_ENV","console","error","exit"]}
1
+ {"version":3,"sources":["../../src/start.ts","../../src/runCLI.ts","../../src/commands/api/runApi.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/xl1.ts"],"sourcesContent":["import { config } from 'dotenv'\n\nimport { runCLI } from './runCLI.ts'\n\nexport const start = async () => {\n config({ quiet: true })\n await runCLI()\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { deepMerge, isDefined } from '@xylabs/sdk-js'\nimport { Orchestrator } from '@xyo-network/chain-orchestration'\nimport { runProducer } from '@xyo-network/chain-producer'\nimport { type Config, ConfigZod } from '@xyo-network/xl1-protocol-sdk'\nimport type { Argv } from 'yargs'\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\nimport { ZodError } from 'zod'\n\nimport {\n runApi, 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\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 // 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 // Validate the merged configuration\n configuration = ConfigZod.parse(mergedConfig)\n } catch (err) {\n if (err instanceof ZodError) {\n console.error(`${err.message}`)\n }\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 runApi({ ...context, config: configuration })\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({ ...context, config: configuration })\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 runApi({ ...context, config: configuration })\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({ ...context, config: configuration })\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-api'\nimport type { Config } from '@xyo-network/xl1-protocol-sdk'\n\ninterface RunApiContext {\n config: Config\n logger?: Logger\n}\n\nexport function runApi(context: RunApiContext) {\n void getServer(context)\n}\n","import type { Logger } from '@xylabs/sdk-js'\nimport { getServer } from '@xyo-network/chain-bridge'\nimport type { Config } from '@xyo-network/xl1-protocol-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-protocol-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-protocol-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-protocol-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-protocol-sdk'\nimport { isUsageMeta } from '@xyo-network/xl1-protocol-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 { 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 = (): Record<string, unknown> => {\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 section\n }\n }\n return {}\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 { start } from './start.ts'\n\nstart().catch((err) => {\n // If we're in development mode, log the stack trace to the console\n if (process.env.NODE_ENV === 'development') console.error('An error occurred during startup:', err)\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1)\n})\n"],"mappings":";;;;AAAA,SAASA,cAAc;;;ACCvB,SAASC,WAAWC,aAAAA,kBAAiB;AACrC,SAASC,oBAAoB;AAC7B,SAASC,mBAAmB;AAC5B,SAAsBC,iBAAiB;AAEvC,OAAOC,WAAW;AAClB,SAASC,eAAe;AACxB,SAASC,gBAAgB;;;ACPzB,SAASC,iBAAiB;AAQnB,SAASC,OAAOC,SAAsB;AAC3C,OAAKC,UAAUD,OAAAA;AACjB;AAFgBD;;;ACRhB,SAASG,aAAAA,kBAAiB;AAQnB,SAASC,UAAUC,SAAyB;AACjD,OAAKC,WAAUD,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,GAAG;AAC9B,YAAMC,SAASC,SAASR,QAAOM,SAASG,YAAW,CAAA;AACnD,UAAIJ,UAAUE,MA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GN;QAASE,QAAQ9C;MAAc,CAAA;IAC7D,CAAA;EACJ,CAAA,EACC2C,QAAQ,MAAM,uBAAuB,MAAA;EAAO,GAAG,YAAA;AAC9C,UAAMC,UAAU,MAAMxC,qBAAqBJ,aAAAA;AAC3C,QAAIA,cAAcmD,QAAQC,SAAS;AAEjCJ,iBAAW;QAAE,GAAGJ;QAASE,QAAQ9C;MAAc,CAAA;AAE/C,YAAMqD,gBAAgBrD,cAAcmD,QAAQG,MAAMtD,cAAcmD,QAAQI,IAAI;IAC9E;AAEAV,WAAO;MAAE,GAAGD;MAASE,QAAQ9C;IAAc,CAAA;AAE3C,UAAMqD,gBAAgBrD,cAAcwD,IAAIF,MAAMtD,cAAcwD,IAAID,IAAI;AAEpE,UAAMN,YAAY;MAAE,GAAGL;MAASE,QAAQ9C;IAAc,CAAA;EACxD,CAAA,EACCyD,KAAI,EACJC,MAAM,QAAQ,GAAA,EACdzD,QAAQA,OAAAA,EACRoB;AAEH,QAAMA;AACR;AAlGsBJ;;;ADrDf,IAAM0C,QAAQ,mCAAA;AACnBC,SAAO;IAAEC,OAAO;EAAK,CAAA;AACrB,QAAMC,OAAAA;AACR,GAHqB;;;AWFrBC,MAAAA,EAAQC,MAAM,CAACC,QAAAA;AAEb,MAAIC,QAAQC,IAAIC,aAAa,cAAeC,SAAQC,MAAM,qCAAqCL,GAAAA;AAE/FC,UAAQK,KAAK,CAAA;AACf,CAAA;","names":["config","deepMerge","isDefined","Orchestrator","runProducer","ConfigZod","yargs","hideBin","ZodError","getServer","runApi","context","getServer","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","cosmiconfigSync","configName","configSection","tryParseConfig","explorer","cosmiconfigSync","result","search","isNull","section","config","isDefined","net","waitForHostPort","host","port","Promise","resolve","tryConnect","socket","net","Socket","setTimeout","once","destroy","connect","end","configuration","version","isDefined","__VERSION__","getContextFromConfig","logger","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","mergedConfig","deepMerge","ConfigZod","parse","ZodError","console","message","Error","options","optionsFromGlobalZodRegistry","wrap","terminalWidth","command","context","runApi","config","runBridge","runMempool","runProducer","runRewardRedemptionApi","mempool","enabled","waitForHostPort","host","port","api","help","alias","start","config","quiet","runCLI","start","catch","err","process","env","NODE_ENV","console","error","exit"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/xl1-cli-lib",
3
- "version": "1.17.7",
3
+ "version": "1.18.0",
4
4
  "description": "XYO Layer One CLI Library",
5
5
  "homepage": "https://xylabs.com",
6
6
  "bugs": {
@@ -44,36 +44,33 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@xylabs/sdk-js": "~5.0.51",
47
- "@xyo-network/chain-api": "~1.17.7",
48
- "@xyo-network/chain-bridge": "~1.17.7",
49
- "@xyo-network/chain-mempool": "~1.17.7",
50
- "@xyo-network/chain-orchestration": "~1.17.7",
51
- "@xyo-network/chain-producer": "~1.17.7",
52
- "@xyo-network/chain-reward-redemption": "~1.17.7",
53
- "@xyo-network/chain-services": "~1.17.7",
54
- "@xyo-network/chain-telemetry": "~1.17.7",
55
- "@xyo-network/chain-utils": "~1.17.7",
56
- "@xyo-network/chain-validation": "~1.17.7",
57
- "@xyo-network/xl1-protocol-sdk": "~1.17.7",
47
+ "@xyo-network/chain-api": "~1.18.0",
48
+ "@xyo-network/chain-bridge": "~1.18.0",
49
+ "@xyo-network/chain-mempool": "~1.18.0",
50
+ "@xyo-network/chain-orchestration": "~1.18.0",
51
+ "@xyo-network/chain-producer": "~1.18.0",
52
+ "@xyo-network/chain-reward-redemption": "~1.18.0",
53
+ "@xyo-network/xl1-protocol-sdk": "~1.18.0",
58
54
  "cosmiconfig": "~9.0.0",
59
55
  "dotenv": "~17.2.3",
60
56
  "yargs": "~18.0.0",
61
57
  "zod": "~4.1.13"
62
58
  },
63
59
  "devDependencies": {
64
- "@xylabs/ts-scripts-yarn3": "~7.2.30",
65
- "@xylabs/tsconfig": "~7.2.30",
60
+ "@xylabs/ts-scripts-yarn3": "~7.2.32",
61
+ "@xylabs/tsconfig": "~7.2.32",
66
62
  "@xylabs/vitest-extended": "~5.0.51",
67
63
  "@xyo-network/account-model": "~5.2.17",
68
64
  "@xyo-network/archivist-lmdb": "~5.2.17",
69
65
  "@xyo-network/archivist-mongodb": "~5.2.17",
70
- "@xyo-network/chain-test": "~1.17.7",
66
+ "@xyo-network/chain-services": "~1.18.0",
67
+ "@xyo-network/chain-test": "~1.18.0",
71
68
  "@xyo-network/wallet": "~5.2.17",
72
69
  "@xyo-network/wallet-model": "~5.2.17",
73
70
  "@xyo-network/xl1-protocol": "~1.14.17",
74
- "@xyo-network/xl1-rpc": "~1.17.7",
75
- "@xyo-network/xl1-validation": "~1.17.7",
76
- "eslint": "^9.39.1",
71
+ "@xyo-network/xl1-rpc": "~1.18.0",
72
+ "@xyo-network/xl1-validation": "~1.18.0",
73
+ "eslint": "^9.39.2",
77
74
  "ethers": "^6.16.0",
78
75
  "lmdb": "~3.4.4",
79
76
  "nodemon": "~3.1.11",
@@ -1,29 +1,34 @@
1
1
  import type { Logger } from '@xylabs/sdk-js'
2
- import { type OrchestratorInstance, ValidatorActor } from '@xyo-network/chain-orchestration'
3
- import type { Config } from '@xyo-network/xl1-protocol-sdk'
4
-
5
- import { initServices } from '../../orchestration/index.ts'
2
+ import type { AccountInstance } from '@xyo-network/account-model'
3
+ import type {
4
+ OrchestratorInstance,
5
+ ValidatorActorParams,
6
+ } from '@xyo-network/chain-orchestration'
7
+ import { ValidatorActor } from '@xyo-network/chain-orchestration'
8
+ import type { Config, ProviderFactoryLocatorInstance } from '@xyo-network/xl1-protocol-sdk'
6
9
 
7
10
  interface RunValidatorContext {
11
+ account: AccountInstance
8
12
  config: Config
13
+ locator: ProviderFactoryLocatorInstance
9
14
  logger: Logger
10
15
  orchestrator: OrchestratorInstance
16
+ singletons: {}
11
17
  }
12
18
 
13
19
  export const runValidator = async (context: RunValidatorContext) => {
14
- const {
15
- config, logger, orchestrator,
16
- } = context
17
-
18
- // Initialize services
19
- logger?.log('Services: Initializing...')
20
- const services = await initServices(context)
21
- logger?.log('Services: Initialized')
20
+ const { config, orchestrator } = context
22
21
 
23
22
  // Create actors
24
- const params = { ...services, config }
23
+ const params = { config }
25
24
  // const balances = await BalanceActor.create({ ...params, id: 'BalanceActor' })
26
- const producer = await ValidatorActor.create({ ...params, id: 'ValidatorActor' })
25
+ const producer = await ValidatorActor.create({
26
+ account: context.account,
27
+ ...params,
28
+ context,
29
+ id: 'ValidatorActor',
30
+ finalizedArchivist: undefined!,
31
+ } satisfies ValidatorActorParams)
27
32
  const actors = [producer]
28
33
 
29
34
  for (const actor of actors) {
package/src/index.ts CHANGED
@@ -1,3 +1,2 @@
1
- export * from './orchestration/index.ts'
2
1
  export * from './runCLI.ts'
3
2
  export * from './start.ts'
@@ -1,2 +0,0 @@
1
- export * from './initServices.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/orchestration/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
@@ -1,9 +0,0 @@
1
- import type { BaseParamsFields, Logger } from '@xylabs/sdk-js';
2
- import { type ChainServiceCollectionV2, type Config } from '@xyo-network/xl1-protocol-sdk';
3
- interface InitServicesContext {
4
- config: Config;
5
- logger: Logger;
6
- }
7
- export declare const initServices: (context: InitServicesContext) => Promise<ChainServiceCollectionV2 & BaseParamsFields>;
8
- export {};
9
- //# sourceMappingURL=initServices.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"initServices.d.ts","sourceRoot":"","sources":["../../../src/orchestration/initServices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,gBAAgB,EAAiB,MAAM,EAExC,MAAM,gBAAgB,CAAA;AAoBvB,OAAO,EACiD,KAAK,wBAAwB,EACnF,KAAK,MAAM,EACZ,MAAM,+BAA+B,CAAA;AAYtC,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED,eAAO,MAAM,YAAY,GAAU,SAAS,mBAAmB,KAAG,OAAO,CAAC,wBAAwB,GAAG,gBAAgB,CA4KpH,CAAA"}
@@ -1 +0,0 @@
1
- export * from './initServices.ts'
@@ -1,217 +0,0 @@
1
- import type {
2
- Address,
3
- BaseParamsFields, CreatableName, Logger,
4
- Promisable,
5
- } from '@xylabs/sdk-js'
6
- import {
7
- asAddress, assertEx, isDefined,
8
- } from '@xylabs/sdk-js'
9
- import type { ChainInitializableParams } from '@xyo-network/chain-orchestration'
10
- import {
11
- buildTelemetryConfig,
12
- initBalanceSummaryMap,
13
- initHealthEndpoints, initProducerAccount, initRejectedTransactionsArchivist, initStatusReporter, initTransferSummaryMap,
14
- } from '@xyo-network/chain-orchestration'
15
- import type { SimpleBlockRunnerParams, XyoValidatorParams } from '@xyo-network/chain-services'
16
- import {
17
- initAccountBalanceService,
18
- initBlockProducer, initBlockRewardViewer, initBlockViewer, initChainService,
19
- initMempoolRunner, initMempoolViewer, initTimeService,
20
- } from '@xyo-network/chain-services'
21
- import { initTelemetry } from '@xyo-network/chain-telemetry'
22
- import { startupSpanAsync } from '@xyo-network/chain-utils'
23
- import { validateHydratedBlockState } from '@xyo-network/chain-validation'
24
- import type { ChainId } from '@xyo-network/xl1-protocol'
25
- import {
26
- type ChainContractViewer, ChainContractViewerMoniker, type ChainServiceCollectionV2, type ChainStakeViewer, ChainStakeViewerMoniker,
27
- type Config,
28
- } from '@xyo-network/xl1-protocol-sdk'
29
-
30
- interface Startable {
31
- start: () => Promise<boolean>
32
- status: string
33
- }
34
-
35
- const isStartable = (value: unknown): value is Startable => {
36
- const possibleStartable = value as Startable
37
- return isDefined(possibleStartable.start) && (typeof (possibleStartable.start) === 'function') && (possibleStartable.status === 'created')
38
- }
39
-
40
- interface InitServicesContext {
41
- config: Config
42
- logger: Logger
43
- }
44
-
45
- export const initServices = async (context: InitServicesContext): Promise<ChainServiceCollectionV2 & BaseParamsFields> => {
46
- const { config, logger } = context
47
- const statusReporter = initStatusReporter({ logger })
48
-
49
- await startupSpanAsync('initHealthEndpoints', () => initHealthEndpoints({ ...context, statusReporter }))
50
-
51
- const telemetryConfig = buildTelemetryConfig(config, 'xl1-server', '1.0.0')
52
-
53
- const [
54
- { traceProvider, meterProvider },
55
- account,
56
- ] = await Promise.all([
57
- startupSpanAsync('initTelemetry', () => initTelemetry(telemetryConfig)),
58
- startupSpanAsync('initProducerAccount', () => initProducerAccount(context)),
59
- ])
60
-
61
- const baseParamsFields: BaseParamsFields = {
62
- logger, meterProvider, traceProvider,
63
- }
64
- const initParams: ChainInitializableParams = {
65
- config, logger, meterProvider, statusReporter, traceProvider,
66
- }
67
-
68
- const mempoolViewer = await initMempoolViewer({ config, logger })
69
- const mempoolRunner = await initMempoolRunner({ config, logger })
70
-
71
- // Archivists
72
- const [
73
- rejectedTransactionsArchivist,
74
- chainService,
75
- balanceSummaryMap,
76
- ] = await Promise.all([
77
- startupSpanAsync(
78
- 'RejectedTransactionsArchivist',
79
- () => initRejectedTransactionsArchivist(initParams),
80
- ),
81
- startupSpanAsync(
82
- 'ChainService',
83
- () => initChainService({
84
- ...initParams, account, name: 'ChainService' as CreatableName,
85
- }),
86
- ),
87
- startupSpanAsync(
88
- 'BalanceSummaryMap',
89
- () => initBalanceSummaryMap(initParams),
90
-
91
- ),
92
- startupSpanAsync(
93
- 'TransferSummaryMap',
94
- () => initTransferSummaryMap(initParams),
95
- ),
96
- ])
97
-
98
- const chainContractViewer = {
99
- forkedAtBlockNumber: function (): Promise<bigint> {
100
- return chainService.forkedAtBlockNumber()
101
- },
102
- forkedAtHash: function (): Promise<bigint> {
103
- return chainService.forkedAtHash()
104
- },
105
- forkedChainId: function (): Promise<Address> {
106
- return chainService.forkedChainId()
107
- },
108
- minWithdrawalBlocks: function (): Promise<bigint> {
109
- return chainService.minWithdrawalBlocks()
110
- },
111
- rewardsContract: function (): Promise<string> {
112
- return chainService.rewardsContract()
113
- },
114
- stakingTokenAddress: function (): Promise<string> {
115
- return chainService.stakingTokenAddress()
116
- },
117
- moniker: ChainContractViewerMoniker,
118
- } satisfies ChainContractViewer
119
-
120
- const chainStakeViewer = {
121
- ...chainContractViewer,
122
- active: function (): Promisable<bigint> {
123
- return chainService.active()
124
- },
125
- activeByStaked: function (staked: Address): Promisable<bigint> {
126
- return chainService.activeByStaked(staked)
127
- },
128
- activeByStaker: function (address: Address): Promisable<bigint> {
129
- return chainService.activeByStaker(address)
130
- },
131
- pending: function (): Promisable<bigint> {
132
- return chainService.pending()
133
- },
134
- pendingByStaker: function (staker: Address): Promisable<bigint> {
135
- return chainService.pendingByStaker(staker)
136
- },
137
- withdrawn: function (): Promisable<bigint> {
138
- return chainService.withdrawn()
139
- },
140
- withdrawnByStaker: function (staker: Address): Promisable<bigint> {
141
- return chainService.withdrawnByStaker(staker)
142
- },
143
- chainId: function (): Promisable<ChainId> {
144
- return chainService.chainId()
145
- },
146
- moniker: ChainStakeViewerMoniker,
147
- } satisfies ChainStakeViewer
148
-
149
- const blockRewardViewer = await initBlockRewardViewer({ config, chainContractViewer })
150
- const chainId = await chainService.chainId()
151
-
152
- const blockViewer = await startupSpanAsync(
153
- 'BlockViewer',
154
- () => initBlockViewer({ ...initParams }),
155
- )
156
-
157
- const balanceService = await startupSpanAsync(
158
- 'BalanceService',
159
- () => initAccountBalanceService({ ...initParams }),
160
- )
161
-
162
- const time = await startupSpanAsync(
163
- 'TimeService',
164
- () => initTimeService({
165
- name: 'TimeService' as CreatableName,
166
- blockViewer,
167
- ...initParams,
168
- }),
169
- )
170
-
171
- const validatorParams: XyoValidatorParams = {
172
- name: 'Validator' as CreatableName,
173
- blockViewer,
174
- validateHydratedBlockState,
175
- ...initParams,
176
- }
177
-
178
- const rewardAddress = isDefined(config.producer.rewardAddress)
179
- ? assertEx(asAddress(config.producer.rewardAddress), () => 'Invalid block reward address provided')
180
- : account.address
181
- const producerParams: SimpleBlockRunnerParams = {
182
- ...validatorParams,
183
- account,
184
- chainId,
185
- name: 'Producer' as CreatableName,
186
- balanceViewer: balanceService,
187
- blockRewardViewer,
188
- mempoolRunner,
189
- mempoolViewer,
190
- rejectedTransactionsArchivist,
191
- rewardAddress,
192
- time,
193
- ...initParams,
194
- }
195
- const producer = await startupSpanAsync('Producer', () => initBlockProducer(producerParams))
196
- const services: ChainServiceCollectionV2 = {
197
- account,
198
- balance: balanceService,
199
- chainContractViewer,
200
- blockViewer,
201
- chainStakeViewer,
202
- mempoolRunner,
203
- mempoolViewer,
204
- producer,
205
- reward: blockRewardViewer,
206
- }
207
-
208
- logger?.log('All services created. Starting...')
209
- const startableServices = [balanceSummaryMap, ...Object.values(services)].filter(isStartable)
210
- // Start all services that have a start method and assert that they all started successfully
211
- assertEx(
212
- (await Promise.all(startableServices.map(service => service.start()))).every(Boolean),
213
- () => 'One or more services failed to start',
214
- )
215
- logger?.log('All services started successfully.')
216
- return { ...services, ...baseParamsFields }
217
- }