@xyo-network/xl1-cli-lib 1.19.9 → 1.19.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/index.mjs +19 -24
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/locatorFromConfig.d.ts.map +1 -1
- package/dist/node/tryParseConfig.d.ts +0 -2
- package/dist/node/tryParseConfig.d.ts.map +1 -1
- package/dist/node/xl1.mjs +19 -24
- package/dist/node/xl1.mjs.map +1 -1
- package/package.json +15 -15
- package/src/locatorFromConfig.ts +21 -30
package/dist/node/index.mjs
CHANGED
|
@@ -103,7 +103,7 @@ import { SimpleBlockRunner } from "@xyo-network/chain-services";
|
|
|
103
103
|
import { initTelemetry } from "@xyo-network/chain-telemetry";
|
|
104
104
|
import { validateHydratedBlock, validateHydratedBlockState } from "@xyo-network/chain-validation";
|
|
105
105
|
import { HDWallet } from "@xyo-network/wallet";
|
|
106
|
-
import { AccountBalanceViewerRpcSchemas, ADDRESS_INDEX, BlockViewerRpcSchemas, FinalizationViewerRpcSchemas, generateXyoBaseWalletFromPhrase, HttpRpcTransport, JsonRpcAccountBalanceViewer, JsonRpcBlockViewer, JsonRpcFinalizationViewer, JsonRpcMempoolRunner, JsonRpcMempoolViewer, MempoolRunnerRpcSchemas, MempoolViewerRpcSchemas, ProviderFactoryLocator, SimpleAccountBalanceViewer, SimpleBlockRewardViewer, SimpleBlockValidationViewer, SimpleBlockViewer, SimpleFinalizationViewer, SimpleMempoolRunner, SimpleMempoolViewer, SimpleNetworkStakeViewer, SimpleStepRewardsByPositionViewer, SimpleStepRewardsByStakerViewer, SimpleStepRewardsByStepViewer, SimpleStepRewardsTotalViewer, SimpleStepRewardsViewer, SimpleStepViewer, SimpleTimeSyncViewer, SimpleWindowedBlockViewer, SimpleXyoConnectionRunner, SimpleXyoConnectionViewer, SimpleXyoGatewayRunner, SimpleXyoRunner, SimpleXyoSigner, SimpleXyoViewer } from "@xyo-network/xl1-sdk";
|
|
106
|
+
import { AccountBalanceViewerRpcSchemas, ADDRESS_INDEX, BlockViewerRpcSchemas, FinalizationViewerRpcSchemas, generateXyoBaseWalletFromPhrase, HttpRpcTransport, JsonRpcAccountBalanceViewer, JsonRpcBlockViewer, JsonRpcFinalizationViewer, JsonRpcMempoolRunner, JsonRpcMempoolViewer, MempoolRunnerRpcSchemas, MempoolViewerRpcSchemas, ProviderFactoryLocator, SimpleAccountBalanceViewer, SimpleBlockRewardViewer, SimpleBlockValidationViewer, SimpleBlockViewer, SimpleFinalizationRunner, SimpleFinalizationViewer, SimpleMempoolRunner, SimpleMempoolViewer, SimpleNetworkStakeViewer, SimpleStepRewardsByPositionViewer, SimpleStepRewardsByStakerViewer, SimpleStepRewardsByStepViewer, SimpleStepRewardsTotalViewer, SimpleStepRewardsViewer, SimpleStepViewer, SimpleTimeSyncViewer, SimpleWindowedBlockViewer, SimpleXyoConnectionRunner, SimpleXyoConnectionViewer, SimpleXyoGateway, SimpleXyoGatewayRunner, SimpleXyoRunner, SimpleXyoSigner, SimpleXyoViewer } from "@xyo-network/xl1-sdk";
|
|
107
107
|
async function telemetryContextFromConfig(config2, serviceName, serviceVersion) {
|
|
108
108
|
const { otlpEndpoint } = config2.telemetry?.otel ?? {};
|
|
109
109
|
const { path: endpoint = "/metrics", port = 9466 } = config2.telemetry?.metrics?.scrape ?? {};
|
|
@@ -203,6 +203,12 @@ async function localLocatorFromConfig(config2, context) {
|
|
|
203
203
|
SimpleXyoConnectionViewer.factory(SimpleXyoConnectionViewer.dependencies, {}),
|
|
204
204
|
SimpleXyoViewer.factory(SimpleXyoViewer.dependencies, {
|
|
205
205
|
finalizedArchivist: readonlyChainArchivist
|
|
206
|
+
}),
|
|
207
|
+
SimpleFinalizationViewer.factory(SimpleFinalizationViewer.dependencies, {
|
|
208
|
+
finalizedArchivist: readonlyChainArchivist
|
|
209
|
+
}),
|
|
210
|
+
SimpleFinalizationRunner.factory(SimpleFinalizationRunner.dependencies, {
|
|
211
|
+
finalizedArchivist: writableChainArchivist
|
|
206
212
|
})
|
|
207
213
|
]);
|
|
208
214
|
locator.freeze();
|
|
@@ -262,7 +268,7 @@ async function producerLocatorFromConfig(config2, context) {
|
|
|
262
268
|
if (rewardAddress === account.address) {
|
|
263
269
|
logger?.warn(`Using producer account address as reward address: ${account.address}`);
|
|
264
270
|
}
|
|
265
|
-
const remoteUrl = config2.remote.rpc?.url;
|
|
271
|
+
const remoteUrl = config2.actors.producer.remote.rpc?.url;
|
|
266
272
|
if (isString(remoteUrl)) {
|
|
267
273
|
const transportFactory = /* @__PURE__ */ __name((schemas) => new HttpRpcTransport(remoteUrl, schemas), "transportFactory");
|
|
268
274
|
locator.registerMany([
|
|
@@ -296,7 +302,11 @@ async function producerLocatorFromConfig(config2, context) {
|
|
|
296
302
|
__name(producerLocatorFromConfig, "producerLocatorFromConfig");
|
|
297
303
|
function apiLocatorFromConfig(config2, context) {
|
|
298
304
|
const locator = new ProviderFactoryLocator(context);
|
|
299
|
-
locator.registerMany([
|
|
305
|
+
locator.registerMany([
|
|
306
|
+
SimpleXyoRunner.factory(SimpleXyoRunner.dependencies, {}),
|
|
307
|
+
SimpleXyoConnectionRunner.factory(SimpleXyoConnectionRunner.dependencies, {}),
|
|
308
|
+
SimpleXyoGateway.factory(SimpleXyoGateway.dependencies, {})
|
|
309
|
+
]);
|
|
300
310
|
locator.freeze();
|
|
301
311
|
return locator;
|
|
302
312
|
}
|
|
@@ -360,26 +370,11 @@ async function locatorsFromConfig(actors, config2, context) {
|
|
|
360
370
|
const result = {
|
|
361
371
|
_root: await rootLocatorFromConfig(config2, context)
|
|
362
372
|
};
|
|
363
|
-
|
|
364
|
-
if (
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
if (api) {
|
|
369
|
-
result.api = api;
|
|
370
|
-
}
|
|
371
|
-
const mempool = actors.includes("mempool") ? await mempoolLocatorFromConfig(config2, result._root.context) : void 0;
|
|
372
|
-
if (mempool) {
|
|
373
|
-
result.mempool = mempool;
|
|
374
|
-
}
|
|
375
|
-
const bridge = actors.includes("bridge") ? await bridgeLocatorFromConfig(config2, result._root.context) : void 0;
|
|
376
|
-
if (bridge) {
|
|
377
|
-
result.bridge = bridge;
|
|
378
|
-
}
|
|
379
|
-
const rewardRedemption = actors.includes("rewardRedemption") ? await rewardRedemptionLocatorFromConfig(config2, result._root.context) : void 0;
|
|
380
|
-
if (rewardRedemption) {
|
|
381
|
-
result.rewardRedemption = rewardRedemption;
|
|
382
|
-
}
|
|
373
|
+
if (actors.includes("producer")) result.producer = await producerLocatorFromConfig(config2, result._root.context);
|
|
374
|
+
if (actors.includes("api")) result.api = await apiLocatorFromConfig(config2, result._root.context);
|
|
375
|
+
if (actors.includes("mempool")) result.mempool = await mempoolLocatorFromConfig(config2, result._root.context);
|
|
376
|
+
if (actors.includes("bridge")) result.bridge = await bridgeLocatorFromConfig(config2, result._root.context);
|
|
377
|
+
if (actors.includes("rewardRedemption")) result.rewardRedemption = await rewardRedemptionLocatorFromConfig(config2, result._root.context);
|
|
383
378
|
return result;
|
|
384
379
|
}
|
|
385
380
|
__name(locatorsFromConfig, "locatorsFromConfig");
|
|
@@ -442,7 +437,7 @@ var waitForHostPort = /* @__PURE__ */ __name((host, port) => {
|
|
|
442
437
|
|
|
443
438
|
// src/runCLI.ts
|
|
444
439
|
var configuration;
|
|
445
|
-
var version = isDefined4("1.19.
|
|
440
|
+
var version = isDefined4("1.19.10") ? "1.19.10" : "unknown";
|
|
446
441
|
function resolveConfig(config2) {
|
|
447
442
|
const logger = console;
|
|
448
443
|
const defaultChainId = toAddress("1");
|
package/dist/node/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/runCLI.ts","../../src/commands/bridge/runBridge.ts","../../src/commands/rewardRedemption/runRewardRedemptionApi.ts","../../src/images.ts","../../src/initLogger.ts","../../src/locatorFromConfig.ts","../../src/optionsFromGlobalZodRegistry.ts","../../src/tryParseConfig.ts","../../src/waitForHostPort.ts","../../src/start.ts"],"sourcesContent":["import type { Logger } from '@xylabs/sdk-js'\nimport {\n deepMerge, isDefined, toAddress,\n} from '@xylabs/sdk-js'\nimport { runApi } from '@xyo-network/chain-api'\nimport { runMempool } from '@xyo-network/chain-mempool'\nimport { Orchestrator } from '@xyo-network/chain-orchestration'\nimport { runProducer } from '@xyo-network/chain-producer'\nimport type { ActorName, Config } from '@xyo-network/xl1-sdk'\nimport { ConfigZod, isZodError } from '@xyo-network/xl1-sdk'\nimport type { Argv } from 'yargs'\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\n\nimport { runBridge, runRewardRedemptionApi } from './commands/index.ts'\nimport { XL1LogoColorizedAscii } from './images.ts'\nimport { initLogger } from './initLogger.ts'\nimport { contextFromConfigWithoutLocator, locatorsFromConfig } from './locatorFromConfig.ts'\nimport { optionsFromGlobalZodRegistry } from './optionsFromGlobalZodRegistry.ts'\nimport { tryParseConfig } from './tryParseConfig.ts'\nimport { waitForHostPort } from './waitForHostPort.ts'\n\ninterface RunCliContext {\n logger: Logger\n orchestrator: Orchestrator\n}\n\n/** Version string injected by Rollup at build time. */\ndeclare const __VERSION__: string\n\n/**\n * The configuration that will be used throughout the CLI.\n * This is materialized after parsing the command-line arguments,\n * environment variables, and defaults.\n */\nlet configuration: Config\n\nconst version = isDefined(__VERSION__) ? __VERSION__ : 'unknown'\n\nfunction resolveConfig(config: Config): Config {\n const logger = console\n const defaultChainId = toAddress('1')\n const resolved = structuredClone(config)\n if (!resolved.chain.id) {\n logger.warn(`No chain ID specified in configuration; defaulting to ${defaultChainId}`)\n resolved.chain.id = defaultChainId\n }\n return resolved\n}\n\nconst getContextFromConfig = async (configuration: Config): Promise<RunCliContext> => {\n const logger = initLogger(configuration)\n const orchestrator = await Orchestrator.create({ logger })\n // Handle cancellation (Ctrl+C)\n process.on('SIGINT', () => {\n void (async () => {\n try {\n logger.log('\\nSIGINT received. Attempting graceful shutdown...')\n await orchestrator?.stop()\n logger.log('Orchestrator stopped, exiting now.')\n process.exit(0)\n } catch (err) {\n logger.error('Error stopping orchestrator:', err)\n process.exit(1)\n }\n })()\n })\n return { logger, orchestrator }\n}\n\nconst getLocatorsFromConfig = async (actors: string[], configuration: Config) => {\n const logger = initLogger(configuration)\n const orchestrator = await Orchestrator.create({ logger })\n const context = await contextFromConfigWithoutLocator(configuration, logger, 'xl1-cli', version)\n const locators = await locatorsFromConfig(actors, configuration, context)\n // Handle cancellation (Ctrl+C)\n process.on('SIGINT', () => {\n void (async () => {\n try {\n logger.log('\\nSIGINT received. Attempting graceful shutdown...')\n await orchestrator?.stop()\n logger.log('Orchestrator stopped, exiting now.')\n process.exit(0)\n } catch (err) {\n logger.error('Error stopping orchestrator:', err)\n process.exit(1)\n }\n })()\n })\n return { locators, orchestrator }\n}\n\n// Main entry point\nexport async function runCLI() {\n // Parse command-line arguments using Yargs\n const y = yargs(hideBin(process.argv)) as Argv<Config>\n const argv = y\n .usage(`\n🚀 XL1 Node CLI (${version})\n${XL1LogoColorizedAscii}\nRun various components of the XL1 ecosystem.\n\nUsage:\n$0 <command> [options]`)\n .parserConfiguration({\n 'dot-notation': true, // foo.bar → { foo: { bar } }\n 'parse-numbers': false, // Don't auto-parse numbers to allow strings like \"0x1\"\n 'populate--': true, // Populate -- with all options so we can detected user-supplied vs defaults\n })\n .env('XL1')\n .scriptName('xl1')\n .middleware((argv) => {\n try {\n // Parse the various config sources\n const parsedConfigFile = tryParseConfig() // Config file\n const parsedConfigArgs = argv // Command-line arguments & ENV VARs\n const parseResult = ConfigZod.safeParse(parsedConfigFile)\n if (!parseResult.success) {\n throw parseResult.error\n }\n // Deep merge with precedence\n // TODO: Would like precedence to be defaults < file < ENV < CLI Args\n // but there is currently no way to determine which are defaults vs\n // user-supplied CLI Args since we set the CLI args to the defaults\n // and receive a flattened object. We might need to manually invoke\n // the parser without the defaults to achieve this.\n // const mergedConfig = deepMerge(parsedConfigArgs, parsedConfigFile)\n const mergedConfig = deepMerge(parsedConfigArgs)\n const validatedMergedConfigResult = ConfigZod.safeParse(mergedConfig)\n if (!validatedMergedConfigResult.success) {\n throw validatedMergedConfigResult.error\n }\n const resolvedConfig = resolveConfig(validatedMergedConfigResult.data)\n // Validate the merged configuration\n const validatedConfigResult = ConfigZod.safeParse(resolvedConfig)\n if (!validatedConfigResult.success) {\n throw validatedConfigResult.error\n }\n configuration = validatedConfigResult.data\n\n const { actors, ...rootConfig } = configuration\n const actorNames = Object.keys(actors) as ActorName[]\n\n for (const actorName of actorNames) {\n configuration.actors[actorName] = deepMerge(\n rootConfig ?? {},\n configuration.actors[actorName] ?? {},\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) as any\n }\n\n // Check if user wants to dump config and exit\n if (argv['dump-config']) {\n console.log(JSON.stringify(configuration, null, 2))\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0)\n }\n } catch (err) {\n if (isZodError(err)) {\n console.error(`Zod error: ${err.message}`)\n } else {\n console.error(`Error parsing configuration: ${err}`)\n }\n console.error(`Stack: ${err instanceof Error ? err.stack : 'N/A'}`)\n throw new Error('Invalid configuration')\n }\n })\n .options(optionsFromGlobalZodRegistry())\n // .commandDir('./command/commands', opts) // Not yet supported for ESM\n .wrap(y.terminalWidth())\n .command('api', 'Run a XL1 API Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 API Node', () => {}, async () => {\n const { locators, orchestrator } = await getLocatorsFromConfig(['api'], configuration)\n await runApi(configuration, orchestrator, locators['api'])\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 { locators, orchestrator } = await getLocatorsFromConfig(['bridge'], configuration)\n await runBridge(configuration, orchestrator, locators['bridge'])\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 { locators, orchestrator } = await getLocatorsFromConfig(['mempool'], configuration)\n await runMempool(configuration, orchestrator, locators['mempool'])\n })\n })\n .command('producer', 'Run a XL1 Producer Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 Producer Node', () => {}, async () => {\n const { locators, orchestrator } = await getLocatorsFromConfig(['producer'], configuration)\n await runProducer(configuration, orchestrator, locators['producer'])\n })\n })\n .command('reward-redemption-api', 'Run a XL1 Rewards Redemption API Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 Rewards Redemption API Node', () => {}, async () => {\n const { locators, orchestrator } = await getLocatorsFromConfig(['rewardRedemption'], configuration)\n await runRewardRedemptionApi(configuration, orchestrator, locators['rewardRedemption'])\n })\n })\n .command('$0', 'Run a full XL1 Node', () => {}, async () => {\n const actors = ['producer', 'api']\n if (configuration.actors.mempool.enabled) {\n actors.push('mempool')\n }\n const { locators, orchestrator } = await getLocatorsFromConfig(['api', 'producer'], configuration)\n if (configuration.actors.mempool.enabled) {\n // Start Mempool but do not block\n await runMempool(configuration, orchestrator, locators['mempool'])\n // Wait for Mempool to be ready\n await waitForHostPort(configuration.actors.mempool.host, configuration.actors.mempool.port)\n }\n // Start API but do not block\n await runApi(configuration, orchestrator, locators['api'])\n // Wait for API to be ready\n await waitForHostPort(configuration.actors.api.host, configuration.actors.api.port)\n // Start Producer and block on it\n await runProducer(configuration, orchestrator, locators['producer'])\n })\n .options({\n 'dump-config': {\n type: 'boolean',\n description: 'Just process the configuration and print the resolved config to stdout, then exit.',\n default: false,\n },\n })\n .help()\n .alias('help', 'h')\n .version(version)\n .argv\n\n await argv\n}\n","import { exists } from '@xylabs/sdk-js'\nimport { BridgeActor } from '@xyo-network/chain-bridge'\nimport { initBridgeWallet, type OrchestratorInstance } from '@xyo-network/chain-orchestration'\nimport type {\n Config,\n ProviderFactoryLocatorInstance,\n} from '@xyo-network/xl1-sdk'\n\nexport const runBridge = async (\n config: Config,\n orchestrator: OrchestratorInstance,\n locator: ProviderFactoryLocatorInstance,\n) => {\n const account = await initBridgeWallet({ config, logger: locator.context.logger })\n // Create actors\n const api = await BridgeActor.create({\n account, config, locator,\n })\n const actors = [api].filter(exists)\n\n for (const actor of actors) {\n // Register the actor with the orchestrator\n await orchestrator.registerActor(actor)\n }\n // Start the orchestrator => automatically activates the actor\n await orchestrator.start()\n}\n","import { exists } from '@xylabs/sdk-js'\nimport type { OrchestratorInstance } from '@xyo-network/chain-orchestration'\nimport { initRewardsRedemptionApiWallet } from '@xyo-network/chain-orchestration'\nimport { RewardRedemptionActor } from '@xyo-network/chain-reward-redemption'\nimport type { Config, ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk'\n\nexport async function runRewardRedemptionApi(\n config: Config,\n orchestrator: OrchestratorInstance,\n locator: ProviderFactoryLocatorInstance,\n) {\n const account = await initRewardsRedemptionApiWallet({ config, logger: locator.context.logger })\n // Create actors\n const rewardRedemption = await RewardRedemptionActor.create({\n account, config, locator,\n })\n const actors = [rewardRedemption].filter(exists)\n\n for (const actor of actors) {\n // Register the actor with the orchestrator\n await orchestrator.registerActor(actor)\n }\n // Start the orchestrator => automatically activates the actor\n await orchestrator.start()\n}\n","/* eslint-disable @stylistic/max-len */\nexport const XL1LogoColorizedAscii = `\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;118;111;144m_\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;72;32;223m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\n\u001b[38;2;128;128;128m ╠╠\u001b[0m\u001b[38;2;103;85;170m_\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;79;121;152m╦\u001b[0m\u001b[38;2;82;121;151m╦\u001b[0m\u001b[38;2;112;125;136m_ \u001b[0m\u001b[38;2;88;59;196m[\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;73;34;221m▒ \u001b[0m\u001b[38;2;121;121;127m_\u001b[0m\u001b[38;2;100;101;128m╔\u001b[0m\u001b[38;2;93;94;127m╦\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;82;121;151m²\u001b[0m\u001b[38;2;44;116;170m╠\u001b[0m\u001b[38;2;44;116;171m▒\u001b[0m\u001b[38;2;51;117;167mD\u001b[0m\u001b[38;2;80;121;152m╦\u001b[0m\u001b[38;2;111;125;136m_ \u001b[0m\u001b[38;2;67;23;232m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠ \u001b[0m\u001b[38;2;120;121;128m_\u001b[0m\u001b[38;2;100;101;127m╔\u001b[0m\u001b[38;2;79;81;127mR\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;88;90;127m╙\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;55;117;165m╚\u001b[0m\u001b[38;2;44;116;171m▒\u001b[0m\u001b[38;2;44;116;171m▒▒\u001b[0m\u001b[38;2;50;116;167mD\u001b[0m\u001b[38;2;80;121;152m╦ \u001b[0m\u001b[38;2;106;90;165mj\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠\u001b[0m\u001b[38;2;89;61;194mH \u001b[0m\u001b[38;2;99;100;127m╔\u001b[0m\u001b[38;2;79;80;127mD\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;71;73;128m▒▒╠\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;83;121;150m²\u001b[0m\u001b[38;2;44;116;170m▒\u001b[0m\u001b[38;2;44;116;171m▒▒▒ \u001b[0m\u001b[38;2;76;38;217m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠ \u001b[0m\u001b[38;2;74;76;128m╠\u001b[0m\u001b[38;2;71;73;128m▒▒▒\u001b[0m\u001b[38;2;89;90;128m╙\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;90;118;148m\\`\u001b[0m\u001b[38;2;89;107;153m_\u001b[0m\u001b[38;2;93;97;154m,\u001b[0m\u001b[38;2;105;89;166m╓\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠\u001b[0m\u001b[38;2;95;72;183m╓\u001b[0m\u001b[38;2;106;96;152m_\u001b[0m\u001b[38;2;100;94;143m\\`\u001b[0m\u001b[38;2;101;100;133m\\`\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;122;118;137m_\u001b[0m\u001b[38;2;113;102;153m,\u001b[0m\u001b[38;2;108;94;161m╓\u001b[0m\u001b[38;2;104;86;169m╓\u001b[0m\u001b[38;2;98;77;178m╔\u001b[0m\u001b[38;2;93;67;188m╗\u001b[0m\u001b[38;2;88;59;196mφ\u001b[0m\u001b[38;2;83;51;204m@\u001b[0m\u001b[38;2;78;42;213mD\u001b[0m\u001b[38;2;72;32;223m▒\u001b[0m\u001b[38;2;68;24;231m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠\u001b[0m\u001b[38;2;71;30;225m▒\u001b[0m\u001b[38;2;77;40;215m▒\u001b[0m\u001b[38;2;82;49;206mK\u001b[0m\u001b[38;2;87;57;198mφ\u001b[0m\u001b[38;2;91;65;190m╗\u001b[0m\u001b[38;2;97;75;180m╦\u001b[0m\u001b[38;2;103;84;171m╖\u001b[0m\u001b[38;2;107;92;163m²\u001b[0m\u001b[38;2;112;101;154m_\u001b[0m\u001b[38;2;119;112;143m_\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;106;91;164m\\`\u001b[0m\u001b[38;2;94;70;185m^\u001b[0m\u001b[38;2;89;62;193m╙\u001b[0m\u001b[38;2;85;54;201m╙\u001b[0m\u001b[38;2;80;45;210m╚\u001b[0m\u001b[38;2;74;35;220m╝\u001b[0m\u001b[38;2;69;26;229m╠\u001b[0m\u001b[38;2;66;22;233m╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠\u001b[0m\u001b[38;2;73;33;222m╝\u001b[0m\u001b[38;2;79;43;212m╩\u001b[0m\u001b[38;2;84;52;203m╜\u001b[0m\u001b[38;2;88;60;195m╙\u001b[0m\u001b[38;2;93;68;187m^\u001b[0m\u001b[38;2;100;80;175m\\`\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;113;84;152m\\`\u001b[0m\u001b[38;2;103;79;169m'\u001b[0m\u001b[38;2;95;72;183m\"\u001b[0m\u001b[38;2;87;57;198m╙\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠\u001b[0m\u001b[38;2;80;46;209m╜\u001b[0m\u001b[38;2;94;70;185m^\u001b[0m\u001b[38;2;102;77;175m^\u001b[0m\u001b[38;2;112;81;162m\\`\u001b[0m\u001b[38;2;115;92;155m\\`\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;145;116;107m,\u001b[0m\u001b[38;2;199;82;45m╠\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒╠ \u001b[0m\u001b[38;2;70;28;227m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠ \u001b[0m\u001b[38;2;189;49;97må\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠\u001b[0m\u001b[38;2;155;92;114m,\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;175;98;73m╔\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒▒▒\u001b[0m\u001b[38;2;197;83;47m╩ \u001b[0m\u001b[38;2;98;76;179m[\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠\u001b[0m\u001b[38;2;81;48;207mH \u001b[0m\u001b[38;2;188;51;98m╚\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠╠\u001b[0m\u001b[38;2;183;57;100mH\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;146;116;106m,\u001b[0m\u001b[38;2;199;82;44m╠\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;196;84;48m╩\u001b[0m\u001b[38;2;168;102;81m^ \u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠ \u001b[0m\u001b[38;2;160;87;111m'\u001b[0m\u001b[38;2;187;52;98m╚\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠\u001b[0m\u001b[38;2;156;91;113m,\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;198;83;46m╩\u001b[0m\u001b[38;2;194;85;50m╩\u001b[0m\u001b[38;2;167;102;82m^ \u001b[0m\u001b[38;2;81;46;209m╚\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠ \u001b[0m\u001b[38;2;159;88;112m'\u001b[0m\u001b[38;2;186;53;98m╚\u001b[0m\u001b[38;2;197;40;93m╩\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;110;97;158m'\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;94;69;186mH\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;68;25;230m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;108;93;162m²\u001b[0m\u001b[38;2;99;79;176m^\u001b[0m`\n","import type { Logger, LogLevelValue } from '@xylabs/sdk-js'\nimport {\n Base,\n ConsoleLogger, isDefined,\n LogLevel, SilentLogger,\n} from '@xylabs/sdk-js'\nimport type { Config } from '@xyo-network/xl1-sdk'\n\nexport const initLogger = (config: Config): Logger => {\n let logger: Logger\n if (config.log.silent) {\n logger = new SilentLogger()\n } else {\n let level: LogLevelValue | undefined\n if (isDefined(config.log.logLevel)) {\n const parsed = LogLevel[config.log.logLevel.toLowerCase() as keyof typeof LogLevel]\n if (isDefined(parsed)) level = parsed\n }\n logger = new ConsoleLogger(level)\n }\n Base.defaultLogger = logger\n return logger\n}\n","import type { Logger, Promisable } from '@xylabs/sdk-js'\nimport {\n asAddress, assertEx, isDefined, isString,\n} from '@xylabs/sdk-js'\nimport {\n initApiWallet,\n initBalanceSummaryMap,\n initEvmProvidersIfAvailable, initFinalizationArchivistIfNeeded, initProducerAccount, initServerNode, initStatusReporter,\n initTransferSummaryMap,\n} from '@xyo-network/chain-orchestration'\nimport { SimpleBlockRunner } from '@xyo-network/chain-services'\nimport { initTelemetry } from '@xyo-network/chain-telemetry'\nimport { validateHydratedBlock, validateHydratedBlockState } from '@xyo-network/chain-validation'\nimport { HDWallet } from '@xyo-network/wallet'\nimport type {\n Config, CreatableProviderContext, ProviderFactoryLocatorInstance,\n RpcSchemaMap,\n TransportFactory,\n} from '@xyo-network/xl1-sdk'\nimport {\n AccountBalanceViewerRpcSchemas,\n ADDRESS_INDEX,\n BlockViewerRpcSchemas,\n FinalizationViewerRpcSchemas,\n generateXyoBaseWalletFromPhrase,\n HttpRpcTransport,\n JsonRpcAccountBalanceViewer,\n JsonRpcBlockViewer,\n JsonRpcFinalizationViewer,\n JsonRpcMempoolRunner,\n JsonRpcMempoolViewer,\n MempoolRunnerRpcSchemas,\n MempoolViewerRpcSchemas,\n ProviderFactoryLocator, SimpleAccountBalanceViewer, SimpleBlockRewardViewer, SimpleBlockValidationViewer,\n SimpleBlockViewer,\n SimpleFinalizationViewer,\n SimpleMempoolRunner,\n SimpleMempoolViewer,\n SimpleNetworkStakeViewer,\n SimpleStepRewardsByPositionViewer,\n SimpleStepRewardsByStakerViewer,\n SimpleStepRewardsByStepViewer,\n SimpleStepRewardsTotalViewer,\n SimpleStepRewardsViewer,\n SimpleStepViewer,\n SimpleTimeSyncViewer,\n SimpleWindowedBlockViewer,\n SimpleXyoConnectionRunner,\n SimpleXyoConnectionViewer,\n SimpleXyoGatewayRunner,\n SimpleXyoRunner,\n SimpleXyoSigner,\n SimpleXyoViewer,\n XyoRunnerMoniker,\n} from '@xyo-network/xl1-sdk'\n\nexport async function telemetryContextFromConfig(config: Config, serviceName: string, serviceVersion: string) {\n const { otlpEndpoint } = config.telemetry?.otel ?? {}\n const { path: endpoint = '/metrics', port: port = 9466 } = config.telemetry?.metrics?.scrape ?? {}\n return await initTelemetry({\n attributes: {\n serviceName,\n serviceVersion,\n },\n otlpEndpoint,\n metricsConfig: { endpoint, port },\n })\n}\n\nexport async function contextFromConfigWithoutLocator(\n config: Config,\n logger: Logger,\n serviceName: string,\n serviceVersion: string,\n): Promise<Omit<CreatableProviderContext, 'locator'>> {\n const singletons = {}\n const caches = {}\n const telemetryConfig = await telemetryContextFromConfig(config, serviceName, serviceVersion)\n const statusReporter = initStatusReporter({ logger })\n return {\n ...telemetryConfig,\n config,\n singletons,\n caches,\n logger,\n statusReporter,\n }\n}\n\nexport async function rootLocatorFromConfig(\n config: Config,\n context: Omit<CreatableProviderContext, 'locator'>,\n): Promise<ProviderFactoryLocatorInstance> {\n let locator: ProviderFactoryLocatorInstance = new ProviderFactoryLocator(context)\n\n locator.registerMany([\n SimpleNetworkStakeViewer.factory<SimpleNetworkStakeViewer>(SimpleNetworkStakeViewer.dependencies, {}),\n SimpleTimeSyncViewer.factory<SimpleTimeSyncViewer>(SimpleTimeSyncViewer.dependencies, {}),\n SimpleStepViewer.factory<SimpleStepViewer>(SimpleStepViewer.dependencies, {}),\n SimpleStepRewardsViewer.factory<SimpleStepRewardsViewer>(SimpleStepRewardsViewer.dependencies, {}),\n SimpleStepRewardsByPositionViewer.factory<SimpleStepRewardsByPositionViewer>(SimpleStepRewardsByPositionViewer.dependencies, {}),\n SimpleStepRewardsByStakerViewer.factory<SimpleStepRewardsByStakerViewer>(SimpleStepRewardsByStakerViewer.dependencies, {}),\n SimpleStepRewardsByStepViewer.factory<SimpleStepRewardsByStepViewer>(SimpleStepRewardsByStepViewer.dependencies, {}),\n SimpleStepRewardsTotalViewer.factory<SimpleStepRewardsTotalViewer>(SimpleStepRewardsTotalViewer.dependencies, {}),\n SimpleBlockValidationViewer.factory<SimpleBlockValidationViewer>(\n SimpleBlockValidationViewer.dependencies,\n { state: validateHydratedBlockState, protocol: validateHydratedBlock },\n ),\n ])\n locator = await initEvmProvidersIfAvailable(locator)\n locator = await (isString(config.remote.rpc?.url)\n ? remoteLocatorFromConfig(config, { ...context, locator })\n : localLocatorFromConfig(config, { ...context, locator }))\n locator.freeze()\n return locator\n}\n\nexport async function localLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<ProviderFactoryLocatorInstance> {\n const balancesSummaryMap = assertEx(await initBalanceSummaryMap(context), () => 'Balance Summary Map not initialized')\n const transfersSummaryMap = assertEx(await initTransferSummaryMap(context), () => 'Transfer Summary Map not initialized')\n\n // TODO: this should not be an api wallet, but a server wallet\n const wallet = await initApiWallet(context)\n\n const {\n writableChainArchivist, readonlyChainArchivist, pendingTransactionsArchivist, pendingBlocksArchivist,\n } = await initServerNode({\n ...context,\n wallet,\n transfersSummaryMap,\n balancesSummaryMap,\n })\n\n await initFinalizationArchivistIfNeeded(writableChainArchivist, config, wallet)\n\n const locator = new ProviderFactoryLocator(context)\n locator.registerMany([\n SimpleMempoolViewer.factory<SimpleMempoolViewer>(SimpleMempoolViewer.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleMempoolRunner.factory<SimpleMempoolRunner>(SimpleMempoolRunner.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleAccountBalanceViewer.factory<SimpleAccountBalanceViewer>(SimpleAccountBalanceViewer.dependencies, { balancesSummaryMap, transfersSummaryMap }),\n SimpleFinalizationViewer.factory<SimpleFinalizationViewer>(SimpleFinalizationViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleBlockViewer.factory<SimpleBlockViewer>(SimpleBlockViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleWindowedBlockViewer.factory<SimpleWindowedBlockViewer>(SimpleWindowedBlockViewer.dependencies, { maxWindowSize: 10_000, syncInterval: 10_000 }),\n SimpleXyoConnectionViewer.factory<SimpleXyoConnectionViewer>(SimpleXyoConnectionViewer.dependencies, {}),\n SimpleXyoViewer.factory<SimpleXyoViewer>(SimpleXyoViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n ])\n locator.freeze()\n return locator\n}\n\nexport async function remoteLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<ProviderFactoryLocatorInstance> {\n const balancesSummaryMap = assertEx(await initBalanceSummaryMap(context), () => 'Balance Summary Map not initialized')\n const transfersSummaryMap = assertEx(await initTransferSummaryMap(context), () => 'Transfer Summary Map not initialized')\n\n // TODO: this should not be an api wallet, but a server wallet\n const wallet = await initApiWallet(context)\n\n const {\n readonlyChainArchivist, pendingTransactionsArchivist, pendingBlocksArchivist,\n } = await initServerNode({\n ...context,\n wallet,\n transfersSummaryMap,\n balancesSummaryMap,\n })\n\n const locator = new ProviderFactoryLocator(context)\n locator.registerMany([\n SimpleMempoolViewer.factory<SimpleMempoolViewer>(SimpleMempoolViewer.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleMempoolRunner.factory<SimpleMempoolRunner>(SimpleMempoolRunner.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleAccountBalanceViewer.factory<SimpleAccountBalanceViewer>(SimpleAccountBalanceViewer.dependencies, { balancesSummaryMap, transfersSummaryMap }),\n SimpleFinalizationViewer.factory<SimpleFinalizationViewer>(SimpleFinalizationViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleBlockViewer.factory<SimpleBlockViewer>(SimpleBlockViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleWindowedBlockViewer.factory<SimpleWindowedBlockViewer>(SimpleWindowedBlockViewer.dependencies, { maxWindowSize: 10_000, syncInterval: 10_000 }),\n SimpleXyoViewer.factory<SimpleXyoViewer>(SimpleXyoViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n ])\n locator.freeze()\n return locator\n}\n\nexport async function producerLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<ProviderFactoryLocatorInstance> {\n const { logger } = context\n const account = await initProducerAccount({ config })\n const locator = new ProviderFactoryLocator(context)\n const rewardAddress = asAddress(config.actors.producer.rewardAddress ?? account.address, true)\n logger?.info(`Using reward address ${rewardAddress}`)\n if (rewardAddress === account.address) {\n logger?.warn(`Using producer account address as reward address: ${account.address}`)\n }\n\n const remoteUrl = config.remote.rpc?.url\n\n if (isString(remoteUrl)) {\n const transportFactory: TransportFactory = (schemas: RpcSchemaMap) => new HttpRpcTransport(remoteUrl, schemas)\n\n locator.registerMany([\n JsonRpcMempoolViewer.factory<JsonRpcMempoolViewer>(JsonRpcMempoolViewer.dependencies, { transport: await transportFactory(MempoolViewerRpcSchemas) }),\n JsonRpcMempoolRunner.factory<JsonRpcMempoolRunner>(JsonRpcMempoolRunner.dependencies, { transport: await transportFactory(MempoolRunnerRpcSchemas) }),\n JsonRpcAccountBalanceViewer.factory<JsonRpcAccountBalanceViewer>(\n JsonRpcAccountBalanceViewer.dependencies,\n { transport: await transportFactory(AccountBalanceViewerRpcSchemas) },\n ),\n JsonRpcFinalizationViewer.factory<JsonRpcFinalizationViewer>(\n JsonRpcFinalizationViewer.dependencies,\n { transport: await transportFactory(FinalizationViewerRpcSchemas) },\n ),\n JsonRpcBlockViewer.factory<JsonRpcBlockViewer>(JsonRpcBlockViewer.dependencies, { transport: await transportFactory(BlockViewerRpcSchemas) }),\n ])\n }\n\n locator.registerMany([\n SimpleBlockRewardViewer.factory<SimpleBlockRewardViewer>(SimpleBlockRewardViewer.dependencies, {}),\n SimpleBlockRunner.factory<SimpleBlockRunner>(\n SimpleBlockRunner.dependencies,\n { account, rewardAddress },\n )])\n locator.freeze()\n return locator\n}\n\nexport function apiLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promisable<ProviderFactoryLocatorInstance> {\n const locator = new ProviderFactoryLocator(context)\n\n locator.registerMany([\n ])\n locator.freeze()\n return locator\n}\n\nexport function mempoolLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promisable<ProviderFactoryLocatorInstance> {\n const locator = new ProviderFactoryLocator(context)\n\n locator.registerMany([\n ])\n locator.freeze()\n return locator\n}\n\nexport async function bridgeLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<Promise<Promisable<ProviderFactoryLocatorInstance>>> {\n const locator = new ProviderFactoryLocator(context)\n\n const { mnemonic } = config.actors.bridge\n const walletPhrase = isDefined(mnemonic) ? mnemonic : HDWallet.generateMnemonic()\n const wallet = await generateXyoBaseWalletFromPhrase(walletPhrase)\n const signerAccount = await wallet.derivePath(ADDRESS_INDEX.XYO)\n\n const remoteUrl = config.actors.bridge.remote.rpc?.url\n\n if (isString(remoteUrl)) {\n const transportFactory: TransportFactory = (schemas: RpcSchemaMap) => new HttpRpcTransport(remoteUrl, schemas)\n\n locator.registerMany([\n JsonRpcMempoolViewer.factory<JsonRpcMempoolViewer>(JsonRpcMempoolViewer.dependencies, { transport: await transportFactory(MempoolViewerRpcSchemas) }),\n JsonRpcMempoolRunner.factory<JsonRpcMempoolRunner>(JsonRpcMempoolRunner.dependencies, { transport: await transportFactory(MempoolRunnerRpcSchemas) }),\n JsonRpcAccountBalanceViewer.factory<JsonRpcAccountBalanceViewer>(\n JsonRpcAccountBalanceViewer.dependencies,\n { transport: await transportFactory(AccountBalanceViewerRpcSchemas) },\n ),\n JsonRpcFinalizationViewer.factory<JsonRpcFinalizationViewer>(\n JsonRpcFinalizationViewer.dependencies,\n { transport: await transportFactory(FinalizationViewerRpcSchemas) },\n ),\n JsonRpcBlockViewer.factory<JsonRpcBlockViewer>(JsonRpcBlockViewer.dependencies, { transport: await transportFactory(BlockViewerRpcSchemas) }),\n ])\n }\n\n locator.registerMany([\n SimpleXyoSigner.factory<SimpleXyoSigner>(SimpleXyoSigner.dependencies, { account: signerAccount }),\n SimpleXyoRunner.factory<SimpleXyoRunner>(SimpleXyoRunner.dependencies, {}),\n SimpleXyoConnectionRunner.factory<SimpleXyoConnectionRunner>(SimpleXyoConnectionRunner.dependencies, {}),\n SimpleXyoGatewayRunner.factory<SimpleXyoGatewayRunner>(SimpleXyoGatewayRunner.dependencies, {}),\n ])\n locator.freeze()\n return locator\n}\n\nexport function rewardRedemptionLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promisable<ProviderFactoryLocatorInstance> {\n const locator = new ProviderFactoryLocator(context)\n\n locator.registerMany([\n SimpleXyoGatewayRunner.factory<SimpleXyoGatewayRunner>(SimpleXyoGatewayRunner.dependencies, {}),\n ])\n locator.freeze()\n return locator\n}\n\nexport async function locatorsFromConfig(\n actors: string[],\n config: Config,\n context: Omit<CreatableProviderContext, 'locator'>,\n): Promise<Record<string, ProviderFactoryLocatorInstance>> {\n const result: Record<string, ProviderFactoryLocatorInstance> = { _root: await rootLocatorFromConfig(config, context) }\n const producer = actors.includes('producer') ? await producerLocatorFromConfig(config, result._root.context) : undefined\n if (producer) {\n result.producer = producer\n }\n const api = actors.includes('api') ? await apiLocatorFromConfig(config, result._root.context) : undefined\n if (api) {\n result.api = api\n }\n const mempool = actors.includes('mempool') ? await mempoolLocatorFromConfig(config, result._root.context) : undefined\n if (mempool) {\n result.mempool = mempool\n }\n const bridge = actors.includes('bridge') ? await bridgeLocatorFromConfig(config, result._root.context) : undefined\n if (bridge) {\n result.bridge = bridge\n }\n const rewardRedemption = actors.includes('rewardRedemption') ? await rewardRedemptionLocatorFromConfig(config, result._root.context) : undefined\n if (rewardRedemption) {\n result.rewardRedemption = rewardRedemption\n }\n return result\n}\n","import type { UsageMeta } from '@xyo-network/xl1-sdk'\nimport { isUsageMeta } from '@xyo-network/xl1-sdk'\nimport type { Options } from 'yargs'\nimport { globalRegistry } from 'zod'\n\nconst usageMetaToOptions = (meta: UsageMeta): Options => {\n return meta\n}\n\nexport const optionsFromGlobalZodRegistry = (): Record<string, Options> => {\n const opts: Record<string, Options> = {}\n for (const schema of Object.values(globalRegistry._map)) {\n if (isUsageMeta(schema)) {\n if (schema.hidden) continue // skip hidden options\n opts[schema.title] = usageMetaToOptions(schema)\n }\n }\n return opts\n}\n","import { isDefined, isNull } from '@xylabs/sdk-js'\nimport { ConfigZod } from '@xyo-network/xl1-sdk'\nimport { cosmiconfigSync } from 'cosmiconfig'\n\n/**\n * The name of the configuration file to search for.\n */\nconst configName = 'xyo'\n\n/**\n * The name of the section within the configuration file to parse.\n */\nconst configSection = 'xl1' // Default section in the config file\n\n/**\n * Attempts to parse the configuration from a file using cosmiconfig.\n * @returns The parsed configuration object if found and valid, otherwise undefined.\n */\nexport const tryParseConfig = () => {\n const explorer = cosmiconfigSync(\n configName,\n /* {\n searchPlaces: [\n 'package.json', // Looks under `xyo` key in package.json\n '.xyorc.json', // Supports common dotfile format\n 'xyo.config.json', // Supports custom-named config file\n ],\n loaders: {\n '.json': defaultLoaders['.json'],\n 'noExt': defaultLoaders['.json'],\n },\n }, */\n )\n const result = explorer.search()\n if (!isNull(result)) {\n const section = result?.config?.[configSection]\n if (isDefined(section) && typeof section === 'object') {\n return ConfigZod.parse(section)\n }\n }\n return ConfigZod.parse({})\n}\n","import net from 'node:net'\n\nexport const waitForHostPort = (host: string, port: number): Promise<void> => {\n return new Promise((resolve) => {\n const tryConnect = () => {\n const socket = new net.Socket()\n\n socket\n .setTimeout(1000)\n .once('error', () => {\n socket.destroy()\n setTimeout(tryConnect, 500) // retry after 500ms\n })\n .once('timeout', () => {\n socket.destroy()\n setTimeout(tryConnect, 500)\n })\n .connect(port, host, () => {\n socket.end()\n resolve()\n })\n }\n\n tryConnect()\n })\n}\n","import { config } from 'dotenv'\n\nimport { runCLI } from './runCLI.ts'\n\nexport const start = async () => {\n config({ quiet: true })\n await runCLI()\n}\n"],"mappings":";;;;AACA,SACEA,WAAWC,aAAAA,YAAWC,iBACjB;AACP,SAASC,cAAc;AACvB,SAASC,kBAAkB;AAC3B,SAASC,oBAAoB;AAC7B,SAASC,mBAAmB;AAE5B,SAASC,aAAAA,YAAWC,kBAAkB;AAEtC,OAAOC,WAAW;AAClB,SAASC,eAAe;;;ACZxB,SAASC,cAAc;AACvB,SAASC,mBAAmB;AAC5B,SAASC,wBAAmD;AAMrD,IAAMC,YAAY,8BACvBC,SACAC,cACAC,YAAAA;AAEA,QAAMC,UAAU,MAAMC,iBAAiB;IAAEJ,QAAAA;IAAQK,QAAQH,QAAQI,QAAQD;EAAO,CAAA;AAEhF,QAAME,MAAM,MAAMC,YAAYC,OAAO;IACnCN;IAASH,QAAAA;IAAQE;EACnB,CAAA;AACA,QAAMQ,SAAS;IAACH;IAAKI,OAAOC,MAAAA;AAE5B,aAAWC,SAASH,QAAQ;AAE1B,UAAMT,aAAaa,cAAcD,KAAAA;EACnC;AAEA,QAAMZ,aAAac,MAAK;AAC1B,GAlByB;;;ACRzB,SAASC,UAAAA,eAAc;AAEvB,SAASC,sCAAsC;AAC/C,SAASC,6BAA6B;AAGtC,eAAsBC,uBACpBC,SACAC,cACAC,SAAuC;AAEvC,QAAMC,UAAU,MAAMC,+BAA+B;IAAEJ,QAAAA;IAAQK,QAAQH,QAAQI,QAAQD;EAAO,CAAA;AAE9F,QAAME,mBAAmB,MAAMC,sBAAsBC,OAAO;IAC1DN;IAASH,QAAAA;IAAQE;EACnB,CAAA;AACA,QAAMQ,SAAS;IAACH;IAAkBI,OAAOC,OAAAA;AAEzC,aAAWC,SAASH,QAAQ;AAE1B,UAAMT,aAAaa,cAAcD,KAAAA;EACnC;AAEA,QAAMZ,aAAac,MAAK;AAC1B;AAlBsBhB;;;ACLf,IAAMiB,wBAAwB;;;;;;;;;;;;;;;;;;;;ACArC,SACEC,MACAC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AQ,MAAM,yCAAyC,MAAA;IAAO,GAAG,YAAA;AAChE,YAAM,EAAElD,UAAUN,aAAY,IAAK,MAAML,sBAAsB;QAAC;SAAqBE,aAAAA;AACrF,YAAMgE,uBAAuBhE,eAAeG,cAAcM,SAAS,kBAAA,CAAmB;IACxF,CAAA;EACJ,CAAA,EACCkD,QAAQ,MAAM,uBAAuB,MAAA;EAAO,GAAG,YAAA;AAC9C,UAAM5D,SAAS;MAAC;MAAY;;AAC5B,QAAIC,cAAcD,OAAOkE,QAAQC,SAAS;AACxCnE,aAAOoE,KAAK,SAAA;IACd;AACA,UAAM,EAAE1D,UAAUN,aAAY,IAAK,MAAML,sBAAsB;MAAC;MAAO;OAAaE,aAAAA;AACpF,QAAIA,cAAcD,OAAOkE,QAAQC,SAAS;AAExC,YAAMJ,WAAW9D,eAAeG,cAAcM,SAAS,SAAA,CAAU;AAEjE,YAAM2D,gBAAgBpE,cAAcD,OAAOkE,QAAQI,MAAMrE,cAAcD,OAAOkE,QAAQK,IAAI;IAC5F;AAEA,UAAMV,OAAO5D,eAAeG,cAAcM,SAAS,KAAA,CAAM;AAEzD,UAAM2D,gBAAgBpE,cAAcD,OAAOwE,IAAIF,MAAMrE,cAAcD,OAAOwE,IAAID,IAAI;AAElF,UAAMP,YAAY/D,eAAeG,cAAcM,SAAS,UAAA,CAAW;EACrE,CAAA,EACC8C,QAAQ;IACP,eAAe;MACbiB,MAAM;MACNC,aAAa;MACbC,SAAS;IACX;EACF,CAAA,EACCC,KAAI,EACJC,MAAM,QAAQ,GAAA,EACdpE,QAAQA,OAAAA,EACRc;AAEH,QAAMA;AACR;AAhJsBJ;;;AS7FtB,SAAS2D,cAAc;AAIhB,IAAMC,QAAQ,mCAAA;AACnBC,SAAO;IAAEC,OAAO;EAAK,CAAA;AACrB,QAAMC,OAAAA;AACR,GAHqB;","names":["deepMerge","isDefined","toAddress","runApi","runMempool","Orchestrator","runProducer","ConfigZod","isZodError","yargs","hideBin","exists","BridgeActor","initBridgeWallet","runBridge","config","orchestrator","locator","account","initBridgeWallet","logger","context","api","BridgeActor","create","actors","filter","exists","actor","registerActor","start","exists","initRewardsRedemptionApiWallet","RewardRedemptionActor","runRewardRedemptionApi","config","orchestrator","locator","account","initRewardsRedemptionApiWallet","logger","context","rewardRedemption","RewardRedemptionActor","create","actors","filter","exists","actor","registerActor","start","XL1LogoColorizedAscii","Base","ConsoleLogger","isDefined","LogLevel","SilentLogger","initLogger","config","logger","log","silent","SilentLogger","level","isDefined","logLevel","parsed","LogLevel","toLowerCase","ConsoleLogger","Base","defaultLogger","asAddress","assertEx","isDefined","isString","initApiWallet","initBalanceSummaryMap","initEvmProvidersIfAvailable","initFinalizationArchivistIfNeeded","initProducerAccount","initServerNode","initStatusReporter","initTransferSummaryMap","SimpleBlockRunner","initTelemetry","validateHydratedBlock","validateHydratedBlockState","HDWallet","AccountBalanceViewerRpcSchemas","ADDRESS_INDEX","BlockViewerRpcSchemas","FinalizationViewerRpcSchemas","generateXyoBaseWalletFromPhrase","HttpRpcTransport","JsonRpcAccountBalanceViewer","JsonRpcBlockViewer","JsonRpcFinalizationViewer","JsonRpcMempoolRunner","JsonRpcMempoolViewer","MempoolRunnerRpcSchemas","MempoolViewerRpcSchemas","ProviderFactoryLocator","SimpleAccountBalanceViewer","SimpleBlockRewardViewer","SimpleBlockValidationViewer","SimpleBlockViewer","SimpleFinalizationViewer","SimpleMempoolRunner","SimpleMempoolViewer","SimpleNetworkStakeViewer","SimpleStepRewardsByPositionViewer","SimpleStepRewardsByStakerViewer","SimpleStepRewardsByStepViewer","SimpleStepRewardsTotalViewer","SimpleStepRewardsViewer","SimpleStepViewer","SimpleTimeSyncViewer","SimpleWindowedBlockViewer","SimpleXyoConnectionRunner","SimpleXyoConnectionViewer","SimpleXyoGatewayRunner","SimpleXyoRunner","SimpleXyoSigner","SimpleXyoViewer","telemetryContextFromConfig","config","serviceName","serviceVersion","otlpEndpoint","telemetry","otel","path","endpoint","port","metrics","scrape","initTelemetry","attributes","metricsConfig","contextFromConfigWithoutLocator","logger","singletons","caches","telemetryConfig","statusReporter","initStatusReporter","rootLocatorFromConfig","context","locator","ProviderFactoryLocator","registerMany","SimpleNetworkStakeViewer","factory","dependencies","SimpleTimeSyncViewer","SimpleStepViewer","SimpleStepRewardsViewer","SimpleStepRewardsByPositionViewer","SimpleStepRewardsByStakerViewer","SimpleStepRewardsByStepViewer","SimpleStepRewardsTotalViewer","SimpleBlockValidationViewer","state","validateHydratedBlockState","protocol","validateHydratedBlock","initEvmProvidersIfAvailable","isString","remote","rpc","url","remoteLocatorFromConfig","localLocatorFromConfig","freeze","balancesSummaryMap","assertEx","initBalanceSummaryMap","transfersSummaryMap","initTransferSummaryMap","wallet","initApiWallet","writableChainArchivist","readonlyChainArchivist","pendingTransactionsArchivist","pendingBlocksArchivist","initServerNode","initFinalizationArchivistIfNeeded","SimpleMempoolViewer","SimpleMempoolRunner","SimpleAccountBalanceViewer","SimpleFinalizationViewer","finalizedArchivist","SimpleBlockViewer","SimpleWindowedBlockViewer","maxWindowSize","syncInterval","SimpleXyoConnectionViewer","SimpleXyoViewer","producerLocatorFromConfig","account","initProducerAccount","rewardAddress","asAddress","actors","producer","address","info","warn","remoteUrl","transportFactory","schemas","HttpRpcTransport","JsonRpcMempoolViewer","transport","MempoolViewerRpcSchemas","JsonRpcMempoolRunner","MempoolRunnerRpcSchemas","JsonRpcAccountBalanceViewer","AccountBalanceViewerRpcSchemas","JsonRpcFinalizationViewer","FinalizationViewerRpcSchemas","JsonRpcBlockViewer","BlockViewerRpcSchemas","SimpleBlockRewardViewer","SimpleBlockRunner","apiLocatorFromConfig","mempoolLocatorFromConfig","bridgeLocatorFromConfig","mnemonic","bridge","walletPhrase","isDefined","HDWallet","generateMnemonic","generateXyoBaseWalletFromPhrase","signerAccount","derivePath","ADDRESS_INDEX","XYO","SimpleXyoSigner","SimpleXyoRunner","SimpleXyoConnectionRunner","SimpleXyoGatewayRunner","rewardRedemptionLocatorFromConfig","locatorsFromConfig","result","_root","includes","undefined","api","mempool","rewardRedemption","isUsageMeta","globalRegistry","usageMetaToOptions","meta","optionsFromGlobalZodRegistry","opts","schema","Object","values","globalRegistry","_map","isUsageMeta","hidden","title","isDefined","isNull","ConfigZod","cosmiconfigSync","configName","configSection","tryParseConfig","explorer","cosmiconfigSync","result","search","isNull","section","config","isDefined","ConfigZod","parse","net","waitForHostPort","host","port","Promise","resolve","tryConnect","socket","net","Socket","setTimeout","once","destroy","connect","end","configuration","version","isDefined","__VERSION__","resolveConfig","config","logger","console","defaultChainId","toAddress","resolved","structuredClone","chain","id","warn","getLocatorsFromConfig","actors","configuration","logger","initLogger","orchestrator","Orchestrator","create","context","contextFromConfigWithoutLocator","version","locators","locatorsFromConfig","process","on","log","stop","exit","err","error","runCLI","y","yargs","hideBin","argv","usage","XL1LogoColorizedAscii","parserConfiguration","env","scriptName","middleware","parsedConfigFile","tryParseConfig","parsedConfigArgs","parseResult","ConfigZod","safeParse","success","mergedConfig","deepMerge","validatedMergedConfigResult","resolvedConfig","resolveConfig","data","validatedConfigResult","rootConfig","actorNames","Object","keys","actorName","console","JSON","stringify","isZodError","message","Error","stack","options","optionsFromGlobalZodRegistry","wrap","terminalWidth","command","runApi","runBridge","runMempool","runProducer","runRewardRedemptionApi","mempool","enabled","push","waitForHostPort","host","port","api","type","description","default","help","alias","config","start","config","quiet","runCLI"]}
|
|
1
|
+
{"version":3,"sources":["../../src/runCLI.ts","../../src/commands/bridge/runBridge.ts","../../src/commands/rewardRedemption/runRewardRedemptionApi.ts","../../src/images.ts","../../src/initLogger.ts","../../src/locatorFromConfig.ts","../../src/optionsFromGlobalZodRegistry.ts","../../src/tryParseConfig.ts","../../src/waitForHostPort.ts","../../src/start.ts"],"sourcesContent":["import type { Logger } from '@xylabs/sdk-js'\nimport {\n deepMerge, isDefined, toAddress,\n} from '@xylabs/sdk-js'\nimport { runApi } from '@xyo-network/chain-api'\nimport { runMempool } from '@xyo-network/chain-mempool'\nimport { Orchestrator } from '@xyo-network/chain-orchestration'\nimport { runProducer } from '@xyo-network/chain-producer'\nimport type { ActorName, Config } from '@xyo-network/xl1-sdk'\nimport { ConfigZod, isZodError } from '@xyo-network/xl1-sdk'\nimport type { Argv } from 'yargs'\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\n\nimport { runBridge, runRewardRedemptionApi } from './commands/index.ts'\nimport { XL1LogoColorizedAscii } from './images.ts'\nimport { initLogger } from './initLogger.ts'\nimport { contextFromConfigWithoutLocator, locatorsFromConfig } from './locatorFromConfig.ts'\nimport { optionsFromGlobalZodRegistry } from './optionsFromGlobalZodRegistry.ts'\nimport { tryParseConfig } from './tryParseConfig.ts'\nimport { waitForHostPort } from './waitForHostPort.ts'\n\ninterface RunCliContext {\n logger: Logger\n orchestrator: Orchestrator\n}\n\n/** Version string injected by Rollup at build time. */\ndeclare const __VERSION__: string\n\n/**\n * The configuration that will be used throughout the CLI.\n * This is materialized after parsing the command-line arguments,\n * environment variables, and defaults.\n */\nlet configuration: Config\n\nconst version = isDefined(__VERSION__) ? __VERSION__ : 'unknown'\n\nfunction resolveConfig(config: Config): Config {\n const logger = console\n const defaultChainId = toAddress('1')\n const resolved = structuredClone(config)\n if (!resolved.chain.id) {\n logger.warn(`No chain ID specified in configuration; defaulting to ${defaultChainId}`)\n resolved.chain.id = defaultChainId\n }\n return resolved\n}\n\nconst getContextFromConfig = async (configuration: Config): Promise<RunCliContext> => {\n const logger = initLogger(configuration)\n const orchestrator = await Orchestrator.create({ logger })\n // Handle cancellation (Ctrl+C)\n process.on('SIGINT', () => {\n void (async () => {\n try {\n logger.log('\\nSIGINT received. Attempting graceful shutdown...')\n await orchestrator?.stop()\n logger.log('Orchestrator stopped, exiting now.')\n process.exit(0)\n } catch (err) {\n logger.error('Error stopping orchestrator:', err)\n process.exit(1)\n }\n })()\n })\n return { logger, orchestrator }\n}\n\nconst getLocatorsFromConfig = async (actors: string[], configuration: Config) => {\n const logger = initLogger(configuration)\n const orchestrator = await Orchestrator.create({ logger })\n const context = await contextFromConfigWithoutLocator(configuration, logger, 'xl1-cli', version)\n const locators = await locatorsFromConfig(actors, configuration, context)\n // Handle cancellation (Ctrl+C)\n process.on('SIGINT', () => {\n void (async () => {\n try {\n logger.log('\\nSIGINT received. Attempting graceful shutdown...')\n await orchestrator?.stop()\n logger.log('Orchestrator stopped, exiting now.')\n process.exit(0)\n } catch (err) {\n logger.error('Error stopping orchestrator:', err)\n process.exit(1)\n }\n })()\n })\n return { locators, orchestrator }\n}\n\n// Main entry point\nexport async function runCLI() {\n // Parse command-line arguments using Yargs\n const y = yargs(hideBin(process.argv)) as Argv<Config>\n const argv = y\n .usage(`\n🚀 XL1 Node CLI (${version})\n${XL1LogoColorizedAscii}\nRun various components of the XL1 ecosystem.\n\nUsage:\n$0 <command> [options]`)\n .parserConfiguration({\n 'dot-notation': true, // foo.bar → { foo: { bar } }\n 'parse-numbers': false, // Don't auto-parse numbers to allow strings like \"0x1\"\n 'populate--': true, // Populate -- with all options so we can detected user-supplied vs defaults\n })\n .env('XL1')\n .scriptName('xl1')\n .middleware((argv) => {\n try {\n // Parse the various config sources\n const parsedConfigFile = tryParseConfig() // Config file\n const parsedConfigArgs = argv // Command-line arguments & ENV VARs\n const parseResult = ConfigZod.safeParse(parsedConfigFile)\n if (!parseResult.success) {\n throw parseResult.error\n }\n // Deep merge with precedence\n // TODO: Would like precedence to be defaults < file < ENV < CLI Args\n // but there is currently no way to determine which are defaults vs\n // user-supplied CLI Args since we set the CLI args to the defaults\n // and receive a flattened object. We might need to manually invoke\n // the parser without the defaults to achieve this.\n // const mergedConfig = deepMerge(parsedConfigArgs, parsedConfigFile)\n const mergedConfig = deepMerge(parsedConfigArgs)\n const validatedMergedConfigResult = ConfigZod.safeParse(mergedConfig)\n if (!validatedMergedConfigResult.success) {\n throw validatedMergedConfigResult.error\n }\n const resolvedConfig = resolveConfig(validatedMergedConfigResult.data)\n // Validate the merged configuration\n const validatedConfigResult = ConfigZod.safeParse(resolvedConfig)\n if (!validatedConfigResult.success) {\n throw validatedConfigResult.error\n }\n configuration = validatedConfigResult.data\n\n const { actors, ...rootConfig } = configuration\n const actorNames = Object.keys(actors) as ActorName[]\n\n for (const actorName of actorNames) {\n configuration.actors[actorName] = deepMerge(\n rootConfig ?? {},\n configuration.actors[actorName] ?? {},\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) as any\n }\n\n // Check if user wants to dump config and exit\n if (argv['dump-config']) {\n console.log(JSON.stringify(configuration, null, 2))\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0)\n }\n } catch (err) {\n if (isZodError(err)) {\n console.error(`Zod error: ${err.message}`)\n } else {\n console.error(`Error parsing configuration: ${err}`)\n }\n console.error(`Stack: ${err instanceof Error ? err.stack : 'N/A'}`)\n throw new Error('Invalid configuration')\n }\n })\n .options(optionsFromGlobalZodRegistry())\n // .commandDir('./command/commands', opts) // Not yet supported for ESM\n .wrap(y.terminalWidth())\n .command('api', 'Run a XL1 API Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 API Node', () => {}, async () => {\n const { locators, orchestrator } = await getLocatorsFromConfig(['api'], configuration)\n await runApi(configuration, orchestrator, locators['api'])\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 { locators, orchestrator } = await getLocatorsFromConfig(['bridge'], configuration)\n await runBridge(configuration, orchestrator, locators['bridge'])\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 { locators, orchestrator } = await getLocatorsFromConfig(['mempool'], configuration)\n await runMempool(configuration, orchestrator, locators['mempool'])\n })\n })\n .command('producer', 'Run a XL1 Producer Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 Producer Node', () => {}, async () => {\n const { locators, orchestrator } = await getLocatorsFromConfig(['producer'], configuration)\n await runProducer(configuration, orchestrator, locators['producer'])\n })\n })\n .command('reward-redemption-api', 'Run a XL1 Rewards Redemption API Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 Rewards Redemption API Node', () => {}, async () => {\n const { locators, orchestrator } = await getLocatorsFromConfig(['rewardRedemption'], configuration)\n await runRewardRedemptionApi(configuration, orchestrator, locators['rewardRedemption'])\n })\n })\n .command('$0', 'Run a full XL1 Node', () => {}, async () => {\n const actors = ['producer', 'api']\n if (configuration.actors.mempool.enabled) {\n actors.push('mempool')\n }\n const { locators, orchestrator } = await getLocatorsFromConfig(['api', 'producer'], configuration)\n if (configuration.actors.mempool.enabled) {\n // Start Mempool but do not block\n await runMempool(configuration, orchestrator, locators['mempool'])\n // Wait for Mempool to be ready\n await waitForHostPort(configuration.actors.mempool.host, configuration.actors.mempool.port)\n }\n // Start API but do not block\n await runApi(configuration, orchestrator, locators['api'])\n // Wait for API to be ready\n await waitForHostPort(configuration.actors.api.host, configuration.actors.api.port)\n // Start Producer and block on it\n await runProducer(configuration, orchestrator, locators['producer'])\n })\n .options({\n 'dump-config': {\n type: 'boolean',\n description: 'Just process the configuration and print the resolved config to stdout, then exit.',\n default: false,\n },\n })\n .help()\n .alias('help', 'h')\n .version(version)\n .argv\n\n await argv\n}\n","import { exists } from '@xylabs/sdk-js'\nimport { BridgeActor } from '@xyo-network/chain-bridge'\nimport { initBridgeWallet, type OrchestratorInstance } from '@xyo-network/chain-orchestration'\nimport type {\n Config,\n ProviderFactoryLocatorInstance,\n} from '@xyo-network/xl1-sdk'\n\nexport const runBridge = async (\n config: Config,\n orchestrator: OrchestratorInstance,\n locator: ProviderFactoryLocatorInstance,\n) => {\n const account = await initBridgeWallet({ config, logger: locator.context.logger })\n // Create actors\n const api = await BridgeActor.create({\n account, config, locator,\n })\n const actors = [api].filter(exists)\n\n for (const actor of actors) {\n // Register the actor with the orchestrator\n await orchestrator.registerActor(actor)\n }\n // Start the orchestrator => automatically activates the actor\n await orchestrator.start()\n}\n","import { exists } from '@xylabs/sdk-js'\nimport type { OrchestratorInstance } from '@xyo-network/chain-orchestration'\nimport { initRewardsRedemptionApiWallet } from '@xyo-network/chain-orchestration'\nimport { RewardRedemptionActor } from '@xyo-network/chain-reward-redemption'\nimport type { Config, ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk'\n\nexport async function runRewardRedemptionApi(\n config: Config,\n orchestrator: OrchestratorInstance,\n locator: ProviderFactoryLocatorInstance,\n) {\n const account = await initRewardsRedemptionApiWallet({ config, logger: locator.context.logger })\n // Create actors\n const rewardRedemption = await RewardRedemptionActor.create({\n account, config, locator,\n })\n const actors = [rewardRedemption].filter(exists)\n\n for (const actor of actors) {\n // Register the actor with the orchestrator\n await orchestrator.registerActor(actor)\n }\n // Start the orchestrator => automatically activates the actor\n await orchestrator.start()\n}\n","/* eslint-disable @stylistic/max-len */\nexport const XL1LogoColorizedAscii = `\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;118;111;144m_\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;72;32;223m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\n\u001b[38;2;128;128;128m ╠╠\u001b[0m\u001b[38;2;103;85;170m_\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;79;121;152m╦\u001b[0m\u001b[38;2;82;121;151m╦\u001b[0m\u001b[38;2;112;125;136m_ \u001b[0m\u001b[38;2;88;59;196m[\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;73;34;221m▒ \u001b[0m\u001b[38;2;121;121;127m_\u001b[0m\u001b[38;2;100;101;128m╔\u001b[0m\u001b[38;2;93;94;127m╦\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;82;121;151m²\u001b[0m\u001b[38;2;44;116;170m╠\u001b[0m\u001b[38;2;44;116;171m▒\u001b[0m\u001b[38;2;51;117;167mD\u001b[0m\u001b[38;2;80;121;152m╦\u001b[0m\u001b[38;2;111;125;136m_ \u001b[0m\u001b[38;2;67;23;232m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠ \u001b[0m\u001b[38;2;120;121;128m_\u001b[0m\u001b[38;2;100;101;127m╔\u001b[0m\u001b[38;2;79;81;127mR\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;88;90;127m╙\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;55;117;165m╚\u001b[0m\u001b[38;2;44;116;171m▒\u001b[0m\u001b[38;2;44;116;171m▒▒\u001b[0m\u001b[38;2;50;116;167mD\u001b[0m\u001b[38;2;80;121;152m╦ \u001b[0m\u001b[38;2;106;90;165mj\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠\u001b[0m\u001b[38;2;89;61;194mH \u001b[0m\u001b[38;2;99;100;127m╔\u001b[0m\u001b[38;2;79;80;127mD\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;71;73;128m▒▒╠\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;83;121;150m²\u001b[0m\u001b[38;2;44;116;170m▒\u001b[0m\u001b[38;2;44;116;171m▒▒▒ \u001b[0m\u001b[38;2;76;38;217m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠ \u001b[0m\u001b[38;2;74;76;128m╠\u001b[0m\u001b[38;2;71;73;128m▒▒▒\u001b[0m\u001b[38;2;89;90;128m╙\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;90;118;148m\\`\u001b[0m\u001b[38;2;89;107;153m_\u001b[0m\u001b[38;2;93;97;154m,\u001b[0m\u001b[38;2;105;89;166m╓\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠\u001b[0m\u001b[38;2;95;72;183m╓\u001b[0m\u001b[38;2;106;96;152m_\u001b[0m\u001b[38;2;100;94;143m\\`\u001b[0m\u001b[38;2;101;100;133m\\`\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;122;118;137m_\u001b[0m\u001b[38;2;113;102;153m,\u001b[0m\u001b[38;2;108;94;161m╓\u001b[0m\u001b[38;2;104;86;169m╓\u001b[0m\u001b[38;2;98;77;178m╔\u001b[0m\u001b[38;2;93;67;188m╗\u001b[0m\u001b[38;2;88;59;196mφ\u001b[0m\u001b[38;2;83;51;204m@\u001b[0m\u001b[38;2;78;42;213mD\u001b[0m\u001b[38;2;72;32;223m▒\u001b[0m\u001b[38;2;68;24;231m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠\u001b[0m\u001b[38;2;71;30;225m▒\u001b[0m\u001b[38;2;77;40;215m▒\u001b[0m\u001b[38;2;82;49;206mK\u001b[0m\u001b[38;2;87;57;198mφ\u001b[0m\u001b[38;2;91;65;190m╗\u001b[0m\u001b[38;2;97;75;180m╦\u001b[0m\u001b[38;2;103;84;171m╖\u001b[0m\u001b[38;2;107;92;163m²\u001b[0m\u001b[38;2;112;101;154m_\u001b[0m\u001b[38;2;119;112;143m_\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;106;91;164m\\`\u001b[0m\u001b[38;2;94;70;185m^\u001b[0m\u001b[38;2;89;62;193m╙\u001b[0m\u001b[38;2;85;54;201m╙\u001b[0m\u001b[38;2;80;45;210m╚\u001b[0m\u001b[38;2;74;35;220m╝\u001b[0m\u001b[38;2;69;26;229m╠\u001b[0m\u001b[38;2;66;22;233m╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠\u001b[0m\u001b[38;2;73;33;222m╝\u001b[0m\u001b[38;2;79;43;212m╩\u001b[0m\u001b[38;2;84;52;203m╜\u001b[0m\u001b[38;2;88;60;195m╙\u001b[0m\u001b[38;2;93;68;187m^\u001b[0m\u001b[38;2;100;80;175m\\`\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;113;84;152m\\`\u001b[0m\u001b[38;2;103;79;169m'\u001b[0m\u001b[38;2;95;72;183m\"\u001b[0m\u001b[38;2;87;57;198m╙\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠\u001b[0m\u001b[38;2;80;46;209m╜\u001b[0m\u001b[38;2;94;70;185m^\u001b[0m\u001b[38;2;102;77;175m^\u001b[0m\u001b[38;2;112;81;162m\\`\u001b[0m\u001b[38;2;115;92;155m\\`\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;145;116;107m,\u001b[0m\u001b[38;2;199;82;45m╠\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒╠ \u001b[0m\u001b[38;2;70;28;227m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠ \u001b[0m\u001b[38;2;189;49;97må\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠\u001b[0m\u001b[38;2;155;92;114m,\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;175;98;73m╔\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒▒▒\u001b[0m\u001b[38;2;197;83;47m╩ \u001b[0m\u001b[38;2;98;76;179m[\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠\u001b[0m\u001b[38;2;81;48;207mH \u001b[0m\u001b[38;2;188;51;98m╚\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠╠\u001b[0m\u001b[38;2;183;57;100mH\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;146;116;106m,\u001b[0m\u001b[38;2;199;82;44m╠\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;196;84;48m╩\u001b[0m\u001b[38;2;168;102;81m^ \u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠ \u001b[0m\u001b[38;2;160;87;111m'\u001b[0m\u001b[38;2;187;52;98m╚\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠\u001b[0m\u001b[38;2;156;91;113m,\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;198;83;46m╩\u001b[0m\u001b[38;2;194;85;50m╩\u001b[0m\u001b[38;2;167;102;82m^ \u001b[0m\u001b[38;2;81;46;209m╚\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠ \u001b[0m\u001b[38;2;159;88;112m'\u001b[0m\u001b[38;2;186;53;98m╚\u001b[0m\u001b[38;2;197;40;93m╩\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;110;97;158m'\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;94;69;186mH\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;68;25;230m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;108;93;162m²\u001b[0m\u001b[38;2;99;79;176m^\u001b[0m`\n","import type { Logger, LogLevelValue } from '@xylabs/sdk-js'\nimport {\n Base,\n ConsoleLogger, isDefined,\n LogLevel, SilentLogger,\n} from '@xylabs/sdk-js'\nimport type { Config } from '@xyo-network/xl1-sdk'\n\nexport const initLogger = (config: Config): Logger => {\n let logger: Logger\n if (config.log.silent) {\n logger = new SilentLogger()\n } else {\n let level: LogLevelValue | undefined\n if (isDefined(config.log.logLevel)) {\n const parsed = LogLevel[config.log.logLevel.toLowerCase() as keyof typeof LogLevel]\n if (isDefined(parsed)) level = parsed\n }\n logger = new ConsoleLogger(level)\n }\n Base.defaultLogger = logger\n return logger\n}\n","import type { Logger, Promisable } from '@xylabs/sdk-js'\nimport {\n asAddress, assertEx, isDefined, isString,\n} from '@xylabs/sdk-js'\nimport {\n initApiWallet, initBalanceSummaryMap, initEvmProvidersIfAvailable, initFinalizationArchivistIfNeeded, initProducerAccount, initServerNode,\n initStatusReporter, initTransferSummaryMap,\n} from '@xyo-network/chain-orchestration'\nimport { SimpleBlockRunner } from '@xyo-network/chain-services'\nimport { initTelemetry } from '@xyo-network/chain-telemetry'\nimport { validateHydratedBlock, validateHydratedBlockState } from '@xyo-network/chain-validation'\nimport { HDWallet } from '@xyo-network/wallet'\nimport type {\n Config, CreatableProviderContext, ProviderFactoryLocatorInstance, RpcSchemaMap, TransportFactory,\n} from '@xyo-network/xl1-sdk'\nimport {\n AccountBalanceViewerRpcSchemas,\n ADDRESS_INDEX,\n BlockViewerRpcSchemas,\n FinalizationViewerRpcSchemas,\n generateXyoBaseWalletFromPhrase,\n HttpRpcTransport,\n JsonRpcAccountBalanceViewer,\n JsonRpcBlockViewer,\n JsonRpcFinalizationViewer,\n JsonRpcMempoolRunner,\n JsonRpcMempoolViewer,\n MempoolRunnerRpcSchemas,\n MempoolViewerRpcSchemas,\n ProviderFactoryLocator,\n SimpleAccountBalanceViewer,\n SimpleBlockRewardViewer,\n SimpleBlockValidationViewer,\n SimpleBlockViewer,\n SimpleFinalizationRunner,\n SimpleFinalizationViewer,\n SimpleMempoolRunner,\n SimpleMempoolViewer,\n SimpleNetworkStakeViewer,\n SimpleStepRewardsByPositionViewer,\n SimpleStepRewardsByStakerViewer,\n SimpleStepRewardsByStepViewer,\n SimpleStepRewardsTotalViewer,\n SimpleStepRewardsViewer,\n SimpleStepViewer,\n SimpleTimeSyncViewer,\n SimpleWindowedBlockViewer,\n SimpleXyoConnectionRunner,\n SimpleXyoConnectionViewer,\n SimpleXyoGateway,\n SimpleXyoGatewayRunner,\n SimpleXyoRunner,\n SimpleXyoSigner,\n SimpleXyoViewer,\n} from '@xyo-network/xl1-sdk'\n\nexport async function telemetryContextFromConfig(config: Config, serviceName: string, serviceVersion: string) {\n const { otlpEndpoint } = config.telemetry?.otel ?? {}\n const { path: endpoint = '/metrics', port: port = 9466 } = config.telemetry?.metrics?.scrape ?? {}\n return await initTelemetry({\n attributes: {\n serviceName,\n serviceVersion,\n },\n otlpEndpoint,\n metricsConfig: { endpoint, port },\n })\n}\n\nexport async function contextFromConfigWithoutLocator(\n config: Config,\n logger: Logger,\n serviceName: string,\n serviceVersion: string,\n): Promise<Omit<CreatableProviderContext, 'locator'>> {\n const singletons = {}\n const caches = {}\n const telemetryConfig = await telemetryContextFromConfig(config, serviceName, serviceVersion)\n const statusReporter = initStatusReporter({ logger })\n return {\n ...telemetryConfig,\n config,\n singletons,\n caches,\n logger,\n statusReporter,\n }\n}\n\nexport async function rootLocatorFromConfig(\n config: Config,\n context: Omit<CreatableProviderContext, 'locator'>,\n): Promise<ProviderFactoryLocatorInstance> {\n let locator: ProviderFactoryLocatorInstance = new ProviderFactoryLocator(context)\n\n locator.registerMany([\n SimpleNetworkStakeViewer.factory<SimpleNetworkStakeViewer>(SimpleNetworkStakeViewer.dependencies, {}),\n SimpleTimeSyncViewer.factory<SimpleTimeSyncViewer>(SimpleTimeSyncViewer.dependencies, {}),\n SimpleStepViewer.factory<SimpleStepViewer>(SimpleStepViewer.dependencies, {}),\n SimpleStepRewardsViewer.factory<SimpleStepRewardsViewer>(SimpleStepRewardsViewer.dependencies, {}),\n SimpleStepRewardsByPositionViewer.factory<SimpleStepRewardsByPositionViewer>(SimpleStepRewardsByPositionViewer.dependencies, {}),\n SimpleStepRewardsByStakerViewer.factory<SimpleStepRewardsByStakerViewer>(SimpleStepRewardsByStakerViewer.dependencies, {}),\n SimpleStepRewardsByStepViewer.factory<SimpleStepRewardsByStepViewer>(SimpleStepRewardsByStepViewer.dependencies, {}),\n SimpleStepRewardsTotalViewer.factory<SimpleStepRewardsTotalViewer>(SimpleStepRewardsTotalViewer.dependencies, {}),\n SimpleBlockValidationViewer.factory<SimpleBlockValidationViewer>(\n SimpleBlockValidationViewer.dependencies,\n { state: validateHydratedBlockState, protocol: validateHydratedBlock },\n ),\n ])\n locator = await initEvmProvidersIfAvailable(locator)\n locator = await (isString(config.remote.rpc?.url)\n ? remoteLocatorFromConfig(config, { ...context, locator })\n : localLocatorFromConfig(config, { ...context, locator }))\n locator.freeze()\n return locator\n}\n\nexport async function localLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<ProviderFactoryLocatorInstance> {\n const balancesSummaryMap = assertEx(await initBalanceSummaryMap(context), () => 'Balance Summary Map not initialized')\n const transfersSummaryMap = assertEx(await initTransferSummaryMap(context), () => 'Transfer Summary Map not initialized')\n\n // TODO: this should not be an api wallet, but a server wallet\n const wallet = await initApiWallet(context)\n\n const {\n writableChainArchivist, readonlyChainArchivist, pendingTransactionsArchivist, pendingBlocksArchivist,\n } = await initServerNode({\n ...context,\n wallet,\n transfersSummaryMap,\n balancesSummaryMap,\n })\n\n await initFinalizationArchivistIfNeeded(writableChainArchivist, config, wallet)\n\n const locator = new ProviderFactoryLocator(context)\n locator.registerMany([\n SimpleMempoolViewer.factory<SimpleMempoolViewer>(SimpleMempoolViewer.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleMempoolRunner.factory<SimpleMempoolRunner>(SimpleMempoolRunner.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleAccountBalanceViewer.factory<SimpleAccountBalanceViewer>(SimpleAccountBalanceViewer.dependencies, { balancesSummaryMap, transfersSummaryMap }),\n SimpleFinalizationViewer.factory<SimpleFinalizationViewer>(SimpleFinalizationViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleBlockViewer.factory<SimpleBlockViewer>(SimpleBlockViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleWindowedBlockViewer.factory<SimpleWindowedBlockViewer>(SimpleWindowedBlockViewer.dependencies, { maxWindowSize: 10_000, syncInterval: 10_000 }),\n SimpleXyoConnectionViewer.factory<SimpleXyoConnectionViewer>(SimpleXyoConnectionViewer.dependencies, {}),\n SimpleXyoViewer.factory<SimpleXyoViewer>(SimpleXyoViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleFinalizationViewer.factory<SimpleFinalizationViewer>(SimpleFinalizationViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleFinalizationRunner.factory<SimpleFinalizationRunner>(SimpleFinalizationRunner.dependencies, { finalizedArchivist: writableChainArchivist }),\n\n ])\n locator.freeze()\n return locator\n}\n\nexport async function remoteLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<ProviderFactoryLocatorInstance> {\n const balancesSummaryMap = assertEx(await initBalanceSummaryMap(context), () => 'Balance Summary Map not initialized')\n const transfersSummaryMap = assertEx(await initTransferSummaryMap(context), () => 'Transfer Summary Map not initialized')\n\n // TODO: this should not be an api wallet, but a server wallet\n const wallet = await initApiWallet(context)\n\n const {\n readonlyChainArchivist, pendingTransactionsArchivist, pendingBlocksArchivist,\n } = await initServerNode({\n ...context,\n wallet,\n transfersSummaryMap,\n balancesSummaryMap,\n })\n\n const locator = new ProviderFactoryLocator(context)\n locator.registerMany([\n SimpleMempoolViewer.factory<SimpleMempoolViewer>(SimpleMempoolViewer.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleMempoolRunner.factory<SimpleMempoolRunner>(SimpleMempoolRunner.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleAccountBalanceViewer.factory<SimpleAccountBalanceViewer>(SimpleAccountBalanceViewer.dependencies, { balancesSummaryMap, transfersSummaryMap }),\n SimpleFinalizationViewer.factory<SimpleFinalizationViewer>(SimpleFinalizationViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleBlockViewer.factory<SimpleBlockViewer>(SimpleBlockViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleWindowedBlockViewer.factory<SimpleWindowedBlockViewer>(SimpleWindowedBlockViewer.dependencies, { maxWindowSize: 10_000, syncInterval: 10_000 }),\n SimpleXyoViewer.factory<SimpleXyoViewer>(SimpleXyoViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n ])\n locator.freeze()\n return locator\n}\n\nexport async function producerLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<ProviderFactoryLocatorInstance> {\n const { logger } = context\n const account = await initProducerAccount({ config })\n const locator = new ProviderFactoryLocator(context)\n const rewardAddress = asAddress(config.actors.producer.rewardAddress ?? account.address, true)\n logger?.info(`Using reward address ${rewardAddress}`)\n if (rewardAddress === account.address) {\n logger?.warn(`Using producer account address as reward address: ${account.address}`)\n }\n\n const remoteUrl = config.actors.producer.remote.rpc?.url\n\n if (isString(remoteUrl)) {\n const transportFactory: TransportFactory = (schemas: RpcSchemaMap) => new HttpRpcTransport(remoteUrl, schemas)\n\n locator.registerMany([\n JsonRpcMempoolViewer.factory<JsonRpcMempoolViewer>(JsonRpcMempoolViewer.dependencies, { transport: await transportFactory(MempoolViewerRpcSchemas) }),\n JsonRpcMempoolRunner.factory<JsonRpcMempoolRunner>(JsonRpcMempoolRunner.dependencies, { transport: await transportFactory(MempoolRunnerRpcSchemas) }),\n JsonRpcAccountBalanceViewer.factory<JsonRpcAccountBalanceViewer>(\n JsonRpcAccountBalanceViewer.dependencies,\n { transport: await transportFactory(AccountBalanceViewerRpcSchemas) },\n ),\n JsonRpcFinalizationViewer.factory<JsonRpcFinalizationViewer>(\n JsonRpcFinalizationViewer.dependencies,\n { transport: await transportFactory(FinalizationViewerRpcSchemas) },\n ),\n JsonRpcBlockViewer.factory<JsonRpcBlockViewer>(JsonRpcBlockViewer.dependencies, { transport: await transportFactory(BlockViewerRpcSchemas) }),\n ])\n }\n\n locator.registerMany([\n SimpleBlockRewardViewer.factory<SimpleBlockRewardViewer>(SimpleBlockRewardViewer.dependencies, {}),\n SimpleBlockRunner.factory<SimpleBlockRunner>(\n SimpleBlockRunner.dependencies,\n { account, rewardAddress },\n )])\n locator.freeze()\n return locator\n}\n\nexport function apiLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promisable<ProviderFactoryLocatorInstance> {\n const locator = new ProviderFactoryLocator(context)\n\n locator.registerMany([\n SimpleXyoRunner.factory<SimpleXyoRunner>(SimpleXyoRunner.dependencies, {}),\n SimpleXyoConnectionRunner.factory<SimpleXyoConnectionRunner>(SimpleXyoConnectionRunner.dependencies, {}),\n SimpleXyoGateway.factory<SimpleXyoGateway>(SimpleXyoGateway.dependencies, {}),\n ])\n locator.freeze()\n return locator\n}\n\nexport function mempoolLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promisable<ProviderFactoryLocatorInstance> {\n const locator = new ProviderFactoryLocator(context)\n\n locator.registerMany([\n ])\n locator.freeze()\n return locator\n}\n\nexport async function bridgeLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<Promise<Promisable<ProviderFactoryLocatorInstance>>> {\n const locator = new ProviderFactoryLocator(context)\n\n const { mnemonic } = config.actors.bridge\n const walletPhrase = isDefined(mnemonic) ? mnemonic : HDWallet.generateMnemonic()\n const wallet = await generateXyoBaseWalletFromPhrase(walletPhrase)\n const signerAccount = await wallet.derivePath(ADDRESS_INDEX.XYO)\n\n const remoteUrl = config.actors.bridge.remote.rpc?.url\n\n if (isString(remoteUrl)) {\n const transportFactory: TransportFactory = (schemas: RpcSchemaMap) => new HttpRpcTransport(remoteUrl, schemas)\n\n locator.registerMany([\n JsonRpcMempoolViewer.factory<JsonRpcMempoolViewer>(JsonRpcMempoolViewer.dependencies, { transport: await transportFactory(MempoolViewerRpcSchemas) }),\n JsonRpcMempoolRunner.factory<JsonRpcMempoolRunner>(JsonRpcMempoolRunner.dependencies, { transport: await transportFactory(MempoolRunnerRpcSchemas) }),\n JsonRpcAccountBalanceViewer.factory<JsonRpcAccountBalanceViewer>(\n JsonRpcAccountBalanceViewer.dependencies,\n { transport: await transportFactory(AccountBalanceViewerRpcSchemas) },\n ),\n JsonRpcFinalizationViewer.factory<JsonRpcFinalizationViewer>(\n JsonRpcFinalizationViewer.dependencies,\n { transport: await transportFactory(FinalizationViewerRpcSchemas) },\n ),\n JsonRpcBlockViewer.factory<JsonRpcBlockViewer>(JsonRpcBlockViewer.dependencies, { transport: await transportFactory(BlockViewerRpcSchemas) }),\n ])\n }\n\n locator.registerMany([\n SimpleXyoSigner.factory<SimpleXyoSigner>(SimpleXyoSigner.dependencies, { account: signerAccount }),\n SimpleXyoRunner.factory<SimpleXyoRunner>(SimpleXyoRunner.dependencies, {}),\n SimpleXyoConnectionRunner.factory<SimpleXyoConnectionRunner>(SimpleXyoConnectionRunner.dependencies, {}),\n SimpleXyoGatewayRunner.factory<SimpleXyoGatewayRunner>(SimpleXyoGatewayRunner.dependencies, {}),\n ])\n locator.freeze()\n return locator\n}\n\nexport function rewardRedemptionLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promisable<ProviderFactoryLocatorInstance> {\n const locator = new ProviderFactoryLocator(context)\n\n locator.registerMany([\n SimpleXyoGatewayRunner.factory<SimpleXyoGatewayRunner>(SimpleXyoGatewayRunner.dependencies, {}),\n ])\n locator.freeze()\n return locator\n}\n\nexport async function locatorsFromConfig(\n actors: string[],\n config: Config,\n context: Omit<CreatableProviderContext, 'locator'>,\n): Promise<Record<string, ProviderFactoryLocatorInstance>> {\n const result: Record<string, ProviderFactoryLocatorInstance> = { _root: await rootLocatorFromConfig(config, context) }\n if (actors.includes('producer')) result.producer = await producerLocatorFromConfig(config, result._root.context)\n if (actors.includes('api')) result.api = await apiLocatorFromConfig(config, result._root.context)\n if (actors.includes('mempool')) result.mempool = await mempoolLocatorFromConfig(config, result._root.context)\n if (actors.includes('bridge')) result.bridge = await bridgeLocatorFromConfig(config, result._root.context)\n if (actors.includes('rewardRedemption')) result.rewardRedemption = await rewardRedemptionLocatorFromConfig(config, result._root.context)\n return result\n}\n","import type { UsageMeta } from '@xyo-network/xl1-sdk'\nimport { isUsageMeta } from '@xyo-network/xl1-sdk'\nimport type { Options } from 'yargs'\nimport { globalRegistry } from 'zod'\n\nconst usageMetaToOptions = (meta: UsageMeta): Options => {\n return meta\n}\n\nexport const optionsFromGlobalZodRegistry = (): Record<string, Options> => {\n const opts: Record<string, Options> = {}\n for (const schema of Object.values(globalRegistry._map)) {\n if (isUsageMeta(schema)) {\n if (schema.hidden) continue // skip hidden options\n opts[schema.title] = usageMetaToOptions(schema)\n }\n }\n return opts\n}\n","import { isDefined, isNull } from '@xylabs/sdk-js'\nimport { ConfigZod } from '@xyo-network/xl1-sdk'\nimport { cosmiconfigSync } from 'cosmiconfig'\n\n/**\n * The name of the configuration file to search for.\n */\nconst configName = 'xyo'\n\n/**\n * The name of the section within the configuration file to parse.\n */\nconst configSection = 'xl1' // Default section in the config file\n\n/**\n * Attempts to parse the configuration from a file using cosmiconfig.\n * @returns The parsed configuration object if found and valid, otherwise undefined.\n */\nexport const tryParseConfig = () => {\n const explorer = cosmiconfigSync(\n configName,\n /* {\n searchPlaces: [\n 'package.json', // Looks under `xyo` key in package.json\n '.xyorc.json', // Supports common dotfile format\n 'xyo.config.json', // Supports custom-named config file\n ],\n loaders: {\n '.json': defaultLoaders['.json'],\n 'noExt': defaultLoaders['.json'],\n },\n }, */\n )\n const result = explorer.search()\n if (!isNull(result)) {\n const section = result?.config?.[configSection]\n if (isDefined(section) && typeof section === 'object') {\n return ConfigZod.parse(section)\n }\n }\n return ConfigZod.parse({})\n}\n","import net from 'node:net'\n\nexport const waitForHostPort = (host: string, port: number): Promise<void> => {\n return new Promise((resolve) => {\n const tryConnect = () => {\n const socket = new net.Socket()\n\n socket\n .setTimeout(1000)\n .once('error', () => {\n socket.destroy()\n setTimeout(tryConnect, 500) // retry after 500ms\n })\n .once('timeout', () => {\n socket.destroy()\n setTimeout(tryConnect, 500)\n })\n .connect(port, host, () => {\n socket.end()\n resolve()\n })\n }\n\n tryConnect()\n })\n}\n","import { config } from 'dotenv'\n\nimport { runCLI } from './runCLI.ts'\n\nexport const start = async () => {\n config({ quiet: true })\n await runCLI()\n}\n"],"mappings":";;;;AACA,SACEA,WAAWC,aAAAA,YAAWC,iBACjB;AACP,SAASC,cAAc;AACvB,SAASC,kBAAkB;AAC3B,SAASC,oBAAoB;AAC7B,SAASC,mBAAmB;AAE5B,SAASC,aAAAA,YAAWC,kBAAkB;AAEtC,OAAOC,WAAW;AAClB,SAASC,eAAe;;;ACZxB,SAASC,cAAc;AACvB,SAASC,mBAAmB;AAC5B,SAASC,wBAAmD;AAMrD,IAAMC,YAAY,8BACvBC,SACAC,cACAC,YAAAA;AAEA,QAAMC,UAAU,MAAMC,iBAAiB;IAAEJ,QAAAA;IAAQK,QAAQH,QAAQI,QAAQD;EAAO,CAAA;AAEhF,QAAME,MAAM,MAAMC,YAAYC,OAAO;IACnCN;IAASH,QAAAA;IAAQE;EACnB,CAAA;AACA,QAAMQ,SAAS;IAACH;IAAKI,OAAOC,MAAAA;AAE5B,aAAWC,SAASH,QAAQ;AAE1B,UAAMT,aAAaa,cAAcD,KAAAA;EACnC;AAEA,QAAMZ,aAAac,MAAK;AAC1B,GAlByB;;;ACRzB,SAASC,UAAAA,eAAc;AAEvB,SAASC,sCAAsC;AAC/C,SAASC,6BAA6B;AAGtC,eAAsBC,uBACpBC,SACAC,cACAC,SAAuC;AAEvC,QAAMC,UAAU,MAAMC,+BAA+B;IAAEJ,QAAAA;IAAQK,QAAQH,QAAQI,QAAQD;EAAO,CAAA;AAE9F,QAAME,mBAAmB,MAAMC,sBAAsBC,OAAO;IAC1DN;IAASH,QAAAA;IAAQE;EACnB,CAAA;AACA,QAAMQ,SAAS;IAACH;IAAkBI,OAAOC,OAAAA;AAEzC,aAAWC,SAASH,QAAQ;AAE1B,UAAMT,aAAaa,cAAcD,KAAAA;EACnC;AAEA,QAAMZ,aAAac,MAAK;AAC1B;AAlBsBhB;;;ACLf,IAAMiB,wBAAwB;;;;;;;;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AAO;EAAK,CAAA;AACrB,QAAMC,OAAAA;AACR,GAHqB;","names":["deepMerge","isDefined","toAddress","runApi","runMempool","Orchestrator","runProducer","ConfigZod","isZodError","yargs","hideBin","exists","BridgeActor","initBridgeWallet","runBridge","config","orchestrator","locator","account","initBridgeWallet","logger","context","api","BridgeActor","create","actors","filter","exists","actor","registerActor","start","exists","initRewardsRedemptionApiWallet","RewardRedemptionActor","runRewardRedemptionApi","config","orchestrator","locator","account","initRewardsRedemptionApiWallet","logger","context","rewardRedemption","RewardRedemptionActor","create","actors","filter","exists","actor","registerActor","start","XL1LogoColorizedAscii","Base","ConsoleLogger","isDefined","LogLevel","SilentLogger","initLogger","config","logger","log","silent","SilentLogger","level","isDefined","logLevel","parsed","LogLevel","toLowerCase","ConsoleLogger","Base","defaultLogger","asAddress","assertEx","isDefined","isString","initApiWallet","initBalanceSummaryMap","initEvmProvidersIfAvailable","initFinalizationArchivistIfNeeded","initProducerAccount","initServerNode","initStatusReporter","initTransferSummaryMap","SimpleBlockRunner","initTelemetry","validateHydratedBlock","validateHydratedBlockState","HDWallet","AccountBalanceViewerRpcSchemas","ADDRESS_INDEX","BlockViewerRpcSchemas","FinalizationViewerRpcSchemas","generateXyoBaseWalletFromPhrase","HttpRpcTransport","JsonRpcAccountBalanceViewer","JsonRpcBlockViewer","JsonRpcFinalizationViewer","JsonRpcMempoolRunner","JsonRpcMempoolViewer","MempoolRunnerRpcSchemas","MempoolViewerRpcSchemas","ProviderFactoryLocator","SimpleAccountBalanceViewer","SimpleBlockRewardViewer","SimpleBlockValidationViewer","SimpleBlockViewer","SimpleFinalizationRunner","SimpleFinalizationViewer","SimpleMempoolRunner","SimpleMempoolViewer","SimpleNetworkStakeViewer","SimpleStepRewardsByPositionViewer","SimpleStepRewardsByStakerViewer","SimpleStepRewardsByStepViewer","SimpleStepRewardsTotalViewer","SimpleStepRewardsViewer","SimpleStepViewer","SimpleTimeSyncViewer","SimpleWindowedBlockViewer","SimpleXyoConnectionRunner","SimpleXyoConnectionViewer","SimpleXyoGateway","SimpleXyoGatewayRunner","SimpleXyoRunner","SimpleXyoSigner","SimpleXyoViewer","telemetryContextFromConfig","config","serviceName","serviceVersion","otlpEndpoint","telemetry","otel","path","endpoint","port","metrics","scrape","initTelemetry","attributes","metricsConfig","contextFromConfigWithoutLocator","logger","singletons","caches","telemetryConfig","statusReporter","initStatusReporter","rootLocatorFromConfig","context","locator","ProviderFactoryLocator","registerMany","SimpleNetworkStakeViewer","factory","dependencies","SimpleTimeSyncViewer","SimpleStepViewer","SimpleStepRewardsViewer","SimpleStepRewardsByPositionViewer","SimpleStepRewardsByStakerViewer","SimpleStepRewardsByStepViewer","SimpleStepRewardsTotalViewer","SimpleBlockValidationViewer","state","validateHydratedBlockState","protocol","validateHydratedBlock","initEvmProvidersIfAvailable","isString","remote","rpc","url","remoteLocatorFromConfig","localLocatorFromConfig","freeze","balancesSummaryMap","assertEx","initBalanceSummaryMap","transfersSummaryMap","initTransferSummaryMap","wallet","initApiWallet","writableChainArchivist","readonlyChainArchivist","pendingTransactionsArchivist","pendingBlocksArchivist","initServerNode","initFinalizationArchivistIfNeeded","SimpleMempoolViewer","SimpleMempoolRunner","SimpleAccountBalanceViewer","SimpleFinalizationViewer","finalizedArchivist","SimpleBlockViewer","SimpleWindowedBlockViewer","maxWindowSize","syncInterval","SimpleXyoConnectionViewer","SimpleXyoViewer","SimpleFinalizationRunner","producerLocatorFromConfig","account","initProducerAccount","rewardAddress","asAddress","actors","producer","address","info","warn","remoteUrl","transportFactory","schemas","HttpRpcTransport","JsonRpcMempoolViewer","transport","MempoolViewerRpcSchemas","JsonRpcMempoolRunner","MempoolRunnerRpcSchemas","JsonRpcAccountBalanceViewer","AccountBalanceViewerRpcSchemas","JsonRpcFinalizationViewer","FinalizationViewerRpcSchemas","JsonRpcBlockViewer","BlockViewerRpcSchemas","SimpleBlockRewardViewer","SimpleBlockRunner","apiLocatorFromConfig","SimpleXyoRunner","SimpleXyoConnectionRunner","SimpleXyoGateway","mempoolLocatorFromConfig","bridgeLocatorFromConfig","mnemonic","bridge","walletPhrase","isDefined","HDWallet","generateMnemonic","generateXyoBaseWalletFromPhrase","signerAccount","derivePath","ADDRESS_INDEX","XYO","SimpleXyoSigner","SimpleXyoGatewayRunner","rewardRedemptionLocatorFromConfig","locatorsFromConfig","result","_root","includes","api","mempool","rewardRedemption","isUsageMeta","globalRegistry","usageMetaToOptions","meta","optionsFromGlobalZodRegistry","opts","schema","Object","values","globalRegistry","_map","isUsageMeta","hidden","title","isDefined","isNull","ConfigZod","cosmiconfigSync","configName","configSection","tryParseConfig","explorer","cosmiconfigSync","result","search","isNull","section","config","isDefined","ConfigZod","parse","net","waitForHostPort","host","port","Promise","resolve","tryConnect","socket","net","Socket","setTimeout","once","destroy","connect","end","configuration","version","isDefined","__VERSION__","resolveConfig","config","logger","console","defaultChainId","toAddress","resolved","structuredClone","chain","id","warn","getLocatorsFromConfig","actors","configuration","logger","initLogger","orchestrator","Orchestrator","create","context","contextFromConfigWithoutLocator","version","locators","locatorsFromConfig","process","on","log","stop","exit","err","error","runCLI","y","yargs","hideBin","argv","usage","XL1LogoColorizedAscii","parserConfiguration","env","scriptName","middleware","parsedConfigFile","tryParseConfig","parsedConfigArgs","parseResult","ConfigZod","safeParse","success","mergedConfig","deepMerge","validatedMergedConfigResult","resolvedConfig","resolveConfig","data","validatedConfigResult","rootConfig","actorNames","Object","keys","actorName","console","JSON","stringify","isZodError","message","Error","stack","options","optionsFromGlobalZodRegistry","wrap","terminalWidth","command","runApi","runBridge","runMempool","runProducer","runRewardRedemptionApi","mempool","enabled","push","waitForHostPort","host","port","api","type","description","default","help","alias","config","start","config","quiet","runCLI"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locatorFromConfig.d.ts","sourceRoot":"","sources":["../../src/locatorFromConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
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ED,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAoC9D;AAED,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,wBAAwB,GAChC,UAAU,CAAC,8BAA8B,CAAC,CAQ5C;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EAAE,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,SAAS,CAAC,GACjD,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAC,CAQzD"}
|
|
@@ -191,7 +191,6 @@ export declare const tryParseConfig: () => {
|
|
|
191
191
|
readonly __address: true;
|
|
192
192
|
})[] | undefined;
|
|
193
193
|
};
|
|
194
|
-
chainRpcApiUrl: string;
|
|
195
194
|
feeFixed: import("@xylabs/sdk-js").BrandedHex;
|
|
196
195
|
feeRateBasisPoints: number;
|
|
197
196
|
host: string;
|
|
@@ -423,7 +422,6 @@ export declare const tryParseConfig: () => {
|
|
|
423
422
|
readonly __address: true;
|
|
424
423
|
})[] | undefined;
|
|
425
424
|
};
|
|
426
|
-
chainRpcApiUrl: string;
|
|
427
425
|
host: string;
|
|
428
426
|
port: number;
|
|
429
427
|
mnemonic?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tryParseConfig.d.ts","sourceRoot":"","sources":["../../src/tryParseConfig.ts"],"names":[],"mappings":"AAcA;;;GAGG;AACH,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"tryParseConfig.d.ts","sourceRoot":"","sources":["../../src/tryParseConfig.ts"],"names":[],"mappings":"AAcA;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuB1B,CAAA"}
|
package/dist/node/xl1.mjs
CHANGED
|
@@ -106,7 +106,7 @@ import { SimpleBlockRunner } from "@xyo-network/chain-services";
|
|
|
106
106
|
import { initTelemetry } from "@xyo-network/chain-telemetry";
|
|
107
107
|
import { validateHydratedBlock, validateHydratedBlockState } from "@xyo-network/chain-validation";
|
|
108
108
|
import { HDWallet } from "@xyo-network/wallet";
|
|
109
|
-
import { AccountBalanceViewerRpcSchemas, ADDRESS_INDEX, BlockViewerRpcSchemas, FinalizationViewerRpcSchemas, generateXyoBaseWalletFromPhrase, HttpRpcTransport, JsonRpcAccountBalanceViewer, JsonRpcBlockViewer, JsonRpcFinalizationViewer, JsonRpcMempoolRunner, JsonRpcMempoolViewer, MempoolRunnerRpcSchemas, MempoolViewerRpcSchemas, ProviderFactoryLocator, SimpleAccountBalanceViewer, SimpleBlockRewardViewer, SimpleBlockValidationViewer, SimpleBlockViewer, SimpleFinalizationViewer, SimpleMempoolRunner, SimpleMempoolViewer, SimpleNetworkStakeViewer, SimpleStepRewardsByPositionViewer, SimpleStepRewardsByStakerViewer, SimpleStepRewardsByStepViewer, SimpleStepRewardsTotalViewer, SimpleStepRewardsViewer, SimpleStepViewer, SimpleTimeSyncViewer, SimpleWindowedBlockViewer, SimpleXyoConnectionRunner, SimpleXyoConnectionViewer, SimpleXyoGatewayRunner, SimpleXyoRunner, SimpleXyoSigner, SimpleXyoViewer } from "@xyo-network/xl1-sdk";
|
|
109
|
+
import { AccountBalanceViewerRpcSchemas, ADDRESS_INDEX, BlockViewerRpcSchemas, FinalizationViewerRpcSchemas, generateXyoBaseWalletFromPhrase, HttpRpcTransport, JsonRpcAccountBalanceViewer, JsonRpcBlockViewer, JsonRpcFinalizationViewer, JsonRpcMempoolRunner, JsonRpcMempoolViewer, MempoolRunnerRpcSchemas, MempoolViewerRpcSchemas, ProviderFactoryLocator, SimpleAccountBalanceViewer, SimpleBlockRewardViewer, SimpleBlockValidationViewer, SimpleBlockViewer, SimpleFinalizationRunner, SimpleFinalizationViewer, SimpleMempoolRunner, SimpleMempoolViewer, SimpleNetworkStakeViewer, SimpleStepRewardsByPositionViewer, SimpleStepRewardsByStakerViewer, SimpleStepRewardsByStepViewer, SimpleStepRewardsTotalViewer, SimpleStepRewardsViewer, SimpleStepViewer, SimpleTimeSyncViewer, SimpleWindowedBlockViewer, SimpleXyoConnectionRunner, SimpleXyoConnectionViewer, SimpleXyoGateway, SimpleXyoGatewayRunner, SimpleXyoRunner, SimpleXyoSigner, SimpleXyoViewer } from "@xyo-network/xl1-sdk";
|
|
110
110
|
async function telemetryContextFromConfig(config2, serviceName, serviceVersion) {
|
|
111
111
|
const { otlpEndpoint } = config2.telemetry?.otel ?? {};
|
|
112
112
|
const { path: endpoint = "/metrics", port = 9466 } = config2.telemetry?.metrics?.scrape ?? {};
|
|
@@ -206,6 +206,12 @@ async function localLocatorFromConfig(config2, context) {
|
|
|
206
206
|
SimpleXyoConnectionViewer.factory(SimpleXyoConnectionViewer.dependencies, {}),
|
|
207
207
|
SimpleXyoViewer.factory(SimpleXyoViewer.dependencies, {
|
|
208
208
|
finalizedArchivist: readonlyChainArchivist
|
|
209
|
+
}),
|
|
210
|
+
SimpleFinalizationViewer.factory(SimpleFinalizationViewer.dependencies, {
|
|
211
|
+
finalizedArchivist: readonlyChainArchivist
|
|
212
|
+
}),
|
|
213
|
+
SimpleFinalizationRunner.factory(SimpleFinalizationRunner.dependencies, {
|
|
214
|
+
finalizedArchivist: writableChainArchivist
|
|
209
215
|
})
|
|
210
216
|
]);
|
|
211
217
|
locator.freeze();
|
|
@@ -265,7 +271,7 @@ async function producerLocatorFromConfig(config2, context) {
|
|
|
265
271
|
if (rewardAddress === account.address) {
|
|
266
272
|
logger?.warn(`Using producer account address as reward address: ${account.address}`);
|
|
267
273
|
}
|
|
268
|
-
const remoteUrl = config2.remote.rpc?.url;
|
|
274
|
+
const remoteUrl = config2.actors.producer.remote.rpc?.url;
|
|
269
275
|
if (isString(remoteUrl)) {
|
|
270
276
|
const transportFactory = /* @__PURE__ */ __name((schemas) => new HttpRpcTransport(remoteUrl, schemas), "transportFactory");
|
|
271
277
|
locator.registerMany([
|
|
@@ -299,7 +305,11 @@ async function producerLocatorFromConfig(config2, context) {
|
|
|
299
305
|
__name(producerLocatorFromConfig, "producerLocatorFromConfig");
|
|
300
306
|
function apiLocatorFromConfig(config2, context) {
|
|
301
307
|
const locator = new ProviderFactoryLocator(context);
|
|
302
|
-
locator.registerMany([
|
|
308
|
+
locator.registerMany([
|
|
309
|
+
SimpleXyoRunner.factory(SimpleXyoRunner.dependencies, {}),
|
|
310
|
+
SimpleXyoConnectionRunner.factory(SimpleXyoConnectionRunner.dependencies, {}),
|
|
311
|
+
SimpleXyoGateway.factory(SimpleXyoGateway.dependencies, {})
|
|
312
|
+
]);
|
|
303
313
|
locator.freeze();
|
|
304
314
|
return locator;
|
|
305
315
|
}
|
|
@@ -363,26 +373,11 @@ async function locatorsFromConfig(actors, config2, context) {
|
|
|
363
373
|
const result = {
|
|
364
374
|
_root: await rootLocatorFromConfig(config2, context)
|
|
365
375
|
};
|
|
366
|
-
|
|
367
|
-
if (
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
if (api) {
|
|
372
|
-
result.api = api;
|
|
373
|
-
}
|
|
374
|
-
const mempool = actors.includes("mempool") ? await mempoolLocatorFromConfig(config2, result._root.context) : void 0;
|
|
375
|
-
if (mempool) {
|
|
376
|
-
result.mempool = mempool;
|
|
377
|
-
}
|
|
378
|
-
const bridge = actors.includes("bridge") ? await bridgeLocatorFromConfig(config2, result._root.context) : void 0;
|
|
379
|
-
if (bridge) {
|
|
380
|
-
result.bridge = bridge;
|
|
381
|
-
}
|
|
382
|
-
const rewardRedemption = actors.includes("rewardRedemption") ? await rewardRedemptionLocatorFromConfig(config2, result._root.context) : void 0;
|
|
383
|
-
if (rewardRedemption) {
|
|
384
|
-
result.rewardRedemption = rewardRedemption;
|
|
385
|
-
}
|
|
376
|
+
if (actors.includes("producer")) result.producer = await producerLocatorFromConfig(config2, result._root.context);
|
|
377
|
+
if (actors.includes("api")) result.api = await apiLocatorFromConfig(config2, result._root.context);
|
|
378
|
+
if (actors.includes("mempool")) result.mempool = await mempoolLocatorFromConfig(config2, result._root.context);
|
|
379
|
+
if (actors.includes("bridge")) result.bridge = await bridgeLocatorFromConfig(config2, result._root.context);
|
|
380
|
+
if (actors.includes("rewardRedemption")) result.rewardRedemption = await rewardRedemptionLocatorFromConfig(config2, result._root.context);
|
|
386
381
|
return result;
|
|
387
382
|
}
|
|
388
383
|
__name(locatorsFromConfig, "locatorsFromConfig");
|
|
@@ -445,7 +440,7 @@ var waitForHostPort = /* @__PURE__ */ __name((host, port) => {
|
|
|
445
440
|
|
|
446
441
|
// src/runCLI.ts
|
|
447
442
|
var configuration;
|
|
448
|
-
var version = isDefined4("1.19.
|
|
443
|
+
var version = isDefined4("1.19.10") ? "1.19.10" : "unknown";
|
|
449
444
|
function resolveConfig(config2) {
|
|
450
445
|
const logger = console;
|
|
451
446
|
const defaultChainId = toAddress("1");
|
package/dist/node/xl1.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/start.ts","../../src/runCLI.ts","../../src/commands/bridge/runBridge.ts","../../src/commands/rewardRedemption/runRewardRedemptionApi.ts","../../src/images.ts","../../src/initLogger.ts","../../src/locatorFromConfig.ts","../../src/optionsFromGlobalZodRegistry.ts","../../src/tryParseConfig.ts","../../src/waitForHostPort.ts","../../src/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 {\n deepMerge, isDefined, toAddress,\n} from '@xylabs/sdk-js'\nimport { runApi } from '@xyo-network/chain-api'\nimport { runMempool } from '@xyo-network/chain-mempool'\nimport { Orchestrator } from '@xyo-network/chain-orchestration'\nimport { runProducer } from '@xyo-network/chain-producer'\nimport type { ActorName, Config } from '@xyo-network/xl1-sdk'\nimport { ConfigZod, isZodError } from '@xyo-network/xl1-sdk'\nimport type { Argv } from 'yargs'\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\n\nimport { runBridge, runRewardRedemptionApi } from './commands/index.ts'\nimport { XL1LogoColorizedAscii } from './images.ts'\nimport { initLogger } from './initLogger.ts'\nimport { contextFromConfigWithoutLocator, locatorsFromConfig } from './locatorFromConfig.ts'\nimport { optionsFromGlobalZodRegistry } from './optionsFromGlobalZodRegistry.ts'\nimport { tryParseConfig } from './tryParseConfig.ts'\nimport { waitForHostPort } from './waitForHostPort.ts'\n\ninterface RunCliContext {\n logger: Logger\n orchestrator: Orchestrator\n}\n\n/** Version string injected by Rollup at build time. */\ndeclare const __VERSION__: string\n\n/**\n * The configuration that will be used throughout the CLI.\n * This is materialized after parsing the command-line arguments,\n * environment variables, and defaults.\n */\nlet configuration: Config\n\nconst version = isDefined(__VERSION__) ? __VERSION__ : 'unknown'\n\nfunction resolveConfig(config: Config): Config {\n const logger = console\n const defaultChainId = toAddress('1')\n const resolved = structuredClone(config)\n if (!resolved.chain.id) {\n logger.warn(`No chain ID specified in configuration; defaulting to ${defaultChainId}`)\n resolved.chain.id = defaultChainId\n }\n return resolved\n}\n\nconst getContextFromConfig = async (configuration: Config): Promise<RunCliContext> => {\n const logger = initLogger(configuration)\n const orchestrator = await Orchestrator.create({ logger })\n // Handle cancellation (Ctrl+C)\n process.on('SIGINT', () => {\n void (async () => {\n try {\n logger.log('\\nSIGINT received. Attempting graceful shutdown...')\n await orchestrator?.stop()\n logger.log('Orchestrator stopped, exiting now.')\n process.exit(0)\n } catch (err) {\n logger.error('Error stopping orchestrator:', err)\n process.exit(1)\n }\n })()\n })\n return { logger, orchestrator }\n}\n\nconst getLocatorsFromConfig = async (actors: string[], configuration: Config) => {\n const logger = initLogger(configuration)\n const orchestrator = await Orchestrator.create({ logger })\n const context = await contextFromConfigWithoutLocator(configuration, logger, 'xl1-cli', version)\n const locators = await locatorsFromConfig(actors, configuration, context)\n // Handle cancellation (Ctrl+C)\n process.on('SIGINT', () => {\n void (async () => {\n try {\n logger.log('\\nSIGINT received. Attempting graceful shutdown...')\n await orchestrator?.stop()\n logger.log('Orchestrator stopped, exiting now.')\n process.exit(0)\n } catch (err) {\n logger.error('Error stopping orchestrator:', err)\n process.exit(1)\n }\n })()\n })\n return { locators, orchestrator }\n}\n\n// Main entry point\nexport async function runCLI() {\n // Parse command-line arguments using Yargs\n const y = yargs(hideBin(process.argv)) as Argv<Config>\n const argv = y\n .usage(`\n🚀 XL1 Node CLI (${version})\n${XL1LogoColorizedAscii}\nRun various components of the XL1 ecosystem.\n\nUsage:\n$0 <command> [options]`)\n .parserConfiguration({\n 'dot-notation': true, // foo.bar → { foo: { bar } }\n 'parse-numbers': false, // Don't auto-parse numbers to allow strings like \"0x1\"\n 'populate--': true, // Populate -- with all options so we can detected user-supplied vs defaults\n })\n .env('XL1')\n .scriptName('xl1')\n .middleware((argv) => {\n try {\n // Parse the various config sources\n const parsedConfigFile = tryParseConfig() // Config file\n const parsedConfigArgs = argv // Command-line arguments & ENV VARs\n const parseResult = ConfigZod.safeParse(parsedConfigFile)\n if (!parseResult.success) {\n throw parseResult.error\n }\n // Deep merge with precedence\n // TODO: Would like precedence to be defaults < file < ENV < CLI Args\n // but there is currently no way to determine which are defaults vs\n // user-supplied CLI Args since we set the CLI args to the defaults\n // and receive a flattened object. We might need to manually invoke\n // the parser without the defaults to achieve this.\n // const mergedConfig = deepMerge(parsedConfigArgs, parsedConfigFile)\n const mergedConfig = deepMerge(parsedConfigArgs)\n const validatedMergedConfigResult = ConfigZod.safeParse(mergedConfig)\n if (!validatedMergedConfigResult.success) {\n throw validatedMergedConfigResult.error\n }\n const resolvedConfig = resolveConfig(validatedMergedConfigResult.data)\n // Validate the merged configuration\n const validatedConfigResult = ConfigZod.safeParse(resolvedConfig)\n if (!validatedConfigResult.success) {\n throw validatedConfigResult.error\n }\n configuration = validatedConfigResult.data\n\n const { actors, ...rootConfig } = configuration\n const actorNames = Object.keys(actors) as ActorName[]\n\n for (const actorName of actorNames) {\n configuration.actors[actorName] = deepMerge(\n rootConfig ?? {},\n configuration.actors[actorName] ?? {},\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) as any\n }\n\n // Check if user wants to dump config and exit\n if (argv['dump-config']) {\n console.log(JSON.stringify(configuration, null, 2))\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0)\n }\n } catch (err) {\n if (isZodError(err)) {\n console.error(`Zod error: ${err.message}`)\n } else {\n console.error(`Error parsing configuration: ${err}`)\n }\n console.error(`Stack: ${err instanceof Error ? err.stack : 'N/A'}`)\n throw new Error('Invalid configuration')\n }\n })\n .options(optionsFromGlobalZodRegistry())\n // .commandDir('./command/commands', opts) // Not yet supported for ESM\n .wrap(y.terminalWidth())\n .command('api', 'Run a XL1 API Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 API Node', () => {}, async () => {\n const { locators, orchestrator } = await getLocatorsFromConfig(['api'], configuration)\n await runApi(configuration, orchestrator, locators['api'])\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 { locators, orchestrator } = await getLocatorsFromConfig(['bridge'], configuration)\n await runBridge(configuration, orchestrator, locators['bridge'])\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 { locators, orchestrator } = await getLocatorsFromConfig(['mempool'], configuration)\n await runMempool(configuration, orchestrator, locators['mempool'])\n })\n })\n .command('producer', 'Run a XL1 Producer Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 Producer Node', () => {}, async () => {\n const { locators, orchestrator } = await getLocatorsFromConfig(['producer'], configuration)\n await runProducer(configuration, orchestrator, locators['producer'])\n })\n })\n .command('reward-redemption-api', 'Run a XL1 Rewards Redemption API Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 Rewards Redemption API Node', () => {}, async () => {\n const { locators, orchestrator } = await getLocatorsFromConfig(['rewardRedemption'], configuration)\n await runRewardRedemptionApi(configuration, orchestrator, locators['rewardRedemption'])\n })\n })\n .command('$0', 'Run a full XL1 Node', () => {}, async () => {\n const actors = ['producer', 'api']\n if (configuration.actors.mempool.enabled) {\n actors.push('mempool')\n }\n const { locators, orchestrator } = await getLocatorsFromConfig(['api', 'producer'], configuration)\n if (configuration.actors.mempool.enabled) {\n // Start Mempool but do not block\n await runMempool(configuration, orchestrator, locators['mempool'])\n // Wait for Mempool to be ready\n await waitForHostPort(configuration.actors.mempool.host, configuration.actors.mempool.port)\n }\n // Start API but do not block\n await runApi(configuration, orchestrator, locators['api'])\n // Wait for API to be ready\n await waitForHostPort(configuration.actors.api.host, configuration.actors.api.port)\n // Start Producer and block on it\n await runProducer(configuration, orchestrator, locators['producer'])\n })\n .options({\n 'dump-config': {\n type: 'boolean',\n description: 'Just process the configuration and print the resolved config to stdout, then exit.',\n default: false,\n },\n })\n .help()\n .alias('help', 'h')\n .version(version)\n .argv\n\n await argv\n}\n","import { exists } from '@xylabs/sdk-js'\nimport { BridgeActor } from '@xyo-network/chain-bridge'\nimport { initBridgeWallet, type OrchestratorInstance } from '@xyo-network/chain-orchestration'\nimport type {\n Config,\n ProviderFactoryLocatorInstance,\n} from '@xyo-network/xl1-sdk'\n\nexport const runBridge = async (\n config: Config,\n orchestrator: OrchestratorInstance,\n locator: ProviderFactoryLocatorInstance,\n) => {\n const account = await initBridgeWallet({ config, logger: locator.context.logger })\n // Create actors\n const api = await BridgeActor.create({\n account, config, locator,\n })\n const actors = [api].filter(exists)\n\n for (const actor of actors) {\n // Register the actor with the orchestrator\n await orchestrator.registerActor(actor)\n }\n // Start the orchestrator => automatically activates the actor\n await orchestrator.start()\n}\n","import { exists } from '@xylabs/sdk-js'\nimport type { OrchestratorInstance } from '@xyo-network/chain-orchestration'\nimport { initRewardsRedemptionApiWallet } from '@xyo-network/chain-orchestration'\nimport { RewardRedemptionActor } from '@xyo-network/chain-reward-redemption'\nimport type { Config, ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk'\n\nexport async function runRewardRedemptionApi(\n config: Config,\n orchestrator: OrchestratorInstance,\n locator: ProviderFactoryLocatorInstance,\n) {\n const account = await initRewardsRedemptionApiWallet({ config, logger: locator.context.logger })\n // Create actors\n const rewardRedemption = await RewardRedemptionActor.create({\n account, config, locator,\n })\n const actors = [rewardRedemption].filter(exists)\n\n for (const actor of actors) {\n // Register the actor with the orchestrator\n await orchestrator.registerActor(actor)\n }\n // Start the orchestrator => automatically activates the actor\n await orchestrator.start()\n}\n","/* eslint-disable @stylistic/max-len */\nexport const XL1LogoColorizedAscii = `\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;118;111;144m_\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;72;32;223m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\n\u001b[38;2;128;128;128m ╠╠\u001b[0m\u001b[38;2;103;85;170m_\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;79;121;152m╦\u001b[0m\u001b[38;2;82;121;151m╦\u001b[0m\u001b[38;2;112;125;136m_ \u001b[0m\u001b[38;2;88;59;196m[\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;73;34;221m▒ \u001b[0m\u001b[38;2;121;121;127m_\u001b[0m\u001b[38;2;100;101;128m╔\u001b[0m\u001b[38;2;93;94;127m╦\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;82;121;151m²\u001b[0m\u001b[38;2;44;116;170m╠\u001b[0m\u001b[38;2;44;116;171m▒\u001b[0m\u001b[38;2;51;117;167mD\u001b[0m\u001b[38;2;80;121;152m╦\u001b[0m\u001b[38;2;111;125;136m_ \u001b[0m\u001b[38;2;67;23;232m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠ \u001b[0m\u001b[38;2;120;121;128m_\u001b[0m\u001b[38;2;100;101;127m╔\u001b[0m\u001b[38;2;79;81;127mR\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;88;90;127m╙\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;55;117;165m╚\u001b[0m\u001b[38;2;44;116;171m▒\u001b[0m\u001b[38;2;44;116;171m▒▒\u001b[0m\u001b[38;2;50;116;167mD\u001b[0m\u001b[38;2;80;121;152m╦ \u001b[0m\u001b[38;2;106;90;165mj\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠\u001b[0m\u001b[38;2;89;61;194mH \u001b[0m\u001b[38;2;99;100;127m╔\u001b[0m\u001b[38;2;79;80;127mD\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;71;73;128m▒▒╠\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;83;121;150m²\u001b[0m\u001b[38;2;44;116;170m▒\u001b[0m\u001b[38;2;44;116;171m▒▒▒ \u001b[0m\u001b[38;2;76;38;217m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠ \u001b[0m\u001b[38;2;74;76;128m╠\u001b[0m\u001b[38;2;71;73;128m▒▒▒\u001b[0m\u001b[38;2;89;90;128m╙\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;90;118;148m\\`\u001b[0m\u001b[38;2;89;107;153m_\u001b[0m\u001b[38;2;93;97;154m,\u001b[0m\u001b[38;2;105;89;166m╓\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠\u001b[0m\u001b[38;2;95;72;183m╓\u001b[0m\u001b[38;2;106;96;152m_\u001b[0m\u001b[38;2;100;94;143m\\`\u001b[0m\u001b[38;2;101;100;133m\\`\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;122;118;137m_\u001b[0m\u001b[38;2;113;102;153m,\u001b[0m\u001b[38;2;108;94;161m╓\u001b[0m\u001b[38;2;104;86;169m╓\u001b[0m\u001b[38;2;98;77;178m╔\u001b[0m\u001b[38;2;93;67;188m╗\u001b[0m\u001b[38;2;88;59;196mφ\u001b[0m\u001b[38;2;83;51;204m@\u001b[0m\u001b[38;2;78;42;213mD\u001b[0m\u001b[38;2;72;32;223m▒\u001b[0m\u001b[38;2;68;24;231m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠\u001b[0m\u001b[38;2;71;30;225m▒\u001b[0m\u001b[38;2;77;40;215m▒\u001b[0m\u001b[38;2;82;49;206mK\u001b[0m\u001b[38;2;87;57;198mφ\u001b[0m\u001b[38;2;91;65;190m╗\u001b[0m\u001b[38;2;97;75;180m╦\u001b[0m\u001b[38;2;103;84;171m╖\u001b[0m\u001b[38;2;107;92;163m²\u001b[0m\u001b[38;2;112;101;154m_\u001b[0m\u001b[38;2;119;112;143m_\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;106;91;164m\\`\u001b[0m\u001b[38;2;94;70;185m^\u001b[0m\u001b[38;2;89;62;193m╙\u001b[0m\u001b[38;2;85;54;201m╙\u001b[0m\u001b[38;2;80;45;210m╚\u001b[0m\u001b[38;2;74;35;220m╝\u001b[0m\u001b[38;2;69;26;229m╠\u001b[0m\u001b[38;2;66;22;233m╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠\u001b[0m\u001b[38;2;73;33;222m╝\u001b[0m\u001b[38;2;79;43;212m╩\u001b[0m\u001b[38;2;84;52;203m╜\u001b[0m\u001b[38;2;88;60;195m╙\u001b[0m\u001b[38;2;93;68;187m^\u001b[0m\u001b[38;2;100;80;175m\\`\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;113;84;152m\\`\u001b[0m\u001b[38;2;103;79;169m'\u001b[0m\u001b[38;2;95;72;183m\"\u001b[0m\u001b[38;2;87;57;198m╙\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠\u001b[0m\u001b[38;2;80;46;209m╜\u001b[0m\u001b[38;2;94;70;185m^\u001b[0m\u001b[38;2;102;77;175m^\u001b[0m\u001b[38;2;112;81;162m\\`\u001b[0m\u001b[38;2;115;92;155m\\`\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;145;116;107m,\u001b[0m\u001b[38;2;199;82;45m╠\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒╠ \u001b[0m\u001b[38;2;70;28;227m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠ \u001b[0m\u001b[38;2;189;49;97må\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠\u001b[0m\u001b[38;2;155;92;114m,\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;175;98;73m╔\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒▒▒\u001b[0m\u001b[38;2;197;83;47m╩ \u001b[0m\u001b[38;2;98;76;179m[\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠\u001b[0m\u001b[38;2;81;48;207mH \u001b[0m\u001b[38;2;188;51;98m╚\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠╠\u001b[0m\u001b[38;2;183;57;100mH\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;146;116;106m,\u001b[0m\u001b[38;2;199;82;44m╠\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;196;84;48m╩\u001b[0m\u001b[38;2;168;102;81m^ \u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠ \u001b[0m\u001b[38;2;160;87;111m'\u001b[0m\u001b[38;2;187;52;98m╚\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠\u001b[0m\u001b[38;2;156;91;113m,\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;198;83;46m╩\u001b[0m\u001b[38;2;194;85;50m╩\u001b[0m\u001b[38;2;167;102;82m^ \u001b[0m\u001b[38;2;81;46;209m╚\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠ \u001b[0m\u001b[38;2;159;88;112m'\u001b[0m\u001b[38;2;186;53;98m╚\u001b[0m\u001b[38;2;197;40;93m╩\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;110;97;158m'\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;94;69;186mH\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;68;25;230m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;108;93;162m²\u001b[0m\u001b[38;2;99;79;176m^\u001b[0m`\n","import type { Logger, LogLevelValue } from '@xylabs/sdk-js'\nimport {\n Base,\n ConsoleLogger, isDefined,\n LogLevel, SilentLogger,\n} from '@xylabs/sdk-js'\nimport type { Config } from '@xyo-network/xl1-sdk'\n\nexport const initLogger = (config: Config): Logger => {\n let logger: Logger\n if (config.log.silent) {\n logger = new SilentLogger()\n } else {\n let level: LogLevelValue | undefined\n if (isDefined(config.log.logLevel)) {\n const parsed = LogLevel[config.log.logLevel.toLowerCase() as keyof typeof LogLevel]\n if (isDefined(parsed)) level = parsed\n }\n logger = new ConsoleLogger(level)\n }\n Base.defaultLogger = logger\n return logger\n}\n","import type { Logger, Promisable } from '@xylabs/sdk-js'\nimport {\n asAddress, assertEx, isDefined, isString,\n} from '@xylabs/sdk-js'\nimport {\n initApiWallet,\n initBalanceSummaryMap,\n initEvmProvidersIfAvailable, initFinalizationArchivistIfNeeded, initProducerAccount, initServerNode, initStatusReporter,\n initTransferSummaryMap,\n} from '@xyo-network/chain-orchestration'\nimport { SimpleBlockRunner } from '@xyo-network/chain-services'\nimport { initTelemetry } from '@xyo-network/chain-telemetry'\nimport { validateHydratedBlock, validateHydratedBlockState } from '@xyo-network/chain-validation'\nimport { HDWallet } from '@xyo-network/wallet'\nimport type {\n Config, CreatableProviderContext, ProviderFactoryLocatorInstance,\n RpcSchemaMap,\n TransportFactory,\n} from '@xyo-network/xl1-sdk'\nimport {\n AccountBalanceViewerRpcSchemas,\n ADDRESS_INDEX,\n BlockViewerRpcSchemas,\n FinalizationViewerRpcSchemas,\n generateXyoBaseWalletFromPhrase,\n HttpRpcTransport,\n JsonRpcAccountBalanceViewer,\n JsonRpcBlockViewer,\n JsonRpcFinalizationViewer,\n JsonRpcMempoolRunner,\n JsonRpcMempoolViewer,\n MempoolRunnerRpcSchemas,\n MempoolViewerRpcSchemas,\n ProviderFactoryLocator, SimpleAccountBalanceViewer, SimpleBlockRewardViewer, SimpleBlockValidationViewer,\n SimpleBlockViewer,\n SimpleFinalizationViewer,\n SimpleMempoolRunner,\n SimpleMempoolViewer,\n SimpleNetworkStakeViewer,\n SimpleStepRewardsByPositionViewer,\n SimpleStepRewardsByStakerViewer,\n SimpleStepRewardsByStepViewer,\n SimpleStepRewardsTotalViewer,\n SimpleStepRewardsViewer,\n SimpleStepViewer,\n SimpleTimeSyncViewer,\n SimpleWindowedBlockViewer,\n SimpleXyoConnectionRunner,\n SimpleXyoConnectionViewer,\n SimpleXyoGatewayRunner,\n SimpleXyoRunner,\n SimpleXyoSigner,\n SimpleXyoViewer,\n XyoRunnerMoniker,\n} from '@xyo-network/xl1-sdk'\n\nexport async function telemetryContextFromConfig(config: Config, serviceName: string, serviceVersion: string) {\n const { otlpEndpoint } = config.telemetry?.otel ?? {}\n const { path: endpoint = '/metrics', port: port = 9466 } = config.telemetry?.metrics?.scrape ?? {}\n return await initTelemetry({\n attributes: {\n serviceName,\n serviceVersion,\n },\n otlpEndpoint,\n metricsConfig: { endpoint, port },\n })\n}\n\nexport async function contextFromConfigWithoutLocator(\n config: Config,\n logger: Logger,\n serviceName: string,\n serviceVersion: string,\n): Promise<Omit<CreatableProviderContext, 'locator'>> {\n const singletons = {}\n const caches = {}\n const telemetryConfig = await telemetryContextFromConfig(config, serviceName, serviceVersion)\n const statusReporter = initStatusReporter({ logger })\n return {\n ...telemetryConfig,\n config,\n singletons,\n caches,\n logger,\n statusReporter,\n }\n}\n\nexport async function rootLocatorFromConfig(\n config: Config,\n context: Omit<CreatableProviderContext, 'locator'>,\n): Promise<ProviderFactoryLocatorInstance> {\n let locator: ProviderFactoryLocatorInstance = new ProviderFactoryLocator(context)\n\n locator.registerMany([\n SimpleNetworkStakeViewer.factory<SimpleNetworkStakeViewer>(SimpleNetworkStakeViewer.dependencies, {}),\n SimpleTimeSyncViewer.factory<SimpleTimeSyncViewer>(SimpleTimeSyncViewer.dependencies, {}),\n SimpleStepViewer.factory<SimpleStepViewer>(SimpleStepViewer.dependencies, {}),\n SimpleStepRewardsViewer.factory<SimpleStepRewardsViewer>(SimpleStepRewardsViewer.dependencies, {}),\n SimpleStepRewardsByPositionViewer.factory<SimpleStepRewardsByPositionViewer>(SimpleStepRewardsByPositionViewer.dependencies, {}),\n SimpleStepRewardsByStakerViewer.factory<SimpleStepRewardsByStakerViewer>(SimpleStepRewardsByStakerViewer.dependencies, {}),\n SimpleStepRewardsByStepViewer.factory<SimpleStepRewardsByStepViewer>(SimpleStepRewardsByStepViewer.dependencies, {}),\n SimpleStepRewardsTotalViewer.factory<SimpleStepRewardsTotalViewer>(SimpleStepRewardsTotalViewer.dependencies, {}),\n SimpleBlockValidationViewer.factory<SimpleBlockValidationViewer>(\n SimpleBlockValidationViewer.dependencies,\n { state: validateHydratedBlockState, protocol: validateHydratedBlock },\n ),\n ])\n locator = await initEvmProvidersIfAvailable(locator)\n locator = await (isString(config.remote.rpc?.url)\n ? remoteLocatorFromConfig(config, { ...context, locator })\n : localLocatorFromConfig(config, { ...context, locator }))\n locator.freeze()\n return locator\n}\n\nexport async function localLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<ProviderFactoryLocatorInstance> {\n const balancesSummaryMap = assertEx(await initBalanceSummaryMap(context), () => 'Balance Summary Map not initialized')\n const transfersSummaryMap = assertEx(await initTransferSummaryMap(context), () => 'Transfer Summary Map not initialized')\n\n // TODO: this should not be an api wallet, but a server wallet\n const wallet = await initApiWallet(context)\n\n const {\n writableChainArchivist, readonlyChainArchivist, pendingTransactionsArchivist, pendingBlocksArchivist,\n } = await initServerNode({\n ...context,\n wallet,\n transfersSummaryMap,\n balancesSummaryMap,\n })\n\n await initFinalizationArchivistIfNeeded(writableChainArchivist, config, wallet)\n\n const locator = new ProviderFactoryLocator(context)\n locator.registerMany([\n SimpleMempoolViewer.factory<SimpleMempoolViewer>(SimpleMempoolViewer.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleMempoolRunner.factory<SimpleMempoolRunner>(SimpleMempoolRunner.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleAccountBalanceViewer.factory<SimpleAccountBalanceViewer>(SimpleAccountBalanceViewer.dependencies, { balancesSummaryMap, transfersSummaryMap }),\n SimpleFinalizationViewer.factory<SimpleFinalizationViewer>(SimpleFinalizationViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleBlockViewer.factory<SimpleBlockViewer>(SimpleBlockViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleWindowedBlockViewer.factory<SimpleWindowedBlockViewer>(SimpleWindowedBlockViewer.dependencies, { maxWindowSize: 10_000, syncInterval: 10_000 }),\n SimpleXyoConnectionViewer.factory<SimpleXyoConnectionViewer>(SimpleXyoConnectionViewer.dependencies, {}),\n SimpleXyoViewer.factory<SimpleXyoViewer>(SimpleXyoViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n ])\n locator.freeze()\n return locator\n}\n\nexport async function remoteLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<ProviderFactoryLocatorInstance> {\n const balancesSummaryMap = assertEx(await initBalanceSummaryMap(context), () => 'Balance Summary Map not initialized')\n const transfersSummaryMap = assertEx(await initTransferSummaryMap(context), () => 'Transfer Summary Map not initialized')\n\n // TODO: this should not be an api wallet, but a server wallet\n const wallet = await initApiWallet(context)\n\n const {\n readonlyChainArchivist, pendingTransactionsArchivist, pendingBlocksArchivist,\n } = await initServerNode({\n ...context,\n wallet,\n transfersSummaryMap,\n balancesSummaryMap,\n })\n\n const locator = new ProviderFactoryLocator(context)\n locator.registerMany([\n SimpleMempoolViewer.factory<SimpleMempoolViewer>(SimpleMempoolViewer.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleMempoolRunner.factory<SimpleMempoolRunner>(SimpleMempoolRunner.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleAccountBalanceViewer.factory<SimpleAccountBalanceViewer>(SimpleAccountBalanceViewer.dependencies, { balancesSummaryMap, transfersSummaryMap }),\n SimpleFinalizationViewer.factory<SimpleFinalizationViewer>(SimpleFinalizationViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleBlockViewer.factory<SimpleBlockViewer>(SimpleBlockViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleWindowedBlockViewer.factory<SimpleWindowedBlockViewer>(SimpleWindowedBlockViewer.dependencies, { maxWindowSize: 10_000, syncInterval: 10_000 }),\n SimpleXyoViewer.factory<SimpleXyoViewer>(SimpleXyoViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n ])\n locator.freeze()\n return locator\n}\n\nexport async function producerLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<ProviderFactoryLocatorInstance> {\n const { logger } = context\n const account = await initProducerAccount({ config })\n const locator = new ProviderFactoryLocator(context)\n const rewardAddress = asAddress(config.actors.producer.rewardAddress ?? account.address, true)\n logger?.info(`Using reward address ${rewardAddress}`)\n if (rewardAddress === account.address) {\n logger?.warn(`Using producer account address as reward address: ${account.address}`)\n }\n\n const remoteUrl = config.remote.rpc?.url\n\n if (isString(remoteUrl)) {\n const transportFactory: TransportFactory = (schemas: RpcSchemaMap) => new HttpRpcTransport(remoteUrl, schemas)\n\n locator.registerMany([\n JsonRpcMempoolViewer.factory<JsonRpcMempoolViewer>(JsonRpcMempoolViewer.dependencies, { transport: await transportFactory(MempoolViewerRpcSchemas) }),\n JsonRpcMempoolRunner.factory<JsonRpcMempoolRunner>(JsonRpcMempoolRunner.dependencies, { transport: await transportFactory(MempoolRunnerRpcSchemas) }),\n JsonRpcAccountBalanceViewer.factory<JsonRpcAccountBalanceViewer>(\n JsonRpcAccountBalanceViewer.dependencies,\n { transport: await transportFactory(AccountBalanceViewerRpcSchemas) },\n ),\n JsonRpcFinalizationViewer.factory<JsonRpcFinalizationViewer>(\n JsonRpcFinalizationViewer.dependencies,\n { transport: await transportFactory(FinalizationViewerRpcSchemas) },\n ),\n JsonRpcBlockViewer.factory<JsonRpcBlockViewer>(JsonRpcBlockViewer.dependencies, { transport: await transportFactory(BlockViewerRpcSchemas) }),\n ])\n }\n\n locator.registerMany([\n SimpleBlockRewardViewer.factory<SimpleBlockRewardViewer>(SimpleBlockRewardViewer.dependencies, {}),\n SimpleBlockRunner.factory<SimpleBlockRunner>(\n SimpleBlockRunner.dependencies,\n { account, rewardAddress },\n )])\n locator.freeze()\n return locator\n}\n\nexport function apiLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promisable<ProviderFactoryLocatorInstance> {\n const locator = new ProviderFactoryLocator(context)\n\n locator.registerMany([\n ])\n locator.freeze()\n return locator\n}\n\nexport function mempoolLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promisable<ProviderFactoryLocatorInstance> {\n const locator = new ProviderFactoryLocator(context)\n\n locator.registerMany([\n ])\n locator.freeze()\n return locator\n}\n\nexport async function bridgeLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<Promise<Promisable<ProviderFactoryLocatorInstance>>> {\n const locator = new ProviderFactoryLocator(context)\n\n const { mnemonic } = config.actors.bridge\n const walletPhrase = isDefined(mnemonic) ? mnemonic : HDWallet.generateMnemonic()\n const wallet = await generateXyoBaseWalletFromPhrase(walletPhrase)\n const signerAccount = await wallet.derivePath(ADDRESS_INDEX.XYO)\n\n const remoteUrl = config.actors.bridge.remote.rpc?.url\n\n if (isString(remoteUrl)) {\n const transportFactory: TransportFactory = (schemas: RpcSchemaMap) => new HttpRpcTransport(remoteUrl, schemas)\n\n locator.registerMany([\n JsonRpcMempoolViewer.factory<JsonRpcMempoolViewer>(JsonRpcMempoolViewer.dependencies, { transport: await transportFactory(MempoolViewerRpcSchemas) }),\n JsonRpcMempoolRunner.factory<JsonRpcMempoolRunner>(JsonRpcMempoolRunner.dependencies, { transport: await transportFactory(MempoolRunnerRpcSchemas) }),\n JsonRpcAccountBalanceViewer.factory<JsonRpcAccountBalanceViewer>(\n JsonRpcAccountBalanceViewer.dependencies,\n { transport: await transportFactory(AccountBalanceViewerRpcSchemas) },\n ),\n JsonRpcFinalizationViewer.factory<JsonRpcFinalizationViewer>(\n JsonRpcFinalizationViewer.dependencies,\n { transport: await transportFactory(FinalizationViewerRpcSchemas) },\n ),\n JsonRpcBlockViewer.factory<JsonRpcBlockViewer>(JsonRpcBlockViewer.dependencies, { transport: await transportFactory(BlockViewerRpcSchemas) }),\n ])\n }\n\n locator.registerMany([\n SimpleXyoSigner.factory<SimpleXyoSigner>(SimpleXyoSigner.dependencies, { account: signerAccount }),\n SimpleXyoRunner.factory<SimpleXyoRunner>(SimpleXyoRunner.dependencies, {}),\n SimpleXyoConnectionRunner.factory<SimpleXyoConnectionRunner>(SimpleXyoConnectionRunner.dependencies, {}),\n SimpleXyoGatewayRunner.factory<SimpleXyoGatewayRunner>(SimpleXyoGatewayRunner.dependencies, {}),\n ])\n locator.freeze()\n return locator\n}\n\nexport function rewardRedemptionLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promisable<ProviderFactoryLocatorInstance> {\n const locator = new ProviderFactoryLocator(context)\n\n locator.registerMany([\n SimpleXyoGatewayRunner.factory<SimpleXyoGatewayRunner>(SimpleXyoGatewayRunner.dependencies, {}),\n ])\n locator.freeze()\n return locator\n}\n\nexport async function locatorsFromConfig(\n actors: string[],\n config: Config,\n context: Omit<CreatableProviderContext, 'locator'>,\n): Promise<Record<string, ProviderFactoryLocatorInstance>> {\n const result: Record<string, ProviderFactoryLocatorInstance> = { _root: await rootLocatorFromConfig(config, context) }\n const producer = actors.includes('producer') ? await producerLocatorFromConfig(config, result._root.context) : undefined\n if (producer) {\n result.producer = producer\n }\n const api = actors.includes('api') ? await apiLocatorFromConfig(config, result._root.context) : undefined\n if (api) {\n result.api = api\n }\n const mempool = actors.includes('mempool') ? await mempoolLocatorFromConfig(config, result._root.context) : undefined\n if (mempool) {\n result.mempool = mempool\n }\n const bridge = actors.includes('bridge') ? await bridgeLocatorFromConfig(config, result._root.context) : undefined\n if (bridge) {\n result.bridge = bridge\n }\n const rewardRedemption = actors.includes('rewardRedemption') ? await rewardRedemptionLocatorFromConfig(config, result._root.context) : undefined\n if (rewardRedemption) {\n result.rewardRedemption = rewardRedemption\n }\n return result\n}\n","import type { UsageMeta } from '@xyo-network/xl1-sdk'\nimport { isUsageMeta } from '@xyo-network/xl1-sdk'\nimport type { Options } from 'yargs'\nimport { globalRegistry } from 'zod'\n\nconst usageMetaToOptions = (meta: UsageMeta): Options => {\n return meta\n}\n\nexport const optionsFromGlobalZodRegistry = (): Record<string, Options> => {\n const opts: Record<string, Options> = {}\n for (const schema of Object.values(globalRegistry._map)) {\n if (isUsageMeta(schema)) {\n if (schema.hidden) continue // skip hidden options\n opts[schema.title] = usageMetaToOptions(schema)\n }\n }\n return opts\n}\n","import { isDefined, isNull } from '@xylabs/sdk-js'\nimport { ConfigZod } from '@xyo-network/xl1-sdk'\nimport { cosmiconfigSync } from 'cosmiconfig'\n\n/**\n * The name of the configuration file to search for.\n */\nconst configName = 'xyo'\n\n/**\n * The name of the section within the configuration file to parse.\n */\nconst configSection = 'xl1' // Default section in the config file\n\n/**\n * Attempts to parse the configuration from a file using cosmiconfig.\n * @returns The parsed configuration object if found and valid, otherwise undefined.\n */\nexport const tryParseConfig = () => {\n const explorer = cosmiconfigSync(\n configName,\n /* {\n searchPlaces: [\n 'package.json', // Looks under `xyo` key in package.json\n '.xyorc.json', // Supports common dotfile format\n 'xyo.config.json', // Supports custom-named config file\n ],\n loaders: {\n '.json': defaultLoaders['.json'],\n 'noExt': defaultLoaders['.json'],\n },\n }, */\n )\n const result = explorer.search()\n if (!isNull(result)) {\n const section = result?.config?.[configSection]\n if (isDefined(section) && typeof section === 'object') {\n return ConfigZod.parse(section)\n }\n }\n return ConfigZod.parse({})\n}\n","import net from 'node:net'\n\nexport const waitForHostPort = (host: string, port: number): Promise<void> => {\n return new Promise((resolve) => {\n const tryConnect = () => {\n const socket = new net.Socket()\n\n socket\n .setTimeout(1000)\n .once('error', () => {\n socket.destroy()\n setTimeout(tryConnect, 500) // retry after 500ms\n })\n .once('timeout', () => {\n socket.destroy()\n setTimeout(tryConnect, 500)\n })\n .connect(port, host, () => {\n socket.end()\n resolve()\n })\n }\n\n tryConnect()\n })\n}\n","import { 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,SACEC,WAAWC,aAAAA,YAAWC,iBACjB;AACP,SAASC,cAAc;AACvB,SAASC,kBAAkB;AAC3B,SAASC,oBAAoB;AAC7B,SAASC,mBAAmB;AAE5B,SAASC,aAAAA,YAAWC,kBAAkB;AAEtC,OAAOC,WAAW;AAClB,SAASC,eAAe;;;ACZxB,SAASC,cAAc;AACvB,SAASC,mBAAmB;AAC5B,SAASC,wBAAmD;AAMrD,IAAMC,YAAY,8BACvBC,SACAC,cACAC,YAAAA;AAEA,QAAMC,UAAU,MAAMC,iBAAiB;IAAEJ,QAAAA;IAAQK,QAAQH,QAAQI,QAAQD;EAAO,CAAA;AAEhF,QAAME,MAAM,MAAMC,YAAYC,OAAO;IACnCN;IAASH,QAAAA;IAAQE;EACnB,CAAA;AACA,QAAMQ,SAAS;IAACH;IAAKI,OAAOC,MAAAA;AAE5B,aAAWC,SAASH,QAAQ;AAE1B,UAAMT,aAAaa,cAAcD,KAAAA;EACnC;AAEA,QAAMZ,aAAac,MAAK;AAC1B,GAlByB;;;ACRzB,SAASC,UAAAA,eAAc;AAEvB,SAASC,sCAAsC;AAC/C,SAASC,6BAA6B;AAGtC,eAAsBC,uBACpBC,SACAC,cACAC,SAAuC;AAEvC,QAAMC,UAAU,MAAMC,+BAA+B;IAAEJ,QAAAA;IAAQK,QAAQH,QAAQI,QAAQD;EAAO,CAAA;AAE9F,QAAME,mBAAmB,MAAMC,s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Q,GAAA,EACdpE,QAAQA,OAAAA,EACRc;AAEH,QAAMA;AACR;AAhJsBJ;;;ADzFf,IAAM2D,QAAQ,mCAAA;AACnBC,SAAO;IAAEC,OAAO;EAAK,CAAA;AACrB,QAAMC,OAAAA;AACR,GAHqB;;;AUFrBC,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","toAddress","runApi","runMempool","Orchestrator","runProducer","ConfigZod","isZodError","yargs","hideBin","exists","BridgeActor","initBridgeWallet","runBridge","config","orchestrator","locator","account","initBridgeWallet","logger","context","api","BridgeActor","create","actors","filter","exists","actor","registerActor","start","exists","initRewardsRedemptionApiWallet","RewardRedemptionActor","runRewardRedemptionApi","config","orchestrator","locator","account","initRewardsRedemptionApiWallet","logger","context","rewardRedemption","RewardRedemptionActor","create","actors","filter","exists","actor","registerActor","start","XL1LogoColorizedAscii","Base","ConsoleLogger","isDefined","LogLevel","SilentLogger","initLogger","config","logger","log","silent","SilentLogger","level","isDefined","logLevel","parsed","LogLevel","toLowerCase","ConsoleLogger","Base","defaultLogger","asAddress","assertEx","isDefined","isString","initApiWallet","initBalanceSummaryMap","initEvmProvidersIfAvailable","initFinalizationArchivistIfNeeded","initProducerAccount","initServerNode","initStatusReporter","initTransferSummaryMap","SimpleBlockRunner","initTelemetry","validateHydratedBlock","validateHydratedBlockState","HDWallet","AccountBalanceViewerRpcSchemas","ADDRESS_INDEX","BlockViewerRpcSchemas","FinalizationViewerRpcSchemas","generateXyoBaseWalletFromPhrase","HttpRpcTransport","JsonRpcAccountBalanceViewer","JsonRpcBlockViewer","JsonRpcFinalizationViewer","JsonRpcMempoolRunner","JsonRpcMempoolViewer","MempoolRunnerRpcSchemas","MempoolViewerRpcSchemas","ProviderFactoryLocator","SimpleAccountBalanceViewer","SimpleBlockRewardViewer","SimpleBlockValidationViewer","SimpleBlockViewer","SimpleFinalizationViewer","SimpleMempoolRunner","SimpleMempoolViewer","SimpleNetworkStakeViewer","SimpleStepRewardsByPositionViewer","SimpleStepRewardsByStakerViewer","SimpleStepRewardsByStepViewer","SimpleStepRewardsTotalViewer","SimpleStepRewardsViewer","SimpleStepViewer","SimpleTimeSyncViewer","SimpleWindowedBlockViewer","SimpleXyoConnectionRunner","SimpleXyoConnectionViewer","SimpleXyoGatewayRunner","SimpleXyoRunner","SimpleXyoSigner","SimpleXyoViewer","telemetryContextFromConfig","config","serviceName","serviceVersion","otlpEndpoint","telemetry","otel","path","endpoint","port","metrics","scrape","initTelemetry","attributes","metricsConfig","contextFromConfigWithoutLocator","logger","singletons","caches","telemetryConfig","statusReporter","initStatusReporter","rootLocatorFromConfig","context","locator","ProviderFactoryLocator","registerMany","SimpleNetworkStakeViewer","factory","dependencies","SimpleTimeSyncViewer","SimpleStepViewer","SimpleStepRewardsViewer","SimpleStepRewardsByPositionViewer","SimpleStepRewardsByStakerViewer","SimpleStepRewardsByStepViewer","SimpleStepRewardsTotalViewer","SimpleBlockValidationViewer","state","validateHydratedBlockState","protocol","validateHydratedBlock","initEvmProvidersIfAvailable","isString","remote","rpc","url","remoteLocatorFromConfig","localLocatorFromConfig","freeze","balancesSummaryMap","assertEx","initBalanceSummaryMap","transfersSummaryMap","initTransferSummaryMap","wallet","initApiWallet","writableChainArchivist","readonlyChainArchivist","pendingTransactionsArchivist","pendingBlocksArchivist","initServerNode","initFinalizationArchivistIfNeeded","SimpleMempoolViewer","SimpleMempoolRunner","SimpleAccountBalanceViewer","SimpleFinalizationViewer","finalizedArchivist","SimpleBlockViewer","SimpleWindowedBlockViewer","maxWindowSize","syncInterval","SimpleXyoConnectionViewer","SimpleXyoViewer","producerLocatorFromConfig","account","initProducerAccount","rewardAddress","asAddress","actors","producer","address","info","warn","remoteUrl","transportFactory","schemas","HttpRpcTransport","JsonRpcMempoolViewer","transport","MempoolViewerRpcSchemas","JsonRpcMempoolRunner","MempoolRunnerRpcSchemas","JsonRpcAccountBalanceViewer","AccountBalanceViewerRpcSchemas","JsonRpcFinalizationViewer","FinalizationViewerRpcSchemas","JsonRpcBlockViewer","BlockViewerRpcSchemas","SimpleBlockRewardViewer","SimpleBlockRunner","apiLocatorFromConfig","mempoolLocatorFromConfig","bridgeLocatorFromConfig","mnemonic","bridge","walletPhrase","isDefined","HDWallet","generateMnemonic","generateXyoBaseWalletFromPhrase","signerAccount","derivePath","ADDRESS_INDEX","XYO","SimpleXyoSigner","SimpleXyoRunner","SimpleXyoConnectionRunner","SimpleXyoGatewayRunner","rewardRedemptionLocatorFromConfig","locatorsFromConfig","result","_root","includes","undefined","api","mempool","rewardRedemption","isUsageMeta","globalRegistry","usageMetaToOptions","meta","optionsFromGlobalZodRegistry","opts","schema","Object","values","globalRegistry","_map","isUsageMeta","hidden","title","isDefined","isNull","ConfigZod","cosmiconfigSync","configName","configSection","tryParseConfig","explorer","cosmiconfigSync","result","search","isNull","section","config","isDefined","ConfigZod","parse","net","waitForHostPort","host","port","Promise","resolve","tryConnect","socket","net","Socket","setTimeout","once","destroy","connect","end","configuration","version","isDefined","__VERSION__","resolveConfig","config","logger","console","defaultChainId","toAddress","resolved","structuredClone","chain","id","warn","getLocatorsFromConfig","actors","configuration","logger","initLogger","orchestrator","Orchestrator","create","context","contextFromConfigWithoutLocator","version","locators","locatorsFromConfig","process","on","log","stop","exit","err","error","runCLI","y","yargs","hideBin","argv","usage","XL1LogoColorizedAscii","parserConfiguration","env","scriptName","middleware","parsedConfigFile","tryParseConfig","parsedConfigArgs","parseResult","ConfigZod","safeParse","success","mergedConfig","deepMerge","validatedMergedConfigResult","resolvedConfig","resolveConfig","data","validatedConfigResult","rootConfig","actorNames","Object","keys","actorName","console","JSON","stringify","isZodError","message","Error","stack","options","optionsFromGlobalZodRegistry","wrap","terminalWidth","command","runApi","runBridge","runMempool","runProducer","runRewardRedemptionApi","mempool","enabled","push","waitForHostPort","host","port","api","type","description","default","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/bridge/runBridge.ts","../../src/commands/rewardRedemption/runRewardRedemptionApi.ts","../../src/images.ts","../../src/initLogger.ts","../../src/locatorFromConfig.ts","../../src/optionsFromGlobalZodRegistry.ts","../../src/tryParseConfig.ts","../../src/waitForHostPort.ts","../../src/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 {\n deepMerge, isDefined, toAddress,\n} from '@xylabs/sdk-js'\nimport { runApi } from '@xyo-network/chain-api'\nimport { runMempool } from '@xyo-network/chain-mempool'\nimport { Orchestrator } from '@xyo-network/chain-orchestration'\nimport { runProducer } from '@xyo-network/chain-producer'\nimport type { ActorName, Config } from '@xyo-network/xl1-sdk'\nimport { ConfigZod, isZodError } from '@xyo-network/xl1-sdk'\nimport type { Argv } from 'yargs'\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\n\nimport { runBridge, runRewardRedemptionApi } from './commands/index.ts'\nimport { XL1LogoColorizedAscii } from './images.ts'\nimport { initLogger } from './initLogger.ts'\nimport { contextFromConfigWithoutLocator, locatorsFromConfig } from './locatorFromConfig.ts'\nimport { optionsFromGlobalZodRegistry } from './optionsFromGlobalZodRegistry.ts'\nimport { tryParseConfig } from './tryParseConfig.ts'\nimport { waitForHostPort } from './waitForHostPort.ts'\n\ninterface RunCliContext {\n logger: Logger\n orchestrator: Orchestrator\n}\n\n/** Version string injected by Rollup at build time. */\ndeclare const __VERSION__: string\n\n/**\n * The configuration that will be used throughout the CLI.\n * This is materialized after parsing the command-line arguments,\n * environment variables, and defaults.\n */\nlet configuration: Config\n\nconst version = isDefined(__VERSION__) ? __VERSION__ : 'unknown'\n\nfunction resolveConfig(config: Config): Config {\n const logger = console\n const defaultChainId = toAddress('1')\n const resolved = structuredClone(config)\n if (!resolved.chain.id) {\n logger.warn(`No chain ID specified in configuration; defaulting to ${defaultChainId}`)\n resolved.chain.id = defaultChainId\n }\n return resolved\n}\n\nconst getContextFromConfig = async (configuration: Config): Promise<RunCliContext> => {\n const logger = initLogger(configuration)\n const orchestrator = await Orchestrator.create({ logger })\n // Handle cancellation (Ctrl+C)\n process.on('SIGINT', () => {\n void (async () => {\n try {\n logger.log('\\nSIGINT received. Attempting graceful shutdown...')\n await orchestrator?.stop()\n logger.log('Orchestrator stopped, exiting now.')\n process.exit(0)\n } catch (err) {\n logger.error('Error stopping orchestrator:', err)\n process.exit(1)\n }\n })()\n })\n return { logger, orchestrator }\n}\n\nconst getLocatorsFromConfig = async (actors: string[], configuration: Config) => {\n const logger = initLogger(configuration)\n const orchestrator = await Orchestrator.create({ logger })\n const context = await contextFromConfigWithoutLocator(configuration, logger, 'xl1-cli', version)\n const locators = await locatorsFromConfig(actors, configuration, context)\n // Handle cancellation (Ctrl+C)\n process.on('SIGINT', () => {\n void (async () => {\n try {\n logger.log('\\nSIGINT received. Attempting graceful shutdown...')\n await orchestrator?.stop()\n logger.log('Orchestrator stopped, exiting now.')\n process.exit(0)\n } catch (err) {\n logger.error('Error stopping orchestrator:', err)\n process.exit(1)\n }\n })()\n })\n return { locators, orchestrator }\n}\n\n// Main entry point\nexport async function runCLI() {\n // Parse command-line arguments using Yargs\n const y = yargs(hideBin(process.argv)) as Argv<Config>\n const argv = y\n .usage(`\n🚀 XL1 Node CLI (${version})\n${XL1LogoColorizedAscii}\nRun various components of the XL1 ecosystem.\n\nUsage:\n$0 <command> [options]`)\n .parserConfiguration({\n 'dot-notation': true, // foo.bar → { foo: { bar } }\n 'parse-numbers': false, // Don't auto-parse numbers to allow strings like \"0x1\"\n 'populate--': true, // Populate -- with all options so we can detected user-supplied vs defaults\n })\n .env('XL1')\n .scriptName('xl1')\n .middleware((argv) => {\n try {\n // Parse the various config sources\n const parsedConfigFile = tryParseConfig() // Config file\n const parsedConfigArgs = argv // Command-line arguments & ENV VARs\n const parseResult = ConfigZod.safeParse(parsedConfigFile)\n if (!parseResult.success) {\n throw parseResult.error\n }\n // Deep merge with precedence\n // TODO: Would like precedence to be defaults < file < ENV < CLI Args\n // but there is currently no way to determine which are defaults vs\n // user-supplied CLI Args since we set the CLI args to the defaults\n // and receive a flattened object. We might need to manually invoke\n // the parser without the defaults to achieve this.\n // const mergedConfig = deepMerge(parsedConfigArgs, parsedConfigFile)\n const mergedConfig = deepMerge(parsedConfigArgs)\n const validatedMergedConfigResult = ConfigZod.safeParse(mergedConfig)\n if (!validatedMergedConfigResult.success) {\n throw validatedMergedConfigResult.error\n }\n const resolvedConfig = resolveConfig(validatedMergedConfigResult.data)\n // Validate the merged configuration\n const validatedConfigResult = ConfigZod.safeParse(resolvedConfig)\n if (!validatedConfigResult.success) {\n throw validatedConfigResult.error\n }\n configuration = validatedConfigResult.data\n\n const { actors, ...rootConfig } = configuration\n const actorNames = Object.keys(actors) as ActorName[]\n\n for (const actorName of actorNames) {\n configuration.actors[actorName] = deepMerge(\n rootConfig ?? {},\n configuration.actors[actorName] ?? {},\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) as any\n }\n\n // Check if user wants to dump config and exit\n if (argv['dump-config']) {\n console.log(JSON.stringify(configuration, null, 2))\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0)\n }\n } catch (err) {\n if (isZodError(err)) {\n console.error(`Zod error: ${err.message}`)\n } else {\n console.error(`Error parsing configuration: ${err}`)\n }\n console.error(`Stack: ${err instanceof Error ? err.stack : 'N/A'}`)\n throw new Error('Invalid configuration')\n }\n })\n .options(optionsFromGlobalZodRegistry())\n // .commandDir('./command/commands', opts) // Not yet supported for ESM\n .wrap(y.terminalWidth())\n .command('api', 'Run a XL1 API Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 API Node', () => {}, async () => {\n const { locators, orchestrator } = await getLocatorsFromConfig(['api'], configuration)\n await runApi(configuration, orchestrator, locators['api'])\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 { locators, orchestrator } = await getLocatorsFromConfig(['bridge'], configuration)\n await runBridge(configuration, orchestrator, locators['bridge'])\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 { locators, orchestrator } = await getLocatorsFromConfig(['mempool'], configuration)\n await runMempool(configuration, orchestrator, locators['mempool'])\n })\n })\n .command('producer', 'Run a XL1 Producer Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 Producer Node', () => {}, async () => {\n const { locators, orchestrator } = await getLocatorsFromConfig(['producer'], configuration)\n await runProducer(configuration, orchestrator, locators['producer'])\n })\n })\n .command('reward-redemption-api', 'Run a XL1 Rewards Redemption API Node', (yargs) => {\n return yargs\n .command('$0', 'Run a XL1 Rewards Redemption API Node', () => {}, async () => {\n const { locators, orchestrator } = await getLocatorsFromConfig(['rewardRedemption'], configuration)\n await runRewardRedemptionApi(configuration, orchestrator, locators['rewardRedemption'])\n })\n })\n .command('$0', 'Run a full XL1 Node', () => {}, async () => {\n const actors = ['producer', 'api']\n if (configuration.actors.mempool.enabled) {\n actors.push('mempool')\n }\n const { locators, orchestrator } = await getLocatorsFromConfig(['api', 'producer'], configuration)\n if (configuration.actors.mempool.enabled) {\n // Start Mempool but do not block\n await runMempool(configuration, orchestrator, locators['mempool'])\n // Wait for Mempool to be ready\n await waitForHostPort(configuration.actors.mempool.host, configuration.actors.mempool.port)\n }\n // Start API but do not block\n await runApi(configuration, orchestrator, locators['api'])\n // Wait for API to be ready\n await waitForHostPort(configuration.actors.api.host, configuration.actors.api.port)\n // Start Producer and block on it\n await runProducer(configuration, orchestrator, locators['producer'])\n })\n .options({\n 'dump-config': {\n type: 'boolean',\n description: 'Just process the configuration and print the resolved config to stdout, then exit.',\n default: false,\n },\n })\n .help()\n .alias('help', 'h')\n .version(version)\n .argv\n\n await argv\n}\n","import { exists } from '@xylabs/sdk-js'\nimport { BridgeActor } from '@xyo-network/chain-bridge'\nimport { initBridgeWallet, type OrchestratorInstance } from '@xyo-network/chain-orchestration'\nimport type {\n Config,\n ProviderFactoryLocatorInstance,\n} from '@xyo-network/xl1-sdk'\n\nexport const runBridge = async (\n config: Config,\n orchestrator: OrchestratorInstance,\n locator: ProviderFactoryLocatorInstance,\n) => {\n const account = await initBridgeWallet({ config, logger: locator.context.logger })\n // Create actors\n const api = await BridgeActor.create({\n account, config, locator,\n })\n const actors = [api].filter(exists)\n\n for (const actor of actors) {\n // Register the actor with the orchestrator\n await orchestrator.registerActor(actor)\n }\n // Start the orchestrator => automatically activates the actor\n await orchestrator.start()\n}\n","import { exists } from '@xylabs/sdk-js'\nimport type { OrchestratorInstance } from '@xyo-network/chain-orchestration'\nimport { initRewardsRedemptionApiWallet } from '@xyo-network/chain-orchestration'\nimport { RewardRedemptionActor } from '@xyo-network/chain-reward-redemption'\nimport type { Config, ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk'\n\nexport async function runRewardRedemptionApi(\n config: Config,\n orchestrator: OrchestratorInstance,\n locator: ProviderFactoryLocatorInstance,\n) {\n const account = await initRewardsRedemptionApiWallet({ config, logger: locator.context.logger })\n // Create actors\n const rewardRedemption = await RewardRedemptionActor.create({\n account, config, locator,\n })\n const actors = [rewardRedemption].filter(exists)\n\n for (const actor of actors) {\n // Register the actor with the orchestrator\n await orchestrator.registerActor(actor)\n }\n // Start the orchestrator => automatically activates the actor\n await orchestrator.start()\n}\n","/* eslint-disable @stylistic/max-len */\nexport const XL1LogoColorizedAscii = `\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;118;111;144m_\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;72;32;223m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\n\u001b[38;2;128;128;128m ╠╠\u001b[0m\u001b[38;2;103;85;170m_\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;79;121;152m╦\u001b[0m\u001b[38;2;82;121;151m╦\u001b[0m\u001b[38;2;112;125;136m_ \u001b[0m\u001b[38;2;88;59;196m[\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;73;34;221m▒ \u001b[0m\u001b[38;2;121;121;127m_\u001b[0m\u001b[38;2;100;101;128m╔\u001b[0m\u001b[38;2;93;94;127m╦\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;82;121;151m²\u001b[0m\u001b[38;2;44;116;170m╠\u001b[0m\u001b[38;2;44;116;171m▒\u001b[0m\u001b[38;2;51;117;167mD\u001b[0m\u001b[38;2;80;121;152m╦\u001b[0m\u001b[38;2;111;125;136m_ \u001b[0m\u001b[38;2;67;23;232m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠ \u001b[0m\u001b[38;2;120;121;128m_\u001b[0m\u001b[38;2;100;101;127m╔\u001b[0m\u001b[38;2;79;81;127mR\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;88;90;127m╙\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;55;117;165m╚\u001b[0m\u001b[38;2;44;116;171m▒\u001b[0m\u001b[38;2;44;116;171m▒▒\u001b[0m\u001b[38;2;50;116;167mD\u001b[0m\u001b[38;2;80;121;152m╦ \u001b[0m\u001b[38;2;106;90;165mj\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠\u001b[0m\u001b[38;2;89;61;194mH \u001b[0m\u001b[38;2;99;100;127m╔\u001b[0m\u001b[38;2;79;80;127mD\u001b[0m\u001b[38;2;71;73;128m▒\u001b[0m\u001b[38;2;71;73;128m▒▒╠\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;83;121;150m²\u001b[0m\u001b[38;2;44;116;170m▒\u001b[0m\u001b[38;2;44;116;171m▒▒▒ \u001b[0m\u001b[38;2;76;38;217m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠ \u001b[0m\u001b[38;2;74;76;128m╠\u001b[0m\u001b[38;2;71;73;128m▒▒▒\u001b[0m\u001b[38;2;89;90;128m╙\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;90;118;148m\\`\u001b[0m\u001b[38;2;89;107;153m_\u001b[0m\u001b[38;2;93;97;154m,\u001b[0m\u001b[38;2;105;89;166m╓\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠\u001b[0m\u001b[38;2;95;72;183m╓\u001b[0m\u001b[38;2;106;96;152m_\u001b[0m\u001b[38;2;100;94;143m\\`\u001b[0m\u001b[38;2;101;100;133m\\`\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;122;118;137m_\u001b[0m\u001b[38;2;113;102;153m,\u001b[0m\u001b[38;2;108;94;161m╓\u001b[0m\u001b[38;2;104;86;169m╓\u001b[0m\u001b[38;2;98;77;178m╔\u001b[0m\u001b[38;2;93;67;188m╗\u001b[0m\u001b[38;2;88;59;196mφ\u001b[0m\u001b[38;2;83;51;204m@\u001b[0m\u001b[38;2;78;42;213mD\u001b[0m\u001b[38;2;72;32;223m▒\u001b[0m\u001b[38;2;68;24;231m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠\u001b[0m\u001b[38;2;71;30;225m▒\u001b[0m\u001b[38;2;77;40;215m▒\u001b[0m\u001b[38;2;82;49;206mK\u001b[0m\u001b[38;2;87;57;198mφ\u001b[0m\u001b[38;2;91;65;190m╗\u001b[0m\u001b[38;2;97;75;180m╦\u001b[0m\u001b[38;2;103;84;171m╖\u001b[0m\u001b[38;2;107;92;163m²\u001b[0m\u001b[38;2;112;101;154m_\u001b[0m\u001b[38;2;119;112;143m_\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;106;91;164m\\`\u001b[0m\u001b[38;2;94;70;185m^\u001b[0m\u001b[38;2;89;62;193m╙\u001b[0m\u001b[38;2;85;54;201m╙\u001b[0m\u001b[38;2;80;45;210m╚\u001b[0m\u001b[38;2;74;35;220m╝\u001b[0m\u001b[38;2;69;26;229m╠\u001b[0m\u001b[38;2;66;22;233m╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠\u001b[0m\u001b[38;2;73;33;222m╝\u001b[0m\u001b[38;2;79;43;212m╩\u001b[0m\u001b[38;2;84;52;203m╜\u001b[0m\u001b[38;2;88;60;195m╙\u001b[0m\u001b[38;2;93;68;187m^\u001b[0m\u001b[38;2;100;80;175m\\`\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;113;84;152m\\`\u001b[0m\u001b[38;2;103;79;169m'\u001b[0m\u001b[38;2;95;72;183m\"\u001b[0m\u001b[38;2;87;57;198m╙\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠╠\u001b[0m\u001b[38;2;80;46;209m╜\u001b[0m\u001b[38;2;94;70;185m^\u001b[0m\u001b[38;2;102;77;175m^\u001b[0m\u001b[38;2;112;81;162m\\`\u001b[0m\u001b[38;2;115;92;155m\\`\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;145;116;107m,\u001b[0m\u001b[38;2;199;82;45m╠\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒╠ \u001b[0m\u001b[38;2;70;28;227m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠╠ \u001b[0m\u001b[38;2;189;49;97må\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠\u001b[0m\u001b[38;2;155;92;114m,\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;175;98;73m╔\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒▒▒\u001b[0m\u001b[38;2;197;83;47m╩ \u001b[0m\u001b[38;2;98;76;179m[\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠\u001b[0m\u001b[38;2;81;48;207mH \u001b[0m\u001b[38;2;188;51;98m╚\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠╠\u001b[0m\u001b[38;2;183;57;100mH\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;146;116;106m,\u001b[0m\u001b[38;2;199;82;44m╠\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;207;77;35m▒\u001b[0m\u001b[38;2;196;84;48m╩\u001b[0m\u001b[38;2;168;102;81m^ \u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠╠ \u001b[0m\u001b[38;2;160;87;111m'\u001b[0m\u001b[38;2;187;52;98m╚\u001b[0m\u001b[38;2;203;32;90m╠\u001b[0m\u001b[38;2;203;32;90m╠╠\u001b[0m\u001b[38;2;156;91;113m,\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;198;83;46m╩\u001b[0m\u001b[38;2;194;85;50m╩\u001b[0m\u001b[38;2;167;102;82m^ \u001b[0m\u001b[38;2;81;46;209m╚\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠╠ \u001b[0m\u001b[38;2;159;88;112m'\u001b[0m\u001b[38;2;186;53;98m╚\u001b[0m\u001b[38;2;197;40;93m╩\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;110;97;158m'\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\u001b[38;2;94;69;186mH\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;68;25;230m╠\u001b[0m\u001b[38;2;66;21;234m╠\u001b[0m\n\u001b[38;2;128;128;128m \u001b[0m\u001b[38;2;108;93;162m²\u001b[0m\u001b[38;2;99;79;176m^\u001b[0m`\n","import type { Logger, LogLevelValue } from '@xylabs/sdk-js'\nimport {\n Base,\n ConsoleLogger, isDefined,\n LogLevel, SilentLogger,\n} from '@xylabs/sdk-js'\nimport type { Config } from '@xyo-network/xl1-sdk'\n\nexport const initLogger = (config: Config): Logger => {\n let logger: Logger\n if (config.log.silent) {\n logger = new SilentLogger()\n } else {\n let level: LogLevelValue | undefined\n if (isDefined(config.log.logLevel)) {\n const parsed = LogLevel[config.log.logLevel.toLowerCase() as keyof typeof LogLevel]\n if (isDefined(parsed)) level = parsed\n }\n logger = new ConsoleLogger(level)\n }\n Base.defaultLogger = logger\n return logger\n}\n","import type { Logger, Promisable } from '@xylabs/sdk-js'\nimport {\n asAddress, assertEx, isDefined, isString,\n} from '@xylabs/sdk-js'\nimport {\n initApiWallet, initBalanceSummaryMap, initEvmProvidersIfAvailable, initFinalizationArchivistIfNeeded, initProducerAccount, initServerNode,\n initStatusReporter, initTransferSummaryMap,\n} from '@xyo-network/chain-orchestration'\nimport { SimpleBlockRunner } from '@xyo-network/chain-services'\nimport { initTelemetry } from '@xyo-network/chain-telemetry'\nimport { validateHydratedBlock, validateHydratedBlockState } from '@xyo-network/chain-validation'\nimport { HDWallet } from '@xyo-network/wallet'\nimport type {\n Config, CreatableProviderContext, ProviderFactoryLocatorInstance, RpcSchemaMap, TransportFactory,\n} from '@xyo-network/xl1-sdk'\nimport {\n AccountBalanceViewerRpcSchemas,\n ADDRESS_INDEX,\n BlockViewerRpcSchemas,\n FinalizationViewerRpcSchemas,\n generateXyoBaseWalletFromPhrase,\n HttpRpcTransport,\n JsonRpcAccountBalanceViewer,\n JsonRpcBlockViewer,\n JsonRpcFinalizationViewer,\n JsonRpcMempoolRunner,\n JsonRpcMempoolViewer,\n MempoolRunnerRpcSchemas,\n MempoolViewerRpcSchemas,\n ProviderFactoryLocator,\n SimpleAccountBalanceViewer,\n SimpleBlockRewardViewer,\n SimpleBlockValidationViewer,\n SimpleBlockViewer,\n SimpleFinalizationRunner,\n SimpleFinalizationViewer,\n SimpleMempoolRunner,\n SimpleMempoolViewer,\n SimpleNetworkStakeViewer,\n SimpleStepRewardsByPositionViewer,\n SimpleStepRewardsByStakerViewer,\n SimpleStepRewardsByStepViewer,\n SimpleStepRewardsTotalViewer,\n SimpleStepRewardsViewer,\n SimpleStepViewer,\n SimpleTimeSyncViewer,\n SimpleWindowedBlockViewer,\n SimpleXyoConnectionRunner,\n SimpleXyoConnectionViewer,\n SimpleXyoGateway,\n SimpleXyoGatewayRunner,\n SimpleXyoRunner,\n SimpleXyoSigner,\n SimpleXyoViewer,\n} from '@xyo-network/xl1-sdk'\n\nexport async function telemetryContextFromConfig(config: Config, serviceName: string, serviceVersion: string) {\n const { otlpEndpoint } = config.telemetry?.otel ?? {}\n const { path: endpoint = '/metrics', port: port = 9466 } = config.telemetry?.metrics?.scrape ?? {}\n return await initTelemetry({\n attributes: {\n serviceName,\n serviceVersion,\n },\n otlpEndpoint,\n metricsConfig: { endpoint, port },\n })\n}\n\nexport async function contextFromConfigWithoutLocator(\n config: Config,\n logger: Logger,\n serviceName: string,\n serviceVersion: string,\n): Promise<Omit<CreatableProviderContext, 'locator'>> {\n const singletons = {}\n const caches = {}\n const telemetryConfig = await telemetryContextFromConfig(config, serviceName, serviceVersion)\n const statusReporter = initStatusReporter({ logger })\n return {\n ...telemetryConfig,\n config,\n singletons,\n caches,\n logger,\n statusReporter,\n }\n}\n\nexport async function rootLocatorFromConfig(\n config: Config,\n context: Omit<CreatableProviderContext, 'locator'>,\n): Promise<ProviderFactoryLocatorInstance> {\n let locator: ProviderFactoryLocatorInstance = new ProviderFactoryLocator(context)\n\n locator.registerMany([\n SimpleNetworkStakeViewer.factory<SimpleNetworkStakeViewer>(SimpleNetworkStakeViewer.dependencies, {}),\n SimpleTimeSyncViewer.factory<SimpleTimeSyncViewer>(SimpleTimeSyncViewer.dependencies, {}),\n SimpleStepViewer.factory<SimpleStepViewer>(SimpleStepViewer.dependencies, {}),\n SimpleStepRewardsViewer.factory<SimpleStepRewardsViewer>(SimpleStepRewardsViewer.dependencies, {}),\n SimpleStepRewardsByPositionViewer.factory<SimpleStepRewardsByPositionViewer>(SimpleStepRewardsByPositionViewer.dependencies, {}),\n SimpleStepRewardsByStakerViewer.factory<SimpleStepRewardsByStakerViewer>(SimpleStepRewardsByStakerViewer.dependencies, {}),\n SimpleStepRewardsByStepViewer.factory<SimpleStepRewardsByStepViewer>(SimpleStepRewardsByStepViewer.dependencies, {}),\n SimpleStepRewardsTotalViewer.factory<SimpleStepRewardsTotalViewer>(SimpleStepRewardsTotalViewer.dependencies, {}),\n SimpleBlockValidationViewer.factory<SimpleBlockValidationViewer>(\n SimpleBlockValidationViewer.dependencies,\n { state: validateHydratedBlockState, protocol: validateHydratedBlock },\n ),\n ])\n locator = await initEvmProvidersIfAvailable(locator)\n locator = await (isString(config.remote.rpc?.url)\n ? remoteLocatorFromConfig(config, { ...context, locator })\n : localLocatorFromConfig(config, { ...context, locator }))\n locator.freeze()\n return locator\n}\n\nexport async function localLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<ProviderFactoryLocatorInstance> {\n const balancesSummaryMap = assertEx(await initBalanceSummaryMap(context), () => 'Balance Summary Map not initialized')\n const transfersSummaryMap = assertEx(await initTransferSummaryMap(context), () => 'Transfer Summary Map not initialized')\n\n // TODO: this should not be an api wallet, but a server wallet\n const wallet = await initApiWallet(context)\n\n const {\n writableChainArchivist, readonlyChainArchivist, pendingTransactionsArchivist, pendingBlocksArchivist,\n } = await initServerNode({\n ...context,\n wallet,\n transfersSummaryMap,\n balancesSummaryMap,\n })\n\n await initFinalizationArchivistIfNeeded(writableChainArchivist, config, wallet)\n\n const locator = new ProviderFactoryLocator(context)\n locator.registerMany([\n SimpleMempoolViewer.factory<SimpleMempoolViewer>(SimpleMempoolViewer.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleMempoolRunner.factory<SimpleMempoolRunner>(SimpleMempoolRunner.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleAccountBalanceViewer.factory<SimpleAccountBalanceViewer>(SimpleAccountBalanceViewer.dependencies, { balancesSummaryMap, transfersSummaryMap }),\n SimpleFinalizationViewer.factory<SimpleFinalizationViewer>(SimpleFinalizationViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleBlockViewer.factory<SimpleBlockViewer>(SimpleBlockViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleWindowedBlockViewer.factory<SimpleWindowedBlockViewer>(SimpleWindowedBlockViewer.dependencies, { maxWindowSize: 10_000, syncInterval: 10_000 }),\n SimpleXyoConnectionViewer.factory<SimpleXyoConnectionViewer>(SimpleXyoConnectionViewer.dependencies, {}),\n SimpleXyoViewer.factory<SimpleXyoViewer>(SimpleXyoViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleFinalizationViewer.factory<SimpleFinalizationViewer>(SimpleFinalizationViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleFinalizationRunner.factory<SimpleFinalizationRunner>(SimpleFinalizationRunner.dependencies, { finalizedArchivist: writableChainArchivist }),\n\n ])\n locator.freeze()\n return locator\n}\n\nexport async function remoteLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<ProviderFactoryLocatorInstance> {\n const balancesSummaryMap = assertEx(await initBalanceSummaryMap(context), () => 'Balance Summary Map not initialized')\n const transfersSummaryMap = assertEx(await initTransferSummaryMap(context), () => 'Transfer Summary Map not initialized')\n\n // TODO: this should not be an api wallet, but a server wallet\n const wallet = await initApiWallet(context)\n\n const {\n readonlyChainArchivist, pendingTransactionsArchivist, pendingBlocksArchivist,\n } = await initServerNode({\n ...context,\n wallet,\n transfersSummaryMap,\n balancesSummaryMap,\n })\n\n const locator = new ProviderFactoryLocator(context)\n locator.registerMany([\n SimpleMempoolViewer.factory<SimpleMempoolViewer>(SimpleMempoolViewer.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleMempoolRunner.factory<SimpleMempoolRunner>(SimpleMempoolRunner.dependencies, { pendingTransactionsArchivist, pendingBlocksArchivist }),\n SimpleAccountBalanceViewer.factory<SimpleAccountBalanceViewer>(SimpleAccountBalanceViewer.dependencies, { balancesSummaryMap, transfersSummaryMap }),\n SimpleFinalizationViewer.factory<SimpleFinalizationViewer>(SimpleFinalizationViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleBlockViewer.factory<SimpleBlockViewer>(SimpleBlockViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n SimpleWindowedBlockViewer.factory<SimpleWindowedBlockViewer>(SimpleWindowedBlockViewer.dependencies, { maxWindowSize: 10_000, syncInterval: 10_000 }),\n SimpleXyoViewer.factory<SimpleXyoViewer>(SimpleXyoViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),\n ])\n locator.freeze()\n return locator\n}\n\nexport async function producerLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<ProviderFactoryLocatorInstance> {\n const { logger } = context\n const account = await initProducerAccount({ config })\n const locator = new ProviderFactoryLocator(context)\n const rewardAddress = asAddress(config.actors.producer.rewardAddress ?? account.address, true)\n logger?.info(`Using reward address ${rewardAddress}`)\n if (rewardAddress === account.address) {\n logger?.warn(`Using producer account address as reward address: ${account.address}`)\n }\n\n const remoteUrl = config.actors.producer.remote.rpc?.url\n\n if (isString(remoteUrl)) {\n const transportFactory: TransportFactory = (schemas: RpcSchemaMap) => new HttpRpcTransport(remoteUrl, schemas)\n\n locator.registerMany([\n JsonRpcMempoolViewer.factory<JsonRpcMempoolViewer>(JsonRpcMempoolViewer.dependencies, { transport: await transportFactory(MempoolViewerRpcSchemas) }),\n JsonRpcMempoolRunner.factory<JsonRpcMempoolRunner>(JsonRpcMempoolRunner.dependencies, { transport: await transportFactory(MempoolRunnerRpcSchemas) }),\n JsonRpcAccountBalanceViewer.factory<JsonRpcAccountBalanceViewer>(\n JsonRpcAccountBalanceViewer.dependencies,\n { transport: await transportFactory(AccountBalanceViewerRpcSchemas) },\n ),\n JsonRpcFinalizationViewer.factory<JsonRpcFinalizationViewer>(\n JsonRpcFinalizationViewer.dependencies,\n { transport: await transportFactory(FinalizationViewerRpcSchemas) },\n ),\n JsonRpcBlockViewer.factory<JsonRpcBlockViewer>(JsonRpcBlockViewer.dependencies, { transport: await transportFactory(BlockViewerRpcSchemas) }),\n ])\n }\n\n locator.registerMany([\n SimpleBlockRewardViewer.factory<SimpleBlockRewardViewer>(SimpleBlockRewardViewer.dependencies, {}),\n SimpleBlockRunner.factory<SimpleBlockRunner>(\n SimpleBlockRunner.dependencies,\n { account, rewardAddress },\n )])\n locator.freeze()\n return locator\n}\n\nexport function apiLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promisable<ProviderFactoryLocatorInstance> {\n const locator = new ProviderFactoryLocator(context)\n\n locator.registerMany([\n SimpleXyoRunner.factory<SimpleXyoRunner>(SimpleXyoRunner.dependencies, {}),\n SimpleXyoConnectionRunner.factory<SimpleXyoConnectionRunner>(SimpleXyoConnectionRunner.dependencies, {}),\n SimpleXyoGateway.factory<SimpleXyoGateway>(SimpleXyoGateway.dependencies, {}),\n ])\n locator.freeze()\n return locator\n}\n\nexport function mempoolLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promisable<ProviderFactoryLocatorInstance> {\n const locator = new ProviderFactoryLocator(context)\n\n locator.registerMany([\n ])\n locator.freeze()\n return locator\n}\n\nexport async function bridgeLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promise<Promise<Promisable<ProviderFactoryLocatorInstance>>> {\n const locator = new ProviderFactoryLocator(context)\n\n const { mnemonic } = config.actors.bridge\n const walletPhrase = isDefined(mnemonic) ? mnemonic : HDWallet.generateMnemonic()\n const wallet = await generateXyoBaseWalletFromPhrase(walletPhrase)\n const signerAccount = await wallet.derivePath(ADDRESS_INDEX.XYO)\n\n const remoteUrl = config.actors.bridge.remote.rpc?.url\n\n if (isString(remoteUrl)) {\n const transportFactory: TransportFactory = (schemas: RpcSchemaMap) => new HttpRpcTransport(remoteUrl, schemas)\n\n locator.registerMany([\n JsonRpcMempoolViewer.factory<JsonRpcMempoolViewer>(JsonRpcMempoolViewer.dependencies, { transport: await transportFactory(MempoolViewerRpcSchemas) }),\n JsonRpcMempoolRunner.factory<JsonRpcMempoolRunner>(JsonRpcMempoolRunner.dependencies, { transport: await transportFactory(MempoolRunnerRpcSchemas) }),\n JsonRpcAccountBalanceViewer.factory<JsonRpcAccountBalanceViewer>(\n JsonRpcAccountBalanceViewer.dependencies,\n { transport: await transportFactory(AccountBalanceViewerRpcSchemas) },\n ),\n JsonRpcFinalizationViewer.factory<JsonRpcFinalizationViewer>(\n JsonRpcFinalizationViewer.dependencies,\n { transport: await transportFactory(FinalizationViewerRpcSchemas) },\n ),\n JsonRpcBlockViewer.factory<JsonRpcBlockViewer>(JsonRpcBlockViewer.dependencies, { transport: await transportFactory(BlockViewerRpcSchemas) }),\n ])\n }\n\n locator.registerMany([\n SimpleXyoSigner.factory<SimpleXyoSigner>(SimpleXyoSigner.dependencies, { account: signerAccount }),\n SimpleXyoRunner.factory<SimpleXyoRunner>(SimpleXyoRunner.dependencies, {}),\n SimpleXyoConnectionRunner.factory<SimpleXyoConnectionRunner>(SimpleXyoConnectionRunner.dependencies, {}),\n SimpleXyoGatewayRunner.factory<SimpleXyoGatewayRunner>(SimpleXyoGatewayRunner.dependencies, {}),\n ])\n locator.freeze()\n return locator\n}\n\nexport function rewardRedemptionLocatorFromConfig(\n config: Config,\n context: CreatableProviderContext,\n): Promisable<ProviderFactoryLocatorInstance> {\n const locator = new ProviderFactoryLocator(context)\n\n locator.registerMany([\n SimpleXyoGatewayRunner.factory<SimpleXyoGatewayRunner>(SimpleXyoGatewayRunner.dependencies, {}),\n ])\n locator.freeze()\n return locator\n}\n\nexport async function locatorsFromConfig(\n actors: string[],\n config: Config,\n context: Omit<CreatableProviderContext, 'locator'>,\n): Promise<Record<string, ProviderFactoryLocatorInstance>> {\n const result: Record<string, ProviderFactoryLocatorInstance> = { _root: await rootLocatorFromConfig(config, context) }\n if (actors.includes('producer')) result.producer = await producerLocatorFromConfig(config, result._root.context)\n if (actors.includes('api')) result.api = await apiLocatorFromConfig(config, result._root.context)\n if (actors.includes('mempool')) result.mempool = await mempoolLocatorFromConfig(config, result._root.context)\n if (actors.includes('bridge')) result.bridge = await bridgeLocatorFromConfig(config, result._root.context)\n if (actors.includes('rewardRedemption')) result.rewardRedemption = await rewardRedemptionLocatorFromConfig(config, result._root.context)\n return result\n}\n","import type { UsageMeta } from '@xyo-network/xl1-sdk'\nimport { isUsageMeta } from '@xyo-network/xl1-sdk'\nimport type { Options } from 'yargs'\nimport { globalRegistry } from 'zod'\n\nconst usageMetaToOptions = (meta: UsageMeta): Options => {\n return meta\n}\n\nexport const optionsFromGlobalZodRegistry = (): Record<string, Options> => {\n const opts: Record<string, Options> = {}\n for (const schema of Object.values(globalRegistry._map)) {\n if (isUsageMeta(schema)) {\n if (schema.hidden) continue // skip hidden options\n opts[schema.title] = usageMetaToOptions(schema)\n }\n }\n return opts\n}\n","import { isDefined, isNull } from '@xylabs/sdk-js'\nimport { ConfigZod } from '@xyo-network/xl1-sdk'\nimport { cosmiconfigSync } from 'cosmiconfig'\n\n/**\n * The name of the configuration file to search for.\n */\nconst configName = 'xyo'\n\n/**\n * The name of the section within the configuration file to parse.\n */\nconst configSection = 'xl1' // Default section in the config file\n\n/**\n * Attempts to parse the configuration from a file using cosmiconfig.\n * @returns The parsed configuration object if found and valid, otherwise undefined.\n */\nexport const tryParseConfig = () => {\n const explorer = cosmiconfigSync(\n configName,\n /* {\n searchPlaces: [\n 'package.json', // Looks under `xyo` key in package.json\n '.xyorc.json', // Supports common dotfile format\n 'xyo.config.json', // Supports custom-named config file\n ],\n loaders: {\n '.json': defaultLoaders['.json'],\n 'noExt': defaultLoaders['.json'],\n },\n }, */\n )\n const result = explorer.search()\n if (!isNull(result)) {\n const section = result?.config?.[configSection]\n if (isDefined(section) && typeof section === 'object') {\n return ConfigZod.parse(section)\n }\n }\n return ConfigZod.parse({})\n}\n","import net from 'node:net'\n\nexport const waitForHostPort = (host: string, port: number): Promise<void> => {\n return new Promise((resolve) => {\n const tryConnect = () => {\n const socket = new net.Socket()\n\n socket\n .setTimeout(1000)\n .once('error', () => {\n socket.destroy()\n setTimeout(tryConnect, 500) // retry after 500ms\n })\n .once('timeout', () => {\n socket.destroy()\n setTimeout(tryConnect, 500)\n })\n .connect(port, host, () => {\n socket.end()\n resolve()\n })\n }\n\n tryConnect()\n })\n}\n","import { 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,SACEC,WAAWC,aAAAA,YAAWC,iBACjB;AACP,SAASC,cAAc;AACvB,SAASC,kBAAkB;AAC3B,SAASC,oBAAoB;AAC7B,SAASC,mBAAmB;AAE5B,SAASC,aAAAA,YAAWC,kBAAkB;AAEtC,OAAOC,WAAW;AAClB,SAASC,eAAe;;;ACZxB,SAASC,cAAc;AACvB,SAASC,mBAAmB;AAC5B,SAASC,wBAAmD;AAMrD,IAAMC,YAAY,8BACvBC,SACAC,cACAC,YAAAA;AAEA,QAAMC,UAAU,MAAMC,iBAAiB;IAAEJ,QAAAA;IAAQK,QAAQH,QAAQI,QAAQD;EAAO,CAAA;AAEhF,QAAME,MAAM,MAAMC,YAAYC,OAAO;IACnCN;IAASH,QAAAA;IAAQE;EACnB,CAAA;AACA,QAAMQ,SAAS;I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D,OAAOkE,QAAQC,SAAS;AAExC,YAAMJ,WAAW9D,eAAeG,cAAcM,SAAS,SAAA,CAAU;AAEjE,YAAM2D,gBAAgBpE,cAAcD,OAAOkE,QAAQI,MAAMrE,cAAcD,OAAOkE,QAAQK,IAAI;IAC5F;AAEA,UAAMV,OAAO5D,eAAeG,cAAcM,SAAS,KAAA,CAAM;AAEzD,UAAM2D,gBAAgBpE,cAAcD,OAAOwE,IAAIF,MAAMrE,cAAcD,OAAOwE,IAAID,IAAI;AAElF,UAAMP,YAAY/D,eAAeG,cAAcM,SAAS,UAAA,CAAW;EACrE,CAAA,EACC8C,QAAQ;IACP,eAAe;MACbiB,MAAM;MACNC,aAAa;MACbC,SAAS;IACX;EACF,CAAA,EACCC,KAAI,EACJC,MAAM,QAAQ,GAAA,EACdpE,QAAQA,OAAAA,EACRc;AAEH,QAAMA;AACR;AAhJsBJ;;;ADzFf,IAAM2D,QAAQ,mCAAA;AACnBC,SAAO;IAAEC,OAAO;EAAK,CAAA;AACrB,QAAMC,OAAAA;AACR,GAHqB;;;AUFrBC,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","toAddress","runApi","runMempool","Orchestrator","runProducer","ConfigZod","isZodError","yargs","hideBin","exists","BridgeActor","initBridgeWallet","runBridge","config","orchestrator","locator","account","initBridgeWallet","logger","context","api","BridgeActor","create","actors","filter","exists","actor","registerActor","start","exists","initRewardsRedemptionApiWallet","RewardRedemptionActor","runRewardRedemptionApi","config","orchestrator","locator","account","initRewardsRedemptionApiWallet","logger","context","rewardRedemption","RewardRedemptionActor","create","actors","filter","exists","actor","registerActor","start","XL1LogoColorizedAscii","Base","ConsoleLogger","isDefined","LogLevel","SilentLogger","initLogger","config","logger","log","silent","SilentLogger","level","isDefined","logLevel","parsed","LogLevel","toLowerCase","ConsoleLogger","Base","defaultLogger","asAddress","assertEx","isDefined","isString","initApiWallet","initBalanceSummaryMap","initEvmProvidersIfAvailable","initFinalizationArchivistIfNeeded","initProducerAccount","initServerNode","initStatusReporter","initTransferSummaryMap","SimpleBlockRunner","initTelemetry","validateHydratedBlock","validateHydratedBlockState","HDWallet","AccountBalanceViewerRpcSchemas","ADDRESS_INDEX","BlockViewerRpcSchemas","FinalizationViewerRpcSchemas","generateXyoBaseWalletFromPhrase","HttpRpcTransport","JsonRpcAccountBalanceViewer","JsonRpcBlockViewer","JsonRpcFinalizationViewer","JsonRpcMempoolRunner","JsonRpcMempoolViewer","MempoolRunnerRpcSchemas","MempoolViewerRpcSchemas","ProviderFactoryLocator","SimpleAccountBalanceViewer","SimpleBlockRewardViewer","SimpleBlockValidationViewer","SimpleBlockViewer","SimpleFinalizationRunner","SimpleFinalizationViewer","SimpleMempoolRunner","SimpleMempoolViewer","SimpleNetworkStakeViewer","SimpleStepRewardsByPositionViewer","SimpleStepRewardsByStakerViewer","SimpleStepRewardsByStepViewer","SimpleStepRewardsTotalViewer","SimpleStepRewardsViewer","SimpleStepViewer","SimpleTimeSyncViewer","SimpleWindowedBlockViewer","SimpleXyoConnectionRunner","SimpleXyoConnectionViewer","SimpleXyoGateway","SimpleXyoGatewayRunner","SimpleXyoRunner","SimpleXyoSigner","SimpleXyoViewer","telemetryContextFromConfig","config","serviceName","serviceVersion","otlpEndpoint","telemetry","otel","path","endpoint","port","metrics","scrape","initTelemetry","attributes","metricsConfig","contextFromConfigWithoutLocator","logger","singletons","caches","telemetryConfig","statusReporter","initStatusReporter","rootLocatorFromConfig","context","locator","ProviderFactoryLocator","registerMany","SimpleNetworkStakeViewer","factory","dependencies","SimpleTimeSyncViewer","SimpleStepViewer","SimpleStepRewardsViewer","SimpleStepRewardsByPositionViewer","SimpleStepRewardsByStakerViewer","SimpleStepRewardsByStepViewer","SimpleStepRewardsTotalViewer","SimpleBlockValidationViewer","state","validateHydratedBlockState","protocol","validateHydratedBlock","initEvmProvidersIfAvailable","isString","remote","rpc","url","remoteLocatorFromConfig","localLocatorFromConfig","freeze","balancesSummaryMap","assertEx","initBalanceSummaryMap","transfersSummaryMap","initTransferSummaryMap","wallet","initApiWallet","writableChainArchivist","readonlyChainArchivist","pendingTransactionsArchivist","pendingBlocksArchivist","initServerNode","initFinalizationArchivistIfNeeded","SimpleMempoolViewer","SimpleMempoolRunner","SimpleAccountBalanceViewer","SimpleFinalizationViewer","finalizedArchivist","SimpleBlockViewer","SimpleWindowedBlockViewer","maxWindowSize","syncInterval","SimpleXyoConnectionViewer","SimpleXyoViewer","SimpleFinalizationRunner","producerLocatorFromConfig","account","initProducerAccount","rewardAddress","asAddress","actors","producer","address","info","warn","remoteUrl","transportFactory","schemas","HttpRpcTransport","JsonRpcMempoolViewer","transport","MempoolViewerRpcSchemas","JsonRpcMempoolRunner","MempoolRunnerRpcSchemas","JsonRpcAccountBalanceViewer","AccountBalanceViewerRpcSchemas","JsonRpcFinalizationViewer","FinalizationViewerRpcSchemas","JsonRpcBlockViewer","BlockViewerRpcSchemas","SimpleBlockRewardViewer","SimpleBlockRunner","apiLocatorFromConfig","SimpleXyoRunner","SimpleXyoConnectionRunner","SimpleXyoGateway","mempoolLocatorFromConfig","bridgeLocatorFromConfig","mnemonic","bridge","walletPhrase","isDefined","HDWallet","generateMnemonic","generateXyoBaseWalletFromPhrase","signerAccount","derivePath","ADDRESS_INDEX","XYO","SimpleXyoSigner","SimpleXyoGatewayRunner","rewardRedemptionLocatorFromConfig","locatorsFromConfig","result","_root","includes","api","mempool","rewardRedemption","isUsageMeta","globalRegistry","usageMetaToOptions","meta","optionsFromGlobalZodRegistry","opts","schema","Object","values","globalRegistry","_map","isUsageMeta","hidden","title","isDefined","isNull","ConfigZod","cosmiconfigSync","configName","configSection","tryParseConfig","explorer","cosmiconfigSync","result","search","isNull","section","config","isDefined","ConfigZod","parse","net","waitForHostPort","host","port","Promise","resolve","tryConnect","socket","net","Socket","setTimeout","once","destroy","connect","end","configuration","version","isDefined","__VERSION__","resolveConfig","config","logger","console","defaultChainId","toAddress","resolved","structuredClone","chain","id","warn","getLocatorsFromConfig","actors","configuration","logger","initLogger","orchestrator","Orchestrator","create","context","contextFromConfigWithoutLocator","version","locators","locatorsFromConfig","process","on","log","stop","exit","err","error","runCLI","y","yargs","hideBin","argv","usage","XL1LogoColorizedAscii","parserConfiguration","env","scriptName","middleware","parsedConfigFile","tryParseConfig","parsedConfigArgs","parseResult","ConfigZod","safeParse","success","mergedConfig","deepMerge","validatedMergedConfigResult","resolvedConfig","resolveConfig","data","validatedConfigResult","rootConfig","actorNames","Object","keys","actorName","console","JSON","stringify","isZodError","message","Error","stack","options","optionsFromGlobalZodRegistry","wrap","terminalWidth","command","runApi","runBridge","runMempool","runProducer","runRewardRedemptionApi","mempool","enabled","push","waitForHostPort","host","port","api","type","description","default","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.19.
|
|
3
|
+
"version": "1.19.11",
|
|
4
4
|
"description": "XYO Layer One CLI Library",
|
|
5
5
|
"homepage": "https://xylabs.com",
|
|
6
6
|
"bugs": {
|
|
@@ -44,17 +44,17 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@xylabs/sdk-js": "~5.0.79",
|
|
47
|
-
"@xyo-network/chain-api": "~1.19.
|
|
48
|
-
"@xyo-network/chain-bridge": "~1.19.
|
|
49
|
-
"@xyo-network/chain-mempool": "~1.19.
|
|
50
|
-
"@xyo-network/chain-orchestration": "~1.19.
|
|
51
|
-
"@xyo-network/chain-producer": "~1.19.
|
|
52
|
-
"@xyo-network/chain-reward-redemption": "~1.19.
|
|
53
|
-
"@xyo-network/chain-services": "~1.19.
|
|
54
|
-
"@xyo-network/chain-telemetry": "~1.19.
|
|
55
|
-
"@xyo-network/chain-validation": "~1.19.
|
|
47
|
+
"@xyo-network/chain-api": "~1.19.11",
|
|
48
|
+
"@xyo-network/chain-bridge": "~1.19.11",
|
|
49
|
+
"@xyo-network/chain-mempool": "~1.19.11",
|
|
50
|
+
"@xyo-network/chain-orchestration": "~1.19.11",
|
|
51
|
+
"@xyo-network/chain-producer": "~1.19.11",
|
|
52
|
+
"@xyo-network/chain-reward-redemption": "~1.19.11",
|
|
53
|
+
"@xyo-network/chain-services": "~1.19.11",
|
|
54
|
+
"@xyo-network/chain-telemetry": "~1.19.11",
|
|
55
|
+
"@xyo-network/chain-validation": "~1.19.11",
|
|
56
56
|
"@xyo-network/wallet": "~5.3.2",
|
|
57
|
-
"@xyo-network/xl1-sdk": "~1.23.
|
|
57
|
+
"@xyo-network/xl1-sdk": "~1.23.21",
|
|
58
58
|
"cosmiconfig": "~9.0.0",
|
|
59
59
|
"dotenv": "~17.2.4",
|
|
60
60
|
"yargs": "~18.0.0"
|
|
@@ -66,13 +66,13 @@
|
|
|
66
66
|
"@xyo-network/account-model": "~5.3.2",
|
|
67
67
|
"@xyo-network/archivist-lmdb": "~5.3.2",
|
|
68
68
|
"@xyo-network/archivist-mongodb": "~5.3.2",
|
|
69
|
-
"@xyo-network/chain-ethereum": "~1.19.
|
|
70
|
-
"@xyo-network/chain-services": "~1.19.
|
|
71
|
-
"@xyo-network/chain-test": "~1.19.
|
|
69
|
+
"@xyo-network/chain-ethereum": "~1.19.11",
|
|
70
|
+
"@xyo-network/chain-services": "~1.19.11",
|
|
71
|
+
"@xyo-network/chain-test": "~1.19.11",
|
|
72
72
|
"@xyo-network/typechain": "~4.1.1",
|
|
73
73
|
"@xyo-network/wallet": "~5.3.2",
|
|
74
74
|
"@xyo-network/wallet-model": "~5.3.2",
|
|
75
|
-
"@xyo-network/xl1-sdk": "~1.23.
|
|
75
|
+
"@xyo-network/xl1-sdk": "~1.23.21",
|
|
76
76
|
"eslint": "^9.39.2",
|
|
77
77
|
"ethers": "^6.16.0",
|
|
78
78
|
"lmdb": "~3.5.1",
|
package/src/locatorFromConfig.ts
CHANGED
|
@@ -3,19 +3,15 @@ import {
|
|
|
3
3
|
asAddress, assertEx, isDefined, isString,
|
|
4
4
|
} from '@xylabs/sdk-js'
|
|
5
5
|
import {
|
|
6
|
-
initApiWallet,
|
|
7
|
-
|
|
8
|
-
initEvmProvidersIfAvailable, initFinalizationArchivistIfNeeded, initProducerAccount, initServerNode, initStatusReporter,
|
|
9
|
-
initTransferSummaryMap,
|
|
6
|
+
initApiWallet, initBalanceSummaryMap, initEvmProvidersIfAvailable, initFinalizationArchivistIfNeeded, initProducerAccount, initServerNode,
|
|
7
|
+
initStatusReporter, initTransferSummaryMap,
|
|
10
8
|
} from '@xyo-network/chain-orchestration'
|
|
11
9
|
import { SimpleBlockRunner } from '@xyo-network/chain-services'
|
|
12
10
|
import { initTelemetry } from '@xyo-network/chain-telemetry'
|
|
13
11
|
import { validateHydratedBlock, validateHydratedBlockState } from '@xyo-network/chain-validation'
|
|
14
12
|
import { HDWallet } from '@xyo-network/wallet'
|
|
15
13
|
import type {
|
|
16
|
-
Config, CreatableProviderContext, ProviderFactoryLocatorInstance,
|
|
17
|
-
RpcSchemaMap,
|
|
18
|
-
TransportFactory,
|
|
14
|
+
Config, CreatableProviderContext, ProviderFactoryLocatorInstance, RpcSchemaMap, TransportFactory,
|
|
19
15
|
} from '@xyo-network/xl1-sdk'
|
|
20
16
|
import {
|
|
21
17
|
AccountBalanceViewerRpcSchemas,
|
|
@@ -31,8 +27,12 @@ import {
|
|
|
31
27
|
JsonRpcMempoolViewer,
|
|
32
28
|
MempoolRunnerRpcSchemas,
|
|
33
29
|
MempoolViewerRpcSchemas,
|
|
34
|
-
ProviderFactoryLocator,
|
|
30
|
+
ProviderFactoryLocator,
|
|
31
|
+
SimpleAccountBalanceViewer,
|
|
32
|
+
SimpleBlockRewardViewer,
|
|
33
|
+
SimpleBlockValidationViewer,
|
|
35
34
|
SimpleBlockViewer,
|
|
35
|
+
SimpleFinalizationRunner,
|
|
36
36
|
SimpleFinalizationViewer,
|
|
37
37
|
SimpleMempoolRunner,
|
|
38
38
|
SimpleMempoolViewer,
|
|
@@ -47,11 +47,11 @@ import {
|
|
|
47
47
|
SimpleWindowedBlockViewer,
|
|
48
48
|
SimpleXyoConnectionRunner,
|
|
49
49
|
SimpleXyoConnectionViewer,
|
|
50
|
+
SimpleXyoGateway,
|
|
50
51
|
SimpleXyoGatewayRunner,
|
|
51
52
|
SimpleXyoRunner,
|
|
52
53
|
SimpleXyoSigner,
|
|
53
54
|
SimpleXyoViewer,
|
|
54
|
-
XyoRunnerMoniker,
|
|
55
55
|
} from '@xyo-network/xl1-sdk'
|
|
56
56
|
|
|
57
57
|
export async function telemetryContextFromConfig(config: Config, serviceName: string, serviceVersion: string) {
|
|
@@ -146,6 +146,9 @@ export async function localLocatorFromConfig(
|
|
|
146
146
|
SimpleWindowedBlockViewer.factory<SimpleWindowedBlockViewer>(SimpleWindowedBlockViewer.dependencies, { maxWindowSize: 10_000, syncInterval: 10_000 }),
|
|
147
147
|
SimpleXyoConnectionViewer.factory<SimpleXyoConnectionViewer>(SimpleXyoConnectionViewer.dependencies, {}),
|
|
148
148
|
SimpleXyoViewer.factory<SimpleXyoViewer>(SimpleXyoViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),
|
|
149
|
+
SimpleFinalizationViewer.factory<SimpleFinalizationViewer>(SimpleFinalizationViewer.dependencies, { finalizedArchivist: readonlyChainArchivist }),
|
|
150
|
+
SimpleFinalizationRunner.factory<SimpleFinalizationRunner>(SimpleFinalizationRunner.dependencies, { finalizedArchivist: writableChainArchivist }),
|
|
151
|
+
|
|
149
152
|
])
|
|
150
153
|
locator.freeze()
|
|
151
154
|
return locator
|
|
@@ -197,7 +200,7 @@ export async function producerLocatorFromConfig(
|
|
|
197
200
|
logger?.warn(`Using producer account address as reward address: ${account.address}`)
|
|
198
201
|
}
|
|
199
202
|
|
|
200
|
-
const remoteUrl = config.remote.rpc?.url
|
|
203
|
+
const remoteUrl = config.actors.producer.remote.rpc?.url
|
|
201
204
|
|
|
202
205
|
if (isString(remoteUrl)) {
|
|
203
206
|
const transportFactory: TransportFactory = (schemas: RpcSchemaMap) => new HttpRpcTransport(remoteUrl, schemas)
|
|
@@ -234,6 +237,9 @@ export function apiLocatorFromConfig(
|
|
|
234
237
|
const locator = new ProviderFactoryLocator(context)
|
|
235
238
|
|
|
236
239
|
locator.registerMany([
|
|
240
|
+
SimpleXyoRunner.factory<SimpleXyoRunner>(SimpleXyoRunner.dependencies, {}),
|
|
241
|
+
SimpleXyoConnectionRunner.factory<SimpleXyoConnectionRunner>(SimpleXyoConnectionRunner.dependencies, {}),
|
|
242
|
+
SimpleXyoGateway.factory<SimpleXyoGateway>(SimpleXyoGateway.dependencies, {}),
|
|
237
243
|
])
|
|
238
244
|
locator.freeze()
|
|
239
245
|
return locator
|
|
@@ -311,25 +317,10 @@ export async function locatorsFromConfig(
|
|
|
311
317
|
context: Omit<CreatableProviderContext, 'locator'>,
|
|
312
318
|
): Promise<Record<string, ProviderFactoryLocatorInstance>> {
|
|
313
319
|
const result: Record<string, ProviderFactoryLocatorInstance> = { _root: await rootLocatorFromConfig(config, context) }
|
|
314
|
-
|
|
315
|
-
if (
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
if (api) {
|
|
320
|
-
result.api = api
|
|
321
|
-
}
|
|
322
|
-
const mempool = actors.includes('mempool') ? await mempoolLocatorFromConfig(config, result._root.context) : undefined
|
|
323
|
-
if (mempool) {
|
|
324
|
-
result.mempool = mempool
|
|
325
|
-
}
|
|
326
|
-
const bridge = actors.includes('bridge') ? await bridgeLocatorFromConfig(config, result._root.context) : undefined
|
|
327
|
-
if (bridge) {
|
|
328
|
-
result.bridge = bridge
|
|
329
|
-
}
|
|
330
|
-
const rewardRedemption = actors.includes('rewardRedemption') ? await rewardRedemptionLocatorFromConfig(config, result._root.context) : undefined
|
|
331
|
-
if (rewardRedemption) {
|
|
332
|
-
result.rewardRedemption = rewardRedemption
|
|
333
|
-
}
|
|
320
|
+
if (actors.includes('producer')) result.producer = await producerLocatorFromConfig(config, result._root.context)
|
|
321
|
+
if (actors.includes('api')) result.api = await apiLocatorFromConfig(config, result._root.context)
|
|
322
|
+
if (actors.includes('mempool')) result.mempool = await mempoolLocatorFromConfig(config, result._root.context)
|
|
323
|
+
if (actors.includes('bridge')) result.bridge = await bridgeLocatorFromConfig(config, result._root.context)
|
|
324
|
+
if (actors.includes('rewardRedemption')) result.rewardRedemption = await rewardRedemptionLocatorFromConfig(config, result._root.context)
|
|
334
325
|
return result
|
|
335
326
|
}
|