shinjuku-shielded 0.3.69 → 0.3.70

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 CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "schema": "carbon-shielded-wallet/bundle-manifest/v1",
3
3
  "file": "shinjuku-wallet.mjs",
4
- "sha256": "c6cbe0a61037f0a435f7ce448d6ff6fc6a4a97a9b7336fea33c9e7a1e56c11e7",
5
- "bytes": 12194855,
6
- "sourceCommit": "6325678a822487e65a0bccf3f398ba32fab563e8",
4
+ "sha256": "ae568c800e9c2e6ccaf4cad6958cf133aa07469a93428827e679d3a1be89505f",
5
+ "bytes": 12197454,
6
+ "sourceCommit": "dc07c3b2f68a0358fc8137b8ba3773c533856117",
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",
@@ -1282,5 +1282,5 @@
1282
1282
  "version": "1.8.0"
1283
1283
  }
1284
1284
  ],
1285
- "publishedAt": "2026-10-22T14:42:59.608Z"
1285
+ "publishedAt": "2026-10-22T15:46:57.559Z"
1286
1286
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "shinjuku-shielded",
3
- "version": "0.3.69",
3
+ "version": "0.3.70",
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": "c6cbe0a6",
7
- "shinjukuSha256": "c6cbe0a61037f0a435f7ce448d6ff6fc6a4a97a9b7336fea33c9e7a1e56c11e7",
6
+ "shinjukuRelease": "ae568c80",
7
+ "shinjukuSha256": "ae568c800e9c2e6ccaf4cad6958cf133aa07469a93428827e679d3a1be89505f",
8
8
  "license": "SEE LICENSE IN LICENSE.txt",
9
9
  "author": "Shinjuku Shielded",
10
10
  "homepage": "https://github.com/ShinjukuStaition/shinjuku-mcp#readme",
@@ -53662,6 +53662,11 @@ function finalizedPoolStateOf(report, { programId, pool: pool2 }) {
53662
53662
  if (entry === void 0 || entry.programId !== String(programId) || entry.pool !== String(pool2)) return void 0;
53663
53663
  return entry.state;
53664
53664
  }
53665
+ function poolReadAtOf(report) {
53666
+ if (!report || !AUTHENTICATED_HISTORY_REPORTS.has(report)) return void 0;
53667
+ const readAt = REPORT_POOL_STATES.get(report)?.readAt;
53668
+ return Number.isFinite(readAt) ? readAt : void 0;
53669
+ }
53665
53670
  function p03SettlementConsumesBuffer(tag2) {
53666
53671
  return P03_SETTLEMENT_TAGS.includes(tag2) && !P03_INLINE_SETTLEMENT_TAGS.includes(tag2);
53667
53672
  }
