@toon-protocol/townhouse 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-6T5CXPYD.js → chunk-SXKZUTGE.js} +9789 -9369
- package/dist/chunk-SXKZUTGE.js.map +1 -0
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +25 -6
- package/dist/cli.js.map +1 -1
- package/dist/compose/townhouse-hs.yml +14 -9
- package/dist/image-manifest.json +10 -10
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/{manager-BtpOFwd6.d.ts → manager-D9Y_iWHo.d.ts} +18 -3
- package/package.json +4 -4
- package/dist/chunk-6T5CXPYD.js.map +0 -1
package/dist/cli.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import Docker from 'dockerode';
|
|
3
|
-
import { C as ComposeLoaderOptions, T as TownhouseConfig, W as WalletManager, N as NodeType } from './manager-
|
|
3
|
+
import { C as ComposeLoaderOptions, T as TownhouseConfig, W as WalletManager, N as NodeType } from './manager-D9Y_iWHo.js';
|
|
4
|
+
import '@toon-protocol/core';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Cross-platform browser opener for the wizard CLI command.
|
package/dist/cli.js
CHANGED
|
@@ -27,8 +27,9 @@ import {
|
|
|
27
27
|
saveWallet,
|
|
28
28
|
serviceFromContainerName,
|
|
29
29
|
tailContainerLogs,
|
|
30
|
-
writeHsConnectorConfig
|
|
31
|
-
|
|
30
|
+
writeHsConnectorConfig,
|
|
31
|
+
writeHsNodeEnvFile
|
|
32
|
+
} from "./chunk-SXKZUTGE.js";
|
|
32
33
|
import "./chunk-5O4SBV5O.js";
|
|
33
34
|
import {
|
|
34
35
|
CONTAINER_PREFIX
|
|
@@ -689,8 +690,11 @@ async function handleNodeAdd(type, options) {
|
|
|
689
690
|
return;
|
|
690
691
|
}
|
|
691
692
|
if (response.status === 409 && body.error === "node_type_in_use") {
|
|
693
|
+
const existingId = body.existingId ?? body.type ?? type;
|
|
692
694
|
process.stderr.write(
|
|
693
|
-
`${xMark}
|
|
695
|
+
`${xMark} A '${body.type}' node already exists (id '${existingId}'). Only one node per type is supported.
|
|
696
|
+
See your nodes: townhouse node list
|
|
697
|
+
Recreate it: townhouse node remove ${existingId} && townhouse node add ${body.type}
|
|
694
698
|
`
|
|
695
699
|
);
|
|
696
700
|
process.exitCode = 1;
|
|
@@ -1990,7 +1994,7 @@ var HELP_TEXT = `townhouse \u2014 TOON node orchestrator
|
|
|
1990
1994
|
|
|
1991
1995
|
Usage:
|
|
1992
1996
|
townhouse setup [--no-browser] [--port <n>] [--config-dir <dir>] Run the first-run setup wizard
|
|
1993
|
-
townhouse init [--force] [--config-dir <dir>] [--password <pw>] [--preset <name>] [--yes] Initialize config + wallet
|
|
1997
|
+
townhouse init [--force] [--config-dir <dir>] [--password <pw>] [--preset <name>] [--network <mode>] [--yes] Initialize config + wallet
|
|
1994
1998
|
townhouse up [--town] [--mill] [--dvm] [-c <path>] [--password <pw>] Start nodes
|
|
1995
1999
|
townhouse down [-c <path>] Stop all nodes
|
|
1996
2000
|
townhouse status [-c <path>] Show node status
|
|
@@ -2024,6 +2028,7 @@ Flags:
|
|
|
2024
2028
|
--no-browser Skip opening the browser automatically (setup command)
|
|
2025
2029
|
--port Override the API port (setup command, default 9400)
|
|
2026
2030
|
--preset Init from a named preset (init only). Supported: demo
|
|
2031
|
+
--network Chain network for apex + nodes (init only): mainnet (default), testnet, devnet, custom
|
|
2027
2032
|
--yes Non-interactive (init only); with --preset=demo uses demo password if --password absent
|
|
2028
2033
|
--json Machine-readable JSON output (node commands; NDJSON for \`logs\`)
|
|
2029
2034
|
--lines Number of historical log lines to fetch on attach (logs command, default 50)
|
|
@@ -2043,7 +2048,7 @@ function printInitNextStep(dir) {
|
|
|
2043
2048
|
);
|
|
2044
2049
|
console.log("It can take a few minutes; progress is shown throughout.");
|
|
2045
2050
|
}
|
|
2046
|
-
async function handleInit(force, configDir, password, preset, yes) {
|
|
2051
|
+
async function handleInit(force, configDir, password, preset, yes, network) {
|
|
2047
2052
|
const dir = resolve(configDir ?? DEFAULT_CONFIG_DIR);
|
|
2048
2053
|
const configPath = join(dir, "config.yaml");
|
|
2049
2054
|
if (existsSync(configPath) && !force) {
|
|
@@ -2068,6 +2073,9 @@ async function handleInit(force, configDir, password, preset, yes) {
|
|
|
2068
2073
|
configToWrite = getDefaultConfig();
|
|
2069
2074
|
configToWrite.wallet.encrypted_path = join(dir, "wallet.enc");
|
|
2070
2075
|
}
|
|
2076
|
+
if (network !== void 0) {
|
|
2077
|
+
configToWrite.network = network;
|
|
2078
|
+
}
|
|
2071
2079
|
const yamlContent = stringify(configToWrite);
|
|
2072
2080
|
writeFileSync(configPath, yamlContent, {
|
|
2073
2081
|
encoding: "utf-8",
|
|
@@ -3140,6 +3148,7 @@ async function handleHsUp(_configPath, configDir, config, docker, options) {
|
|
|
3140
3148
|
writeHsConnectorConfig(configDir, config, { force });
|
|
3141
3149
|
const materialize = hsOverrides?.materializeComposeTemplate ?? materializeComposeTemplate;
|
|
3142
3150
|
const { composePath } = materialize("hs", { townhouseHome: configDir });
|
|
3151
|
+
writeHsNodeEnvFile(configDir, config);
|
|
3143
3152
|
ribbon.start("pull");
|
|
3144
3153
|
const orchestratorFactory = hsOverrides?.createOrchestrator ?? ((d, cfg, wm, opts) => new DockerOrchestrator(d, cfg, wm, opts));
|
|
3145
3154
|
const orch = orchestratorFactory(docker, config, walletManager, {
|
|
@@ -3600,6 +3609,7 @@ async function main(argv, dockerInstance, browserOpener, hsOverrides, nodeComman
|
|
|
3600
3609
|
"no-browser": { type: "boolean" },
|
|
3601
3610
|
port: { type: "string" },
|
|
3602
3611
|
preset: { type: "string" },
|
|
3612
|
+
network: { type: "string" },
|
|
3603
3613
|
yes: { type: "boolean" },
|
|
3604
3614
|
"rotate-keys": { type: "boolean" },
|
|
3605
3615
|
"skip-preflight": { type: "boolean" },
|
|
@@ -3675,12 +3685,21 @@ async function main(argv, dockerInstance, browserOpener, hsOverrides, nodeComman
|
|
|
3675
3685
|
process.exitCode = 1;
|
|
3676
3686
|
break;
|
|
3677
3687
|
}
|
|
3688
|
+
const networkVal = values.network;
|
|
3689
|
+
if (networkVal !== void 0 && !["mainnet", "testnet", "devnet", "custom"].includes(networkVal)) {
|
|
3690
|
+
console.error(
|
|
3691
|
+
`Unknown network: ${networkVal}. Supported: mainnet, testnet, devnet, custom`
|
|
3692
|
+
);
|
|
3693
|
+
process.exitCode = 1;
|
|
3694
|
+
break;
|
|
3695
|
+
}
|
|
3678
3696
|
await handleInit(
|
|
3679
3697
|
values.force === true,
|
|
3680
3698
|
values["config-dir"],
|
|
3681
3699
|
values.password,
|
|
3682
3700
|
presetVal,
|
|
3683
|
-
values.yes === true
|
|
3701
|
+
values.yes === true,
|
|
3702
|
+
networkVal
|
|
3684
3703
|
);
|
|
3685
3704
|
break;
|
|
3686
3705
|
}
|