shinjuku-shield 0.3.209 → 0.3.211

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 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.209. The command is `shinjuku`.
8
+ This is version 0.3.211. The command is `shinjuku`.
9
9
 
10
10
  ## Set up
11
11
 
12
12
  ```sh
13
- npx -y shinjuku@0.3.209 setup
13
+ npx -y shinjuku@0.3.211 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.209 mcp
103
+ claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.211 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.209, its older name, runs this package at the same version, so wallets
119
+ 0.3.211, 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": "2b7c138c4c824705da41d7d40c276b95bd8d546a6f80c782fdc5b698c8946996",
5
- "bytes": 9650108,
6
- "sourceCommit": "df5b9ea5aa1a330598af3851cdda6bddbc48e581",
4
+ "sha256": "16c37be1941f1e83a98ce3c15d4bd9bdb3528c5916f0d5aa7f6b3b0d2eeaa579",
5
+ "bytes": 9662400,
6
+ "sourceCommit": "28aa2965049cb9edc56100a7161a98ca72c8b366",
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",
@@ -1040,8 +1040,8 @@
1040
1040
  ],
1041
1041
  "seller": {
1042
1042
  "file": "shinjuku-seller.mjs",
1043
- "sha256": "f8f72239b2288bbf4f253967545cc120adda2500902af29c8693117bc104dbac",
1044
- "bytes": 4093726,
1043
+ "sha256": "3f3b08467d9fdc83230b8e44f75f956c32087a61a7a31b9aa65794b536648a3e",
1044
+ "bytes": 4100943,
1045
1045
  "entry": "wallet/src/seller/exact/index.mjs",
1046
1046
  "external": [
1047
1047
  "@x402/core/http",
@@ -1933,5 +1933,5 @@
1933
1933
  }
1934
1934
  ]
1935
1935
  },
1936
- "publishedAt": "2026-11-11T06:50:53.278Z"
1936
+ "publishedAt": "2026-11-11T09:48:45.182Z"
1937
1937
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "shinjuku-shield",
3
- "version": "0.3.209",
3
+ "version": "0.3.211",
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": "2b7c138c",
7
- "shinjukuSha256": "2b7c138c4c824705da41d7d40c276b95bd8d546a6f80c782fdc5b698c8946996",
6
+ "shinjukuRelease": "16c37be1",
7
+ "shinjukuSha256": "16c37be1941f1e83a98ce3c15d4bd9bdb3528c5916f0d5aa7f6b3b0d2eeaa579",
8
8
  "license": "SEE LICENSE IN LICENSE.txt",
9
9
  "author": "Shinjuku Shield",
10
10
  "homepage": "https://github.com/ShinjukuStaition/shinjuku-shield#readme",
@@ -38823,7 +38823,7 @@ async function attestP03ProgramHistory(input) {
38823
38823
  observedUpgradeSlots: Object.freeze(transitions.map((entry) => BigInt(entry.slot)))
38824
38824
  });
38825
38825
  }
38826
- var P03_PROGRAM_HISTORY_SCHEMA, P03_PROGRAM_HISTORY_V2_SCHEMA, P03_PROGRAM_HISTORY_V3_SCHEMA, P03_PROGRAM_HISTORY_V4_SCHEMA, P03_PROGRAM_HISTORY_V5_SCHEMA, COMPRESSED_REPLAY_ELF_SHA256, COMPRESSED_REPLAY_ELF_BYTES, POLICY_ALLOCATION_BYTES, COMPRESSED_REPLAY_EXTENSION_BYTES, P03_PROGRAM_HISTORY_V6_SCHEMA, E1_ELF_SHA256, E1_ELF_BYTES, E1_SUPERSEDED_ELF_SHA256, P03_E1_TREE_RENT_DESTINATION, E1_EXTENSION_BYTES, P03_PROGRAM_HISTORY_V7_SCHEMA, LOCKED_RETIRE_ELF_SHA256, LOCKED_RETIRE_ELF_BYTES, LOCKED_RETIRE_ALLOCATED_SHA256, LOCKED_RETIRE_EXTENSION_BYTES, LOCKED_RETIRE_ALLOCATION_BYTES, P03_PROGRAM_HISTORY_V8_SCHEMA, ANCHOR_RING_ELF_SHA256, ANCHOR_RING_ELF_BYTES, ANCHOR_RING_ALLOCATED_SHA256, ANCHOR_RING_EXTENSION_BYTES, SUCCESSION_ELF_SHA256, SUCCESSION_ELF_BYTES, SUCCESSION_ALLOCATED_SHA256, SUCCESSION_EXTENSION_BYTES, ANCHOR_RING_ALLOCATION_BYTES, ANCHOR_RING_WIDE_ELF_SHA256, ANCHOR_RING_WIDE_ELF_BYTES, ANCHOR_RING_WIDE_ALLOCATED_SHA256, ANCHOR_RING_WIDE_EXTENSION_BYTES, SUCCESSION_ALLOCATION_BYTES, LIGHT_REMOVAL_ELF_SHA256, LIGHT_REMOVAL_ELF_BYTES, LIGHT_REMOVAL_ALLOCATED_SHA256, ANCHOR_RING_WIDE_ALLOCATION_BYTES, DEPOSIT_TWO_KEYS_ELF_SHA256, DEPOSIT_TWO_KEYS_ELF_BYTES, DEPOSIT_TWO_KEYS_ALLOCATED_SHA256, P03_LOCKED_RETIRE_POOL, P03_LOCKED_RETIRE_AUTHORITY, P03_LOCKED_RETIRE_DESTINATION, P03_COMPATIBLE_CODE, LOADER, SYSTEM, fail, sha, DEPOSIT_INTENT_V1, DEPOSIT_RECORD_V2, COMPRESSED_REPLAY_REVIEWED, E1_REVIEWED, LOCKED_RETIRE_REVIEWED, ANCHOR_RING_REVIEWED, SUCCESSION_REVIEWED, ANCHOR_RING_WIDE_REVIEWED, LIGHT_REMOVAL_REVIEWED, DEPOSIT_TWO_KEYS_REVIEWED, P03_REVIEWED_EXECUTABLES, ADDED_EXECUTABLES, LATER_FLAGS, EXECUTABLE_FLAGS, EXECUTABLE_KEYS, p03ReviewedExecutables, keys, hash, slot, keyBytes, comparePosition, P03_PROGRAM_HISTORY_GENERIC_SCHEMA, GENERIC_PRIOR_SCHEMAS, GENERIC_MAX_STEPS, GENERIC_MAX_DEPTH, ORIGINAL_KEYS, UPGRADE_KEYS, EXTEND_KEYS, canonical, hasArea, currentAllocation, originalAllocation, p03ProgramHistoryDigest, compare, tag;
38826
+ var P03_PROGRAM_HISTORY_SCHEMA, P03_PROGRAM_HISTORY_V2_SCHEMA, P03_PROGRAM_HISTORY_V3_SCHEMA, P03_PROGRAM_HISTORY_V4_SCHEMA, P03_PROGRAM_HISTORY_V5_SCHEMA, COMPRESSED_REPLAY_ELF_SHA256, COMPRESSED_REPLAY_ELF_BYTES, POLICY_ALLOCATION_BYTES, COMPRESSED_REPLAY_EXTENSION_BYTES, P03_PROGRAM_HISTORY_V6_SCHEMA, E1_ELF_SHA256, E1_ELF_BYTES, E1_SUPERSEDED_ELF_SHA256, P03_E1_TREE_RENT_DESTINATION, E1_EXTENSION_BYTES, P03_PROGRAM_HISTORY_V7_SCHEMA, LOCKED_RETIRE_ELF_SHA256, LOCKED_RETIRE_ELF_BYTES, LOCKED_RETIRE_ALLOCATED_SHA256, LOCKED_RETIRE_EXTENSION_BYTES, LOCKED_RETIRE_ALLOCATION_BYTES, P03_PROGRAM_HISTORY_V8_SCHEMA, ANCHOR_RING_ELF_SHA256, ANCHOR_RING_ELF_BYTES, ANCHOR_RING_ALLOCATED_SHA256, ANCHOR_RING_EXTENSION_BYTES, SUCCESSION_ELF_SHA256, SUCCESSION_ELF_BYTES, SUCCESSION_ALLOCATED_SHA256, SUCCESSION_EXTENSION_BYTES, ANCHOR_RING_ALLOCATION_BYTES, ANCHOR_RING_WIDE_ELF_SHA256, ANCHOR_RING_WIDE_ELF_BYTES, ANCHOR_RING_WIDE_ALLOCATED_SHA256, ANCHOR_RING_WIDE_EXTENSION_BYTES, SUCCESSION_ALLOCATION_BYTES, LIGHT_REMOVAL_ELF_SHA256, LIGHT_REMOVAL_ELF_BYTES, LIGHT_REMOVAL_ALLOCATED_SHA256, ANCHOR_RING_WIDE_ALLOCATION_BYTES, DEPOSIT_TWO_KEYS_ELF_SHA256, DEPOSIT_TWO_KEYS_ELF_BYTES, DEPOSIT_TWO_KEYS_ALLOCATED_SHA256, DEPOSIT_ONE_KEY_ELF_SHA256, DEPOSIT_ONE_KEY_ELF_BYTES, DEPOSIT_ONE_KEY_ALLOCATED_SHA256, P03_LOCKED_RETIRE_POOL, P03_LOCKED_RETIRE_AUTHORITY, P03_LOCKED_RETIRE_DESTINATION, P03_COMPATIBLE_CODE, LOADER, SYSTEM, fail, sha, DEPOSIT_INTENT_V1, DEPOSIT_RECORD_V2, COMPRESSED_REPLAY_REVIEWED, E1_REVIEWED, LOCKED_RETIRE_REVIEWED, ANCHOR_RING_REVIEWED, SUCCESSION_REVIEWED, ANCHOR_RING_WIDE_REVIEWED, LIGHT_REMOVAL_REVIEWED, DEPOSIT_TWO_KEYS_REVIEWED, DEPOSIT_ONE_KEY_REVIEWED, P03_REVIEWED_EXECUTABLES, ADDED_EXECUTABLES, LATER_FLAGS, EXECUTABLE_FLAGS, EXECUTABLE_KEYS, p03ReviewedExecutables, keys, hash, slot, keyBytes, comparePosition, P03_PROGRAM_HISTORY_GENERIC_SCHEMA, GENERIC_PRIOR_SCHEMAS, GENERIC_MAX_STEPS, GENERIC_MAX_DEPTH, ORIGINAL_KEYS, UPGRADE_KEYS, EXTEND_KEYS, canonical, hasArea, currentAllocation, originalAllocation, p03ProgramHistoryDigest, compare, tag;
38827
38827
  var init_p03ProgramHistory = __esm({
38828
38828
  "wallet/vendor/shared/p03ProgramHistory.mjs"() {
38829
38829
  "use strict";
@@ -38927,6 +38927,16 @@ var init_p03ProgramHistory = __esm({
38927
38927
  throw new Error("p03_program_history_deposit_two_keys_allocation_invalid");
38928
38928
  }
38929
38929
  }
38930
+ DEPOSIT_ONE_KEY_ELF_SHA256 = "e5045352cfa2f79ecf735850cf11b7b4b399f2eda66f97e8e8abd95e9d9b89dd";
38931
+ DEPOSIT_ONE_KEY_ELF_BYTES = 418288;
38932
+ DEPOSIT_ONE_KEY_ALLOCATED_SHA256 = "b2d1d9824175190c5b285b4afba853144af828c4d9556eeee03de179863f34d6";
38933
+ {
38934
+ const set = [DEPOSIT_ONE_KEY_ELF_SHA256, DEPOSIT_ONE_KEY_ELF_BYTES, DEPOSIT_ONE_KEY_ALLOCATED_SHA256].filter((value2) => value2 !== null).length;
38935
+ if (set !== 0 && set !== 3) throw new Error("p03_program_history_deposit_one_key_constants_partial");
38936
+ if (set === 3 && (ANCHOR_RING_WIDE_ALLOCATION_BYTES === null || !Number.isSafeInteger(DEPOSIT_ONE_KEY_ELF_BYTES) || DEPOSIT_ONE_KEY_ELF_BYTES > ANCHOR_RING_WIDE_ALLOCATION_BYTES || DEPOSIT_ONE_KEY_ELF_BYTES === ANCHOR_RING_WIDE_ALLOCATION_BYTES !== (DEPOSIT_ONE_KEY_ALLOCATED_SHA256 === DEPOSIT_ONE_KEY_ELF_SHA256))) {
38937
+ throw new Error("p03_program_history_deposit_one_key_allocation_invalid");
38938
+ }
38939
+ }
38930
38940
  P03_LOCKED_RETIRE_POOL = "AAG16mNWTtC1sBeu2tTVTwWjqWXCefLTCByVPj5X3kV8";
38931
38941
  P03_LOCKED_RETIRE_AUTHORITY = "5Zk3jnUcWWk5XSiDdQdTkhCPmAi5GxKPQmNVvF7bfyYs";
38932
38942
  P03_LOCKED_RETIRE_DESTINATION = "B9xbQWtK5iJ8jY4cBjz5LEAKpCbscLg8dYy3dTnbqGhn";
@@ -38984,7 +38994,11 @@ var init_p03ProgramHistory = __esm({
38984
38994
  // Deposit upgrade, two deposit keys (no extend; the AB code area): null (fail closed) if the constants above are unset.
38985
38995
  depositTwoKeys: DEPOSIT_TWO_KEYS_ELF_SHA256,
38986
38996
  depositTwoKeysBytes: DEPOSIT_TWO_KEYS_ELF_BYTES,
38987
- depositTwoKeysAllocatedSha256: DEPOSIT_TWO_KEYS_ALLOCATED_SHA256
38997
+ depositTwoKeysAllocatedSha256: DEPOSIT_TWO_KEYS_ALLOCATED_SHA256,
38998
+ // The old deposit key removal, one deposit key (no extend; the AB code area): null (fail closed) if the constants above are unset.
38999
+ depositOneKey: DEPOSIT_ONE_KEY_ELF_SHA256,
39000
+ depositOneKeyBytes: DEPOSIT_ONE_KEY_ELF_BYTES,
39001
+ depositOneKeyAllocatedSha256: DEPOSIT_ONE_KEY_ALLOCATED_SHA256
38988
39002
  });
38989
39003
  LOADER = "BPFLoaderUpgradeab1e11111111111111111111111";
38990
39004
  SYSTEM = "11111111111111111111111111111111";
@@ -39002,6 +39016,7 @@ var init_p03ProgramHistory = __esm({
39002
39016
  ANCHOR_RING_WIDE_REVIEWED = SUCCESSION_REVIEWED && Number.isSafeInteger(SUCCESSION_ALLOCATION_BYTES) && typeof P03_COMPATIBLE_CODE.anchorRingWide === "string" && /^[0-9a-f]{64}$/.test(P03_COMPATIBLE_CODE.anchorRingWide) && Number.isSafeInteger(P03_COMPATIBLE_CODE.anchorRingWideBytes) && typeof P03_COMPATIBLE_CODE.anchorRingWideAllocatedSha256 === "string" && /^[0-9a-f]{64}$/.test(P03_COMPATIBLE_CODE.anchorRingWideAllocatedSha256) && Number.isSafeInteger(P03_COMPATIBLE_CODE.anchorRingWideExtensionBytes);
39003
39017
  LIGHT_REMOVAL_REVIEWED = ANCHOR_RING_WIDE_REVIEWED && Number.isSafeInteger(ANCHOR_RING_WIDE_ALLOCATION_BYTES) && typeof P03_COMPATIBLE_CODE.lightRemoval === "string" && /^[0-9a-f]{64}$/.test(P03_COMPATIBLE_CODE.lightRemoval) && Number.isSafeInteger(P03_COMPATIBLE_CODE.lightRemovalBytes) && typeof P03_COMPATIBLE_CODE.lightRemovalAllocatedSha256 === "string" && /^[0-9a-f]{64}$/.test(P03_COMPATIBLE_CODE.lightRemovalAllocatedSha256);
39004
39018
  DEPOSIT_TWO_KEYS_REVIEWED = LIGHT_REMOVAL_REVIEWED && typeof P03_COMPATIBLE_CODE.depositTwoKeys === "string" && /^[0-9a-f]{64}$/.test(P03_COMPATIBLE_CODE.depositTwoKeys) && Number.isSafeInteger(P03_COMPATIBLE_CODE.depositTwoKeysBytes) && typeof P03_COMPATIBLE_CODE.depositTwoKeysAllocatedSha256 === "string" && /^[0-9a-f]{64}$/.test(P03_COMPATIBLE_CODE.depositTwoKeysAllocatedSha256);
39019
+ DEPOSIT_ONE_KEY_REVIEWED = DEPOSIT_TWO_KEYS_REVIEWED && typeof P03_COMPATIBLE_CODE.depositOneKey === "string" && /^[0-9a-f]{64}$/.test(P03_COMPATIBLE_CODE.depositOneKey) && Number.isSafeInteger(P03_COMPATIBLE_CODE.depositOneKeyBytes) && typeof P03_COMPATIBLE_CODE.depositOneKeyAllocatedSha256 === "string" && /^[0-9a-f]{64}$/.test(P03_COMPATIBLE_CODE.depositOneKeyAllocatedSha256);
39005
39020
  P03_REVIEWED_EXECUTABLES = Object.freeze([
39006
39021
  Object.freeze({ codeSha256: P03_COMPATIBLE_CODE.previous, codeBytes: P03_COMPATIBLE_CODE.previousBytes, initAccounts: 4, deposit: DEPOSIT_INTENT_V1, compressedReplay: false, indexedReplay: false }),
39007
39022
  Object.freeze({ codeSha256: P03_COMPATIBLE_CODE.next, codeBytes: P03_COMPATIBLE_CODE.nextBytes, initAccounts: 4, deposit: DEPOSIT_INTENT_V1, compressedReplay: false, indexedReplay: false }),
@@ -39124,6 +39139,23 @@ var init_p03ProgramHistory = __esm({
39124
39139
  allocationBytes: ANCHOR_RING_WIDE_ALLOCATION_BYTES,
39125
39140
  allocatedSha256: P03_COMPATIBLE_CODE.depositTwoKeysAllocatedSha256,
39126
39141
  upgradeFrom: Object.freeze([P03_COMPATIBLE_CODE.lightRemoval])
39142
+ })] : [],
39143
+ // Generic-history target only: an upgrade with no extend, so the area is the AB area (the ELF plus 20,256 zero bytes).
39144
+ ...DEPOSIT_ONE_KEY_REVIEWED ? [Object.freeze({
39145
+ codeSha256: P03_COMPATIBLE_CODE.depositOneKey,
39146
+ codeBytes: P03_COMPATIBLE_CODE.depositOneKeyBytes,
39147
+ initAccounts: 6,
39148
+ indexedInitAccounts: 7,
39149
+ deposit: DEPOSIT_RECORD_V2,
39150
+ compressedReplay: true,
39151
+ indexedReplay: true,
39152
+ lockedPoolRetire: true,
39153
+ anchorRing: true,
39154
+ succession: true,
39155
+ anchorRingWide: true,
39156
+ allocationBytes: ANCHOR_RING_WIDE_ALLOCATION_BYTES,
39157
+ allocatedSha256: P03_COMPATIBLE_CODE.depositOneKeyAllocatedSha256,
39158
+ upgradeFrom: Object.freeze([P03_COMPATIBLE_CODE.depositTwoKeys])
39127
39159
  })] : []
39128
39160
  ]);
39129
39161
  {
@@ -43754,6 +43786,7 @@ var init_errorCodes = __esm({
43754
43786
  "relay_config_mismatch",
43755
43787
  "relay_config_unavailable",
43756
43788
  "relay_intake_paused_retry_later",
43789
+ "relay_not_ready_retry_later",
43757
43790
  "relay_key_mismatch",
43758
43791
  "relay_key_probe_exhausted",
43759
43792
  "relay_memo_missing",
@@ -61844,7 +61877,6 @@ ${stamp}`;
61844
61877
  OPTIONAL_TOOL_KEYS = /* @__PURE__ */ new Set(["depositProver", "depositHiddenProver", "solanaCli", "moveWitness", "moveProver"]);
