shinjuku-shield 0.3.210 → 0.3.212
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 +164 -68
- package/shinjuku-wallet.mjs +625 -447
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.212. 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.212 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.212 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.212, 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": "2dd06d0d1f1482e159084ac58482cb1a9f1a7d605d73cc74b291678481650edd",
|
|
5
|
+
"bytes": 9664309,
|
|
6
|
+
"sourceCommit": "16f55e7cd4a6424ec469d297048d0613e81a8afe",
|
|
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": "
|
|
1044
|
-
"bytes":
|
|
1043
|
+
"sha256": "dacd62ea0f70f185497a7d6d4d9a65bca500a30152b1d4567fe46a351da4d0a2",
|
|
1044
|
+
"bytes": 4100977,
|
|
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-
|
|
1936
|
+
"publishedAt": "2026-11-11T10:24:03.084Z"
|
|
1937
1937
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinjuku-shield",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.212",
|
|
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": "2dd06d0d",
|
|
7
|
+
"shinjukuSha256": "2dd06d0d1f1482e159084ac58482cb1a9f1a7d605d73cc74b291678481650edd",
|
|
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
|
@@ -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",
|
|
@@ -44809,6 +44842,7 @@ var init_errorCodes = __esm({
|
|
|
44809
44842
|
"wallet_status",
|
|
44810
44843
|
// 2026-10-08 zero config review: the pinned proof-tool set, download limits, a private passphrase file, host-config conflicts, Tor.
|
|
44811
44844
|
"setup_proof_tools_pin_mismatch",
|
|
44845
|
+
"setup_proof_tools_not_v2",
|
|
44812
44846
|
"setup_proof_tools_unpinned",
|
|
44813
44847
|
"setup_proof_tools_trust_invalid",
|
|
44814
44848
|
"setup_download_too_large",
|
|
@@ -61844,7 +61878,6 @@ ${stamp}`;
|
|
|
61844
61878
|
OPTIONAL_TOOL_KEYS = /* @__PURE__ */ new Set(["depositProver", "depositHiddenProver", "solanaCli", "moveWitness", "moveProver"]);
|
|
61845
61879
|
STANDBY_TOOLS_MAX_AGE_MS = 10 * 6e4;
|
|
61846
61880
|
RELATION_PROVERS = Object.freeze({
|
|
61847
|
-
"deposit-v1": ["depositProver", "deposit-v1.json"],
|
|
61848
61881
|
// The prover's production artifact name (deposit_hidden_v1_spike.rs artifact_path).
|
|
61849
61882
|
"deposit-hidden-v1": ["depositHiddenProver", "deposit-hidden-v1.json"],
|
|
61850
61883
|
"tree-append-v1": ["treeAppendProver", "tree-append-v1-deposit.json"]
|
|
@@ -62167,7 +62200,7 @@ function buildDepositWitness({
|
|
|
62167
62200
|
poolDomain,
|
|
62168
62201
|
zeroLeaf,
|
|
62169
62202
|
amountAtomic,
|
|
62170
|
-
relation = DEPOSIT_RELATION.
|
|
62203
|
+
relation = DEPOSIT_RELATION.hidden,
|
|
62171
62204
|
kind = "account",
|
|
62172
62205
|
random = defaultRandom
|
|
62173
62206
|
}) {
|
|
@@ -62244,6 +62277,46 @@ function buildDepositWitness({
|
|
|
62244
62277
|
accountSlot: slot3
|
|
62245
62278
|
});
|
|
62246
62279
|
}
|
|
62280
|
+
function hiddenWitnessForDeposit({ seedHex, generator, zeroLeaf, publicInputBytesHex, memoBundleHex }) {
|
|
62281
|
+
if (!/^[0-9a-f]{64}$/.test(seedHex ?? "")) fail12("seed_invalid");
|
|
62282
|
+
if (!Array.isArray(publicInputBytesHex) || publicInputBytesHex.length !== 6) fail12("public_inputs_invalid");
|
|
62283
|
+
const inputs = publicInputBytesHex.map((value2) => BigInt(`0x${String(value2).replace(/^0x/, "")}`));
|
|
62284
|
+
const [poolDomain, amount, contextCommitment, outCommitment, memoHi, memoLo] = inputs;
|
|
62285
|
+
const bundle2 = Buffer.from(String(memoBundleHex ?? ""), "hex");
|
|
62286
|
+
if (bundle2.length !== MEMO_BUNDLE_BYTES3) fail12("bundle_length");
|
|
62287
|
+
const [hi, lo] = splitDigest2(Buffer.from(bundleDigest2(bundle2).replace(/^0x/, ""), "hex"));
|
|
62288
|
+
if (hi !== memoHi || lo !== memoLo) fail12("memo_digest_mismatch");
|
|
62289
|
+
const keys3 = deriveWalletKeys2({
|
|
62290
|
+
seedBytes: Uint8Array.from(Buffer.from(seedHex, "hex")),
|
|
62291
|
+
generator,
|
|
62292
|
+
resourceNonce: new Uint8Array(32),
|
|
62293
|
+
poolDomain
|
|
62294
|
+
});
|
|
62295
|
+
const { accepted } = trialDecryptBundle({
|
|
62296
|
+
bundleBytes: bundle2,
|
|
62297
|
+
eta: keys3.eta,
|
|
62298
|
+
poolDomain,
|
|
62299
|
+
outCommitment,
|
|
62300
|
+
contextCommitment,
|
|
62301
|
+
epoch: 0n,
|
|
62302
|
+
transitionKind: DEPOSIT_TRANSITION_KIND,
|
|
62303
|
+
zeroLeaf: BigInt(zeroLeaf),
|
|
62304
|
+
subtreeStartIndex: 0n
|
|
62305
|
+
});
|
|
62306
|
+
const found = accepted[0];
|
|
62307
|
+
if (accepted.length !== 1 || found.kind !== "account" || found.account.i !== 0n || found.account.b !== amount) fail12("self_recovery_failed");
|
|
62308
|
+
const text2 = (value2) => value2.toString();
|
|
62309
|
+
return Object.freeze({
|
|
62310
|
+
relation: DEPOSIT_RELATION.hidden,
|
|
62311
|
+
kind: "account",
|
|
62312
|
+
vector: { zeroLeaf: text2(BigInt(zeroLeaf)), depositHiddenV1: {
|
|
62313
|
+
kind: "account",
|
|
62314
|
+
publicInputs: inputs.map(text2),
|
|
62315
|
+
slot: found.slot,
|
|
62316
|
+
leaf: { d: text2(found.account.d), pDX: text2(found.account.pDX), t: "0", commitment: text2(found.commitment) }
|
|
62317
|
+
} }
|
|
62318
|
+
});
|
|
62319
|
+
}
|
|
62247
62320
|
var DEPOSIT_DOMAIN, DEPOSIT_TRANSITION_KIND, U64_MAX2, DEPOSIT_RELATION, NOTE_T_BYTES, defaultRandom;
|
|
62248
62321
|
var init_witness = __esm({
|
|
62249
62322
|
"wallet/src/deposit/witness.mjs"() {
|
|
@@ -69361,11 +69434,13 @@ It asks the amount, then gives a one-time address and its QR code: send USDC to
|
|
|
69361
69434
|
const selfPay = String(entry.record.url ?? "").startsWith(SELF_PAY_ORIGIN);
|
|
69362
69435
|
const joined = selfPay ? joinedAccountOf(entry, byName) : void 0;
|
|
69363
69436
|
const requestId = payerRequestIdOf(entry.record);
|
|
69437
|
+
const userSend = selfPay && joined === void 0 && !/\/unshield\/(pocket-|merge-)/.test(String(entry.record.url ?? ""));
|
|
69364
69438
|
const item = {
|
|
69365
69439
|
kind: joined !== void 0 ? "merge" : selfPay ? "unshield-self-payment" : "payment",
|
|
69366
69440
|
state: entry.state,
|
|
69367
69441
|
amountAtomic: paymentAmount(entry.record) ?? null,
|
|
69368
69442
|
...selfPay ? {} : { url: publicUrl(entry.record.url) },
|
|
69443
|
+
...userSend ? { userSend: true } : {},
|
|
69369
69444
|
...requestId === void 0 ? {} : { requestId }
|
|
69370
69445
|
};
|
|
69371
69446
|
if (joined !== void 0) {
|
|
@@ -69719,61 +69794,6 @@ async function currentAppend({ store, connection, id, proofTools, outCommitment,
|
|
|
69719
69794
|
publicInputBytesHex: proof.publicInputBytesHex
|
|
69720
69795
|
});
|
|
69721
69796
|
}
|
|
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
69797
|
function payload(record) {
|
|
69778
69798
|
const bytes2 = Buffer.concat([hex(record.proofBytesHex), ...record.publicInputBytesHex.map(hex)]);
|
|
69779
69799
|
if (bytes2.length !== PAYLOAD_LENGTH2.deposit) fail15("payload_length_invalid");
|
|
@@ -70153,6 +70173,13 @@ async function submitDeposit({ store, connection, programId, proofTools, deposit
|
|
|
70153
70173
|
store.writeWal(name, record);
|
|
70154
70174
|
continue;
|
|
70155
70175
|
}
|
|
70176
|
+
if (record.relation !== DEPOSIT_RELATION.hidden) {
|
|
70177
|
+
const buffer = await closeLeftoverBuffer({ connection, id, record, store, name, pause: pause2 });
|
|
70178
|
+
if (buffer.startsWith("pending_until_slot_")) fail15("buffer_near_expiry_retry_later");
|
|
70179
|
+
if (buffer === "close_not_finalized_retry_later") fail15("buffer_close_not_finalized_retry");
|
|
70180
|
+
if (buffer === "not_ours") fail15("buffer_foreign_or_changed");
|
|
70181
|
+
await proveAgainWithHiddenKey({ store, name, record, proofTools, deps });
|
|
70182
|
+
}
|
|
70156
70183
|
const pool2 = await poolState(connection, id);
|
|
70157
70184
|
await assertAdmission(connection, id, pool2, BigInt(record.amountAtomic));
|
|
70158
70185
|
await signSet({ connection, id, record, store, proofTools, source, deps });
|
|
@@ -70373,10 +70400,12 @@ async function prepareRelayedDepositLeased({
|
|
|
70373
70400
|
if (!inbound && record.amountAtomic !== amount.toString()) fail15("id_reused_with_different_amount");
|
|
70374
70401
|
return record;
|
|
70375
70402
|
}
|
|
70376
|
-
if (!proofTools.
|
|
70403
|
+
if (!proofTools.depositHiddenProver) fail15("proof_tools_missing_deposit_prover");
|
|
70377
70404
|
if (!serviceUrl2) fail15("relay_service_required");
|
|
70378
70405
|
const id = walletIdentity(store, programId);
|
|
70379
70406
|
const config = await readRelayConfig({ serviceUrl: serviceUrl2, fetchImpl: deps.fetchImpl ?? fetch, id });
|
|
70407
|
+
if (Array.isArray(config.depositRelations) && config.depositRelations.length === 0) fail15("relay_not_ready_retry_later");
|
|
70408
|
+
if (!config.depositRelations?.includes(DEPOSIT_RELATION.hidden)) fail15("relay_not_offered");
|
|
70380
70409
|
let inboundSource;
|
|
70381
70410
|
let inboundHeld;
|
|
70382
70411
|
if (inbound) {
|
|
@@ -70437,8 +70466,8 @@ async function prepareRelayedDepositLeased({
|
|
|
70437
70466
|
}
|
|
70438
70467
|
if (closing && sourceAmount !== amount) fail15("relay_closing_source_not_whole_balance");
|
|
70439
70468
|
checkAmount?.({ amount, pool: pool2, sourceAmount, vaultAmount });
|
|
70440
|
-
const relation =
|
|
70441
|
-
const kind =
|
|
70469
|
+
const relation = DEPOSIT_RELATION.hidden;
|
|
70470
|
+
const kind = depositKindFor(store);
|
|
70442
70471
|
const witness = (deps.buildWitness ?? buildDepositWitness)({
|
|
70443
70472
|
seedHex: store.state.seedHex,
|
|
70444
70473
|
generator: pinnedGenerator2(),
|
|
@@ -70467,6 +70496,24 @@ async function prepareRelayedDepositLeased({
|
|
|
70467
70496
|
store.writeWal(name, record);
|
|
70468
70497
|
return record;
|
|
70469
70498
|
}
|
|
70499
|
+
async function proveAgainWithHiddenKey({ store, name, record, proofTools, deps = {} }) {
|
|
70500
|
+
if (record.relation === DEPOSIT_RELATION.hidden) return;
|
|
70501
|
+
if (!proofTools?.depositHiddenProver) fail15("proof_tools_missing_deposit_prover");
|
|
70502
|
+
const witness = hiddenWitnessForDeposit({
|
|
70503
|
+
seedHex: store.state.seedHex,
|
|
70504
|
+
generator: pinnedGenerator2(),
|
|
70505
|
+
zeroLeaf: P03_PINNED_ZERO_LEAF,
|
|
70506
|
+
publicInputBytesHex: record.publicInputBytesHex,
|
|
70507
|
+
memoBundleHex: record.memoBundleHex
|
|
70508
|
+
});
|
|
70509
|
+
const proof = await (deps.prove ?? proveP03Vector)({ tools: proofTools, relation: DEPOSIT_RELATION.hidden, vector: witness.vector });
|
|
70510
|
+
if (JSON.stringify(proof.publicInputBytesHex) !== JSON.stringify(record.publicInputBytesHex)) fail15("deposit_public_inputs_mismatch");
|
|
70511
|
+
record.proofBytesHex = proof.proofBytesHex;
|
|
70512
|
+
record.relation = DEPOSIT_RELATION.hidden;
|
|
70513
|
+
record.kind = "account";
|
|
70514
|
+
record.provedAgainFrom = "deposit-v1";
|
|
70515
|
+
store.writeWal(name, record);
|
|
70516
|
+
}
|
|
70470
70517
|
function relayApproveTransaction({ owner, mint, decimals, amountAtomic, delegate, feePayer, blockhash, computeUnitPrice, closeAuthority }) {
|
|
70471
70518
|
const source = getAssociatedTokenAddressSync(mint, owner.publicKey, false, TOKEN_PROGRAM_ID);
|
|
70472
70519
|
const transaction = new import_web3117.Transaction({ feePayer, recentBlockhash: blockhash }).add(import_web3117.ComputeBudgetProgram.setComputeUnitLimit({ units: APPROVE_COMPUTE_UNITS }));
|
|
@@ -70489,6 +70536,10 @@ function depositKindFor(store) {
|
|
|
70489
70536
|
async function readRelayConfig({ serviceUrl: serviceUrl2, fetchImpl, id }) {
|
|
70490
70537
|
const response = await fetchImpl(serviceUrl(serviceUrl2, "/api/x402/deposit"), { headers: { accept: "application/json" } });
|
|
70491
70538
|
if (response.status === 404) fail15("relay_not_offered");
|
|
70539
|
+
if (response.status === 503) {
|
|
70540
|
+
const body = await response.json().catch(() => void 0);
|
|
70541
|
+
if (body?.error === "deposit_relay_not_ready") fail15("relay_not_ready_retry_later");
|
|
70542
|
+
}
|
|
70492
70543
|
if (response.status !== 200) fail15(`relay_status_${response.status}`);
|
|
70493
70544
|
const config = await response.json().catch(() => fail15("relay_config_invalid"));
|
|
70494
70545
|
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 +70720,7 @@ async function submitRelayedDepositLeased({ store, connection, programId, proofT
|
|
|
70669
70720
|
fail15("relay_deposit_landed_by_foreign_funder");
|
|
70670
70721
|
};
|
|
70671
70722
|
if (record.state === "foreign_funded") return foreignFunded();
|
|
70723
|
+
if (record.state === "proved") await proveAgainWithHiddenKey({ store, name, record, proofTools, deps });
|
|
70672
70724
|
for (let round = 0; record.state === "proved" || record.state === "submitted"; round += 1) {
|
|
70673
70725
|
if (round >= RELAY_ROUNDS) await refuse6("relay_not_settled_rerun_same_id", record.relay.result ? "relay_sent_confirmation_unread" : void 0);
|
|
70674
70726
|
const settled = (promise) => {
|
|
@@ -70848,6 +70900,10 @@ async function submitRelayedDepositLeased({ store, connection, programId, proofT
|
|
|
70848
70900
|
continue;
|
|
70849
70901
|
}
|
|
70850
70902
|
if (reason === "deposit_already_landed") continue;
|
|
70903
|
+
if (answer.body?.reason === "deposit_proof_key_retired" && record.relation !== DEPOSIT_RELATION.hidden) {
|
|
70904
|
+
await proveAgainWithHiddenKey({ store, name, record, proofTools, deps });
|
|
70905
|
+
continue;
|
|
70906
|
+
}
|
|
70851
70907
|
await refuse6(`relay_refused_${reason}`);
|
|
70852
70908
|
}
|
|
70853
70909
|
if (answer.status === 409) await refuse6("relay_refused_deposit_replay_conflict");
|
|
@@ -71516,6 +71572,10 @@ var init_deposit = __esm({
|
|
|
71516
71572
|
"deposit_pool_invalid",
|
|
71517
71573
|
"deposit_pool_value_cap",
|
|
71518
71574
|
"deposit_proof_invalid",
|
|
71575
|
+
// The old-key removal (PLAN AB279, the relay): a deposit-v1 record the relay cannot take as the same statement
|
|
71576
|
+
// with the hidden proof (an old buffer or signed F1b bytes hold the old proof), and a record whose reclaim started.
|
|
71577
|
+
"deposit_proof_key_retired",
|
|
71578
|
+
"deposit_reclaim_started",
|
|
71519
71579
|
"deposit_settle_attempts_exhausted",
|
|
71520
71580
|
"deposit_source_insufficient",
|
|
71521
71581
|
"deposit_source_invalid",
|
|
@@ -72966,7 +73026,7 @@ function parseGenericHistory2(value2, executables, depth) {
|
|
|
72966
73026
|
if (parsedForm && canonical3(value2) !== canonical3(result)) fail16("compatibility_not_reviewed");
|
|
72967
73027
|
return result;
|
|
72968
73028
|
}
|
|
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;
|
|
73029
|
+
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
73030
|
var init_p03ProgramHistory2 = __esm({
|
|
72971
73031
|
"src/shared/p03ProgramHistory.mjs"() {
|
|
72972
73032
|
"use strict";
|
|
@@ -73069,6 +73129,16 @@ var init_p03ProgramHistory2 = __esm({
|
|
|
73069
73129
|
throw new Error("p03_program_history_deposit_two_keys_allocation_invalid");
|
|
73070
73130
|
}
|
|
73071
73131
|
}
|
|
73132
|
+
DEPOSIT_ONE_KEY_ELF_SHA2562 = "e5045352cfa2f79ecf735850cf11b7b4b399f2eda66f97e8e8abd95e9d9b89dd";
|
|
73133
|
+
DEPOSIT_ONE_KEY_ELF_BYTES2 = 418288;
|
|
73134
|
+
DEPOSIT_ONE_KEY_ALLOCATED_SHA2562 = "b2d1d9824175190c5b285b4afba853144af828c4d9556eeee03de179863f34d6";
|
|
73135
|
+
{
|
|
73136
|
+
const set = [DEPOSIT_ONE_KEY_ELF_SHA2562, DEPOSIT_ONE_KEY_ELF_BYTES2, DEPOSIT_ONE_KEY_ALLOCATED_SHA2562].filter((value2) => value2 !== null).length;
|
|
73137
|
+
if (set !== 0 && set !== 3) throw new Error("p03_program_history_deposit_one_key_constants_partial");
|
|
73138
|
+
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))) {
|
|
73139
|
+
throw new Error("p03_program_history_deposit_one_key_allocation_invalid");
|
|
73140
|
+
}
|
|
73141
|
+
}
|
|
73072
73142
|
P03_COMPATIBLE_CODE2 = Object.freeze({
|
|
73073
73143
|
previous: "0163c996cba100607cec17ec547f43ebdb4e6262cbfb3ccdf4ed91ecf8f76b88",
|
|
73074
73144
|
next: "4e03cb77f13b5f5f611d5effe5fdf874be0c60cd1304c42410f33ac5e3d9e8ca",
|
|
@@ -73123,7 +73193,11 @@ var init_p03ProgramHistory2 = __esm({
|
|
|
73123
73193
|
// Deposit upgrade, two deposit keys (no extend; the AB code area): null (fail closed) if the constants above are unset.
|
|
73124
73194
|
depositTwoKeys: DEPOSIT_TWO_KEYS_ELF_SHA2562,
|
|
73125
73195
|
depositTwoKeysBytes: DEPOSIT_TWO_KEYS_ELF_BYTES2,
|
|
73126
|
-
depositTwoKeysAllocatedSha256: DEPOSIT_TWO_KEYS_ALLOCATED_SHA2562
|
|
73196
|
+
depositTwoKeysAllocatedSha256: DEPOSIT_TWO_KEYS_ALLOCATED_SHA2562,
|
|
73197
|
+
// The old deposit key removal, one deposit key (no extend; the AB code area): null (fail closed) if the constants above are unset.
|
|
73198
|
+
depositOneKey: DEPOSIT_ONE_KEY_ELF_SHA2562,
|
|
73199
|
+
depositOneKeyBytes: DEPOSIT_ONE_KEY_ELF_BYTES2,
|
|
73200
|
+
depositOneKeyAllocatedSha256: DEPOSIT_ONE_KEY_ALLOCATED_SHA2562
|
|
73127
73201
|
});
|
|
73128
73202
|
fail16 = (reason) => {
|
|
73129
73203
|
throw new Error(`p03_program_history_${reason}`);
|
|
@@ -73138,6 +73212,7 @@ var init_p03ProgramHistory2 = __esm({
|
|
|
73138
73212
|
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
73213
|
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
73214
|
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);
|
|
73215
|
+
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
73216
|
P03_REVIEWED_EXECUTABLES2 = Object.freeze([
|
|
73142
73217
|
Object.freeze({ codeSha256: P03_COMPATIBLE_CODE2.previous, codeBytes: P03_COMPATIBLE_CODE2.previousBytes, initAccounts: 4, deposit: DEPOSIT_INTENT_V12, compressedReplay: false, indexedReplay: false }),
|
|
73143
73218
|
Object.freeze({ codeSha256: P03_COMPATIBLE_CODE2.next, codeBytes: P03_COMPATIBLE_CODE2.nextBytes, initAccounts: 4, deposit: DEPOSIT_INTENT_V12, compressedReplay: false, indexedReplay: false }),
|
|
@@ -73260,6 +73335,23 @@ var init_p03ProgramHistory2 = __esm({
|
|
|
73260
73335
|
allocationBytes: ANCHOR_RING_WIDE_ALLOCATION_BYTES2,
|
|
73261
73336
|
allocatedSha256: P03_COMPATIBLE_CODE2.depositTwoKeysAllocatedSha256,
|
|
73262
73337
|
upgradeFrom: Object.freeze([P03_COMPATIBLE_CODE2.lightRemoval])
|
|
73338
|
+
})] : [],
|
|
73339
|
+
// Generic-history target only: an upgrade with no extend, so the area is the AB area (the ELF plus 20,256 zero bytes).
|
|
73340
|
+
...DEPOSIT_ONE_KEY_REVIEWED2 ? [Object.freeze({
|
|
73341
|
+
codeSha256: P03_COMPATIBLE_CODE2.depositOneKey,
|
|
73342
|
+
codeBytes: P03_COMPATIBLE_CODE2.depositOneKeyBytes,
|
|
73343
|
+
initAccounts: 6,
|
|
73344
|
+
indexedInitAccounts: 7,
|
|
73345
|
+
deposit: DEPOSIT_RECORD_V22,
|
|
73346
|
+
compressedReplay: true,
|
|
73347
|
+
indexedReplay: true,
|
|
73348
|
+
lockedPoolRetire: true,
|
|
73349
|
+
anchorRing: true,
|
|
73350
|
+
succession: true,
|
|
73351
|
+
anchorRingWide: true,
|
|
73352
|
+
allocationBytes: ANCHOR_RING_WIDE_ALLOCATION_BYTES2,
|
|
73353
|
+
allocatedSha256: P03_COMPATIBLE_CODE2.depositOneKeyAllocatedSha256,
|
|
73354
|
+
upgradeFrom: Object.freeze([P03_COMPATIBLE_CODE2.depositTwoKeys])
|
|
73263
73355
|
})] : []
|
|
73264
73356
|
]);
|
|
73265
73357
|
{
|
|
@@ -76261,8 +76353,8 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
76261
76353
|
" restore --pool <pubkey> --network <caip-2> --asset <mint> --recovery <init's recovery file>",
|
|
76262
76354
|
" (a lost wallet from init's recovery text; then recover, deposit-scan, pocket scan)",
|
|
76263
76355
|
" deposit --pool <pubkey> --program <id> --proof-tools <file> --deposit-id <id> --amount <atomic> [--rpc-file <file>]",
|
|
76264
|
-
"
|
|
76265
|
-
"
|
|
76356
|
+
" --relay --service <url> [--one-time-index <n>] USDC from a one-time address; the facilitator pays every fee",
|
|
76357
|
+
" (a new deposit is relayed with the hidden deposit proof; --submit without --relay only finishes a record that exists)",
|
|
76266
76358
|
" deposit-reclaim --pool <pubkey> --program <id> --deposit-id <id> --to <token account> (--service <url> | --fee-payer-key-file <file>) [--rpc-file <file>]",
|
|
76267
76359
|
" (a relayed deposit that did not land: its USDC back out of the one-time address)",
|
|
76268
76360
|
" deposit-scan --pool <pubkey> [--from <index>] [--count <n>] [--rpc-file <file>]",
|
|
@@ -76315,15 +76407,19 @@ async function runSelfCustodyDeposit(args) {
|
|
|
76315
76407
|
const connection = connect(rpcUrl, "finalized");
|
|
76316
76408
|
const common = { store, connection, programId, proofTools, depositId };
|
|
76317
76409
|
if (!args.includes("--submit")) {
|
|
76410
|
+
if (!relay) {
|
|
76411
|
+
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");
|
|
76412
|
+
}
|
|
76318
76413
|
const denomination = resolveExitDenominationPolicy({
|
|
76319
76414
|
pool: pool2,
|
|
76320
76415
|
flagValue: readPoolDenominationFlag(args),
|
|
76321
76416
|
envValue: process.env.SHIELDED_X402_P03_EXIT_DENOMINATIONS,
|
|
76322
76417
|
allowOffDenomination: args.includes("--allow-off-denomination")
|
|
76323
76418
|
});
|
|
76324
|
-
const record = await
|
|
76419
|
+
const record = await prepareRelayedDeposit({
|
|
76325
76420
|
...common,
|
|
76326
|
-
|
|
76421
|
+
serviceUrl: flag(args, "--service"),
|
|
76422
|
+
oneTimeIndex: indexFlag === void 0 ? void 0 : Number(indexFlag),
|
|
76327
76423
|
amountAtomic: amount,
|
|
76328
76424
|
checkAmount: ({ amount: requested, pool: state2, sourceAmount, vaultAmount, phase }) => {
|
|
76329
76425
|
const resolved = resolveAgentDepositAmount({
|