shinjuku-shielded 0.3.70 → 0.3.71
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 +4 -4
- package/package.json +3 -3
- package/shinjuku-wallet.mjs +82 -34
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": "61674c4e8c6309ae6c93338211bf57a674837f572e498215300031a65b9aa743",
|
|
5
|
+
"bytes": 12200396,
|
|
6
|
+
"sourceCommit": "ec62139d8d55db9f55e17c488d052b6c8248acda",
|
|
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",
|
|
@@ -1282,5 +1282,5 @@
|
|
|
1282
1282
|
"version": "1.8.0"
|
|
1283
1283
|
}
|
|
1284
1284
|
],
|
|
1285
|
-
"publishedAt": "2026-10-
|
|
1285
|
+
"publishedAt": "2026-10-22T16:40:39.055Z"
|
|
1286
1286
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinjuku-shielded",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.71",
|
|
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": "61674c4e",
|
|
7
|
+
"shinjukuSha256": "61674c4e8c6309ae6c93338211bf57a674837f572e498215300031a65b9aa743",
|
|
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
|
@@ -51938,13 +51938,7 @@ function createCompactHistoryCacheStore({ path, hmacKey, now }) {
|
|
|
51938
51938
|
accounts: [...state.initialization.accounts],
|
|
51939
51939
|
data: Buffer.from(state.initialization.data).toString("hex")
|
|
51940
51940
|
},
|
|
51941
|
-
...state.attestation ? {
|
|
51942
|
-
attestation: {
|
|
51943
|
-
key: state.attestation.key,
|
|
51944
|
-
newestSignature: state.attestation.newestSignature,
|
|
51945
|
-
coverage: encodeTagged(state.attestation.coverage)
|
|
51946
|
-
}
|
|
51947
|
-
} : {},
|
|
51941
|
+
...state.attestation ? { attestation: serializeAttestation(state.attestation) } : {},
|
|
51948
51942
|
// 2026-10-16: the append root after each served record (hex, count 1..n) and the empty
|
|
51949
51943
|
// tree's root, a fold hint for a new process (compact.mjs hintCompactFold). Optional: an
|
|
51950
51944
|
// older build reads the file and drops it; a file without it folds as before.
|
|
@@ -51986,7 +51980,7 @@ function createCompactHistoryCacheStore({ path, hmacKey, now }) {
|
|
|
51986
51980
|
}
|
|
51987
51981
|
});
|
|
51988
51982
|
}
|
|
51989
|
-
var P03_HISTORY_CACHE_SCHEMA, positionOrNull, encodeTagged, decodeTagged, deserializeAttestation, serializeState, deserializeState, P03_COMPACT_HISTORY_CACHE_SCHEMA;
|
|
51983
|
+
var P03_HISTORY_CACHE_SCHEMA, positionOrNull, encodeTagged, decodeTagged, deserializeAttestation, serializeAttestation, serializeState, deserializeState, P03_COMPACT_HISTORY_CACHE_SCHEMA;
|
|
51990
51984
|
var init_cacheStore = __esm({
|
|
51991
51985
|
"wallet/src/history/cacheStore.mjs"() {
|
|
51992
51986
|
"use strict";
|
|
@@ -52019,8 +52013,22 @@ var init_cacheStore = __esm({
|
|
|
52019
52013
|
if (coverage.complete !== true || typeof coverage.programDataAddress !== "string" || typeof coverage.programDataSha256 !== "string" || typeof coverage.deployedAtSlot !== "bigint" || typeof coverage.throughFinalizedSlot !== "bigint") {
|
|
52020
52014
|
throw new Error("p03_history_cache_attestation_invalid");
|
|
52021
52015
|
}
|
|
52022
|
-
|
|
52016
|
+
if (value.newestSignatureSlot !== void 0 && (!Number.isSafeInteger(value.newestSignatureSlot) || value.newestSignatureSlot < 0 || BigInt(value.newestSignatureSlot) > coverage.throughFinalizedSlot)) {
|
|
52017
|
+
throw new Error("p03_history_cache_attestation_invalid");
|
|
52018
|
+
}
|
|
52019
|
+
return {
|
|
52020
|
+
key: value.key,
|
|
52021
|
+
newestSignature: value.newestSignature,
|
|
52022
|
+
...value.newestSignatureSlot === void 0 ? {} : { newestSignatureSlot: value.newestSignatureSlot },
|
|
52023
|
+
coverage
|
|
52024
|
+
};
|
|
52023
52025
|
};
|
|
52026
|
+
serializeAttestation = (attestation) => ({
|
|
52027
|
+
key: attestation.key,
|
|
52028
|
+
newestSignature: attestation.newestSignature,
|
|
52029
|
+
...Number.isSafeInteger(attestation.newestSignatureSlot) ? { newestSignatureSlot: attestation.newestSignatureSlot } : {},
|
|
52030
|
+
coverage: encodeTagged(attestation.coverage)
|
|
52031
|
+
});
|
|
52024
52032
|
serializeState = (state) => ({
|
|
52025
52033
|
schema: P03_HISTORY_CACHE_SCHEMA,
|
|
52026
52034
|
programId: state.programId,
|
|
@@ -52028,13 +52036,7 @@ var init_cacheStore = __esm({
|
|
|
52028
52036
|
cursor: { ...state.cursor },
|
|
52029
52037
|
snapshot: { ...state.snapshot },
|
|
52030
52038
|
transactions: state.transactions.map(serializeTransactionEntry),
|
|
52031
|
-
...state.attestation ? {
|
|
52032
|
-
attestation: {
|
|
52033
|
-
key: state.attestation.key,
|
|
52034
|
-
newestSignature: state.attestation.newestSignature,
|
|
52035
|
-
coverage: encodeTagged(state.attestation.coverage)
|
|
52036
|
-
}
|
|
52037
|
-
} : {}
|
|
52039
|
+
...state.attestation ? { attestation: serializeAttestation(state.attestation) } : {}
|
|
52038
52040
|
});
|
|
52039
52041
|
deserializeState = (value) => {
|
|
52040
52042
|
if (!value || value.schema !== P03_HISTORY_CACHE_SCHEMA || typeof value.programId !== "string" || typeof value.pool !== "string" || !value.cursor || typeof value.cursor.lastPoolSignature !== "string" || !Number.isSafeInteger(value.cursor.lastSlot) || !value.snapshot || !Number.isSafeInteger(value.snapshot.slot) || typeof value.snapshot.terminal !== "boolean" || typeof value.snapshot.currentIndex !== "string" || typeof value.snapshot.currentRoot !== "string" || !Array.isArray(value.transactions)) {
|
|
@@ -54061,7 +54063,8 @@ function slicedSnapshot(result, program, pool2, tree, programData) {
|
|
|
54061
54063
|
owner: value.owner,
|
|
54062
54064
|
executable: value.executable,
|
|
54063
54065
|
data,
|
|
54064
|
-
newestSignature: newest.signature
|
|
54066
|
+
newestSignature: newest.signature,
|
|
54067
|
+
newestSignatureSlot: newest.slot
|
|
54065
54068
|
})
|
|
54066
54069
|
}));
|
|
54067
54070
|
}
|
|
@@ -54326,12 +54329,21 @@ async function programDataCoverageFor(args) {
|
|
|
54326
54329
|
let priorRefused = false;
|
|
54327
54330
|
let cause;
|
|
54328
54331
|
const key = coverageKey({ program, initialization, deploymentIdentity });
|
|
54332
|
+
if (key !== void 0 && prior?.key === key && typeof prior.newestSignature === "string" && Number.isSafeInteger(prior.newestSignatureSlot) && typeof prior.coverage?.throughFinalizedSlot === "bigint" && BigInt(prior.newestSignatureSlot) <= BigInt(snapshotSlot) && prior.coverage.throughFinalizedSlot > BigInt(snapshotSlot)) {
|
|
54333
|
+
markPhase("attest-reuse-older-snapshot");
|
|
54334
|
+
return { coverage: Object.freeze({ ...prior.coverage, throughFinalizedSlot: BigInt(snapshotSlot) }), attestation: prior, reused: true };
|
|
54335
|
+
}
|
|
54329
54336
|
if (key !== void 0 && prior?.key === key && typeof prior.newestSignature === "string" && prior.coverage?.throughFinalizedSlot <= BigInt(snapshotSlot)) {
|
|
54330
54337
|
const address5 = new import_web396.PublicKey(prior.coverage.programDataAddress);
|
|
54331
54338
|
const deployedAtSlot = BigInt(prior.coverage.deployedAtSlot);
|
|
54332
|
-
const reuse = (signature2) => {
|
|
54339
|
+
const reuse = (signature2, signatureSlot) => {
|
|
54333
54340
|
const coverage = Object.freeze({ ...prior.coverage, throughFinalizedSlot: BigInt(snapshotSlot) });
|
|
54334
|
-
return { coverage, attestation: {
|
|
54341
|
+
return { coverage, attestation: {
|
|
54342
|
+
key,
|
|
54343
|
+
newestSignature: signature2,
|
|
54344
|
+
...Number.isSafeInteger(signatureSlot) && signatureSlot <= snapshotSlot ? { newestSignatureSlot: signatureSlot } : {},
|
|
54345
|
+
coverage
|
|
54346
|
+
}, reused: true };
|
|
54335
54347
|
};
|
|
54336
54348
|
const pooled = reuseAnswer !== void 0 && reuseAnswer.slot === snapshotSlot && reuseAnswer.address === address5.toBase58() ? reuseAnswer : void 0;
|
|
54337
54349
|
if (pooled !== void 0) {
|
|
@@ -54339,7 +54351,7 @@ async function programDataCoverageFor(args) {
|
|
|
54339
54351
|
assertProgramDataHeader(pooled.slot, pooled, { snapshotSlot, deployedAtSlot });
|
|
54340
54352
|
if (pooled.newestSignature === prior.newestSignature) {
|
|
54341
54353
|
markPhase("attest-reuse-in-pool-read");
|
|
54342
|
-
return reuse(pooled.newestSignature);
|
|
54354
|
+
return reuse(pooled.newestSignature, pooled.newestSignatureSlot);
|
|
54343
54355
|
}
|
|
54344
54356
|
cause = "programdata_newest_signature_changed";
|
|
54345
54357
|
} catch (error) {
|
|
@@ -54357,7 +54369,7 @@ async function programDataCoverageFor(args) {
|
|
|
54357
54369
|
}),
|
|
54358
54370
|
newestSignature(reuseConnection, address5, snapshotSlot)
|
|
54359
54371
|
]);
|
|
54360
|
-
if (newest.signature === prior.newestSignature) return reuse(newest.signature);
|
|
54372
|
+
if (newest.signature === prior.newestSignature) return reuse(newest.signature, newest.slot);
|
|
54361
54373
|
cause = "programdata_newest_signature_changed";
|
|
54362
54374
|
break;
|
|
54363
54375
|
} catch (error) {
|
|
@@ -54403,7 +54415,7 @@ async function programDataCoverageFor(args) {
|
|
|
54403
54415
|
const newest = await newestSignature(connection, new import_web396.PublicKey(coverage.programDataAddress), snapshotSlot);
|
|
54404
54416
|
return {
|
|
54405
54417
|
coverage,
|
|
54406
|
-
attestation: key !== void 0 && newest.slot <= snapshotSlot ? { key, newestSignature: newest.signature, coverage } : void 0,
|
|
54418
|
+
attestation: key !== void 0 && newest.slot <= snapshotSlot ? { key, newestSignature: newest.signature, newestSignatureSlot: newest.slot, coverage } : void 0,
|
|
54407
54419
|
reused: false
|
|
54408
54420
|
};
|
|
54409
54421
|
})();
|
|
@@ -57429,7 +57441,7 @@ function withBoundedOwnReads(connection) {
|
|
|
57429
57441
|
if (typeof value !== "function") return value;
|
|
57430
57442
|
if (BOUNDED_OWN_METHODS.has(property)) return (...args) => boundedOwnRead(() => value.apply(target, args));
|
|
57431
57443
|
if (property === "_rpcRequest") {
|
|
57432
|
-
return (...args) => args[0] === P03_POOL_SLICES_METHOD ? boundedOwnRead(() =>
|
|
57444
|
+
return (...args) => args[0] === P03_POOL_SLICES_METHOD ? boundedOwnRead((stalled) => hedgedOwnPoolSlicesRead(target, args[1], { stalled })) : value.apply(target, args);
|
|
57433
57445
|
}
|
|
57434
57446
|
return value.bind(target);
|
|
57435
57447
|
}
|
|
@@ -57556,15 +57568,40 @@ async function ownTransaction(own, signature2) {
|
|
|
57556
57568
|
}
|
|
57557
57569
|
async function hedgedOwnTransactionRead(own, signature2, { stalled, hedge = inTorRun, afterMs = SPOT_HEDGE_AFTER_MS } = {}) {
|
|
57558
57570
|
const params = [signature2, { commitment: "finalized", maxSupportedTransactionVersion: 1, encoding: "base64" }];
|
|
57559
|
-
|
|
57560
|
-
|
|
57571
|
+
return hedgedOwnRead(own, "getTransaction", params, {
|
|
57572
|
+
stalled,
|
|
57573
|
+
hedge,
|
|
57574
|
+
afterMs,
|
|
57575
|
+
id: `spot-${spotReadId += 1}`,
|
|
57576
|
+
lane: SPOT_HEDGE_LANE,
|
|
57577
|
+
mark: "spot-hedge",
|
|
57578
|
+
passes: (response) => {
|
|
57579
|
+
checkedOwnTransaction(response, signature2);
|
|
57580
|
+
}
|
|
57581
|
+
});
|
|
57582
|
+
}
|
|
57583
|
+
function hedgedOwnPoolSlicesRead(own, params, { stalled, hedge = inTorRun, afterMs = POOL_HEDGE_AFTER_MS } = {}) {
|
|
57584
|
+
return hedgedOwnRead(own, P03_POOL_SLICES_METHOD, params, {
|
|
57585
|
+
stalled,
|
|
57586
|
+
hedge,
|
|
57587
|
+
afterMs,
|
|
57588
|
+
id: `pool-${poolReadId += 1}`,
|
|
57589
|
+
lane: POOL_HEDGE_LANE,
|
|
57590
|
+
mark: "pool-hedge",
|
|
57591
|
+
passes: (response) => {
|
|
57592
|
+
if (response === null || typeof response !== "object" || !("result" in response || "error" in response)) throw new Error("no answer");
|
|
57593
|
+
}
|
|
57594
|
+
});
|
|
57595
|
+
}
|
|
57596
|
+
async function hedgedOwnRead(own, method, params, { stalled, hedge, afterMs, id, lane: hedgeLane, mark, passes: check }) {
|
|
57597
|
+
if (typeof own.abortableRpcRequest !== "function") return own._rpcRequest(method, params);
|
|
57561
57598
|
const copies = [];
|
|
57562
57599
|
const send3 = (lane) => {
|
|
57563
57600
|
const controller = new AbortController();
|
|
57564
57601
|
const signal = stalled === void 0 ? controller.signal : AbortSignal.any([stalled, controller.signal]);
|
|
57565
57602
|
const copy = { controller, lane, outcome: void 0 };
|
|
57566
57603
|
copy.read = own.abortableRpcRequest(
|
|
57567
|
-
|
|
57604
|
+
method,
|
|
57568
57605
|
params,
|
|
57569
57606
|
signal,
|
|
57570
57607
|
void 0,
|
|
@@ -57591,14 +57628,14 @@ async function hedgedOwnTransactionRead(own, signature2, { stalled, hedge = inTo
|
|
|
57591
57628
|
const follow = (copy, which) => copy.read.then((response) => {
|
|
57592
57629
|
let passes = false;
|
|
57593
57630
|
try {
|
|
57594
|
-
|
|
57631
|
+
check(response);
|
|
57595
57632
|
passes = true;
|
|
57596
57633
|
} catch {
|
|
57597
57634
|
passes = false;
|
|
57598
57635
|
}
|
|
57599
57636
|
copy.outcome = { response, passes };
|
|
57600
57637
|
if (passes && !done) {
|
|
57601
|
-
if (copies.length > 1) markPhase(
|
|
57638
|
+
if (copies.length > 1) markPhase(`${mark}-won-${which}`);
|
|
57602
57639
|
finish(() => resolve38(response));
|
|
57603
57640
|
return;
|
|
57604
57641
|
}
|
|
@@ -57615,8 +57652,8 @@ async function hedgedOwnTransactionRead(own, signature2, { stalled, hedge = inTo
|
|
|
57615
57652
|
clearTimeout(timer);
|
|
57616
57653
|
timer = void 0;
|
|
57617
57654
|
if (done || copies.length > 1) return;
|
|
57618
|
-
markPhase(
|
|
57619
|
-
follow(send3(
|
|
57655
|
+
markPhase(`${mark}-sent`);
|
|
57656
|
+
follow(send3(hedgeLane), "hedge");
|
|
57620
57657
|
};
|
|
57621
57658
|
follow(send3(void 0), "first");
|
|
57622
57659
|
timer = hedging ? setTimeout(sendHedge, afterMs) : void 0;
|
|
@@ -58269,7 +58306,7 @@ async function tryCompactP03HistoryReport(options) {
|
|
|
58269
58306
|
return { ok: false, reason, ...detail ? { detail } : {}, error };
|
|
58270
58307
|
}
|
|
58271
58308
|
}
|
|
58272
|
-
var import_web397, P03_COMPACT_HISTORY_SOURCE_MODEL, P03_COMPACT_PAGE, P03_COMPACT_SPOT_CHECKS, FIELD_MODULUS5, SUBTREE_LEAVES3, LOCAL_DEPTH2, OUTER_DEPTH2, PRIMARY_PROOF_BYTES2, FIELD_BYTES3, ED25519_SPKI_PREFIX2, VERSION_1_PREFIX2, HEX64, BASE58, REPLAY_STORE_INDEXED2, PROFILES2, MOVE_HEAD_BYTES2, MOVE_INSERTED_VALUES2, refuse3, hash4, bitAt, zeroRootsMemo, lastFolds, PRE_FOLD_SLICE_MS, preFolds, hex64, droppedPools, verifyQuietMs, VERIFY_SLICE_MS, VERIFY_POLL_MS, verifying, unrefTurn, isSignature, isIndex, IMPORT_KEYS, IMPORT_MAX_VALUES, LIST_ATTEMPTS, pageZeroInFlight, OWN_READ_TIMEOUT_MS, BOUNDED_OWN_METHODS, SPOT_HEDGE_AFTER_MS, SPOT_HEDGE_LANE, spotReadId, compactReportsRunning, compactHistoryReadsRunning;
|
|
58309
|
+
var import_web397, P03_COMPACT_HISTORY_SOURCE_MODEL, P03_COMPACT_PAGE, P03_COMPACT_SPOT_CHECKS, FIELD_MODULUS5, SUBTREE_LEAVES3, LOCAL_DEPTH2, OUTER_DEPTH2, PRIMARY_PROOF_BYTES2, FIELD_BYTES3, ED25519_SPKI_PREFIX2, VERSION_1_PREFIX2, HEX64, BASE58, REPLAY_STORE_INDEXED2, PROFILES2, MOVE_HEAD_BYTES2, MOVE_INSERTED_VALUES2, refuse3, hash4, bitAt, zeroRootsMemo, lastFolds, PRE_FOLD_SLICE_MS, preFolds, hex64, droppedPools, verifyQuietMs, VERIFY_SLICE_MS, VERIFY_POLL_MS, verifying, unrefTurn, isSignature, isIndex, IMPORT_KEYS, IMPORT_MAX_VALUES, LIST_ATTEMPTS, pageZeroInFlight, OWN_READ_TIMEOUT_MS, BOUNDED_OWN_METHODS, SPOT_HEDGE_AFTER_MS, SPOT_HEDGE_LANE, spotReadId, POOL_HEDGE_AFTER_MS, POOL_HEDGE_LANE, poolReadId, compactReportsRunning, compactHistoryReadsRunning;
|
|
58273
58310
|
var init_compact = __esm({
|
|
58274
58311
|
"wallet/src/history/compact.mjs"() {
|
|
58275
58312
|
"use strict";
|
|
@@ -58405,6 +58442,9 @@ var init_compact = __esm({
|
|
|
58405
58442
|
SPOT_HEDGE_AFTER_MS = 4e3;
|
|
58406
58443
|
SPOT_HEDGE_LANE = "spot-hedge";
|
|
58407
58444
|
spotReadId = 0;
|
|
58445
|
+
POOL_HEDGE_AFTER_MS = 5e3;
|
|
58446
|
+
POOL_HEDGE_LANE = "pool-hedge";
|
|
58447
|
+
poolReadId = 0;
|
|
58408
58448
|
compactReportsRunning = 0;
|
|
58409
58449
|
compactHistoryReadsRunning = () => compactReportsRunning;
|
|
58410
58450
|
}
|
|
@@ -73896,6 +73936,7 @@ async function runRecoveredP03NoteExit({
|
|
|
73896
73936
|
pool: pool2,
|
|
73897
73937
|
history
|
|
73898
73938
|
});
|
|
73939
|
+
markPhase("exit-anchor-refreshed");
|
|
73899
73940
|
timestamp = await readChainTime();
|
|
73900
73941
|
epoch = BigInt(Math.floor(timestamp / 300));
|
|
73901
73942
|
}
|
|
@@ -74037,6 +74078,7 @@ async function runRecoveredP03NoteExit({
|
|
|
74037
74078
|
epoch = BigInt(Math.floor(timestamp / 300));
|
|
74038
74079
|
}
|
|
74039
74080
|
await ensureCurrentAnchor();
|
|
74081
|
+
markPhase("exit-anchor-current");
|
|
74040
74082
|
const buildRecoveryPath = deps.buildRecoveryPath ?? buildFinalizedP03RecoveryPath;
|
|
74041
74083
|
const prepareFold = deps.buildRecoveryPath === void 0 ? prepareFinalizedP03RecoveryFold : async () => {
|
|
74042
74084
|
};
|
|
@@ -74119,8 +74161,10 @@ async function runRecoveredP03NoteExit({
|
|
|
74119
74161
|
store.writeWal(walName2, wal);
|
|
74120
74162
|
}
|
|
74121
74163
|
let proved = wal.proved;
|
|
74164
|
+
markPhase("exit-request-built");
|
|
74122
74165
|
if (!proved) {
|
|
74123
74166
|
proved = await proveExit(request);
|
|
74167
|
+
markPhase("exit-proved");
|
|
74124
74168
|
assertProvedExitBinding(proved, request);
|
|
74125
74169
|
wal = {
|
|
74126
74170
|
...wal,
|
|
@@ -74148,6 +74192,7 @@ async function runRecoveredP03NoteExit({
|
|
|
74148
74192
|
memoBundleHex: proved.output.memoBundleHex,
|
|
74149
74193
|
recipientTokenAccount: recipient.toBase58()
|
|
74150
74194
|
}) : await selfBroadcastExit();
|
|
74195
|
+
markPhase(relaySubmit ? "exit-relay-answered" : "exit-sent");
|
|
74151
74196
|
async function selfBroadcastExit() {
|
|
74152
74197
|
if (poolState2.replayStore === REPLAY_STORE.indexedTree) return selfBroadcastE1Exit();
|
|
74153
74198
|
const replayValues = [proved.primary.publicInputBytesHex[3]];
|
|
@@ -74244,6 +74289,7 @@ async function runRecoveredP03NoteExit({
|
|
|
74244
74289
|
store.writeWal(walName2, wal);
|
|
74245
74290
|
for (let attempt = 1; ; attempt += 1) {
|
|
74246
74291
|
history = await walkHistory();
|
|
74292
|
+
markPhase("exit-post-walk");
|
|
74247
74293
|
poolState2 = await readPool2(connection, pool2, "finalized");
|
|
74248
74294
|
if (!poolState2 || !poolState2.owner.equals(chainProgramId) || poolState2.version !== 3) {
|
|
74249
74295
|
throw new Error("finalized note-exit pool postcondition invalid");
|
|
@@ -75039,6 +75085,7 @@ var init_shielded_wallet = __esm({
|
|
|
75039
75085
|
init_settlement_receipt();
|
|
75040
75086
|
init_safe_exit();
|
|
75041
75087
|
init_walletHistory();
|
|
75088
|
+
init_phaseTiming();
|
|
75042
75089
|
init_chain2();
|
|
75043
75090
|
init_compressedReplay();
|
|
75044
75091
|
init_e1Exit();
|
|
@@ -108693,7 +108740,7 @@ function balanceLine(a) {
|
|
|
108693
108740
|
const pub = usdcText(a.unshieldedAtomic);
|
|
108694
108741
|
const landing = usdcText(a.landingAtomic);
|
|
108695
108742
|
if (positive(landing) && !a.refreshError) {
|
|
108696
|
-
const line = `${landing} USDC you added landed and is being counted.
|
|
108743
|
+
const line = `${landing} USDC you added landed and is being counted. It needs no step from you.`;
|
|
108697
108744
|
return balance !== void 0 && a.refreshing !== true ? `You have ${balance} USDC private; ${line}` : line;
|
|
108698
108745
|
}
|
|
108699
108746
|
const arriving = addFundsHeldSay(a.addFunds);
|
|
@@ -119327,7 +119374,7 @@ ${canonical5}`;
|
|
|
119327
119374
|
const balance = {
|
|
119328
119375
|
name: "wallet_balance",
|
|
119329
119376
|
title: "Balance",
|
|
119330
|
-
description: `Use this when the user asks "what is my balance" or "how much USDC do I have": it answers ONE balance (balanceAtomic, what x402_pay can spend) and the public (unshielded) USDC. Pays nothing and signs nothing. balanceAtomic is one number; breakdown names its parts (breakdown.shieldedAtomic is what wallet_unshield can send; privateSendPendingAtomic is the part of a running private send (wallet_unshield with parts or max_delay_minutes) not sent yet, already taken off shieldedAtomic; refundsInFlightAtomic is a Shinjuku refund on its way back; setAsideAtomic (only when not 0) is value an older version of this wallet set aside to pay sellers; during a pool move, pools lists each pool's part and movingAtomic is value on its way from the old pool to the new one; the move field shows the move, poolSwitches each switch). UNSHIELDED (unshieldedAtomic) is the plain public USDC on the wallet's own Solana key (ownAddress), the USDC wallet_shield makes private; unshieldedSolLamports is that key's SOL, information only: wallet_shield needs none (the facilitator's relayer pays every fee and rent). When the local balance is stale (a new deposit, a received payment), it reads the chain by itself first; when that takes longer than about 20 s it answers the last balance with refreshing: true and finishes in the background (call wallet_balance again in 30 s). A balance with refreshing: true and refreshReason is exact (payment_settling: a payment settles and the number counts it; account_join: the wallet joins its own balance parts and the number counts them; pool_move: value from the old pool arrives and the number counts it; first_check: a new wallet's first history check, the number is its own landed deposits). status reading (balanceAtomic null): the first balance read of a wallet that may hold money is not done; call wallet_balance again in 30 s. If the public read fails, unshieldedAtomic is null with unshieldedReason; the rest still answers. ownKeyTokens (only when there are any): the other tokens on ownAddress (not its USDC), each { mint, amountAtomic, decimals, amount }, at most 10 (ownKeyTokensMore counts the rest); a token is its mint, never a name or symbol; wallet_transfer_token with that mint as token_mint sells one and sends the USDC privately. earlierDeposits (only when there are any): USDC found at a one-time deposit address of an earlier pool, each with a notice line to tell the user; the wallet moves it into the current pool by itself. addFunds (only when there are any): each wallet_add_funds address still open, with its state and the USDC known to wait there (heldAtomic; null with heldNote when the address was not checked yet). landingAtomic (only when not 0): USDC you added whose deposit landed on chain and that balanceAtomic does not count yet; this call finishes it and waits about 20 s for it, past that it is being counted: call wallet_balance again in 30 s. session shows the spending limits (null or "none": no limit), what is left, where the limits come from, and how to change them (session.summary). verbose: true adds \`internal\` (accounts, notes, and other engineering numbers); the default answer leaves them out. To add money, use wallet_add_funds. Amounts are atomic units (USDC: 1000000 = 1 USDC); say and usdc give them in USDC.`,
|
|
119377
|
+
description: `Use this when the user asks "what is my balance" or "how much USDC do I have": it answers ONE balance (balanceAtomic, what x402_pay can spend) and the public (unshielded) USDC. Pays nothing and signs nothing. balanceAtomic is one number; breakdown names its parts (breakdown.shieldedAtomic is what wallet_unshield can send; privateSendPendingAtomic is the part of a running private send (wallet_unshield with parts or max_delay_minutes) not sent yet, already taken off shieldedAtomic; refundsInFlightAtomic is a Shinjuku refund on its way back; setAsideAtomic (only when not 0) is value an older version of this wallet set aside to pay sellers; during a pool move, pools lists each pool's part and movingAtomic is value on its way from the old pool to the new one; the move field shows the move, poolSwitches each switch). UNSHIELDED (unshieldedAtomic) is the plain public USDC on the wallet's own Solana key (ownAddress), the USDC wallet_shield makes private; unshieldedSolLamports is that key's SOL, information only: wallet_shield needs none (the facilitator's relayer pays every fee and rent). When the local balance is stale (a new deposit, a received payment), it reads the chain by itself first; when that takes longer than about 20 s it answers the last balance with refreshing: true and finishes in the background (call wallet_balance again in 30 s). A balance with refreshing: true and refreshReason is exact (payment_settling: a payment settles and the number counts it; account_join: the wallet joins its own balance parts and the number counts them; pool_move: value from the old pool arrives and the number counts it; first_check: a new wallet's first history check, the number is its own landed deposits). status reading (balanceAtomic null): the first balance read of a wallet that may hold money is not done; call wallet_balance again in 30 s. If the public read fails, unshieldedAtomic is null with unshieldedReason; the rest still answers. ownKeyTokens (only when there are any): the other tokens on ownAddress (not its USDC), each { mint, amountAtomic, decimals, amount }, at most 10 (ownKeyTokensMore counts the rest); a token is its mint, never a name or symbol; wallet_transfer_token with that mint as token_mint sells one and sends the USDC privately. earlierDeposits (only when there are any): USDC found at a one-time deposit address of an earlier pool, each with a notice line to tell the user; the wallet moves it into the current pool by itself. addFunds (only when there are any): each wallet_add_funds address still open, with its state and the USDC known to wait there (heldAtomic; null with heldNote when the address was not checked yet). landingAtomic (only when not 0): USDC you added whose deposit landed on chain and that balanceAtomic does not count yet; this call finishes it and waits about 20 s for it, past that it is being counted: call wallet_balance again as next says (at once in the same turn when this call waited its 20 s, else in 30 s). session shows the spending limits (null or "none": no limit), what is left, where the limits come from, and how to change them (session.summary). verbose: true adds \`internal\` (accounts, notes, and other engineering numbers); the default answer leaves them out. To add money, use wallet_add_funds. Amounts are atomic units (USDC: 1000000 = 1 USDC); say and usdc give them in USDC.`,
|
|
119331
119378
|
inputSchema: { type: "object", properties: {
|
|
119332
119379
|
verbose: { type: "boolean", description: "Optional. true adds `internal`: the engineering numbers (funded accounts, notes, payments without waiting, a 0 set-aside value). Default false." }
|
|
119333
119380
|
}, additionalProperties: false },
|
|
@@ -119528,7 +119575,8 @@ ${canonical5}`;
|
|
|
119528
119575
|
if (typeof amount === "bigint" && amount > 0n) landingAtomic += amount;
|
|
119529
119576
|
}
|
|
119530
119577
|
}
|
|
119531
|
-
const
|
|
119578
|
+
const landedWaitedFull = Date.now() - balanceStartedAt >= balanceRefreshWaitMs;
|
|
119579
|
+
const landedNext = landingAtomic > 0n && !refresh.refreshError ? landedWaitedFull ? `${usdcText2(landingAtomic)} USDC you added landed on chain and is being counted (landingAtomic, not in balanceAtomic yet): call wallet_balance again now, in this same turn; that call waits up to ${waitSeconds} s for it. Do not end the turn or ask the user: it needs no step from them` : `${usdcText2(landingAtomic)} USDC you added landed on chain and is being counted (landingAtomic, not in balanceAtomic yet): call wallet_balance again in ${POLL_SECONDS3} s; that call waits up to ${waitSeconds} s for it. Tell the user it needs no step from them` : void 0;
|
|
119532
119580
|
if (landedNext) next = landedNext;
|
|
119533
119581
|
const stalled = [...resumeRefusals].map(([requestId, error2]) => `"${requestId}" (${error2})`);
|
|
119534
119582
|
if (stalled.length && one.breakdown?.privateSendPendingAtomic !== "0") {
|