@xyo-network/xl1-cli-lib 1.23.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/index.mjs +92 -161
- package/dist/node/index.mjs.map +7 -1
- package/dist/node/runCLI.d.ts.map +1 -1
- package/dist/node/xl1.mjs +92 -161
- package/dist/node/xl1.mjs.map +7 -1
- package/package.json +100 -100
package/dist/node/xl1.mjs
CHANGED
|
@@ -1,37 +1,59 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/start.ts
|
|
5
2
|
import { config } from "dotenv";
|
|
6
3
|
|
|
7
4
|
// src/runCLI.ts
|
|
8
|
-
import { stdin as input, stdout as output } from "process";
|
|
9
|
-
import { createInterface } from "readline/promises";
|
|
5
|
+
import { stdin as input, stdout as output } from "node:process";
|
|
6
|
+
import { createInterface } from "node:readline/promises";
|
|
10
7
|
import { isDefined as isDefined3 } from "@xylabs/sdk-js";
|
|
11
8
|
import { apiCommand } from "@xyo-network/chain-api";
|
|
12
9
|
import { bridgeCommand } from "@xyo-network/chain-bridge";
|
|
13
10
|
import { finalizerCommand } from "@xyo-network/chain-finalizer";
|
|
14
11
|
import { mempoolCommand } from "@xyo-network/chain-mempool";
|
|
15
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
contextFromConfigWithoutLocator,
|
|
14
|
+
detectDerivationPathCollisions,
|
|
15
|
+
formatWalletReport,
|
|
16
|
+
initializeResolvedWalletReport,
|
|
17
|
+
locatorsFromConfig,
|
|
18
|
+
Orchestrator
|
|
19
|
+
} from "@xyo-network/chain-orchestration";
|
|
16
20
|
import { initHealthEndpoints } from "@xyo-network/chain-orchestration-express";
|
|
17
21
|
import { producerCommand } from "@xyo-network/chain-producer";
|
|
18
22
|
import { rewardRedemptionCommand } from "@xyo-network/chain-reward-redemption";
|
|
19
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
ActorConfigZod,
|
|
25
|
+
ConfigZod as ConfigZod2,
|
|
26
|
+
DefaultMetricsScrapePorts
|
|
27
|
+
} from "@xyo-network/xl1-sdk";
|
|
20
28
|
import yargs from "yargs";
|
|
21
29
|
import { hideBin } from "yargs/helpers";
|
|
30
|
+
import { z } from "zod/mini";
|
|
22
31
|
|
|
23
32
|
// src/commands/start/startCommand.ts
|
|
24
33
|
import { getApiActor } from "@xyo-network/chain-api";
|
|
25
34
|
import { getBridgeActor } from "@xyo-network/chain-bridge";
|
|
26
35
|
import { getFinalizerActor } from "@xyo-network/chain-finalizer";
|
|
27
36
|
import { getMempoolActor } from "@xyo-network/chain-mempool";
|
|
28
|
-
import {
|
|
37
|
+
import {
|
|
38
|
+
ApiConfigZod,
|
|
39
|
+
BridgeConfigZod,
|
|
40
|
+
FinalizerConfigZod,
|
|
41
|
+
MempoolConfigZod,
|
|
42
|
+
ProducerConfigZod,
|
|
43
|
+
RewardRedemptionConfigZod
|
|
44
|
+
} from "@xyo-network/chain-orchestration";
|
|
29
45
|
import { getProducerActor } from "@xyo-network/chain-producer";
|
|
30
46
|
import { getRewardRedemptionActor } from "@xyo-network/chain-reward-redemption";
|
|
31
47
|
|
|
32
48
|
// src/initLogger.ts
|
|
33
|
-
import {
|
|
34
|
-
|
|
49
|
+
import {
|
|
50
|
+
Base,
|
|
51
|
+
ConsoleLogger,
|
|
52
|
+
isDefined,
|
|
53
|
+
LogLevel,
|
|
54
|
+
SilentLogger
|
|
55
|
+
} from "@xylabs/sdk-js";
|
|
56
|
+
var initLogger = (config2) => {
|
|
35
57
|
let logger;
|
|
36
58
|
if (config2.log.silent) {
|
|
37
59
|
logger = new SilentLogger();
|
|
@@ -45,31 +67,18 @@ var initLogger = /* @__PURE__ */ __name((config2) => {
|
|
|
45
67
|
}
|
|
46
68
|
Base.defaultLogger = logger;
|
|
47
69
|
return logger;
|
|
48
|
-
}
|
|
70
|
+
};
|
|
49
71
|
|
|
50
72
|
// src/commands/start/startCommand.ts
|
|
51
|
-
var KNOWN_ACTORS = [
|
|
52
|
-
"api",
|
|
53
|
-
"bridge",
|
|
54
|
-
"finalizer",
|
|
55
|
-
"mempool",
|
|
56
|
-
"producer",
|
|
57
|
-
"rewardRedemption"
|
|
58
|
-
];
|
|
73
|
+
var KNOWN_ACTORS = ["api", "bridge", "finalizer", "mempool", "producer", "rewardRedemption"];
|
|
59
74
|
var BOOT_TIMEOUT_MS = 6e4;
|
|
60
75
|
function getActorsFromConfig(configuration2) {
|
|
61
76
|
const enabledActors = configuration2.actors.filter((actor) => actor.enabled !== false).map((actor) => actor.name);
|
|
62
77
|
return enabledActors.length > 0 ? enabledActors : void 0;
|
|
63
78
|
}
|
|
64
|
-
__name(getActorsFromConfig, "getActorsFromConfig");
|
|
65
79
|
function getDefaultActors() {
|
|
66
|
-
return [
|
|
67
|
-
"api",
|
|
68
|
-
"producer",
|
|
69
|
-
"finalizer"
|
|
70
|
-
];
|
|
80
|
+
return ["api", "producer", "finalizer"];
|
|
71
81
|
}
|
|
72
|
-
__name(getDefaultActors, "getDefaultActors");
|
|
73
82
|
async function buildActor(name, locator) {
|
|
74
83
|
switch (name) {
|
|
75
84
|
case "api": {
|
|
@@ -101,7 +110,6 @@ async function buildActor(name, locator) {
|
|
|
101
110
|
}
|
|
102
111
|
}
|
|
103
112
|
}
|
|
104
|
-
__name(buildActor, "buildActor");
|
|
105
113
|
async function bootActors(requestedActors, locators, orchestrator, configuration2) {
|
|
106
114
|
const startedAt = Date.now();
|
|
107
115
|
const actors = await Promise.all(requestedActors.map((name) => buildActor(name, locators[name])));
|
|
@@ -111,39 +119,34 @@ async function bootActors(requestedActors, locators, orchestrator, configuration
|
|
|
111
119
|
await orchestrator.start();
|
|
112
120
|
await orchestrator.whenReady(BOOT_TIMEOUT_MS);
|
|
113
121
|
const ms = Date.now() - startedAt;
|
|
114
|
-
initLogger(configuration2).info(`[xl1] system ready (${requestedActors.
|
|
122
|
+
initLogger(configuration2).info(`[xl1] system ready (${requestedActors.join("/")} in ${ms}ms)`);
|
|
115
123
|
}
|
|
116
|
-
__name(bootActors, "bootActors");
|
|
117
124
|
function startCommand(getConfiguration2, getLocatorsFromConfig2) {
|
|
118
125
|
return {
|
|
119
|
-
command: [
|
|
120
|
-
"start [actors..]",
|
|
121
|
-
"$0"
|
|
122
|
-
],
|
|
126
|
+
command: ["start [actors..]", "$0"],
|
|
123
127
|
describe: "Run a full XL1 Node",
|
|
124
|
-
builder:
|
|
128
|
+
builder: (yargs2) => {
|
|
125
129
|
return yargs2.positional("actors", {
|
|
126
130
|
type: "string",
|
|
127
131
|
array: true,
|
|
128
132
|
choices: KNOWN_ACTORS,
|
|
129
133
|
description: "Actors to start (e.g. xl1 start api producer or xl1 start api,producer)",
|
|
130
|
-
coerce:
|
|
134
|
+
coerce: (values) => values.flatMap((v) => v.split(","))
|
|
131
135
|
}).option("actors", {
|
|
132
136
|
type: "array",
|
|
133
137
|
string: true,
|
|
134
138
|
choices: KNOWN_ACTORS,
|
|
135
139
|
description: "List of actors to start (e.g. --actors api producer finalizer). Defaults to api, producer, and finalizer."
|
|
136
140
|
});
|
|
137
|
-
},
|
|
138
|
-
handler:
|
|
141
|
+
},
|
|
142
|
+
handler: async (argv) => {
|
|
139
143
|
const configuration2 = getConfiguration2();
|
|
140
144
|
const requestedActors = argv.actors !== void 0 && argv.actors.length > 0 ? argv.actors : getActorsFromConfig(configuration2) ?? getDefaultActors();
|
|
141
145
|
const { locators, orchestrator } = await getLocatorsFromConfig2(requestedActors, configuration2);
|
|
142
146
|
await bootActors(requestedActors, locators, orchestrator, configuration2);
|
|
143
|
-
}
|
|
147
|
+
}
|
|
144
148
|
};
|
|
145
149
|
}
|
|
146
|
-
__name(startCommand, "startCommand");
|
|
147
150
|
|
|
148
151
|
// src/commands/withDeprecationWarning.ts
|
|
149
152
|
import { delay } from "@xylabs/sdk-js";
|
|
@@ -152,41 +155,42 @@ function withDeprecationWarning(module) {
|
|
|
152
155
|
if (typeof deprecated === "string") {
|
|
153
156
|
return {
|
|
154
157
|
...module,
|
|
155
|
-
handler:
|
|
158
|
+
handler: async (argv) => {
|
|
156
159
|
console.warn(`[deprecated] ${deprecated}`);
|
|
157
160
|
await delay(3e3);
|
|
158
161
|
return handler(argv);
|
|
159
|
-
}
|
|
162
|
+
}
|
|
160
163
|
};
|
|
161
164
|
}
|
|
162
165
|
return module;
|
|
163
166
|
}
|
|
164
|
-
__name(withDeprecationWarning, "withDeprecationWarning");
|
|
165
167
|
|
|
166
168
|
// src/configMiddleware.ts
|
|
167
169
|
import { createDeepMerge, isDefined as isDefined2 } from "@xylabs/sdk-js";
|
|
168
|
-
import {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
import {
|
|
171
|
+
ActorMnemonicNotAllowedError,
|
|
172
|
+
assertNoActorMnemonics,
|
|
173
|
+
ConfigFileNotFoundError,
|
|
174
|
+
tryParseConfig
|
|
175
|
+
} from "@xyo-network/chain-orchestration";
|
|
176
|
+
import {
|
|
177
|
+
ConfigZod,
|
|
178
|
+
isZodError,
|
|
179
|
+
resolveConfig
|
|
180
|
+
} from "@xyo-network/xl1-sdk";
|
|
181
|
+
var deepMerge = createDeepMerge({ arrayStrategy: "concat" });
|
|
173
182
|
var REDACTED = "[REDACTED]";
|
|
174
|
-
var REDACTED_KEY_NAMES = /* @__PURE__ */ new Set([
|
|
175
|
-
"mnemonic",
|
|
176
|
-
"connectionString"
|
|
177
|
-
]);
|
|
183
|
+
var REDACTED_KEY_NAMES = /* @__PURE__ */ new Set(["mnemonic", "connectionString"]);
|
|
178
184
|
var REDACTED_KEY_SUFFIX = /(PrivateKey|Secret|Password)$/i;
|
|
179
185
|
function shouldRedactKey(key) {
|
|
180
186
|
if (REDACTED_KEY_NAMES.has(key)) return true;
|
|
181
187
|
return REDACTED_KEY_SUFFIX.test(key);
|
|
182
188
|
}
|
|
183
|
-
__name(shouldRedactKey, "shouldRedactKey");
|
|
184
189
|
function redactConfig(config2) {
|
|
185
190
|
const cloned = structuredClone(config2);
|
|
186
191
|
redactInPlace(cloned);
|
|
187
192
|
return cloned;
|
|
188
193
|
}
|
|
189
|
-
__name(redactConfig, "redactConfig");
|
|
190
194
|
function redactInPlace(node) {
|
|
191
195
|
if (Array.isArray(node)) {
|
|
192
196
|
for (const item of node) redactInPlace(item);
|
|
@@ -202,36 +206,25 @@ function redactInPlace(node) {
|
|
|
202
206
|
}
|
|
203
207
|
}
|
|
204
208
|
}
|
|
205
|
-
__name(redactInPlace, "redactInPlace");
|
|
206
209
|
function coerceActorsArray(argv) {
|
|
207
210
|
const actors = argv.actors;
|
|
208
211
|
if (actors === void 0 || Array.isArray(actors)) return argv;
|
|
209
212
|
if (typeof actors !== "object" || actors === null) return argv;
|
|
210
213
|
const entries = Object.entries(actors);
|
|
211
|
-
const numericEntries = entries.map(([key, value]) => [
|
|
212
|
-
Number(key),
|
|
213
|
-
value
|
|
214
|
-
]).filter(([key]) => Number.isInteger(key) && key >= 0);
|
|
214
|
+
const numericEntries = entries.map(([key, value]) => [Number(key), value]).filter(([key]) => Number.isInteger(key) && key >= 0);
|
|
215
215
|
if (numericEntries.length !== entries.length) return argv;
|
|
216
216
|
const asArray = [];
|
|
217
217
|
for (const [key, value] of numericEntries) asArray[key] = value;
|
|
218
|
-
return {
|
|
219
|
-
...argv,
|
|
220
|
-
actors: asArray
|
|
221
|
-
};
|
|
218
|
+
return { ...argv, actors: asArray };
|
|
222
219
|
}
|
|
223
|
-
__name(coerceActorsArray, "coerceActorsArray");
|
|
224
220
|
function safeParseOrThrow(input2) {
|
|
225
221
|
const result = ConfigZod.safeParse(input2);
|
|
226
222
|
if (!result.success) throw result.error;
|
|
227
223
|
return result.data;
|
|
228
224
|
}
|
|
229
|
-
__name(safeParseOrThrow, "safeParseOrThrow");
|
|
230
225
|
async function buildFinalConfig(argv) {
|
|
231
226
|
const configPath = argv.config;
|
|
232
|
-
const parsedConfigFile = await tryParseConfig({
|
|
233
|
-
configPath
|
|
234
|
-
});
|
|
227
|
+
const parsedConfigFile = await tryParseConfig({ configPath });
|
|
235
228
|
const rootMnemonicFromFile = typeof parsedConfigFile.mnemonic === "string" ? parsedConfigFile.mnemonic : void 0;
|
|
236
229
|
const normalizedArgv = coerceActorsArray(argv);
|
|
237
230
|
const parsedConfigArgs = ConfigZod.safeParse(normalizedArgv).data ?? {};
|
|
@@ -239,12 +232,8 @@ async function buildFinalConfig(argv) {
|
|
|
239
232
|
const mergedConfig = safeParseOrThrow(deepMerge(parsedConfigFile, parsedConfigArgs));
|
|
240
233
|
const validated = safeParseOrThrow(resolveConfig(safeParseOrThrow(mergedConfig)));
|
|
241
234
|
const rootMnemonic = rootMnemonicFromArgs ?? rootMnemonicFromFile;
|
|
242
|
-
return isDefined2(rootMnemonic) ? {
|
|
243
|
-
...validated,
|
|
244
|
-
mnemonic: rootMnemonic
|
|
245
|
-
} : validated;
|
|
235
|
+
return isDefined2(rootMnemonic) ? { ...validated, mnemonic: rootMnemonic } : validated;
|
|
246
236
|
}
|
|
247
|
-
__name(buildFinalConfig, "buildFinalConfig");
|
|
248
237
|
async function configMiddleware(argv, setConfiguration) {
|
|
249
238
|
try {
|
|
250
239
|
const finalConfig = await buildFinalConfig(argv);
|
|
@@ -269,12 +258,9 @@ async function configMiddleware(argv, setConfiguration) {
|
|
|
269
258
|
if (!(err instanceof ConfigFileNotFoundError) && !(err instanceof ActorMnemonicNotAllowedError)) {
|
|
270
259
|
console.error(`Stack: ${err instanceof Error ? err.stack : "N/A"}`);
|
|
271
260
|
}
|
|
272
|
-
throw new Error("Invalid configuration", {
|
|
273
|
-
cause: err
|
|
274
|
-
});
|
|
261
|
+
throw new Error("Invalid configuration", { cause: err });
|
|
275
262
|
}
|
|
276
263
|
}
|
|
277
|
-
__name(configMiddleware, "configMiddleware");
|
|
278
264
|
|
|
279
265
|
// src/dumpProviders.ts
|
|
280
266
|
var CANONICAL_ACTOR_ORDER = [
|
|
@@ -312,11 +298,8 @@ function enumerateLocator(locator) {
|
|
|
312
298
|
}
|
|
313
299
|
}
|
|
314
300
|
}
|
|
315
|
-
return [
|
|
316
|
-
...collapsed.values()
|
|
317
|
-
].toSorted((a, b) => a.moniker.localeCompare(b.moniker) || a.providerName.localeCompare(b.providerName));
|
|
301
|
+
return [...collapsed.values()].toSorted((a, b) => a.moniker.localeCompare(b.moniker) || a.providerName.localeCompare(b.providerName));
|
|
318
302
|
}
|
|
319
|
-
__name(enumerateLocator, "enumerateLocator");
|
|
320
303
|
function buildOwnerIndex(perActor) {
|
|
321
304
|
const monikerOwners = /* @__PURE__ */ new Map();
|
|
322
305
|
for (const [actorName, entries] of perActor) {
|
|
@@ -331,27 +314,16 @@ function buildOwnerIndex(perActor) {
|
|
|
331
314
|
}
|
|
332
315
|
return monikerOwners;
|
|
333
316
|
}
|
|
334
|
-
__name(buildOwnerIndex, "buildOwnerIndex");
|
|
335
317
|
function renderDuplicatesSummary(monikerOwners) {
|
|
336
|
-
const duplicates = [
|
|
337
|
-
...monikerOwners.entries()
|
|
338
|
-
].filter(([, owners]) => owners.size > 1).map(([moniker, owners]) => ({
|
|
339
|
-
moniker,
|
|
340
|
-
owners: [
|
|
341
|
-
...owners
|
|
342
|
-
].toSorted().map(formatGroupForDisplay)
|
|
343
|
-
})).toSorted((a, b) => a.moniker.localeCompare(b.moniker));
|
|
318
|
+
const duplicates = [...monikerOwners.entries()].filter(([, owners]) => owners.size > 1).map(([moniker, owners]) => ({ moniker, owners: [...owners].toSorted().map(formatGroupForDisplay) })).toSorted((a, b) => a.moniker.localeCompare(b.moniker));
|
|
344
319
|
if (duplicates.length === 0) return [];
|
|
345
|
-
const lines = [
|
|
346
|
-
"Duplicate monikers (registered by more than one locator):"
|
|
347
|
-
];
|
|
320
|
+
const lines = ["Duplicate monikers (registered by more than one locator):"];
|
|
348
321
|
for (const { moniker, owners } of duplicates) {
|
|
349
322
|
lines.push(` - ${moniker}: ${owners.join(", ")}`);
|
|
350
323
|
}
|
|
351
324
|
lines.push("");
|
|
352
325
|
return lines;
|
|
353
326
|
}
|
|
354
|
-
__name(renderDuplicatesSummary, "renderDuplicatesSummary");
|
|
355
327
|
function groupActorsBySharedRegistry(locators) {
|
|
356
328
|
const groups = [];
|
|
357
329
|
for (const actorName of Object.keys(locators)) {
|
|
@@ -361,9 +333,7 @@ function groupActorsBySharedRegistry(locators) {
|
|
|
361
333
|
existing.actorNames.push(actorName);
|
|
362
334
|
} else {
|
|
363
335
|
groups.push({
|
|
364
|
-
actorNames: [
|
|
365
|
-
actorName
|
|
366
|
-
],
|
|
336
|
+
actorNames: [actorName],
|
|
367
337
|
locator,
|
|
368
338
|
registry: locator.registry
|
|
369
339
|
});
|
|
@@ -371,27 +341,18 @@ function groupActorsBySharedRegistry(locators) {
|
|
|
371
341
|
}
|
|
372
342
|
return groups;
|
|
373
343
|
}
|
|
374
|
-
__name(groupActorsBySharedRegistry, "groupActorsBySharedRegistry");
|
|
375
344
|
function groupId(actorNames) {
|
|
376
|
-
return [
|
|
377
|
-
...actorNames
|
|
378
|
-
].toSorted().join(",");
|
|
345
|
+
return [...actorNames].toSorted().join(",");
|
|
379
346
|
}
|
|
380
|
-
__name(groupId, "groupId");
|
|
381
347
|
function formatGroupForDisplay(groupKey) {
|
|
382
348
|
const members = groupKey.split(",");
|
|
383
349
|
return members.length === 1 ? members[0] : `(${members.join(", ")})`;
|
|
384
350
|
}
|
|
385
|
-
__name(formatGroupForDisplay, "formatGroupForDisplay");
|
|
386
351
|
function renderGroupSection(actorNames, entries, monikerOwners) {
|
|
387
|
-
const sortedActors = [
|
|
388
|
-
...actorNames
|
|
389
|
-
].toSorted();
|
|
352
|
+
const sortedActors = [...actorNames].toSorted();
|
|
390
353
|
const ownGroupKey = groupId(sortedActors);
|
|
391
354
|
const heading = sortedActors.length === 1 ? `Providers for actor: ${sortedActors[0]} (${entries.length} registered)` : `Providers shared by actors: ${sortedActors.join(", ")} (${entries.length} registered)`;
|
|
392
|
-
const lines = [
|
|
393
|
-
heading
|
|
394
|
-
];
|
|
355
|
+
const lines = [heading];
|
|
395
356
|
if (entries.length === 0) {
|
|
396
357
|
lines.push(" (none)", "");
|
|
397
358
|
return lines;
|
|
@@ -401,9 +362,7 @@ function renderGroupSection(actorNames, entries, monikerOwners) {
|
|
|
401
362
|
const isLast = i === entries.length - 1;
|
|
402
363
|
const branch = isLast ? "\u2514\u2500\u2500" : "\u251C\u2500\u2500";
|
|
403
364
|
const owners = monikerOwners.get(entry.moniker) ?? /* @__PURE__ */ new Set();
|
|
404
|
-
const otherOwners = [
|
|
405
|
-
...owners
|
|
406
|
-
].filter((o) => o !== ownGroupKey).toSorted().map(formatGroupForDisplay);
|
|
365
|
+
const otherOwners = [...owners].filter((o) => o !== ownGroupKey).toSorted().map(formatGroupForDisplay);
|
|
407
366
|
const dupNote = otherOwners.length > 0 ? ` \u26A0 also in: ${otherOwners.join(", ")}` : "";
|
|
408
367
|
const depsNote = entry.dependencies.length > 0 ? `, deps: [${entry.dependencies.join(", ")}]` : "";
|
|
409
368
|
const countNote = entry.count > 1 ? ` (\xD7${entry.count})` : "";
|
|
@@ -412,19 +371,13 @@ function renderGroupSection(actorNames, entries, monikerOwners) {
|
|
|
412
371
|
lines.push("");
|
|
413
372
|
return lines;
|
|
414
373
|
}
|
|
415
|
-
__name(renderGroupSection, "renderGroupSection");
|
|
416
374
|
function formatProviderTree(locators) {
|
|
417
375
|
const groups = groupActorsBySharedRegistry(locators);
|
|
418
|
-
const groupKeys = groups.map((g) => ({
|
|
419
|
-
...g,
|
|
420
|
-
key: groupId(g.actorNames)
|
|
421
|
-
}));
|
|
376
|
+
const groupKeys = groups.map((g) => ({ ...g, key: groupId(g.actorNames) }));
|
|
422
377
|
const perGroup = /* @__PURE__ */ new Map();
|
|
423
378
|
for (const g of groupKeys) perGroup.set(g.key, enumerateLocator(g.locator));
|
|
424
379
|
const monikerOwners = buildOwnerIndex(perGroup);
|
|
425
|
-
const orderedGroups = [
|
|
426
|
-
...groupKeys
|
|
427
|
-
].toSorted((a, b) => {
|
|
380
|
+
const orderedGroups = [...groupKeys].toSorted((a, b) => {
|
|
428
381
|
const aHasRoot = a.actorNames.includes("_root");
|
|
429
382
|
const bHasRoot = b.actorNames.includes("_root");
|
|
430
383
|
if (aHasRoot !== bHasRoot) return aHasRoot ? -1 : 1;
|
|
@@ -433,18 +386,13 @@ function formatProviderTree(locators) {
|
|
|
433
386
|
if (ai !== bi) return (ai === -1 ? Number.MAX_SAFE_INTEGER : ai) - (bi === -1 ? Number.MAX_SAFE_INTEGER : bi);
|
|
434
387
|
return a.key.localeCompare(b.key);
|
|
435
388
|
});
|
|
436
|
-
const lines = [
|
|
437
|
-
"XL1 Provider Dump",
|
|
438
|
-
"=================",
|
|
439
|
-
""
|
|
440
|
-
];
|
|
389
|
+
const lines = ["XL1 Provider Dump", "=================", ""];
|
|
441
390
|
for (const g of orderedGroups) {
|
|
442
391
|
lines.push(...renderGroupSection(g.actorNames.toSorted(), perGroup.get(g.key) ?? [], monikerOwners));
|
|
443
392
|
}
|
|
444
393
|
lines.push(...renderDuplicatesSummary(monikerOwners));
|
|
445
394
|
return lines.join("\n");
|
|
446
395
|
}
|
|
447
|
-
__name(formatProviderTree, "formatProviderTree");
|
|
448
396
|
|
|
449
397
|
// src/images.ts
|
|
450
398
|
var XL1LogoColorizedAscii = `\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;118;111;144m_\x1B[0m
|
|
@@ -468,11 +416,11 @@ var XL1LogoColorizedAscii = `\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\
|
|
|
468
416
|
|
|
469
417
|
// src/optionsFromGlobalZodRegistry.ts
|
|
470
418
|
import { isUsageMeta } from "@xyo-network/xl1-sdk";
|
|
471
|
-
import { globalRegistry } from "zod";
|
|
472
|
-
var usageMetaToOptions =
|
|
419
|
+
import { globalRegistry } from "zod/mini";
|
|
420
|
+
var usageMetaToOptions = (meta) => {
|
|
473
421
|
return meta;
|
|
474
|
-
}
|
|
475
|
-
var optionsFromGlobalZodRegistry =
|
|
422
|
+
};
|
|
423
|
+
var optionsFromGlobalZodRegistry = () => {
|
|
476
424
|
const opts = {};
|
|
477
425
|
for (const schema of Object.values(globalRegistry._map)) {
|
|
478
426
|
if (isUsageMeta(schema)) {
|
|
@@ -481,40 +429,34 @@ var optionsFromGlobalZodRegistry = /* @__PURE__ */ __name(() => {
|
|
|
481
429
|
}
|
|
482
430
|
}
|
|
483
431
|
return opts;
|
|
484
|
-
}
|
|
432
|
+
};
|
|
485
433
|
|
|
486
434
|
// src/runCLI.ts
|
|
487
|
-
var DEFAULT_HEALTH_CHECK_PORT =
|
|
435
|
+
var DEFAULT_HEALTH_CHECK_PORT = 9099;
|
|
488
436
|
function defaultScrapePortForActors(actors) {
|
|
489
437
|
const primary = actors[0];
|
|
490
438
|
const key = primary === "rewardRedemption" ? "rewardRedemptionApi" : primary;
|
|
491
439
|
return DefaultMetricsScrapePorts[key] ?? DefaultMetricsScrapePorts.producer;
|
|
492
440
|
}
|
|
493
|
-
__name(defaultScrapePortForActors, "defaultScrapePortForActors");
|
|
494
441
|
var configuration;
|
|
495
442
|
var skipInsecureConfirm = false;
|
|
496
443
|
var dumpProviders = false;
|
|
497
|
-
var version = isDefined3("
|
|
444
|
+
var version = isDefined3("2.0.0") ? "2.0.0" : "unknown";
|
|
498
445
|
function getConfiguration() {
|
|
499
446
|
return configuration;
|
|
500
447
|
}
|
|
501
|
-
__name(getConfiguration, "getConfiguration");
|
|
502
448
|
async function promptForInsecureGenesisConfirmation(logger) {
|
|
503
449
|
if (!input.isTTY || !output.isTTY) {
|
|
504
450
|
logger.warn("Insecure genesis reward wallet is active. Interactive confirmation skipped because this session is not a TTY.");
|
|
505
451
|
return;
|
|
506
452
|
}
|
|
507
|
-
const rl = createInterface({
|
|
508
|
-
input,
|
|
509
|
-
output
|
|
510
|
-
});
|
|
453
|
+
const rl = createInterface({ input, output });
|
|
511
454
|
try {
|
|
512
455
|
await rl.question("Insecure genesis reward wallet is active. Hit RETURN to continue.");
|
|
513
456
|
} finally {
|
|
514
457
|
rl.close();
|
|
515
458
|
}
|
|
516
459
|
}
|
|
517
|
-
__name(promptForInsecureGenesisConfirmation, "promptForInsecureGenesisConfirmation");
|
|
518
460
|
async function getLocatorsFromConfig(actors, configuration2) {
|
|
519
461
|
const actorConfigs = [];
|
|
520
462
|
for (const actorName of actors) {
|
|
@@ -522,20 +464,13 @@ async function getLocatorsFromConfig(actors, configuration2) {
|
|
|
522
464
|
if (existingConfig) {
|
|
523
465
|
actorConfigs.push(existingConfig);
|
|
524
466
|
} else {
|
|
525
|
-
const actorConfig = ActorConfigZod.
|
|
526
|
-
name: actorName
|
|
527
|
-
});
|
|
467
|
+
const actorConfig = z.looseObject(ActorConfigZod.shape).parse({ name: actorName });
|
|
528
468
|
actorConfigs.push(actorConfig);
|
|
529
469
|
}
|
|
530
470
|
}
|
|
531
|
-
const config2 = ConfigZod2.parse({
|
|
532
|
-
...configuration2,
|
|
533
|
-
actors: actorConfigs
|
|
534
|
-
});
|
|
471
|
+
const config2 = ConfigZod2.parse({ ...configuration2, actors: actorConfigs });
|
|
535
472
|
const logger = initLogger(configuration2);
|
|
536
|
-
const orchestrator = await Orchestrator.create({
|
|
537
|
-
logger
|
|
538
|
-
});
|
|
473
|
+
const orchestrator = await Orchestrator.create({ logger });
|
|
539
474
|
const collision = detectDerivationPathCollisions(actors, configuration2);
|
|
540
475
|
if (collision) throw collision;
|
|
541
476
|
const walletReport = await initializeResolvedWalletReport(actors, configuration2);
|
|
@@ -572,12 +507,8 @@ async function getLocatorsFromConfig(actors, configuration2) {
|
|
|
572
507
|
}
|
|
573
508
|
})();
|
|
574
509
|
});
|
|
575
|
-
return {
|
|
576
|
-
locators,
|
|
577
|
-
orchestrator
|
|
578
|
-
};
|
|
510
|
+
return { locators, orchestrator };
|
|
579
511
|
}
|
|
580
|
-
__name(getLocatorsFromConfig, "getLocatorsFromConfig");
|
|
581
512
|
async function runCLI() {
|
|
582
513
|
const y = yargs(hideBin(process.argv));
|
|
583
514
|
const argv = y.usage(`
|
|
@@ -588,8 +519,11 @@ Run various components of the XL1 ecosystem.
|
|
|
588
519
|
Usage:
|
|
589
520
|
$0 <command> [options]`).parserConfiguration({
|
|
590
521
|
"dot-notation": true,
|
|
522
|
+
// foo.bar → { foo: { bar } }
|
|
591
523
|
"parse-numbers": false,
|
|
524
|
+
// Don't auto-parse numbers to allow strings like "0x1"
|
|
592
525
|
"populate--": true
|
|
526
|
+
// Populate -- with all options so we can detected user-supplied vs defaults
|
|
593
527
|
}).env("XL1").scriptName("xl1").middleware(async (argv2) => {
|
|
594
528
|
await configMiddleware(argv2, (config2) => {
|
|
595
529
|
configuration = config2;
|
|
@@ -629,19 +563,16 @@ $0 <command> [options]`).parserConfiguration({
|
|
|
629
563
|
}).help().alias("help", "h").version(version).argv;
|
|
630
564
|
await argv;
|
|
631
565
|
}
|
|
632
|
-
__name(runCLI, "runCLI");
|
|
633
566
|
|
|
634
567
|
// src/start.ts
|
|
635
|
-
var start =
|
|
636
|
-
config({
|
|
637
|
-
quiet: true
|
|
638
|
-
});
|
|
568
|
+
var start = async () => {
|
|
569
|
+
config({ quiet: true });
|
|
639
570
|
await runCLI();
|
|
640
|
-
}
|
|
571
|
+
};
|
|
641
572
|
|
|
642
573
|
// src/xl1.ts
|
|
643
574
|
start().catch((err) => {
|
|
644
575
|
if (process.env.NODE_ENV === "development") console.error("An error occurred during startup:", err);
|
|
645
576
|
process.exit(1);
|
|
646
577
|
});
|
|
647
|
-
//# sourceMappingURL=xl1.mjs.map
|
|
578
|
+
//# sourceMappingURL=xl1.mjs.map
|