shinjuku-shielded 0.3.30 → 0.3.31

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": "a523d67b85ebcfd6f07f653c2a9bde16a7c9d87f908874ddae71cf91083fabc8",
5
- "bytes": 11177579,
6
- "sourceCommit": "025c6a4ab1a1c3e38019cdd7843b524a6a90d62a",
4
+ "sha256": "c8c82dc4ce0277f8c560adec5cb16119709d00240a8efa4ebbb2a426e5161b6a",
5
+ "bytes": 11178235,
6
+ "sourceCommit": "206a11827c4c668d65b7e8e2040a344f17aad1d0",
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.30",
3
+ "version": "0.3.31",
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": "a523d67b",
7
- "shinjukuSha256": "a523d67b85ebcfd6f07f653c2a9bde16a7c9d87f908874ddae71cf91083fabc8",
6
+ "shinjukuRelease": "c8c82dc4",
7
+ "shinjukuSha256": "c8c82dc4ce0277f8c560adec5cb16119709d00240a8efa4ebbb2a426e5161b6a",
8
8
  "license": "SEE LICENSE IN LICENSE.txt",
9
9
  "author": "Shinjuku Shielded",
10
10
  "homepage": "https://github.com/ShinjukuStaition/shinjuku-mcp#readme",
@@ -70299,11 +70299,14 @@ async function runRecoveredP03NoteExit({
70299
70299
  }
70300
70300
  wal = { ...wal, state: "confirmed", signature };
70301
70301
  store.writeWal(walName2, wal);
70302
- poolState2 = await readPool2(connection, pool2, "finalized");
70303
- if (!poolState2 || !poolState2.owner.equals(chainProgramId) || poolState2.version !== 3) {
70304
- throw new Error("finalized note-exit pool postcondition invalid");
70302
+ for (let attempt = 1; ; attempt += 1) {
70303
+ history = await walkHistory();
70304
+ poolState2 = await readPool2(connection, pool2, "finalized");
70305
+ if (!poolState2 || !poolState2.owner.equals(chainProgramId) || poolState2.version !== 3) {
70306
+ throw new Error("finalized note-exit pool postcondition invalid");
70307
+ }
70308
+ if (attempt >= 4 || history.finalizedPoolSnapshot.currentIndex === poolState2.currentIndex && history.finalizedPoolSnapshot.currentRoot === poolState2.currentRoot) break;
70305
70309
  }
70306
- history = await walkHistory();
70307
70310
  await prepareFold(history);
70308
70311
  const spentPath = buildRecoveryPath({
70309
70312
  history,
@@ -72326,7 +72329,7 @@ async function validateReceiptTransaction(connection, receipt, record, state, pr
72326
72329
  [{ signature: receipt.transaction, slot: status.slot, failed: false }],
72327
72330
  blockCache,
72328
72331
  transactions,
72329
- { commitment }
72332
+ { commitment, positionWhen: () => false }
72330
72333
  );
72331
72334
  const settlements = targetInstructions([...transactions.values()], program).filter((instruction) => (instruction.data[0] === 4 || instruction.data[0] === COMPRESSED_SETTLE_TAG.payment || instruction.data[0] === E1_SETTLE_TAG.payment) && instruction.accounts[0] === pool2.toBase58());
72332
72335
  if (settlements.length !== 1) fail16("receipt_payment_instruction_missing");
@@ -96223,6 +96226,7 @@ async function createSellerAdapter({
96223
96226
  return { status: original.result.status, result: original.result, receipt: original.receipt };
96224
96227
  }
96225
96228
  let offer = original;
96229
+ let intakeChain;
96226
96230
  try {
96227
96231
  if (!offer.outboundJson) {
96228
96232
  const parsed = parseSolanaP03HttpPaymentPayload(payment.payload);
@@ -96237,6 +96241,7 @@ async function createSellerAdapter({
96237
96241
  const recoveredNote = await scanner.recoverMerchantNoteYielding({ parsed, authenticatedQuote: auth });
96238
96242
  mark("intake-note-recovered");
96239
96243
  const chain = await intakeRead;
96244
+ intakeChain = chain;
96240
96245
  mark("intake-anchor-read");
96241
96246
  const issuedAt = Number(chain.chainTimestamp);
96242
96247
  const expiresAt = Math.min(issuedAt + 300, Number(payment.accepted.extra.validBefore));
@@ -96277,11 +96282,18 @@ async function createSellerAdapter({
96277
96282
  await put(nonce, offer);
96278
96283
  mark("intake-durable");
96279
96284
  }
96285
+ const firstIntake = intakeChain !== void 0 && !offer.settleAttempted;
96286
+ if (firstIntake) {
96287
+ await readCurrentAnchor(intakeChain);
96288
+ offer = { ...offer, phase: "settlement_pending", settleAttempted: true };
96289
+ await put(nonce, offer);
96290
+ mark("first-intake-settle");
96291
+ }
96280
96292
  const preVerifyReadAt = Date.now();
96281
96293
  const preVerifyRead = offer.settleAttempted ? void 0 : readAnchor();
96282
96294
  preVerifyRead?.catch(() => void 0);
96283
- const claimed = await facilitator("claim", offer.outboundJson);
96284
- mark("claim");
96295
+ const claimed = firstIntake ? void 0 : await facilitator("claim", offer.outboundJson);
96296
+ if (!firstIntake) mark("claim");
96285
96297
  if (claimed) {
96286
96298
  offer = await persistReceipt(nonce, offer, claimed, mark);
96287
96299
  return { status: offer.result.status, result: offer.result, receipt: offer.receipt };