@xyo-network/xl1-cli-lib 1.19.8 → 1.19.9
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/commands/bridge/runBridge.d.ts +3 -8
- package/dist/node/commands/bridge/runBridge.d.ts.map +1 -1
- package/dist/node/commands/index.d.ts +0 -1
- package/dist/node/commands/index.d.ts.map +1 -1
- package/dist/node/commands/rewardRedemption/runRewardRedemptionApi.d.ts +3 -8
- package/dist/node/commands/rewardRedemption/runRewardRedemptionApi.d.ts.map +1 -1
- package/dist/node/commands/validator/runValidator.d.ts +3 -11
- package/dist/node/commands/validator/runValidator.d.ts.map +1 -1
- package/dist/node/index.mjs +174 -77
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/locatorFromConfig.d.ts +5 -1
- package/dist/node/locatorFromConfig.d.ts.map +1 -1
- package/dist/node/runCLI.d.ts.map +1 -1
- package/dist/node/xl1.mjs +174 -77
- package/dist/node/xl1.mjs.map +1 -1
- package/package.json +18 -17
- package/src/commands/bridge/runBridge.ts +24 -9
- package/src/commands/index.ts +0 -1
- package/src/commands/rewardRedemption/runRewardRedemptionApi.ts +22 -9
- package/src/commands/validator/runValidator.ts +15 -28
- package/src/locatorFromConfig.ts +141 -3
- package/src/runCLI.ts +13 -19
- package/dist/node/commands/mempool/index.d.ts +0 -2
- package/dist/node/commands/mempool/index.d.ts.map +0 -1
- package/dist/node/commands/mempool/runMempool.d.ts +0 -9
- package/dist/node/commands/mempool/runMempool.d.ts.map +0 -1
- package/src/commands/mempool/index.ts +0 -1
- package/src/commands/mempool/runMempool.ts +0 -12
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { Config } from '@xyo-network/xl1-sdk';
|
|
3
|
-
|
|
4
|
-
config: Config;
|
|
5
|
-
logger?: Logger;
|
|
6
|
-
}
|
|
7
|
-
export declare function runBridge(context: RunBridgeContext): void;
|
|
8
|
-
export {};
|
|
1
|
+
import { type OrchestratorInstance } from '@xyo-network/chain-orchestration';
|
|
2
|
+
import type { Config, ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk';
|
|
3
|
+
export declare const runBridge: (config: Config, orchestrator: OrchestratorInstance, locator: ProviderFactoryLocatorInstance) => Promise<void>;
|
|
9
4
|
//# sourceMappingURL=runBridge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runBridge.d.ts","sourceRoot":"","sources":["../../../../src/commands/bridge/runBridge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runBridge.d.ts","sourceRoot":"","sources":["../../../../src/commands/bridge/runBridge.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AAC9F,OAAO,KAAK,EACV,MAAM,EACN,8BAA8B,EAC/B,MAAM,sBAAsB,CAAA;AAE7B,eAAO,MAAM,SAAS,GACpB,QAAQ,MAAM,EACd,cAAc,oBAAoB,EAClC,SAAS,8BAA8B,kBAexC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,sBAAsB,CAAA"}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Config } from '@xyo-network/xl1-sdk';
|
|
3
|
-
|
|
4
|
-
config: Config;
|
|
5
|
-
logger?: Logger;
|
|
6
|
-
}
|
|
7
|
-
export declare function runRewardRedemptionApi(context: RunRewardRedemptionApiContext): void;
|
|
8
|
-
export {};
|
|
1
|
+
import type { OrchestratorInstance } from '@xyo-network/chain-orchestration';
|
|
2
|
+
import type { Config, ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk';
|
|
3
|
+
export declare function runRewardRedemptionApi(config: Config, orchestrator: OrchestratorInstance, locator: ProviderFactoryLocatorInstance): Promise<void>;
|
|
9
4
|
//# sourceMappingURL=runRewardRedemptionApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runRewardRedemptionApi.d.ts","sourceRoot":"","sources":["../../../../src/commands/rewardRedemption/runRewardRedemptionApi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runRewardRedemptionApi.d.ts","sourceRoot":"","sources":["../../../../src/commands/rewardRedemption/runRewardRedemptionApi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AAG5E,OAAO,KAAK,EAAE,MAAM,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAA;AAElF,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,oBAAoB,EAClC,OAAO,EAAE,8BAA8B,iBAexC"}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
interface RunValidatorContext extends CachingContext {
|
|
5
|
-
account: AccountInstance;
|
|
6
|
-
config: Config;
|
|
7
|
-
locator: ProviderFactoryLocatorInstance;
|
|
8
|
-
orchestrator: OrchestratorInstance;
|
|
9
|
-
}
|
|
10
|
-
export declare const runValidator: (context: RunValidatorContext) => Promise<void>;
|
|
11
|
-
export {};
|
|
1
|
+
import { type OrchestratorInstance } from '@xyo-network/chain-orchestration';
|
|
2
|
+
import type { Config, ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk';
|
|
3
|
+
export declare const runValidator: (config: Config, orchestrator: OrchestratorInstance, locator: ProviderFactoryLocatorInstance) => Promise<void>;
|
|
12
4
|
//# sourceMappingURL=runValidator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runValidator.d.ts","sourceRoot":"","sources":["../../../../src/commands/validator/runValidator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runValidator.d.ts","sourceRoot":"","sources":["../../../../src/commands/validator/runValidator.ts"],"names":[],"mappings":"AACA,OAAO,EACgB,KAAK,oBAAoB,EAC/C,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EACV,MAAM,EACN,8BAA8B,EAC/B,MAAM,sBAAsB,CAAA;AAE7B,eAAO,MAAM,YAAY,GACvB,QAAQ,MAAM,EACd,cAAc,oBAAoB,EAClC,SAAS,8BAA8B,kBAexC,CAAA"}
|
package/dist/node/index.mjs
CHANGED
|
@@ -2,8 +2,9 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
4
|
// src/runCLI.ts
|
|
5
|
-
import { deepMerge, isDefined as
|
|
5
|
+
import { deepMerge, isDefined as isDefined4, toAddress } from "@xylabs/sdk-js";
|
|
6
6
|
import { runApi } from "@xyo-network/chain-api";
|
|
7
|
+
import { runMempool } from "@xyo-network/chain-mempool";
|
|
7
8
|
import { Orchestrator } from "@xyo-network/chain-orchestration";
|
|
8
9
|
import { runProducer } from "@xyo-network/chain-producer";
|
|
9
10
|
import { ConfigZod as ConfigZod2, isZodError } from "@xyo-network/xl1-sdk";
|
|
@@ -11,23 +12,49 @@ import yargs from "yargs";
|
|
|
11
12
|
import { hideBin } from "yargs/helpers";
|
|
12
13
|
|
|
13
14
|
// src/commands/bridge/runBridge.ts
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
import { exists } from "@xylabs/sdk-js";
|
|
16
|
+
import { BridgeActor } from "@xyo-network/chain-bridge";
|
|
17
|
+
import { initBridgeWallet } from "@xyo-network/chain-orchestration";
|
|
18
|
+
var runBridge = /* @__PURE__ */ __name(async (config2, orchestrator, locator) => {
|
|
19
|
+
const account = await initBridgeWallet({
|
|
20
|
+
config: config2,
|
|
21
|
+
logger: locator.context.logger
|
|
22
|
+
});
|
|
23
|
+
const api = await BridgeActor.create({
|
|
24
|
+
account,
|
|
25
|
+
config: config2,
|
|
26
|
+
locator
|
|
27
|
+
});
|
|
28
|
+
const actors = [
|
|
29
|
+
api
|
|
30
|
+
].filter(exists);
|
|
31
|
+
for (const actor of actors) {
|
|
32
|
+
await orchestrator.registerActor(actor);
|
|
33
|
+
}
|
|
34
|
+
await orchestrator.start();
|
|
35
|
+
}, "runBridge");
|
|
26
36
|
|
|
27
37
|
// src/commands/rewardRedemption/runRewardRedemptionApi.ts
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
|
|
38
|
+
import { exists as exists2 } from "@xylabs/sdk-js";
|
|
39
|
+
import { initRewardsRedemptionApiWallet } from "@xyo-network/chain-orchestration";
|
|
40
|
+
import { RewardRedemptionActor } from "@xyo-network/chain-reward-redemption";
|
|
41
|
+
async function runRewardRedemptionApi(config2, orchestrator, locator) {
|
|
42
|
+
const account = await initRewardsRedemptionApiWallet({
|
|
43
|
+
config: config2,
|
|
44
|
+
logger: locator.context.logger
|
|
45
|
+
});
|
|
46
|
+
const rewardRedemption = await RewardRedemptionActor.create({
|
|
47
|
+
account,
|
|
48
|
+
config: config2,
|
|
49
|
+
locator
|
|
50
|
+
});
|
|
51
|
+
const actors = [
|
|
52
|
+
rewardRedemption
|
|
53
|
+
].filter(exists2);
|
|
54
|
+
for (const actor of actors) {
|
|
55
|
+
await orchestrator.registerActor(actor);
|
|
56
|
+
}
|
|
57
|
+
await orchestrator.start();
|
|
31
58
|
}
|
|
32
59
|
__name(runRewardRedemptionApi, "runRewardRedemptionApi");
|
|
33
60
|
|
|
@@ -70,12 +97,13 @@ var initLogger = /* @__PURE__ */ __name((config2) => {
|
|
|
70
97
|
}, "initLogger");
|
|
71
98
|
|
|
72
99
|
// src/locatorFromConfig.ts
|
|
73
|
-
import { asAddress, assertEx, isString } from "@xylabs/sdk-js";
|
|
100
|
+
import { asAddress, assertEx, isDefined as isDefined2, isString } from "@xylabs/sdk-js";
|
|
74
101
|
import { initApiWallet, initBalanceSummaryMap, initEvmProvidersIfAvailable, initFinalizationArchivistIfNeeded, initProducerAccount, initServerNode, initStatusReporter, initTransferSummaryMap } from "@xyo-network/chain-orchestration";
|
|
75
102
|
import { SimpleBlockRunner } from "@xyo-network/chain-services";
|
|
76
103
|
import { initTelemetry } from "@xyo-network/chain-telemetry";
|
|
77
104
|
import { validateHydratedBlock, validateHydratedBlockState } from "@xyo-network/chain-validation";
|
|
78
|
-
import {
|
|
105
|
+
import { HDWallet } from "@xyo-network/wallet";
|
|
106
|
+
import { AccountBalanceViewerRpcSchemas, ADDRESS_INDEX, BlockViewerRpcSchemas, FinalizationViewerRpcSchemas, generateXyoBaseWalletFromPhrase, HttpRpcTransport, JsonRpcAccountBalanceViewer, JsonRpcBlockViewer, JsonRpcFinalizationViewer, JsonRpcMempoolRunner, JsonRpcMempoolViewer, MempoolRunnerRpcSchemas, MempoolViewerRpcSchemas, ProviderFactoryLocator, SimpleAccountBalanceViewer, SimpleBlockRewardViewer, SimpleBlockValidationViewer, SimpleBlockViewer, SimpleFinalizationViewer, SimpleMempoolRunner, SimpleMempoolViewer, SimpleNetworkStakeViewer, SimpleStepRewardsByPositionViewer, SimpleStepRewardsByStakerViewer, SimpleStepRewardsByStepViewer, SimpleStepRewardsTotalViewer, SimpleStepRewardsViewer, SimpleStepViewer, SimpleTimeSyncViewer, SimpleWindowedBlockViewer, SimpleXyoConnectionRunner, SimpleXyoConnectionViewer, SimpleXyoGatewayRunner, SimpleXyoRunner, SimpleXyoSigner, SimpleXyoViewer } from "@xyo-network/xl1-sdk";
|
|
79
107
|
async function telemetryContextFromConfig(config2, serviceName, serviceVersion) {
|
|
80
108
|
const { otlpEndpoint } = config2.telemetry?.otel ?? {};
|
|
81
109
|
const { path: endpoint = "/metrics", port = 9466 } = config2.telemetry?.metrics?.scrape ?? {};
|
|
@@ -172,7 +200,10 @@ async function localLocatorFromConfig(config2, context) {
|
|
|
172
200
|
maxWindowSize: 1e4,
|
|
173
201
|
syncInterval: 1e4
|
|
174
202
|
}),
|
|
175
|
-
|
|
203
|
+
SimpleXyoConnectionViewer.factory(SimpleXyoConnectionViewer.dependencies, {}),
|
|
204
|
+
SimpleXyoViewer.factory(SimpleXyoViewer.dependencies, {
|
|
205
|
+
finalizedArchivist: readonlyChainArchivist
|
|
206
|
+
})
|
|
176
207
|
]);
|
|
177
208
|
locator.freeze();
|
|
178
209
|
return locator;
|
|
@@ -212,7 +243,9 @@ async function remoteLocatorFromConfig(config2, context) {
|
|
|
212
243
|
maxWindowSize: 1e4,
|
|
213
244
|
syncInterval: 1e4
|
|
214
245
|
}),
|
|
215
|
-
SimpleXyoViewer.factory(SimpleXyoViewer.dependencies, {
|
|
246
|
+
SimpleXyoViewer.factory(SimpleXyoViewer.dependencies, {
|
|
247
|
+
finalizedArchivist: readonlyChainArchivist
|
|
248
|
+
})
|
|
216
249
|
]);
|
|
217
250
|
locator.freeze();
|
|
218
251
|
return locator;
|
|
@@ -229,6 +262,27 @@ async function producerLocatorFromConfig(config2, context) {
|
|
|
229
262
|
if (rewardAddress === account.address) {
|
|
230
263
|
logger?.warn(`Using producer account address as reward address: ${account.address}`);
|
|
231
264
|
}
|
|
265
|
+
const remoteUrl = config2.remote.rpc?.url;
|
|
266
|
+
if (isString(remoteUrl)) {
|
|
267
|
+
const transportFactory = /* @__PURE__ */ __name((schemas) => new HttpRpcTransport(remoteUrl, schemas), "transportFactory");
|
|
268
|
+
locator.registerMany([
|
|
269
|
+
JsonRpcMempoolViewer.factory(JsonRpcMempoolViewer.dependencies, {
|
|
270
|
+
transport: await transportFactory(MempoolViewerRpcSchemas)
|
|
271
|
+
}),
|
|
272
|
+
JsonRpcMempoolRunner.factory(JsonRpcMempoolRunner.dependencies, {
|
|
273
|
+
transport: await transportFactory(MempoolRunnerRpcSchemas)
|
|
274
|
+
}),
|
|
275
|
+
JsonRpcAccountBalanceViewer.factory(JsonRpcAccountBalanceViewer.dependencies, {
|
|
276
|
+
transport: await transportFactory(AccountBalanceViewerRpcSchemas)
|
|
277
|
+
}),
|
|
278
|
+
JsonRpcFinalizationViewer.factory(JsonRpcFinalizationViewer.dependencies, {
|
|
279
|
+
transport: await transportFactory(FinalizationViewerRpcSchemas)
|
|
280
|
+
}),
|
|
281
|
+
JsonRpcBlockViewer.factory(JsonRpcBlockViewer.dependencies, {
|
|
282
|
+
transport: await transportFactory(BlockViewerRpcSchemas)
|
|
283
|
+
})
|
|
284
|
+
]);
|
|
285
|
+
}
|
|
232
286
|
locator.registerMany([
|
|
233
287
|
SimpleBlockRewardViewer.factory(SimpleBlockRewardViewer.dependencies, {}),
|
|
234
288
|
SimpleBlockRunner.factory(SimpleBlockRunner.dependencies, {
|
|
@@ -240,6 +294,68 @@ async function producerLocatorFromConfig(config2, context) {
|
|
|
240
294
|
return locator;
|
|
241
295
|
}
|
|
242
296
|
__name(producerLocatorFromConfig, "producerLocatorFromConfig");
|
|
297
|
+
function apiLocatorFromConfig(config2, context) {
|
|
298
|
+
const locator = new ProviderFactoryLocator(context);
|
|
299
|
+
locator.registerMany([]);
|
|
300
|
+
locator.freeze();
|
|
301
|
+
return locator;
|
|
302
|
+
}
|
|
303
|
+
__name(apiLocatorFromConfig, "apiLocatorFromConfig");
|
|
304
|
+
function mempoolLocatorFromConfig(config2, context) {
|
|
305
|
+
const locator = new ProviderFactoryLocator(context);
|
|
306
|
+
locator.registerMany([]);
|
|
307
|
+
locator.freeze();
|
|
308
|
+
return locator;
|
|
309
|
+
}
|
|
310
|
+
__name(mempoolLocatorFromConfig, "mempoolLocatorFromConfig");
|
|
311
|
+
async function bridgeLocatorFromConfig(config2, context) {
|
|
312
|
+
const locator = new ProviderFactoryLocator(context);
|
|
313
|
+
const { mnemonic } = config2.actors.bridge;
|
|
314
|
+
const walletPhrase = isDefined2(mnemonic) ? mnemonic : HDWallet.generateMnemonic();
|
|
315
|
+
const wallet = await generateXyoBaseWalletFromPhrase(walletPhrase);
|
|
316
|
+
const signerAccount = await wallet.derivePath(ADDRESS_INDEX.XYO);
|
|
317
|
+
const remoteUrl = config2.actors.bridge.remote.rpc?.url;
|
|
318
|
+
if (isString(remoteUrl)) {
|
|
319
|
+
const transportFactory = /* @__PURE__ */ __name((schemas) => new HttpRpcTransport(remoteUrl, schemas), "transportFactory");
|
|
320
|
+
locator.registerMany([
|
|
321
|
+
JsonRpcMempoolViewer.factory(JsonRpcMempoolViewer.dependencies, {
|
|
322
|
+
transport: await transportFactory(MempoolViewerRpcSchemas)
|
|
323
|
+
}),
|
|
324
|
+
JsonRpcMempoolRunner.factory(JsonRpcMempoolRunner.dependencies, {
|
|
325
|
+
transport: await transportFactory(MempoolRunnerRpcSchemas)
|
|
326
|
+
}),
|
|
327
|
+
JsonRpcAccountBalanceViewer.factory(JsonRpcAccountBalanceViewer.dependencies, {
|
|
328
|
+
transport: await transportFactory(AccountBalanceViewerRpcSchemas)
|
|
329
|
+
}),
|
|
330
|
+
JsonRpcFinalizationViewer.factory(JsonRpcFinalizationViewer.dependencies, {
|
|
331
|
+
transport: await transportFactory(FinalizationViewerRpcSchemas)
|
|
332
|
+
}),
|
|
333
|
+
JsonRpcBlockViewer.factory(JsonRpcBlockViewer.dependencies, {
|
|
334
|
+
transport: await transportFactory(BlockViewerRpcSchemas)
|
|
335
|
+
})
|
|
336
|
+
]);
|
|
337
|
+
}
|
|
338
|
+
locator.registerMany([
|
|
339
|
+
SimpleXyoSigner.factory(SimpleXyoSigner.dependencies, {
|
|
340
|
+
account: signerAccount
|
|
341
|
+
}),
|
|
342
|
+
SimpleXyoRunner.factory(SimpleXyoRunner.dependencies, {}),
|
|
343
|
+
SimpleXyoConnectionRunner.factory(SimpleXyoConnectionRunner.dependencies, {}),
|
|
344
|
+
SimpleXyoGatewayRunner.factory(SimpleXyoGatewayRunner.dependencies, {})
|
|
345
|
+
]);
|
|
346
|
+
locator.freeze();
|
|
347
|
+
return locator;
|
|
348
|
+
}
|
|
349
|
+
__name(bridgeLocatorFromConfig, "bridgeLocatorFromConfig");
|
|
350
|
+
function rewardRedemptionLocatorFromConfig(config2, context) {
|
|
351
|
+
const locator = new ProviderFactoryLocator(context);
|
|
352
|
+
locator.registerMany([
|
|
353
|
+
SimpleXyoGatewayRunner.factory(SimpleXyoGatewayRunner.dependencies, {})
|
|
354
|
+
]);
|
|
355
|
+
locator.freeze();
|
|
356
|
+
return locator;
|
|
357
|
+
}
|
|
358
|
+
__name(rewardRedemptionLocatorFromConfig, "rewardRedemptionLocatorFromConfig");
|
|
243
359
|
async function locatorsFromConfig(actors, config2, context) {
|
|
244
360
|
const result = {
|
|
245
361
|
_root: await rootLocatorFromConfig(config2, context)
|
|
@@ -248,6 +364,22 @@ async function locatorsFromConfig(actors, config2, context) {
|
|
|
248
364
|
if (producer) {
|
|
249
365
|
result.producer = producer;
|
|
250
366
|
}
|
|
367
|
+
const api = actors.includes("api") ? await apiLocatorFromConfig(config2, result._root.context) : void 0;
|
|
368
|
+
if (api) {
|
|
369
|
+
result.api = api;
|
|
370
|
+
}
|
|
371
|
+
const mempool = actors.includes("mempool") ? await mempoolLocatorFromConfig(config2, result._root.context) : void 0;
|
|
372
|
+
if (mempool) {
|
|
373
|
+
result.mempool = mempool;
|
|
374
|
+
}
|
|
375
|
+
const bridge = actors.includes("bridge") ? await bridgeLocatorFromConfig(config2, result._root.context) : void 0;
|
|
376
|
+
if (bridge) {
|
|
377
|
+
result.bridge = bridge;
|
|
378
|
+
}
|
|
379
|
+
const rewardRedemption = actors.includes("rewardRedemption") ? await rewardRedemptionLocatorFromConfig(config2, result._root.context) : void 0;
|
|
380
|
+
if (rewardRedemption) {
|
|
381
|
+
result.rewardRedemption = rewardRedemption;
|
|
382
|
+
}
|
|
251
383
|
return result;
|
|
252
384
|
}
|
|
253
385
|
__name(locatorsFromConfig, "locatorsFromConfig");
|
|
@@ -270,7 +402,7 @@ var optionsFromGlobalZodRegistry = /* @__PURE__ */ __name(() => {
|
|
|
270
402
|
}, "optionsFromGlobalZodRegistry");
|
|
271
403
|
|
|
272
404
|
// src/tryParseConfig.ts
|
|
273
|
-
import { isDefined as
|
|
405
|
+
import { isDefined as isDefined3, isNull } from "@xylabs/sdk-js";
|
|
274
406
|
import { ConfigZod } from "@xyo-network/xl1-sdk";
|
|
275
407
|
import { cosmiconfigSync } from "cosmiconfig";
|
|
276
408
|
var configName = "xyo";
|
|
@@ -280,7 +412,7 @@ var tryParseConfig = /* @__PURE__ */ __name(() => {
|
|
|
280
412
|
const result = explorer.search();
|
|
281
413
|
if (!isNull(result)) {
|
|
282
414
|
const section = result?.config?.[configSection];
|
|
283
|
-
if (
|
|
415
|
+
if (isDefined3(section) && typeof section === "object") {
|
|
284
416
|
return ConfigZod.parse(section);
|
|
285
417
|
}
|
|
286
418
|
}
|
|
@@ -310,7 +442,7 @@ var waitForHostPort = /* @__PURE__ */ __name((host, port) => {
|
|
|
310
442
|
|
|
311
443
|
// src/runCLI.ts
|
|
312
444
|
var configuration;
|
|
313
|
-
var version =
|
|
445
|
+
var version = isDefined4("1.19.8") ? "1.19.8" : "unknown";
|
|
314
446
|
function resolveConfig(config2) {
|
|
315
447
|
const logger = console;
|
|
316
448
|
const defaultChainId = toAddress("1");
|
|
@@ -322,29 +454,6 @@ function resolveConfig(config2) {
|
|
|
322
454
|
return resolved;
|
|
323
455
|
}
|
|
324
456
|
__name(resolveConfig, "resolveConfig");
|
|
325
|
-
var getContextFromConfig = /* @__PURE__ */ __name(async (configuration2) => {
|
|
326
|
-
const logger = initLogger(configuration2);
|
|
327
|
-
const orchestrator = await Orchestrator.create({
|
|
328
|
-
logger
|
|
329
|
-
});
|
|
330
|
-
process.on("SIGINT", () => {
|
|
331
|
-
void (async () => {
|
|
332
|
-
try {
|
|
333
|
-
logger.log("\nSIGINT received. Attempting graceful shutdown...");
|
|
334
|
-
await orchestrator?.stop();
|
|
335
|
-
logger.log("Orchestrator stopped, exiting now.");
|
|
336
|
-
process.exit(0);
|
|
337
|
-
} catch (err) {
|
|
338
|
-
logger.error("Error stopping orchestrator:", err);
|
|
339
|
-
process.exit(1);
|
|
340
|
-
}
|
|
341
|
-
})();
|
|
342
|
-
});
|
|
343
|
-
return {
|
|
344
|
-
logger,
|
|
345
|
-
orchestrator
|
|
346
|
-
};
|
|
347
|
-
}, "getContextFromConfig");
|
|
348
457
|
var getLocatorsFromConfig = /* @__PURE__ */ __name(async (actors, configuration2) => {
|
|
349
458
|
const logger = initLogger(configuration2);
|
|
350
459
|
const orchestrator = await Orchestrator.create({
|
|
@@ -422,30 +531,26 @@ $0 <command> [options]`).parserConfiguration({
|
|
|
422
531
|
}).options(optionsFromGlobalZodRegistry()).wrap(y.terminalWidth()).command("api", "Run a XL1 API Node", (yargs2) => {
|
|
423
532
|
return yargs2.command("$0", "Run a XL1 API Node", () => {
|
|
424
533
|
}, async () => {
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
singletons: {}
|
|
430
|
-
});
|
|
534
|
+
const { locators, orchestrator } = await getLocatorsFromConfig([
|
|
535
|
+
"api"
|
|
536
|
+
], configuration);
|
|
537
|
+
await runApi(configuration, orchestrator, locators["api"]);
|
|
431
538
|
});
|
|
432
539
|
}).command("bridge", "Run a XL1 Bridge Node", (yargs2) => {
|
|
433
540
|
return yargs2.command("$0", "Run a XL1 Bridge Node", () => {
|
|
434
541
|
}, async () => {
|
|
435
|
-
const
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
});
|
|
542
|
+
const { locators, orchestrator } = await getLocatorsFromConfig([
|
|
543
|
+
"bridge"
|
|
544
|
+
], configuration);
|
|
545
|
+
await runBridge(configuration, orchestrator, locators["bridge"]);
|
|
440
546
|
});
|
|
441
547
|
}).command("mempool", "Run a XL1 Mempool Node", (yargs2) => {
|
|
442
548
|
return yargs2.command("$0", "Run a XL1 Mempool Node", () => {
|
|
443
549
|
}, async () => {
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
});
|
|
550
|
+
const { locators, orchestrator } = await getLocatorsFromConfig([
|
|
551
|
+
"mempool"
|
|
552
|
+
], configuration);
|
|
553
|
+
await runMempool(configuration, orchestrator, locators["mempool"]);
|
|
449
554
|
});
|
|
450
555
|
}).command("producer", "Run a XL1 Producer Node", (yargs2) => {
|
|
451
556
|
return yargs2.command("$0", "Run a XL1 Producer Node", () => {
|
|
@@ -458,11 +563,10 @@ $0 <command> [options]`).parserConfiguration({
|
|
|
458
563
|
}).command("reward-redemption-api", "Run a XL1 Rewards Redemption API Node", (yargs2) => {
|
|
459
564
|
return yargs2.command("$0", "Run a XL1 Rewards Redemption API Node", () => {
|
|
460
565
|
}, async () => {
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
});
|
|
566
|
+
const { locators, orchestrator } = await getLocatorsFromConfig([
|
|
567
|
+
"rewardRedemption"
|
|
568
|
+
], configuration);
|
|
569
|
+
await runRewardRedemptionApi(configuration, orchestrator, locators["rewardRedemption"]);
|
|
466
570
|
});
|
|
467
571
|
}).command("$0", "Run a full XL1 Node", () => {
|
|
468
572
|
}, async () => {
|
|
@@ -473,22 +577,15 @@ $0 <command> [options]`).parserConfiguration({
|
|
|
473
577
|
if (configuration.actors.mempool.enabled) {
|
|
474
578
|
actors.push("mempool");
|
|
475
579
|
}
|
|
476
|
-
const context = await getContextFromConfig(configuration);
|
|
477
580
|
const { locators, orchestrator } = await getLocatorsFromConfig([
|
|
581
|
+
"api",
|
|
478
582
|
"producer"
|
|
479
583
|
], configuration);
|
|
480
584
|
if (configuration.actors.mempool.enabled) {
|
|
481
|
-
runMempool(
|
|
482
|
-
...context,
|
|
483
|
-
config: configuration
|
|
484
|
-
});
|
|
585
|
+
await runMempool(configuration, orchestrator, locators["mempool"]);
|
|
485
586
|
await waitForHostPort(configuration.actors.mempool.host, configuration.actors.mempool.port);
|
|
486
587
|
}
|
|
487
|
-
await runApi(
|
|
488
|
-
...context,
|
|
489
|
-
config: configuration,
|
|
490
|
-
singletons: {}
|
|
491
|
-
});
|
|
588
|
+
await runApi(configuration, orchestrator, locators["api"]);
|
|
492
589
|
await waitForHostPort(configuration.actors.api.host, configuration.actors.api.port);
|
|
493
590
|
await runProducer(configuration, orchestrator, locators["producer"]);
|
|
494
591
|
}).options({
|