shinjuku-shielded 0.3.10 → 0.3.11
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/manifest.json +3 -3
- package/package.json +3 -3
- package/shinjuku-wallet.mjs +64 -7
package/manifest.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "carbon-shielded-wallet/bundle-manifest/v1",
|
|
3
3
|
"file": "shinjuku-wallet.mjs",
|
|
4
|
-
"sha256": "
|
|
5
|
-
"bytes":
|
|
6
|
-
"sourceCommit": "
|
|
4
|
+
"sha256": "a9b9ea19ca82a7e4fe991f01050aae148bea45db0bb46be31c22df310e081969",
|
|
5
|
+
"bytes": 10949292,
|
|
6
|
+
"sourceCommit": "043825750e3f2f6138f265ad8b909764455bc24d",
|
|
7
7
|
"sourceDirty": false,
|
|
8
8
|
"installRecordMatchesLockfile": true,
|
|
9
9
|
"releaseRule": "valid only when two fresh npm ci --ignore-scripts builds on different OSes give the same sha256; installRecordMatchesLockfile true means every entry npm installed equals its package-lock.json entry and every entry not marked optional, devOptional included, is installed: an optional entry (a package for another platform) may be absent",
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinjuku-shielded",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"mcpName": "io.github.ShinjukuStaition/shinjuku-mcp",
|
|
5
5
|
"description": "Shinjuku Shielded, the private x402 facilitator on Solana: the self-custody wallet CLI and its MCP server. Shield, pay, and unshield USDC from any MCP agent, under caps you set.",
|
|
6
|
-
"shinjukuRelease": "
|
|
7
|
-
"shinjukuSha256": "
|
|
6
|
+
"shinjukuRelease": "a9b9ea19",
|
|
7
|
+
"shinjukuSha256": "a9b9ea19ca82a7e4fe991f01050aae148bea45db0bb46be31c22df310e081969",
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
9
9
|
"author": "Shinjuku Shielded",
|
|
10
10
|
"homepage": "https://github.com/ShinjukuStaition/shinjuku-mcp#readme",
|
package/shinjuku-wallet.mjs
CHANGED
|
@@ -129591,7 +129591,8 @@ var COMMANDS = [
|
|
|
129591
129591
|
"--add-to for Claude Desktop or Cursor: a host config whose mcpServers is not a JSON object, or that has a different shinjuku-shielded entry (without --force), is left alone. Otherwise the old file is copied to <file>.bak-<time> (mode 0600 on Linux and macOS; on Windows the folder's access list) and the new file replaces it in one rename.",
|
|
129592
129592
|
"The provers are Linux programs. Linux: ready. Windows: the wallet runs them through WSL; setup checks that wsl.exe runs (wsl --install -d Ubuntu otherwise). macOS: not supported; setup says so and creates nothing.",
|
|
129593
129593
|
"Run it again at any time: it never changes an existing wallet, keeps the recorded caps unless you pass new ones, checks every proof-tool file again, downloads what is missing or newer, and rewrites config.json.",
|
|
129594
|
-
"Then mcp needs no flags: npx -y shinjuku-shielded mcp reads config.json (a flag on the command line still wins). Before setup, mcp in a terminal offers to run setup; started by an agent host, it serves shinjuku_setup, which runs this same setup after you confirm in the host."
|
|
129594
|
+
"Then mcp needs no flags: npx -y shinjuku-shielded mcp reads config.json (a flag on the command line still wins). Before setup, mcp in a terminal offers to run setup; started by an agent host, it serves shinjuku_setup, which runs this same setup after you confirm in the host.",
|
|
129595
|
+
"A command that takes --pool (balance, recover, deposit, add-funds, and others) takes it, and the passphrase of this home's wallet, from config.json when you leave them out: shinjuku-wallet balance needs no flags. A flag or SHIELDED_WALLET_PASSPHRASE still wins; init and restore never use config.json, and move reads it itself."
|
|
129595
129596
|
],
|
|
129596
129597
|
next: `start it from your agent host with npx -y shinjuku-shielded mcp (or ${CLI2} mcp), then ask your agent "what is my balance"`,
|
|
129597
129598
|
run: (args, values, deps, io) => deps.setupMain(values, { ...deps, io })
|
|
@@ -130257,6 +130258,55 @@ function checkValue(spec, value) {
|
|
|
130257
130258
|
}
|
|
130258
130259
|
return void 0;
|
|
130259
130260
|
}
|
|
130261
|
+
var NO_CONFIG_DEFAULTS = /* @__PURE__ */ new Set(["mcp", "setup", "init", "restore", "move"]);
|
|
130262
|
+
function configDefaults(command, args, deps) {
|
|
130263
|
+
const unchanged = { args, passphrase: void 0 };
|
|
130264
|
+
if (NO_CONFIG_DEFAULTS.has(command.name) || command.beforeValidate) return unchanged;
|
|
130265
|
+
const has2 = (name) => command.flags.some((spec) => spec.name === name);
|
|
130266
|
+
const given = parseFlags(command, args);
|
|
130267
|
+
const passphraseFileSpec = command.flags.find((spec) => spec.name === "--passphrase-file");
|
|
130268
|
+
const envPassphrase = Boolean(deps.env[PASSPHRASE_ENV2]);
|
|
130269
|
+
const wantPool = has2("--pool") && !given.has("--pool") && !given.has("--wallet");
|
|
130270
|
+
const wantFile = Boolean(passphraseFileSpec) && !given.has("--passphrase-file") && (passphraseFileSpec.required || !envPassphrase);
|
|
130271
|
+
const wantEnv = !passphraseFileSpec && command.env.includes(PASSPHRASE_ENV2) && !envPassphrase;
|
|
130272
|
+
if (!wantPool && !wantFile && !wantEnv) return unchanged;
|
|
130273
|
+
const home = setupHome(deps.env);
|
|
130274
|
+
const config = setupConfigOf(home);
|
|
130275
|
+
if (!config) return unchanged;
|
|
130276
|
+
const added = wantPool ? ["--pool", config.pool] : [];
|
|
130277
|
+
const pool = wantPool ? config.pool : given.get("--pool");
|
|
130278
|
+
const homePools = [config.pool, ...(config.previousPools ?? []).map((entry) => entry.pool)];
|
|
130279
|
+
const ownWallet = given.has("--wallet") ? homePools.some((entry) => resolve33(given.get("--wallet")) === resolve33(homeWalletPath(home, entry))) : homePools.includes(pool);
|
|
130280
|
+
if (!ownWallet || !wantFile && !wantEnv) return { args: [...args, ...added], passphrase: void 0 };
|
|
130281
|
+
const where = `config.json (${join32(home, "config.json")})`;
|
|
130282
|
+
if (wantFile) {
|
|
130283
|
+
if (!config.passphraseFile) {
|
|
130284
|
+
throw new UsageError(`${command.name} needs the wallet passphrase: ${where} names no passphrase file; pass --passphrase-file <file>, or rerun ${CLI2} setup (it keeps the wallet)`, command);
|
|
130285
|
+
}
|
|
130286
|
+
return { args: [...args, ...added, "--passphrase-file", config.passphraseFile], passphrase: void 0 };
|
|
130287
|
+
}
|
|
130288
|
+
let text3;
|
|
130289
|
+
try {
|
|
130290
|
+
text3 = config.passphraseFile ? readSecretText(config.passphraseFile, "the passphrase file") : void 0;
|
|
130291
|
+
} catch (error) {
|
|
130292
|
+
if (error instanceof SecretFileEncodingError) throw new PublicFailure(error.message);
|
|
130293
|
+
text3 = void 0;
|
|
130294
|
+
}
|
|
130295
|
+
if (!text3) {
|
|
130296
|
+
throw new UsageError(`${PASSPHRASE_ENV2} is not set, and the passphrase file that ${where} names (${config.passphraseFile ?? "none"}) could not be read or is empty: export ${PASSPHRASE_ENV2}=<your wallet passphrase>, or rerun ${CLI2} setup (it keeps the wallet)`, command);
|
|
130297
|
+
}
|
|
130298
|
+
return { args: [...args, ...added], passphrase: text3 };
|
|
130299
|
+
}
|
|
130300
|
+
function lendPassphrase(passphrase2) {
|
|
130301
|
+
if (passphrase2 === void 0) return () => {
|
|
130302
|
+
};
|
|
130303
|
+
const saved = process.env[PASSPHRASE_ENV2];
|
|
130304
|
+
process.env[PASSPHRASE_ENV2] = passphrase2;
|
|
130305
|
+
return () => {
|
|
130306
|
+
if (saved === void 0) delete process.env[PASSPHRASE_ENV2];
|
|
130307
|
+
else process.env[PASSPHRASE_ENV2] = saved;
|
|
130308
|
+
};
|
|
130309
|
+
}
|
|
130260
130310
|
function validate3(command, values, env) {
|
|
130261
130311
|
const missing = command.flags.filter((spec) => (spec.required || spec.requiredUnless && !values.has(spec.requiredUnless)) && !values.has(spec.name));
|
|
130262
130312
|
if (missing.length === 1) {
|
|
@@ -131331,17 +131381,24 @@ async function runShinjukuWallet(argv, overrides = {}) {
|
|
|
131331
131381
|
io.out(commandHelp(command));
|
|
131332
131382
|
return 0;
|
|
131333
131383
|
}
|
|
131334
|
-
const
|
|
131384
|
+
const defaults = configDefaults(command, command.normalizeArgs ? command.normalizeArgs(command, args) : args, deps);
|
|
131385
|
+
const commandArgs = defaults.args;
|
|
131386
|
+
const runDeps = defaults.passphrase === void 0 ? deps : { ...deps, env: { ...deps.env, [PASSPHRASE_ENV2]: defaults.passphrase } };
|
|
131335
131387
|
values = parseFlags(command, commandArgs);
|
|
131336
|
-
const skip = command.beforeValidate?.(values,
|
|
131337
|
-
if (!skip) validate3(command, values,
|
|
131388
|
+
const skip = command.beforeValidate?.(values, runDeps, commandArgs) === SKIP_VALIDATE;
|
|
131389
|
+
if (!skip) validate3(command, values, runDeps.env);
|
|
131338
131390
|
retiredPoolGuard(command, values, io);
|
|
131339
|
-
const rpc2 = skip ? { args: commandArgs } : rpcFileArgs(command, commandArgs, values,
|
|
131391
|
+
const rpc2 = skip ? { args: commandArgs } : rpcFileArgs(command, commandArgs, values, runDeps, io);
|
|
131340
131392
|
try {
|
|
131341
|
-
applyStoredChannel({ home: setupHome(
|
|
131393
|
+
applyStoredChannel({ home: setupHome(runDeps.env) });
|
|
131342
131394
|
} catch {
|
|
131343
131395
|
}
|
|
131344
|
-
|
|
131396
|
+
const restorePassphrase = lendPassphrase(defaults.passphrase);
|
|
131397
|
+
try {
|
|
131398
|
+
await command.run(rpc2.args, values, rpc2.url === void 0 ? runDeps : { ...runDeps, rpcUrlFromFile: rpc2.url }, io);
|
|
131399
|
+
} finally {
|
|
131400
|
+
restorePassphrase();
|
|
131401
|
+
}
|
|
131345
131402
|
if (!command.nextInOutput) io.err(`next: ${hintForThisRun(command.nextAfterRun?.(values, deps) ?? command.next, values)}
|
|
131346
131403
|
`);
|
|
131347
131404
|
writeRunResult(deps, command, 0);
|