@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/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,21 +117,32 @@ 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";
|
|
150
148
|
|
|
@@ -153,31 +151,25 @@ import { getApiActor } from "@xyo-network/chain-api";
|
|
|
153
151
|
import { getBridgeActor } from "@xyo-network/chain-bridge";
|
|
154
152
|
import { getFinalizerActor } from "@xyo-network/chain-finalizer";
|
|
155
153
|
import { getMempoolActor } from "@xyo-network/chain-mempool";
|
|
156
|
-
import {
|
|
154
|
+
import {
|
|
155
|
+
ApiConfigZod,
|
|
156
|
+
BridgeConfigZod,
|
|
157
|
+
FinalizerConfigZod,
|
|
158
|
+
MempoolConfigZod,
|
|
159
|
+
ProducerConfigZod,
|
|
160
|
+
RewardRedemptionConfigZod
|
|
161
|
+
} from "@xyo-network/chain-orchestration";
|
|
157
162
|
import { getProducerActor } from "@xyo-network/chain-producer";
|
|
158
163
|
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
|
-
];
|
|
164
|
+
var KNOWN_ACTORS = ["api", "bridge", "finalizer", "mempool", "producer", "rewardRedemption"];
|
|
167
165
|
var BOOT_TIMEOUT_MS = 6e4;
|
|
168
166
|
function getActorsFromConfig(configuration2) {
|
|
169
167
|
const enabledActors = configuration2.actors.filter((actor) => actor.enabled !== false).map((actor) => actor.name);
|
|
170
168
|
return enabledActors.length > 0 ? enabledActors : void 0;
|
|
171
169
|
}
|
|
172
|
-
__name(getActorsFromConfig, "getActorsFromConfig");
|
|
173
170
|
function getDefaultActors() {
|
|
174
|
-
return [
|
|
175
|
-
"api",
|
|
176
|
-
"producer",
|
|
177
|
-
"finalizer"
|
|
178
|
-
];
|
|
171
|
+
return ["api", "producer", "finalizer"];
|
|
179
172
|
}
|
|
180
|
-
__name(getDefaultActors, "getDefaultActors");
|
|
181
173
|
async function buildActor(name, locator) {
|
|
182
174
|
switch (name) {
|
|
183
175
|
case "api": {
|
|
@@ -209,7 +201,6 @@ async function buildActor(name, locator) {
|
|
|
209
201
|
}
|
|
210
202
|
}
|
|
211
203
|
}
|
|
212
|
-
__name(buildActor, "buildActor");
|
|
213
204
|
async function bootActors(requestedActors, locators, orchestrator, configuration2) {
|
|
214
205
|
const startedAt = Date.now();
|
|
215
206
|
const actors = await Promise.all(requestedActors.map((name) => buildActor(name, locators[name])));
|
|
@@ -219,39 +210,34 @@ async function bootActors(requestedActors, locators, orchestrator, configuration
|
|
|
219
210
|
await orchestrator.start();
|
|
220
211
|
await orchestrator.whenReady(BOOT_TIMEOUT_MS);
|
|
221
212
|
const ms = Date.now() - startedAt;
|
|
222
|
-
initLogger(configuration2).info(`[xl1] system ready (${requestedActors.
|
|
213
|
+
initLogger(configuration2).info(`[xl1] system ready (${requestedActors.join("/")} in ${ms}ms)`);
|
|
223
214
|
}
|
|
224
|
-
__name(bootActors, "bootActors");
|
|
225
215
|
function startCommand(getConfiguration2, getLocatorsFromConfig2) {
|
|
226
216
|
return {
|
|
227
|
-
command: [
|
|
228
|
-
"start [actors..]",
|
|
229
|
-
"$0"
|
|
230
|
-
],
|
|
217
|
+
command: ["start [actors..]", "$0"],
|
|
231
218
|
describe: "Run a full XL1 Node",
|
|
232
|
-
builder:
|
|
219
|
+
builder: (yargs2) => {
|
|
233
220
|
return yargs2.positional("actors", {
|
|
234
221
|
type: "string",
|
|
235
222
|
array: true,
|
|
236
223
|
choices: KNOWN_ACTORS,
|
|
237
224
|
description: "Actors to start (e.g. xl1 start api producer or xl1 start api,producer)",
|
|
238
|
-
coerce:
|
|
225
|
+
coerce: (values) => values.flatMap((v) => v.split(","))
|
|
239
226
|
}).option("actors", {
|
|
240
227
|
type: "array",
|
|
241
228
|
string: true,
|
|
242
229
|
choices: KNOWN_ACTORS,
|
|
243
230
|
description: "List of actors to start (e.g. --actors api producer finalizer). Defaults to api, producer, and finalizer."
|
|
244
231
|
});
|
|
245
|
-
},
|
|
246
|
-
handler:
|
|
232
|
+
},
|
|
233
|
+
handler: async (argv) => {
|
|
247
234
|
const configuration2 = getConfiguration2();
|
|
248
235
|
const requestedActors = argv.actors !== void 0 && argv.actors.length > 0 ? argv.actors : getActorsFromConfig(configuration2) ?? getDefaultActors();
|
|
249
236
|
const { locators, orchestrator } = await getLocatorsFromConfig2(requestedActors, configuration2);
|
|
250
237
|
await bootActors(requestedActors, locators, orchestrator, configuration2);
|
|
251
|
-
}
|
|
238
|
+
}
|
|
252
239
|
};
|
|
253
240
|
}
|
|
254
|
-
__name(startCommand, "startCommand");
|
|
255
241
|
|
|
256
242
|
// src/commands/withDeprecationWarning.ts
|
|
257
243
|
import { delay } from "@xylabs/sdk-js";
|
|
@@ -260,16 +246,15 @@ function withDeprecationWarning(module) {
|
|
|
260
246
|
if (typeof deprecated === "string") {
|
|
261
247
|
return {
|
|
262
248
|
...module,
|
|
263
|
-
handler:
|
|
249
|
+
handler: async (argv) => {
|
|
264
250
|
console.warn(`[deprecated] ${deprecated}`);
|
|
265
251
|
await delay(3e3);
|
|
266
252
|
return handler(argv);
|
|
267
|
-
}
|
|
253
|
+
}
|
|
268
254
|
};
|
|
269
255
|
}
|
|
270
256
|
return module;
|
|
271
257
|
}
|
|
272
|
-
__name(withDeprecationWarning, "withDeprecationWarning");
|
|
273
258
|
|
|
274
259
|
// src/dumpProviders.ts
|
|
275
260
|
var CANONICAL_ACTOR_ORDER = [
|
|
@@ -307,11 +292,8 @@ function enumerateLocator(locator) {
|
|
|
307
292
|
}
|
|
308
293
|
}
|
|
309
294
|
}
|
|
310
|
-
return [
|
|
311
|
-
...collapsed.values()
|
|
312
|
-
].toSorted((a, b) => a.moniker.localeCompare(b.moniker) || a.providerName.localeCompare(b.providerName));
|
|
295
|
+
return [...collapsed.values()].toSorted((a, b) => a.moniker.localeCompare(b.moniker) || a.providerName.localeCompare(b.providerName));
|
|
313
296
|
}
|
|
314
|
-
__name(enumerateLocator, "enumerateLocator");
|
|
315
297
|
function buildOwnerIndex(perActor) {
|
|
316
298
|
const monikerOwners = /* @__PURE__ */ new Map();
|
|
317
299
|
for (const [actorName, entries] of perActor) {
|
|
@@ -326,27 +308,16 @@ function buildOwnerIndex(perActor) {
|
|
|
326
308
|
}
|
|
327
309
|
return monikerOwners;
|
|
328
310
|
}
|
|
329
|
-
__name(buildOwnerIndex, "buildOwnerIndex");
|
|
330
311
|
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));
|
|
312
|
+
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
313
|
if (duplicates.length === 0) return [];
|
|
340
|
-
const lines = [
|
|
341
|
-
"Duplicate monikers (registered by more than one locator):"
|
|
342
|
-
];
|
|
314
|
+
const lines = ["Duplicate monikers (registered by more than one locator):"];
|
|
343
315
|
for (const { moniker, owners } of duplicates) {
|
|
344
316
|
lines.push(` - ${moniker}: ${owners.join(", ")}`);
|
|
345
317
|
}
|
|
346
318
|
lines.push("");
|
|
347
319
|
return lines;
|
|
348
320
|
}
|
|
349
|
-
__name(renderDuplicatesSummary, "renderDuplicatesSummary");
|
|
350
321
|
function groupActorsBySharedRegistry(locators) {
|
|
351
322
|
const groups = [];
|
|
352
323
|
for (const actorName of Object.keys(locators)) {
|
|
@@ -356,9 +327,7 @@ function groupActorsBySharedRegistry(locators) {
|
|
|
356
327
|
existing.actorNames.push(actorName);
|
|
357
328
|
} else {
|
|
358
329
|
groups.push({
|
|
359
|
-
actorNames: [
|
|
360
|
-
actorName
|
|
361
|
-
],
|
|
330
|
+
actorNames: [actorName],
|
|
362
331
|
locator,
|
|
363
332
|
registry: locator.registry
|
|
364
333
|
});
|
|
@@ -366,27 +335,18 @@ function groupActorsBySharedRegistry(locators) {
|
|
|
366
335
|
}
|
|
367
336
|
return groups;
|
|
368
337
|
}
|
|
369
|
-
__name(groupActorsBySharedRegistry, "groupActorsBySharedRegistry");
|
|
370
338
|
function groupId(actorNames) {
|
|
371
|
-
return [
|
|
372
|
-
...actorNames
|
|
373
|
-
].toSorted().join(",");
|
|
339
|
+
return [...actorNames].toSorted().join(",");
|
|
374
340
|
}
|
|
375
|
-
__name(groupId, "groupId");
|
|
376
341
|
function formatGroupForDisplay(groupKey) {
|
|
377
342
|
const members = groupKey.split(",");
|
|
378
343
|
return members.length === 1 ? members[0] : `(${members.join(", ")})`;
|
|
379
344
|
}
|
|
380
|
-
__name(formatGroupForDisplay, "formatGroupForDisplay");
|
|
381
345
|
function renderGroupSection(actorNames, entries, monikerOwners) {
|
|
382
|
-
const sortedActors = [
|
|
383
|
-
...actorNames
|
|
384
|
-
].toSorted();
|
|
346
|
+
const sortedActors = [...actorNames].toSorted();
|
|
385
347
|
const ownGroupKey = groupId(sortedActors);
|
|
386
348
|
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
|
-
];
|
|
349
|
+
const lines = [heading];
|
|
390
350
|
if (entries.length === 0) {
|
|
391
351
|
lines.push(" (none)", "");
|
|
392
352
|
return lines;
|
|
@@ -396,9 +356,7 @@ function renderGroupSection(actorNames, entries, monikerOwners) {
|
|
|
396
356
|
const isLast = i === entries.length - 1;
|
|
397
357
|
const branch = isLast ? "\u2514\u2500\u2500" : "\u251C\u2500\u2500";
|
|
398
358
|
const owners = monikerOwners.get(entry.moniker) ?? /* @__PURE__ */ new Set();
|
|
399
|
-
const otherOwners = [
|
|
400
|
-
...owners
|
|
401
|
-
].filter((o) => o !== ownGroupKey).toSorted().map(formatGroupForDisplay);
|
|
359
|
+
const otherOwners = [...owners].filter((o) => o !== ownGroupKey).toSorted().map(formatGroupForDisplay);
|
|
402
360
|
const dupNote = otherOwners.length > 0 ? ` \u26A0 also in: ${otherOwners.join(", ")}` : "";
|
|
403
361
|
const depsNote = entry.dependencies.length > 0 ? `, deps: [${entry.dependencies.join(", ")}]` : "";
|
|
404
362
|
const countNote = entry.count > 1 ? ` (\xD7${entry.count})` : "";
|
|
@@ -407,19 +365,13 @@ function renderGroupSection(actorNames, entries, monikerOwners) {
|
|
|
407
365
|
lines.push("");
|
|
408
366
|
return lines;
|
|
409
367
|
}
|
|
410
|
-
__name(renderGroupSection, "renderGroupSection");
|
|
411
368
|
function formatProviderTree(locators) {
|
|
412
369
|
const groups = groupActorsBySharedRegistry(locators);
|
|
413
|
-
const groupKeys = groups.map((g) => ({
|
|
414
|
-
...g,
|
|
415
|
-
key: groupId(g.actorNames)
|
|
416
|
-
}));
|
|
370
|
+
const groupKeys = groups.map((g) => ({ ...g, key: groupId(g.actorNames) }));
|
|
417
371
|
const perGroup = /* @__PURE__ */ new Map();
|
|
418
372
|
for (const g of groupKeys) perGroup.set(g.key, enumerateLocator(g.locator));
|
|
419
373
|
const monikerOwners = buildOwnerIndex(perGroup);
|
|
420
|
-
const orderedGroups = [
|
|
421
|
-
...groupKeys
|
|
422
|
-
].toSorted((a, b) => {
|
|
374
|
+
const orderedGroups = [...groupKeys].toSorted((a, b) => {
|
|
423
375
|
const aHasRoot = a.actorNames.includes("_root");
|
|
424
376
|
const bHasRoot = b.actorNames.includes("_root");
|
|
425
377
|
if (aHasRoot !== bHasRoot) return aHasRoot ? -1 : 1;
|
|
@@ -428,18 +380,13 @@ function formatProviderTree(locators) {
|
|
|
428
380
|
if (ai !== bi) return (ai === -1 ? Number.MAX_SAFE_INTEGER : ai) - (bi === -1 ? Number.MAX_SAFE_INTEGER : bi);
|
|
429
381
|
return a.key.localeCompare(b.key);
|
|
430
382
|
});
|
|
431
|
-
const lines = [
|
|
432
|
-
"XL1 Provider Dump",
|
|
433
|
-
"=================",
|
|
434
|
-
""
|
|
435
|
-
];
|
|
383
|
+
const lines = ["XL1 Provider Dump", "=================", ""];
|
|
436
384
|
for (const g of orderedGroups) {
|
|
437
385
|
lines.push(...renderGroupSection(g.actorNames.toSorted(), perGroup.get(g.key) ?? [], monikerOwners));
|
|
438
386
|
}
|
|
439
387
|
lines.push(...renderDuplicatesSummary(monikerOwners));
|
|
440
388
|
return lines.join("\n");
|
|
441
389
|
}
|
|
442
|
-
__name(formatProviderTree, "formatProviderTree");
|
|
443
390
|
|
|
444
391
|
// src/images.ts
|
|
445
392
|
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
|
|
@@ -464,10 +411,10 @@ var XL1LogoColorizedAscii = `\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\
|
|
|
464
411
|
// src/optionsFromGlobalZodRegistry.ts
|
|
465
412
|
import { isUsageMeta } from "@xyo-network/xl1-sdk";
|
|
466
413
|
import { globalRegistry } from "zod";
|
|
467
|
-
var usageMetaToOptions =
|
|
414
|
+
var usageMetaToOptions = (meta) => {
|
|
468
415
|
return meta;
|
|
469
|
-
}
|
|
470
|
-
var optionsFromGlobalZodRegistry =
|
|
416
|
+
};
|
|
417
|
+
var optionsFromGlobalZodRegistry = () => {
|
|
471
418
|
const opts = {};
|
|
472
419
|
for (const schema of Object.values(globalRegistry._map)) {
|
|
473
420
|
if (isUsageMeta(schema)) {
|
|
@@ -476,7 +423,7 @@ var optionsFromGlobalZodRegistry = /* @__PURE__ */ __name(() => {
|
|
|
476
423
|
}
|
|
477
424
|
}
|
|
478
425
|
return opts;
|
|
479
|
-
}
|
|
426
|
+
};
|
|
480
427
|
|
|
481
428
|
// src/runCLI.ts
|
|
482
429
|
var DEFAULT_HEALTH_CHECK_PORT = 9090;
|
|
@@ -485,31 +432,25 @@ function defaultScrapePortForActors(actors) {
|
|
|
485
432
|
const key = primary === "rewardRedemption" ? "rewardRedemptionApi" : primary;
|
|
486
433
|
return DefaultMetricsScrapePorts[key] ?? DefaultMetricsScrapePorts.producer;
|
|
487
434
|
}
|
|
488
|
-
__name(defaultScrapePortForActors, "defaultScrapePortForActors");
|
|
489
435
|
var configuration;
|
|
490
436
|
var skipInsecureConfirm = false;
|
|
491
437
|
var dumpProviders = false;
|
|
492
|
-
var version = isDefined3("1.23.
|
|
438
|
+
var version = isDefined3("1.23.2") ? "1.23.2" : "unknown";
|
|
493
439
|
function getConfiguration() {
|
|
494
440
|
return configuration;
|
|
495
441
|
}
|
|
496
|
-
__name(getConfiguration, "getConfiguration");
|
|
497
442
|
async function promptForInsecureGenesisConfirmation(logger) {
|
|
498
443
|
if (!input.isTTY || !output.isTTY) {
|
|
499
444
|
logger.warn("Insecure genesis reward wallet is active. Interactive confirmation skipped because this session is not a TTY.");
|
|
500
445
|
return;
|
|
501
446
|
}
|
|
502
|
-
const rl = createInterface({
|
|
503
|
-
input,
|
|
504
|
-
output
|
|
505
|
-
});
|
|
447
|
+
const rl = createInterface({ input, output });
|
|
506
448
|
try {
|
|
507
449
|
await rl.question("Insecure genesis reward wallet is active. Hit RETURN to continue.");
|
|
508
450
|
} finally {
|
|
509
451
|
rl.close();
|
|
510
452
|
}
|
|
511
453
|
}
|
|
512
|
-
__name(promptForInsecureGenesisConfirmation, "promptForInsecureGenesisConfirmation");
|
|
513
454
|
async function getLocatorsFromConfig(actors, configuration2) {
|
|
514
455
|
const actorConfigs = [];
|
|
515
456
|
for (const actorName of actors) {
|
|
@@ -517,20 +458,13 @@ async function getLocatorsFromConfig(actors, configuration2) {
|
|
|
517
458
|
if (existingConfig) {
|
|
518
459
|
actorConfigs.push(existingConfig);
|
|
519
460
|
} else {
|
|
520
|
-
const actorConfig = ActorConfigZod.loose().parse({
|
|
521
|
-
name: actorName
|
|
522
|
-
});
|
|
461
|
+
const actorConfig = ActorConfigZod.loose().parse({ name: actorName });
|
|
523
462
|
actorConfigs.push(actorConfig);
|
|
524
463
|
}
|
|
525
464
|
}
|
|
526
|
-
const config2 = ConfigZod2.parse({
|
|
527
|
-
...configuration2,
|
|
528
|
-
actors: actorConfigs
|
|
529
|
-
});
|
|
465
|
+
const config2 = ConfigZod2.parse({ ...configuration2, actors: actorConfigs });
|
|
530
466
|
const logger = initLogger(configuration2);
|
|
531
|
-
const orchestrator = await Orchestrator.create({
|
|
532
|
-
logger
|
|
533
|
-
});
|
|
467
|
+
const orchestrator = await Orchestrator.create({ logger });
|
|
534
468
|
const collision = detectDerivationPathCollisions(actors, configuration2);
|
|
535
469
|
if (collision) throw collision;
|
|
536
470
|
const walletReport = await initializeResolvedWalletReport(actors, configuration2);
|
|
@@ -567,12 +501,8 @@ async function getLocatorsFromConfig(actors, configuration2) {
|
|
|
567
501
|
}
|
|
568
502
|
})();
|
|
569
503
|
});
|
|
570
|
-
return {
|
|
571
|
-
locators,
|
|
572
|
-
orchestrator
|
|
573
|
-
};
|
|
504
|
+
return { locators, orchestrator };
|
|
574
505
|
}
|
|
575
|
-
__name(getLocatorsFromConfig, "getLocatorsFromConfig");
|
|
576
506
|
async function runCLI() {
|
|
577
507
|
const y = yargs(hideBin(process.argv));
|
|
578
508
|
const argv = y.usage(`
|
|
@@ -583,8 +513,11 @@ Run various components of the XL1 ecosystem.
|
|
|
583
513
|
Usage:
|
|
584
514
|
$0 <command> [options]`).parserConfiguration({
|
|
585
515
|
"dot-notation": true,
|
|
516
|
+
// foo.bar → { foo: { bar } }
|
|
586
517
|
"parse-numbers": false,
|
|
518
|
+
// Don't auto-parse numbers to allow strings like "0x1"
|
|
587
519
|
"populate--": true
|
|
520
|
+
// Populate -- with all options so we can detected user-supplied vs defaults
|
|
588
521
|
}).env("XL1").scriptName("xl1").middleware(async (argv2) => {
|
|
589
522
|
await configMiddleware(argv2, (config2) => {
|
|
590
523
|
configuration = config2;
|
|
@@ -624,16 +557,13 @@ $0 <command> [options]`).parserConfiguration({
|
|
|
624
557
|
}).help().alias("help", "h").version(version).argv;
|
|
625
558
|
await argv;
|
|
626
559
|
}
|
|
627
|
-
__name(runCLI, "runCLI");
|
|
628
560
|
|
|
629
561
|
// src/start.ts
|
|
630
562
|
import { config } from "dotenv";
|
|
631
|
-
var start =
|
|
632
|
-
config({
|
|
633
|
-
quiet: true
|
|
634
|
-
});
|
|
563
|
+
var start = async () => {
|
|
564
|
+
config({ quiet: true });
|
|
635
565
|
await runCLI();
|
|
636
|
-
}
|
|
566
|
+
};
|
|
637
567
|
export {
|
|
638
568
|
configMiddleware,
|
|
639
569
|
initLogger,
|
|
@@ -641,4 +571,4 @@ export {
|
|
|
641
571
|
runCLI,
|
|
642
572
|
start
|
|
643
573
|
};
|
|
644
|
-
//# sourceMappingURL=index.mjs.map
|
|
574
|
+
//# sourceMappingURL=index.mjs.map
|