@toon-protocol/townhouse 0.1.0 → 0.1.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/README.md +95 -438
- package/dist/chunk-5O4SBV5O.js +538 -0
- package/dist/chunk-5O4SBV5O.js.map +1 -0
- package/dist/{chunk-4WCMVIO4.js → chunk-W33MEOPM.js} +10568 -180
- package/dist/chunk-W33MEOPM.js.map +1 -0
- package/dist/cli.js +65 -12
- package/dist/cli.js.map +1 -1
- package/dist/compose/townhouse-hs.yml +8 -8
- package/dist/image-manifest.json +10 -10
- package/dist/index.d.ts +36 -4
- package/dist/index.js +2 -1
- package/dist/{rsa-from-seed-VMNLNDZM.js → rsa-from-seed-XIT6EU73.js} +9 -4
- package/dist/rsa-from-seed-XIT6EU73.js.map +1 -0
- package/package.json +4 -4
- package/dist/chunk-4WCMVIO4.js.map +0 -1
- package/dist/rsa-from-seed-VMNLNDZM.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -27,7 +27,8 @@ import {
|
|
|
27
27
|
serviceFromContainerName,
|
|
28
28
|
tailContainerLogs,
|
|
29
29
|
writeHsConnectorConfig
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-W33MEOPM.js";
|
|
31
|
+
import "./chunk-5O4SBV5O.js";
|
|
31
32
|
import {
|
|
32
33
|
CONTAINER_PREFIX
|
|
33
34
|
} from "./chunk-GQNBZJ6F.js";
|
|
@@ -45,7 +46,8 @@ import {
|
|
|
45
46
|
existsSync,
|
|
46
47
|
renameSync,
|
|
47
48
|
rmSync,
|
|
48
|
-
statSync
|
|
49
|
+
statSync,
|
|
50
|
+
realpathSync
|
|
49
51
|
} from "fs";
|
|
50
52
|
import { join, resolve, dirname } from "path";
|
|
51
53
|
import { homedir } from "os";
|
|
@@ -2025,6 +2027,18 @@ Flags:
|
|
|
2025
2027
|
If no flags given, starts all enabled nodes from config.`;
|
|
2026
2028
|
var DEFAULT_CONFIG_DIR = join(homedir(), ".townhouse");
|
|
2027
2029
|
var DEFAULT_CONFIG_PATH = join(DEFAULT_CONFIG_DIR, "config.yaml");
|
|
2030
|
+
function printInitNextStep(dir) {
|
|
2031
|
+
const isDefaultDir = dir === resolve(DEFAULT_CONFIG_DIR);
|
|
2032
|
+
const cmd = isDefaultDir ? "npx @toon-protocol/townhouse hs up" : `npx @toon-protocol/townhouse hs up -c ${join(dir, "config.yaml")}`;
|
|
2033
|
+
console.log("");
|
|
2034
|
+
console.log("Next \u2014 start your node:");
|
|
2035
|
+
console.log(` ${cmd}`);
|
|
2036
|
+
console.log("");
|
|
2037
|
+
console.log(
|
|
2038
|
+
"First run pulls container images and bootstraps a hidden service."
|
|
2039
|
+
);
|
|
2040
|
+
console.log("It can take a few minutes; progress is shown throughout.");
|
|
2041
|
+
}
|
|
2028
2042
|
async function handleInit(force, configDir, password, preset, yes) {
|
|
2029
2043
|
const dir = resolve(configDir ?? DEFAULT_CONFIG_DIR);
|
|
2030
2044
|
const configPath = join(dir, "config.yaml");
|
|
@@ -2058,9 +2072,17 @@ async function handleInit(force, configDir, password, preset, yes) {
|
|
|
2058
2072
|
console.log(`Config created at ${configPath}`);
|
|
2059
2073
|
const walletPath = join(dir, "wallet.enc");
|
|
2060
2074
|
if (existsSync(walletPath) && !force) {
|
|
2075
|
+
console.log("");
|
|
2076
|
+
console.log(
|
|
2077
|
+
`Wallet already exists at ${walletPath} \u2014 keeping your existing keys.`
|
|
2078
|
+
);
|
|
2061
2079
|
console.log(
|
|
2062
|
-
|
|
2080
|
+
"Your seed phrase from the first run is still valid; nothing changed."
|
|
2063
2081
|
);
|
|
2082
|
+
console.log(
|
|
2083
|
+
"(Re-run with --force to regenerate, which REPLACES your keys.)"
|
|
2084
|
+
);
|
|
2085
|
+
printInitNextStep(dir);
|
|
2064
2086
|
return;
|
|
2065
2087
|
}
|
|
2066
2088
|
const walletPassword = password ?? process.env["TOWNHOUSE_WALLET_PASSWORD"];
|
|
@@ -2094,6 +2116,7 @@ async function handleInit(force, configDir, password, preset, yes) {
|
|
|
2094
2116
|
console.log(` ${"".padEnd(6)} EVM: ${info.evmAddress}`);
|
|
2095
2117
|
}
|
|
2096
2118
|
walletManager.lock();
|
|
2119
|
+
printInitNextStep(dir);
|
|
2097
2120
|
}
|
|
2098
2121
|
async function handleSetup(configDir, port, noBrowser, dockerInstance, browserOpener) {
|
|
2099
2122
|
const dir = resolve(configDir ?? DEFAULT_CONFIG_DIR);
|
|
@@ -3041,7 +3064,7 @@ async function handleHsUp(_configPath, configDir, config, docker, options) {
|
|
|
3041
3064
|
resolvedPassword = await promptPassword("Wallet password: ");
|
|
3042
3065
|
} else {
|
|
3043
3066
|
console.error(
|
|
3044
|
-
"Wallet password required
|
|
3067
|
+
"Wallet password required, but no interactive terminal is available to prompt.\nPass --password <pw> or set TOWNHOUSE_WALLET_PASSWORD."
|
|
3045
3068
|
);
|
|
3046
3069
|
process.exitCode = 1;
|
|
3047
3070
|
return;
|
|
@@ -3131,11 +3154,18 @@ async function handleHsUp(_configPath, configDir, config, docker, options) {
|
|
|
3131
3154
|
console.log(` [${pulled}/${apexImages.length}] ${ref}`);
|
|
3132
3155
|
await orch.pullImage(ref);
|
|
3133
3156
|
}
|
|
3157
|
+
} else {
|
|
3158
|
+
console.log(
|
|
3159
|
+
"No pinned image manifest found \u2014 Docker will pull images on demand."
|
|
3160
|
+
);
|
|
3161
|
+
console.log(
|
|
3162
|
+
"First start can take several minutes with limited progress output."
|
|
3163
|
+
);
|
|
3134
3164
|
}
|
|
3135
3165
|
} catch (pullErr) {
|
|
3136
3166
|
const detail = pullErr instanceof Error ? pullErr.message : String(pullErr);
|
|
3137
|
-
console.
|
|
3138
|
-
`
|
|
3167
|
+
console.log(
|
|
3168
|
+
`Could not pre-pull images (${detail}). Docker will pull them during startup \u2014 this is normal and may take a few minutes.`
|
|
3139
3169
|
);
|
|
3140
3170
|
}
|
|
3141
3171
|
}
|
|
@@ -3156,6 +3186,10 @@ async function handleHsUp(_configPath, configDir, config, docker, options) {
|
|
|
3156
3186
|
resolve(config.wallet.encrypted_path)
|
|
3157
3187
|
);
|
|
3158
3188
|
process.env["TOWNHOUSE_DOCKER_GID"] = String(dockerSockGid);
|
|
3189
|
+
if (!bootstrapStarted) {
|
|
3190
|
+
bootstrapStarted = true;
|
|
3191
|
+
ribbon.start("bootstrap");
|
|
3192
|
+
}
|
|
3159
3193
|
const MAX_ANON_RETRIES = 3;
|
|
3160
3194
|
try {
|
|
3161
3195
|
for (let attempt = 1; attempt <= MAX_ANON_RETRIES; attempt++) {
|
|
@@ -3230,11 +3264,23 @@ async function handleHsUp(_configPath, configDir, config, docker, options) {
|
|
|
3230
3264
|
});
|
|
3231
3265
|
ribbon.start("live", hostname);
|
|
3232
3266
|
if (shouldRenderInk()) {
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3267
|
+
try {
|
|
3268
|
+
const { mountTui } = await import("./tui-OIFXGBTL.js");
|
|
3269
|
+
const apiUrlOverride = process.env["HS_TOWNHOUSE_API_URL"];
|
|
3270
|
+
const mountOpts = apiUrlOverride !== void 0 ? { apiUrl: apiUrlOverride } : {};
|
|
3271
|
+
const instance = mountTui(mountOpts);
|
|
3272
|
+
await instance.waitUntilExit();
|
|
3273
|
+
} catch (tuiErr) {
|
|
3274
|
+
const detail = tuiErr instanceof Error ? tuiErr.message : String(tuiErr);
|
|
3275
|
+
console.error("");
|
|
3276
|
+
console.error(`Your node is live at ${hostname}.`);
|
|
3277
|
+
console.error(
|
|
3278
|
+
`The live dashboard could not open (${detail}) \u2014 this is a display issue, not a node issue. Your node keeps running.`
|
|
3279
|
+
);
|
|
3280
|
+
console.error(
|
|
3281
|
+
"Stop it anytime with: npx @toon-protocol/townhouse hs down"
|
|
3282
|
+
);
|
|
3283
|
+
}
|
|
3238
3284
|
}
|
|
3239
3285
|
} catch (err) {
|
|
3240
3286
|
const { exitCode } = renderFailure(err);
|
|
@@ -3671,7 +3717,14 @@ async function main(argv, dockerInstance, browserOpener, hsOverrides, nodeComman
|
|
|
3671
3717
|
}
|
|
3672
3718
|
}
|
|
3673
3719
|
var invokedFile = process.argv[1];
|
|
3674
|
-
var invokedDirectly =
|
|
3720
|
+
var invokedDirectly = false;
|
|
3721
|
+
if (typeof invokedFile === "string") {
|
|
3722
|
+
try {
|
|
3723
|
+
invokedDirectly = import.meta.url === pathToFileURL(realpathSync(invokedFile)).href;
|
|
3724
|
+
} catch {
|
|
3725
|
+
invokedDirectly = import.meta.url === pathToFileURL(invokedFile).href;
|
|
3726
|
+
}
|
|
3727
|
+
}
|
|
3675
3728
|
if (invokedDirectly) {
|
|
3676
3729
|
main(process.argv.slice(2)).catch((error) => {
|
|
3677
3730
|
if (error instanceof CliHelpRequested) {
|