shinjuku-shield 0.3.141 → 0.3.143
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 +6 -6
- package/manifest.json +5 -4
- package/package.json +3 -3
- package/shinjuku-wallet.mjs +81 -12
package/README.md
CHANGED
|
@@ -6,19 +6,19 @@ answers privately, in a terminal chat or for your agent app. Its `mcp`
|
|
|
6
6
|
command runs a local MCP server (stdio) for your agent. Your keys never
|
|
7
7
|
leave your machine.
|
|
8
8
|
|
|
9
|
-
This is version 0.3.
|
|
9
|
+
This is version 0.3.143. The npm packages `shinjuku-shield` and
|
|
10
10
|
`shinjuku-shielded` hold the same files. The command is `shinjuku`.
|
|
11
11
|
|
|
12
12
|
## Set up
|
|
13
13
|
|
|
14
14
|
```sh
|
|
15
|
-
npm install -g shinjuku@0.3.
|
|
15
|
+
npm install -g shinjuku@0.3.143
|
|
16
16
|
shinjuku setup
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
Type the two lines as they are. `npx install shinjuku` does not work: npx
|
|
20
20
|
reads `install` as the name of another npm package. To set up without
|
|
21
|
-
installing, type `npx shinjuku@0.3.
|
|
21
|
+
installing, type `npx shinjuku@0.3.143 setup`.
|
|
22
22
|
|
|
23
23
|
Setup makes the wallet on this machine, a private passphrase file, and the
|
|
24
24
|
checked proof tools (about 191 MB), and writes `config.json`. It also writes
|
|
@@ -36,13 +36,13 @@ Every wallet command works after `shinjuku`, for example `shinjuku balance`,
|
|
|
36
36
|
Claude Code:
|
|
37
37
|
|
|
38
38
|
```sh
|
|
39
|
-
claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.
|
|
39
|
+
claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.143 mcp
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
Claude Desktop (`claude_desktop_config.json`) or Cursor (`~/.cursor/mcp.json`):
|
|
43
43
|
|
|
44
44
|
```json
|
|
45
|
-
{ "mcpServers": { "shinjuku": { "command": "npx", "args": ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.
|
|
45
|
+
{ "mcpServers": { "shinjuku": { "command": "npx", "args": ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.143", "mcp"] } } }
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
On native Windows, if the host cannot find `npx`, use `"command": "cmd"` and
|
|
@@ -55,7 +55,7 @@ Codex (the Codex app and Codex CLI read the same file, `~/.codex/config.toml`):
|
|
|
55
55
|
```toml
|
|
56
56
|
[mcp_servers.shinjuku]
|
|
57
57
|
command = "npx"
|
|
58
|
-
args = ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.
|
|
58
|
+
args = ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.143", "mcp"]
|
|
59
59
|
startup_timeout_sec = 120
|
|
60
60
|
tool_timeout_sec = 300
|
|
61
61
|
```
|
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": "d1d7233b86e252e58009678280970cb3aaa264c8569bd29f790e5a592a948138",
|
|
5
|
+
"bytes": 8974175,
|
|
6
|
+
"sourceCommit": "d25e1296d250570e9a2a5c427ea98730b75a1cee",
|
|
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",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"src/server/payments/shielded/p03LoopLag.ts",
|
|
39
39
|
"src/server/payments/shielded/p03MinContextSlotRetry.ts",
|
|
40
40
|
"src/server/payments/shielded/p03PhotonHost.ts",
|
|
41
|
+
"src/server/payments/shielded/p03QuoteRingAnchor.ts",
|
|
41
42
|
"src/server/payments/shielded/poseidon/poseidon_params_t_2.json",
|
|
42
43
|
"src/server/payments/shielded/poseidon/poseidon_params_t_3.json",
|
|
43
44
|
"src/server/payments/shielded/poseidon/poseidon_params_t_6.json",
|
|
@@ -1037,5 +1038,5 @@
|
|
|
1037
1038
|
"version": "1.8.0"
|
|
1038
1039
|
}
|
|
1039
1040
|
],
|
|
1040
|
-
"publishedAt": "2026-11-
|
|
1041
|
+
"publishedAt": "2026-11-01T09:22:38.910Z"
|
|
1041
1042
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinjuku-shield",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.143",
|
|
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": "d1d7233b",
|
|
7
|
+
"shinjukuSha256": "d1d7233b86e252e58009678280970cb3aaa264c8569bd29f790e5a592a948138",
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
9
9
|
"author": "Shinjuku Shielded",
|
|
10
10
|
"homepage": "https://github.com/ShinjukuStaition/shinjuku-shield#readme",
|
package/shinjuku-wallet.mjs
CHANGED
|
@@ -80044,6 +80044,35 @@ var init_ShieldedSolanaP03Types = __esm({
|
|
|
80044
80044
|
}
|
|
80045
80045
|
});
|
|
80046
80046
|
|
|
80047
|
+
// src/server/payments/shielded/p03QuoteRingAnchor.ts
|
|
80048
|
+
function p03QuoteValidBefore(epoch) {
|
|
80049
|
+
return (epoch + 2n) * EPOCH_SECONDS;
|
|
80050
|
+
}
|
|
80051
|
+
function p03RingAnchorHasQuoteMargin(epoch, chainTimestamp) {
|
|
80052
|
+
return p03QuoteValidBefore(epoch) - chainTimestamp >= P03_QUOTE_RING_ANCHOR_MIN_SECONDS_LEFT;
|
|
80053
|
+
}
|
|
80054
|
+
function p03StaleQuoteAnchorRing(error) {
|
|
80055
|
+
return error instanceof P03QuoteAnchorStaleError ? error.ring : void 0;
|
|
80056
|
+
}
|
|
80057
|
+
function p03RingAnchorServesQuote(anchor, ring) {
|
|
80058
|
+
return p03RingAnchorHasQuoteMargin(anchor.epoch, ring.chainTimestamp) && ring.anchors.some((slot3) => slot3.epoch === anchor.epoch && slot3.anchorIndex === anchor.anchorIndex && slot3.anchorRoot === anchor.anchorRoot);
|
|
80059
|
+
}
|
|
80060
|
+
var P03_QUOTE_RING_ANCHOR_MIN_SECONDS_LEFT, EPOCH_SECONDS, P03QuoteAnchorStaleError;
|
|
80061
|
+
var init_p03QuoteRingAnchor = __esm({
|
|
80062
|
+
"src/server/payments/shielded/p03QuoteRingAnchor.ts"() {
|
|
80063
|
+
"use strict";
|
|
80064
|
+
P03_QUOTE_RING_ANCHOR_MIN_SECONDS_LEFT = 120n;
|
|
80065
|
+
EPOCH_SECONDS = 300n;
|
|
80066
|
+
P03QuoteAnchorStaleError = class extends Error {
|
|
80067
|
+
ring;
|
|
80068
|
+
constructor(ring) {
|
|
80069
|
+
super("p03_quote_anchor_stale");
|
|
80070
|
+
this.ring = Object.freeze({ ...ring, anchors: Object.freeze(ring.anchors.map((anchor) => Object.freeze({ ...anchor }))) });
|
|
80071
|
+
}
|
|
80072
|
+
};
|
|
80073
|
+
}
|
|
80074
|
+
});
|
|
80075
|
+
|
|
80047
80076
|
// src/server/payments/shielded/ShieldedSolanaP03Quote.ts
|
|
80048
80077
|
function deriveShieldedSolanaP03SvmMappings(input) {
|
|
80049
80078
|
const network = canonicalNetwork(input.network);
|
|
@@ -80100,8 +80129,8 @@ function parseAnchor(raw, label) {
|
|
|
80100
80129
|
});
|
|
80101
80130
|
}
|
|
80102
80131
|
function checkedValidBefore(epoch) {
|
|
80103
|
-
if (epoch > U64_LIMIT /
|
|
80104
|
-
return (epoch + 2n) *
|
|
80132
|
+
if (epoch > U64_LIMIT / EPOCH_SECONDS2 - 2n) throw new Error("p03_quote_expiry_overflow");
|
|
80133
|
+
return (epoch + 2n) * EPOCH_SECONDS2;
|
|
80105
80134
|
}
|
|
80106
80135
|
function canonicalPublicInput(value2) {
|
|
80107
80136
|
if (value2 instanceof Uint8Array) {
|
|
@@ -80228,7 +80257,7 @@ function assertExactKeys(value2, expectedKeys, label) {
|
|
|
80228
80257
|
throw new Error(`p03_quote_${label}_shape_invalid`);
|
|
80229
80258
|
}
|
|
80230
80259
|
}
|
|
80231
|
-
var import_web3108, U48_LIMIT, U64_LIMIT,
|
|
80260
|
+
var import_web3108, U48_LIMIT, U64_LIMIT, EPOCH_SECONDS2, QUOTE_DOMAIN_LABEL, POOL_DOMAIN_LABEL, SHIELDED_SOLANA_P03_QUOTE_DOMAIN, REQUIREMENT_KEYS, EXTRA_KEYS, ShieldedSolanaP03QuoteIssuer;
|
|
80232
80261
|
var init_ShieldedSolanaP03Quote = __esm({
|
|
80233
80262
|
"src/server/payments/shielded/ShieldedSolanaP03Quote.ts"() {
|
|
80234
80263
|
"use strict";
|
|
@@ -80236,10 +80265,11 @@ var init_ShieldedSolanaP03Quote = __esm({
|
|
|
80236
80265
|
init_sha3();
|
|
80237
80266
|
init_utils();
|
|
80238
80267
|
init_ShieldedSolanaP03Types();
|
|
80268
|
+
init_p03QuoteRingAnchor();
|
|
80239
80269
|
init_ShieldedSolanaP03QuoteCrypto();
|
|
80240
80270
|
U48_LIMIT = 1n << 48n;
|
|
80241
80271
|
U64_LIMIT = 1n << 64n;
|
|
80242
|
-
|
|
80272
|
+
EPOCH_SECONDS2 = 300n;
|
|
80243
80273
|
QUOTE_DOMAIN_LABEL = utf8ToBytes("carbon-shielded-exact/quote/v1");
|
|
80244
80274
|
POOL_DOMAIN_LABEL = utf8ToBytes("carbon-shielded-exact/pool/v1");
|
|
80245
80275
|
SHIELDED_SOLANA_P03_QUOTE_DOMAIN = bytesToBigInt2(keccak_256(QUOTE_DOMAIN_LABEL)) % SHIELDED_SOLANA_P03_QUOTE_FIELD_MODULUS;
|
|
@@ -80307,7 +80337,7 @@ var init_ShieldedSolanaP03Quote = __esm({
|
|
|
80307
80337
|
}
|
|
80308
80338
|
async issue(recipientAddress) {
|
|
80309
80339
|
const evidence = parseAnchorEvidence(await this.readCurrentQuoteAnchor());
|
|
80310
|
-
const chainEpoch = evidence.chainTimestamp /
|
|
80340
|
+
const chainEpoch = evidence.chainTimestamp / EPOCH_SECONDS2;
|
|
80311
80341
|
if (evidence.current.epoch !== chainEpoch) throw new Error("p03_quote_anchor_not_current");
|
|
80312
80342
|
const nonceResult = this.randomBytes(32);
|
|
80313
80343
|
if (!(nonceResult instanceof Uint8Array) || nonceResult.length !== 32) {
|
|
@@ -80337,7 +80367,17 @@ var init_ShieldedSolanaP03Quote = __esm({
|
|
|
80337
80367
|
}
|
|
80338
80368
|
async authenticate(input) {
|
|
80339
80369
|
const parsed2 = this.parseAuthentication(input);
|
|
80340
|
-
|
|
80370
|
+
let raw;
|
|
80371
|
+
try {
|
|
80372
|
+
raw = await this.readCurrentQuoteAnchor();
|
|
80373
|
+
} catch (error) {
|
|
80374
|
+
const ring = p03StaleQuoteAnchorRing(error);
|
|
80375
|
+
if (ring === void 0) throw error;
|
|
80376
|
+
if (ring.chainTimestamp >= parsed2.validBefore) throw new Error("p03_quote_expired");
|
|
80377
|
+
if (!p03RingAnchorServesQuote(parsed2.anchor, ring)) throw error;
|
|
80378
|
+
return this.authenticateParsed(input, parsed2);
|
|
80379
|
+
}
|
|
80380
|
+
const evidence = parseAnchorEvidence(raw);
|
|
80341
80381
|
if (evidence.chainTimestamp >= parsed2.validBefore) throw new Error("p03_quote_expired");
|
|
80342
80382
|
if (parsed2.anchor.epoch > evidence.current.epoch || parsed2.anchor.epoch === evidence.current.epoch && parsed2.anchor.anchorIndex > evidence.current.anchorIndex) {
|
|
80343
80383
|
throw new Error("p03_quote_anchor_stale");
|
|
@@ -82217,8 +82257,10 @@ function createAnchorReader({ connection, profile }) {
|
|
|
82217
82257
|
if (chainTimestamp < 0n) fail17("chain_clock_invalid");
|
|
82218
82258
|
const anchors = state.validAnchors.map((a) => ({ epoch: a.epoch, anchorIndex: a.index, anchorRoot: bigint(a.root) }));
|
|
82219
82259
|
const current = anchors.find((a) => a.epoch === chainTimestamp / 300n);
|
|
82220
|
-
|
|
82221
|
-
const
|
|
82260
|
+
const newest = anchors[0];
|
|
82261
|
+
const ringSlotServes = !current && requireCapacity && state.anchorMode === 2 && state.anchorRing !== null && newest !== void 0 && newest.anchorIndex === BigInt(state.currentIndex) && p03RingAnchorHasQuoteMargin(BigInt(newest.epoch), chainTimestamp);
|
|
82262
|
+
if (requireCapacity && !current && !ringSlotServes) fail17("anchor_not_ready");
|
|
82263
|
+
const selected = current ?? newest;
|
|
82222
82264
|
return {
|
|
82223
82265
|
...selected,
|
|
82224
82266
|
chainTimestamp,
|
|
@@ -83142,6 +83184,7 @@ var init_service = __esm({
|
|
|
83142
83184
|
init_EncryptedJsonFile();
|
|
83143
83185
|
init_finalizedReadMemo();
|
|
83144
83186
|
init_ShieldedSolanaP03Quote();
|
|
83187
|
+
init_p03QuoteRingAnchor();
|
|
83145
83188
|
init_ShieldedSolanaP03MemoScanner();
|
|
83146
83189
|
init_SolanaP03Wire();
|
|
83147
83190
|
init_ShieldedSolanaP03QuoteCrypto();
|
|
@@ -151566,6 +151609,31 @@ var payerSessionFlags = () => [
|
|
|
151566
151609
|
flag2("--memo-service", "<url>", "server that serves the encrypted memos (its origin is also the default RPC relay)", { required: true }),
|
|
151567
151610
|
HISTORY_RPC_FLAG
|
|
151568
151611
|
];
|
|
151612
|
+
var BALANCE_NEXT_SET_UP = `back up the wallet (${CLI_WORD} help backup-export); ${CLI_WORD} balance shows the private balance`;
|
|
151613
|
+
var BALANCE_NEXT = `${BALANCE_NEXT_SET_UP} (a wallet you name by flags, not set up: ${CLI_WORD} help balance)`;
|
|
151614
|
+
var SPEND_WALLET_FOLLOWED = /* @__PURE__ */ Symbol("spend wallet followed");
|
|
151615
|
+
function sameFile(a, b) {
|
|
151616
|
+
const real = (path) => {
|
|
151617
|
+
try {
|
|
151618
|
+
return realpathSync.native(path);
|
|
151619
|
+
} catch {
|
|
151620
|
+
return resolve36(path);
|
|
151621
|
+
}
|
|
151622
|
+
};
|
|
151623
|
+
const [x, y] = [real(a), real(b)];
|
|
151624
|
+
return process.platform === "win32" ? x.toLowerCase() === y.toLowerCase() : x === y;
|
|
151625
|
+
}
|
|
151626
|
+
function balanceNextAfterRun(values, deps) {
|
|
151627
|
+
try {
|
|
151628
|
+
const home = setupHome(deps.env);
|
|
151629
|
+
const config = setupConfigOf(home);
|
|
151630
|
+
if (!config?.pool) return BALANCE_NEXT;
|
|
151631
|
+
const wallet = values.get(SPEND_WALLET_FOLLOWED) ?? values.get("--wallet");
|
|
151632
|
+
return wallet === void 0 || sameFile(wallet, homeWalletPath(home, config.pool)) ? BALANCE_NEXT_SET_UP : BALANCE_NEXT;
|
|
151633
|
+
} catch {
|
|
151634
|
+
return BALANCE_NEXT;
|
|
151635
|
+
}
|
|
151636
|
+
}
|
|
151569
151637
|
var PAYER_SESSION_BASE = `--pool ${GUIDE.pool} --rpc-file rpc.txt --proof-tools proof-tools.json --program ${GUIDE.program} --memo-service ${GUIDE.facilitator}`;
|
|
151570
151638
|
function validatePayerSession(name, values, env) {
|
|
151571
151639
|
if (values.has("--pool") === values.has("--wallet")) {
|
|
@@ -151832,6 +151900,7 @@ async function spendGate(args, values, deps, io, { amountAtomic, again }) {
|
|
|
151832
151900
|
}
|
|
151833
151901
|
const index = args.indexOf("--wallet");
|
|
151834
151902
|
if (!followed || index < 0 || resolve36(followed) === walletFile) return args;
|
|
151903
|
+
values.set(SPEND_WALLET_FOLLOWED, followed);
|
|
151835
151904
|
return [...args.slice(0, index + 1), followed, ...args.slice(index + 2)];
|
|
151836
151905
|
}
|
|
151837
151906
|
async function pocketFillGate(args, values, deps, io) {
|
|
@@ -154891,9 +154960,8 @@ var COMMANDS = [
|
|
|
154891
154960
|
`Outside sellers: a seller that takes only a standard USDC payment (Coinbase CDP, PayAI, any Solana x402 seller on this pool's network and token) is paid through Shinjuku. Your wallet pays Shinjuku privately from the private balance (the seller's price plus a small fee; GET <server>/api/x402/float/config shows feeAtomic), and Shinjuku pays the seller at once from its own funds. The chain shows Shinjuku paying the seller, never your wallet. Nothing to fill or set up. --maximum-atomic must cover price + fee. The output then has "scheme": "exact" (the x402 name of a standard payment: Shinjuku paid the seller).`,
|
|
154892
154961
|
"If the seller does not take Shinjuku's payment, Shinjuku refunds price + fee to your private balance by itself; the run says so (p03_float_refund_pending), with the time Shinjuku gives, and there is nothing more to do. A rerun with the same --request-id never pays Shinjuku twice: it sends the same payment to the seller again."
|
|
154893
154962
|
],
|
|
154894
|
-
|
|
154895
|
-
|
|
154896
|
-
next: `back up the wallet (${CLI_WORD} help backup-export); ${CLI_WORD} balance shows the private balance (a wallet you name by flags, not set up: ${CLI_WORD} help balance)`,
|
|
154963
|
+
next: BALANCE_NEXT,
|
|
154964
|
+
nextAfterRun: balanceNextAfterRun,
|
|
154897
154965
|
// Its progress lines show only with --verbose, in a terminal or not (progressQuiet, H10b); pay/cli.mjs takes no --verbose.
|
|
154898
154966
|
quietProgress: (values) => progressQuiet(values),
|
|
154899
154967
|
run: async (args, values, deps, io) => deps.payMain(await spendGate(
|
|
@@ -155369,7 +155437,8 @@ If an agent app already runs the wallet, close and open it so it reads these set
|
|
|
155369
155437
|
"In a terminal it ends with one plain line (what was sent, to whom, the transaction) and the new private balance: after a send the wallet reads the balance again itself (the same walk as balance --refresh, over the same connection; Tor when setup recorded it). A program, or --json, gets the result as JSON. The wallet's own progress lines (Tor, the RPC relay, the pool history walk, the memo reads, the steps that get your balance ready to send) show only with --verbose; warnings and failures always show.",
|
|
155370
155438
|
`One unshield is one transfer to the address. An unshield that an older version started as several smaller payments still finishes: run the same command with its --unshield-id; ${CLI_WORD} unshield-cancel --unshield-id <id> stops the ones not sent yet.`
|
|
155371
155439
|
],
|
|
155372
|
-
next:
|
|
155440
|
+
next: BALANCE_NEXT,
|
|
155441
|
+
nextAfterRun: balanceNextAfterRun,
|
|
155373
155442
|
// U4 (mcp56, 0.3.98: about 60 lines): help unshield shows these; help unshield --verbose shows every flag and note.
|
|
155374
155443
|
brief: { flags: ["--amount", "--to"], notes: [0, 3] },
|
|
155375
155444
|
// Its progress lines show only with --verbose, in a terminal or not (progressQuiet; fault 6 of the pin 0.3.86).
|