shinjuku-shielded 0.3.36 → 0.3.37
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 +3 -3
- package/package.json +3 -3
- package/shinjuku-wallet.mjs +50 -13
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": "1335e815f99108526e1a9d4e93f53a94d95910ea150e404987f09826c39fc547",
|
|
5
|
+
"bytes": 11195840,
|
|
6
|
+
"sourceCommit": "c27f02e8ca3ec7ba4862c1292aad35ed9d766934",
|
|
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.
|
|
3
|
+
"version": "0.3.37",
|
|
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": "
|
|
7
|
-
"shinjukuSha256": "
|
|
6
|
+
"shinjukuRelease": "1335e815",
|
|
7
|
+
"shinjukuSha256": "1335e815f99108526e1a9d4e93f53a94d95910ea150e404987f09826c39fc547",
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
9
9
|
"author": "Shinjuku Shielded",
|
|
10
10
|
"homepage": "https://github.com/ShinjukuStaition/shinjuku-mcp#readme",
|
package/shinjuku-wallet.mjs
CHANGED
|
@@ -52762,6 +52762,7 @@ async function readFinalizedPoolForRefresh(connection, program, pool2) {
|
|
|
52762
52762
|
{ commitment: "finalized", dataSlice: { offset: 0, length: REFRESH_READ_BYTES } }
|
|
52763
52763
|
));
|
|
52764
52764
|
if (!Array.isArray(both?.value) || both.value.length !== 2) throw new Error("p03_history_e1_tree_read_invalid");
|
|
52765
|
+
if (both.value[0]?.data && Buffer.from(both.value[0].data).length >= REFRESH_READ_BYTES) return readFinalizedPool(connection, program, pool2);
|
|
52765
52766
|
const snapshot = parseFinalizedPool({ context: both.context, value: both.value[0] }, program);
|
|
52766
52767
|
if (snapshot.replayStore !== REPLAY_STORE_INDEXED) return snapshot;
|
|
52767
52768
|
const treeAccount = both.value[1];
|
|
@@ -53320,20 +53321,26 @@ async function retryTransientRpc(operation, {
|
|
|
53320
53321
|
attempts = TRANSIENT_RPC_ATTEMPTS,
|
|
53321
53322
|
baseDelayMs = TRANSIENT_RPC_BASE_DELAY_MS
|
|
53322
53323
|
} = {}) {
|
|
53323
|
-
|
|
53324
|
-
|
|
53324
|
+
const budgetMs = baseDelayMs * (2 ** Math.max(0, attempts - 1) - 1);
|
|
53325
|
+
let waitedMs = 0;
|
|
53326
|
+
let transportRetries = 0;
|
|
53327
|
+
let laggingRetries = 0;
|
|
53328
|
+
for (; ; ) {
|
|
53325
53329
|
try {
|
|
53326
53330
|
return await operation();
|
|
53327
53331
|
} catch (error) {
|
|
53328
53332
|
if (!isTransientRpcError(error)) throw error;
|
|
53329
|
-
|
|
53333
|
+
if (error?.code === -32016 && historyRpcFailed(error)) throw error;
|
|
53330
53334
|
markPhase(`rpc-retry-${transientCause(error)}`);
|
|
53331
|
-
|
|
53332
|
-
|
|
53333
|
-
|
|
53335
|
+
const lagging = error instanceof import_web396.SolanaJSONRPCError && LAGGING_NODE_RPC_CODES.has(error.code);
|
|
53336
|
+
const delayMs = lagging ? baseDelayMs * LAGGING_NODE_STEP_OF_BASE : baseDelayMs * 2 ** transportRetries;
|
|
53337
|
+
if (waitedMs + delayMs > budgetMs || lagging && laggingRetries >= LAGGING_NODE_MAX_RETRIES) throw error;
|
|
53338
|
+
if (lagging) laggingRetries += 1;
|
|
53339
|
+
else transportRetries += 1;
|
|
53340
|
+
waitedMs += delayMs;
|
|
53341
|
+
await new Promise((resolve38) => setTimeout(resolve38, delayMs));
|
|
53334
53342
|
}
|
|
53335
53343
|
}
|
|
53336
|
-
throw lastError;
|
|
53337
53344
|
}
|
|
53338
53345
|
function reuseRefusalCause(error) {
|
|
53339
53346
|
const message = String(error?.message ?? error);
|
|
@@ -54279,7 +54286,7 @@ function base58Decode(value) {
|
|
|
54279
54286
|
while (zeros < value.length && value[zeros] === "1") zeros += 1;
|
|
54280
54287
|
return Uint8Array.from(Buffer.concat([Buffer.alloc(zeros), body]));
|
|
54281
54288
|
}
|
|
54282
|
-
var import_web396, REPLAY_STORE_INDEXED, CLOSE_REPLAY_TREE_TAG, EXTEND_ANCHOR_RING_TAG, LINK_SUCCESSOR_TAG, IMPORT_REPLAY_LEAVES_TAG, SETTLE_MOVE_TAG, SWEEP_PREDECESSOR_VAULT_TAG, RELINK_SUCCESSOR_TAG, ROTATE_PAYMENT_SETTLER_TAG, IMPORT_A_LEAF_BYTES, IMPORT_MEMBERSHIP_BYTES, IMPORT_PRESENT_SHIFT, IMPORT_MAX_ENTRIES, MOVE_HEAD_BYTES, MOVE_INSERTED_VALUES, DEFAULT_KEY, FIELD_BYTES2, PRIMARY_PROOF_BYTES, SUBTREE_LEAVES, PAGE_SIZE, FIELD_MODULUS3, BPF_LOADER_UPGRADEABLE_PROGRAM_ID, SYSTEM_PROGRAM, TEST_EXECUTABLES, reviewedExecutables, isProgramDataIdentityError, ASSUMED_ORIGINAL_EXECUTABLE, AUTHENTICATED_HISTORY_REPORTS, HISTORY_ATTESTATIONS, hasExecutableEvidence, P03_FINALIZED_HISTORY_SOURCE_MODEL, P03_PROGRAMDATA_COVERAGE_SOURCE_MODEL, P03_RUN_RECOVER_UNAVAILABLE_FROM_CHAIN, PROFILES, P03_SETTLEMENT_TAGS, P03_INLINE_SETTLEMENT_TAGS, P03_PAYMENT_REPLAY_INDICES, NO_CONTEXTS, REFRESH_READ_BYTES, E1_TREE_HEADER_BYTES, HISTORY_FETCH_CONCURRENCY, HISTORY_BULK_TRANSACTIONS, HISTORY_BULK_ADDRESSES, TRANSIENT_RPC_ATTEMPTS, TRANSIENT_RPC_BASE_DELAY_MS, LAGGING_NODE_RPC_CODES;
|
|
54289
|
+
var import_web396, REPLAY_STORE_INDEXED, CLOSE_REPLAY_TREE_TAG, EXTEND_ANCHOR_RING_TAG, LINK_SUCCESSOR_TAG, IMPORT_REPLAY_LEAVES_TAG, SETTLE_MOVE_TAG, SWEEP_PREDECESSOR_VAULT_TAG, RELINK_SUCCESSOR_TAG, ROTATE_PAYMENT_SETTLER_TAG, IMPORT_A_LEAF_BYTES, IMPORT_MEMBERSHIP_BYTES, IMPORT_PRESENT_SHIFT, IMPORT_MAX_ENTRIES, MOVE_HEAD_BYTES, MOVE_INSERTED_VALUES, DEFAULT_KEY, FIELD_BYTES2, PRIMARY_PROOF_BYTES, SUBTREE_LEAVES, PAGE_SIZE, FIELD_MODULUS3, BPF_LOADER_UPGRADEABLE_PROGRAM_ID, SYSTEM_PROGRAM, TEST_EXECUTABLES, reviewedExecutables, isProgramDataIdentityError, ASSUMED_ORIGINAL_EXECUTABLE, AUTHENTICATED_HISTORY_REPORTS, HISTORY_ATTESTATIONS, hasExecutableEvidence, P03_FINALIZED_HISTORY_SOURCE_MODEL, P03_PROGRAMDATA_COVERAGE_SOURCE_MODEL, P03_RUN_RECOVER_UNAVAILABLE_FROM_CHAIN, PROFILES, P03_SETTLEMENT_TAGS, P03_INLINE_SETTLEMENT_TAGS, P03_PAYMENT_REPLAY_INDICES, NO_CONTEXTS, REFRESH_READ_BYTES, E1_TREE_HEADER_BYTES, HISTORY_FETCH_CONCURRENCY, HISTORY_BULK_TRANSACTIONS, HISTORY_BULK_ADDRESSES, TRANSIENT_RPC_ATTEMPTS, TRANSIENT_RPC_BASE_DELAY_MS, LAGGING_NODE_STEP_OF_BASE, LAGGING_NODE_MAX_RETRIES, LAGGING_NODE_RPC_CODES;
|
|
54283
54290
|
var init_walk = __esm({
|
|
54284
54291
|
"wallet/src/history/walk.mjs"() {
|
|
54285
54292
|
"use strict";
|
|
@@ -54515,13 +54522,15 @@ var init_walk = __esm({
|
|
|
54515
54522
|
P03_INLINE_SETTLEMENT_TAGS = Object.freeze([24, 25, 26, 32]);
|
|
54516
54523
|
P03_PAYMENT_REPLAY_INDICES = PROFILES[4].replayIndices;
|
|
54517
54524
|
NO_CONTEXTS = Object.freeze([]);
|
|
54518
|
-
REFRESH_READ_BYTES =
|
|
54525
|
+
REFRESH_READ_BYTES = 4096;
|
|
54519
54526
|
E1_TREE_HEADER_BYTES = 80;
|
|
54520
54527
|
HISTORY_FETCH_CONCURRENCY = 4;
|
|
54521
54528
|
HISTORY_BULK_TRANSACTIONS = 256;
|
|
54522
54529
|
HISTORY_BULK_ADDRESSES = 256;
|
|
54523
54530
|
TRANSIENT_RPC_ATTEMPTS = 6;
|
|
54524
54531
|
TRANSIENT_RPC_BASE_DELAY_MS = 250;
|
|
54532
|
+
LAGGING_NODE_STEP_OF_BASE = 1.6;
|
|
54533
|
+
LAGGING_NODE_MAX_RETRIES = 10;
|
|
54525
54534
|
LAGGING_NODE_RPC_CODES = /* @__PURE__ */ new Set([-32004, -32016]);
|
|
54526
54535
|
}
|
|
54527
54536
|
});
|
|
@@ -56453,8 +56462,15 @@ async function loadWalletP03HistoryNow({ store, connection: given, programId, po
|
|
|
56453
56462
|
let movedIndex;
|
|
56454
56463
|
if (earlier !== void 0) {
|
|
56455
56464
|
markPhase("refresh-start");
|
|
56465
|
+
const refreshing = refreshFinalizedP03HistorySnapshot({ connection, programId, pool: pool2, history: earlier });
|
|
56466
|
+
if (typeof onCompactList === "function" && Array.isArray(earlier.contexts)) {
|
|
56467
|
+
try {
|
|
56468
|
+
onCompactList(earlier.contexts);
|
|
56469
|
+
} catch {
|
|
56470
|
+
}
|
|
56471
|
+
}
|
|
56456
56472
|
try {
|
|
56457
|
-
const refreshed = await
|
|
56473
|
+
const refreshed = await refreshing;
|
|
56458
56474
|
markPhase("walk-refreshed");
|
|
56459
56475
|
rememberRunReport(runKey, refreshed);
|
|
56460
56476
|
writeStderr("history: the pool made no transition since this run's last walk; that history was moved to the current pool account (your own RPC read the pool account and the program's deployment account; the history source answered one signature read)\n");
|
|
@@ -60447,7 +60463,9 @@ async function syncedOutputs({ store, finalizedHistory: finalizedHistory2, diges
|
|
|
60447
60463
|
if (!serviceUrl2) {
|
|
60448
60464
|
throw new Error(`p03_memo_service_required: ${pending.length} transitions this wallet has not read come from the memo service; rerun with --service <facilitator URL>`);
|
|
60449
60465
|
}
|
|
60450
|
-
|
|
60466
|
+
if (!fresh) store.listWal();
|
|
60467
|
+
let wal;
|
|
60468
|
+
const walFor = () => wal ??= fresh ? /* @__PURE__ */ new Map() : walMemoBundles(store);
|
|
60451
60469
|
const reader = deps.memoReader ?? createMemoReader(serviceUrl2, { fetchImpl: deps.fetchImpl ?? fetch, ...deps.pause ? { pause: deps.pause } : {} });
|
|
60452
60470
|
(deps.notice ?? ((text3) => process.stderr.write(text3)))(
|
|
60453
60471
|
`reading ${pending.length} memos from the memo service, ${Math.ceil(pending.length / MEMO_BATCH_MAX)} request(s)
|
|
@@ -60467,7 +60485,7 @@ async function syncedOutputs({ store, finalizedHistory: finalizedHistory2, diges
|
|
|
60467
60485
|
for (const context of chunk) {
|
|
60468
60486
|
const digest2 = hexOf2(context.memoDigest);
|
|
60469
60487
|
const fromService = served.get(digest2);
|
|
60470
|
-
const bytes2 = fromService ??
|
|
60488
|
+
const bytes2 = fromService ?? walFor().get(digest2);
|
|
60471
60489
|
if (!bytes2) {
|
|
60472
60490
|
absent2 += 1;
|
|
60473
60491
|
continue;
|
|
@@ -72071,13 +72089,31 @@ function exitReservedNoteCommitments(store) {
|
|
|
72071
72089
|
const selfPay2 = name.startsWith("self-pay-");
|
|
72072
72090
|
if (!selfPay2 && !name.startsWith("note-exit-")) continue;
|
|
72073
72091
|
if (name.startsWith("self-pay-merge-")) continue;
|
|
72092
|
+
const settledKey = selfPay2 ? void 0 : settledNoteExitKey(store, name);
|
|
72093
|
+
const before = settledKey === void 0 ? void 0 : walFileValidator(store, name);
|
|
72094
|
+
if (before !== void 0 && settledNoteExits.get(settledKey) === before) continue;
|
|
72074
72095
|
const record = store.readWal(name);
|
|
72096
|
+
if (before !== void 0) {
|
|
72097
|
+
if (record?.state === "settled" && walFileValidator(store, name) === before) settledNoteExits.set(settledKey, before);
|
|
72098
|
+
else settledNoteExits.delete(settledKey);
|
|
72099
|
+
}
|
|
72075
72100
|
const pending = selfPay2 ? record?.state === "paid" : ["selected", "proved", "confirmed"].includes(record?.state);
|
|
72076
72101
|
if (!pending || typeof record?.noteCommitment !== "string" || !/^[0-9]{1,90}$/.test(record.noteCommitment)) continue;
|
|
72077
72102
|
reserved.add(BigInt(record.noteCommitment).toString());
|
|
72078
72103
|
}
|
|
72079
72104
|
return reserved;
|
|
72080
72105
|
}
|
|
72106
|
+
function settledNoteExitKey(store, name) {
|
|
72107
|
+
return typeof store?.walDirectory === "string" ? `${resolve15(store.walDirectory)}\0${name}` : void 0;
|
|
72108
|
+
}
|
|
72109
|
+
function walFileValidator(store, name) {
|
|
72110
|
+
try {
|
|
72111
|
+
const stat = statSync(join13(store.walDirectory, `${name}.json`), { bigint: true, throwIfNoEntry: false });
|
|
72112
|
+
return stat?.isFile() ? `${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}` : void 0;
|
|
72113
|
+
} catch {
|
|
72114
|
+
return void 0;
|
|
72115
|
+
}
|
|
72116
|
+
}
|
|
72081
72117
|
async function readFinalizedClock(connection) {
|
|
72082
72118
|
const info = await connection.getAccountInfo(import_web3106.SYSVAR_CLOCK_PUBKEY, "finalized");
|
|
72083
72119
|
const data = info?.data;
|
|
@@ -72455,7 +72491,7 @@ function assertProvedPaymentBinding(proved, { poolDomain, inputAccountCommitment
|
|
|
72455
72491
|
fail15("proved_request_binding_invalid");
|
|
72456
72492
|
}
|
|
72457
72493
|
}
|
|
72458
|
-
var import_web3106, MODEL_DIR3, seedBytes5, EARLY_CHAIN_TIME_MAX_AGE_MS;
|
|
72494
|
+
var import_web3106, MODEL_DIR3, seedBytes5, EARLY_CHAIN_TIME_MAX_AGE_MS, settledNoteExits;
|
|
72459
72495
|
var init_prepareRecoveredPayment = __esm({
|
|
72460
72496
|
"wallet/src/pay/prepareRecoveredPayment.mjs"() {
|
|
72461
72497
|
"use strict";
|
|
@@ -72476,6 +72512,7 @@ var init_prepareRecoveredPayment = __esm({
|
|
|
72476
72512
|
MODEL_DIR3 = resolve15(fileURLToPath8(new URL("../../vendor/shielded-x402-model/", new URL("__bundled_source__/wallet/src/pay/prepareRecoveredPayment.mjs", import.meta.url).href)));
|
|
72477
72513
|
seedBytes5 = (state) => Uint8Array.from(Buffer.from(state.seedHex, "hex"));
|
|
72478
72514
|
EARLY_CHAIN_TIME_MAX_AGE_MS = 3e4;
|
|
72515
|
+
settledNoteExits = /* @__PURE__ */ new Map();
|
|
72479
72516
|
}
|
|
72480
72517
|
});
|
|
72481
72518
|
|