shinjuku-shield 0.3.225 → 0.3.226
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 +4 -4
- package/manifest.json +6 -6
- package/package.json +3 -3
- package/shinjuku-seller.mjs +113 -51
- package/shinjuku-wallet.mjs +419 -330
package/README.md
CHANGED
|
@@ -5,12 +5,12 @@ web services and AI answers from your private balance, so the payment does
|
|
|
5
5
|
not show who paid. It works inside your AI app (Claude, Cursor, Codex) and in
|
|
6
6
|
a terminal. Only you hold the keys: they never leave your computer.
|
|
7
7
|
|
|
8
|
-
This is version 0.3.
|
|
8
|
+
This is version 0.3.226. The command is `shinjuku`.
|
|
9
9
|
|
|
10
10
|
## Set up
|
|
11
11
|
|
|
12
12
|
```sh
|
|
13
|
-
npx -y shinjuku@0.3.
|
|
13
|
+
npx -y shinjuku@0.3.226 setup
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
Setup does every step for you:
|
|
@@ -100,7 +100,7 @@ Add it yourself. The name of the wallet in your app is `shinjuku`.
|
|
|
100
100
|
Claude Code:
|
|
101
101
|
|
|
102
102
|
```sh
|
|
103
|
-
claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.
|
|
103
|
+
claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.226 mcp
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
## For builders: check what you install
|
|
@@ -116,7 +116,7 @@ with the Releases table in
|
|
|
116
116
|
Versions are published from GitHub Actions with npm provenance.
|
|
117
117
|
|
|
118
118
|
`shinjuku-shield` is the package that holds the wallet. `shinjuku-shielded`
|
|
119
|
-
0.3.
|
|
119
|
+
0.3.226, its older name, runs this package at the same version, so wallets
|
|
120
120
|
installed under that name keep updating. New installs use `shinjuku`.
|
|
121
121
|
|
|
122
122
|
The full guide is
|
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": "7096425674f5aabb225d920e2ca4d3dec6156dd90fe971676378d40b0ff7b9e0",
|
|
5
|
+
"bytes": 10327140,
|
|
6
|
+
"sourceCommit": "f76449ff42a89cda9aec487b488ada6e70b846ab",
|
|
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",
|
|
@@ -1075,8 +1075,8 @@
|
|
|
1075
1075
|
],
|
|
1076
1076
|
"seller": {
|
|
1077
1077
|
"file": "shinjuku-seller.mjs",
|
|
1078
|
-
"sha256": "
|
|
1079
|
-
"bytes":
|
|
1078
|
+
"sha256": "b530213797ba8ef7ee651bb9b8666ecb709d7c6b2893d53c3358fc3ecac3887d",
|
|
1079
|
+
"bytes": 4193010,
|
|
1080
1080
|
"entry": "wallet/src/seller/exact/index.mjs",
|
|
1081
1081
|
"external": [
|
|
1082
1082
|
"@x402/core/http",
|
|
@@ -1968,5 +1968,5 @@
|
|
|
1968
1968
|
}
|
|
1969
1969
|
]
|
|
1970
1970
|
},
|
|
1971
|
-
"publishedAt": "2026-11-12T19:
|
|
1971
|
+
"publishedAt": "2026-11-12T19:50:31.830Z"
|
|
1972
1972
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinjuku-shield",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.226",
|
|
4
4
|
"mcpName": "io.github.ShinjukuStaition/shinjuku-shield",
|
|
5
5
|
"description": "Shinjuku Shield, private x402 payments 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": "70964256",
|
|
7
|
+
"shinjukuSha256": "7096425674f5aabb225d920e2ca4d3dec6156dd90fe971676378d40b0ff7b9e0",
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
9
9
|
"author": "Shinjuku Shield",
|
|
10
10
|
"homepage": "https://github.com/ShinjukuStaition/shinjuku-shield#readme",
|
package/shinjuku-seller.mjs
CHANGED
|
@@ -19214,7 +19214,7 @@ var require_stream = __commonJS({
|
|
|
19214
19214
|
};
|
|
19215
19215
|
duplex._final = function(callback) {
|
|
19216
19216
|
if (ws.readyState === ws.CONNECTING) {
|
|
19217
|
-
ws.once("open", function
|
|
19217
|
+
ws.once("open", function open3() {
|
|
19218
19218
|
duplex._final(callback);
|
|
19219
19219
|
});
|
|
19220
19220
|
return;
|
|
@@ -19235,7 +19235,7 @@ var require_stream = __commonJS({
|
|
|
19235
19235
|
};
|
|
19236
19236
|
duplex._write = function(chunk, encoding, callback) {
|
|
19237
19237
|
if (ws.readyState === ws.CONNECTING) {
|
|
19238
|
-
ws.once("open", function
|
|
19238
|
+
ws.once("open", function open3() {
|
|
19239
19239
|
duplex._write(chunk, encoding, callback);
|
|
19240
19240
|
});
|
|
19241
19241
|
return;
|
|
@@ -34996,7 +34996,7 @@ ${Object.entries(params.headers ?? {}).filter(([name, value2]) => value2 !== voi
|
|
|
34996
34996
|
let socket;
|
|
34997
34997
|
let ready = false;
|
|
34998
34998
|
let waitFor200 = false;
|
|
34999
|
-
let
|
|
34999
|
+
let open3 = false;
|
|
35000
35000
|
let reply = Buffer.alloc(0);
|
|
35001
35001
|
let endPending;
|
|
35002
35002
|
let ended2 = false;
|
|
@@ -35044,7 +35044,7 @@ ${Object.entries(params.headers ?? {}).filter(([name, value2]) => value2 !== voi
|
|
|
35044
35044
|
if (keptBytes > REPLAY_LIMIT) tooBigToReplay = true;
|
|
35045
35045
|
return;
|
|
35046
35046
|
}
|
|
35047
|
-
if (!
|
|
35047
|
+
if (!open3 && !tooBigToReplay) {
|
|
35048
35048
|
if (keptBytes + bytes2.length > REPLAY_LIMIT) tooBigToReplay = true;
|
|
35049
35049
|
else {
|
|
35050
35050
|
sent.push({ bytes: bytes2, done: void 0 });
|
|
@@ -35084,7 +35084,7 @@ ${Object.entries(params.headers ?? {}).filter(([name, value2]) => value2 !== voi
|
|
|
35084
35084
|
openTunnelStreams.add(stream);
|
|
35085
35085
|
stream.once("close", () => openTunnelStreams.delete(stream));
|
|
35086
35086
|
stream.once("close", () => {
|
|
35087
|
-
if (!
|
|
35087
|
+
if (!open3) releaseTunnelOpen(onOpen);
|
|
35088
35088
|
});
|
|
35089
35089
|
if (runEnded()) {
|
|
35090
35090
|
stream.destroy();
|
|
@@ -35131,7 +35131,7 @@ ${Object.entries(params.headers ?? {}).filter(([name, value2]) => value2 !== voi
|
|
|
35131
35131
|
resolve18();
|
|
35132
35132
|
});
|
|
35133
35133
|
socket.on("data", (chunk) => {
|
|
35134
|
-
if (
|
|
35134
|
+
if (open3) {
|
|
35135
35135
|
if (!stream.push(chunk)) socket.pause();
|
|
35136
35136
|
return;
|
|
35137
35137
|
}
|
|
@@ -35145,7 +35145,7 @@ ${Object.entries(params.headers ?? {}).filter(([name, value2]) => value2 !== voi
|
|
|
35145
35145
|
return;
|
|
35146
35146
|
}
|
|
35147
35147
|
mark("tunnel-200", `ms${Date.now() - startedAt}_dial${dials}`);
|
|
35148
|
-
|
|
35148
|
+
open3 = true;
|
|
35149
35149
|
tunnelOpened(onOpen, stream);
|
|
35150
35150
|
closedInRow.delete(target);
|
|
35151
35151
|
const rest = reply.subarray(end + 4);
|
|
@@ -35167,11 +35167,11 @@ ${Object.entries(params.headers ?? {}).filter(([name, value2]) => value2 !== voi
|
|
|
35167
35167
|
}
|
|
35168
35168
|
return;
|
|
35169
35169
|
}
|
|
35170
|
-
if (
|
|
35170
|
+
if (open3) stream.destroy(error);
|
|
35171
35171
|
});
|
|
35172
35172
|
socket.on("close", () => {
|
|
35173
35173
|
if (!connected || stream.destroyed) return;
|
|
35174
|
-
if (
|
|
35174
|
+
if (open3) {
|
|
35175
35175
|
stream.push(null);
|
|
35176
35176
|
return;
|
|
35177
35177
|
}
|
|
@@ -53431,6 +53431,58 @@ var init_book = __esm({
|
|
|
53431
53431
|
}
|
|
53432
53432
|
});
|
|
53433
53433
|
|
|
53434
|
+
// wallet/src/net/openRequests.mjs
|
|
53435
|
+
import { AsyncLocalStorage as AsyncLocalStorage4 } from "node:async_hooks";
|
|
53436
|
+
import { performance as performance2 } from "node:perf_hooks";
|
|
53437
|
+
function withRequestName(name, send2) {
|
|
53438
|
+
return requestName.run(name, send2);
|
|
53439
|
+
}
|
|
53440
|
+
function rpcMethodOf(body) {
|
|
53441
|
+
if (typeof body !== "string") return void 0;
|
|
53442
|
+
return /"method"\s*:\s*"([A-Za-z0-9_]{1,48})"/.exec(body.slice(0, 200))?.[1];
|
|
53443
|
+
}
|
|
53444
|
+
var open2, MAX_OPEN, requestName, namedRpcFetch, guarded2, EVENTS;
|
|
53445
|
+
var init_openRequests = __esm({
|
|
53446
|
+
"wallet/src/net/openRequests.mjs"() {
|
|
53447
|
+
"use strict";
|
|
53448
|
+
open2 = /* @__PURE__ */ new Map();
|
|
53449
|
+
MAX_OPEN = 256;
|
|
53450
|
+
requestName = new AsyncLocalStorage4();
|
|
53451
|
+
namedRpcFetch = (fetch2) => (input, init) => {
|
|
53452
|
+
const method = rpcMethodOf(init?.body);
|
|
53453
|
+
return method === void 0 ? fetch2(input, init) : requestName.run(`rpc:${method}`, () => fetch2(input, init));
|
|
53454
|
+
};
|
|
53455
|
+
guarded2 = (fn) => (message) => {
|
|
53456
|
+
try {
|
|
53457
|
+
fn(message);
|
|
53458
|
+
} catch {
|
|
53459
|
+
}
|
|
53460
|
+
};
|
|
53461
|
+
EVENTS = [
|
|
53462
|
+
["undici:request:create", guarded2(({ request }) => {
|
|
53463
|
+
if (!request || request.method === "CONNECT") return;
|
|
53464
|
+
const name = requestName.getStore();
|
|
53465
|
+
open2.set(request, { at: performance2.now(), name: typeof name === "string" ? name : String(request.method ?? "?"), stage: "created" });
|
|
53466
|
+
if (open2.size > MAX_OPEN) open2.delete(open2.keys().next().value);
|
|
53467
|
+
})],
|
|
53468
|
+
["undici:request:bodySent", guarded2(({ request }) => {
|
|
53469
|
+
const entry = open2.get(request);
|
|
53470
|
+
if (entry?.stage === "created") entry.stage = "sent";
|
|
53471
|
+
})],
|
|
53472
|
+
["undici:request:headers", guarded2(({ request }) => {
|
|
53473
|
+
const entry = open2.get(request);
|
|
53474
|
+
if (entry) entry.stage = "head";
|
|
53475
|
+
})],
|
|
53476
|
+
["undici:request:trailers", guarded2(({ request }) => {
|
|
53477
|
+
open2.delete(request);
|
|
53478
|
+
})],
|
|
53479
|
+
["undici:request:error", guarded2(({ request }) => {
|
|
53480
|
+
open2.delete(request);
|
|
53481
|
+
})]
|
|
53482
|
+
];
|
|
53483
|
+
}
|
|
53484
|
+
});
|
|
53485
|
+
|
|
53434
53486
|
// src/shared/readTokenCrypto.mjs
|
|
53435
53487
|
import { constants as constants2, createHash as createHash10, createHmac as createHmac6, createPublicKey as createPublicKey2, privateDecrypt, publicEncrypt, randomBytes as randomBytes9, verify } from "node:crypto";
|
|
53436
53488
|
function readTokenKeyId(key2) {
|
|
@@ -53588,7 +53640,7 @@ var init_readTokenCrypto = __esm({
|
|
|
53588
53640
|
|
|
53589
53641
|
// wallet/src/net/readTokens.mjs
|
|
53590
53642
|
import { createHash as createHash11, createPrivateKey as createPrivateKey2, createPublicKey as createPublicKey3, randomBytes as randomBytes10, sign } from "node:crypto";
|
|
53591
|
-
import { AsyncLocalStorage as
|
|
53643
|
+
import { AsyncLocalStorage as AsyncLocalStorage5 } from "node:async_hooks";
|
|
53592
53644
|
import { dirname as dirname11, join as join11 } from "node:path";
|
|
53593
53645
|
function depositReadTokenProver(seed) {
|
|
53594
53646
|
const key2 = createPrivateKey2({ key: Buffer.concat([ED25519_PKCS8_PREFIX, Buffer.from(seed).subarray(0, 32)]), format: "der", type: "pkcs8" });
|
|
@@ -54032,7 +54084,7 @@ var init_readTokens = __esm({
|
|
|
54032
54084
|
throttledUntil = /* @__PURE__ */ new Map();
|
|
54033
54085
|
RETRY_AFTER_MIN_MS = 3e4;
|
|
54034
54086
|
RETRY_AFTER_DEFAULT_MS2 = 6e4;
|
|
54035
|
-
userAction = new
|
|
54087
|
+
userAction = new AsyncLocalStorage5();
|
|
54036
54088
|
userActionNow = () => {
|
|
54037
54089
|
const scope2 = userAction.getStore();
|
|
54038
54090
|
return scope2?.open === true && typeof scope2.walletPath === "string" ? scope2 : void 0;
|
|
@@ -54656,7 +54708,7 @@ function poolLayoutForLength(length) {
|
|
|
54656
54708
|
return POOL_LAYOUTS.find((layout) => layout.length === length);
|
|
54657
54709
|
}
|
|
54658
54710
|
function connect2(rpcUrl, commitment = "finalized", { timeoutMs, wrapFetch = (fetch2) => fetch2, wrapBase = (fetch2) => fetch2 } = {}) {
|
|
54659
|
-
const pooled = wrapBase((input, init) => rpcFetch(input, rpcKeepAliveInit(input, init)));
|
|
54711
|
+
const pooled = namedRpcFetch(wrapBase((input, init) => rpcFetch(input, rpcKeepAliveInit(input, init))));
|
|
54660
54712
|
const fetch2 = wrapFetch(timeoutMs === void 0 ? pooled : async (input, { onResponseHead, bodyStallMs, totalCapMs, ...init } = {}) => {
|
|
54661
54713
|
await afterOnionRace(input, init?.signal);
|
|
54662
54714
|
const circuit = torCircuit();
|
|
@@ -55487,19 +55539,19 @@ function createMemoReader(baseUrl, { fetchImpl = fetch, pause: pause2 = pauseFor
|
|
|
55487
55539
|
const options = { pause: pause2, attempts, now, notice, gate };
|
|
55488
55540
|
let batchRoute = true;
|
|
55489
55541
|
const readOne = async (digest2) => {
|
|
55490
|
-
const { status, bytes: bytes2 } = await memoRequest((signal) => fetchImpl(serviceUrl(baseUrl, `/api/shielded-x402/memos/${digest2}`), { signal }), options);
|
|
55542
|
+
const { status, bytes: bytes2 } = await memoRequest((signal) => withRequestName("memos", () => fetchImpl(serviceUrl(baseUrl, `/api/shielded-x402/memos/${digest2}`), { signal })), options);
|
|
55491
55543
|
if (status === 404) return void 0;
|
|
55492
55544
|
if (status !== 200) throw new Error(`memo_fetch_failed:${status}`);
|
|
55493
55545
|
if (bytes2.length !== MEMO_BUNDLE_BYTES2) throw new Error("memo_fetch_length_invalid");
|
|
55494
55546
|
return bytes2;
|
|
55495
55547
|
};
|
|
55496
55548
|
const readBatch2 = async (digests, lane = 0, cancel = void 0) => {
|
|
55497
|
-
const { status, bytes: bytes2 } = await memoRequest((signal) => fetchImpl(serviceUrl(baseUrl, "/api/shielded-x402/memos/batch"), torLaneInit(lane, {
|
|
55549
|
+
const { status, bytes: bytes2 } = await memoRequest((signal) => withRequestName("memos", () => fetchImpl(serviceUrl(baseUrl, "/api/shielded-x402/memos/batch"), torLaneInit(lane, {
|
|
55498
55550
|
method: "POST",
|
|
55499
55551
|
headers: { "content-type": "application/octet-stream" },
|
|
55500
55552
|
body: Buffer.concat(digests.map((digest2) => Buffer.from(digest2, "hex"))),
|
|
55501
55553
|
signal: cancel ? AbortSignal.any([signal, cancel]) : signal
|
|
55502
|
-
})), { ...options, cancel });
|
|
55554
|
+
}))), { ...options, cancel });
|
|
55503
55555
|
if (status === 404 || status === 405) return void 0;
|
|
55504
55556
|
if (status !== 200) throw new Error(`memo_fetch_failed:${status}`);
|
|
55505
55557
|
return parseMemoBatch(bytes2, digests);
|
|
@@ -55508,7 +55560,7 @@ function createMemoReader(baseUrl, { fetchImpl = fetch, pause: pause2 = pauseFor
|
|
|
55508
55560
|
const chunks = [];
|
|
55509
55561
|
for (let start = 0; start < wanted.length; start += MEMO_BATCH_MAX) chunks.push(wanted.slice(start, start + MEMO_BATCH_MAX));
|
|
55510
55562
|
const answers = new Array(chunks.length);
|
|
55511
|
-
const
|
|
55563
|
+
const open3 = /* @__PURE__ */ new Map();
|
|
55512
55564
|
let next = 0;
|
|
55513
55565
|
let left = chunks.length;
|
|
55514
55566
|
let spareLane = MEMO_LANES;
|
|
@@ -55519,19 +55571,19 @@ function createMemoReader(baseUrl, { fetchImpl = fetch, pause: pause2 = pauseFor
|
|
|
55519
55571
|
let laneId = index;
|
|
55520
55572
|
if (next < chunks.length) {
|
|
55521
55573
|
at = next++;
|
|
55522
|
-
|
|
55574
|
+
open3.set(at, { runners: 0, controllers: /* @__PURE__ */ new Set(), startedAt: Date.now() });
|
|
55523
55575
|
} else {
|
|
55524
55576
|
const started = Date.now();
|
|
55525
|
-
const slow = batchRoute && started >= gate.reopenAtWall ? [...
|
|
55577
|
+
const slow = batchRoute && started >= gate.reopenAtWall ? [...open3].find(([, entry2]) => entry2.runners === 1 && started - Math.max(entry2.startedAt, gate.reopenAtWall) >= MEMO_HEDGE_AFTER_MS) : void 0;
|
|
55526
55578
|
if (slow === void 0) {
|
|
55527
|
-
if (
|
|
55579
|
+
if (open3.size === 0) return;
|
|
55528
55580
|
await runSleep(250);
|
|
55529
55581
|
continue;
|
|
55530
55582
|
}
|
|
55531
55583
|
at = slow[0];
|
|
55532
55584
|
laneId = spareLane++;
|
|
55533
55585
|
}
|
|
55534
|
-
const entry =
|
|
55586
|
+
const entry = open3.get(at);
|
|
55535
55587
|
const controller = new AbortController();
|
|
55536
55588
|
entry.runners += 1;
|
|
55537
55589
|
entry.controllers.add(controller);
|
|
@@ -55553,7 +55605,7 @@ function createMemoReader(baseUrl, { fetchImpl = fetch, pause: pause2 = pauseFor
|
|
|
55553
55605
|
}
|
|
55554
55606
|
if (answers[at] !== void 0) continue;
|
|
55555
55607
|
answers[at] = answer;
|
|
55556
|
-
|
|
55608
|
+
open3.delete(at);
|
|
55557
55609
|
left -= 1;
|
|
55558
55610
|
for (const other of entry.controllers) if (other !== controller) other.abort();
|
|
55559
55611
|
}
|
|
@@ -55631,7 +55683,7 @@ function createMemoReader(baseUrl, { fetchImpl = fetch, pause: pause2 = pauseFor
|
|
|
55631
55683
|
async function fetchMemoFromService(baseUrl, digest2, { fetchImpl = fetch, pause: pause2 = pauseFor, notice = noticeOnStderr } = {}) {
|
|
55632
55684
|
const clean4 = memoDigestHex(digest2);
|
|
55633
55685
|
const { status, bytes: bytes2 } = await memoRequest(
|
|
55634
|
-
(signal) => fetchImpl(serviceUrl(baseUrl, `/api/shielded-x402/memos/${clean4}`), { signal }),
|
|
55686
|
+
(signal) => withRequestName("memos", () => fetchImpl(serviceUrl(baseUrl, `/api/shielded-x402/memos/${clean4}`), { signal })),
|
|
55635
55687
|
{ pause: pause2, attempts: MEMO_ATTEMPTS, now: () => Date.now(), notice, gate: memoGateFor(fetchImpl, baseUrl) }
|
|
55636
55688
|
);
|
|
55637
55689
|
if (status === 404) return void 0;
|
|
@@ -55701,6 +55753,7 @@ var init_chain2 = __esm({
|
|
|
55701
55753
|
init_esm2();
|
|
55702
55754
|
init_proxy();
|
|
55703
55755
|
init_facilitatorOnion();
|
|
55756
|
+
init_openRequests();
|
|
55704
55757
|
init_keepAlive();
|
|
55705
55758
|
init_readTokens();
|
|
55706
55759
|
init_phaseTiming();
|
|
@@ -62071,7 +62124,7 @@ var init_incremental = __esm({
|
|
|
62071
62124
|
});
|
|
62072
62125
|
|
|
62073
62126
|
// wallet/src/history/walletHistory.mjs
|
|
62074
|
-
import { AsyncLocalStorage as
|
|
62127
|
+
import { AsyncLocalStorage as AsyncLocalStorage6 } from "node:async_hooks";
|
|
62075
62128
|
import { createHmac as createHmac7 } from "node:crypto";
|
|
62076
62129
|
import { dirname as dirname13, join as join13, resolve as resolve9 } from "node:path";
|
|
62077
62130
|
function sweepFolderOnce(folder) {
|
|
@@ -62880,8 +62933,8 @@ var init_walletHistory = __esm({
|
|
|
62880
62933
|
init_runEnd();
|
|
62881
62934
|
init_rpcRefusal();
|
|
62882
62935
|
init_store();
|
|
62883
|
-
strictScope = new
|
|
62884
|
-
recentScope = new
|
|
62936
|
+
strictScope = new AsyncLocalStorage6();
|
|
62937
|
+
recentScope = new AsyncLocalStorage6();
|
|
62885
62938
|
recentLoads = /* @__PURE__ */ new Map();
|
|
62886
62939
|
recentAgeStart = (recent) => recent.ageFrom ?? poolReadAtOf(recent.report) ?? recent.startedAt;
|
|
62887
62940
|
proofBuiltAt = 0;
|
|
@@ -68190,14 +68243,14 @@ var init_service = __esm({
|
|
|
68190
68243
|
|
|
68191
68244
|
// wallet/src/recovery/memoDecryptPool.mjs
|
|
68192
68245
|
import { availableParallelism } from "node:os";
|
|
68193
|
-
import { performance as
|
|
68246
|
+
import { performance as performance3 } from "node:perf_hooks";
|
|
68194
68247
|
import { Worker as Worker3 } from "node:worker_threads";
|
|
68195
68248
|
function sliceClock() {
|
|
68196
|
-
let started =
|
|
68249
|
+
let started = performance3.now();
|
|
68197
68250
|
return async () => {
|
|
68198
|
-
if (
|
|
68251
|
+
if (performance3.now() - started < SLICE_MS) return;
|
|
68199
68252
|
await yieldTurn2();
|
|
68200
|
-
started =
|
|
68253
|
+
started = performance3.now();
|
|
68201
68254
|
};
|
|
68202
68255
|
}
|
|
68203
68256
|
function mainThreadFunctions() {
|
|
@@ -68564,7 +68617,7 @@ var init_settlement_receipt = __esm({
|
|
|
68564
68617
|
});
|
|
68565
68618
|
|
|
68566
68619
|
// wallet/src/recovery/recoveryCache.mjs
|
|
68567
|
-
import { performance as
|
|
68620
|
+
import { performance as performance4 } from "node:perf_hooks";
|
|
68568
68621
|
function contextBinding(context) {
|
|
68569
68622
|
return [
|
|
68570
68623
|
context.transitionKind,
|
|
@@ -68624,14 +68677,14 @@ function openRecoveryCache(store, ids) {
|
|
|
68624
68677
|
}
|
|
68625
68678
|
async function openRecoveryCacheSliced(store, ids) {
|
|
68626
68679
|
const run2 = openRecoveryCacheSteps(store, ids);
|
|
68627
|
-
let started =
|
|
68680
|
+
let started = performance4.now();
|
|
68628
68681
|
let step = run2.next();
|
|
68629
68682
|
while (!step.done) {
|
|
68630
|
-
if (
|
|
68683
|
+
if (performance4.now() - started >= 25) {
|
|
68631
68684
|
await new Promise((resolve18) => {
|
|
68632
68685
|
setImmediate(resolve18);
|
|
68633
68686
|
});
|
|
68634
|
-
started =
|
|
68687
|
+
started = performance4.now();
|
|
68635
68688
|
}
|
|
68636
68689
|
step = run2.next();
|
|
68637
68690
|
}
|
|
@@ -68781,7 +68834,7 @@ var init_successorHistories = __esm({
|
|
|
68781
68834
|
// wallet/src/recovery/recover.mjs
|
|
68782
68835
|
import { createHash as createHash22 } from "node:crypto";
|
|
68783
68836
|
import { join as join16, resolve as resolve11 } from "node:path";
|
|
68784
|
-
import { performance as
|
|
68837
|
+
import { performance as performance5 } from "node:perf_hooks";
|
|
68785
68838
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
68786
68839
|
function pinnedGenerator(profileVector) {
|
|
68787
68840
|
if (profileVector?.payerKeys?.generator) return profileVector.payerKeys.generator;
|
|
@@ -68852,18 +68905,18 @@ function walMemoBundles(store) {
|
|
|
68852
68905
|
}
|
|
68853
68906
|
async function walMemoBundlesSliced(store) {
|
|
68854
68907
|
const bundles = /* @__PURE__ */ new Map();
|
|
68855
|
-
let started =
|
|
68908
|
+
let started = performance5.now();
|
|
68856
68909
|
for (const name of store.listWal()) {
|
|
68857
68910
|
const record = store.readWal(name);
|
|
68858
68911
|
if (record?.memoBundleHex) {
|
|
68859
68912
|
const bytes2 = Uint8Array.from(Buffer.from(hexOf2(record.memoBundleHex), "hex"));
|
|
68860
68913
|
bundles.set(hexOf2(record.memoDigest ?? bundleDigest2(bytes2)), bytes2);
|
|
68861
68914
|
}
|
|
68862
|
-
if (
|
|
68915
|
+
if (performance5.now() - started >= 25) {
|
|
68863
68916
|
await new Promise((resolve18) => {
|
|
68864
68917
|
setImmediate(resolve18);
|
|
68865
68918
|
});
|
|
68866
|
-
started =
|
|
68919
|
+
started = performance5.now();
|
|
68867
68920
|
}
|
|
68868
68921
|
}
|
|
68869
68922
|
return bundles;
|
|
@@ -69052,13 +69105,13 @@ async function syncedOutputs({ store, finalizedHistory: finalizedHistory2, diges
|
|
|
69052
69105
|
}
|
|
69053
69106
|
}
|
|
69054
69107
|
const items = [];
|
|
69055
|
-
let sliceStart =
|
|
69108
|
+
let sliceStart = performance5.now();
|
|
69056
69109
|
for (const context of chunk) {
|
|
69057
|
-
if (
|
|
69110
|
+
if (performance5.now() - sliceStart >= 25) {
|
|
69058
69111
|
await new Promise((resolve18) => {
|
|
69059
69112
|
setImmediate(resolve18);
|
|
69060
69113
|
});
|
|
69061
|
-
sliceStart =
|
|
69114
|
+
sliceStart = performance5.now();
|
|
69062
69115
|
}
|
|
69063
69116
|
const digest2 = hexOf2(context.memoDigest);
|
|
69064
69117
|
const fromService = served.get(digest2);
|
|
@@ -69205,14 +69258,14 @@ async function runRecover({ store, connection, programId, digests, serviceUrl: s
|
|
|
69205
69258
|
}
|
|
69206
69259
|
markPhase("recover-memos");
|
|
69207
69260
|
const recovered = [];
|
|
69208
|
-
let replayStarted =
|
|
69261
|
+
let replayStarted = performance5.now();
|
|
69209
69262
|
for (const { digest: digest2, context, outputs } of read.entries) {
|
|
69210
69263
|
for (const output2 of outputs) {
|
|
69211
|
-
if (
|
|
69264
|
+
if (performance5.now() - replayStarted >= 25) {
|
|
69212
69265
|
await new Promise((resolve18) => {
|
|
69213
69266
|
setImmediate(resolve18);
|
|
69214
69267
|
});
|
|
69215
|
-
replayStarted =
|
|
69268
|
+
replayStarted = performance5.now();
|
|
69216
69269
|
}
|
|
69217
69270
|
const replayValue = replayValueOf(
|
|
69218
69271
|
output2.kind,
|
|
@@ -70905,14 +70958,14 @@ It asks the amount, then gives a one-time address and its QR code: send USDC to
|
|
|
70905
70958
|
sendHold = privateSendPending === 0n ? { accounts: /* @__PURE__ */ new Map(), notes: /* @__PURE__ */ new Set(), sends: [], unpacked: [] } : privateSendPending === null ? null : privateSendHold(store, freeInputs);
|
|
70906
70959
|
const isHeld = (output2) => sendHold.accounts.has(output2.commitment) || sendHold.notes.has(output2.commitment);
|
|
70907
70960
|
const notHeld = sendHold === null ? [] : free.filter((output2) => !isHeld(output2));
|
|
70908
|
-
const
|
|
70961
|
+
const open3 = sendHold === null || sendHold.accounts.size === 0 && sendHold.notes.size === 0 ? notHeld : notHeld.filter((output2) => output2.kind !== "note" || notHeld.some((other) => other.kind === "account" && noteFitsAccount(spendEntry(other), spendEntry(output2))));
|
|
70909
70962
|
const spares = sendHold === null ? [] : free.filter((output2) => output2.kind === "account" && sendHold.accounts.has(output2.commitment)).map((output2) => ({ output: output2, spareAtomic: heldSpareAtomic(sendHold, spendEntry(output2)) }));
|
|
70910
70963
|
if (sendHold !== null) {
|
|
70911
70964
|
heldWholeAtomic = sum(free.filter(isHeld).map((output2) => output2.valueAtomic)) + sum(sendHold.unpacked.map((part) => part.amountAtomic));
|
|
70912
70965
|
heldAtomic = heldWholeAtomic - sum(spares.map((spare) => spare.spareAtomic));
|
|
70913
70966
|
spareMost = spares.reduce((most, spare) => spare.spareAtomic > most ? spare.spareAtomic : most, 0n);
|
|
70914
70967
|
}
|
|
70915
|
-
const openLargest = sendHold === null ? void 0 : largestOneSpend(
|
|
70968
|
+
const openLargest = sendHold === null ? void 0 : largestOneSpend(open3);
|
|
70916
70969
|
const largest = openLargest === void 0 || openLargest >= spareMost ? openLargest : spareMost;
|
|
70917
70970
|
if (sendHold !== null) {
|
|
70918
70971
|
const belowAccounts = notesBelowEveryAccount(free).filter((output2) => !isHeld(output2));
|
|
@@ -70921,7 +70974,7 @@ It asks the amount, then gives a one-time address and its QR code: send USDC to
|
|
|
70921
70974
|
detail.belowAccountsAtomic = (belowGross > uncovered ? belowGross - uncovered : 0n).toString();
|
|
70922
70975
|
detail.belowAccountsNotes = belowAccounts.length;
|
|
70923
70976
|
detail.belowAccountsLargestAtomic = belowAccounts.reduce((top, output2) => BigInt(output2.valueAtomic) > top ? BigInt(output2.valueAtomic) : top, 0n).toString();
|
|
70924
|
-
const afterJoin = largestAfterJoin(
|
|
70977
|
+
const afterJoin = largestAfterJoin(open3);
|
|
70925
70978
|
if (afterJoin !== void 0) detail.paymentReadyAtomic = afterJoin.toString();
|
|
70926
70979
|
}
|
|
70927
70980
|
if (settling.some((payment) => payment.inputs.some((commitment) => reserved.has(commitment) || joining.has(commitment))) || unknownInputs && settling.length) {
|
|
@@ -70935,7 +70988,7 @@ It asks the amount, then gives a one-time address and its QR code: send USDC to
|
|
|
70935
70988
|
}
|
|
70936
70989
|
const anchorIndex = canonicalAtomic(snapshot.anchorIndex) ? BigInt(snapshot.anchorIndex) : void 0;
|
|
70937
70990
|
detail.fundedAccounts = unknownInputs ? 0 : sendHold === null ? null : [
|
|
70938
|
-
...
|
|
70991
|
+
...open3.filter((output2) => output2.kind === "account" && BigInt(output2.valueAtomic) > 0n),
|
|
70939
70992
|
...spares.filter((spare) => spare.spareAtomic > 0n).map((spare) => spare.output)
|
|
70940
70993
|
].filter((output2) => anchorIndex === void 0 || BigInt(output2.leafIndex) < anchorIndex).length;
|
|
70941
70994
|
const answeredOnly = detail.inFlight.length > 0 && detail.inFlight.every((item) => item.answered === true);
|
|
@@ -79114,7 +79167,7 @@ function createInboundFacilitatorClient({ baseUrl, fetchImpl = fetch, store, boo
|
|
|
79114
79167
|
if (record.delivered === true || serving.has(index)) return ALREADY_SERVED;
|
|
79115
79168
|
return sameTerms(record.terms, terms) ? void 0 : TERMS_DIFFER;
|
|
79116
79169
|
}
|
|
79117
|
-
async function
|
|
79170
|
+
async function open3(index, payload2, requirements, terms) {
|
|
79118
79171
|
let record = book.record(index);
|
|
79119
79172
|
const paymentDigest = paymentDigestOf(payload2);
|
|
79120
79173
|
const digestField = paymentDigest === void 0 ? {} : { paymentDigest };
|
|
@@ -79209,7 +79262,7 @@ function createInboundFacilitatorClient({ baseUrl, fetchImpl = fetch, store, boo
|
|
|
79209
79262
|
return refuse4(record.state === "refused" && record.open?.reason ? record.open.reason : PAYTO_USED);
|
|
79210
79263
|
}
|
|
79211
79264
|
try {
|
|
79212
|
-
await
|
|
79265
|
+
await open3(index, payload2, requirements, terms);
|
|
79213
79266
|
} catch (error) {
|
|
79214
79267
|
return refuse4(codeOf2(error));
|
|
79215
79268
|
}
|
|
@@ -80715,8 +80768,17 @@ function torTimingMark(line, ours, lines) {
|
|
|
80715
80768
|
const purpose = field4("PURPOSE");
|
|
80716
80769
|
const hsState = field4("HS_STATE");
|
|
80717
80770
|
const reason = field4("REASON");
|
|
80718
|
-
|
|
80719
|
-
|
|
80771
|
+
const powField = /(?:^| )HS_POW=(\S*)/.exec(line)?.[1];
|
|
80772
|
+
const pow = powField === void 0 ? void 0 : /^v1,(\d{1,10})$/.exec(powField)?.[1];
|
|
80773
|
+
if (!prefix || !CIRC_PURPOSES.has(purpose) || hsState !== void 0 && !CIRC_HS_STATES.has(hsState) || reason !== void 0 && !CIRC_REASONS.has(reason) || powField !== void 0 && pow === void 0) return void 0;
|
|
80774
|
+
return { phase: `circ-${circ[2].toLowerCase()}`, outcome: [
|
|
80775
|
+
`onion_${prefix}`,
|
|
80776
|
+
`c${circ[1]}`,
|
|
80777
|
+
purpose,
|
|
80778
|
+
hsState,
|
|
80779
|
+
reason,
|
|
80780
|
+
pow === void 0 ? void 0 : `pow${pow}`
|
|
80781
|
+
].filter(Boolean).join("_").toLowerCase() };
|
|
80720
80782
|
}
|
|
80721
80783
|
function startTorTimingMarks() {
|
|
80722
80784
|
const run2 = String(process.env.SHINJUKU_WALLET_PROXIED ?? "");
|