shinjuku-shielded 0.3.35 → 0.3.36
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 +252 -138
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": "658897741c5d9bce482ff9d932f4ade7e51cf98f834e78c3f693da1e1771e547",
|
|
5
|
+
"bytes": 11193868,
|
|
6
|
+
"sourceCommit": "60ad77f63dbc238b88ee877a67ae54d30ebdbdfb",
|
|
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.36",
|
|
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": "65889774",
|
|
7
|
+
"shinjukuSha256": "658897741c5d9bce482ff9d932f4ade7e51cf98f834e78c3f693da1e1771e547",
|
|
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
|
@@ -18266,7 +18266,7 @@ var require_websocket = __commonJS({
|
|
|
18266
18266
|
var http2 = __require("http");
|
|
18267
18267
|
var net2 = __require("net");
|
|
18268
18268
|
var tls = __require("tls");
|
|
18269
|
-
var { randomBytes: randomBytes30, createHash:
|
|
18269
|
+
var { randomBytes: randomBytes30, createHash: createHash39 } = __require("crypto");
|
|
18270
18270
|
var { Duplex, Readable } = __require("stream");
|
|
18271
18271
|
var { URL: URL4 } = __require("url");
|
|
18272
18272
|
var PerMessageDeflate = require_permessage_deflate();
|
|
@@ -18934,7 +18934,7 @@ var require_websocket = __commonJS({
|
|
|
18934
18934
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
18935
18935
|
return;
|
|
18936
18936
|
}
|
|
18937
|
-
const digest2 =
|
|
18937
|
+
const digest2 = createHash39("sha1").update(key + GUID).digest("base64");
|
|
18938
18938
|
if (res.headers["sec-websocket-accept"] !== digest2) {
|
|
18939
18939
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
18940
18940
|
return;
|
|
@@ -19303,7 +19303,7 @@ var require_websocket_server = __commonJS({
|
|
|
19303
19303
|
var EventEmitter = __require("events");
|
|
19304
19304
|
var http2 = __require("http");
|
|
19305
19305
|
var { Duplex } = __require("stream");
|
|
19306
|
-
var { createHash:
|
|
19306
|
+
var { createHash: createHash39 } = __require("crypto");
|
|
19307
19307
|
var extension3 = require_extension();
|
|
19308
19308
|
var PerMessageDeflate = require_permessage_deflate();
|
|
19309
19309
|
var subprotocol = require_subprotocol();
|
|
@@ -19610,7 +19610,7 @@ var require_websocket_server = __commonJS({
|
|
|
19610
19610
|
);
|
|
19611
19611
|
}
|
|
19612
19612
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
19613
|
-
const digest2 =
|
|
19613
|
+
const digest2 = createHash39("sha1").update(key + GUID).digest("base64");
|
|
19614
19614
|
const headers = [
|
|
19615
19615
|
"HTTP/1.1 101 Switching Protocols",
|
|
19616
19616
|
"Upgrade: websocket",
|
|
@@ -49186,6 +49186,36 @@ var init_book = __esm({
|
|
|
49186
49186
|
}
|
|
49187
49187
|
});
|
|
49188
49188
|
|
|
49189
|
+
// wallet/src/fetch/keepAlive.mjs
|
|
49190
|
+
function proxiedRun() {
|
|
49191
|
+
const env = process.env;
|
|
49192
|
+
return Boolean(env.SHINJUKU_WALLET_PROXIED || env.NODE_USE_ENV_PROXY || env.HTTPS_PROXY || env.HTTP_PROXY || env.https_proxy || env.http_proxy);
|
|
49193
|
+
}
|
|
49194
|
+
function keepAliveDispatcher() {
|
|
49195
|
+
if (shared !== void 0) return shared;
|
|
49196
|
+
try {
|
|
49197
|
+
if (proxiedRun()) return void 0;
|
|
49198
|
+
const global2 = globalThis[GLOBAL_DISPATCHER];
|
|
49199
|
+
if (global2?.constructor?.name !== "Agent") return void 0;
|
|
49200
|
+
shared = new global2.constructor({ keepAliveTimeout: KEEP_ALIVE_MS, keepAliveMaxTimeout: KEEP_ALIVE_MS });
|
|
49201
|
+
return shared;
|
|
49202
|
+
} catch {
|
|
49203
|
+
return void 0;
|
|
49204
|
+
}
|
|
49205
|
+
}
|
|
49206
|
+
function keepAliveInit(init = {}) {
|
|
49207
|
+
const dispatcher = keepAliveDispatcher();
|
|
49208
|
+
return dispatcher === void 0 ? init : { ...init, dispatcher };
|
|
49209
|
+
}
|
|
49210
|
+
var GLOBAL_DISPATCHER, KEEP_ALIVE_MS, shared;
|
|
49211
|
+
var init_keepAlive = __esm({
|
|
49212
|
+
"wallet/src/fetch/keepAlive.mjs"() {
|
|
49213
|
+
"use strict";
|
|
49214
|
+
GLOBAL_DISPATCHER = /* @__PURE__ */ Symbol.for("undici.globalDispatcher.1");
|
|
49215
|
+
KEEP_ALIVE_MS = 2e4;
|
|
49216
|
+
}
|
|
49217
|
+
});
|
|
49218
|
+
|
|
49189
49219
|
// wallet/vendor/shielded-x402-model/src/reference.mjs
|
|
49190
49220
|
import { dirname as dirname5, join as join6 } from "node:path";
|
|
49191
49221
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
@@ -49756,11 +49786,12 @@ var init_anchorClock = __esm({
|
|
|
49756
49786
|
// wallet/src/chain.mjs
|
|
49757
49787
|
import { createHash as createHash7, createPublicKey, randomInt, verify as verifySignature } from "node:crypto";
|
|
49758
49788
|
function connect2(rpcUrl, commitment = "finalized", { timeoutMs } = {}) {
|
|
49759
|
-
const
|
|
49789
|
+
const pooled = (input, init) => rpcFetch(input, keepAliveInit(init));
|
|
49790
|
+
const fetch2 = timeoutMs === void 0 ? pooled : async (input, init) => {
|
|
49760
49791
|
const circuit = torCircuit();
|
|
49761
49792
|
const timeout = AbortSignal.timeout(timeoutMs);
|
|
49762
49793
|
try {
|
|
49763
|
-
const response = await
|
|
49794
|
+
const response = await pooled(input, { ...init, signal: init?.signal ? AbortSignal.any([init.signal, timeout]) : timeout });
|
|
49764
49795
|
const body = await response.text();
|
|
49765
49796
|
const headers = new Headers(response.headers);
|
|
49766
49797
|
headers.delete("content-encoding");
|
|
@@ -49771,7 +49802,23 @@ function connect2(rpcUrl, commitment = "finalized", { timeoutMs } = {}) {
|
|
|
49771
49802
|
throw error;
|
|
49772
49803
|
}
|
|
49773
49804
|
};
|
|
49774
|
-
|
|
49805
|
+
const connection = countRpcCalls(new import_web395.Connection(rpcUrl, { commitment, fetch: fetch2, disableRetryOnRateLimit: true }));
|
|
49806
|
+
let nextId = 0;
|
|
49807
|
+
Object.defineProperty(connection, "abortableRpcRequest", {
|
|
49808
|
+
value: async (method, params, signal) => {
|
|
49809
|
+
const response = await fetch2(rpcUrl, {
|
|
49810
|
+
method: "POST",
|
|
49811
|
+
signal,
|
|
49812
|
+
headers: { "content-type": "application/json" },
|
|
49813
|
+
body: JSON.stringify({ jsonrpc: "2.0", id: `abortable-${nextId += 1}`, method, params })
|
|
49814
|
+
});
|
|
49815
|
+
return response.json();
|
|
49816
|
+
},
|
|
49817
|
+
enumerable: false,
|
|
49818
|
+
writable: false,
|
|
49819
|
+
configurable: true
|
|
49820
|
+
});
|
|
49821
|
+
return connection;
|
|
49775
49822
|
}
|
|
49776
49823
|
function countRpcCalls(connection) {
|
|
49777
49824
|
const counters = Object.fromEntries(COUNTED_RPC_METHODS.map((name) => [name, 0]));
|
|
@@ -50040,11 +50087,11 @@ function connectSplit(own, historyUrl, commitment = "finalized", { pause: pause3
|
|
|
50040
50087
|
const now = Date.now();
|
|
50041
50088
|
if (behindSince === void 0) {
|
|
50042
50089
|
behindSince = now;
|
|
50043
|
-
notice(strictAfterSlot === void 0 ? `history: the history source is behind the chain (JSON-RPC -32016: it has not reached the slot your own RPC read the pool account at); asking again after 0.5 s, 1 s, 2 s, then every 5 s, for at most ${HISTORY_RPC_BEHIND_WAIT_MS / 1e3} s
|
|
50044
|
-
` : `history: the pool account changed after slot ${strictAfterSlot}, the newest slot the history source had reached (its history did not rebuild the pool account your own RPC reads); asking it again after 0.5 s, 1 s, 2 s, then every 5 s, for at most ${HISTORY_RPC_BEHIND_WAIT_MS / 1e3} s
|
|
50090
|
+
notice(strictAfterSlot === void 0 ? `history: the history source is behind the chain (JSON-RPC -32016: it has not reached the slot your own RPC read the pool account at); asking again every 0.15 s for about 2 s, then after 0.5 s, 1 s, 2 s, then every 5 s, for at most ${HISTORY_RPC_BEHIND_WAIT_MS / 1e3} s
|
|
50091
|
+
` : `history: the pool account changed after slot ${strictAfterSlot}, the newest slot the history source had reached (its history did not rebuild the pool account your own RPC reads); asking it again every 0.15 s for about 2 s, then after 0.5 s, 1 s, 2 s, then every 5 s, for at most ${HISTORY_RPC_BEHIND_WAIT_MS / 1e3} s
|
|
50045
50092
|
`);
|
|
50046
50093
|
}
|
|
50047
|
-
const delay3 = HISTORY_RPC_BEHIND_RETRY_STEPS_MS[Math.min(behindWaits, HISTORY_RPC_BEHIND_RETRY_STEPS_MS.length - 1)];
|
|
50094
|
+
const delay3 = behindWaits < HISTORY_RPC_BEHIND_FAST_TRIES ? HISTORY_RPC_BEHIND_FAST_MS : HISTORY_RPC_BEHIND_RETRY_STEPS_MS[Math.min(behindWaits - HISTORY_RPC_BEHIND_FAST_TRIES, HISTORY_RPC_BEHIND_RETRY_STEPS_MS.length - 1)];
|
|
50048
50095
|
if (now - behindSince + delay3 > HISTORY_RPC_BEHIND_WAIT_MS) return false;
|
|
50049
50096
|
behindWaits += 1;
|
|
50050
50097
|
await pause3(delay3);
|
|
@@ -50571,13 +50618,14 @@ function depositIntentAddress2({ programId, pool: pool2, depositPublicInputBytes
|
|
|
50571
50618
|
programId
|
|
50572
50619
|
)[0];
|
|
50573
50620
|
}
|
|
50574
|
-
var import_web395, POOL_STATE_LEN2, POOL_STATE_LEN_RING2, ANCHOR_MODE_RING2, ANCHOR_RING_SLOTS2, ANCHOR_RING_HEADER2, ANCHOR_RING_FIRST_SLOT2, ANCHOR_RING_SLOT_LEN2, POOL_STATE_LEN_V22, BUFFER_HEADER_LEN2, MEMO_BUNDLE_BYTES2, PAYLOAD_LENGTH2, PAYLOAD_LENGTH_V22, TRANSITION_KIND2, INSTRUCTION2, COUNTED_RPC_METHODS, HISTORY_RPC_METHODS, PINNED_HISTORY_PROXIES, PINNED_HISTORY_HTTPS, HISTORY_RPC_OWN, historyRpcErrors, HISTORY_RPC_BEHIND_WAIT_MS, HISTORY_RPC_REQUEST_TIMEOUT_MS, HISTORY_RPC_BEHIND_RETRY_STEPS_MS, HISTORY_RPC_BEHIND_CODE, ED25519_SPKI_PREFIX, SIGNATURE_BYTES, VERSION_1_PREFIX, HISTORY_CROSS_CHECK_COUNT, runTransactions, warmedSources, bytes323, MEMO_BATCH_MAX, MEMO_ATTEMPTS, MEMO_MAX_WAIT_SECONDS, MEMO_ANSWER_TIMEOUT_MS, MEMO_BODY_TIMEOUT_MS, pauseFor, noticeOnStderr, memoDigestHex, memoFailureText, prefetchedMemosByFetch, MEMO_PREFETCH_LIFE_MS;
|
|
50621
|
+
var import_web395, POOL_STATE_LEN2, POOL_STATE_LEN_RING2, ANCHOR_MODE_RING2, ANCHOR_RING_SLOTS2, ANCHOR_RING_HEADER2, ANCHOR_RING_FIRST_SLOT2, ANCHOR_RING_SLOT_LEN2, POOL_STATE_LEN_V22, BUFFER_HEADER_LEN2, MEMO_BUNDLE_BYTES2, PAYLOAD_LENGTH2, PAYLOAD_LENGTH_V22, TRANSITION_KIND2, INSTRUCTION2, COUNTED_RPC_METHODS, HISTORY_RPC_METHODS, PINNED_HISTORY_PROXIES, PINNED_HISTORY_HTTPS, HISTORY_RPC_OWN, historyRpcErrors, HISTORY_RPC_BEHIND_WAIT_MS, HISTORY_RPC_REQUEST_TIMEOUT_MS, HISTORY_RPC_BEHIND_FAST_MS, HISTORY_RPC_BEHIND_FAST_TRIES, HISTORY_RPC_BEHIND_RETRY_STEPS_MS, HISTORY_RPC_BEHIND_CODE, ED25519_SPKI_PREFIX, SIGNATURE_BYTES, VERSION_1_PREFIX, HISTORY_CROSS_CHECK_COUNT, runTransactions, warmedSources, bytes323, MEMO_BATCH_MAX, MEMO_ATTEMPTS, MEMO_MAX_WAIT_SECONDS, MEMO_ANSWER_TIMEOUT_MS, MEMO_BODY_TIMEOUT_MS, pauseFor, noticeOnStderr, memoDigestHex, memoFailureText, prefetchedMemosByFetch, MEMO_PREFETCH_LIFE_MS;
|
|
50575
50622
|
var init_chain2 = __esm({
|
|
50576
50623
|
"wallet/src/chain.mjs"() {
|
|
50577
50624
|
"use strict";
|
|
50578
50625
|
import_web395 = __toESM(require_index_cjs(), 1);
|
|
50579
50626
|
init_esm2();
|
|
50580
50627
|
init_proxy();
|
|
50628
|
+
init_keepAlive();
|
|
50581
50629
|
init_compressedReplay();
|
|
50582
50630
|
init_reference2();
|
|
50583
50631
|
init_anchorClock();
|
|
@@ -50660,6 +50708,8 @@ var init_chain2 = __esm({
|
|
|
50660
50708
|
historyRpcErrors = /* @__PURE__ */ new WeakSet();
|
|
50661
50709
|
HISTORY_RPC_BEHIND_WAIT_MS = 6e4;
|
|
50662
50710
|
HISTORY_RPC_REQUEST_TIMEOUT_MS = 2e4;
|
|
50711
|
+
HISTORY_RPC_BEHIND_FAST_MS = 150;
|
|
50712
|
+
HISTORY_RPC_BEHIND_FAST_TRIES = 12;
|
|
50663
50713
|
HISTORY_RPC_BEHIND_RETRY_STEPS_MS = Object.freeze([500, 1e3, 2e3, 5e3]);
|
|
50664
50714
|
HISTORY_RPC_BEHIND_CODE = -32016;
|
|
50665
50715
|
ED25519_SPKI_PREFIX = Buffer.from("302a300506032b6570032100", "hex");
|
|
@@ -52614,11 +52664,11 @@ async function refreshFinalizedP03HistorySnapshot({
|
|
|
52614
52664
|
if (authenticated.programId !== program.toBase58() || authenticated.pool !== poolKey.toBase58()) {
|
|
52615
52665
|
throw new Error("p03_history_refresh_binding_invalid");
|
|
52616
52666
|
}
|
|
52617
|
-
const snapshot = await
|
|
52618
|
-
if (snapshot.terminal !== authenticated.finalizedPoolSnapshot.terminal || snapshot.currentIndex !== authenticated.finalizedPoolSnapshot.currentIndex || snapshot.currentRoot !== authenticated.finalizedPoolSnapshot.currentRoot || !sameP03PoolPolicy(snapshot, authenticated.finalizedPoolSnapshot.policy) || !
|
|
52667
|
+
const snapshot = await readFinalizedPoolForRefresh(connection, program, poolKey);
|
|
52668
|
+
if (snapshot.terminal !== authenticated.finalizedPoolSnapshot.terminal || snapshot.currentIndex !== authenticated.finalizedPoolSnapshot.currentIndex || snapshot.currentRoot !== authenticated.finalizedPoolSnapshot.currentRoot || !sameP03PoolPolicy(snapshot, authenticated.finalizedPoolSnapshot.policy) || !sameE1TreeHeader(snapshot, authenticated.finalizedPoolSnapshot.e1Tree, program, poolKey)) {
|
|
52619
52669
|
throw Object.assign(
|
|
52620
52670
|
new Error("p03_history_refresh_transition_detected"),
|
|
52621
|
-
{ snapshot, snapshotBinding: { programId: program.toBase58(), pool: poolKey.toBase58() } }
|
|
52671
|
+
{ currentIndex: snapshot.currentIndex, snapshotBinding: { programId: program.toBase58(), pool: poolKey.toBase58() } }
|
|
52622
52672
|
);
|
|
52623
52673
|
}
|
|
52624
52674
|
const priorCoverage = authenticated.deploymentCoverage;
|
|
@@ -52704,6 +52754,26 @@ async function readFinalizedPool(connection, program, pool2) {
|
|
|
52704
52754
|
})
|
|
52705
52755
|
});
|
|
52706
52756
|
}
|
|
52757
|
+
async function readFinalizedPoolForRefresh(connection, program, pool2) {
|
|
52758
|
+
if (typeof connection.getMultipleAccountsInfoAndContext !== "function") return readFinalizedPool(connection, program, pool2);
|
|
52759
|
+
const tree = new import_web396.PublicKey(e1TreeAddress(pool2.toBase58(), program.toBase58()));
|
|
52760
|
+
const both = await retryTransientRpc(() => connection.getMultipleAccountsInfoAndContext(
|
|
52761
|
+
[pool2, tree],
|
|
52762
|
+
{ commitment: "finalized", dataSlice: { offset: 0, length: REFRESH_READ_BYTES } }
|
|
52763
|
+
));
|
|
52764
|
+
if (!Array.isArray(both?.value) || both.value.length !== 2) throw new Error("p03_history_e1_tree_read_invalid");
|
|
52765
|
+
const snapshot = parseFinalizedPool({ context: both.context, value: both.value[0] }, program);
|
|
52766
|
+
if (snapshot.replayStore !== REPLAY_STORE_INDEXED) return snapshot;
|
|
52767
|
+
const treeAccount = both.value[1];
|
|
52768
|
+
return Object.freeze({
|
|
52769
|
+
...snapshot,
|
|
52770
|
+
e1TreeHeader: Object.freeze({
|
|
52771
|
+
address: tree.toBase58(),
|
|
52772
|
+
ownerProgramId: treeAccount ? canonicalKey(treeAccount.owner, "e1_tree_owner").toBase58() : null,
|
|
52773
|
+
data: treeAccount ? Buffer.from(treeAccount.data) : null
|
|
52774
|
+
})
|
|
52775
|
+
});
|
|
52776
|
+
}
|
|
52707
52777
|
function parseFinalizedPool(response, program) {
|
|
52708
52778
|
const value = response?.value;
|
|
52709
52779
|
const slot3 = response?.context?.slot;
|
|
@@ -53424,19 +53494,16 @@ function assertP03E1TreeComplete({ program, pool: pool2, poolSnapshot, settles,
|
|
|
53424
53494
|
if (Buffer.from(header.root).toString("hex") !== root) mismatch("root");
|
|
53425
53495
|
return Object.freeze({ state: "open", address: tree.address, slot: BigInt(poolSnapshot.slot), root, leaves });
|
|
53426
53496
|
}
|
|
53427
|
-
function
|
|
53497
|
+
function sameE1TreeHeader(snapshot, verified, program, pool2) {
|
|
53428
53498
|
if (verified === void 0) return snapshot.replayStore !== REPLAY_STORE_INDEXED;
|
|
53429
|
-
const tree = snapshot.
|
|
53499
|
+
const tree = snapshot.e1TreeHeader;
|
|
53430
53500
|
if (!tree || tree.address !== verified.address) return false;
|
|
53431
53501
|
const empty = tree.data === null || tree.ownerProgramId === null || tree.ownerProgramId === SYSTEM_PROGRAM && tree.data.every((byte) => byte === 0);
|
|
53432
53502
|
if (verified.state === "closed") return empty;
|
|
53433
|
-
if (empty || tree.data.length
|
|
53434
|
-
|
|
53435
|
-
|
|
53436
|
-
|
|
53437
|
-
} catch {
|
|
53438
|
-
return false;
|
|
53439
|
-
}
|
|
53503
|
+
if (empty || tree.ownerProgramId !== program.toBase58() || tree.data.length < E1_TREE_HEADER_BYTES || !Number.isSafeInteger(verified.leaves) || verified.leaves < 1) return false;
|
|
53504
|
+
const data = tree.data;
|
|
53505
|
+
if (data.subarray(0, 8).toString("latin1") !== "SX402T01" || !data.subarray(8, 40).equals(pool2.toBuffer()) || data[40] !== 1 || data[41] !== E1.depth || data.readUInt16LE(42) !== E1.bufferSize || data[44] !== E1.canopyDepth || data[45] !== 0 || data[46] !== 0 || data[47] !== 0) return false;
|
|
53506
|
+
return data.readBigUInt64LE(56) === BigInt(2 * verified.leaves - 1);
|
|
53440
53507
|
}
|
|
53441
53508
|
function assertIndexedSettlementCpis(cpis, kind) {
|
|
53442
53509
|
const exit = kind === "withdraw" || kind === "note-exit";
|
|
@@ -54212,7 +54279,7 @@ function base58Decode(value) {
|
|
|
54212
54279
|
while (zeros < value.length && value[zeros] === "1") zeros += 1;
|
|
54213
54280
|
return Uint8Array.from(Buffer.concat([Buffer.alloc(zeros), body]));
|
|
54214
54281
|
}
|
|
54215
|
-
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, HISTORY_FETCH_CONCURRENCY, HISTORY_BULK_TRANSACTIONS, HISTORY_BULK_ADDRESSES, TRANSIENT_RPC_ATTEMPTS, TRANSIENT_RPC_BASE_DELAY_MS, LAGGING_NODE_RPC_CODES;
|
|
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;
|
|
54216
54283
|
var init_walk = __esm({
|
|
54217
54284
|
"wallet/src/history/walk.mjs"() {
|
|
54218
54285
|
"use strict";
|
|
@@ -54448,6 +54515,8 @@ var init_walk = __esm({
|
|
|
54448
54515
|
P03_INLINE_SETTLEMENT_TAGS = Object.freeze([24, 25, 26, 32]);
|
|
54449
54516
|
P03_PAYMENT_REPLAY_INDICES = PROFILES[4].replayIndices;
|
|
54450
54517
|
NO_CONTEXTS = Object.freeze([]);
|
|
54518
|
+
REFRESH_READ_BYTES = POOL_STATE_LEN_RING2;
|
|
54519
|
+
E1_TREE_HEADER_BYTES = 80;
|
|
54451
54520
|
HISTORY_FETCH_CONCURRENCY = 4;
|
|
54452
54521
|
HISTORY_BULK_TRANSACTIONS = 256;
|
|
54453
54522
|
HISTORY_BULK_ADDRESSES = 256;
|
|
@@ -55363,10 +55432,15 @@ async function readCompactP03History({
|
|
|
55363
55432
|
// it verified. Both are bound again below like served ones.
|
|
55364
55433
|
served,
|
|
55365
55434
|
initialization: knownInitialization,
|
|
55366
|
-
// walletHistory.mjs: the
|
|
55367
|
-
//
|
|
55368
|
-
//
|
|
55369
|
-
//
|
|
55435
|
+
// walletHistory.mjs: the pool's current index that a refresh read on this same own RPC moments
|
|
55436
|
+
// ago and refused as moved (p03_history_refresh_transition_detected carries it; that read held
|
|
55437
|
+
// only the tree's header). The page request starts at once, beside the pool account read below,
|
|
55438
|
+
// unless the cached records already reach that index.
|
|
55439
|
+
knownIndex,
|
|
55440
|
+
// walletHistory.mjs compactFirst: the full pool account (readFinalizedPool, tree included) that
|
|
55441
|
+
// an earlier try of this same load read and folded nothing to because the source was behind
|
|
55442
|
+
// (p03_compact_history_source_behind carries it as behindSnapshot). Folded to again instead of
|
|
55443
|
+
// a second read of the pool account and its 386 KB tree; every check below runs on it as before.
|
|
55370
55444
|
knownSnapshot,
|
|
55371
55445
|
// compactP03HistoryReport: run beside the spot checks once the initialization is verified
|
|
55372
55446
|
// ({ snapshot, initialization, contexts }); its result comes back as `alongside`.
|
|
@@ -55386,8 +55460,9 @@ async function readCompactP03History({
|
|
|
55386
55460
|
throw refuse3("p03_compact_history_connection_invalid");
|
|
55387
55461
|
}
|
|
55388
55462
|
own = withBoundedOwnReads(own);
|
|
55389
|
-
const
|
|
55390
|
-
const
|
|
55463
|
+
const hintIndex = knownSnapshot?.currentIndex ?? knownIndex;
|
|
55464
|
+
const cachedReachesKnown = hintIndex !== void 0 && served !== void 0 && Array.isArray(served.records) && Boolean(served.initialization) && BigInt(served.records.length) * SUBTREE_LEAVES3 >= hintIndex;
|
|
55465
|
+
const first = served === void 0 || hintIndex !== void 0 && !cachedReachesKnown ? requestPage(source, poolString, 0) : void 0;
|
|
55391
55466
|
if (first !== void 0) markPhase("compact-page0-sent");
|
|
55392
55467
|
const snapshot = knownSnapshot ?? await readFinalizedPool(own, program, poolKey);
|
|
55393
55468
|
markPhase(knownSnapshot !== void 0 ? "compact-pool-reused" : "compact-pool");
|
|
@@ -55402,7 +55477,10 @@ async function readCompactP03History({
|
|
|
55402
55477
|
initialization: served.initialization,
|
|
55403
55478
|
syncedSlot: served.syncedSlot,
|
|
55404
55479
|
cached: true
|
|
55405
|
-
} : await readPages(source, poolString, count2, first, { wakeSlot: snapshot.slot })
|
|
55480
|
+
} : await readPages(source, poolString, count2, first, { wakeSlot: snapshot.slot }).catch((error) => {
|
|
55481
|
+
if (error?.compactHistoryRefusal === "p03_compact_history_source_behind") error.behindSnapshot = snapshot;
|
|
55482
|
+
throw error;
|
|
55483
|
+
});
|
|
55406
55484
|
markPhase(page.cached === true ? "compact-list-cached" : "compact-list");
|
|
55407
55485
|
const binding = {
|
|
55408
55486
|
programId: programString,
|
|
@@ -55527,6 +55605,7 @@ async function compactP03HistoryReport({
|
|
|
55527
55605
|
forceRead = false,
|
|
55528
55606
|
freshMs = 0,
|
|
55529
55607
|
priorAttestation,
|
|
55608
|
+
knownIndex,
|
|
55530
55609
|
knownSnapshot,
|
|
55531
55610
|
onList
|
|
55532
55611
|
}) {
|
|
@@ -55596,6 +55675,7 @@ async function compactP03HistoryReport({
|
|
|
55596
55675
|
programId,
|
|
55597
55676
|
pool: pool2,
|
|
55598
55677
|
alongside: attest,
|
|
55678
|
+
...knownIndex !== void 0 ? { knownIndex } : {},
|
|
55599
55679
|
...knownSnapshot !== void 0 ? { knownSnapshot } : {},
|
|
55600
55680
|
...onList !== void 0 ? { onList } : {},
|
|
55601
55681
|
...warm ? { served: cached.served } : {},
|
|
@@ -56370,7 +56450,7 @@ async function loadWalletP03HistoryNow({ store, connection: given, programId, po
|
|
|
56370
56450
|
const runKey = lastRunReportKey(store, programId, pool2, deploymentIdentity, cache);
|
|
56371
56451
|
const remembered = runKey === void 0 || forceRead ? void 0 : lastRunReports.get(runKey);
|
|
56372
56452
|
const earlier = remembered !== void 0 && Date.now() - remembered.at <= HISTORY_WARM_FRESH_MS ? remembered.report : void 0;
|
|
56373
|
-
let
|
|
56453
|
+
let movedIndex;
|
|
56374
56454
|
if (earlier !== void 0) {
|
|
56375
56455
|
markPhase("refresh-start");
|
|
56376
56456
|
try {
|
|
@@ -56381,8 +56461,8 @@ async function loadWalletP03HistoryNow({ store, connection: given, programId, po
|
|
|
56381
56461
|
return refreshed;
|
|
56382
56462
|
} catch (error) {
|
|
56383
56463
|
markPhase("refresh-missed");
|
|
56384
|
-
if (error?.message === "p03_history_refresh_transition_detected" && error.
|
|
56385
|
-
|
|
56464
|
+
if (error?.message === "p03_history_refresh_transition_detected" && typeof error.currentIndex === "bigint" && error.snapshotBinding?.programId === String(programId) && error.snapshotBinding?.pool === String(pool2)) {
|
|
56465
|
+
movedIndex = error.currentIndex;
|
|
56386
56466
|
}
|
|
56387
56467
|
floor?.reset();
|
|
56388
56468
|
if (strict) floor?.strict();
|
|
@@ -56397,7 +56477,7 @@ async function loadWalletP03HistoryNow({ store, connection: given, programId, po
|
|
|
56397
56477
|
pool: pool2,
|
|
56398
56478
|
deploymentIdentity,
|
|
56399
56479
|
forceRead,
|
|
56400
|
-
|
|
56480
|
+
knownIndex: movedIndex,
|
|
56401
56481
|
onCompactList
|
|
56402
56482
|
});
|
|
56403
56483
|
if (compact !== void 0) {
|
|
@@ -56439,7 +56519,7 @@ async function loadWalletP03HistoryNow({ store, connection: given, programId, po
|
|
|
56439
56519
|
if (runKey !== void 0) rememberRunReport(runKey, result.report);
|
|
56440
56520
|
return result.report;
|
|
56441
56521
|
}
|
|
56442
|
-
async function compactFirst({ store, connection, source, programId, pool: pool2, deploymentIdentity, forceRead,
|
|
56522
|
+
async function compactFirst({ store, connection, source, programId, pool: pool2, deploymentIdentity, forceRead, knownIndex, onCompactList }) {
|
|
56443
56523
|
const started = Date.now();
|
|
56444
56524
|
let behindNoticed = false;
|
|
56445
56525
|
let behindTries = 0;
|
|
@@ -56463,8 +56543,9 @@ async function compactFirst({ store, connection, source, programId, pool: pool2,
|
|
|
56463
56543
|
}
|
|
56464
56544
|
}
|
|
56465
56545
|
};
|
|
56546
|
+
let behindSnapshot;
|
|
56466
56547
|
for (let tries = 0; ; tries += 1) {
|
|
56467
|
-
const result = await tryCompactP03HistoryReport(tries === 0 &&
|
|
56548
|
+
const result = await tryCompactP03HistoryReport(behindSnapshot !== void 0 ? { ...options, knownSnapshot: behindSnapshot } : tries === 0 && knownIndex !== void 0 ? { ...options, knownIndex } : options);
|
|
56468
56549
|
if (result.ok) {
|
|
56469
56550
|
markPhase("walk-compact");
|
|
56470
56551
|
const who = source === "pinned" ? "the pinned history proxy" : "--history-rpc";
|
|
@@ -56478,12 +56559,13 @@ async function compactFirst({ store, connection, source, programId, pool: pool2,
|
|
|
56478
56559
|
if (result.reason === "p03_compact_history_source_behind" && Date.now() - started + behindDelay <= HISTORY_RPC_BEHIND_WAIT_MS) {
|
|
56479
56560
|
if (!behindNoticed) {
|
|
56480
56561
|
behindNoticed = true;
|
|
56481
|
-
writeStderr(`history: the history proxy has fewer transitions than the pool account your own RPC read (it is behind the chain); asking it again after 0.5 s, 1 s, 2 s, then every 5 s, for at most ${HISTORY_RPC_BEHIND_WAIT_MS / 1e3} s
|
|
56562
|
+
writeStderr(`history: the history proxy has fewer transitions than the pool account your own RPC read (it is behind the chain); asking it again the first time as soon as it reaches that slot (checked every 0.15 s) or after 0.5 s, then after 1 s, 2 s, then every 5 s, for at most ${HISTORY_RPC_BEHIND_WAIT_MS / 1e3} s
|
|
56482
56563
|
`);
|
|
56483
56564
|
}
|
|
56484
56565
|
markPhase("compact-behind-wait");
|
|
56485
56566
|
behindTries += 1;
|
|
56486
|
-
|
|
56567
|
+
behindSnapshot = result.error?.behindSnapshot;
|
|
56568
|
+
await waitForCompactSource(options.history, pool2, behindTries === 1 ? behindSnapshot?.slot : void 0, behindDelay);
|
|
56487
56569
|
continue;
|
|
56488
56570
|
}
|
|
56489
56571
|
writeStderr(`history: the compact transition list was refused (${result.reason}${result.detail ? `; cause ${result.detail}` : ""}); walking the pool history instead
|
|
@@ -56491,6 +56573,30 @@ async function compactFirst({ store, connection, source, programId, pool: pool2,
|
|
|
56491
56573
|
return void 0;
|
|
56492
56574
|
}
|
|
56493
56575
|
}
|
|
56576
|
+
async function waitForCompactSource(source, pool2, slot3, budgetMs) {
|
|
56577
|
+
const sleep5 = (ms) => new Promise((resolve38) => setTimeout(resolve38, ms));
|
|
56578
|
+
if (!Number.isSafeInteger(slot3) || typeof source?._rpcRequest !== "function") return sleep5(budgetMs);
|
|
56579
|
+
const until = Date.now() + budgetMs;
|
|
56580
|
+
for (; ; ) {
|
|
56581
|
+
const abort = new AbortController();
|
|
56582
|
+
const params = [pool2, { commitment: "finalized", fromOrdinal: 0, toOrdinal: 1, minContextSlot: slot3 }];
|
|
56583
|
+
const read = (typeof source.abortableRpcRequest === "function" ? source.abortableRpcRequest("getP03Transitions", params, abort.signal) : source._rpcRequest("getP03Transitions", params)).catch(() => ({ failed: true }));
|
|
56584
|
+
let timer;
|
|
56585
|
+
const answer = await Promise.race([read, new Promise((resolve38) => {
|
|
56586
|
+
timer = setTimeout(resolve38, Math.max(COMPACT_BEHIND_READ_MS, until - Date.now()));
|
|
56587
|
+
})]);
|
|
56588
|
+
clearTimeout(timer);
|
|
56589
|
+
if (answer === void 0) abort.abort();
|
|
56590
|
+
if (answer?.result !== void 0) {
|
|
56591
|
+
markPhase("compact-behind-caught-up");
|
|
56592
|
+
return void 0;
|
|
56593
|
+
}
|
|
56594
|
+
if (answer !== void 0 && answer?.error?.code !== -32016) return sleep5(Math.max(0, until - Date.now()));
|
|
56595
|
+
const left = until - Date.now();
|
|
56596
|
+
if (left <= 0) return void 0;
|
|
56597
|
+
await sleep5(Math.min(COMPACT_BEHIND_POLL_MS, left));
|
|
56598
|
+
}
|
|
56599
|
+
}
|
|
56494
56600
|
function lastRunReportKey(store, programId, pool2, deploymentIdentity, cache) {
|
|
56495
56601
|
if (cache !== void 0 || !store || typeof store !== "object" || !deploymentIdentity) return void 0;
|
|
56496
56602
|
if (typeof store.path !== "string" || store.path.length === 0) return void 0;
|
|
@@ -56540,7 +56646,7 @@ function reportHistoryRpc(split5, source, result, crossChecked) {
|
|
|
56540
56646
|
writeStderr(`history: ${who} answered ${list(split5.history)}; your own RPC answered ${list(split5.own)} (the pool account the history must match, and the cross-check)${window2}${integrity}
|
|
56541
56647
|
`);
|
|
56542
56648
|
}
|
|
56543
|
-
var strictScope, withStrictHistorySource, recentScope, withRecentWalletHistory, recentLoads, forgetRecentWalletHistory, historyCacheKey, HISTORY_PREWARM_JOIN_MS, prewarmedWalks, PREWARMED_REPORTS, isPrewarmedWalletHistory, COMPACT_BEHIND_RETRY_MS, lastRunReports, writeStderr, announcedSources;
|
|
56649
|
+
var strictScope, withStrictHistorySource, recentScope, withRecentWalletHistory, recentLoads, forgetRecentWalletHistory, historyCacheKey, HISTORY_PREWARM_JOIN_MS, prewarmedWalks, PREWARMED_REPORTS, isPrewarmedWalletHistory, COMPACT_BEHIND_POLL_MS, COMPACT_BEHIND_READ_MS, COMPACT_BEHIND_RETRY_MS, lastRunReports, writeStderr, announcedSources;
|
|
56544
56650
|
var init_walletHistory = __esm({
|
|
56545
56651
|
"wallet/src/history/walletHistory.mjs"() {
|
|
56546
56652
|
"use strict";
|
|
@@ -56565,6 +56671,8 @@ var init_walletHistory = __esm({
|
|
|
56565
56671
|
prewarmedWalks = /* @__PURE__ */ new Map();
|
|
56566
56672
|
PREWARMED_REPORTS = /* @__PURE__ */ new WeakSet();
|
|
56567
56673
|
isPrewarmedWalletHistory = (report) => report !== null && typeof report === "object" && PREWARMED_REPORTS.has(report);
|
|
56674
|
+
COMPACT_BEHIND_POLL_MS = 150;
|
|
56675
|
+
COMPACT_BEHIND_READ_MS = 1e3;
|
|
56568
56676
|
COMPACT_BEHIND_RETRY_MS = [500, 1e3, 2e3, 5e3];
|
|
56569
56677
|
lastRunReports = /* @__PURE__ */ new Map();
|
|
56570
56678
|
writeStderr = (text3) => {
|
|
@@ -59915,6 +60023,12 @@ function workerCount() {
|
|
|
59915
60023
|
}
|
|
59916
60024
|
return Math.max(1, Math.min(MAX_WORKERS, cores - 1));
|
|
59917
60025
|
}
|
|
60026
|
+
function warmMemoDecryptPool() {
|
|
60027
|
+
try {
|
|
60028
|
+
workers();
|
|
60029
|
+
} catch {
|
|
60030
|
+
}
|
|
60031
|
+
}
|
|
59918
60032
|
function workers() {
|
|
59919
60033
|
if (pool !== void 0) return pool.broken ? void 0 : pool;
|
|
59920
60034
|
pool = { list: [], pending: /* @__PURE__ */ new Map(), broken: false };
|
|
@@ -60205,15 +60319,28 @@ var init_successorHistories = __esm({
|
|
|
60205
60319
|
});
|
|
60206
60320
|
|
|
60207
60321
|
// wallet/src/recovery/recover.mjs
|
|
60322
|
+
import { createHash as createHash15 } from "node:crypto";
|
|
60208
60323
|
import { join as join10, resolve as resolve10 } from "node:path";
|
|
60209
60324
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
60210
60325
|
function pinnedGenerator2(profileVector) {
|
|
60211
60326
|
if (profileVector?.payerKeys?.generator) return profileVector.payerKeys.generator;
|
|
60212
|
-
|
|
60213
|
-
|
|
60214
|
-
|
|
60215
|
-
|
|
60216
|
-
|
|
60327
|
+
if (!committedGenerator) {
|
|
60328
|
+
const committed2 = JSON.parse(readFileSync(
|
|
60329
|
+
join10(MODEL_DIR, "vectors", "rust-vectors.json"),
|
|
60330
|
+
"utf8"
|
|
60331
|
+
));
|
|
60332
|
+
committedGenerator = Object.freeze(committed2.payerKeys.generator);
|
|
60333
|
+
}
|
|
60334
|
+
return committedGenerator;
|
|
60335
|
+
}
|
|
60336
|
+
function replayValueOf(kind, poolDomain, commitment, eta, leafIndex) {
|
|
60337
|
+
const key = createHash15("sha256").update(kind === "account" ? `account|${String(commitment)}|${String(eta)}|${String(leafIndex)}` : `note|${String(poolDomain)}|${String(commitment)}|${String(eta)}|${String(leafIndex)}`).digest("base64");
|
|
60338
|
+
const known = REPLAY_VALUES.get(key);
|
|
60339
|
+
if (known !== void 0) return known;
|
|
60340
|
+
const value = kind === "account" ? accountNullifier(commitment, eta, leafIndex) : noteNullifier2(poolDomain, commitment, eta, leafIndex);
|
|
60341
|
+
if (REPLAY_VALUES.size >= REPLAY_VALUES_MAX) REPLAY_VALUES.clear();
|
|
60342
|
+
REPLAY_VALUES.set(key, value);
|
|
60343
|
+
return value;
|
|
60217
60344
|
}
|
|
60218
60345
|
function assertFinalizedRecoveryContext(context, digest2, programId, pool2) {
|
|
60219
60346
|
const kinds = Object.freeze({ deposit: 1, payment: 2, withdraw: 3, "note-exit": 4, move: 5 });
|
|
@@ -60401,6 +60528,7 @@ function prefetchRecoveryMemos({ store, finalizedHistory: finalizedHistory2, ser
|
|
|
60401
60528
|
if (pending.length === 0) return;
|
|
60402
60529
|
createMemoReader(serviceUrl2, { fetchImpl: deps.fetchImpl ?? fetch, notice: () => {
|
|
60403
60530
|
} }).prefetch(pending);
|
|
60531
|
+
warmMemoDecryptPool();
|
|
60404
60532
|
} catch {
|
|
60405
60533
|
}
|
|
60406
60534
|
}
|
|
@@ -60493,7 +60621,13 @@ async function runRecover({ store, connection, programId, digests, serviceUrl: s
|
|
|
60493
60621
|
const recovered = [];
|
|
60494
60622
|
for (const { digest: digest2, context, outputs } of read.entries) {
|
|
60495
60623
|
for (const output2 of outputs) {
|
|
60496
|
-
const replayValue =
|
|
60624
|
+
const replayValue = replayValueOf(
|
|
60625
|
+
output2.kind,
|
|
60626
|
+
context.poolDomain,
|
|
60627
|
+
output2.commitment,
|
|
60628
|
+
viewingAuthority.eta,
|
|
60629
|
+
output2.leafIndex
|
|
60630
|
+
);
|
|
60497
60631
|
recovered.push({ ...output2, digest: digest2, replayValue });
|
|
60498
60632
|
}
|
|
60499
60633
|
}
|
|
@@ -60528,7 +60662,7 @@ async function runRecover({ store, connection, programId, digests, serviceUrl: s
|
|
|
60528
60662
|
...Array.isArray(digests) && digests.length > 0 ? { narrowedByDigests: true } : {}
|
|
60529
60663
|
};
|
|
60530
60664
|
}
|
|
60531
|
-
var import_web3102, FIELD_MODULUS6, MODEL_DIR, seedBytes3, hexOf2;
|
|
60665
|
+
var import_web3102, FIELD_MODULUS6, MODEL_DIR, seedBytes3, committedGenerator, REPLAY_VALUES, REPLAY_VALUES_MAX, hexOf2;
|
|
60532
60666
|
var init_recover = __esm({
|
|
60533
60667
|
"wallet/src/recovery/recover.mjs"() {
|
|
60534
60668
|
"use strict";
|
|
@@ -60548,6 +60682,8 @@ var init_recover = __esm({
|
|
|
60548
60682
|
fileURLToPath5(new URL("../../vendor/shielded-x402-model/", new URL("__bundled_source__/wallet/src/recovery/recover.mjs", import.meta.url).href))
|
|
60549
60683
|
);
|
|
60550
60684
|
seedBytes3 = (state) => Uint8Array.from(Buffer.from(state.seedHex, "hex"));
|
|
60685
|
+
REPLAY_VALUES = /* @__PURE__ */ new Map();
|
|
60686
|
+
REPLAY_VALUES_MAX = 5e4;
|
|
60551
60687
|
hexOf2 = (value) => String(value).replace(/^0x/, "").toLowerCase();
|
|
60552
60688
|
}
|
|
60553
60689
|
});
|
|
@@ -68288,14 +68424,14 @@ var init_solana_ed255192 = __esm({
|
|
|
68288
68424
|
});
|
|
68289
68425
|
|
|
68290
68426
|
// spikes/shielded-x402-solana/scripts/verify-production-parameter-bundle.mjs
|
|
68291
|
-
import { createHash as
|
|
68427
|
+
import { createHash as createHash16 } from "node:crypto";
|
|
68292
68428
|
import { dirname as dirname12, isAbsolute as isAbsolute4, relative as relative5, resolve as resolve11 } from "node:path";
|
|
68293
68429
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
68294
68430
|
function fail13(message) {
|
|
68295
68431
|
throw new Error(`production parameter bundle rejected: ${message}`);
|
|
68296
68432
|
}
|
|
68297
68433
|
function sha2567(bytes2) {
|
|
68298
|
-
return
|
|
68434
|
+
return createHash16("sha256").update(bytes2).digest("hex");
|
|
68299
68435
|
}
|
|
68300
68436
|
function assertHex2(value, bytes2, label) {
|
|
68301
68437
|
if (typeof value !== "string" || !new RegExp(`^[0-9a-f]{${bytes2 * 2}}$`).test(value)) {
|
|
@@ -68769,7 +68905,7 @@ var init_production_proof_bundle2 = __esm({
|
|
|
68769
68905
|
|
|
68770
68906
|
// spikes/shielded-x402-wallet/lib/p03-recovered-exit.mjs
|
|
68771
68907
|
import { spawn as spawn3, spawnSync as spawnSync3 } from "node:child_process";
|
|
68772
|
-
import { createHash as
|
|
68908
|
+
import { createHash as createHash17 } from "node:crypto";
|
|
68773
68909
|
import { dirname as dirname13, isAbsolute as isAbsolute5, join as join11, relative as relative6, resolve as resolve13 } from "node:path";
|
|
68774
68910
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
68775
68911
|
function fail14(reason) {
|
|
@@ -69170,7 +69306,7 @@ var init_p03_recovered_exit = __esm({
|
|
|
69170
69306
|
init_pool_denomination();
|
|
69171
69307
|
TOOLS_SCHEMA2 = "carbon-shielded-wallet/p03-public-proof-tools/v1";
|
|
69172
69308
|
REQUEST_SCHEMA2 = "carbon-shielded-x402/p03-recovered-exit-request/v1";
|
|
69173
|
-
sha2568 = (value) =>
|
|
69309
|
+
sha2568 = (value) => createHash17("sha256").update(value).digest("hex");
|
|
69174
69310
|
jsonBytes2 = (value) => Buffer.from(`${JSON.stringify(value, null, 2)}
|
|
69175
69311
|
`, "utf8");
|
|
69176
69312
|
CHILD_MAX_BUFFER2 = 128 * 1024 * 1024;
|
|
@@ -69202,7 +69338,7 @@ var init_p03_recovered_exit = __esm({
|
|
|
69202
69338
|
});
|
|
69203
69339
|
|
|
69204
69340
|
// spikes/shielded-x402-wallet/bin/shielded-wallet.mjs
|
|
69205
|
-
import { createHash as
|
|
69341
|
+
import { createHash as createHash18 } from "node:crypto";
|
|
69206
69342
|
import { homedir } from "node:os";
|
|
69207
69343
|
import { join as join12, resolve as resolve14 } from "node:path";
|
|
69208
69344
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
@@ -69689,7 +69825,7 @@ function contextHoldsPrimary(context, primaryHex) {
|
|
|
69689
69825
|
const expected = contextPrimaryHex(context, primaryHex);
|
|
69690
69826
|
if (expected === void 0) return false;
|
|
69691
69827
|
if (context.primaryPayloadHex !== void 0) return context.primaryPayloadHex === expected;
|
|
69692
|
-
return context.historySource === "compact" && typeof context.primaryPayloadSha256 === "string" && context.primaryPayloadSha256 ===
|
|
69828
|
+
return context.historySource === "compact" && typeof context.primaryPayloadSha256 === "string" && context.primaryPayloadSha256 === createHash18("sha256").update(Buffer.from(expected, "hex")).digest("hex");
|
|
69693
69829
|
}
|
|
69694
69830
|
function releaseIfSpentByOtherPayment({ store, history, prior }) {
|
|
69695
69831
|
const authenticated = assertAuthenticatedFinalizedP03History(history);
|
|
@@ -71272,7 +71408,7 @@ var init_poseidon_params_t_6 = __esm({
|
|
|
71272
71408
|
});
|
|
71273
71409
|
|
|
71274
71410
|
// src/server/payments/shielded/ShieldedSolanaP03QuoteCrypto.ts
|
|
71275
|
-
import { createHash as
|
|
71411
|
+
import { createHash as createHash19 } from "node:crypto";
|
|
71276
71412
|
function serializePinnedJson(value) {
|
|
71277
71413
|
if (Array.isArray(value)) return `[${value.map(serializePinnedJson).join(", ")}]`;
|
|
71278
71414
|
if (value !== null && typeof value === "object") {
|
|
@@ -71311,7 +71447,7 @@ function parseMatrix(value, rows, columns, label) {
|
|
|
71311
71447
|
}
|
|
71312
71448
|
function assertParameterArtifact(artifact, expected) {
|
|
71313
71449
|
if (!isJsonValue(artifact)) throw new Error("p03_quote_crypto_parameter_artifact_invalid");
|
|
71314
|
-
const digest2 =
|
|
71450
|
+
const digest2 = createHash19("sha256").update(serializePinnedJson(artifact)).digest("hex");
|
|
71315
71451
|
if (digest2 !== expected.sha256) throw new Error("p03_quote_crypto_parameter_hash_mismatch");
|
|
71316
71452
|
if (!artifact || typeof artifact !== "object" || Array.isArray(artifact)) {
|
|
71317
71453
|
throw new Error("p03_quote_crypto_parameter_shape_invalid");
|
|
@@ -72344,7 +72480,7 @@ var init_prepareRecoveredPayment = __esm({
|
|
|
72344
72480
|
});
|
|
72345
72481
|
|
|
72346
72482
|
// wallet/src/pay/receiptTransaction.mjs
|
|
72347
|
-
import { createHash as
|
|
72483
|
+
import { createHash as createHash20 } from "node:crypto";
|
|
72348
72484
|
function sameQuoteCommitment(left, right) {
|
|
72349
72485
|
const parse4 = (value) => {
|
|
72350
72486
|
if (typeof value !== "string" || value.length > 77 || !/^(?:0|[1-9][0-9]*|0x[0-9a-f]{64})$/.test(value)) return void 0;
|
|
@@ -72368,7 +72504,7 @@ function contextPayloadMatches(context, payload2) {
|
|
|
72368
72504
|
else fail16("receipt_history_proof_form_invalid");
|
|
72369
72505
|
if (bytes2 === void 0) return false;
|
|
72370
72506
|
if (context.primaryPayloadHex !== void 0) return context.primaryPayloadHex === bytes2.toString("hex");
|
|
72371
|
-
return context.primaryPayloadSha256 ===
|
|
72507
|
+
return context.primaryPayloadSha256 === createHash20("sha256").update(bytes2).digest("hex");
|
|
72372
72508
|
}
|
|
72373
72509
|
function submittedPayload(paymentHeader) {
|
|
72374
72510
|
const payload2 = decodePaymentSignatureHeader(paymentHeader)?.payload;
|
|
@@ -91159,38 +91295,8 @@ var init_pay = __esm({
|
|
|
91159
91295
|
}
|
|
91160
91296
|
});
|
|
91161
91297
|
|
|
91162
|
-
// wallet/src/fetch/keepAlive.mjs
|
|
91163
|
-
function proxiedRun() {
|
|
91164
|
-
const env = process.env;
|
|
91165
|
-
return Boolean(env.SHINJUKU_WALLET_PROXIED || env.NODE_USE_ENV_PROXY || env.HTTPS_PROXY || env.HTTP_PROXY || env.https_proxy || env.http_proxy);
|
|
91166
|
-
}
|
|
91167
|
-
function keepAliveDispatcher() {
|
|
91168
|
-
if (shared !== void 0) return shared;
|
|
91169
|
-
try {
|
|
91170
|
-
if (proxiedRun()) return void 0;
|
|
91171
|
-
const global2 = globalThis[GLOBAL_DISPATCHER];
|
|
91172
|
-
if (global2?.constructor?.name !== "Agent") return void 0;
|
|
91173
|
-
shared = new global2.constructor({ keepAliveTimeout: KEEP_ALIVE_MS, keepAliveMaxTimeout: KEEP_ALIVE_MS });
|
|
91174
|
-
return shared;
|
|
91175
|
-
} catch {
|
|
91176
|
-
return void 0;
|
|
91177
|
-
}
|
|
91178
|
-
}
|
|
91179
|
-
function keepAliveInit(init = {}) {
|
|
91180
|
-
const dispatcher = keepAliveDispatcher();
|
|
91181
|
-
return dispatcher === void 0 ? init : { ...init, dispatcher };
|
|
91182
|
-
}
|
|
91183
|
-
var GLOBAL_DISPATCHER, KEEP_ALIVE_MS, shared;
|
|
91184
|
-
var init_keepAlive = __esm({
|
|
91185
|
-
"wallet/src/fetch/keepAlive.mjs"() {
|
|
91186
|
-
"use strict";
|
|
91187
|
-
GLOBAL_DISPATCHER = /* @__PURE__ */ Symbol.for("undici.globalDispatcher.1");
|
|
91188
|
-
KEEP_ALIVE_MS = 2e4;
|
|
91189
|
-
}
|
|
91190
|
-
});
|
|
91191
|
-
|
|
91192
91298
|
// wallet/src/pay/floatPay.mjs
|
|
91193
|
-
import { createHash as
|
|
91299
|
+
import { createHash as createHash21, randomBytes as randomBytes11 } from "node:crypto";
|
|
91194
91300
|
import { fileURLToPath as fileURLToPath9 } from "node:url";
|
|
91195
91301
|
function floatRecordOf(store, requestId) {
|
|
91196
91302
|
try {
|
|
@@ -91380,7 +91486,7 @@ function canonicalBody({ requestId, resourceUrl, requirement, refundTo }) {
|
|
|
91380
91486
|
const text3 = `{"requestId":${JSON.stringify(opaque)},"resourceUrl":${JSON.stringify(resourceUrl)},"requirement":${JSON.stringify(requirement)},"refundTo":${JSON.stringify(refundTo)}}`;
|
|
91381
91487
|
const bytes2 = Buffer.from(text3, "utf8");
|
|
91382
91488
|
if (bytes2.length > MAX_BODY_BYTES) fail18("p03_float_body_too_large");
|
|
91383
|
-
return { bodyBase64: bytes2.toString("base64"), floatId:
|
|
91489
|
+
return { bodyBase64: bytes2.toString("base64"), floatId: createHash21("sha256").update(bytes2).digest("hex") };
|
|
91384
91490
|
}
|
|
91385
91491
|
function floatAnswer(resultBase64, record, store) {
|
|
91386
91492
|
let answer;
|
|
@@ -92106,6 +92212,7 @@ async function finalizePendingReceipt({ store, connection, programId, name, time
|
|
|
92106
92212
|
const deadline = now() + timeoutMs;
|
|
92107
92213
|
let gated = false;
|
|
92108
92214
|
let strict = false;
|
|
92215
|
+
let gateClock;
|
|
92109
92216
|
for (; ; ) {
|
|
92110
92217
|
const record = store.readWal(name);
|
|
92111
92218
|
if (!isPending(record)) return record;
|
|
@@ -92129,15 +92236,19 @@ async function finalizePendingReceipt({ store, connection, programId, name, time
|
|
|
92129
92236
|
const answeredLongAgo = Number.isSafeInteger(record.answeredAtMs) && Date.now() - record.answeredAtMs >= FINALITY_GATE_SKIP_AFTER_MS;
|
|
92130
92237
|
if (!answeredLongAgo) {
|
|
92131
92238
|
strict = true;
|
|
92132
|
-
const
|
|
92133
|
-
const
|
|
92134
|
-
|
|
92239
|
+
const [tipClock, finalClock] = await Promise.all([finalizedClock(connection, "confirmed"), finalizedClock(connection)]);
|
|
92240
|
+
const tip = tipClock.slot;
|
|
92241
|
+
const target = tip > finalClock.slot ? tip + FINALITY_GATE_MARGIN_SLOTS : tip;
|
|
92242
|
+
gateClock = finalClock;
|
|
92243
|
+
while (gateClock.slot < target && now() < deadline) {
|
|
92135
92244
|
await sleep5(Math.min(pollMs, FINALITY_GATE_POLL_MS));
|
|
92245
|
+
gateClock = await finalizedClock(connection);
|
|
92136
92246
|
}
|
|
92137
92247
|
}
|
|
92138
92248
|
markPhase("gate");
|
|
92139
92249
|
}
|
|
92140
|
-
const clock2 = await finalizedClock(connection);
|
|
92250
|
+
const clock2 = gateClock ?? await finalizedClock(connection);
|
|
92251
|
+
gateClock = void 0;
|
|
92141
92252
|
const history = assertAuthenticatedFinalizedP03History(
|
|
92142
92253
|
await (strict ? withStrictHistorySource(() => deps.walkHistory()) : deps.walkHistory())
|
|
92143
92254
|
);
|
|
@@ -92848,7 +92959,7 @@ var init_payResource = __esm({
|
|
|
92848
92959
|
});
|
|
92849
92960
|
|
|
92850
92961
|
// wallet/src/pay/cli.mjs
|
|
92851
|
-
import { createHash as
|
|
92962
|
+
import { createHash as createHash22 } from "node:crypto";
|
|
92852
92963
|
import { resolve as resolve16 } from "node:path";
|
|
92853
92964
|
import { fileURLToPath as fileURLToPath11 } from "node:url";
|
|
92854
92965
|
async function main2(args = process.argv.slice(2)) {
|
|
@@ -92968,7 +93079,7 @@ function writePaidAnswer(path, resultBase64) {
|
|
|
92968
93079
|
} catch {
|
|
92969
93080
|
throw new Error("p03_resource_cli_out_unwritable_rerun_same_request");
|
|
92970
93081
|
}
|
|
92971
|
-
return { path, bytes: bytes2.length, sha256:
|
|
93082
|
+
return { path, bytes: bytes2.length, sha256: createHash22("sha256").update(bytes2).digest("hex") };
|
|
92972
93083
|
}
|
|
92973
93084
|
function describeCliError(error, options = {}) {
|
|
92974
93085
|
return describeError(error, { fallback: "p03_resource_cli_failed", nameUnknown: true, ...options });
|
|
@@ -94167,7 +94278,7 @@ var init_secp256k1 = __esm({
|
|
|
94167
94278
|
});
|
|
94168
94279
|
|
|
94169
94280
|
// src/server/storage/EncryptedJsonFile.ts
|
|
94170
|
-
import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, createHash as
|
|
94281
|
+
import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, createHash as createHash24, randomBytes as randomBytes16 } from "node:crypto";
|
|
94171
94282
|
import { mkdir as mkdir3, open as open2, readFile as readFile4, rename as rename3, writeFile as writeFile2 } from "node:fs/promises";
|
|
94172
94283
|
import { dirname as dirname18 } from "node:path";
|
|
94173
94284
|
var EncryptedJsonFile, renameReplacing, renameReplacingSync, retryableWindowsRename, isEncryptedPayload, isMissingFile, isUnsupportedDirectorySync;
|
|
@@ -94293,7 +94404,7 @@ var init_EncryptedJsonFile = __esm({
|
|
|
94293
94404
|
await pause3();
|
|
94294
94405
|
}
|
|
94295
94406
|
const text3 = parts.join("");
|
|
94296
|
-
return { text: text3, sha256:
|
|
94407
|
+
return { text: text3, sha256: createHash24("sha256").update(text3, "utf8").digest("hex") };
|
|
94297
94408
|
}
|
|
94298
94409
|
const iv = randomBytes16(12);
|
|
94299
94410
|
const cipher = createCipheriv3("aes-256-gcm", this.key(), iv);
|
|
@@ -94305,7 +94416,7 @@ var init_EncryptedJsonFile = __esm({
|
|
|
94305
94416
|
sealed.push(cipher.final());
|
|
94306
94417
|
const ciphertext = Buffer.concat(sealed);
|
|
94307
94418
|
const head = `{"version":1,"algorithm":"aes-256-gcm","iv":"${iv.toString("base64")}","tag":"${cipher.getAuthTag().toString("base64")}","ciphertext":"`;
|
|
94308
|
-
const hash12 =
|
|
94419
|
+
const hash12 = createHash24("sha256").update(head, "utf8");
|
|
94309
94420
|
const encoded = [head];
|
|
94310
94421
|
const window2 = 3 * 256 * 1024;
|
|
94311
94422
|
for (let offset = 0; offset < ciphertext.length; offset += window2) {
|
|
@@ -94405,7 +94516,7 @@ var init_EncryptedJsonFile = __esm({
|
|
|
94405
94516
|
if (decoded.length === 32) return decoded;
|
|
94406
94517
|
} catch {
|
|
94407
94518
|
}
|
|
94408
|
-
return
|
|
94519
|
+
return createHash24("sha256").update(value).digest();
|
|
94409
94520
|
}
|
|
94410
94521
|
};
|
|
94411
94522
|
renameReplacing = async (from, to) => {
|
|
@@ -94971,7 +95082,7 @@ var init_poseidon_params_t_3 = __esm({
|
|
|
94971
95082
|
});
|
|
94972
95083
|
|
|
94973
95084
|
// src/server/payments/shielded/ShieldedSolanaP03Poseidon.ts
|
|
94974
|
-
import { createHash as
|
|
95085
|
+
import { createHash as createHash25 } from "node:crypto";
|
|
94975
95086
|
function serializePinnedJson2(value) {
|
|
94976
95087
|
if (Array.isArray(value)) return `[${value.map(serializePinnedJson2).join(", ")}]`;
|
|
94977
95088
|
if (value !== null && typeof value === "object") {
|
|
@@ -95010,7 +95121,7 @@ function parseMatrix2(value, rows, columns, label) {
|
|
|
95010
95121
|
}
|
|
95011
95122
|
function assertShieldedSolanaP03PoseidonParameterArtifact(artifact) {
|
|
95012
95123
|
if (!isJsonValue2(artifact)) throw new Error("p03_poseidon_parameter_artifact_invalid");
|
|
95013
|
-
const digest2 =
|
|
95124
|
+
const digest2 = createHash25("sha256").update(serializePinnedJson2(artifact)).digest("hex");
|
|
95014
95125
|
if (digest2 !== SHIELDED_SOLANA_P03_POSEIDON_PARAMETERS_SHA256) {
|
|
95015
95126
|
throw new Error("p03_poseidon_parameter_hash_mismatch");
|
|
95016
95127
|
}
|
|
@@ -95869,7 +95980,7 @@ var init_shieldedSellerAcceptance = __esm({
|
|
|
95869
95980
|
});
|
|
95870
95981
|
|
|
95871
95982
|
// wallet/src/seller/config.mjs
|
|
95872
|
-
import { createHash as
|
|
95983
|
+
import { createHash as createHash26 } from "node:crypto";
|
|
95873
95984
|
var import_web3119, fail26, sha2;
|
|
95874
95985
|
var init_config = __esm({
|
|
95875
95986
|
"wallet/src/seller/config.mjs"() {
|
|
@@ -95880,7 +95991,7 @@ var init_config = __esm({
|
|
|
95880
95991
|
fail26 = (code) => {
|
|
95881
95992
|
throw new Error(`p03_seller_${code}`);
|
|
95882
95993
|
};
|
|
95883
|
-
sha2 = (bytes2) =>
|
|
95994
|
+
sha2 = (bytes2) => createHash26("sha256").update(bytes2).digest("hex");
|
|
95884
95995
|
}
|
|
95885
95996
|
});
|
|
95886
95997
|
|
|
@@ -112997,7 +113108,7 @@ __export(binding_exports, {
|
|
|
112997
113108
|
commitmentsOpen: () => commitmentsOpen,
|
|
112998
113109
|
transcript: () => transcript
|
|
112999
113110
|
});
|
|
113000
|
-
import { createHash as
|
|
113111
|
+
import { createHash as createHash32, randomBytes as randomBytes26 } from "node:crypto";
|
|
113001
113112
|
function transcript(t, contextCommitment, D5, T, cLo, cHi) {
|
|
113002
113113
|
for (const [name, b] of [["programId", t.programId], ["pool", t.pool], ["mint", t.mint], ["vault", t.vault], ["counterparty", t.counterparty], ["T", T], ["C_lo", cLo], ["C_hi", cHi]]) {
|
|
113003
113114
|
if (b.length !== 32) throw new Error(`transcript ${name} must be 32 bytes, got ${b.length}`);
|
|
@@ -113083,7 +113194,7 @@ var init_binding = __esm({
|
|
|
113083
113194
|
bindCommitment = (v, k, rho) => sponge2([BIND_DOMAIN, v, k, rho]);
|
|
113084
113195
|
TRANSCRIPT_LEN = 391;
|
|
113085
113196
|
FORCED_TRANSCRIPT_LEN = 423;
|
|
113086
|
-
challenge = (tr) => BigInt(`0x${
|
|
113197
|
+
challenge = (tr) => BigInt(`0x${createHash32("sha256").update(tr).digest().subarray(0, 24).toString("hex")}`);
|
|
113087
113198
|
}
|
|
113088
113199
|
});
|
|
113089
113200
|
|
|
@@ -113666,7 +113777,7 @@ __export(witness_exports, {
|
|
|
113666
113777
|
memoDigestHex: () => memoDigestHex2,
|
|
113667
113778
|
treeAppendRequest: () => treeAppendRequest
|
|
113668
113779
|
});
|
|
113669
|
-
import { createHash as
|
|
113780
|
+
import { createHash as createHash33 } from "node:crypto";
|
|
113670
113781
|
function depositRequest(p) {
|
|
113671
113782
|
if (p.account.b !== p.bind.v || p.account.i !== 0n) throw new Error("a deposit account has b = v and i = 0");
|
|
113672
113783
|
return {
|
|
@@ -113715,7 +113826,7 @@ var init_witness2 = __esm({
|
|
|
113715
113826
|
WITNESS_SCHEMA = "carbon-shielded-x402/ctvault-v0b-witness/v1";
|
|
113716
113827
|
dec = (x) => x.toString();
|
|
113717
113828
|
acct = (a) => ({ d: dec(a.d), pDX: dec(a.pDX), i: dec(a.i), b: dec(a.b) });
|
|
113718
|
-
memoDigestHex2 = (memo) => `0x${
|
|
113829
|
+
memoDigestHex2 = (memo) => `0x${createHash33("sha256").update(memo, "utf8").digest("hex")}`;
|
|
113719
113830
|
bindFields = (b) => ({
|
|
113720
113831
|
value: dec(b.v),
|
|
113721
113832
|
blinding: dec(b.k),
|
|
@@ -114461,7 +114572,7 @@ var init_service2 = __esm({
|
|
|
114461
114572
|
});
|
|
114462
114573
|
|
|
114463
114574
|
// wallet/src/v0b/prover.mjs
|
|
114464
|
-
import { createHash as
|
|
114575
|
+
import { createHash as createHash34 } from "node:crypto";
|
|
114465
114576
|
import { join as join33, resolve as resolve32 } from "node:path";
|
|
114466
114577
|
function parseParamsPins(text3) {
|
|
114467
114578
|
const pins = {};
|
|
@@ -114576,7 +114687,7 @@ var init_prover2 = __esm({
|
|
|
114576
114687
|
ExitCTV1: "carbon-shielded-exact/exit-ct-v1/CEREMONY-proof/v0b",
|
|
114577
114688
|
TreeAppendV1: "carbon-shielded-exact/tree-append-v1/CEREMONY-proof/v0b"
|
|
114578
114689
|
});
|
|
114579
|
-
sha256File = (path) =>
|
|
114690
|
+
sha256File = (path) => createHash34("sha256").update(readFileSync(path)).digest("hex");
|
|
114580
114691
|
DEPOSIT_ORDER = spec_exports.DEPOSIT_CT_PUBLIC;
|
|
114581
114692
|
EXIT_ORDER = spec_exports.EXIT_CT_PUBLIC;
|
|
114582
114693
|
}
|
|
@@ -116239,7 +116350,7 @@ var init_lib2 = __esm({
|
|
|
116239
116350
|
});
|
|
116240
116351
|
|
|
116241
116352
|
// wallet/src/laneb/keys.mjs
|
|
116242
|
-
import { createHash as
|
|
116353
|
+
import { createHash as createHash35, createHmac as createHmac9 } from "node:crypto";
|
|
116243
116354
|
function seedBytes7(state) {
|
|
116244
116355
|
const seed = Buffer.from(String(state?.seedHex ?? ""), "hex");
|
|
116245
116356
|
if (seed.length !== 32) fail50("seed_invalid");
|
|
@@ -116340,7 +116451,7 @@ var init_keys3 = __esm({
|
|
|
116340
116451
|
}
|
|
116341
116452
|
return out;
|
|
116342
116453
|
};
|
|
116343
|
-
sha5123 = (...parts) =>
|
|
116454
|
+
sha5123 = (...parts) => createHash35("sha512").update(Buffer.concat(parts.map((part) => Buffer.from(part)))).digest();
|
|
116344
116455
|
hashToScalar = (...parts) => mod9(leToBig(sha5123(...parts)));
|
|
116345
116456
|
nonZero = (scalar) => {
|
|
116346
116457
|
if (scalar === 0n) fail50("degenerate_scalar");
|
|
@@ -116360,7 +116471,7 @@ var init_keys3 = __esm({
|
|
|
116360
116471
|
});
|
|
116361
116472
|
|
|
116362
116473
|
// wallet/src/laneb/flows.mjs
|
|
116363
|
-
import { createHash as
|
|
116474
|
+
import { createHash as createHash36 } from "node:crypto";
|
|
116364
116475
|
import { resolve as resolve34 } from "node:path";
|
|
116365
116476
|
function serviceRefusal(error, what, fallbackNext) {
|
|
116366
116477
|
if (error?.message === "laneb_service_not_enabled") {
|
|
@@ -117023,7 +117134,7 @@ var init_flows3 = __esm({
|
|
|
117023
117134
|
};
|
|
117024
117135
|
sleep3 = (ms) => new Promise((done) => setTimeout(done, ms));
|
|
117025
117136
|
isAddress4 = (value) => typeof value === "string" && /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(value);
|
|
117026
|
-
sha256Hex3 = (text3) =>
|
|
117137
|
+
sha256Hex3 = (text3) => createHash36("sha256").update(text3).digest("hex");
|
|
117027
117138
|
AMOUNT_SENTENCE = "We know the quoted price; for scheme confidential we also check the payer's proof that the transfer equals it. We cannot decrypt a slot. The chain shows no amount.";
|
|
117028
117139
|
saveBook = (store, book) => store.writeWal(BOOK, book);
|
|
117029
117140
|
planRpc = (rpc2) => ({
|
|
@@ -117033,7 +117144,7 @@ var init_flows3 = __esm({
|
|
|
117033
117144
|
});
|
|
117034
117145
|
|
|
117035
117146
|
// wallet/src/laneb/amountProof.mjs
|
|
117036
|
-
import { createHash as
|
|
117147
|
+
import { createHash as createHash37, randomBytes as randomBytes27 } from "node:crypto";
|
|
117037
117148
|
function readValidityContext(transactions) {
|
|
117038
117149
|
if (!Array.isArray(transactions) || transactions.length === 0) refuse13("the plan carries no transactions");
|
|
117039
117150
|
let validity;
|
|
@@ -117066,7 +117177,7 @@ function readValidityContext(transactions) {
|
|
|
117066
117177
|
return { sourcePubkey: data.slice(1, 33), destinationPubkey: data.slice(33, 65), auditorPubkey: data.slice(65, 97), lo: half(97), hi: half(225) };
|
|
117067
117178
|
}
|
|
117068
117179
|
function challenge2({ nonce, half, sourcePubkey, sourceHandle, R: R2, A1, A2, commitment }) {
|
|
117069
|
-
const digest2 =
|
|
117180
|
+
const digest2 = createHash37("sha512").update(Buffer.from(AMOUNT_PROOF_DOMAIN, "utf8")).update(nonce).update(Buffer.from(half, "utf8")).update(sourcePubkey).update(H2.toBytes()).update(sourceHandle).update(R2).update(A1).update(A2).update(commitment).digest();
|
|
117070
117181
|
return leToBig2(digest2) % L3;
|
|
117071
117182
|
}
|
|
117072
117183
|
function nonceBytes(nonce) {
|
|
@@ -117181,7 +117292,7 @@ var init_amountProof = __esm({
|
|
|
117181
117292
|
});
|
|
117182
117293
|
|
|
117183
117294
|
// wallet/src/laneb/x402pay.mjs
|
|
117184
|
-
import { createHash as
|
|
117295
|
+
import { createHash as createHash38, randomBytes as randomBytes28 } from "node:crypto";
|
|
117185
117296
|
import { resolve as resolve35 } from "node:path";
|
|
117186
117297
|
async function call2(promise, what, fallbackNext) {
|
|
117187
117298
|
try {
|
|
@@ -117653,7 +117764,7 @@ var init_x402pay = __esm({
|
|
|
117653
117764
|
}
|
|
117654
117765
|
};
|
|
117655
117766
|
sleep4 = (ms) => new Promise((done) => setTimeout(done, ms));
|
|
117656
|
-
sha256Hex4 = (bytes2) =>
|
|
117767
|
+
sha256Hex4 = (bytes2) => createHash38("sha256").update(bytes2).digest("hex");
|
|
117657
117768
|
isAddress5 = (value) => typeof value === "string" && /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(value);
|
|
117658
117769
|
isSignature2 = (value) => typeof value === "string" && /^[1-9A-HJ-NP-Za-km-z]{64,100}$/.test(value);
|
|
117659
117770
|
usdc5 = (atomic3) => {
|
|
@@ -118364,14 +118475,15 @@ function startHistoryPrewarm(session, store, mark) {
|
|
|
118364
118475
|
// for them after the walk, M). The same set the recovery asks (every listed transition
|
|
118365
118476
|
// its cache lacks); it takes an answer only for a transition of the verified report
|
|
118366
118477
|
// (chain.mjs createMemoReader prefetch; recover.mjs checks each bundle's digest).
|
|
118367
|
-
onCompactList: (
|
|
118368
|
-
markPhase("memo-prefetch");
|
|
118369
|
-
prefetchRecoveryMemos({ store, finalizedHistory: { contexts }, serviceUrl: session.memoServiceUrl, programId: session.programId });
|
|
118370
|
-
}
|
|
118478
|
+
onCompactList: memoPrefetchOnList(session, store)
|
|
118371
118479
|
}));
|
|
118372
118480
|
} catch {
|
|
118373
118481
|
}
|
|
118374
118482
|
}
|
|
118483
|
+
var memoPrefetchOnList = (session, store) => (contexts) => {
|
|
118484
|
+
markPhase("memo-prefetch");
|
|
118485
|
+
prefetchRecoveryMemos({ store, finalizedHistory: { contexts }, serviceUrl: session.memoServiceUrl, programId: session.programId });
|
|
118486
|
+
};
|
|
118375
118487
|
var lazyProofTools = (session) => new Proxy({}, { get: (_target, key) => session.proofTools[key] });
|
|
118376
118488
|
async function paidCall({ session, target, method, headers, body, cap, requestId, price, challenge: challenge3, timing, mark }) {
|
|
118377
118489
|
if (session.closed) fail20("fetch_session_closed", "this payer session is closed; open a new one");
|
|
@@ -118424,7 +118536,8 @@ async function paidCall({ session, target, method, headers, body, cap, requestId
|
|
|
118424
118536
|
connection: connectSplit(session.connection, session.historyUrl),
|
|
118425
118537
|
programId: session.programId,
|
|
118426
118538
|
pool: store.state.pool,
|
|
118427
|
-
deploymentIdentity: session.proofTools.deploymentIdentity
|
|
118539
|
+
deploymentIdentity: session.proofTools.deploymentIdentity,
|
|
118540
|
+
onCompactList: memoPrefetchOnList(session, store)
|
|
118428
118541
|
})
|
|
118429
118542
|
}
|
|
118430
118543
|
});
|
|
@@ -118451,7 +118564,7 @@ async function paidCall({ session, target, method, headers, body, cap, requestId
|
|
|
118451
118564
|
// wallet/src/mcp/stdioServer.mjs
|
|
118452
118565
|
init_fs();
|
|
118453
118566
|
var import_web3131 = __toESM(require_index_cjs(), 1);
|
|
118454
|
-
import { createHash as
|
|
118567
|
+
import { createHash as createHash30 } from "node:crypto";
|
|
118455
118568
|
import { dirname as dirname24, join as join27, resolve as resolve25, sep as sep4 } from "node:path";
|
|
118456
118569
|
import { fileURLToPath as fileURLToPath17 } from "node:url";
|
|
118457
118570
|
init_proxy();
|
|
@@ -118730,7 +118843,7 @@ function addToJsonHost(file, entry, { now = /* @__PURE__ */ new Date(), force =
|
|
|
118730
118843
|
// wallet/src/setup/proofTools.mjs
|
|
118731
118844
|
init_fs();
|
|
118732
118845
|
init_rpcDefault();
|
|
118733
|
-
import { createHash as
|
|
118846
|
+
import { createHash as createHash23 } from "node:crypto";
|
|
118734
118847
|
import { dirname as dirname17, join as join17, sep as sep3 } from "node:path";
|
|
118735
118848
|
|
|
118736
118849
|
// wallet/src/setup/channel.mjs
|
|
@@ -118965,7 +119078,7 @@ var LIMITS = Object.freeze({ release: 64 * 1024, sums: 64 * 1024, file: 200 * 10
|
|
|
118965
119078
|
var RELEASE_TIMEOUT_MS = 3e4;
|
|
118966
119079
|
var FILE_TIMEOUT_MS = 15 * 6e4;
|
|
118967
119080
|
var REQUIRED_FILES = Object.freeze(["proof-tools.json", "exit-proof-tools.json", "public-profile.json"]);
|
|
118968
|
-
var sha2569 = (bytes2) =>
|
|
119081
|
+
var sha2569 = (bytes2) => createHash23("sha256").update(bytes2).digest("hex");
|
|
118969
119082
|
var fail22 = (code, detail) => new Error(`${code}: ${detail}`);
|
|
118970
119083
|
async function getBytes(fetchImpl, url, timeoutMs, label, maxBytes, budget) {
|
|
118971
119084
|
const limit = budget ? Math.min(maxBytes, budget.left) : maxBytes;
|
|
@@ -120006,7 +120119,7 @@ init_shielded_wallet();
|
|
|
120006
120119
|
|
|
120007
120120
|
// wallet/src/mcp/autoPockets.mjs
|
|
120008
120121
|
init_http();
|
|
120009
|
-
import { createHash as
|
|
120122
|
+
import { createHash as createHash27 } from "node:crypto";
|
|
120010
120123
|
|
|
120011
120124
|
// wallet/src/pocket/auto.mjs
|
|
120012
120125
|
var import_web3126 = __toESM(require_index_cjs(), 1);
|
|
@@ -121337,7 +121450,7 @@ var REST_OF_FILL_SECONDS = Object.freeze({
|
|
|
121337
121450
|
});
|
|
121338
121451
|
var REFILLING_CODE = "wallet_refilling_retry_same_request";
|
|
121339
121452
|
var firstCode3 = (error) => String(error?.message ?? error ?? "").split(/[\s:;(]/, 1)[0];
|
|
121340
|
-
var sha25610 = (text3) =>
|
|
121453
|
+
var sha25610 = (text3) => createHash27("sha256").update(text3, "utf8").digest("hex");
|
|
121341
121454
|
function requestFingerprint({ url, method = "GET", headers = {}, body }) {
|
|
121342
121455
|
const sorted = Object.entries(headers ?? {}).map(([name, value]) => [name.toLowerCase(), String(value)]).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
121343
121456
|
return sha25610(JSON.stringify([String(url), String(method).toUpperCase(), sorted, body ?? null]));
|
|
@@ -124533,7 +124646,7 @@ function createOneTimeAdopter({ session, log = () => {
|
|
|
124533
124646
|
|
|
124534
124647
|
// wallet/src/mcp/answer.mjs
|
|
124535
124648
|
init_fs();
|
|
124536
|
-
import { createHash as
|
|
124649
|
+
import { createHash as createHash28 } from "node:crypto";
|
|
124537
124650
|
import { join as join24 } from "node:path";
|
|
124538
124651
|
var DEFAULT_MAX_INLINE_BYTES = 4e6;
|
|
124539
124652
|
var DEFAULT_MAX_TEXT_CHARS = 64 * 1024;
|
|
@@ -124697,7 +124810,7 @@ function extractEmbeddedImages(json2, { saveDir, now, maxInlineBytes = DEFAULT_M
|
|
|
124697
124810
|
return NOT_AN_IMAGE;
|
|
124698
124811
|
}
|
|
124699
124812
|
const sniffed = sniffImage(decoded);
|
|
124700
|
-
const sha3 =
|
|
124813
|
+
const sha3 = createHash28("sha256").update(decoded).digest("hex");
|
|
124701
124814
|
if (!sniffed) {
|
|
124702
124815
|
const svg = claimedMime === "image/svg+xml" || looksLikeSvg(decoded);
|
|
124703
124816
|
const saved2 = save(decoded, svg ? "svg" : "bin", saveDir, now, sha3);
|
|
@@ -124763,7 +124876,7 @@ function paidAnswerContent({
|
|
|
124763
124876
|
bytes: data.length,
|
|
124764
124877
|
...truncated ? { answerTruncated: true } : {}
|
|
124765
124878
|
};
|
|
124766
|
-
const sha25612 =
|
|
124879
|
+
const sha25612 = createHash28("sha256").update(data).digest("hex");
|
|
124767
124880
|
const sniffed = sniffImage(data);
|
|
124768
124881
|
if (sniffed && (declared === "" || declared.startsWith("image/") || declared === "application/octet-stream")) {
|
|
124769
124882
|
const saved2 = save(data, RASTER[sniffed], saveDir, now, sha25612);
|
|
@@ -124844,7 +124957,7 @@ function paidAnswerContent({
|
|
|
124844
124957
|
|
|
124845
124958
|
// wallet/src/mcp/discover.mjs
|
|
124846
124959
|
init_fs();
|
|
124847
|
-
import { createHash as
|
|
124960
|
+
import { createHash as createHash29 } from "node:crypto";
|
|
124848
124961
|
import { join as join25 } from "node:path";
|
|
124849
124962
|
var SOLANA_MAINNET = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
124850
124963
|
var SOLANA_USDC = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
@@ -125315,7 +125428,7 @@ function clip(text3, max) {
|
|
|
125315
125428
|
return text3.length > max ? `${text3.slice(0, max - 1)}\u2026` : text3;
|
|
125316
125429
|
}
|
|
125317
125430
|
function cachePath(key, cacheDir) {
|
|
125318
|
-
return join25(cacheDir, `x402-discover-${
|
|
125431
|
+
return join25(cacheDir, `x402-discover-${createHash29("sha256").update(key).digest("hex").slice(0, 24)}.json`);
|
|
125319
125432
|
}
|
|
125320
125433
|
function readCache(key, ctx, maxAge) {
|
|
125321
125434
|
const age = (record) => ctx.clock() - Number(record?.fetchedAt);
|
|
@@ -125606,6 +125719,7 @@ var withTimeout = (promise, ms) => Promise.race([
|
|
|
125606
125719
|
})
|
|
125607
125720
|
]);
|
|
125608
125721
|
var ownKey = (store) => import_web3130.Keypair.fromSecretKey(Uint8Array.from(store.state.solanaSecretKey)).publicKey;
|
|
125722
|
+
var readFailure = (error) => [error?.name ?? "Error", error?.cause?.code, String(error?.message ?? "").replace(/[a-z][a-z0-9+.-]*:\/\/\S+/gi, "<url>").replace(/api[-_]?key=\S+/gi, "<key>").slice(0, 160)].filter(Boolean).join(" ");
|
|
125609
125723
|
async function readOwnPublicBalance({ session, store }) {
|
|
125610
125724
|
const owner = ownKey(store);
|
|
125611
125725
|
const tokenAccount = getAssociatedTokenAddressSync(new import_web3130.PublicKey(store.state.asset), owner, false, TOKEN_PROGRAM_ID);
|
|
@@ -126654,7 +126768,7 @@ function createWalletTools({
|
|
|
126654
126768
|
]);
|
|
126655
126769
|
if (answered.reading) {
|
|
126656
126770
|
publicRead.then(({ error: late2 }) => {
|
|
126657
|
-
if (late2) log(`MCP_PUBLIC_READ_FAILED_LATE ${late2
|
|
126771
|
+
if (late2) log(`MCP_PUBLIC_READ_FAILED_LATE ${readFailure(late2)}`);
|
|
126658
126772
|
});
|
|
126659
126773
|
}
|
|
126660
126774
|
const { read, error } = answered;
|
|
@@ -126673,7 +126787,7 @@ function createWalletTools({
|
|
|
126673
126787
|
unshieldedSolLamports: read.solLamports
|
|
126674
126788
|
};
|
|
126675
126789
|
} else {
|
|
126676
|
-
log(`MCP_PUBLIC_READ_FAILED ${error
|
|
126790
|
+
log(`MCP_PUBLIC_READ_FAILED ${readFailure(error)}`);
|
|
126677
126791
|
unshielded = {
|
|
126678
126792
|
unshieldedAtomic: null,
|
|
126679
126793
|
unshielded: null,
|
|
@@ -128102,7 +128216,7 @@ function runningBundleFile({ moduleUrl = new URL("__bundled_source__/wallet/src/
|
|
|
128102
128216
|
function runningReleaseSha256({ bundleFile = runningBundleFile() } = {}) {
|
|
128103
128217
|
if (!bundleFile) return Promise.resolve(void 0);
|
|
128104
128218
|
return new Promise((done) => {
|
|
128105
|
-
readFile(bundleFile, (error, bytes2) => done(error ? void 0 :
|
|
128219
|
+
readFile(bundleFile, (error, bytes2) => done(error ? void 0 : createHash30("sha256").update(bytes2).digest("hex")));
|
|
128106
128220
|
});
|
|
128107
128221
|
}
|
|
128108
128222
|
async function checkWalletUpdate({ facilitator, ownSha256 = runningReleaseSha256, fetchReleaseImpl = fetchRelease } = {}) {
|
|
@@ -130177,7 +130291,7 @@ init_chain2();
|
|
|
130177
130291
|
init_proxy();
|
|
130178
130292
|
init_sealedCache();
|
|
130179
130293
|
init_reference2();
|
|
130180
|
-
import { createHash as
|
|
130294
|
+
import { createHash as createHash31, createPublicKey as createPublicKey6, verify as verify3 } from "node:crypto";
|
|
130181
130295
|
var PROGRAM_ID = new import_web3133.PublicKey("9fhQBbumKEFuXtMBDw8AaQyAjCorLGJQiS3skWZdQyQD");
|
|
130182
130296
|
var USDC_MINT = new import_web3133.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
|
|
130183
130297
|
var TREE_ACCOUNT = import_web3133.PublicKey.findProgramAddressSync([Buffer.from("merkle_tree"), USDC_MINT.toBuffer()], PROGRAM_ID)[0];
|
|
@@ -130186,7 +130300,7 @@ var TREE_ACCOUNT_BYTES = 4136;
|
|
|
130186
130300
|
var NEXT_INDEX_OFFSET = 40;
|
|
130187
130301
|
var ROOT_HISTORY_OFFSET = 912;
|
|
130188
130302
|
var ROOT_HISTORY_SIZE_OFFSET = 4129;
|
|
130189
|
-
var EVENT_DISCRIMINATOR =
|
|
130303
|
+
var EVENT_DISCRIMINATOR = createHash31("sha256").update("event:SplCommitmentData").digest().subarray(0, 8);
|
|
130190
130304
|
var EVENT_HEADER_BYTES = 84;
|
|
130191
130305
|
var LOG_DATA = "Program data: ";
|
|
130192
130306
|
var SIGNATURE_PAGE = 1e3;
|
|
@@ -133020,7 +133134,7 @@ var rpcFlags = [
|
|
|
133020
133134
|
var HISTORY_RPC_FLAG = flag2(
|
|
133021
133135
|
"--history-rpc",
|
|
133022
133136
|
"<own|url>",
|
|
133023
|
-
`where the pool's public history comes from (the history walk: its signature lists, transactions, and block signature lists). Default with --tor: the history proxy onion this wallet pins for the pool (the pool ${GUIDE.pool} has one; a pool without one uses your own RPC), so your RPC provider does not see that you read this pool; Default without --tor: the same history proxy over https on the facilitator's pay host (that host already serves your memos and payments), so a first walk takes seconds, not minutes of rate-limited RPC calls; a pool without one uses your own RPC. A line on stderr says which source the run uses. own: your own RPC serves it, with or without --tor, so your RPC provider sees that you read this pool. An https URL, or an http://<v3 onion>/ origin with --tor, serves it instead. That source sees that a client read this pool's public history (and your IP address unless you add --tor), not who; every wallet of the pool makes the same reads. A refresh asks it for every record of a fixed 256-record bucket of the pool's list and the newer ones, not only what is newer than your last refresh, so it sees that refresh only to the bucket (more reads than your own RPC needs). Your own RPC still serves the pool account that the history must match, and every read that names your wallet (your own payment, deposit, and pocket reads). If the source is a little behind the chain, the walk continues at once with the history up to the slot the source has reached, which matches when the pool did not change after that slot; only when it did, the walk asks the source again after 0.5 s, 1 s, 2 s, then every 5 s, for at most 60 s. The wallet checks the signatures of every transaction the source serves, and each refresh reads 3 of them, drawn at random, again on your own RPC (so your RPC provider sees 3 pool reads per refresh). If the source fails, stays behind, or serves history that does not match (a bad signature or a cross-check mismatch), the command stops and says so. It never falls back to your own RPC. A URL that holds an API key shows in the process list and shell history`,
|
|
133137
|
+
`where the pool's public history comes from (the history walk: its signature lists, transactions, and block signature lists). Default with --tor: the history proxy onion this wallet pins for the pool (the pool ${GUIDE.pool} has one; a pool without one uses your own RPC), so your RPC provider does not see that you read this pool; Default without --tor: the same history proxy over https on the facilitator's pay host (that host already serves your memos and payments), so a first walk takes seconds, not minutes of rate-limited RPC calls; a pool without one uses your own RPC. A line on stderr says which source the run uses. own: your own RPC serves it, with or without --tor, so your RPC provider sees that you read this pool. An https URL, or an http://<v3 onion>/ origin with --tor, serves it instead. That source sees that a client read this pool's public history (and your IP address unless you add --tor), not who; every wallet of the pool makes the same reads. A refresh asks it for every record of a fixed 256-record bucket of the pool's list and the newer ones, not only what is newer than your last refresh, so it sees that refresh only to the bucket (more reads than your own RPC needs). Your own RPC still serves the pool account that the history must match, and every read that names your wallet (your own payment, deposit, and pocket reads). If the source is a little behind the chain, the walk continues at once with the history up to the slot the source has reached, which matches when the pool did not change after that slot; only when it did, the walk asks the source again every 0.15 s for about 2 s, then after 0.5 s, 1 s, 2 s, then every 5 s, for at most 60 s. The wallet checks the signatures of every transaction the source serves, and each refresh reads 3 of them, drawn at random, again on your own RPC (so your RPC provider sees 3 pool reads per refresh). If the source fails, stays behind, or serves history that does not match (a bad signature or a cross-check mismatch), the command stops and says so. It never falls back to your own RPC. A URL that holds an API key shows in the process list and shell history`,
|
|
133024
133138
|
{ check: "history-rpc" }
|
|
133025
133139
|
);
|
|
133026
133140
|
var recoverFlags = (options = {}) => [
|