@toon-protocol/townhouse 0.3.2 → 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/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-BtpOFwd6.js';
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
- } from "./chunk-6T5CXPYD.js";
30
+ writeHsConnectorConfig,
31
+ writeHsNodeEnvFile
32
+ } from "./chunk-SXKZUTGE.js";
32
33
  import "./chunk-5O4SBV5O.js";
33
34
  import {
34
35
  CONTAINER_PREFIX
@@ -1993,7 +1994,7 @@ var HELP_TEXT = `townhouse \u2014 TOON node orchestrator
1993
1994
 
1994
1995
  Usage:
1995
1996
  townhouse setup [--no-browser] [--port <n>] [--config-dir <dir>] Run the first-run setup wizard
1996
- 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
1997
1998
  townhouse up [--town] [--mill] [--dvm] [-c <path>] [--password <pw>] Start nodes
1998
1999
  townhouse down [-c <path>] Stop all nodes
1999
2000
  townhouse status [-c <path>] Show node status
@@ -2027,6 +2028,7 @@ Flags:
2027
2028
  --no-browser Skip opening the browser automatically (setup command)
2028
2029
  --port Override the API port (setup command, default 9400)
2029
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
2030
2032
  --yes Non-interactive (init only); with --preset=demo uses demo password if --password absent
2031
2033
  --json Machine-readable JSON output (node commands; NDJSON for \`logs\`)
2032
2034
  --lines Number of historical log lines to fetch on attach (logs command, default 50)
@@ -2046,7 +2048,7 @@ function printInitNextStep(dir) {
2046
2048
  );
2047
2049
  console.log("It can take a few minutes; progress is shown throughout.");
2048
2050
  }
2049
- async function handleInit(force, configDir, password, preset, yes) {
2051
+ async function handleInit(force, configDir, password, preset, yes, network) {
2050
2052
  const dir = resolve(configDir ?? DEFAULT_CONFIG_DIR);
2051
2053
  const configPath = join(dir, "config.yaml");
2052
2054
  if (existsSync(configPath) && !force) {
@@ -2071,6 +2073,9 @@ async function handleInit(force, configDir, password, preset, yes) {
2071
2073
  configToWrite = getDefaultConfig();
2072
2074
  configToWrite.wallet.encrypted_path = join(dir, "wallet.enc");
2073
2075
  }
2076
+ if (network !== void 0) {
2077
+ configToWrite.network = network;
2078
+ }
2074
2079
  const yamlContent = stringify(configToWrite);
2075
2080
  writeFileSync(configPath, yamlContent, {
2076
2081
  encoding: "utf-8",
@@ -3143,6 +3148,7 @@ async function handleHsUp(_configPath, configDir, config, docker, options) {
3143
3148
  writeHsConnectorConfig(configDir, config, { force });
3144
3149
  const materialize = hsOverrides?.materializeComposeTemplate ?? materializeComposeTemplate;
3145
3150
  const { composePath } = materialize("hs", { townhouseHome: configDir });
3151
+ writeHsNodeEnvFile(configDir, config);
3146
3152
  ribbon.start("pull");
3147
3153
  const orchestratorFactory = hsOverrides?.createOrchestrator ?? ((d, cfg, wm, opts) => new DockerOrchestrator(d, cfg, wm, opts));
3148
3154
  const orch = orchestratorFactory(docker, config, walletManager, {
@@ -3603,6 +3609,7 @@ async function main(argv, dockerInstance, browserOpener, hsOverrides, nodeComman
3603
3609
  "no-browser": { type: "boolean" },
3604
3610
  port: { type: "string" },
3605
3611
  preset: { type: "string" },
3612
+ network: { type: "string" },
3606
3613
  yes: { type: "boolean" },
3607
3614
  "rotate-keys": { type: "boolean" },
3608
3615
  "skip-preflight": { type: "boolean" },
@@ -3678,12 +3685,21 @@ async function main(argv, dockerInstance, browserOpener, hsOverrides, nodeComman
3678
3685
  process.exitCode = 1;
3679
3686
  break;
3680
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
+ }
3681
3696
  await handleInit(
3682
3697
  values.force === true,
3683
3698
  values["config-dir"],
3684
3699
  values.password,
3685
3700
  presetVal,
3686
- values.yes === true
3701
+ values.yes === true,
3702
+ networkVal
3687
3703
  );
3688
3704
  break;
3689
3705
  }