shinjuku-shielded 0.3.7 → 0.3.8

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": "488372b4f12886748870eb5fb6d5f25eb42a43b6ddc6f74c20cac033fe5f6927",
5
- "bytes": 10818483,
6
- "sourceCommit": "bb0d7783d7afef43e857ab6841b5dfc6c3ea6195",
4
+ "sha256": "08a4b56f6452268ffdd513e67326de8782b53dcec16ba88adaddf16793581206",
5
+ "bytes": 10822047,
6
+ "sourceCommit": "1368a8e875dcbdba3c4a936162975193929ef876",
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.7",
3
+ "version": "0.3.8",
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": "488372b4",
7
- "shinjukuSha256": "488372b4f12886748870eb5fb6d5f25eb42a43b6ddc6f74c20cac033fe5f6927",
6
+ "shinjukuRelease": "08a4b56f",
7
+ "shinjukuSha256": "08a4b56f6452268ffdd513e67326de8782b53dcec16ba88adaddf16793581206",
8
8
  "license": "SEE LICENSE IN LICENSE.txt",
9
9
  "author": "Shinjuku Shielded",
10
10
  "homepage": "https://github.com/ShinjukuStaition/shinjuku-mcp#readme",
@@ -47814,14 +47814,20 @@ function parsePoolState(data) {
47814
47814
  if (!data) throw new Error("pool_state_length_invalid");
47815
47815
  const bytes2 = Buffer.from(data);
47816
47816
  const magic = bytes2.subarray(0, 8).toString("ascii");
47817
- if (bytes2.length === POOL_STATE_LEN && isP03PoolMagic(magic)) {
47818
- const anchors = [88, 136].map((offset) => ({
47817
+ if ((bytes2.length === POOL_STATE_LEN || bytes2.length === POOL_STATE_LEN_RING) && isP03PoolMagic(magic)) {
47818
+ const anchorMode = bytes2[11];
47819
+ const ring = bytes2.length === POOL_STATE_LEN_RING;
47820
+ if (ring !== (anchorMode === ANCHOR_MODE_RING) || !ring && anchorMode !== 0 && anchorMode !== 1) {
47821
+ throw new Error("pool_state_anchor_layout_invalid");
47822
+ }
47823
+ const anchors = ring ? readAnchorRing(bytes2) : [88, 136].map((offset) => ({
47819
47824
  epoch: bytes2.readBigUInt64LE(offset),
47820
47825
  root: BigInt(`0x${bytes2.subarray(offset + 8, offset + 40).toString("hex")}`),
47821
47826
  index: bytes2.readBigUInt64LE(offset + 40)
47822
47827
  }));
47823
47828
  return {
47824
47829
  version: 3,
47830
+ anchorMode,
47825
47831
  terminal: bytes2[12] === 1,
47826
47832
  poolDomain: BigInt(`0x${bytes2.subarray(16, 48).toString("hex")}`),
47827
47833
  currentRoot: BigInt(`0x${bytes2.subarray(48, 80).toString("hex")}`),
@@ -47856,6 +47862,22 @@ function parsePoolState(data) {
47856
47862
  paymentSettler: new import_web391.PublicKey(data.subarray(200, 232))
47857
47863
  };
47858
47864
  }
47865
+ function readAnchorRing(bytes2) {
47866
+ const head = bytes2.readUInt16LE(ANCHOR_RING_HEADER);
47867
+ const count2 = bytes2.readUInt16LE(ANCHOR_RING_HEADER + 2);
47868
+ if (head >= ANCHOR_RING_SLOTS || count2 < 1 || count2 > ANCHOR_RING_SLOTS || bytes2.readUInt32LE(ANCHOR_RING_HEADER + 4) !== 0) throw new Error("pool_state_anchor_ring_invalid");
47869
+ const anchors = [];
47870
+ for (let back = 0; back < count2; back += 1) {
47871
+ const offset = ANCHOR_RING_FIRST_SLOT + (head - back + ANCHOR_RING_SLOTS) % ANCHOR_RING_SLOTS * ANCHOR_RING_SLOT_LEN;
47872
+ anchors.push({
47873
+ epoch: bytes2.readBigUInt64LE(offset),
47874
+ root: BigInt(`0x${bytes2.subarray(offset + 8, offset + 40).toString("hex")}`),
47875
+ index: bytes2.readBigUInt64LE(offset + 40),
47876
+ takenAt: bytes2.readBigInt64LE(offset + 48)
47877
+ });
47878
+ }
47879
+ return anchors;
47880
+ }
47859
47881
  async function readPoolState(connection, pool, commitment = "finalized") {
47860
47882
  const info = await retryRpc(() => connection.getAccountInfo(pool, commitment));
47861
47883
  if (!info) return void 0;
@@ -48129,7 +48151,7 @@ function depositIntentAddress({ programId, pool, depositPublicInputBytesHex }) {
48129
48151
  programId
48130
48152
  )[0];
48131
48153
  }
48132
- var import_web391, POOL_STATE_LEN, POOL_STATE_LEN_V2, BUFFER_HEADER_LEN, PAYLOAD_LENGTH, PAYLOAD_LENGTH_V2, TRANSITION_KIND, INSTRUCTION, MAINNET_GENESIS, bytes322;
48154
+ var import_web391, POOL_STATE_LEN, POOL_STATE_LEN_RING, ANCHOR_MODE_RING, ANCHOR_RING_SLOTS, ANCHOR_RING_HEADER, ANCHOR_RING_FIRST_SLOT, ANCHOR_RING_SLOT_LEN, POOL_STATE_LEN_V2, BUFFER_HEADER_LEN, PAYLOAD_LENGTH, PAYLOAD_LENGTH_V2, TRANSITION_KIND, INSTRUCTION, MAINNET_GENESIS, bytes322;
48133
48155
  var init_chain = __esm({
48134
48156
  "spikes/shielded-x402-wallet/lib/chain.mjs"() {
48135
48157
  "use strict";
@@ -48138,6 +48160,12 @@ var init_chain = __esm({
48138
48160
  init_proxy();
48139
48161
  init_compressedReplay();
48140
48162
  POOL_STATE_LEN = 312;
48163
+ POOL_STATE_LEN_RING = 1664;
48164
+ ANCHOR_MODE_RING = 2;
48165
+ ANCHOR_RING_SLOTS = 24;
48166
+ ANCHOR_RING_HEADER = 312;
48167
+ ANCHOR_RING_FIRST_SLOT = 320;
48168
+ ANCHOR_RING_SLOT_LEN = 56;
48141
48169
  POOL_STATE_LEN_V2 = 280;
48142
48170
  BUFFER_HEADER_LEN = 92;
48143
48171
  PAYLOAD_LENGTH = Object.freeze({
@@ -50101,13 +50129,13 @@ function parsePoolState2(data) {
50101
50129
  if (!data) throw new Error("pool_state_length_invalid");
50102
50130
  const bytes2 = Buffer.from(data);
50103
50131
  const magic = bytes2.subarray(0, 8).toString("ascii");
50104
- if ((bytes2.length === POOL_STATE_LEN2 || bytes2.length === POOL_STATE_LEN_RING) && isP03PoolMagic(magic)) {
50132
+ if ((bytes2.length === POOL_STATE_LEN2 || bytes2.length === POOL_STATE_LEN_RING2) && isP03PoolMagic(magic)) {
50105
50133
  const anchorMode = bytes2[11];
50106
- const ring = bytes2.length === POOL_STATE_LEN_RING;
50107
- if (ring !== (anchorMode === ANCHOR_MODE_RING) || !ring && anchorMode !== 0 && anchorMode !== 1) {
50134
+ const ring = bytes2.length === POOL_STATE_LEN_RING2;
50135
+ if (ring !== (anchorMode === ANCHOR_MODE_RING2) || !ring && anchorMode !== 0 && anchorMode !== 1) {
50108
50136
  throw new Error("pool_state_anchor_layout_invalid");
50109
50137
  }
50110
- const anchors = ring ? readAnchorRing(bytes2) : [88, 136].map((offset) => ({
50138
+ const anchors = ring ? readAnchorRing2(bytes2) : [88, 136].map((offset) => ({
50111
50139
  epoch: bytes2.readBigUInt64LE(offset),
50112
50140
  root: BigInt(`0x${bytes2.subarray(offset + 8, offset + 40).toString("hex")}`),
50113
50141
  index: bytes2.readBigUInt64LE(offset + 40)
@@ -50152,13 +50180,13 @@ function parsePoolState2(data) {
50152
50180
  paymentSettler: new import_web395.PublicKey(data.subarray(200, 232))
50153
50181
  };
50154
50182
  }
50155
- function readAnchorRing(bytes2) {
50156
- const head = bytes2.readUInt16LE(ANCHOR_RING_HEADER);
50157
- const count2 = bytes2.readUInt16LE(ANCHOR_RING_HEADER + 2);
50158
- if (head >= ANCHOR_RING_SLOTS || count2 < 1 || count2 > ANCHOR_RING_SLOTS || bytes2.readUInt32LE(ANCHOR_RING_HEADER + 4) !== 0) throw new Error("pool_state_anchor_ring_invalid");
50183
+ function readAnchorRing2(bytes2) {
50184
+ const head = bytes2.readUInt16LE(ANCHOR_RING_HEADER2);
50185
+ const count2 = bytes2.readUInt16LE(ANCHOR_RING_HEADER2 + 2);
50186
+ if (head >= ANCHOR_RING_SLOTS2 || count2 < 1 || count2 > ANCHOR_RING_SLOTS2 || bytes2.readUInt32LE(ANCHOR_RING_HEADER2 + 4) !== 0) throw new Error("pool_state_anchor_ring_invalid");
50159
50187
  const anchors = [];
50160
50188
  for (let back = 0; back < count2; back += 1) {
50161
- const offset = ANCHOR_RING_FIRST_SLOT + (head - back + ANCHOR_RING_SLOTS) % ANCHOR_RING_SLOTS * ANCHOR_RING_SLOT_LEN;
50189
+ const offset = ANCHOR_RING_FIRST_SLOT2 + (head - back + ANCHOR_RING_SLOTS2) % ANCHOR_RING_SLOTS2 * ANCHOR_RING_SLOT_LEN2;
50162
50190
  anchors.push({
50163
50191
  epoch: bytes2.readBigUInt64LE(offset),
50164
50192
  root: BigInt(`0x${bytes2.subarray(offset + 8, offset + 40).toString("hex")}`),
@@ -50401,7 +50429,7 @@ function depositIntentAddress2({ programId, pool, depositPublicInputBytesHex })
50401
50429
  programId
50402
50430
  )[0];
50403
50431
  }
50404
- var import_web395, POOL_STATE_LEN2, POOL_STATE_LEN_RING, ANCHOR_MODE_RING, ANCHOR_RING_SLOTS, ANCHOR_RING_HEADER, ANCHOR_RING_FIRST_SLOT, ANCHOR_RING_SLOT_LEN, POOL_STATE_LEN_V22, BUFFER_HEADER_LEN2, MEMO_BUNDLE_BYTES2, PAYLOAD_LENGTH2, PAYLOAD_LENGTH_V22, TRANSITION_KIND2, INSTRUCTION2, COUNTED_RPC_METHODS, HISTORY_RPC_METHODS, PINNED_HISTORY_PROXIES, PINNED_HISTORY_HTTPS, HISTORY_RPC_OWN, historyRpcErrors, HISTORY_RPC_BEHIND_WAIT_MS, HISTORY_RPC_REQUEST_TIMEOUT_MS, HISTORY_RPC_BEHIND_RETRY_MS, HISTORY_RPC_BEHIND_CODE, ED25519_SPKI_PREFIX, SIGNATURE_BYTES, VERSION_1_PREFIX, HISTORY_CROSS_CHECK_COUNT, runTransactions, warmedSources, bytes323, MEMO_BATCH_MAX, MEMO_ATTEMPTS, MEMO_MAX_WAIT_SECONDS, MEMO_ANSWER_TIMEOUT_MS, MEMO_BODY_TIMEOUT_MS, pauseFor, noticeOnStderr, memoDigestHex, memoFailureText, prefetchedMemosByFetch, MEMO_PREFETCH_LIFE_MS;
50432
+ var import_web395, POOL_STATE_LEN2, POOL_STATE_LEN_RING2, ANCHOR_MODE_RING2, ANCHOR_RING_SLOTS2, ANCHOR_RING_HEADER2, ANCHOR_RING_FIRST_SLOT2, ANCHOR_RING_SLOT_LEN2, POOL_STATE_LEN_V22, BUFFER_HEADER_LEN2, MEMO_BUNDLE_BYTES2, PAYLOAD_LENGTH2, PAYLOAD_LENGTH_V22, TRANSITION_KIND2, INSTRUCTION2, COUNTED_RPC_METHODS, HISTORY_RPC_METHODS, PINNED_HISTORY_PROXIES, PINNED_HISTORY_HTTPS, HISTORY_RPC_OWN, historyRpcErrors, HISTORY_RPC_BEHIND_WAIT_MS, HISTORY_RPC_REQUEST_TIMEOUT_MS, HISTORY_RPC_BEHIND_RETRY_MS, HISTORY_RPC_BEHIND_CODE, ED25519_SPKI_PREFIX, SIGNATURE_BYTES, VERSION_1_PREFIX, HISTORY_CROSS_CHECK_COUNT, runTransactions, warmedSources, bytes323, MEMO_BATCH_MAX, MEMO_ATTEMPTS, MEMO_MAX_WAIT_SECONDS, MEMO_ANSWER_TIMEOUT_MS, MEMO_BODY_TIMEOUT_MS, pauseFor, noticeOnStderr, memoDigestHex, memoFailureText, prefetchedMemosByFetch, MEMO_PREFETCH_LIFE_MS;
50405
50433
  var init_chain2 = __esm({
50406
50434
  "wallet/src/chain.mjs"() {
50407
50435
  "use strict";
@@ -50412,12 +50440,12 @@ var init_chain2 = __esm({
50412
50440
  init_reference2();
50413
50441
  init_anchorClock();
50414
50442
  POOL_STATE_LEN2 = 312;
50415
- POOL_STATE_LEN_RING = 1664;
50416
- ANCHOR_MODE_RING = 2;
50417
- ANCHOR_RING_SLOTS = 24;
50418
- ANCHOR_RING_HEADER = 312;
50419
- ANCHOR_RING_FIRST_SLOT = 320;
50420
- ANCHOR_RING_SLOT_LEN = 56;
50443
+ POOL_STATE_LEN_RING2 = 1664;
50444
+ ANCHOR_MODE_RING2 = 2;
50445
+ ANCHOR_RING_SLOTS2 = 24;
50446
+ ANCHOR_RING_HEADER2 = 312;
50447
+ ANCHOR_RING_FIRST_SLOT2 = 320;
50448
+ ANCHOR_RING_SLOT_LEN2 = 56;
50421
50449
  POOL_STATE_LEN_V22 = 280;
50422
50450
  BUFFER_HEADER_LEN2 = 92;
50423
50451
  MEMO_BUNDLE_BYTES2 = 25600;
@@ -59700,6 +59728,7 @@ var init_errorCodes = __esm({
59700
59728
  "p03_resource_cli_out_unwritable_rerun_same_request",
59701
59729
  "p03_resource_payment_response_unconfirmed_retry_same_request",
59702
59730
  "p03_resource_payment_refused_pay_again_new_request_id",
59731
+ "p03_resource_payment_another_request_unresolved",
59703
59732
  "p03_seller_anchor_not_ready",
59704
59733
  "p03_seller_http_failed",
59705
59734
  "p03_seller_lock_release_failed",
@@ -89554,6 +89583,18 @@ var init_floatPay = __esm({
89554
89583
  }
89555
89584
  });
89556
89585
 
89586
+ // wallet/src/pay/requestId.mjs
89587
+ var payerRequestIdOf;
89588
+ var init_requestId = __esm({
89589
+ "wallet/src/pay/requestId.mjs"() {
89590
+ "use strict";
89591
+ payerRequestIdOf = (record) => {
89592
+ const id = typeof record?.requestId === "string" ? record.requestId.replace(/:float$/, "") : void 0;
89593
+ return id !== void 0 && !id.startsWith("float:") && /^[A-Za-z0-9._:-]{1,128}$/.test(id) ? id : void 0;
89594
+ };
89595
+ }
89596
+ });
89597
+
89557
89598
  // wallet/src/pay/payResource.mjs
89558
89599
  import { fileURLToPath as fileURLToPath10 } from "node:url";
89559
89600
  function assertOwnerUnshieldRequest(requestId, url) {
@@ -90094,7 +90135,7 @@ async function payResourceOnce({
90094
90135
  if (reconciling) break;
90095
90136
  const other = store.readWal(name);
90096
90137
  if (other?.state === "submitted" && other.refused?.landed) fail19("refused_payment_landed");
90097
- if (!["receipt", "cancelled"].includes(other?.state)) fail19("another_request_unresolved");
90138
+ if (!["receipt", "cancelled"].includes(other?.state)) failUnresolved(other);
90098
90139
  }
90099
90140
  if (record?.state === "cancelled") fail19(record.refused ? "request_refused_use_new_request_id" : "request_cancelled");
90100
90141
  const walkHistory = deps.walkHistory ?? (() => walkFinalizedP03TransitionContexts({
@@ -90176,7 +90217,7 @@ async function payResourceOnce({
90176
90217
  if (isPending(other)) {
90177
90218
  mark("prior-finality-wait");
90178
90219
  other = await withPhaseScope(mark, "fin", () => finalizePendingReceipt({ store, connection, programId, name, ...finalityWait, deps: finality }));
90179
- if (isPending(other)) fail19("another_request_unresolved");
90220
+ if (isPending(other)) failUnresolved(other);
90180
90221
  mark("prior-finality-done");
90181
90222
  }
90182
90223
  if (other?.state === "receipt" && other.receiptFinality === "never-finalized") {
@@ -90261,6 +90302,7 @@ async function payResourceOnce({
90261
90302
  state: "quoted",
90262
90303
  fingerprint,
90263
90304
  url,
90305
+ requestId,
90264
90306
  request: suppliedRequest,
90265
90307
  paymentRequired,
90266
90308
  ownerUnshield,
@@ -90420,7 +90462,7 @@ async function payResourceOnce({
90420
90462
  mark("receipt-pending");
90421
90463
  return { replayed: false, receipt, resultBase64, receiptFinality: "pending" };
90422
90464
  }
90423
- var import_web3110, fail19, hash10, OWNER_UNSHIELD_REQUEST, OWNER_UNSHIELD_ORIGIN, POCKET_FILL_ID, RECEIPT_FINALITY_TIMEOUT_MS, RECEIPT_FINALITY_POLL_MS, FINALITY_GATE_MARGIN_SLOTS, FINALITY_GATE_POLL_MS, FINALITY_GATE_SKIP_AFTER_MS, PENDING_FINALITY, isPending, REPLAY_INPUTS, PAYMENT_OUTPUT_INPUT2, QUOTE_MARGIN_SECONDS, SELLER_REFUSED_PAY_AGAIN, SELLER_REASON_FACILITATOR_UNDERFUNDED, ANCHOR_EPOCH_MS, ANCHOR_MARGIN_MS, ANCHOR_WAIT_CAP_MS, DEAD_PAYMENT_MARGIN_SECONDS, SYSVAR_OWNER, quoteLiveAt, replayValuesOf;
90465
+ var import_web3110, fail19, failUnresolved, hash10, OWNER_UNSHIELD_REQUEST, OWNER_UNSHIELD_ORIGIN, POCKET_FILL_ID, RECEIPT_FINALITY_TIMEOUT_MS, RECEIPT_FINALITY_POLL_MS, FINALITY_GATE_MARGIN_SLOTS, FINALITY_GATE_POLL_MS, FINALITY_GATE_SKIP_AFTER_MS, PENDING_FINALITY, isPending, REPLAY_INPUTS, PAYMENT_OUTPUT_INPUT2, QUOTE_MARGIN_SECONDS, SELLER_REFUSED_PAY_AGAIN, SELLER_REASON_FACILITATOR_UNDERFUNDED, ANCHOR_EPOCH_MS, ANCHOR_MARGIN_MS, ANCHOR_WAIT_CAP_MS, DEAD_PAYMENT_MARGIN_SECONDS, SYSVAR_OWNER, quoteLiveAt, replayValuesOf;
90424
90466
  var init_payResource = __esm({
90425
90467
  "wallet/src/pay/payResource.mjs"() {
90426
90468
  "use strict";
@@ -90443,9 +90485,16 @@ var init_payResource = __esm({
90443
90485
  init_proxy();
90444
90486
  init_phaseTiming();
90445
90487
  init_anchorClock();
90488
+ init_requestId();
90446
90489
  fail19 = (reason) => {
90447
90490
  throw new Error(`p03_resource_payment_${reason}`);
90448
90491
  };
90492
+ failUnresolved = (other) => {
90493
+ const error = new Error("p03_resource_payment_another_request_unresolved");
90494
+ const blocking = payerRequestIdOf(other);
90495
+ if (blocking !== void 0) error.blockingRequestId = blocking;
90496
+ throw error;
90497
+ };
90449
90498
  hash10 = (value) => sha256Hex2(Buffer.from(value, "utf8"));
90450
90499
  OWNER_UNSHIELD_REQUEST = /^unshield-([0-9a-zA-Z_-]{1,48})$/;
90451
90500
  OWNER_UNSHIELD_ORIGIN = "https://self-pay.invalid";
@@ -116177,8 +116226,8 @@ import { createHash as createHash21 } from "node:crypto";
116177
116226
  import { dirname as dirname16, join as join15, sep as sep3 } from "node:path";
116178
116227
  var PINNED_PROOF_TOOLS = Object.freeze({
116179
116228
  [DEFAULT_FACILITATOR_ORIGIN]: Object.freeze({
116180
- dir: "ad860e62",
116181
- sumsSha256: "ad860e62dd9bde09008fce798dbe0970f59ef9f7fca846e5a5238c93d7f42597"
116229
+ dir: "47678912",
116230
+ sumsSha256: "47678912949d7da8b705c399edf03d2367465f6eb581b00a059356373baed28e"
116182
116231
  })
116183
116232
  });
116184
116233
  var UPDATE_NEXT = "update the wallet: npx -y shinjuku-shielded@latest setup";
@@ -116363,6 +116412,7 @@ init_sealedCache();
116363
116412
  init_deposit();
116364
116413
  init_selfPay();
116365
116414
  init_book();
116415
+ init_requestId();
116366
116416
  var BALANCE_SNAPSHOT_SCHEMA = "carbon-shielded-wallet/balance-snapshot/v1";
116367
116417
  var BALANCE_SNAPSHOT_FILE = "balance-snapshot.json";
116368
116418
  var SNAPSHOT_KEY_LABEL = "carbon-shielded-wallet/balance-snapshot-key/v1";
@@ -116638,11 +116688,13 @@ function computeBalance({ store, snapshotRead, source = "local", now = Date.now(
116638
116688
  const proof = byName.get(`resource-proof-${key}`)?.record;
116639
116689
  const inputs = provenInputs(proof);
116640
116690
  const selfPay2 = String(entry.record.url ?? "").startsWith(SELF_PAY_ORIGIN2);
116691
+ const requestId = payerRequestIdOf(entry.record);
116641
116692
  const item = {
116642
116693
  kind: selfPay2 ? "unshield-self-payment" : "payment",
116643
116694
  state: entry.state,
116644
116695
  amountAtomic: paymentAmount(entry.record) ?? null,
116645
- ...selfPay2 ? {} : { url: publicUrl(entry.record.url) }
116696
+ ...selfPay2 ? {} : { url: publicUrl(entry.record.url) },
116697
+ ...requestId === void 0 ? {} : { requestId }
116646
116698
  };
116647
116699
  if (inputs === void 0) {
116648
116700
  unknownInputs = true;
@@ -120032,6 +120084,9 @@ function createWalletTools({
120032
120084
  );
120033
120085
  } else if (code === "p03_resource_payment_refused_pay_again_new_request_id") {
120034
120086
  next = "Nothing was paid, and the seller closed this request_id. To pay, call x402_pay with a NEW request_id and the same url, method, headers, and body; if the same refusal repeats, tell your owner what the detail says";
120087
+ } else if (/another_request_unresolved$/.test(code)) {
120088
+ const blocking = error?.blockingRequestId ?? error?.cause?.blockingRequestId;
120089
+ next = typeof blocking === "string" && /^[A-Za-z0-9._:-]{1,128}$/.test(blocking) ? `Nothing was paid: an earlier payment (request_id "${blocking}") is not finished, and the wallet pays one at a time. Call x402_pay again with request_id "${blocking}" and that payment's url, method, headers, and body (it finishes it and never pays twice), or close it with wallet_cancel request_id "${blocking}"; then call x402_pay again with request_id "${requestId}"` : `Nothing was paid: an earlier payment is not finished, and the wallet pays one at a time. wallet_balance lists it in detail.inFlight; finish it with x402_pay and its request_id, or close it with wallet_cancel; then call x402_pay again with request_id "${requestId}"`;
120035
120090
  } else if (/accounts_split_merge_first/.test(line)) {
120036
120091
  next = `Nothing was paid: the shielded balance covers this price in total, but it sits in several accounts and one payment draws only one account and at most 3 notes. Tell your owner to join them: shinjuku-wallet merge --wallet <wallet.json> --passphrase-file passphrase.txt --program <program> --proof-tools proof-tools.json --profile public-profile.json --facilitator <facilitator origin> (--dry-run shows the plan; shinjuku-wallet help merge). After it finished and the next pool anchor (up to 5 minutes; about 30 s on a pool with sub-anchors) passed, call x402_pay again with request_id "${requestId}" and the same url, method, headers, and body`;
120037
120092
  } else if (code.startsWith("wallet_spend_refused_")) {
@@ -128468,7 +128523,7 @@ function failureHint(command, reason, deps, values) {
128468
128523
  if (/wallet_quote_refused_/.test(reason)) {
128469
128524
  return "nothing was paid: the seller's payment terms do not fit this wallet (the code names the failed check: pool, asset, network, binding, or a malformed challenge). Pay a seller that accepts this wallet's pool";
128470
128525
  }
128471
- if (/another_request_unresolved/.test(reason)) return `finish the earlier payment (rerun its pay command) or close it (${CLI2} help cancel); ${CLI2} balance lists it`;
128526
+ if (/another_request_unresolved/.test(reason)) return `finish the earlier payment (rerun its pay command with the same --request-id) or close it (${CLI2} help cancel); ${CLI2} balance --refresh lists it in detail.inFlight with its requestId`;
128472
128527
  if (/resource_cli_out_unwritable/.test(reason)) return "the payment is recorded, but the --out file could not be written; rerun the same pay command (same --request-id) with a --out path you can write: it replays the receipt and never pays twice";
128473
128528
  if (/p03_facilitator_underfunded/.test(reason)) {
128474
128529
  const again = command.name === "unshield" ? "rerun the same command with a new --unshield-id" : command.name === "pocket fill" ? "rerun the same pocket fill command (it starts the fill again with a new quote)" : "pay again with a new --request-id";
@@ -128984,8 +129039,11 @@ async function runShinjukuWallet(argv, overrides = {}) {
128984
129039
  const codes = failureCodes(error, reason);
128985
129040
  writeRunResult(deps, command, 1, error, codes);
128986
129041
  const hint = failureHint(command, codes.join(" "), deps, values);
129042
+ const blocking = error?.blockingRequestId ?? error?.cause?.blockingRequestId;
129043
+ const blockingLine = typeof blocking === "string" && /^[A-Za-z0-9._:-]{1,128}$/.test(blocking) ? `earlier payment: --request-id ${blocking}
129044
+ ` : "";
128987
129045
  io.err(`${CLI2} ${command.name} failed: ${reason}
128988
- ${hint ? `hint: ${hint}
129046
+ ${blockingLine}${hint ? `hint: ${hint}
128989
129047
  ` : ""}Help: ${CLI2} help ${command.name}
128990
129048
  `);
128991
129049
  return 1;