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