@xyo-network/xl1-cli-lib 1.20.14 → 1.20.16

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.
@@ -444,7 +444,7 @@ var optionsFromGlobalZodRegistry = /* @__PURE__ */ __name(() => {
444
444
 
445
445
  // src/runCLI.ts
446
446
  var configuration;
447
- var version = isDefined2("1.20.13") ? "1.20.13" : "unknown";
447
+ var version = isDefined2("1.20.16") ? "1.20.16" : "unknown";
448
448
  function getConfiguration() {
449
449
  return configuration;
450
450
  }
package/dist/node/xl1.mjs CHANGED
@@ -447,7 +447,7 @@ var optionsFromGlobalZodRegistry = /* @__PURE__ */ __name(() => {
447
447
 
448
448
  // src/runCLI.ts
449
449
  var configuration;
450
- var version = isDefined2("1.20.13") ? "1.20.13" : "unknown";
450
+ var version = isDefined2("1.20.16") ? "1.20.16" : "unknown";
451
451
  function getConfiguration() {
452
452
  return configuration;
453
453
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/xl1-cli-lib",
3
- "version": "1.20.14",
3
+ "version": "1.20.16",
4
4
  "description": "XYO Layer One CLI Library",
5
5
  "homepage": "https://xylabs.com",
6
6
  "bugs": {
@@ -23,7 +23,6 @@
23
23
  ".": {
24
24
  "node": {
25
25
  "types": "./dist/node/index.d.ts",
26
- "source": "./src/index.ts",
27
26
  "import": "./dist/node/index.mjs"
28
27
  }
29
28
  },
@@ -33,54 +32,163 @@
33
32
  "module": "./dist/node/index.mjs",
34
33
  "files": [
35
34
  "dist",
36
- "src",
37
35
  "!**/*.bench.*",
38
36
  "!**/*.spec.*",
39
- "!**/*.test.*"
37
+ "!**/*.test.*",
38
+ "README.md"
40
39
  ],
41
- "scripts": {
42
- "build-tests": "tsc --noEmit --lib dom,esnext",
43
- "start": "node ./dist/node/xl1.mjs"
44
- },
45
40
  "dependencies": {
46
- "@xyo-network/chain-api": "~1.20.14",
47
- "@xyo-network/chain-bridge": "~1.20.14",
48
- "@xyo-network/chain-mempool": "~1.20.14",
49
- "@xyo-network/chain-orchestration": "~1.20.14",
50
- "@xyo-network/chain-producer": "~1.20.14",
51
- "@xyo-network/chain-reward-redemption": "~1.20.14",
52
- "dotenv": "~17.3.1",
53
- "yargs": "~18.0.0"
41
+ "@xyo-network/xl1-sdk": "~1.26.19",
42
+ "dotenv": "~17.4.1",
43
+ "yargs": "~18.0.0",
44
+ "@xyo-network/chain-api": "~1.20.16",
45
+ "@xyo-network/chain-orchestration": "~1.20.16"
54
46
  },
55
47
  "devDependencies": {
48
+ "@opentelemetry/api": "^1.9.0",
49
+ "@types/node": "^25.5.2",
56
50
  "@types/yargs": "^17.0.35",
57
- "@xylabs/sdk-js": "~5.0.90",
58
- "@xylabs/ts-scripts-common": "~7.5.11",
59
- "@xylabs/ts-scripts-yarn3": "~7.5.11",
60
- "@xylabs/tsconfig": "~7.5.11",
61
- "@xyo-network/sdk-js": "~5.3.20",
62
- "@xyo-network/xl1-sdk": "~1.26.11",
63
- "axios": "^1.13.6",
51
+ "@xylabs/express": "^5.0.95",
52
+ "@xylabs/mongo": "^5.0.95",
53
+ "@xylabs/sdk-js": "~5.0.95",
54
+ "@xylabs/ts-scripts-common": "~7.9.3",
55
+ "@xylabs/ts-scripts-pnpm": "~7.9.3",
56
+ "@xylabs/tsconfig": "~7.9.3",
57
+ "@xyo-network/account": "~5.3.30",
58
+ "@xyo-network/account-model": "~5.3",
59
+ "@xyo-network/api-models": "~5.3.30",
60
+ "@xyo-network/archivist-abstract": "~5.3",
61
+ "@xyo-network/archivist-generic": "~5.3.30",
62
+ "@xyo-network/archivist-memory": "~5.3.30",
63
+ "@xyo-network/archivist-model": "~5.3",
64
+ "@xyo-network/archivist-view": "~5.3.30",
65
+ "@xyo-network/archivist-wrapper": "~5.3",
66
+ "@xyo-network/boundwitness-builder": "~5.3.30",
67
+ "@xyo-network/boundwitness-validator": "~5.3",
68
+ "@xyo-network/bridge-abstract": "~5.3.30",
69
+ "@xyo-network/bridge-model": "~5.3.30",
70
+ "@xyo-network/config-payload-plugin": "~5.3.30",
71
+ "@xyo-network/data": "~5.3.30",
72
+ "@xyo-network/diviner-abstract": "~5.3",
73
+ "@xyo-network/diviner-boundwitness-memory": "~5.3.30",
74
+ "@xyo-network/diviner-identity": "~5.3.30",
75
+ "@xyo-network/diviner-model": "~5.3.30",
76
+ "@xyo-network/diviner-payload-generic": "~5.3.30",
77
+ "@xyo-network/diviner-payload-model": "~5.3.30",
78
+ "@xyo-network/diviner-wrapper": "~5.3",
79
+ "@xyo-network/dns": "~5.3.30",
80
+ "@xyo-network/domain-payload-plugin": "~5.3.30",
81
+ "@xyo-network/elliptic": "~5.3.30",
82
+ "@xyo-network/hash": "~5.3",
83
+ "@xyo-network/huri": "~5.3.30",
84
+ "@xyo-network/manifest-model": "~5.3",
85
+ "@xyo-network/module-abstract": "~5.3",
86
+ "@xyo-network/module-model": "~5.3",
87
+ "@xyo-network/module-model-mongodb": "~5.3",
88
+ "@xyo-network/module-resolver": "~5.3.30",
89
+ "@xyo-network/module-wrapper": "~5.3",
90
+ "@xyo-network/network": "~5.3.30",
91
+ "@xyo-network/node-abstract": "~5.3.30",
92
+ "@xyo-network/node-memory": "~5.3.30",
93
+ "@xyo-network/node-model": "~5.3.30",
94
+ "@xyo-network/node-view": "~5.3.30",
95
+ "@xyo-network/node-wrapper": "~5.3",
96
+ "@xyo-network/payload-builder": "~5.3",
97
+ "@xyo-network/payload-model": "~5.3.30",
98
+ "@xyo-network/payload-validator": "~5.3",
99
+ "@xyo-network/previous-hash-store-model": "~5.3.30",
100
+ "@xyo-network/sdk-js": "~5.3.30",
101
+ "@xyo-network/sentinel-abstract": "~5.3.30",
102
+ "@xyo-network/sentinel-memory": "~5.3.30",
103
+ "@xyo-network/sentinel-model": "~5.3.30",
104
+ "@xyo-network/wallet-model": "~5.3.30",
105
+ "@xyo-network/wasm": "~5.3.30",
106
+ "@xyo-network/witness-adhoc": "~5.3.30",
107
+ "@xyo-network/witness-model": "~5.3.30",
108
+ "ajv": "^8",
109
+ "axios": "^1.14.0",
110
+ "esbuild": ">=0.18",
64
111
  "ethers": "^6.16.0",
65
- "lmdb": "~3.5.2",
112
+ "lmdb": "~3.5.3",
66
113
  "mongodb": "~7.1.1",
114
+ "pako": "~2.1.0",
67
115
  "typescript": "~5.9.3",
68
- "vitest": "^4.1.2",
69
- "zod": "~4.3.6"
116
+ "vite": "^8.0.7",
117
+ "vitest": "^4.1.3",
118
+ "zod": "~4.3.6",
119
+ "@xyo-network/chain-bridge": "~1.20.16",
120
+ "@xyo-network/chain-mempool": "~1.20.16",
121
+ "@xyo-network/chain-reward-redemption": "~1.20.16",
122
+ "@xyo-network/chain-producer": "~1.20.16",
123
+ "@xyo-network/chain-services": "~1.20.16",
124
+ "@xyo-network/chain-telemetry": "~1.20.16"
70
125
  },
71
126
  "peerDependencies": {
72
- "@xylabs/sdk-js": "^5",
73
- "@xyo-network/sdk-js": "^5",
74
- "@xyo-network/xl1-sdk": "^1",
75
- "axios": "^1",
76
- "lmdb": "^3",
77
- "zod": "^4"
127
+ "@xylabs/express": "^5.0.95",
128
+ "@xylabs/sdk-js": "~5.0.93",
129
+ "@xyo-network/account": "~5.3.30",
130
+ "@xyo-network/account-model": "~5.3",
131
+ "@xyo-network/api-models": "~5.3.30",
132
+ "@xyo-network/archivist-abstract": "~5.3",
133
+ "@xyo-network/archivist-generic": "~5.3.30",
134
+ "@xyo-network/archivist-memory": "~5.3.30",
135
+ "@xyo-network/archivist-model": "~5.3",
136
+ "@xyo-network/archivist-view": "~5.3.30",
137
+ "@xyo-network/boundwitness-builder": "~5.3.30",
138
+ "@xyo-network/boundwitness-validator": "~5.3",
139
+ "@xyo-network/bridge-abstract": "~5.3.30",
140
+ "@xyo-network/bridge-model": "~5.3.30",
141
+ "@xyo-network/config-payload-plugin": "~5.3.30",
142
+ "@xyo-network/data": "~5.3.30",
143
+ "@xyo-network/diviner-boundwitness-memory": "~5.3.30",
144
+ "@xyo-network/diviner-identity": "~5.3.30",
145
+ "@xyo-network/diviner-model": "~5.3.30",
146
+ "@xyo-network/diviner-payload-generic": "~5.3.30",
147
+ "@xyo-network/diviner-payload-model": "~5.3.30",
148
+ "@xyo-network/dns": "~5.3.30",
149
+ "@xyo-network/domain-payload-plugin": "~5.3.30",
150
+ "@xyo-network/elliptic": "~5.3.30",
151
+ "@xyo-network/hash": "~5.3",
152
+ "@xyo-network/huri": "~5.3.30",
153
+ "@xyo-network/manifest-model": "~5.3",
154
+ "@xyo-network/module-abstract": "~5.3",
155
+ "@xyo-network/module-model": "~5.3",
156
+ "@xyo-network/module-model-mongodb": "~5.3",
157
+ "@xyo-network/module-resolver": "~5.3.30",
158
+ "@xyo-network/network": "~5.3.30",
159
+ "@xyo-network/node-abstract": "~5.3.30",
160
+ "@xyo-network/node-memory": "~5.3.30",
161
+ "@xyo-network/node-model": "~5.3.30",
162
+ "@xyo-network/node-view": "~5.3.30",
163
+ "@xyo-network/payload-builder": "~5.3",
164
+ "@xyo-network/payload-model": "~5.3.30",
165
+ "@xyo-network/payload-validator": "~5.3",
166
+ "@xyo-network/previous-hash-store-model": "~5.3.30",
167
+ "@xyo-network/sentinel-abstract": "~5.3.30",
168
+ "@xyo-network/sentinel-memory": "~5.3.30",
169
+ "@xyo-network/sentinel-model": "~5.3.30",
170
+ "@xyo-network/wallet-model": "~5.3.30",
171
+ "@xyo-network/wasm": "~5.3.30",
172
+ "@xyo-network/witness-adhoc": "~5.3.30",
173
+ "@xyo-network/witness-model": "~5.3.30",
174
+ "pako": "~2.1.0",
175
+ "zod": "~4.3.6",
176
+ "@xyo-network/chain-mempool": "~1.20.16",
177
+ "@xyo-network/chain-bridge": "~1.20.16",
178
+ "@xyo-network/chain-producer": "~1.20.16",
179
+ "@xyo-network/chain-services": "~1.20.16",
180
+ "@xyo-network/chain-telemetry": "~1.20.16",
181
+ "@xyo-network/chain-reward-redemption": "~1.20.16"
78
182
  },
79
183
  "engines": {
80
- "node": ">=22.3 <23"
184
+ "node": ">=24"
81
185
  },
82
186
  "engineStrict": true,
83
187
  "publishConfig": {
84
188
  "access": "public"
189
+ },
190
+ "scripts": {
191
+ "build-tests": "tsc --noEmit --lib dom,esnext",
192
+ "start": "node ./dist/node/xl1.mjs"
85
193
  }
86
- }
194
+ }
@@ -1,39 +0,0 @@
1
- import { getApiActor } from '@xyo-network/chain-api'
2
- import { getMempoolActor } from '@xyo-network/chain-mempool'
3
- import {
4
- ApiConfigZod, MempoolConfigZod,
5
- ValidatorConfigZod,
6
- } from '@xyo-network/chain-orchestration'
7
- import type { Config } from '@xyo-network/xl1-sdk'
8
- import type { CommandModule } from 'yargs'
9
-
10
- import type { GetLocatorsFromConfig } from '../types.ts'
11
- import { getValidatorActor } from '../validator/index.ts'
12
-
13
- export function apiCommand(getConfiguration: () => Config, getLocatorsFromConfig: GetLocatorsFromConfig): CommandModule {
14
- return {
15
- command: 'api',
16
- deprecated: 'Use "start api" instead',
17
- describe: 'Run a XL1 API Node',
18
- handler: async () => {
19
- const configuration = getConfiguration()
20
- const { locators, orchestrator } = await getLocatorsFromConfig(['api', 'mempool', 'validator'], configuration)
21
- const actors = await Promise.all([getApiActor(
22
- ApiConfigZod.parse(locators['api'].context.config),
23
- locators['api'],
24
- ), getMempoolActor(
25
- MempoolConfigZod.parse(locators['mempool'].context.config),
26
- locators['mempool'],
27
- ), getValidatorActor(
28
- ValidatorConfigZod.parse(locators['validator'].context.config),
29
- locators['validator'],
30
- )])
31
-
32
- for (const actor of actors) {
33
- await orchestrator.registerActor(actor)
34
- }
35
-
36
- await orchestrator.start()
37
- },
38
- }
39
- }
@@ -1 +0,0 @@
1
- export * from './apiCommand.ts'
@@ -1,19 +0,0 @@
1
- import { BridgeConfigZod } from '@xyo-network/chain-orchestration'
2
- import type { Config } from '@xyo-network/xl1-sdk'
3
- import type { CommandModule } from 'yargs'
4
-
5
- import type { GetLocatorsFromConfig } from '../types.ts'
6
- import { runBridge } from './runBridge.ts'
7
-
8
- export function bridgeCommand(getConfiguration: () => Config, getLocatorsFromConfig: GetLocatorsFromConfig): CommandModule {
9
- return {
10
- command: 'bridge',
11
- deprecated: 'Use "start bridge" instead',
12
- describe: 'Run a XL1 Bridge Node',
13
- handler: async () => {
14
- const configuration = getConfiguration()
15
- const { locators, orchestrator } = await getLocatorsFromConfig(['bridge'], configuration)
16
- await runBridge(BridgeConfigZod.parse(locators['bridge'].context.config), orchestrator, locators['bridge'])
17
- },
18
- }
19
- }
@@ -1,2 +0,0 @@
1
- export * from './bridgeCommand.ts'
2
- export * from './runBridge.ts'
@@ -1,34 +0,0 @@
1
- import { exists } from '@xylabs/sdk-js'
2
- import { BridgeActor } from '@xyo-network/chain-bridge'
3
- import type { BridgeConfig, OrchestratorInstance } from '@xyo-network/chain-orchestration'
4
- import { initActorWallet } from '@xyo-network/chain-orchestration'
5
- import type { ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk'
6
-
7
- export const getBridgeActor = async (
8
- config: BridgeConfig,
9
- locator: ProviderFactoryLocatorInstance,
10
- ) => {
11
- const account = await initActorWallet({
12
- config, logger: locator.context.logger, singletons: {}, caches: {},
13
- })
14
- // Create actors
15
- return await BridgeActor.create({
16
- account, config, locator,
17
- })
18
- }
19
-
20
- export const runBridge = async (
21
- config: BridgeConfig,
22
- orchestrator: OrchestratorInstance,
23
- locator: ProviderFactoryLocatorInstance,
24
- ) => {
25
- const bridge = await getBridgeActor(config, locator)
26
- const actors = [bridge].filter(exists)
27
-
28
- for (const actor of actors) {
29
- // Register the actor with the orchestrator
30
- await orchestrator.registerActor(actor)
31
- }
32
- // Start the orchestrator => automatically activates the actor
33
- await orchestrator.start()
34
- }
@@ -1,9 +0,0 @@
1
- export * from './api/index.ts'
2
- export * from './bridge/index.ts'
3
- export * from './mempool/index.ts'
4
- export * from './producer/index.ts'
5
- export * from './rewardRedemption/index.ts'
6
- export * from './start/index.ts'
7
- export * from './types.ts'
8
- export * from './validator/index.ts'
9
- export * from './withDeprecationWarning.ts'
@@ -1 +0,0 @@
1
- export * from './mempoolCommand.ts'
@@ -1,19 +0,0 @@
1
- import { runMempool } from '@xyo-network/chain-mempool'
2
- import { MempoolConfigZod } from '@xyo-network/chain-orchestration'
3
- import type { Config } from '@xyo-network/xl1-sdk'
4
- import type { CommandModule } from 'yargs'
5
-
6
- import type { GetLocatorsFromConfig } from '../types.ts'
7
-
8
- export function mempoolCommand(getConfiguration: () => Config, getLocatorsFromConfig: GetLocatorsFromConfig): CommandModule {
9
- return {
10
- command: 'mempool',
11
- deprecated: 'Use "start mempool" instead',
12
- describe: 'Run a XL1 Mempool Node',
13
- handler: async () => {
14
- const configuration = getConfiguration()
15
- const { locators, orchestrator } = await getLocatorsFromConfig(['mempool'], configuration)
16
- await runMempool(MempoolConfigZod.parse(locators['mempool'].context.config), orchestrator, locators['mempool'])
17
- },
18
- }
19
- }
@@ -1 +0,0 @@
1
- export * from './producerCommand.ts'
@@ -1,19 +0,0 @@
1
- import { ProducerConfigZod } from '@xyo-network/chain-orchestration'
2
- import { runProducer } from '@xyo-network/chain-producer'
3
- import type { Config } from '@xyo-network/xl1-sdk'
4
- import type { CommandModule } from 'yargs'
5
-
6
- import type { GetLocatorsFromConfig } from '../types.ts'
7
-
8
- export function producerCommand(getConfiguration: () => Config, getLocatorsFromConfig: GetLocatorsFromConfig): CommandModule {
9
- return {
10
- command: 'producer',
11
- deprecated: 'Use "start producer" instead',
12
- describe: 'Run a XL1 Producer Node',
13
- handler: async () => {
14
- const configuration = getConfiguration()
15
- const { locators, orchestrator } = await getLocatorsFromConfig(['producer'], configuration)
16
- await runProducer(ProducerConfigZod.parse(locators['producer'].context.config), orchestrator, locators['producer'])
17
- },
18
- }
19
- }
@@ -1,2 +0,0 @@
1
- export * from './rewardRedemptionCommand.ts'
2
- export * from './runRewardRedemptionApi.ts'
@@ -1,19 +0,0 @@
1
- import { RewardRedemptionConfigZod } from '@xyo-network/chain-orchestration'
2
- import type { Config } from '@xyo-network/xl1-sdk'
3
- import type { CommandModule } from 'yargs'
4
-
5
- import type { GetLocatorsFromConfig } from '../types.ts'
6
- import { runRewardRedemptionApi } from './runRewardRedemptionApi.ts'
7
-
8
- export function rewardRedemptionCommand(getConfiguration: () => Config, getLocatorsFromConfig: GetLocatorsFromConfig): CommandModule {
9
- return {
10
- command: 'reward-redemption-api',
11
- deprecated: 'Use "start rewardRedemption" instead',
12
- describe: 'Run a XL1 Rewards Redemption API Node',
13
- handler: async () => {
14
- const configuration = getConfiguration()
15
- const { locators, orchestrator } = await getLocatorsFromConfig(['rewardRedemption'], configuration)
16
- await runRewardRedemptionApi(RewardRedemptionConfigZod.parse(locators['rewardRedemption'].context.config), orchestrator, locators['rewardRedemption'])
17
- },
18
- }
19
- }
@@ -1,36 +0,0 @@
1
- import { exists } from '@xylabs/sdk-js'
2
- import type {
3
- OrchestratorInstance,
4
- RewardRedemptionConfig,
5
- } from '@xyo-network/chain-orchestration'
6
- import { initActorWallet } from '@xyo-network/chain-orchestration'
7
- import { RewardRedemptionActor } from '@xyo-network/chain-reward-redemption'
8
- import type { ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk'
9
-
10
- export async function getRewardRedemptionActor(
11
- config: RewardRedemptionConfig,
12
- locator: ProviderFactoryLocatorInstance,
13
- ) {
14
- const account = await initActorWallet({
15
- config, logger: locator.context.logger, singletons: {}, caches: {},
16
- })
17
- return await RewardRedemptionActor.create({
18
- account, config, locator,
19
- })
20
- }
21
-
22
- export async function runRewardRedemptionApi(
23
- config: RewardRedemptionConfig,
24
- orchestrator: OrchestratorInstance,
25
- locator: ProviderFactoryLocatorInstance,
26
- ) {
27
- const rewardRedemption = await getRewardRedemptionActor(config, locator)
28
- const actors = [rewardRedemption].filter(exists)
29
-
30
- for (const actor of actors) {
31
- // Register the actor with the orchestrator
32
- await orchestrator.registerActor(actor)
33
- }
34
- // Start the orchestrator => automatically activates the actor
35
- await orchestrator.start()
36
- }
@@ -1 +0,0 @@
1
- export * from './startCommand.ts'
@@ -1,127 +0,0 @@
1
- import { getApiActor } from '@xyo-network/chain-api'
2
- import { getMempoolActor } from '@xyo-network/chain-mempool'
3
- import type { OrchestratorInstance } from '@xyo-network/chain-orchestration'
4
- import {
5
- ApiConfigZod,
6
- BridgeConfigZod,
7
- MempoolConfigZod,
8
- ProducerConfigZod,
9
- RewardRedemptionConfigZod,
10
- ValidatorConfigZod,
11
- } from '@xyo-network/chain-orchestration'
12
- import { runProducer } from '@xyo-network/chain-producer'
13
- import type { Config, ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk'
14
- import type {
15
- ArgumentsCamelCase, Argv, CommandModule,
16
- } from 'yargs'
17
-
18
- import { waitForHostPort } from '../../waitForHostPort.ts'
19
- import { getBridgeActor } from '../bridge/index.ts'
20
- import { getRewardRedemptionActor } from '../rewardRedemption/index.ts'
21
- import type { GetLocatorsFromConfig } from '../types.ts'
22
- import { getValidatorActor } from '../validator/index.ts'
23
-
24
- interface StartArgs {
25
- actors?: string[]
26
- }
27
-
28
- const KNOWN_ACTORS = ['api', 'bridge', 'mempool', 'producer', 'rewardRedemption', 'validator'] as const
29
-
30
- function getActorsFromConfig(configuration: Config): string[] | undefined {
31
- const enabledActors = configuration.actors
32
- .filter(actor => actor.enabled !== false)
33
- .map(actor => actor.name)
34
- return enabledActors.length > 0 ? enabledActors : undefined
35
- }
36
-
37
- function getDefaultActors(): string[] {
38
- return ['api', 'producer']
39
- }
40
-
41
- async function startActor(
42
- name: string,
43
- locator: ProviderFactoryLocatorInstance,
44
- orchestrator: OrchestratorInstance,
45
- ): Promise<void> {
46
- switch (name) {
47
- case 'api': {
48
- const config = ApiConfigZod.parse(locator.context.config)
49
- const actor = await getApiActor(config, locator)
50
- await orchestrator.registerActor(actor)
51
- await orchestrator.start()
52
- await waitForHostPort(config.host, config.port)
53
- break
54
- }
55
- case 'bridge': {
56
- const config = BridgeConfigZod.parse(locator.context.config)
57
- const actor = await getBridgeActor(config, locator)
58
- await orchestrator.registerActor(actor)
59
- await orchestrator.start()
60
- break
61
- }
62
- case 'mempool': {
63
- const config = MempoolConfigZod.parse(locator.context.config)
64
- const actor = await getMempoolActor(config, locator)
65
- await orchestrator.registerActor(actor)
66
- await orchestrator.start()
67
- await waitForHostPort(config.host, config.port)
68
- break
69
- }
70
- case 'producer': {
71
- const config = ProducerConfigZod.parse(locator.context.config)
72
- await runProducer(config, orchestrator, locator)
73
- break
74
- }
75
- case 'rewardRedemption': {
76
- const config = RewardRedemptionConfigZod.parse(locator.context.config)
77
- const actor = await getRewardRedemptionActor(config, locator)
78
- await orchestrator.registerActor(actor)
79
- await orchestrator.start()
80
- break
81
- }
82
- case 'validator': {
83
- const config = ValidatorConfigZod.parse(locator.context.config)
84
- const actor = await getValidatorActor(config, locator)
85
- await orchestrator.registerActor(actor)
86
- await orchestrator.start()
87
- break
88
- }
89
- default: {
90
- throw new Error(`Unknown actor: ${name}`)
91
- }
92
- }
93
- }
94
-
95
- export function startCommand(getConfiguration: () => Config, getLocatorsFromConfig: GetLocatorsFromConfig): CommandModule {
96
- return {
97
- command: ['start [actors..]', '$0'],
98
- describe: 'Run a full XL1 Node',
99
- builder: (yargs: Argv) => {
100
- return yargs
101
- .positional('actors', {
102
- type: 'string',
103
- array: true,
104
- choices: KNOWN_ACTORS,
105
- description: 'Actors to start (e.g. xl1 start api producer or xl1 start api,producer)',
106
- coerce: (values: string[]) => values.flatMap(v => v.split(',')),
107
- })
108
- .option('actors', {
109
- type: 'array',
110
- string: true,
111
- choices: KNOWN_ACTORS,
112
- description: 'List of actors to start (e.g. --actors api producer mempool). Defaults to api, producer, and mempool if enabled.',
113
- })
114
- },
115
- handler: async (argv: ArgumentsCamelCase<StartArgs>) => {
116
- const configuration = getConfiguration()
117
- const requestedActors = argv.actors !== undefined && argv.actors.length > 0
118
- ? argv.actors
119
- : getActorsFromConfig(configuration) ?? getDefaultActors()
120
- const { locators, orchestrator } = await getLocatorsFromConfig(requestedActors, configuration)
121
-
122
- for (const name of requestedActors) {
123
- await startActor(name, locators[name], orchestrator)
124
- }
125
- },
126
- }
127
- }
@@ -1,9 +0,0 @@
1
- import type { OrchestratorInstance } from '@xyo-network/chain-orchestration'
2
- import type { Config, ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk'
3
-
4
- export interface LocatorsResult {
5
- locators: Record<string, ProviderFactoryLocatorInstance>
6
- orchestrator: OrchestratorInstance
7
- }
8
-
9
- export type GetLocatorsFromConfig = (actors: string[], configuration: Config) => Promise<LocatorsResult>
@@ -1 +0,0 @@
1
- export * from './runValidator.ts'
@@ -1,33 +0,0 @@
1
- import { exists } from '@xylabs/sdk-js'
2
- import type { OrchestratorInstance, ValidatorConfig } from '@xyo-network/chain-orchestration'
3
- import { initActorWallet, ValidatorActor } from '@xyo-network/chain-orchestration'
4
- import type { ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk'
5
-
6
- export const getValidatorActor = async (
7
- config: ValidatorConfig,
8
- locator: ProviderFactoryLocatorInstance,
9
- ) => {
10
- const account = await initActorWallet({
11
- config, logger: locator.context.logger, singletons: {}, caches: {},
12
- })
13
- // Create actors
14
- return await ValidatorActor.create({
15
- account, config, locator,
16
- })
17
- }
18
-
19
- export const runValidator = async (
20
- config: ValidatorConfig,
21
- orchestrator: OrchestratorInstance,
22
- locator: ProviderFactoryLocatorInstance,
23
- ) => {
24
- const validator = await getValidatorActor(config, locator)
25
- const actors = [validator].filter(exists)
26
-
27
- for (const actor of actors) {
28
- // Register the actor with the orchestrator
29
- await orchestrator.registerActor(actor)
30
- }
31
- // Start the orchestrator => automatically activates the actor
32
- await orchestrator.start()
33
- }
@@ -1,17 +0,0 @@
1
- import { delay } from '@xylabs/sdk-js'
2
- import type { CommandModule } from 'yargs'
3
-
4
- export function withDeprecationWarning(module: CommandModule): CommandModule {
5
- const { deprecated, handler } = module
6
- if (typeof deprecated === 'string') {
7
- return {
8
- ...module,
9
- handler: async (argv) => {
10
- console.warn(`[deprecated] ${deprecated}`)
11
- await delay(3000)
12
- return handler(argv)
13
- },
14
- }
15
- }
16
- return module
17
- }