@@ -53843,13 +53848,34 @@ async function refreshFinalizedP03HistorySnapshot({
53843
53848
  history,
53844
53849
  paymentSettler
53845
53850
  }) {
53851
+ const { authenticated, program, poolKey } = refreshBinding(history, programId, pool2);
53852
+ const snapshot = await readFinalizedPoolForRefresh(connection, program, poolKey);
53853
+ return refreshedFromSnapshot({ connection, program, poolKey, authenticated, snapshot, paymentSettler });
53854
+ }
53855
+ async function refreshFinalizedP03HistoryFromSliced({ connection, programId, pool: pool2, history, snapshot }) {
53856
+ const { authenticated, program, poolKey } = refreshBinding(history, programId, pool2);
53857
+ if (snapshot === null || typeof snapshot !== "object" || snapshot.programDataReuse === void 0) return void 0;
53858
+ let view2 = snapshot;
53859
+ if (snapshot.replayStore === REPLAY_STORE_INDEXED) {
53860
+ const slices = snapshot.e1TreeSlices;
53861
+ if (!slices || slices.slot !== snapshot.slot || !(slices.header instanceof Uint8Array)) return void 0;
53862
+ view2 = withPoolStateOf(snapshot, Object.freeze({
53863
+ ...snapshot,
53864
+ e1TreeHeader: Object.freeze({ address: slices.address, ownerProgramId: slices.ownerProgramId, data: Buffer.from(slices.header) })
53865
+ }));
53866
+ }
53867
+ return refreshedFromSnapshot({ connection, program, poolKey, authenticated, snapshot: view2, reuseAnswer: snapshot.programDataReuse });
53868
+ }
53869
+ function refreshBinding(history, programId, pool2) {
53846
53870
  const authenticated = assertAuthenticatedFinalizedP03History(history);
53847
53871
  const program = canonicalKey(programId, "program_id");
53848
53872
  const poolKey = canonicalKey(pool2, "pool");
53849
53873
  if (authenticated.programId !== b58(program) || authenticated.pool !== poolKey.toBase58()) {
53850
53874
  throw new Error("p03_history_refresh_binding_invalid");
53851
53875
  }
53852
- const snapshot = await readFinalizedPoolForRefresh(connection, program, poolKey);
53876
+ return { authenticated, program, poolKey };
53877
+ }
53878
+ async function refreshedFromSnapshot({ connection, program, poolKey, authenticated, snapshot, paymentSettler, reuseAnswer }) {
53853
53879
  if (snapshot.terminal !== authenticated.finalizedPoolSnapshot.terminal || snapshot.currentIndex !== authenticated.finalizedPoolSnapshot.currentIndex || snapshot.currentRoot !== authenticated.finalizedPoolSnapshot.currentRoot || !sameP03PoolPolicy(snapshot, authenticated.finalizedPoolSnapshot.policy) || !sameE1TreeHeader(snapshot, authenticated.finalizedPoolSnapshot.e1Tree, program, poolKey) || paymentSettler !== void 0 && snapshot.paymentSettler?.toBase58() !== paymentSettler) {
53854
53880
  throw Object.assign(
53855
53881
  new Error("p03_history_refresh_transition_detected"),
@@ -53869,7 +53895,8 @@ async function refreshFinalizedP03HistorySnapshot({
53869
53895
  programDataSha256: priorCoverage.programDataSha256,
53870
53896
  ...priorCoverage.programHistory ? { programHistory: priorCoverage.programHistory } : {}
53871
53897
  },
53872
- prior: HISTORY_ATTESTATIONS.get(authenticated)
53898
+ prior: HISTORY_ATTESTATIONS.get(authenticated),
53899
+ ...reuseAnswer !== void 0 ? { reuseAnswer } : {}
53873
53900
  });
53874
53901
  const deploymentCoverage = refreshedCoverage.coverage;
53875
53902
  if (!hasExecutableEvidence(deploymentCoverage)) throw new Error("p03_history_executable_evidence_required");
@@ -54162,7 +54189,8 @@ function parseFinalizedPool(response, program, pool2) {
54162
54189
  SNAPSHOT_POOL_STATES.set(snapshot, Object.freeze({
54163
54190
  programId: b58(program),
54164
54191
  pool: pool2.toBase58(),
54165
- state: Object.freeze({ ...state, owner })
54192
+ state: Object.freeze({ ...state, owner }),
54193
+ readAt: Date.now()
54166
54194
  }));
54167
54195
  }
54168
54196
  return snapshot;
@@ -57452,8 +57480,15 @@ async function readPages(history, pool2, needed, first, { wakeSlot } = {}) {
57452
57480
  }
57453
57481
  return { records: records.slice(0, needed), imports, initialization, syncedSlot };
57454
57482
  }
57455
- async function readCompactPoolSnapshot({ connection, programId, pool: pool2 }) {
57456
- return readFinalizedPool(withBoundedOwnReads(connection), new import_web397.PublicKey(programId), new import_web397.PublicKey(pool2), { treeSlices: true });
57483
+ function startCompactPoolSnapshot({ connection, programId, pool: pool2 }) {
57484
+ const own = withBoundedOwnReads(connection);
57485
+ const program = new import_web397.PublicKey(programId);
57486
+ const poolKey = new import_web397.PublicKey(pool2);
57487
+ const sliced = readFinalizedPoolSliced(own, program, poolKey).catch(() => void 0);
57488
+ const full = sliced.then((snapshot) => snapshot ?? readFinalizedPool(own, program, poolKey));
57489
+ full.catch(() => {
57490
+ });
57491
+ return { sliced, full };
57457
57492
  }
57458
57493
  function requestCompactFirstPage({ history, pool: pool2 }) {
57459
57494
  try {
@@ -58988,7 +59023,7 @@ async function loadWalletP03History(args) {
58988
59023
  }
58989
59024
  if (runKey !== void 0 && recentScope.getStore() !== void 0 && strictScope.getStore() !== true && args.forceRead !== true) {
58990
59025
  const recent = recentLoads.get(runKey);
58991
- if (recent !== void 0 && Date.now() - recent.startedAt <= HISTORY_PREWARM_JOIN_MS) {
59026
+ if (recent !== void 0 && Date.now() - recentAgeStart(recent) <= HISTORY_PREWARM_JOIN_MS) {
58992
59027
  PREWARMED_REPORTS.add(recent.report);
58993
59028
  PAYMENT_TAKEN_REPORTS.add(recent.report);
58994
59029
  markPhase("walk-recent");
@@ -59022,7 +59057,7 @@ function recentBeforePrewarm(runKey, prewarm) {
59022
59057
  const accept = recentScope.getStore()?.accept;
59023
59058
  if (typeof accept !== "function" || prewarm.settled) return void 0;
59024
59059
  const recent = recentLoads.get(runKey);
59025
- if (recent === void 0 || Date.now() - recent.startedAt > HISTORY_PREWARM_JOIN_MS) return void 0;
59060
+ if (recent === void 0 || Date.now() - recentAgeStart(recent) > HISTORY_PREWARM_JOIN_MS) return void 0;
59026
59061
  let accepted = false;
59027
59062
  try {
59028
59063
  accepted = accept(recent.report) === true;
@@ -59167,11 +59202,11 @@ async function walkWalletP03HistoryNow({ store, connection: given, programId, po
59167
59202
  if (typeof index === "bigint") movedIndex = index + SUBTREE_LEAVES4;
59168
59203
  } else if (earlier !== void 0) {
59169
59204
  markPhase("refresh-start");
59170
- const refreshing = refreshFinalizedP03HistorySnapshot({ connection, programId, pool: pool2, history: earlier });
59205
+ let slicedPreRead;
59171
59206
  if (compactNext) {
59172
- poolPreRead = readCompactPoolSnapshot({ connection, programId, pool: pool2 });
59173
- poolPreRead.catch(() => {
59174
- });
59207
+ const started = startCompactPoolSnapshot({ connection, programId, pool: pool2 });
59208
+ slicedPreRead = started.sliced;
59209
+ poolPreRead = started.full;
59175
59210
  markPhase("compact-pool-prestarted");
59176
59211
  if (!inTorRun() && Date.now() - remembered.at > PAGE0_PREREAD_AFTER_MS) {
59177
59212
  firstPreRead = requestCompactFirstPage({ history: connection.historyRpcSource, pool: pool2 });
@@ -59184,11 +59219,24 @@ async function walkWalletP03HistoryNow({ store, connection: given, programId, po
59184
59219
  } catch {
59185
59220
  }
59186
59221
  }
59222
+ let fromSliced = false;
59223
+ const refreshing = (async () => {
59224
+ if (slicedPreRead !== void 0) {
59225
+ const decided = await refreshFinalizedP03HistoryFromSliced({ connection, programId, pool: pool2, history: earlier, snapshot: await slicedPreRead });
59226
+ if (decided !== void 0) {
59227
+ fromSliced = true;
59228
+ markPhase("refresh-from-sliced");
59229
+ return decided;
59230
+ }
59231
+ markPhase("refresh-sliced-undecided");
59232
+ }
59233
+ return refreshFinalizedP03HistorySnapshot({ connection, programId, pool: pool2, history: earlier });
59234
+ })();
59187
59235
  try {
59188
59236
  const refreshed = await refreshing;
59189
59237
  markPhase("walk-refreshed");
59190
59238
  rememberRunReport(runKey, refreshed);
59191
- writeStderr("history: the pool made no transition since this run's last walk; that history was moved to the current pool account (your own RPC read the pool account and the program's deployment account; the history source answered one signature read)\n");
59239
+ writeStderr("history: the pool made no transition since this run's last walk; that history was moved to the current pool account " + (fromSliced ? "(your own RPC read the pool account and the program's deployment account in one request)\n" : "(your own RPC read the pool account and the program's deployment account; the history source answered one signature read)\n"));
59192
59240
  return refreshed;
59193
59241
  } catch (error) {
59194
59242
  markPhase("refresh-missed");
@@ -59411,7 +59459,7 @@ function reportHistoryRpc(split5, source, result, crossChecked) {
59411
59459
  writeStderr(`history: ${who} answered ${list(split5.history)}; your own RPC answered ${list(split5.own)} (the pool account the history must match, and the cross-check)${window2}${integrity}
59412
59460
  `);
59413
59461
  }
59414
- var prepareReport, strictScope, withStrictHistorySource, recentScope, withRecentWalletHistory, recentLoads, forgetRecentWalletHistory, proofBuiltAt, historyCacheKey, latestPrewarm, HOME_MARKS_SETTLED_MS, HISTORY_PREWARM_JOIN_MS, SHARED_WALK_WAIT_MS, PAGE0_PREREAD_AFTER_MS, SUBTREE_LEAVES4, prewarmedWalks, sharedWalks, PREWARMED_REPORTS, PAYMENT_TAKEN_REPORTS, isPrewarmedWalletHistory, REPORT_STARTED_AT, walkStartedAtOf, COMPACT_BEHIND_POLL_MS, COMPACT_BEHIND_READ_MS, COMPACT_BEHIND_TOR_READ_MS, COMPACT_BEHIND_REFUSAL_MAX_BYTES, COMPACT_BEHIND_PAGE_BODY_MS, COMPACT_BEHIND_RETRY_MS, lastRunReports, writeStderr, announcedSources;
59462
+ var prepareReport, strictScope, withStrictHistorySource, recentScope, withRecentWalletHistory, recentLoads, recentAgeStart, forgetRecentWalletHistory, proofBuiltAt, historyCacheKey, latestPrewarm, HOME_MARKS_SETTLED_MS, HISTORY_PREWARM_JOIN_MS, SHARED_WALK_WAIT_MS, PAGE0_PREREAD_AFTER_MS, SUBTREE_LEAVES4, prewarmedWalks, sharedWalks, PREWARMED_REPORTS, PAYMENT_TAKEN_REPORTS, isPrewarmedWalletHistory, REPORT_STARTED_AT, walkStartedAtOf, COMPACT_BEHIND_POLL_MS, COMPACT_BEHIND_READ_MS, COMPACT_BEHIND_TOR_READ_MS, COMPACT_BEHIND_REFUSAL_MAX_BYTES, COMPACT_BEHIND_PAGE_BODY_MS, COMPACT_BEHIND_RETRY_MS, lastRunReports, writeStderr, announcedSources;
59415
59463
  var init_walletHistory = __esm({
59416
59464
  "wallet/src/history/walletHistory.mjs"() {
59417
59465
  "use strict";
@@ -59433,6 +59481,7 @@ var init_walletHistory = __esm({
59433
59481
  recentScope = new AsyncLocalStorage2();
59434
59482
  withRecentWalletHistory = (fn, { accept } = {}) => recentScope.run({ accept }, fn);
59435
59483
  recentLoads = /* @__PURE__ */ new Map();
59484
+ recentAgeStart = (recent) => poolReadAtOf(recent.report) ?? recent.startedAt;
59436
59485
  forgetRecentWalletHistory = () => {
59437
59486
  recentLoads.clear();
59438
59487
  proofBuiltAt = Date.now();