From 4c531f46cc0fc7503accbf6ecb6388450c41e9eb Mon Sep 17 00:00:00 2001 From: Vladimir Rogojin Date: Wed, 8 Jul 2026 20:15:50 +0200 Subject: [PATCH] feat(cli)(sphere-cli-p6-fork): --network flag on `sphere host local-spawn` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Widen `sphere host local-spawn` to accept `--network ` so the per-user HM boots with the right `UNICITY_NETWORK` env var. Extends the wave-6 pattern from PR #54 (`sphere trader spawn --network`) so operators can bring up their own HM directly for spawning non-trader tenants (escrow, faucet, etc.) on testnet2. Uncovered while spawning a local v2 escrow tenant to complete trader-roundtrip against v2 — see sphere-sdk#657 (Wave 6-P2-21 invoice-token registration) and follow-up issue on escrow deposit-detection. - Add `network?: string` to `LocalSpawnOpts` - Add `.option('--network ', 'Sphere network: testnet|testnet2|mainnet|dev')` to `sphere host local-spawn` - Thread through to `ensureLocalHM({network})` Zero regression on existing callers — omitted flag falls back to the same `SPHERE_LOCAL_HM_NETWORK` env / 'testnet' default the earlier patch established. --- src/host/host-commands.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/host/host-commands.ts b/src/host/host-commands.ts index e6e55ea..3634ef3 100644 --- a/src/host/host-commands.ts +++ b/src/host/host-commands.ts @@ -82,6 +82,7 @@ interface LocalSpawnOpts { templatesFile?: string; healthPort?: string; baseDir?: string; + network?: string; } interface LocalStopOpts { @@ -736,6 +737,7 @@ async function handleLocalSpawn(cmd: Command, opts: LocalSpawnOpts): Promise', 'Override templates.json (defaults to bundled trader-agent + escrow-service)') .option('--health-port ', 'Override health-check port on 127.0.0.1 (default: derived from wallet)') .option('--base-dir ', `Override per-controller data dir (default: ${DEFAULT_LOCAL_HM_BASE_DIR})`) + .option('--network ', 'Sphere network for the HM (testnet|testnet2|mainnet|dev)') .action(async function (this: Command, opts: LocalSpawnOpts) { await handleLocalSpawn(this, opts); });