61845
61878
  STANDBY_TOOLS_MAX_AGE_MS = 10 * 6e4;
61846
61879
  RELATION_PROVERS = Object.freeze({
61847
- "deposit-v1": ["depositProver", "deposit-v1.json"],
61848
61880
  // The prover's production artifact name (deposit_hidden_v1_spike.rs artifact_path).
61849
61881
  "deposit-hidden-v1": ["depositHiddenProver", "deposit-hidden-v1.json"],
61850
61882
  "tree-append-v1": ["treeAppendProver", "tree-append-v1-deposit.json"]
@@ -62167,7 +62199,7 @@ function buildDepositWitness({
62167
62199
  poolDomain,
62168
62200
  zeroLeaf,
62169
62201
  amountAtomic,
62170
- relation = DEPOSIT_RELATION.v1,
62202
+ relation = DEPOSIT_RELATION.hidden,
62171
62203
  kind = "account",
62172
62204
  random = defaultRandom
62173
62205
  }) {
@@ -62244,6 +62276,46 @@ function buildDepositWitness({
62244
62276
  accountSlot: slot3
62245
62277
  });
62246
62278
  }
62279
+ function hiddenWitnessForDeposit({ seedHex, generator, zeroLeaf, publicInputBytesHex, memoBundleHex }) {
62280
+ if (!/^[0-9a-f]{64}$/.test(seedHex ?? "")) fail12("seed_invalid");
62281
+ if (!Array.isArray(publicInputBytesHex) || publicInputBytesHex.length !== 6) fail12("public_inputs_invalid");
62282
+ const inputs = publicInputBytesHex.map((value2) => BigInt(`0x${String(value2).replace(/^0x/, "")}`));
62283
+ const [poolDomain, amount, contextCommitment, outCommitment, memoHi, memoLo] = inputs;
62284
+ const bundle2 = Buffer.from(String(memoBundleHex ?? ""), "hex");
62285
+ if (bundle2.length !== MEMO_BUNDLE_BYTES3) fail12("bundle_length");
62286
+ const [hi, lo] = splitDigest2(Buffer.from(bundleDigest2(bundle2).replace(/^0x/, ""), "hex"));
62287
+ if (hi !== memoHi || lo !== memoLo) fail12("memo_digest_mismatch");
62288
+ const keys3 = deriveWalletKeys2({
62289
+ seedBytes: Uint8Array.from(Buffer.from(seedHex, "hex")),
62290
+ generator,
62291
+ resourceNonce: new Uint8Array(32),
62292
+ poolDomain
62293
+ });
62294
+ const { accepted } = trialDecryptBundle({
62295
+ bundleBytes: bundle2,
62296
+ eta: keys3.eta,
62297
+ poolDomain,
62298
+ outCommitment,
62299
+ contextCommitment,
62300
+ epoch: 0n,
62301
+ transitionKind: DEPOSIT_TRANSITION_KIND,
62302
+ zeroLeaf: BigInt(zeroLeaf),
62303
+ subtreeStartIndex: 0n
62304
+ });
62305
+ const found = accepted[0];
62306
+ if (accepted.length !== 1 || found.kind !== "account" || found.account.i !== 0n || found.account.b !== amount) fail12("self_recovery_failed");
62307
+ const text2 = (value2) => value2.toString();
62308
+ return Object.freeze({
62309
+ relation: DEPOSIT_RELATION.hidden,
62310
+ kind: "account",
62311
+ vector: { zeroLeaf: text2(BigInt(zeroLeaf)), depositHiddenV1: {
62312
+ kind: "account",
62313
+ publicInputs: inputs.map(text2),
62314
+ slot: found.slot,
62315
+ leaf: { d: text2(found.account.d), pDX: text2(found.account.pDX), t: "0", commitment: text2(found.commitment) }
62316
+ } }
62317
+ });
62318
+ }
62247
62319
  var DEPOSIT_DOMAIN, DEPOSIT_TRANSITION_KIND, U64_MAX2, DEPOSIT_RELATION, NOTE_T_BYTES, defaultRandom;
62248
62320
  var init_witness = __esm({
62249
62321
  "wallet/src/deposit/witness.mjs"() {
@@ -69361,11 +69433,13 @@ It asks the amount, then gives a one-time address and its QR code: send USDC to
69361
69433
  const selfPay = String(entry.record.url ?? "").startsWith(SELF_PAY_ORIGIN);
69362
69434
  const joined = selfPay ? joinedAccountOf(entry, byName) : void 0;
69363
69435
  const requestId = payerRequestIdOf(entry.record);
69436
+ const userSend = selfPay && joined === void 0 && !/\/unshield\/(pocket-|merge-)/.test(String(entry.record.url ?? ""));
69364
69437
  const item = {
69365
69438
  kind: joined !== void 0 ? "merge" : selfPay ? "unshield-self-payment" : "payment",
69366
69439
  state: entry.state,
69367
69440
  amountAtomic: paymentAmount(entry.record) ?? null,
69368
69441
  ...selfPay ? {} : { url: publicUrl(entry.record.url) },
69442
+ ...userSend ? { userSend: true } : {},
69369
69443
  ...requestId === void 0 ? {} : { requestId }
69370
69444
  };
69371
69445
  if (joined !== void 0) {
@@ -69719,61 +69793,6 @@ async function currentAppend({ store, connection, id, proofTools, outCommitment,
69719
69793
  publicInputBytesHex: proof.publicInputBytesHex
69720
69794
  });
69721
69795
  }
69722
- async function prepareDeposit({ store, connection, programId, proofTools, amountAtomic, depositId, checkAmount, deps = {} }) {
69723
- assertDepositId(depositId);
69724
- const existing = store.readWal(walName(depositId));
69725
- if (existing) {
69726
- if (existing.relay) fail15("id_used_by_relayed_deposit");
69727
- if (existing.schema !== DEPOSIT_WAL_SCHEMA || existing.amountAtomic !== String(amountAtomic)) fail15("id_reused_with_different_amount");
69728
- return existing;
69729
- }
69730
- const unresolved = store.listWal().filter((name) => name.startsWith("deposit-")).map((name) => store.readWal(name)).filter((record2) => record2?.schema === DEPOSIT_WAL_SCHEMA && !RESOLVED_STATES.has(record2.state) && record2.relay?.inbound === void 0);
69731
- if (unresolved.length > 0) fail15("another_deposit_unresolved");
69732
- if (!proofTools.depositProver) fail15("proof_tools_missing_deposit_prover");
69733
- const id = walletIdentity(store, programId);
69734
- const amount = BigInt(amountAtomic);
69735
- const pool2 = await poolState(connection, id);
69736
- const balances = await assertAdmission(connection, id, pool2, amount);
69737
- checkAmount?.({ amount, pool: pool2, ...balances });
69738
- const witness = (deps.buildWitness ?? buildDepositWitness)({
69739
- seedHex: store.state.seedHex,
69740
- generator: pinnedGenerator2(),
69741
- poolDomain: pool2.poolDomain,
69742
- zeroLeaf: P03_PINNED_ZERO_LEAF,
69743
- amountAtomic: amount
69744
- });
69745
- const proof = await (deps.prove ?? proveP03Vector)({ tools: proofTools, relation: "deposit-v1", vector: witness.vector });
69746
- if (JSON.stringify(proof.publicInputBytesHex) !== JSON.stringify(witness.publicInputBytesHex)) fail15("deposit_public_inputs_mismatch");
69747
- const append = await (deps.currentAppend ?? currentAppend)({
69748
- store,
69749
- connection,
69750
- id,
69751
- proofTools,
69752
- outCommitment: witness.outCommitment,
69753
- poolDomain: pool2.poolDomain,
69754
- deps
69755
- });
69756
- const record = {
69757
- schema: DEPOSIT_WAL_SCHEMA,
69758
- state: "proved",
69759
- depositId,
69760
- program: id.program.toBase58(),
69761
- pool: id.pool.toBase58(),
69762
- asset: id.mint.toBase58(),
69763
- amountAtomic: amount.toString(),
69764
- memoDigest: witness.memoDigest,
69765
- memoBundleHex: witness.memoBundleHex,
69766
- outCommitment: witness.outCommitment,
69767
- accountSlot: witness.accountSlot,
69768
- proofBytesHex: proof.proofBytesHex,
69769
- publicInputBytesHex: proof.publicInputBytesHex,
69770
- append,
69771
- bufferSecretKey: Array.from(import_web3117.Keypair.generate().secretKey),
69772
- attempts: []
69773
- };
69774
- store.writeWal(walName(depositId), record);
69775
- return record;
69776
- }
69777
69796
  function payload(record) {
69778
69797
  const bytes2 = Buffer.concat([hex(record.proofBytesHex), ...record.publicInputBytesHex.map(hex)]);
69779
69798
  if (bytes2.length !== PAYLOAD_LENGTH2.deposit) fail15("payload_length_invalid");
@@ -70153,6 +70172,13 @@ async function submitDeposit({ store, connection, programId, proofTools, deposit
70153
70172
  store.writeWal(name, record);
70154
70173
  continue;
70155
70174
  }
70175
+ if (record.relation !== DEPOSIT_RELATION.hidden) {
70176
+ const buffer = await closeLeftoverBuffer({ connection, id, record, store, name, pause: pause2 });
70177
+ if (buffer.startsWith("pending_until_slot_")) fail15("buffer_near_expiry_retry_later");
70178
+ if (buffer === "close_not_finalized_retry_later") fail15("buffer_close_not_finalized_retry");
70179
+ if (buffer === "not_ours") fail15("buffer_foreign_or_changed");
70180
+ await proveAgainWithHiddenKey({ store, name, record, proofTools, deps });
70181
+ }
70156
70182
  const pool2 = await poolState(connection, id);
70157
70183
  await assertAdmission(connection, id, pool2, BigInt(record.amountAtomic));
70158
70184
  await signSet({ connection, id, record, store, proofTools, source, deps });
@@ -70373,10 +70399,12 @@ async function prepareRelayedDepositLeased({
70373
70399
  if (!inbound && record.amountAtomic !== amount.toString()) fail15("id_reused_with_different_amount");
70374
70400
  return record;
70375
70401
  }
70376
- if (!proofTools.depositProver) fail15("proof_tools_missing_deposit_prover");
70402
+ if (!proofTools.depositHiddenProver) fail15("proof_tools_missing_deposit_prover");
70377
70403
  if (!serviceUrl2) fail15("relay_service_required");
70378
70404
  const id = walletIdentity(store, programId);
70379
70405
  const config = await readRelayConfig({ serviceUrl: serviceUrl2, fetchImpl: deps.fetchImpl ?? fetch, id });
70406
+ if (Array.isArray(config.depositRelations) && config.depositRelations.length === 0) fail15("relay_not_ready_retry_later");
70407
+ if (!config.depositRelations?.includes(DEPOSIT_RELATION.hidden)) fail15("relay_not_offered");
70380
70408
  let inboundSource;
70381
70409
  let inboundHeld;
70382
70410
  if (inbound) {
@@ -70437,8 +70465,8 @@ async function prepareRelayedDepositLeased({
70437
70465
  }
70438
70466
  if (closing && sourceAmount !== amount) fail15("relay_closing_source_not_whole_balance");
70439
70467
  checkAmount?.({ amount, pool: pool2, sourceAmount, vaultAmount });
70440
- const relation = config.depositRelations?.includes(DEPOSIT_RELATION.hidden) && proofTools.depositHiddenProver ? DEPOSIT_RELATION.hidden : DEPOSIT_RELATION.v1;
70441
- const kind = relation === DEPOSIT_RELATION.hidden ? depositKindFor(store) : "account";
70468
+ const relation = DEPOSIT_RELATION.hidden;
70469
+ const kind = depositKindFor(store);
70442
70470
  const witness = (deps.buildWitness ?? buildDepositWitness)({
70443
70471
  seedHex: store.state.seedHex,
70444
70472
  generator: pinnedGenerator2(),
@@ -70467,6 +70495,24 @@ async function prepareRelayedDepositLeased({
70467
70495
  store.writeWal(name, record);
70468
70496
  return record;
70469
70497
  }
70498
+ async function proveAgainWithHiddenKey({ store, name, record, proofTools, deps = {} }) {
70499
+ if (record.relation === DEPOSIT_RELATION.hidden) return;
70500
+ if (!proofTools?.depositHiddenProver) fail15("proof_tools_missing_deposit_prover");
70501
+ const witness = hiddenWitnessForDeposit({
70502
+ seedHex: store.state.seedHex,
70503
+ generator: pinnedGenerator2(),
70504
+ zeroLeaf: P03_PINNED_ZERO_LEAF,
70505
+ publicInputBytesHex: record.publicInputBytesHex,
70506
+ memoBundleHex: record.memoBundleHex
70507
+ });
70508
+ const proof = await (deps.prove ?? proveP03Vector)({ tools: proofTools, relation: DEPOSIT_RELATION.hidden, vector: witness.vector });
70509
+ if (JSON.stringify(proof.publicInputBytesHex) !== JSON.stringify(record.publicInputBytesHex)) fail15("deposit_public_inputs_mismatch");
70510
+ record.proofBytesHex = proof.proofBytesHex;
70511
+ record.relation = DEPOSIT_RELATION.hidden;
70512
+ record.kind = "account";
70513
+ record.provedAgainFrom = "deposit-v1";
70514
+ store.writeWal(name, record);
70515
+ }
70470
70516
  function relayApproveTransaction({ owner, mint, decimals, amountAtomic, delegate, feePayer, blockhash, computeUnitPrice, closeAuthority }) {
70471
70517
  const source = getAssociatedTokenAddressSync(mint, owner.publicKey, false, TOKEN_PROGRAM_ID);
70472
70518
  const transaction = new import_web3117.Transaction({ feePayer, recentBlockhash: blockhash }).add(import_web3117.ComputeBudgetProgram.setComputeUnitLimit({ units: APPROVE_COMPUTE_UNITS }));
@@ -70489,6 +70535,10 @@ function depositKindFor(store) {
70489
70535
  async function readRelayConfig({ serviceUrl: serviceUrl2, fetchImpl, id }) {
70490
70536
  const response = await fetchImpl(serviceUrl(serviceUrl2, "/api/x402/deposit"), { headers: { accept: "application/json" } });
70491
70537
  if (response.status === 404) fail15("relay_not_offered");
70538
+ if (response.status === 503) {
70539
+ const body = await response.json().catch(() => void 0);
70540
+ if (body?.error === "deposit_relay_not_ready") fail15("relay_not_ready_retry_later");
70541
+ }
70492
70542
  if (response.status !== 200) fail15(`relay_status_${response.status}`);
70493
70543
  const config = await response.json().catch(() => fail15("relay_config_invalid"));
70494
70544
  if (config?.schema !== DEPOSIT_RELAY_CONFIG_SCHEMA || config.programId !== id.program.toBase58() || config.pool !== id.pool.toBase58() || config.mint !== id.mint.toBase58() || !/^(0|[1-9][0-9]{0,19})$/.test(String(config.computeUnitPriceMicroLamports)) || !/^[1-9][0-9]{0,19}$/.test(String(config.minimumAtomic))) {
@@ -70669,6 +70719,7 @@ async function submitRelayedDepositLeased({ store, connection, programId, proofT
70669
70719
  fail15("relay_deposit_landed_by_foreign_funder");
70670
70720
  };
70671
70721
  if (record.state === "foreign_funded") return foreignFunded();
70722
+ if (record.state === "proved") await proveAgainWithHiddenKey({ store, name, record, proofTools, deps });
70672
70723
  for (let round = 0; record.state === "proved" || record.state === "submitted"; round += 1) {
70673
70724
  if (round >= RELAY_ROUNDS) await refuse6("relay_not_settled_rerun_same_id", record.relay.result ? "relay_sent_confirmation_unread" : void 0);
70674
70725
  const settled = (promise) => {
@@ -70848,6 +70899,10 @@ async function submitRelayedDepositLeased({ store, connection, programId, proofT
70848
70899
  continue;
70849
70900
  }
70850
70901
  if (reason === "deposit_already_landed") continue;
70902
+ if (answer.body?.reason === "deposit_proof_key_retired" && record.relation !== DEPOSIT_RELATION.hidden) {
70903
+ await proveAgainWithHiddenKey({ store, name, record, proofTools, deps });
70904
+ continue;
70905
+ }
70851
70906
  await refuse6(`relay_refused_${reason}`);
70852
70907
  }
70853
70908
  if (answer.status === 409) await refuse6("relay_refused_deposit_replay_conflict");
@@ -71516,6 +71571,10 @@ var init_deposit = __esm({
71516
71571
  "deposit_pool_invalid",
71517
71572
  "deposit_pool_value_cap",
71518
71573
  "deposit_proof_invalid",
71574
+ // The old-key removal (PLAN AB279, the relay): a deposit-v1 record the relay cannot take as the same statement
71575
+ // with the hidden proof (an old buffer or signed F1b bytes hold the old proof), and a record whose reclaim started.
71576
+ "deposit_proof_key_retired",
71577
+ "deposit_reclaim_started",
71519
71578
  "deposit_settle_attempts_exhausted",
71520
71579
  "deposit_source_insufficient",
71521
71580
  "deposit_source_invalid",
@@ -72966,7 +73025,7 @@ function parseGenericHistory2(value2, executables, depth) {
72966
73025
  if (parsedForm && canonical3(value2) !== canonical3(result)) fail16("compatibility_not_reviewed");
72967
73026
  return result;
72968
73027
  }
72969
- var P03_PROGRAM_HISTORY_SCHEMA2, P03_PROGRAM_HISTORY_V2_SCHEMA2, P03_PROGRAM_HISTORY_V3_SCHEMA2, P03_PROGRAM_HISTORY_V4_SCHEMA2, P03_PROGRAM_HISTORY_V5_SCHEMA2, COMPRESSED_REPLAY_ELF_SHA2562, COMPRESSED_REPLAY_ELF_BYTES2, POLICY_ALLOCATION_BYTES2, COMPRESSED_REPLAY_EXTENSION_BYTES2, P03_PROGRAM_HISTORY_V6_SCHEMA2, E1_ELF_SHA2562, E1_ELF_BYTES2, E1_SUPERSEDED_ELF_SHA2562, E1_EXTENSION_BYTES2, P03_PROGRAM_HISTORY_V7_SCHEMA2, LOCKED_RETIRE_ELF_SHA2562, LOCKED_RETIRE_ELF_BYTES2, LOCKED_RETIRE_ALLOCATED_SHA2562, LOCKED_RETIRE_EXTENSION_BYTES2, LOCKED_RETIRE_ALLOCATION_BYTES2, P03_PROGRAM_HISTORY_V8_SCHEMA2, ANCHOR_RING_ELF_SHA2562, ANCHOR_RING_ELF_BYTES2, ANCHOR_RING_ALLOCATED_SHA2562, ANCHOR_RING_EXTENSION_BYTES2, SUCCESSION_ELF_SHA2562, SUCCESSION_ELF_BYTES2, SUCCESSION_ALLOCATED_SHA2562, SUCCESSION_EXTENSION_BYTES2, ANCHOR_RING_ALLOCATION_BYTES2, ANCHOR_RING_WIDE_ELF_SHA2562, ANCHOR_RING_WIDE_ELF_BYTES2, ANCHOR_RING_WIDE_ALLOCATED_SHA2562, ANCHOR_RING_WIDE_EXTENSION_BYTES2, SUCCESSION_ALLOCATION_BYTES2, LIGHT_REMOVAL_ELF_SHA2562, LIGHT_REMOVAL_ELF_BYTES2, LIGHT_REMOVAL_ALLOCATED_SHA2562, ANCHOR_RING_WIDE_ALLOCATION_BYTES2, DEPOSIT_TWO_KEYS_ELF_SHA2562, DEPOSIT_TWO_KEYS_ELF_BYTES2, DEPOSIT_TWO_KEYS_ALLOCATED_SHA2562, P03_COMPATIBLE_CODE2, fail16, DEPOSIT_INTENT_V12, DEPOSIT_RECORD_V22, COMPRESSED_REPLAY_REVIEWED2, E1_REVIEWED2, LOCKED_RETIRE_REVIEWED2, ANCHOR_RING_REVIEWED2, SUCCESSION_REVIEWED2, ANCHOR_RING_WIDE_REVIEWED2, LIGHT_REMOVAL_REVIEWED2, DEPOSIT_TWO_KEYS_REVIEWED2, P03_REVIEWED_EXECUTABLES2, ADDED_EXECUTABLES2, LATER_FLAGS2, EXECUTABLE_FLAGS2, EXECUTABLE_KEYS2, p03ReviewedExecutables2, keys2, hash5, slot2, keyBytes3, P03_PROGRAM_HISTORY_GENERIC_SCHEMA2, GENERIC_PRIOR_SCHEMAS2, GENERIC_MAX_STEPS2, GENERIC_MAX_DEPTH2, ORIGINAL_KEYS2, UPGRADE_KEYS2, EXTEND_KEYS2, canonical3, hasArea2, currentAllocation2, originalAllocation2;
73028
+ var P03_PROGRAM_HISTORY_SCHEMA2, P03_PROGRAM_HISTORY_V2_SCHEMA2, P03_PROGRAM_HISTORY_V3_SCHEMA2, P03_PROGRAM_HISTORY_V4_SCHEMA2, P03_PROGRAM_HISTORY_V5_SCHEMA2, COMPRESSED_REPLAY_ELF_SHA2562, COMPRESSED_REPLAY_ELF_BYTES2, POLICY_ALLOCATION_BYTES2, COMPRESSED_REPLAY_EXTENSION_BYTES2, P03_PROGRAM_HISTORY_V6_SCHEMA2, E1_ELF_SHA2562, E1_ELF_BYTES2, E1_SUPERSEDED_ELF_SHA2562, E1_EXTENSION_BYTES2, P03_PROGRAM_HISTORY_V7_SCHEMA2, LOCKED_RETIRE_ELF_SHA2562, LOCKED_RETIRE_ELF_BYTES2, LOCKED_RETIRE_ALLOCATED_SHA2562, LOCKED_RETIRE_EXTENSION_BYTES2, LOCKED_RETIRE_ALLOCATION_BYTES2, P03_PROGRAM_HISTORY_V8_SCHEMA2, ANCHOR_RING_ELF_SHA2562, ANCHOR_RING_ELF_BYTES2, ANCHOR_RING_ALLOCATED_SHA2562, ANCHOR_RING_EXTENSION_BYTES2, SUCCESSION_ELF_SHA2562, SUCCESSION_ELF_BYTES2, SUCCESSION_ALLOCATED_SHA2562, SUCCESSION_EXTENSION_BYTES2, ANCHOR_RING_ALLOCATION_BYTES2, ANCHOR_RING_WIDE_ELF_SHA2562, ANCHOR_RING_WIDE_ELF_BYTES2, ANCHOR_RING_WIDE_ALLOCATED_SHA2562, ANCHOR_RING_WIDE_EXTENSION_BYTES2, SUCCESSION_ALLOCATION_BYTES2, LIGHT_REMOVAL_ELF_SHA2562, LIGHT_REMOVAL_ELF_BYTES2, LIGHT_REMOVAL_ALLOCATED_SHA2562, ANCHOR_RING_WIDE_ALLOCATION_BYTES2, DEPOSIT_TWO_KEYS_ELF_SHA2562, DEPOSIT_TWO_KEYS_ELF_BYTES2, DEPOSIT_TWO_KEYS_ALLOCATED_SHA2562, DEPOSIT_ONE_KEY_ELF_SHA2562, DEPOSIT_ONE_KEY_ELF_BYTES2, DEPOSIT_ONE_KEY_ALLOCATED_SHA2562, P03_COMPATIBLE_CODE2, fail16, DEPOSIT_INTENT_V12, DEPOSIT_RECORD_V22, COMPRESSED_REPLAY_REVIEWED2, E1_REVIEWED2, LOCKED_RETIRE_REVIEWED2, ANCHOR_RING_REVIEWED2, SUCCESSION_REVIEWED2, ANCHOR_RING_WIDE_REVIEWED2, LIGHT_REMOVAL_REVIEWED2, DEPOSIT_TWO_KEYS_REVIEWED2, DEPOSIT_ONE_KEY_REVIEWED2, P03_REVIEWED_EXECUTABLES2, ADDED_EXECUTABLES2, LATER_FLAGS2, EXECUTABLE_FLAGS2, EXECUTABLE_KEYS2, p03ReviewedExecutables2, keys2, hash5, slot2, keyBytes3, P03_PROGRAM_HISTORY_GENERIC_SCHEMA2, GENERIC_PRIOR_SCHEMAS2, GENERIC_MAX_STEPS2, GENERIC_MAX_DEPTH2, ORIGINAL_KEYS2, UPGRADE_KEYS2, EXTEND_KEYS2, canonical3, hasArea2, currentAllocation2, originalAllocation2;
72970
73029
  var init_p03ProgramHistory2 = __esm({
72971
73030
  "src/shared/p03ProgramHistory.mjs"() {
72972
73031
  "use strict";
@@ -73069,6 +73128,16 @@ var init_p03ProgramHistory2 = __esm({
73069
73128
  throw new Error("p03_program_history_deposit_two_keys_allocation_invalid");
73070
73129
  }
73071
73130
  }
73131
+ DEPOSIT_ONE_KEY_ELF_SHA2562 = "e5045352cfa2f79ecf735850cf11b7b4b399f2eda66f97e8e8abd95e9d9b89dd";
73132
+ DEPOSIT_ONE_KEY_ELF_BYTES2 = 418288;
73133
+ DEPOSIT_ONE_KEY_ALLOCATED_SHA2562 = "b2d1d9824175190c5b285b4afba853144af828c4d9556eeee03de179863f34d6";
73134
+ {
73135
+ const set = [DEPOSIT_ONE_KEY_ELF_SHA2562, DEPOSIT_ONE_KEY_ELF_BYTES2, DEPOSIT_ONE_KEY_ALLOCATED_SHA2562].filter((value2) => value2 !== null).length;
73136
+ if (set !== 0 && set !== 3) throw new Error("p03_program_history_deposit_one_key_constants_partial");
73137
+ if (set === 3 && (ANCHOR_RING_WIDE_ALLOCATION_BYTES2 === null || !Number.isSafeInteger(DEPOSIT_ONE_KEY_ELF_BYTES2) || DEPOSIT_ONE_KEY_ELF_BYTES2 > ANCHOR_RING_WIDE_ALLOCATION_BYTES2 || DEPOSIT_ONE_KEY_ELF_BYTES2 === ANCHOR_RING_WIDE_ALLOCATION_BYTES2 !== (DEPOSIT_ONE_KEY_ALLOCATED_SHA2562 === DEPOSIT_ONE_KEY_ELF_SHA2562))) {
73138
+ throw new Error("p03_program_history_deposit_one_key_allocation_invalid");
73139
+ }
73140
+ }
73072
73141
  P03_COMPATIBLE_CODE2 = Object.freeze({
73073
73142
  previous: "0163c996cba100607cec17ec547f43ebdb4e6262cbfb3ccdf4ed91ecf8f76b88",
73074
73143
  next: "4e03cb77f13b5f5f611d5effe5fdf874be0c60cd1304c42410f33ac5e3d9e8ca",
@@ -73123,7 +73192,11 @@ var init_p03ProgramHistory2 = __esm({
73123
73192
  // Deposit upgrade, two deposit keys (no extend; the AB code area): null (fail closed) if the constants above are unset.
73124
73193
  depositTwoKeys: DEPOSIT_TWO_KEYS_ELF_SHA2562,
73125
73194
  depositTwoKeysBytes: DEPOSIT_TWO_KEYS_ELF_BYTES2,
73126
- depositTwoKeysAllocatedSha256: DEPOSIT_TWO_KEYS_ALLOCATED_SHA2562
73195
+ depositTwoKeysAllocatedSha256: DEPOSIT_TWO_KEYS_ALLOCATED_SHA2562,
73196
+ // The old deposit key removal, one deposit key (no extend; the AB code area): null (fail closed) if the constants above are unset.
73197
+ depositOneKey: DEPOSIT_ONE_KEY_ELF_SHA2562,
73198
+ depositOneKeyBytes: DEPOSIT_ONE_KEY_ELF_BYTES2,
73199
+ depositOneKeyAllocatedSha256: DEPOSIT_ONE_KEY_ALLOCATED_SHA2562
73127
73200
  });
73128
73201
  fail16 = (reason) => {
73129
73202
  throw new Error(`p03_program_history_${reason}`);
@@ -73138,6 +73211,7 @@ var init_p03ProgramHistory2 = __esm({
73138
73211
  ANCHOR_RING_WIDE_REVIEWED2 = SUCCESSION_REVIEWED2 && Number.isSafeInteger(SUCCESSION_ALLOCATION_BYTES2) && typeof P03_COMPATIBLE_CODE2.anchorRingWide === "string" && /^[0-9a-f]{64}$/.test(P03_COMPATIBLE_CODE2.anchorRingWide) && Number.isSafeInteger(P03_COMPATIBLE_CODE2.anchorRingWideBytes) && typeof P03_COMPATIBLE_CODE2.anchorRingWideAllocatedSha256 === "string" && /^[0-9a-f]{64}$/.test(P03_COMPATIBLE_CODE2.anchorRingWideAllocatedSha256) && Number.isSafeInteger(P03_COMPATIBLE_CODE2.anchorRingWideExtensionBytes);
73139
73212
  LIGHT_REMOVAL_REVIEWED2 = ANCHOR_RING_WIDE_REVIEWED2 && Number.isSafeInteger(ANCHOR_RING_WIDE_ALLOCATION_BYTES2) && typeof P03_COMPATIBLE_CODE2.lightRemoval === "string" && /^[0-9a-f]{64}$/.test(P03_COMPATIBLE_CODE2.lightRemoval) && Number.isSafeInteger(P03_COMPATIBLE_CODE2.lightRemovalBytes) && typeof P03_COMPATIBLE_CODE2.lightRemovalAllocatedSha256 === "string" && /^[0-9a-f]{64}$/.test(P03_COMPATIBLE_CODE2.lightRemovalAllocatedSha256);
73140
73213
  DEPOSIT_TWO_KEYS_REVIEWED2 = LIGHT_REMOVAL_REVIEWED2 && typeof P03_COMPATIBLE_CODE2.depositTwoKeys === "string" && /^[0-9a-f]{64}$/.test(P03_COMPATIBLE_CODE2.depositTwoKeys) && Number.isSafeInteger(P03_COMPATIBLE_CODE2.depositTwoKeysBytes) && typeof P03_COMPATIBLE_CODE2.depositTwoKeysAllocatedSha256 === "string" && /^[0-9a-f]{64}$/.test(P03_COMPATIBLE_CODE2.depositTwoKeysAllocatedSha256);
73214
+ DEPOSIT_ONE_KEY_REVIEWED2 = DEPOSIT_TWO_KEYS_REVIEWED2 && typeof P03_COMPATIBLE_CODE2.depositOneKey === "string" && /^[0-9a-f]{64}$/.test(P03_COMPATIBLE_CODE2.depositOneKey) && Number.isSafeInteger(P03_COMPATIBLE_CODE2.depositOneKeyBytes) && typeof P03_COMPATIBLE_CODE2.depositOneKeyAllocatedSha256 === "string" && /^[0-9a-f]{64}$/.test(P03_COMPATIBLE_CODE2.depositOneKeyAllocatedSha256);
73141
73215
  P03_REVIEWED_EXECUTABLES2 = Object.freeze([
73142
73216
  Object.freeze({ codeSha256: P03_COMPATIBLE_CODE2.previous, codeBytes: P03_COMPATIBLE_CODE2.previousBytes, initAccounts: 4, deposit: DEPOSIT_INTENT_V12, compressedReplay: false, indexedReplay: false }),
73143
73217
  Object.freeze({ codeSha256: P03_COMPATIBLE_CODE2.next, codeBytes: P03_COMPATIBLE_CODE2.nextBytes, initAccounts: 4, deposit: DEPOSIT_INTENT_V12, compressedReplay: false, indexedReplay: false }),
@@ -73260,6 +73334,23 @@ var init_p03ProgramHistory2 = __esm({
73260
73334
  allocationBytes: ANCHOR_RING_WIDE_ALLOCATION_BYTES2,
73261
73335
  allocatedSha256: P03_COMPATIBLE_CODE2.depositTwoKeysAllocatedSha256,
73262
73336
  upgradeFrom: Object.freeze([P03_COMPATIBLE_CODE2.lightRemoval])
73337
+ })] : [],
73338
+ // Generic-history target only: an upgrade with no extend, so the area is the AB area (the ELF plus 20,256 zero bytes).
73339
+ ...DEPOSIT_ONE_KEY_REVIEWED2 ? [Object.freeze({
73340
+ codeSha256: P03_COMPATIBLE_CODE2.depositOneKey,
73341
+ codeBytes: P03_COMPATIBLE_CODE2.depositOneKeyBytes,
73342
+ initAccounts: 6,
73343
+ indexedInitAccounts: 7,
73344
+ deposit: DEPOSIT_RECORD_V22,
73345
+ compressedReplay: true,
73346
+ indexedReplay: true,
73347
+ lockedPoolRetire: true,
73348
+ anchorRing: true,
73349
+ succession: true,
73350
+ anchorRingWide: true,
73351
+ allocationBytes: ANCHOR_RING_WIDE_ALLOCATION_BYTES2,
73352
+ allocatedSha256: P03_COMPATIBLE_CODE2.depositOneKeyAllocatedSha256,
73353
+ upgradeFrom: Object.freeze([P03_COMPATIBLE_CODE2.depositTwoKeys])
73263
73354
  })] : []
73264
73355
  ]);
73265
73356
  {
@@ -76261,8 +76352,8 @@ async function main(argv = process.argv.slice(2)) {
76261
76352
  " restore --pool <pubkey> --network <caip-2> --asset <mint> --recovery <init's recovery file>",
76262
76353
  " (a lost wallet from init's recovery text; then recover, deposit-scan, pocket scan)",
76263
76354
  " deposit --pool <pubkey> --program <id> --proof-tools <file> --deposit-id <id> --amount <atomic> [--rpc-file <file>]",
76264
- " (first run proves and records; back up; then add --submit --service <url>)",
76265
- " [--relay --service <url> [--one-time-index <n>]] USDC from a one-time address; the facilitator pays every fee",
76355
+ " --relay --service <url> [--one-time-index <n>] USDC from a one-time address; the facilitator pays every fee",
76356
+ " (a new deposit is relayed with the hidden deposit proof; --submit without --relay only finishes a record that exists)",
76266
76357
  " deposit-reclaim --pool <pubkey> --program <id> --deposit-id <id> --to <token account> (--service <url> | --fee-payer-key-file <file>) [--rpc-file <file>]",
76267
76358
  " (a relayed deposit that did not land: its USDC back out of the one-time address)",
76268
76359
  " deposit-scan --pool <pubkey> [--from <index>] [--count <n>] [--rpc-file <file>]",
@@ -76315,15 +76406,19 @@ async function runSelfCustodyDeposit(args) {
76315
76406
  const connection = connect(rpcUrl, "finalized");
76316
76407
  const common = { store, connection, programId, proofTools, depositId };
76317
76408
  if (!args.includes("--submit")) {
76409
+ if (!relay) {
76410
+ throw new Error("p03_deposit_relay_service_required: a new deposit needs --relay --service <url> (the facilitator relays it with the hidden deposit proof); without --relay, only --submit finishes a deposit record that already exists");
76411
+ }
76318
76412
  const denomination = resolveExitDenominationPolicy({
76319
76413
  pool: pool2,
76320
76414
  flagValue: readPoolDenominationFlag(args),
76321
76415
  envValue: process.env.SHIELDED_X402_P03_EXIT_DENOMINATIONS,
76322
76416
  allowOffDenomination: args.includes("--allow-off-denomination")
76323
76417
  });
76324
- const record = await (relay ? prepareRelayedDeposit : prepareDeposit)({
76418
+ const record = await prepareRelayedDeposit({
76325
76419
  ...common,
76326
- ...relay ? { serviceUrl: flag(args, "--service"), oneTimeIndex: indexFlag === void 0 ? void 0 : Number(indexFlag) } : {},
76420
+ serviceUrl: flag(args, "--service"),
76421
+ oneTimeIndex: indexFlag === void 0 ? void 0 : Number(indexFlag),
76327
76422
  amountAtomic: amount,
76328
76423
  checkAmount: ({ amount: requested, pool: state2, sourceAmount, vaultAmount, phase }) => {
76329
76424
  const resolved = resolveAgentDepositAmount({