@xyo-network/xl1-cli 1.7.0 → 1.7.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/cli-min.mjs +99 -99
- package/{dist → lib}/node/commands/api/runApi.d.ts +2 -0
- package/lib/node/commands/api/runApi.d.ts.map +1 -0
- package/lib/node/commands/producer/createDeclaration.d.ts +3 -0
- package/lib/node/commands/producer/createDeclaration.d.ts.map +1 -0
- package/{dist → lib}/node/commands/producer/runProducer.d.ts +2 -0
- package/lib/node/commands/producer/runProducer.d.ts.map +1 -0
- package/lib/node/images.d.ts +2 -0
- package/lib/node/images.d.ts.map +1 -0
- package/lib/node/index.d.ts +4 -202
- package/lib/node/index.mjs +223 -131
- package/lib/node/index.mjs.map +1 -1
- package/lib/node/initConfig.d.ts +3 -0
- package/lib/node/initConfig.d.ts.map +1 -0
- package/lib/node/initLogger.d.ts +4 -0
- package/lib/node/initLogger.d.ts.map +1 -0
- package/lib/node/optionsFromZodSchema.d.ts +4 -0
- package/lib/node/optionsFromZodSchema.d.ts.map +1 -0
- package/lib/node/orchestration/ChainInitializableParams.d.ts +9 -0
- package/lib/node/orchestration/ChainInitializableParams.d.ts.map +1 -0
- package/{dist → lib}/node/orchestration/actor/implementation/ChainHeadUpdateActor.d.ts +1 -1
- package/{dist → lib}/node/orchestration/actor/implementation/ChainHeadUpdateActor.d.ts.map +1 -1
- package/{dist → lib}/node/orchestration/actor/implementation/ProducerActor.d.ts +1 -1
- package/{dist → lib}/node/orchestration/actor/implementation/ProducerActor.d.ts.map +1 -1
- package/lib/node/orchestration/archivists/ChainFinalized/archivist.d.ts +4 -0
- package/lib/node/orchestration/archivists/ChainFinalized/archivist.d.ts.map +1 -0
- package/{dist → lib}/node/orchestration/archivists/ChainFinalized/local.d.ts +1 -1
- package/{dist → lib}/node/orchestration/archivists/ChainFinalized/local.d.ts.map +1 -1
- package/{dist → lib}/node/orchestration/archivists/ChainFinalized/remote.d.ts +1 -1
- package/{dist → lib}/node/orchestration/archivists/ChainFinalized/remote.d.ts.map +1 -1
- package/{dist → lib}/node/orchestration/archivists/ChainSubmissions/archivist.d.ts +1 -1
- package/{dist → lib}/node/orchestration/archivists/ChainSubmissions/archivist.d.ts.map +1 -1
- package/{dist → lib}/node/orchestration/archivists/ChainSubmissions/remote.d.ts +1 -1
- package/{dist → lib}/node/orchestration/archivists/ChainSubmissions/remote.d.ts.map +1 -1
- package/lib/node/orchestration/archivists/PendingTransactions/archivist.d.ts +4 -0
- package/lib/node/orchestration/archivists/PendingTransactions/archivist.d.ts.map +1 -0
- package/{dist → lib}/node/orchestration/archivists/PendingTransactions/local.d.ts +1 -1
- package/{dist → lib}/node/orchestration/archivists/PendingTransactions/local.d.ts.map +1 -1
- package/{dist → lib}/node/orchestration/archivists/PendingTransactions/remote.d.ts +1 -1
- package/{dist → lib}/node/orchestration/archivists/PendingTransactions/remote.d.ts.map +1 -1
- package/lib/node/orchestration/archivists/RejectedTransactions/archivist.d.ts +4 -0
- package/lib/node/orchestration/archivists/RejectedTransactions/archivist.d.ts.map +1 -0
- package/{dist → lib}/node/orchestration/archivists/RejectedTransactions/local.d.ts +1 -1
- package/{dist → lib}/node/orchestration/archivists/RejectedTransactions/local.d.ts.map +1 -1
- package/{dist → lib}/node/orchestration/archivists/StakeIntentState/archivist.d.ts +2 -1
- package/{dist → lib}/node/orchestration/archivists/StakeIntentState/archivist.d.ts.map +1 -1
- package/{dist → lib}/node/orchestration/archivists/StakeIntentState/local.d.ts +1 -1
- package/{dist → lib}/node/orchestration/archivists/StakeIntentState/local.d.ts.map +1 -1
- package/lib/node/orchestration/initServices.d.ts +10 -0
- package/lib/node/orchestration/initServices.d.ts.map +1 -0
- package/lib/node/orchestration/map/BalanceSummary/initBalanceSummaryMap.d.ts +7 -0
- package/lib/node/orchestration/map/BalanceSummary/initBalanceSummaryMap.d.ts.map +1 -0
- package/lib/node/orchestration/map/BalanceSummary/local.d.ts +7 -0
- package/{dist → lib}/node/orchestration/map/BalanceSummary/local.d.ts.map +1 -1
- package/lib/node/orchestration/services/implementation/account.d.ts +4 -0
- package/{dist → lib}/node/orchestration/services/implementation/account.d.ts.map +1 -1
- package/lib/node/runCLI.d.ts +2 -0
- package/lib/node/runCLI.d.ts.map +1 -0
- package/lib/node/start.d.ts.map +1 -0
- package/lib/node/waitForHostPort.d.ts +2 -0
- package/lib/node/waitForHostPort.d.ts.map +1 -0
- package/lib/node/xl1.d.ts +2 -2
- package/lib/node/xl1.mjs +241 -149
- package/lib/node/xl1.mjs.map +1 -1
- package/package.json +38 -36
- package/rollup.config.mjs +14 -8
- package/src/commands/api/runApi.ts +3 -2
- package/src/commands/producer/createDeclaration.ts +3 -2
- package/src/commands/producer/runProducer.ts +3 -1
- package/src/images.ts +19 -0
- package/src/initConfig.ts +6 -0
- package/src/initLogger.ts +6 -5
- package/src/optionsFromZodSchema.ts +69 -0
- package/src/orchestration/ChainInitializableParams.ts +10 -0
- package/src/orchestration/archivists/ChainFinalized/archivist.ts +4 -4
- package/src/orchestration/archivists/ChainFinalized/local.ts +1 -1
- package/src/orchestration/archivists/ChainFinalized/remote.ts +1 -1
- package/src/orchestration/archivists/ChainSubmissions/archivist.ts +2 -2
- package/src/orchestration/archivists/ChainSubmissions/remote.ts +1 -1
- package/src/orchestration/archivists/PendingTransactions/archivist.ts +4 -4
- package/src/orchestration/archivists/PendingTransactions/local.ts +1 -1
- package/src/orchestration/archivists/PendingTransactions/remote.ts +1 -1
- package/src/orchestration/archivists/RejectedTransactions/archivist.ts +3 -3
- package/src/orchestration/archivists/RejectedTransactions/local.ts +1 -1
- package/src/orchestration/archivists/StakeIntentState/archivist.ts +10 -8
- package/src/orchestration/archivists/StakeIntentState/local.ts +1 -1
- package/src/orchestration/initServices.ts +36 -23
- package/src/orchestration/map/BalanceSummary/initBalanceSummaryMap.ts +3 -3
- package/src/orchestration/map/BalanceSummary/local.ts +2 -1
- package/src/orchestration/services/implementation/account.ts +4 -4
- package/src/runCLI.ts +82 -70
- package/src/start.ts +1 -22
- package/src/waitForHostPort.ts +26 -0
- package/src/xl1.ts +2 -1
- package/xy.config.ts +13 -2
- package/dist/node/commands/api/runApi.d.ts.map +0 -1
- package/dist/node/commands/producer/createDeclaration.d.ts +0 -2
- package/dist/node/commands/producer/createDeclaration.d.ts.map +0 -1
- package/dist/node/commands/producer/runProducer.d.ts.map +0 -1
- package/dist/node/index.d.ts +0 -4
- package/dist/node/initLogger.d.ts +0 -3
- package/dist/node/initLogger.d.ts.map +0 -1
- package/dist/node/orchestration/archivists/ChainFinalized/archivist.d.ts +0 -4
- package/dist/node/orchestration/archivists/ChainFinalized/archivist.d.ts.map +0 -1
- package/dist/node/orchestration/archivists/PendingTransactions/archivist.d.ts +0 -4
- package/dist/node/orchestration/archivists/PendingTransactions/archivist.d.ts.map +0 -1
- package/dist/node/orchestration/archivists/RejectedTransactions/archivist.d.ts +0 -4
- package/dist/node/orchestration/archivists/RejectedTransactions/archivist.d.ts.map +0 -1
- package/dist/node/orchestration/initServices.d.ts +0 -4
- package/dist/node/orchestration/initServices.d.ts.map +0 -1
- package/dist/node/orchestration/map/BalanceSummary/initBalanceSummaryMap.d.ts +0 -7
- package/dist/node/orchestration/map/BalanceSummary/initBalanceSummaryMap.d.ts.map +0 -1
- package/dist/node/orchestration/map/BalanceSummary/local.d.ts +0 -6
- package/dist/node/orchestration/services/implementation/account.d.ts +0 -4
- package/dist/node/runCLI.d.ts +0 -9
- package/dist/node/runCLI.d.ts.map +0 -1
- package/dist/node/start.d.ts.map +0 -1
- package/dist/node/xl1.d.ts +0 -2
- /package/{dist → lib}/node/commands/api/index.d.ts +0 -0
- /package/{dist → lib}/node/commands/api/index.d.ts.map +0 -0
- /package/{dist → lib}/node/commands/index.d.ts +0 -0
- /package/{dist → lib}/node/commands/index.d.ts.map +0 -0
- /package/{dist → lib}/node/commands/producer/index.d.ts +0 -0
- /package/{dist → lib}/node/commands/producer/index.d.ts.map +0 -0
- /package/{dist → lib}/node/commands/validator/index.d.ts +0 -0
- /package/{dist → lib}/node/commands/validator/index.d.ts.map +0 -0
- /package/{dist → lib}/node/commands/validator/runValidator.d.ts +0 -0
- /package/{dist → lib}/node/commands/validator/runValidator.d.ts.map +0 -0
- /package/{dist → lib}/node/index.d.ts.map +0 -0
- /package/{dist → lib}/node/initEnv.d.ts +0 -0
- /package/{dist → lib}/node/initEnv.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/actor/implementation/BalanceActor.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/actor/implementation/BalanceActor.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/actor/implementation/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/actor/implementation/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/actor/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/actor/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/actor/model/Actor.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/actor/model/Actor.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/actor/model/Orchestrator.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/actor/model/Orchestrator.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/actor/model/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/actor/model/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/archivists/ChainFinalized/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/archivists/ChainFinalized/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/archivists/ChainSubmissions/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/archivists/ChainSubmissions/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/archivists/PendingTransactions/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/archivists/PendingTransactions/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/archivists/RejectedTransactions/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/archivists/RejectedTransactions/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/archivists/StakeIntentState/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/archivists/StakeIntentState/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/archivists/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/archivists/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/archivists/lib/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/archivists/lib/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/archivists/lib/localPersistentArchivist.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/archivists/lib/localPersistentArchivist.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/health/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/health/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/health/initHealthEndpoints.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/health/initHealthEndpoints.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/host/implementation/DefaultHost.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/host/implementation/DefaultHost.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/host/implementation/DefaultServiceCollection.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/host/implementation/DefaultServiceCollection.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/host/implementation/DefaultServiceProvider.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/host/implementation/DefaultServiceProvider.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/host/implementation/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/host/implementation/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/host/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/host/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/host/model/Host.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/host/model/Host.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/host/model/ServiceCollection.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/host/model/ServiceCollection.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/host/model/ServiceProvider.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/host/model/ServiceProvider.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/host/model/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/host/model/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/map/BalanceSummary/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/map/BalanceSummary/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/map/driver/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/map/driver/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/map/driver/lmdb/Params.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/map/driver/lmdb/Params.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/map/driver/lmdb/SynchronousLmdbMap.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/map/driver/lmdb/SynchronousLmdbMap.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/map/driver/lmdb/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/map/driver/lmdb/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/map/driver/lmdb/spec/SynchronousLmdbMap.spec.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/map/driver/lmdb/spec/SynchronousLmdbMap.spec.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/map/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/map/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/map/localPersistentMap.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/map/localPersistentMap.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/repository/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/repository/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/repository/lib/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/repository/lib/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/repository/lib/repositoryFromArchivist.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/repository/lib/repositoryFromArchivist.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/balance.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/balance.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/chain/evm.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/chain/evm.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/chain/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/chain/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/evm/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/evm/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/evm/initChainId.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/evm/initChainId.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/evm/initEvmProvider.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/evm/initEvmProvider.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/evm/initGanacheProvider.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/evm/initGanacheProvider.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/evm/initInfuraProvider.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/evm/initInfuraProvider.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/head.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/head.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/iterator.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/iterator.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/pendingTransactions.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/pendingTransactions.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/producer.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/producer.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/reward.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/reward.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/validator.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/services/implementation/validator.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/services/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/services/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/status/RuntimeStatusMonitor.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/status/RuntimeStatusMonitor.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/status/ServiceStatus.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/status/ServiceStatus.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/status/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/status/index.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/store/StoreKind.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/store/StoreKind.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/store/getStoreDirectory.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/store/getStoreDirectory.d.ts.map +0 -0
- /package/{dist → lib}/node/orchestration/store/index.d.ts +0 -0
- /package/{dist → lib}/node/orchestration/store/index.d.ts.map +0 -0
- /package/{dist → lib}/node/spec/BootstrapChain.spec.d.ts +0 -0
- /package/{dist → lib}/node/spec/BootstrapChain.spec.d.ts.map +0 -0
- /package/{dist → lib}/node/start.d.ts +0 -0
- /package/{dist → lib}/node/xl1.d.ts.map +0 -0
package/lib/node/xl1.mjs
CHANGED
|
@@ -15,20 +15,19 @@ var initEnv = /* @__PURE__ */ __name(() => {
|
|
|
15
15
|
}
|
|
16
16
|
}, "initEnv");
|
|
17
17
|
|
|
18
|
-
// src/
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}, "initLogger");
|
|
18
|
+
// src/runCLI.ts
|
|
19
|
+
import { isDefined as isDefined7 } from "@xylabs/typeof";
|
|
20
|
+
import { ConfigSchema } from "@xyo-network/chain-protocol";
|
|
21
|
+
import yargs from "yargs";
|
|
22
|
+
import { hideBin } from "yargs/helpers";
|
|
23
|
+
import { ZodError } from "zod";
|
|
24
|
+
|
|
25
|
+
// src/commands/api/runApi.ts
|
|
26
|
+
import { getServer } from "@xyo-network/chain-api";
|
|
27
|
+
function runApi(context) {
|
|
28
|
+
void getServer(context);
|
|
29
|
+
}
|
|
30
|
+
__name(runApi, "runApi");
|
|
32
31
|
|
|
33
32
|
// src/orchestration/actor/implementation/BalanceActor.ts
|
|
34
33
|
import { assertEx } from "@xylabs/assert";
|
|
@@ -36,11 +35,11 @@ import { PayloadBuilder } from "@xyo-network/payload-builder";
|
|
|
36
35
|
import { Mutex } from "async-mutex";
|
|
37
36
|
|
|
38
37
|
// src/orchestration/actor/model/Actor.ts
|
|
39
|
-
import { Base
|
|
38
|
+
import { Base } from "@xylabs/base";
|
|
40
39
|
import { forget } from "@xylabs/forget";
|
|
41
40
|
import { IdLogger } from "@xylabs/logger";
|
|
42
41
|
import { span, spanAsync } from "@xylabs/telemetry";
|
|
43
|
-
var Actor = class extends
|
|
42
|
+
var Actor = class extends Base {
|
|
44
43
|
static {
|
|
45
44
|
__name(this, "Actor");
|
|
46
45
|
}
|
|
@@ -49,7 +48,7 @@ var Actor = class extends Base2 {
|
|
|
49
48
|
_displayName;
|
|
50
49
|
_id;
|
|
51
50
|
constructor(id, displayName = "Actor", params) {
|
|
52
|
-
const logger = params.logger ?? new IdLogger(
|
|
51
|
+
const logger = params.logger ?? new IdLogger(Base.defaultLogger ?? console, () => `[${displayName} (${id})] `);
|
|
53
52
|
super({
|
|
54
53
|
...params,
|
|
55
54
|
logger
|
|
@@ -272,7 +271,7 @@ var ChainHeadUpdateActor = class _ChainHeadUpdateActor extends Actor {
|
|
|
272
271
|
// src/orchestration/actor/implementation/ProducerActor.ts
|
|
273
272
|
import { assertEx as assertEx3 } from "@xylabs/assert";
|
|
274
273
|
import { toHex as toHex2 } from "@xylabs/hex";
|
|
275
|
-
import { isDefined
|
|
274
|
+
import { isDefined, isUndefined } from "@xylabs/typeof";
|
|
276
275
|
import { createDeclarationIntent } from "@xyo-network/chain-protocol";
|
|
277
276
|
import { BaseBlockProducerService } from "@xyo-network/chain-services";
|
|
278
277
|
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
|
|
@@ -398,7 +397,7 @@ var ProducerActor = class _ProducerActor extends Actor {
|
|
|
398
397
|
}
|
|
399
398
|
async validateCurrentBalance() {
|
|
400
399
|
const head = this._lastProducedBlock?.[0]._hash;
|
|
401
|
-
if (
|
|
400
|
+
if (isDefined(head)) {
|
|
402
401
|
const balances = await this.balanceService.balances(head, [
|
|
403
402
|
this.account.address
|
|
404
403
|
]);
|
|
@@ -412,7 +411,7 @@ var ProducerActor = class _ProducerActor extends Actor {
|
|
|
412
411
|
return true;
|
|
413
412
|
}
|
|
414
413
|
async validateCurrentStake() {
|
|
415
|
-
const requiredMinimumStake =
|
|
414
|
+
const requiredMinimumStake = isDefined(process.env.XYO_PRODUCER_MIN_STAKE) ? BigInt(process.env.XYO_PRODUCER_MIN_STAKE) : 1n;
|
|
416
415
|
const currentStake = await this.chainStakeViewer.activeByAddressStaked(this.account.address);
|
|
417
416
|
if (currentStake < requiredMinimumStake) {
|
|
418
417
|
this.logger?.error(`Producer ${this.account.address} has insufficient stake.`);
|
|
@@ -424,7 +423,7 @@ var ProducerActor = class _ProducerActor extends Actor {
|
|
|
424
423
|
|
|
425
424
|
// src/orchestration/health/initHealthEndpoints.ts
|
|
426
425
|
import http from "http";
|
|
427
|
-
import { isDefined as
|
|
426
|
+
import { isDefined as isDefined2, isEmptyString } from "@xylabs/typeof";
|
|
428
427
|
var sendStatus = /* @__PURE__ */ __name((res, status, errorCode) => {
|
|
429
428
|
const statusCode = status === "started" ? 200 : errorCode;
|
|
430
429
|
res.writeHead(statusCode, {
|
|
@@ -474,7 +473,7 @@ var createHealthServer = /* @__PURE__ */ __name((port = 8080, statusMonitor) =>
|
|
|
474
473
|
}, "createHealthServer");
|
|
475
474
|
var initHealthEndpoints = /* @__PURE__ */ __name((params) => {
|
|
476
475
|
const healthCheckEnvVarPort = process.env.XYO_PRODUCER_HEALTH_CHECK_PORT;
|
|
477
|
-
if (
|
|
476
|
+
if (isDefined2(healthCheckEnvVarPort) && !isEmptyString(healthCheckEnvVarPort)) {
|
|
478
477
|
const healthCheckPort = Number.parseInt(healthCheckEnvVarPort, 10);
|
|
479
478
|
return createHealthServer(healthCheckPort, params.statusReporter);
|
|
480
479
|
}
|
|
@@ -483,7 +482,7 @@ var initHealthEndpoints = /* @__PURE__ */ __name((params) => {
|
|
|
483
482
|
// src/orchestration/initServices.ts
|
|
484
483
|
import { assertEx as assertEx16 } from "@xylabs/assert";
|
|
485
484
|
import { asAddress as asAddress2 } from "@xylabs/hex";
|
|
486
|
-
import { isDefined as
|
|
485
|
+
import { isDefined as isDefined5 } from "@xylabs/typeof";
|
|
487
486
|
import { balanceSummaryRepositoryFromMap } from "@xyo-network/chain-modules";
|
|
488
487
|
import { initTelemetry } from "@xyo-network/chain-telemetry";
|
|
489
488
|
import { startupSpanAsync as startupSpanAsync7 } from "@xyo-network/chain-utils";
|
|
@@ -559,12 +558,16 @@ var initRemoteChainFinalizedArchivist = /* @__PURE__ */ __name(async () => {
|
|
|
559
558
|
// src/orchestration/archivists/ChainFinalized/archivist.ts
|
|
560
559
|
var mutex3 = new Mutex4();
|
|
561
560
|
var singleton3;
|
|
562
|
-
async function initChainFinalizedArchivist(traceProvider) {
|
|
561
|
+
async function initChainFinalizedArchivist({ traceProvider, logger }) {
|
|
563
562
|
return await mutex3.runExclusive(async () => {
|
|
564
563
|
if (singleton3) return singleton3;
|
|
565
564
|
const [remote, local] = await Promise.all([
|
|
566
|
-
startupSpanAsync("ChainFinalizedArchivist:initRemote", () => initRemoteChainFinalizedArchivist(
|
|
567
|
-
|
|
565
|
+
startupSpanAsync("ChainFinalizedArchivist:initRemote", () => initRemoteChainFinalizedArchivist({
|
|
566
|
+
logger
|
|
567
|
+
})),
|
|
568
|
+
startupSpanAsync("ChainFinalizedArchivist:initLocal", () => initLocalChainFinalizedArchivist({
|
|
569
|
+
logger
|
|
570
|
+
}))
|
|
568
571
|
]);
|
|
569
572
|
await startupSpanAsync("ChainFinalizedArchivist:initArchivistSync", () => initArchivistSync("ChainFinalizedArchivist", remote, local, 200, Number.MAX_SAFE_INTEGER, traceProvider));
|
|
570
573
|
singleton3 = local;
|
|
@@ -600,10 +603,10 @@ var initRemoteChainSubmissionsArchivist = /* @__PURE__ */ __name(async () => {
|
|
|
600
603
|
// src/orchestration/archivists/ChainSubmissions/archivist.ts
|
|
601
604
|
var mutex5 = new Mutex6();
|
|
602
605
|
var singleton5;
|
|
603
|
-
var initChainSubmissionsArchivist = /* @__PURE__ */ __name(async () => {
|
|
606
|
+
var initChainSubmissionsArchivist = /* @__PURE__ */ __name(async (params) => {
|
|
604
607
|
return await mutex5.runExclusive(async () => {
|
|
605
608
|
if (singleton5) return singleton5;
|
|
606
|
-
const remote = await startupSpanAsync2("ChainSubmissionsArchivist:initRemote", () => initRemoteChainSubmissionsArchivist());
|
|
609
|
+
const remote = await startupSpanAsync2("ChainSubmissionsArchivist:initRemote", () => initRemoteChainSubmissionsArchivist(params));
|
|
607
610
|
singleton5 = remote;
|
|
608
611
|
return assertEx6(singleton5, () => new Error("Failed to initialize ChainSubmissionsArchivist"));
|
|
609
612
|
});
|
|
@@ -656,11 +659,11 @@ var initRemotePendingTransactionsArchivist = /* @__PURE__ */ __name(async () =>
|
|
|
656
659
|
// src/orchestration/archivists/PendingTransactions/archivist.ts
|
|
657
660
|
var mutex8 = new Mutex9();
|
|
658
661
|
var singleton8;
|
|
659
|
-
async function initPendingBundledTransactionsArchivist(
|
|
662
|
+
async function initPendingBundledTransactionsArchivist(params) {
|
|
660
663
|
return await mutex8.runExclusive(async () => {
|
|
661
664
|
if (singleton8) return singleton8;
|
|
662
|
-
const remote = await startupSpanAsync3("PendingBundledTransactionsArchivist:initRemote", () => initRemotePendingTransactionsArchivist());
|
|
663
|
-
const local = await startupSpanAsync3("PendingBundledTransactionsArchivist:initLocal", () => initLocalPendingTransactionsArchivist());
|
|
665
|
+
const remote = await startupSpanAsync3("PendingBundledTransactionsArchivist:initRemote", () => initRemotePendingTransactionsArchivist(params));
|
|
666
|
+
const local = await startupSpanAsync3("PendingBundledTransactionsArchivist:initLocal", () => initLocalPendingTransactionsArchivist(params));
|
|
664
667
|
const start2 = await remote.next({
|
|
665
668
|
limit: 1,
|
|
666
669
|
order: "desc"
|
|
@@ -703,10 +706,10 @@ var initLocalRejectedTransactionsArchivist = /* @__PURE__ */ __name(async () =>
|
|
|
703
706
|
// src/orchestration/archivists/RejectedTransactions/archivist.ts
|
|
704
707
|
var mutex10 = new Mutex11();
|
|
705
708
|
var singleton10;
|
|
706
|
-
async function initRejectedTransactionsArchivist(
|
|
709
|
+
async function initRejectedTransactionsArchivist(params) {
|
|
707
710
|
return await mutex10.runExclusive(async () => {
|
|
708
711
|
if (singleton10) return singleton10;
|
|
709
|
-
const local = await startupSpanAsync4("RejectedTransactionsArchivist:initLocal", () => initLocalRejectedTransactionsArchivist());
|
|
712
|
+
const local = await startupSpanAsync4("RejectedTransactionsArchivist:initLocal", () => initLocalRejectedTransactionsArchivist(params));
|
|
710
713
|
singleton10 = local;
|
|
711
714
|
return singleton10;
|
|
712
715
|
});
|
|
@@ -734,22 +737,22 @@ var initLocalStakeIntentStateArchivist = /* @__PURE__ */ __name(async () => {
|
|
|
734
737
|
// src/orchestration/archivists/StakeIntentState/archivist.ts
|
|
735
738
|
var mutex12 = new Mutex13();
|
|
736
739
|
var singleton12;
|
|
737
|
-
var initStakeIntentStateArchivist = /* @__PURE__ */ __name(async () => {
|
|
740
|
+
var initStakeIntentStateArchivist = /* @__PURE__ */ __name(async (params) => {
|
|
738
741
|
return await mutex12.runExclusive(async () => {
|
|
739
742
|
if (singleton12) return singleton12;
|
|
740
|
-
const local = await startupSpanAsync5("StakeIntentStateArchivist:initLocal", () => initLocalStakeIntentStateArchivist());
|
|
743
|
+
const local = await startupSpanAsync5("StakeIntentStateArchivist:initLocal", () => initLocalStakeIntentStateArchivist(params));
|
|
741
744
|
singleton12 = local;
|
|
742
745
|
return assertEx9(singleton12, () => "Error: StakeIntentStateArchivist is undefined");
|
|
743
746
|
});
|
|
744
747
|
}, "initStakeIntentStateArchivist");
|
|
745
748
|
|
|
746
749
|
// src/orchestration/map/BalanceSummary/initBalanceSummaryMap.ts
|
|
747
|
-
import { isDefined as
|
|
750
|
+
import { isDefined as isDefined4 } from "@xylabs/typeof";
|
|
748
751
|
import { startupSpanAsync as startupSpanAsync6 } from "@xyo-network/chain-utils";
|
|
749
752
|
import { Mutex as Mutex15 } from "async-mutex";
|
|
750
753
|
|
|
751
754
|
// src/orchestration/map/BalanceSummary/local.ts
|
|
752
|
-
import { isDefined as
|
|
755
|
+
import { isDefined as isDefined3 } from "@xylabs/typeof";
|
|
753
756
|
import { Mutex as Mutex14 } from "async-mutex";
|
|
754
757
|
|
|
755
758
|
// src/orchestration/map/localPersistentMap.ts
|
|
@@ -835,9 +838,9 @@ var getLocalPersistentMap = /* @__PURE__ */ __name(async (dbName, storeName, kin
|
|
|
835
838
|
// src/orchestration/map/BalanceSummary/local.ts
|
|
836
839
|
var mutex13 = new Mutex14();
|
|
837
840
|
var singleton13;
|
|
838
|
-
var initLocalBalanceSummaryMap = /* @__PURE__ */ __name(async () => {
|
|
841
|
+
var initLocalBalanceSummaryMap = /* @__PURE__ */ __name(async (_params) => {
|
|
839
842
|
return await mutex13.runExclusive(async () => {
|
|
840
|
-
if (
|
|
843
|
+
if (isDefined3(singleton13)) return singleton13;
|
|
841
844
|
singleton13 = await getLocalPersistentMap("balance", "summary");
|
|
842
845
|
return singleton13;
|
|
843
846
|
});
|
|
@@ -846,10 +849,10 @@ var initLocalBalanceSummaryMap = /* @__PURE__ */ __name(async () => {
|
|
|
846
849
|
// src/orchestration/map/BalanceSummary/initBalanceSummaryMap.ts
|
|
847
850
|
var mutex14 = new Mutex15();
|
|
848
851
|
var singleton14;
|
|
849
|
-
async function initBalanceSummaryMap(
|
|
852
|
+
async function initBalanceSummaryMap(params) {
|
|
850
853
|
return await mutex14.runExclusive(async () => {
|
|
851
|
-
if (
|
|
852
|
-
const local = await startupSpanAsync6("BalanceSummaryMap:initLocal", () => initLocalBalanceSummaryMap());
|
|
854
|
+
if (isDefined4(singleton14)) return singleton14;
|
|
855
|
+
const local = await startupSpanAsync6("BalanceSummaryMap:initLocal", () => initLocalBalanceSummaryMap(params));
|
|
853
856
|
singleton14 = local;
|
|
854
857
|
return singleton14;
|
|
855
858
|
});
|
|
@@ -861,13 +864,13 @@ import { isUndefined as isUndefined2 } from "@xylabs/typeof";
|
|
|
861
864
|
import { ADDRESS_INDEX, generateXyoBaseWalletFromPhrase } from "@xyo-network/chain-protocol";
|
|
862
865
|
import { HDWallet } from "@xyo-network/wallet";
|
|
863
866
|
var accountServiceSingleton;
|
|
864
|
-
var initAccount = /* @__PURE__ */ __name(async () => {
|
|
867
|
+
var initAccount = /* @__PURE__ */ __name(async ({ logger }) => {
|
|
865
868
|
if (accountServiceSingleton) return accountServiceSingleton;
|
|
866
869
|
let walletPhrase = process.env.XYO_WALLET_MNEMONIC;
|
|
867
870
|
if (isUndefined2(walletPhrase)) {
|
|
868
|
-
|
|
871
|
+
logger?.log("No wallet mnemonic specified!");
|
|
869
872
|
const randomMnemonic = HDWallet.generateMnemonic();
|
|
870
|
-
|
|
873
|
+
logger?.log(`Using randomly generated mnemonic: ${randomMnemonic}`);
|
|
871
874
|
walletPhrase = randomMnemonic;
|
|
872
875
|
}
|
|
873
876
|
const wallet = await generateXyoBaseWalletFromPhrase(walletPhrase);
|
|
@@ -923,8 +926,8 @@ var getChainId = /* @__PURE__ */ __name(() => {
|
|
|
923
926
|
|
|
924
927
|
// src/orchestration/services/implementation/evm/initGanacheProvider.ts
|
|
925
928
|
var initJsonRpcProvider = /* @__PURE__ */ __name(() => {
|
|
926
|
-
const
|
|
927
|
-
return Promise.resolve(new JsonRpcProvider(...
|
|
929
|
+
const config2 = getJsonRpcProviderConfig();
|
|
930
|
+
return Promise.resolve(new JsonRpcProvider(...config2));
|
|
928
931
|
}, "initJsonRpcProvider");
|
|
929
932
|
var canUseJsonRpcProvider = /* @__PURE__ */ __name(() => {
|
|
930
933
|
return canUseChainId() && process.env.XYO_JSON_RPC_URL !== void 0;
|
|
@@ -943,8 +946,8 @@ import { InfuraProvider } from "ethers/providers";
|
|
|
943
946
|
var instance;
|
|
944
947
|
var initInfuraProvider = /* @__PURE__ */ __name(() => {
|
|
945
948
|
if (instance) return instance;
|
|
946
|
-
const
|
|
947
|
-
instance = Promise.resolve(new InfuraProvider(...
|
|
949
|
+
const config2 = getInfuraProviderConfig();
|
|
950
|
+
instance = Promise.resolve(new InfuraProvider(...config2));
|
|
948
951
|
return instance;
|
|
949
952
|
}, "initInfuraProvider");
|
|
950
953
|
var canUseInfuraProvider = /* @__PURE__ */ __name(() => {
|
|
@@ -1213,9 +1216,10 @@ var telemetryConfig = {
|
|
|
1213
1216
|
}
|
|
1214
1217
|
};
|
|
1215
1218
|
var isStartable = /* @__PURE__ */ __name((value) => {
|
|
1216
|
-
return
|
|
1219
|
+
return isDefined5(value.start) && typeof value.start === "function";
|
|
1217
1220
|
}, "isStartable");
|
|
1218
|
-
var initServices = /* @__PURE__ */ __name(async (
|
|
1221
|
+
var initServices = /* @__PURE__ */ __name(async (context) => {
|
|
1222
|
+
const { config: config2, logger } = context;
|
|
1219
1223
|
const statusReporter = new RuntimeStatusMonitor(logger);
|
|
1220
1224
|
statusReporter.onGlobalTransition({
|
|
1221
1225
|
to: "started"
|
|
@@ -1233,25 +1237,35 @@ var initServices = /* @__PURE__ */ __name(async (logger) => {
|
|
|
1233
1237
|
}));
|
|
1234
1238
|
const [{ traceProvider, meterProvider }, account] = await Promise.all([
|
|
1235
1239
|
startupSpanAsync7("initTelemetry", () => initTelemetry(telemetryConfig)),
|
|
1236
|
-
startupSpanAsync7("initAccount", () => initAccount(
|
|
1240
|
+
startupSpanAsync7("initAccount", () => initAccount({
|
|
1241
|
+
logger
|
|
1242
|
+
}))
|
|
1237
1243
|
]);
|
|
1244
|
+
const initParams = {
|
|
1245
|
+
logger,
|
|
1246
|
+
traceProvider,
|
|
1247
|
+
meterProvider,
|
|
1248
|
+
statusReporter
|
|
1249
|
+
};
|
|
1238
1250
|
const [chainArchivist, [pendingBundledTransactionsArchivist, pendingBundledTransactionsArchivistWrite], rejectedTransactionsArchivist, chainSubmissionsArchivistWrite, stakeIntentStateArchivist, chainService, balanceSummaryMap] = await Promise.all([
|
|
1239
|
-
startupSpanAsync7("ChainFinalizedArchivist", () => initChainFinalizedArchivist(
|
|
1240
|
-
startupSpanAsync7("PendingBundledTransactionsArchivist", () => initPendingBundledTransactionsArchivist(
|
|
1241
|
-
startupSpanAsync7("RejectedTransactionsArchivist", () => initRejectedTransactionsArchivist(
|
|
1242
|
-
startupSpanAsync7("ChainSubmissionsArchivist", () => initChainSubmissionsArchivist()),
|
|
1243
|
-
startupSpanAsync7("StakeIntentStateArchivist", () => initStakeIntentStateArchivist()),
|
|
1251
|
+
startupSpanAsync7("ChainFinalizedArchivist", () => initChainFinalizedArchivist(initParams)),
|
|
1252
|
+
startupSpanAsync7("PendingBundledTransactionsArchivist", () => initPendingBundledTransactionsArchivist(initParams)),
|
|
1253
|
+
startupSpanAsync7("RejectedTransactionsArchivist", () => initRejectedTransactionsArchivist(initParams)),
|
|
1254
|
+
startupSpanAsync7("ChainSubmissionsArchivist", () => initChainSubmissionsArchivist(initParams)),
|
|
1255
|
+
startupSpanAsync7("StakeIntentStateArchivist", () => initStakeIntentStateArchivist(initParams)),
|
|
1244
1256
|
startupSpanAsync7("ChainService", () => initChainService({
|
|
1257
|
+
...initParams,
|
|
1245
1258
|
account,
|
|
1246
1259
|
name: "ChainService"
|
|
1247
1260
|
})),
|
|
1248
|
-
startupSpanAsync7("BalanceSummaryMap", () => initBalanceSummaryMap(
|
|
1261
|
+
startupSpanAsync7("BalanceSummaryMap", () => initBalanceSummaryMap(initParams))
|
|
1249
1262
|
]);
|
|
1250
1263
|
const chainId = chainService.chainId;
|
|
1251
1264
|
const chainContractViewer = chainService;
|
|
1252
1265
|
const chainStakeViewer = chainService;
|
|
1253
1266
|
const chainStaker = chainService;
|
|
1254
1267
|
const head = await startupSpanAsync7("initHead", () => initHead({
|
|
1268
|
+
...initParams,
|
|
1255
1269
|
account,
|
|
1256
1270
|
chainArchivist,
|
|
1257
1271
|
chainSubmissionsArchivistWrite
|
|
@@ -1261,30 +1275,27 @@ var initServices = /* @__PURE__ */ __name(async (logger) => {
|
|
|
1261
1275
|
name: "PendingTransactionsService",
|
|
1262
1276
|
chainArchivist,
|
|
1263
1277
|
chainId,
|
|
1264
|
-
meterProvider,
|
|
1265
1278
|
pendingBundledTransactionsArchivist,
|
|
1266
1279
|
rejectedTransactionsArchivist,
|
|
1267
|
-
|
|
1268
|
-
statusReporter
|
|
1280
|
+
...initParams
|
|
1269
1281
|
})),
|
|
1270
1282
|
startupSpanAsync7("RewardService", () => initBlockRewardService({
|
|
1271
1283
|
name: "RewardService",
|
|
1272
1284
|
account,
|
|
1273
1285
|
chainService,
|
|
1274
|
-
|
|
1275
|
-
statusReporter
|
|
1286
|
+
...initParams
|
|
1276
1287
|
})),
|
|
1277
1288
|
startupSpanAsync7("ChainIterator", () => initChainIterator({
|
|
1278
1289
|
name: "ChainIterator",
|
|
1279
|
-
traceProvider,
|
|
1280
1290
|
chainArchivist,
|
|
1281
1291
|
head,
|
|
1282
|
-
|
|
1292
|
+
...initParams
|
|
1283
1293
|
})),
|
|
1284
1294
|
startupSpanAsync7("BalanceService", () => initBalanceService({
|
|
1285
1295
|
name: "BalanceService",
|
|
1286
1296
|
chainArchivist,
|
|
1287
|
-
summaryRepository: balanceSummaryRepositoryFromMap(balanceSummaryMap)
|
|
1297
|
+
summaryRepository: balanceSummaryRepositoryFromMap(balanceSummaryMap),
|
|
1298
|
+
...initParams
|
|
1288
1299
|
}))
|
|
1289
1300
|
]);
|
|
1290
1301
|
const stakeIntentService = await startupSpanAsync7("StakeIntentService", () => initStakeIntentService({
|
|
@@ -1293,16 +1304,14 @@ var initServices = /* @__PURE__ */ __name(async (logger) => {
|
|
|
1293
1304
|
chainIterator,
|
|
1294
1305
|
chainStakeViewer,
|
|
1295
1306
|
stakeIntentStateArchivist,
|
|
1296
|
-
|
|
1297
|
-
statusReporter
|
|
1307
|
+
...initParams
|
|
1298
1308
|
}));
|
|
1299
1309
|
const electionService = await startupSpanAsync7("ElectionService", () => initElectionService({
|
|
1300
1310
|
name: "ElectionService",
|
|
1301
|
-
traceProvider,
|
|
1302
1311
|
chainIterator,
|
|
1303
1312
|
chainStakeViewer,
|
|
1304
1313
|
stakeIntentService,
|
|
1305
|
-
|
|
1314
|
+
...initParams
|
|
1306
1315
|
}));
|
|
1307
1316
|
const validatorParams = {
|
|
1308
1317
|
name: "Validator",
|
|
@@ -1313,10 +1322,10 @@ var initServices = /* @__PURE__ */ __name(async (logger) => {
|
|
|
1313
1322
|
electionService,
|
|
1314
1323
|
rewardService,
|
|
1315
1324
|
stakeIntentService,
|
|
1316
|
-
|
|
1317
|
-
|
|
1325
|
+
validateHydratedBlockState,
|
|
1326
|
+
...initParams
|
|
1318
1327
|
};
|
|
1319
|
-
const rewardAddress =
|
|
1328
|
+
const rewardAddress = isDefined5(process.env.XYO_BLOCK_REWARD_ADDRESS) ? assertEx16(asAddress2(process.env.XYO_BLOCK_REWARD_ADDRESS), () => "Invalid block reward address provided") : account.address;
|
|
1320
1329
|
const producerParams = {
|
|
1321
1330
|
...validatorParams,
|
|
1322
1331
|
name: "Producer",
|
|
@@ -1325,7 +1334,8 @@ var initServices = /* @__PURE__ */ __name(async (logger) => {
|
|
|
1325
1334
|
pendingBundledTransactionsArchivist,
|
|
1326
1335
|
pendingTransactionsService,
|
|
1327
1336
|
rejectedTransactionsArchivist,
|
|
1328
|
-
rewardAddress
|
|
1337
|
+
rewardAddress,
|
|
1338
|
+
...initParams
|
|
1329
1339
|
};
|
|
1330
1340
|
const producer = await startupSpanAsync7("Producer", () => initBlockProducer(producerParams));
|
|
1331
1341
|
const result = {
|
|
@@ -1353,24 +1363,11 @@ var initServices = /* @__PURE__ */ __name(async (logger) => {
|
|
|
1353
1363
|
return result;
|
|
1354
1364
|
}, "initServices");
|
|
1355
1365
|
|
|
1356
|
-
// src/runCLI.ts
|
|
1357
|
-
import net from "net";
|
|
1358
|
-
import yargs from "yargs";
|
|
1359
|
-
import { hideBin } from "yargs/helpers";
|
|
1360
|
-
|
|
1361
|
-
// src/commands/api/runApi.ts
|
|
1362
|
-
import { getServer } from "@xyo-network/chain-api";
|
|
1363
|
-
function runApi(context) {
|
|
1364
|
-
const { logger } = context;
|
|
1365
|
-
void getServer(void 0, void 0, logger);
|
|
1366
|
-
}
|
|
1367
|
-
__name(runApi, "runApi");
|
|
1368
|
-
|
|
1369
1366
|
// src/commands/producer/runProducer.ts
|
|
1370
1367
|
var runProducer = /* @__PURE__ */ __name(async (context) => {
|
|
1371
1368
|
const { logger, orchestrator } = context;
|
|
1372
1369
|
logger?.log("Services: Initializing...");
|
|
1373
|
-
const services = await initServices(
|
|
1370
|
+
const services = await initServices(context);
|
|
1374
1371
|
logger?.log("Services: Initialized");
|
|
1375
1372
|
const chainHeadUpdate = await ChainHeadUpdateActor.create(services);
|
|
1376
1373
|
const producer = await ProducerActor.create(services);
|
|
@@ -1386,16 +1383,93 @@ var runProducer = /* @__PURE__ */ __name(async (context) => {
|
|
|
1386
1383
|
await orchestrator.start();
|
|
1387
1384
|
}, "runProducer");
|
|
1388
1385
|
|
|
1389
|
-
// src/
|
|
1390
|
-
var
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1386
|
+
// src/images.ts
|
|
1387
|
+
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
|
|
1388
|
+
\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\x1B[0m\x1B[38;2;72;32;223m\u2560\x1B[0m\x1B[38;2;66;21;234m\u2560\x1B[0m
|
|
1389
|
+
\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\u2560\u2560\x1B[0m\x1B[38;2;103;85;170m_\x1B[0m
|
|
1390
|
+
\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;79;121;152m\u2566\x1B[0m\x1B[38;2;82;121;151m\u2566\x1B[0m\x1B[38;2;112;125;136m_\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;88;59;196m[\x1B[0m\x1B[38;2;66;21;234m\u2560\x1B[0m\x1B[38;2;66;21;234m\u2560\x1B[0m\x1B[38;2;73;34;221m\u2592\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;121;121;127m_\x1B[0m\x1B[38;2;100;101;128m\u2554\x1B[0m\x1B[38;2;93;94;127m\u2566\x1B[0m
|
|
1391
|
+
\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;82;121;151m\xB2\x1B[0m\x1B[38;2;44;116;170m\u2560\x1B[0m\x1B[38;2;44;116;171m\u2592\x1B[0m\x1B[38;2;51;117;167mD\x1B[0m\x1B[38;2;80;121;152m\u2566\x1B[0m\x1B[38;2;111;125;136m_\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;67;23;232m\u2560\x1B[0m\x1B[38;2;66;21;234m\u2560\u2560\u2560\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;120;121;128m_\x1B[0m\x1B[38;2;100;101;127m\u2554\x1B[0m\x1B[38;2;79;81;127mR\x1B[0m\x1B[38;2;71;73;128m\u2592\x1B[0m\x1B[38;2;71;73;128m\u2592\x1B[0m\x1B[38;2;88;90;127m\u2559\x1B[0m
|
|
1392
|
+
\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;55;117;165m\u255A\x1B[0m\x1B[38;2;44;116;171m\u2592\x1B[0m\x1B[38;2;44;116;171m\u2592\u2592\x1B[0m\x1B[38;2;50;116;167mD\x1B[0m\x1B[38;2;80;121;152m\u2566\xA0\x1B[0m\x1B[38;2;106;90;165mj\x1B[0m\x1B[38;2;66;21;234m\u2560\x1B[0m\x1B[38;2;66;21;234m\u2560\u2560\u2560\x1B[0m\x1B[38;2;89;61;194mH\xA0\x1B[0m\x1B[38;2;99;100;127m\u2554\x1B[0m\x1B[38;2;79;80;127mD\x1B[0m\x1B[38;2;71;73;128m\u2592\x1B[0m\x1B[38;2;71;73;128m\u2592\u2592\u2560\x1B[0m
|
|
1393
|
+
\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;83;121;150m\xB2\x1B[0m\x1B[38;2;44;116;170m\u2592\x1B[0m\x1B[38;2;44;116;171m\u2592\u2592\u2592\xA0\x1B[0m\x1B[38;2;76;38;217m\u2560\x1B[0m\x1B[38;2;66;21;234m\u2560\x1B[0m\x1B[38;2;66;21;234m\u2560\u2560\u2560\u2560\xA0\x1B[0m\x1B[38;2;74;76;128m\u2560\x1B[0m\x1B[38;2;71;73;128m\u2592\u2592\u2592\x1B[0m\x1B[38;2;89;90;128m\u2559\x1B[0m
|
|
1394
|
+
\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;90;118;148m\`\x1B[0m\x1B[38;2;89;107;153m_\x1B[0m\x1B[38;2;93;97;154m,\x1B[0m\x1B[38;2;105;89;166m\u2553\x1B[0m\x1B[38;2;66;21;234m\u2560\x1B[0m\x1B[38;2;66;21;234m\u2560\u2560\u2560\u2560\u2560\x1B[0m\x1B[38;2;95;72;183m\u2553\x1B[0m\x1B[38;2;106;96;152m_\x1B[0m\x1B[38;2;100;94;143m\`\x1B[0m\x1B[38;2;101;100;133m\`\x1B[0m
|
|
1395
|
+
\x1B[38;2;128;128;128m\xA0\x1B[0m\x1B[38;2;122;118;137m_\x1B[0m\x1B[38;2;113;102;153m,\x1B[0m\x1B[38;2;108;94;161m\u2553\x1B[0m\x1B[38;2;104;86;169m\u2553\x1B[0m\x1B[38;2;98;77;178m\u2554\x1B[0m\x1B[38;2;93;67;188m\u2557\x1B[0m\x1B[38;2;88;59;196m\u03C6\x1B[0m\x1B[38;2;83;51;204m@\x1B[0m\x1B[38;2;78;42;213mD\x1B[0m\x1B[38;2;72;32;223m\u2592\x1B[0m\x1B[38;2;68;24;231m\u2560\x1B[0m\x1B[38;2;66;21;234m\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\x1B[0m\x1B[38;2;71;30;225m\u2592\x1B[0m\x1B[38;2;77;40;215m\u2592\x1B[0m\x1B[38;2;82;49;206mK\x1B[0m\x1B[38;2;87;57;198m\u03C6\x1B[0m\x1B[38;2;91;65;190m\u2557\x1B[0m\x1B[38;2;97;75;180m\u2566\x1B[0m\x1B[38;2;103;84;171m\u2556\x1B[0m\x1B[38;2;107;92;163m\xB2\x1B[0m\x1B[38;2;112;101;154m_\x1B[0m\x1B[38;2;119;112;143m_\x1B[0m
|
|
1396
|
+
\x1B[38;2;128;128;128m\xA0\x1B[0m\x1B[38;2;106;91;164m\`\x1B[0m\x1B[38;2;94;70;185m^\x1B[0m\x1B[38;2;89;62;193m\u2559\x1B[0m\x1B[38;2;85;54;201m\u2559\x1B[0m\x1B[38;2;80;45;210m\u255A\x1B[0m\x1B[38;2;74;35;220m\u255D\x1B[0m\x1B[38;2;69;26;229m\u2560\x1B[0m\x1B[38;2;66;22;233m\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\u2560\x1B[0m\x1B[38;2;73;33;222m\u255D\x1B[0m\x1B[38;2;79;43;212m\u2569\x1B[0m\x1B[38;2;84;52;203m\u255C\x1B[0m\x1B[38;2;88;60;195m\u2559\x1B[0m\x1B[38;2;93;68;187m^\x1B[0m\x1B[38;2;100;80;175m\`\x1B[0m
|
|
1397
|
+
\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;113;84;152m\`\x1B[0m\x1B[38;2;103;79;169m'\x1B[0m\x1B[38;2;95;72;183m"\x1B[0m\x1B[38;2;87;57;198m\u2559\x1B[0m\x1B[38;2;66;21;234m\u2560\x1B[0m\x1B[38;2;66;21;234m\u2560\u2560\u2560\u2560\u2560\x1B[0m\x1B[38;2;80;46;209m\u255C\x1B[0m\x1B[38;2;94;70;185m^\x1B[0m\x1B[38;2;102;77;175m^\x1B[0m\x1B[38;2;112;81;162m\`\x1B[0m\x1B[38;2;115;92;155m\`\x1B[0m
|
|
1398
|
+
\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;145;116;107m,\x1B[0m\x1B[38;2;199;82;45m\u2560\x1B[0m\x1B[38;2;207;77;35m\u2592\x1B[0m\x1B[38;2;207;77;35m\u2592\u2560\xA0\x1B[0m\x1B[38;2;70;28;227m\u2560\x1B[0m\x1B[38;2;66;21;234m\u2560\x1B[0m\x1B[38;2;66;21;234m\u2560\u2560\u2560\u2560\xA0\x1B[0m\x1B[38;2;189;49;97m\xE5\x1B[0m\x1B[38;2;203;32;90m\u2560\x1B[0m\x1B[38;2;203;32;90m\u2560\u2560\x1B[0m\x1B[38;2;155;92;114m,\x1B[0m
|
|
1399
|
+
\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;175;98;73m\u2554\x1B[0m\x1B[38;2;207;77;35m\u2592\x1B[0m\x1B[38;2;207;77;35m\u2592\u2592\u2592\x1B[0m\x1B[38;2;197;83;47m\u2569\xA0\x1B[0m\x1B[38;2;98;76;179m[\x1B[0m\x1B[38;2;66;21;234m\u2560\x1B[0m\x1B[38;2;66;21;234m\u2560\u2560\u2560\x1B[0m\x1B[38;2;81;48;207mH\xA0\x1B[0m\x1B[38;2;188;51;98m\u255A\x1B[0m\x1B[38;2;203;32;90m\u2560\x1B[0m\x1B[38;2;203;32;90m\u2560\u2560\u2560\x1B[0m\x1B[38;2;183;57;100mH\x1B[0m
|
|
1400
|
+
\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;146;116;106m,\x1B[0m\x1B[38;2;199;82;44m\u2560\x1B[0m\x1B[38;2;207;77;35m\u2592\x1B[0m\x1B[38;2;207;77;35m\u2592\x1B[0m\x1B[38;2;196;84;48m\u2569\x1B[0m\x1B[38;2;168;102;81m^\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;66;21;234m\u2560\x1B[0m\x1B[38;2;66;21;234m\u2560\u2560\u2560\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;160;87;111m'\x1B[0m\x1B[38;2;187;52;98m\u255A\x1B[0m\x1B[38;2;203;32;90m\u2560\x1B[0m\x1B[38;2;203;32;90m\u2560\u2560\x1B[0m\x1B[38;2;156;91;113m,\x1B[0m
|
|
1401
|
+
\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;198;83;46m\u2569\x1B[0m\x1B[38;2;194;85;50m\u2569\x1B[0m\x1B[38;2;167;102;82m^\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;81;46;209m\u255A\x1B[0m\x1B[38;2;66;21;234m\u2560\x1B[0m\x1B[38;2;66;21;234m\u2560\u2560\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;159;88;112m'\x1B[0m\x1B[38;2;186;53;98m\u255A\x1B[0m\x1B[38;2;197;40;93m\u2569\x1B[0m
|
|
1402
|
+
\x1B[38;2;128;128;128m\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\x1B[0m\x1B[38;2;110;97;158m'\x1B[0m\x1B[38;2;66;21;234m\u2560\x1B[0m\x1B[38;2;66;21;234m\u2560\x1B[0m\x1B[38;2;94;69;186mH\x1B[0m
|
|
1403
|
+
\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\x1B[0m\x1B[38;2;68;25;230m\u2560\x1B[0m\x1B[38;2;66;21;234m\u2560\x1B[0m
|
|
1404
|
+
\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\x1B[0m\x1B[38;2;108;93;162m\xB2\x1B[0m\x1B[38;2;99;79;176m^\x1B[0m`;
|
|
1396
1405
|
|
|
1397
|
-
// src/
|
|
1398
|
-
|
|
1406
|
+
// src/initLogger.ts
|
|
1407
|
+
import { Base as Base2 } from "@xylabs/base";
|
|
1408
|
+
import { ConsoleLogger, LogLevel } from "@xylabs/logger";
|
|
1409
|
+
import { isDefined as isDefined6 } from "@xylabs/typeof";
|
|
1410
|
+
var initLogger = /* @__PURE__ */ __name((config2) => {
|
|
1411
|
+
let level;
|
|
1412
|
+
if (isDefined6(config2?.log?.level)) {
|
|
1413
|
+
const parsed = LogLevel[config2.log.level.toLowerCase()];
|
|
1414
|
+
if (isDefined6(parsed)) level = parsed;
|
|
1415
|
+
}
|
|
1416
|
+
const logger = new ConsoleLogger(level);
|
|
1417
|
+
Base2.defaultLogger = logger;
|
|
1418
|
+
return logger;
|
|
1419
|
+
}, "initLogger");
|
|
1420
|
+
|
|
1421
|
+
// src/optionsFromZodSchema.ts
|
|
1422
|
+
import { ZodBoolean, ZodDefault, ZodEnum, ZodNumber, ZodObject, ZodOptional } from "zod";
|
|
1423
|
+
var collectOptions = /* @__PURE__ */ __name((zodType, path = [], out = {}) => {
|
|
1424
|
+
if (zodType instanceof ZodObject) {
|
|
1425
|
+
const shape = zodType.shape;
|
|
1426
|
+
for (const [k, v] of Object.entries(shape)) {
|
|
1427
|
+
collectOptions(v, [
|
|
1428
|
+
...path,
|
|
1429
|
+
k
|
|
1430
|
+
], out);
|
|
1431
|
+
}
|
|
1432
|
+
return out;
|
|
1433
|
+
}
|
|
1434
|
+
const def = zodType._def;
|
|
1435
|
+
if (def?.innerType instanceof ZodObject) {
|
|
1436
|
+
const shape = def.innerType.shape;
|
|
1437
|
+
for (const [k, v] of Object.entries(shape)) {
|
|
1438
|
+
collectOptions(v, [
|
|
1439
|
+
...path,
|
|
1440
|
+
k
|
|
1441
|
+
], out);
|
|
1442
|
+
}
|
|
1443
|
+
return out;
|
|
1444
|
+
}
|
|
1445
|
+
const options = {};
|
|
1446
|
+
options.describe = def.description;
|
|
1447
|
+
options.default = typeof def.defaultValue === "function" ? def.defaultValue() : def.defaultValue;
|
|
1448
|
+
let type = "string";
|
|
1449
|
+
const typeName = def.typeName === ZodDefault.name || def.typeName === ZodOptional.name ? def.innerType._def.typeName : def.typeName;
|
|
1450
|
+
if (typeName === ZodBoolean.name) type = "boolean";
|
|
1451
|
+
if (typeName === ZodNumber.name || def.coerce) type = "number";
|
|
1452
|
+
if (typeName === ZodEnum.name) {
|
|
1453
|
+
options.choices = Object.values(def.innerType.enum);
|
|
1454
|
+
}
|
|
1455
|
+
options.type = type;
|
|
1456
|
+
const key = path.join(".");
|
|
1457
|
+
out[key] = options;
|
|
1458
|
+
return out;
|
|
1459
|
+
}, "collectOptions");
|
|
1460
|
+
var optionsFromZodSchema = /* @__PURE__ */ __name((schema) => {
|
|
1461
|
+
const opts = {};
|
|
1462
|
+
for (const [rootKey, zodType] of Object.entries(schema)) {
|
|
1463
|
+
collectOptions(zodType, [
|
|
1464
|
+
rootKey
|
|
1465
|
+
], opts);
|
|
1466
|
+
}
|
|
1467
|
+
return opts;
|
|
1468
|
+
}, "optionsFromZodSchema");
|
|
1469
|
+
|
|
1470
|
+
// src/waitForHostPort.ts
|
|
1471
|
+
import net from "net";
|
|
1472
|
+
var waitForHostPort = /* @__PURE__ */ __name((host, port) => {
|
|
1399
1473
|
return new Promise((resolve) => {
|
|
1400
1474
|
const tryConnect = /* @__PURE__ */ __name(() => {
|
|
1401
1475
|
const socket = new net.Socket();
|
|
@@ -1412,56 +1486,13 @@ function waitForPort(host, port) {
|
|
|
1412
1486
|
}, "tryConnect");
|
|
1413
1487
|
tryConnect();
|
|
1414
1488
|
});
|
|
1415
|
-
}
|
|
1416
|
-
__name(waitForPort, "waitForPort");
|
|
1417
|
-
async function runCLI(context) {
|
|
1418
|
-
async function validateTransaction() {
|
|
1419
|
-
await Promise.reject("Not implemented yet");
|
|
1420
|
-
}
|
|
1421
|
-
__name(validateTransaction, "validateTransaction");
|
|
1422
|
-
async function submitTransaction() {
|
|
1423
|
-
await Promise.reject("Not implemented yet");
|
|
1424
|
-
}
|
|
1425
|
-
__name(submitTransaction, "submitTransaction");
|
|
1426
|
-
async function checkBalance() {
|
|
1427
|
-
await Promise.reject("Not implemented yet");
|
|
1428
|
-
}
|
|
1429
|
-
__name(checkBalance, "checkBalance");
|
|
1430
|
-
const argv = yargs(hideBin(process.argv)).command("validator", "Run the XL1 validator", (yargs2) => {
|
|
1431
|
-
return yargs2.command("$0", "Run as a XL1 validator node", () => {
|
|
1432
|
-
}, () => runValidator(context));
|
|
1433
|
-
}).command("producer", "Run the XL1 producer", (yargs2) => {
|
|
1434
|
-
return yargs2.command("$0", "Run as a XL1 producer node", () => {
|
|
1435
|
-
}, () => runProducer(context));
|
|
1436
|
-
}).command("client", "Client-related operations", (yargs2) => {
|
|
1437
|
-
return yargs2.command("transaction", "Transaction-related operations", (yargs3) => {
|
|
1438
|
-
return yargs3.command("validate", "Validate a transaction", () => {
|
|
1439
|
-
}, validateTransaction).command("submit", "Submit a transaction", () => {
|
|
1440
|
-
}, submitTransaction);
|
|
1441
|
-
});
|
|
1442
|
-
}).command("api", "Run as a api node", (yargs2) => {
|
|
1443
|
-
return yargs2.command("$0", "Run as a api node", () => {
|
|
1444
|
-
}, () => runApi(context)).command("run", "Run as a api node", () => {
|
|
1445
|
-
}, () => runApi(context));
|
|
1446
|
-
}).command("$0", "Run a full XL1 deployment", (yargs2) => {
|
|
1447
|
-
return yargs2.command("$0", "Start the API and a producer", () => {
|
|
1448
|
-
}, async () => {
|
|
1449
|
-
runApi(context);
|
|
1450
|
-
await waitForPort("localhost", 8080);
|
|
1451
|
-
await runProducer(context);
|
|
1452
|
-
});
|
|
1453
|
-
}).command("account", "Account-related operations", (yargs2) => {
|
|
1454
|
-
return yargs2.command("balance", "Check account balance", () => {
|
|
1455
|
-
}, checkBalance);
|
|
1456
|
-
}).help().alias("help", "h").env("XL1").argv;
|
|
1457
|
-
await argv;
|
|
1458
|
-
}
|
|
1459
|
-
__name(runCLI, "runCLI");
|
|
1489
|
+
}, "waitForHostPort");
|
|
1460
1490
|
|
|
1461
|
-
// src/
|
|
1462
|
-
var
|
|
1463
|
-
|
|
1464
|
-
|
|
1491
|
+
// src/runCLI.ts
|
|
1492
|
+
var config;
|
|
1493
|
+
var version = isDefined7("1.7.1") ? "1.7.1" : "unknown";
|
|
1494
|
+
var getContextFromConfig = /* @__PURE__ */ __name((config2) => {
|
|
1495
|
+
const logger = initLogger(config2);
|
|
1465
1496
|
const orchestrator = new Orchestrator(logger);
|
|
1466
1497
|
process.on("SIGINT", () => {
|
|
1467
1498
|
void (async () => {
|
|
@@ -1476,15 +1507,76 @@ var start = /* @__PURE__ */ __name(async () => {
|
|
|
1476
1507
|
}
|
|
1477
1508
|
})();
|
|
1478
1509
|
});
|
|
1479
|
-
|
|
1510
|
+
return {
|
|
1480
1511
|
logger,
|
|
1481
1512
|
orchestrator
|
|
1482
|
-
}
|
|
1513
|
+
};
|
|
1514
|
+
}, "getContextFromConfig");
|
|
1515
|
+
async function runCLI() {
|
|
1516
|
+
const y = yargs(hideBin(process.argv));
|
|
1517
|
+
const argv = y.usage(`
|
|
1518
|
+
\u{1F680} XL1 Node CLI (${version})
|
|
1519
|
+
${XL1LogoColorizedAscii}
|
|
1520
|
+
Run various components of the XL1 ecosystem.
|
|
1521
|
+
|
|
1522
|
+
Usage:
|
|
1523
|
+
$0 <command> [options]`).parserConfiguration({
|
|
1524
|
+
"dot-notation": true
|
|
1525
|
+
}).env("XL1").scriptName("xl1").config().version(version).middleware((argv2) => {
|
|
1526
|
+
try {
|
|
1527
|
+
config = ConfigSchema.parse(argv2);
|
|
1528
|
+
} catch (err) {
|
|
1529
|
+
if (err instanceof ZodError) {
|
|
1530
|
+
for (const issue of err.errors) {
|
|
1531
|
+
console.error(`${issue.path.join(".")} \u2192 ${issue.message}`);
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
throw new Error("Invalid configuration");
|
|
1535
|
+
}
|
|
1536
|
+
}).options(optionsFromZodSchema(ConfigSchema.shape)).wrap(y.terminalWidth()).command("api", "Run a XL1 API Node", (yargs2) => {
|
|
1537
|
+
return yargs2.command("$0", "Run a XL1 API Node", () => {
|
|
1538
|
+
}, () => {
|
|
1539
|
+
const context = getContextFromConfig(config);
|
|
1540
|
+
runApi({
|
|
1541
|
+
...context,
|
|
1542
|
+
config
|
|
1543
|
+
});
|
|
1544
|
+
});
|
|
1545
|
+
}).command("producer", "Run a XL1 Producer Node", (yargs2) => {
|
|
1546
|
+
return yargs2.command("$0", "Run a XL1 Producer Node", () => {
|
|
1547
|
+
}, async () => {
|
|
1548
|
+
const context = getContextFromConfig(config);
|
|
1549
|
+
await runProducer({
|
|
1550
|
+
...context,
|
|
1551
|
+
config
|
|
1552
|
+
});
|
|
1553
|
+
});
|
|
1554
|
+
}).command("$0", "Run a full XL1 Node", () => {
|
|
1555
|
+
}, async () => {
|
|
1556
|
+
const context = getContextFromConfig(config);
|
|
1557
|
+
runApi({
|
|
1558
|
+
...context,
|
|
1559
|
+
config
|
|
1560
|
+
});
|
|
1561
|
+
await waitForHostPort("localhost", config.api.port);
|
|
1562
|
+
await runProducer({
|
|
1563
|
+
...context,
|
|
1564
|
+
config
|
|
1565
|
+
});
|
|
1566
|
+
}).help().alias("help", "h").argv;
|
|
1567
|
+
await argv;
|
|
1568
|
+
}
|
|
1569
|
+
__name(runCLI, "runCLI");
|
|
1570
|
+
|
|
1571
|
+
// src/start.ts
|
|
1572
|
+
var start = /* @__PURE__ */ __name(async () => {
|
|
1573
|
+
initEnv();
|
|
1574
|
+
await runCLI();
|
|
1483
1575
|
}, "start");
|
|
1484
1576
|
|
|
1485
1577
|
// src/xl1.ts
|
|
1486
1578
|
start().catch((err) => {
|
|
1487
|
-
console.error("An error occurred during startup:", err);
|
|
1579
|
+
if (process.env.NODE_ENV === "development") console.error("An error occurred during startup:", err);
|
|
1488
1580
|
process.exit(1);
|
|
1489
1581
|
});
|
|
1490
1582
|
//# sourceMappingURL=xl1.mjs.map
|