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