shinjuku-shield 0.3.219 → 0.3.220
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/manifest.json +6 -6
- package/package.json +3 -3
- package/shinjuku-seller.mjs +70 -13
- package/shinjuku-wallet.mjs +208 -44
package/README.md
CHANGED
|
@@ -5,12 +5,12 @@ web services and AI answers from your private balance, so the payment does
|
|
|
5
5
|
not show who paid. It works inside your AI app (Claude, Cursor, Codex) and in
|
|
6
6
|
a terminal. Only you hold the keys: they never leave your computer.
|
|
7
7
|
|
|
8
|
-
This is version 0.3.
|
|
8
|
+
This is version 0.3.220. The command is `shinjuku`.
|
|
9
9
|
|
|
10
10
|
## Set up
|
|
11
11
|
|
|
12
12
|
```sh
|
|
13
|
-
npx -y shinjuku@0.3.
|
|
13
|
+
npx -y shinjuku@0.3.220 setup
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
Setup does every step for you:
|
|
@@ -100,7 +100,7 @@ Add it yourself. The name of the wallet in your app is `shinjuku`.
|
|
|
100
100
|
Claude Code:
|
|
101
101
|
|
|
102
102
|
```sh
|
|
103
|
-
claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.
|
|
103
|
+
claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.220 mcp
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
## For builders: check what you install
|
|
@@ -116,7 +116,7 @@ with the Releases table in
|
|
|
116
116
|
Versions are published from GitHub Actions with npm provenance.
|
|
117
117
|
|
|
118
118
|
`shinjuku-shield` is the package that holds the wallet. `shinjuku-shielded`
|
|
119
|
-
0.3.
|
|
119
|
+
0.3.220, its older name, runs this package at the same version, so wallets
|
|
120
120
|
installed under that name keep updating. New installs use `shinjuku`.
|
|
121
121
|
|
|
122
122
|
The full guide is
|
package/manifest.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "carbon-shielded-wallet/bundle-manifest/v1",
|
|
3
3
|
"file": "shinjuku-wallet.mjs",
|
|
4
|
-
"sha256": "
|
|
5
|
-
"bytes":
|
|
6
|
-
"sourceCommit": "
|
|
4
|
+
"sha256": "a910db1e1c876a207fdc040c809315913121206f32723a9d87192c8a75a7823c",
|
|
5
|
+
"bytes": 10294711,
|
|
6
|
+
"sourceCommit": "a4a5fa17d6f6c9ef6009c96dfdb3255bcd674e72",
|
|
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",
|
|
@@ -1075,8 +1075,8 @@
|
|
|
1075
1075
|
],
|
|
1076
1076
|
"seller": {
|
|
1077
1077
|
"file": "shinjuku-seller.mjs",
|
|
1078
|
-
"sha256": "
|
|
1079
|
-
"bytes":
|
|
1078
|
+
"sha256": "7e40398886e63df2a3981ac6603e19ff0772b5c86162e65e64ac1f5c0a7dce32",
|
|
1079
|
+
"bytes": 4182275,
|
|
1080
1080
|
"entry": "wallet/src/seller/exact/index.mjs",
|
|
1081
1081
|
"external": [
|
|
1082
1082
|
"@x402/core/http",
|
|
@@ -1968,5 +1968,5 @@
|
|
|
1968
1968
|
}
|
|
1969
1969
|
]
|
|
1970
1970
|
},
|
|
1971
|
-
"publishedAt": "2026-11-
|
|
1971
|
+
"publishedAt": "2026-11-12T15:31:01.378Z"
|
|
1972
1972
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinjuku-shield",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.220",
|
|
4
4
|
"mcpName": "io.github.ShinjukuStaition/shinjuku-shield",
|
|
5
5
|
"description": "Shinjuku Shield, private x402 payments on Solana: the self-custody wallet CLI and its MCP server. Shield, pay, and unshield USDC from any MCP agent, under caps you set.",
|
|
6
|
-
"shinjukuRelease": "
|
|
7
|
-
"shinjukuSha256": "
|
|
6
|
+
"shinjukuRelease": "a910db1e",
|
|
7
|
+
"shinjukuSha256": "a910db1e1c876a207fdc040c809315913121206f32723a9d87192c8a75a7823c",
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
9
9
|
"author": "Shinjuku Shield",
|
|
10
10
|
"homepage": "https://github.com/ShinjukuStaition/shinjuku-shield#readme",
|
package/shinjuku-seller.mjs
CHANGED
|
@@ -60816,6 +60816,7 @@ async function compactP03HistoryReportRun({
|
|
|
60816
60816
|
poolPreRead,
|
|
60817
60817
|
firstPreRead,
|
|
60818
60818
|
onList,
|
|
60819
|
+
onUnlist,
|
|
60819
60820
|
tailGrid,
|
|
60820
60821
|
heldPicks = {},
|
|
60821
60822
|
signal,
|
|
@@ -60992,6 +60993,10 @@ async function compactP03HistoryReportRun({
|
|
|
60992
60993
|
} catch (error) {
|
|
60993
60994
|
if (tailHit === void 0 || !TAIL_RETRY_REFUSALS.has(error?.compactHistoryRefusal)) throw error;
|
|
60994
60995
|
markPhase("compact-tail-refused-page0");
|
|
60996
|
+
try {
|
|
60997
|
+
onUnlist?.();
|
|
60998
|
+
} catch {
|
|
60999
|
+
}
|
|
60995
61000
|
readAgain = true;
|
|
60996
61001
|
lastFolds.delete(poolKey.toBase58());
|
|
60997
61002
|
try {
|
|
@@ -62014,10 +62019,17 @@ async function loadWalletP03History(args) {
|
|
|
62014
62019
|
const walkOwn = (signal) => {
|
|
62015
62020
|
ownStartedAt = Date.now();
|
|
62016
62021
|
const stop = new AbortController();
|
|
62017
|
-
const loading = loadWalletP03HistoryNow({ ...walkArgs, signal: stop.signal });
|
|
62018
62022
|
let entry;
|
|
62023
|
+
const loading = loadWalletP03HistoryNow({
|
|
62024
|
+
...walkArgs,
|
|
62025
|
+
signal: stop.signal,
|
|
62026
|
+
onListed: (listed) => {
|
|
62027
|
+
if (entry !== void 0) setListed(entry, listed);
|
|
62028
|
+
}
|
|
62029
|
+
});
|
|
62019
62030
|
if (joinable) {
|
|
62020
62031
|
entry = { startedAt: ownStartedAt, promise: loading, joined: false };
|
|
62032
|
+
endListed(entry);
|
|
62021
62033
|
sharedWalks.set(runKey, entry);
|
|
62022
62034
|
const ended2 = () => {
|
|
62023
62035
|
if (sharedWalks.get(runKey) === entry) sharedWalks.delete(runKey);
|
|
@@ -62041,7 +62053,7 @@ async function loadWalletP03History(args) {
|
|
|
62041
62053
|
prewarm.promise,
|
|
62042
62054
|
walkOwn,
|
|
62043
62055
|
"walk-prewarm-share",
|
|
62044
|
-
{ listed: () => prewarm.listedAt !== void 0 }
|
|
62056
|
+
{ listed: () => prewarm.listedAt !== void 0, unlisted: () => whenUnlisted(prewarm) }
|
|
62045
62057
|
);
|
|
62046
62058
|
if (taken?.own === true) return ownReport(taken.report);
|
|
62047
62059
|
if (taken !== void 0) {
|
|
@@ -62065,7 +62077,8 @@ async function loadWalletP03History(args) {
|
|
|
62065
62077
|
return loadWalletP03HistoryNow({ ...args, signal });
|
|
62066
62078
|
}, joinedRefresh ? "walk-joined-refresh" : "walk-prewarm", {
|
|
62067
62079
|
...joinedRefresh ? { untilMs: prewarm.ownAtMs } : {},
|
|
62068
|
-
listed: () => prewarm.listedAt !== void 0
|
|
62080
|
+
listed: () => prewarm.listedAt !== void 0,
|
|
62081
|
+
unlisted: () => whenUnlisted(prewarm)
|
|
62069
62082
|
});
|
|
62070
62083
|
if (taken?.own === true) {
|
|
62071
62084
|
if (runKey !== void 0) recentLoads.set(runKey, { startedAt: ownStartedAt, report: taken.report });
|
|
@@ -62095,7 +62108,7 @@ async function loadWalletP03History(args) {
|
|
|
62095
62108
|
const taken = await joinedWalkOrOwn(shared2.promise, (signal) => {
|
|
62096
62109
|
ownStartedAt = Date.now();
|
|
62097
62110
|
return loadWalletP03HistoryNow({ ...args, signal });
|
|
62098
|
-
}, "walk-shared");
|
|
62111
|
+
}, "walk-shared", { listed: () => shared2.listedAt !== void 0, unlisted: () => whenUnlisted(shared2) });
|
|
62099
62112
|
if (taken?.own === true) {
|
|
62100
62113
|
recentLoads.set(runKey, { startedAt: ownStartedAt, report: taken.report });
|
|
62101
62114
|
return taken.report;
|
|
@@ -62136,7 +62149,30 @@ function recentBeforePrewarm(runKey, prewarm) {
|
|
|
62136
62149
|
markPhase("walk-recent-before-prewarm");
|
|
62137
62150
|
return recent.report;
|
|
62138
62151
|
}
|
|
62139
|
-
|
|
62152
|
+
function setListed(entry, listed) {
|
|
62153
|
+
if (listed !== false) {
|
|
62154
|
+
entry.listedAt ??= Date.now();
|
|
62155
|
+
return;
|
|
62156
|
+
}
|
|
62157
|
+
if (entry.listedAt === void 0) return;
|
|
62158
|
+
entry.listedAt = void 0;
|
|
62159
|
+
const waiters = entry.unlistedWaiters;
|
|
62160
|
+
entry.unlistedWaiters = void 0;
|
|
62161
|
+
for (const wake of waiters ?? []) wake();
|
|
62162
|
+
}
|
|
62163
|
+
function whenUnlisted(entry) {
|
|
62164
|
+
const own = entry.of ?? entry;
|
|
62165
|
+
return new Promise((resolve18) => {
|
|
62166
|
+
(own.unlistedWaiters ??= /* @__PURE__ */ new Set()).add(resolve18);
|
|
62167
|
+
});
|
|
62168
|
+
}
|
|
62169
|
+
function endListed(entry) {
|
|
62170
|
+
const end = () => {
|
|
62171
|
+
entry.unlistedWaiters = void 0;
|
|
62172
|
+
};
|
|
62173
|
+
entry.promise.then(end, end);
|
|
62174
|
+
}
|
|
62175
|
+
async function joinedWalkOrOwn(joined, startOwn, mark, { untilMs = Date.now() + SHARED_WALK_WAIT_MS, listed, unlisted } = {}) {
|
|
62140
62176
|
const isReport = (report) => report !== null && typeof report === "object";
|
|
62141
62177
|
let timer;
|
|
62142
62178
|
let first;
|
|
@@ -62154,12 +62190,16 @@ async function joinedWalkOrOwn(joined, startOwn, mark, { untilMs = Date.now() +
|
|
|
62154
62190
|
markPhase(`${mark}-slow`);
|
|
62155
62191
|
if (listed?.() === true) {
|
|
62156
62192
|
markPhase(`${mark}-listed-wait`);
|
|
62193
|
+
const dropped = unlisted?.()?.then(() => JOINED_WALK_UNLISTED);
|
|
62194
|
+
let waited;
|
|
62157
62195
|
try {
|
|
62158
|
-
|
|
62159
|
-
return isReport(report) ? { own: false, report } : void 0;
|
|
62196
|
+
waited = await (dropped ? Promise.race([joined, dropped]) : joined);
|
|
62160
62197
|
} catch {
|
|
62161
62198
|
return void 0;
|
|
62162
62199
|
}
|
|
62200
|
+
if (waited !== JOINED_WALK_UNLISTED) return isReport(waited) ? { own: false, report: waited } : void 0;
|
|
62201
|
+
if (runEnded()) return void 0;
|
|
62202
|
+
markPhase(`${mark}-listed-dropped`);
|
|
62163
62203
|
}
|
|
62164
62204
|
const stop = new AbortController();
|
|
62165
62205
|
const own = startOwn(stop.signal);
|
|
@@ -62213,6 +62253,10 @@ async function loadWalletP03HistoryNow(args) {
|
|
|
62213
62253
|
if (!await channelMovedSince(startedAt)) throw error;
|
|
62214
62254
|
if (args.signal?.aborted) throw error;
|
|
62215
62255
|
markPhase("walk-channel-refreshed");
|
|
62256
|
+
try {
|
|
62257
|
+
args.onListed?.(false);
|
|
62258
|
+
} catch {
|
|
62259
|
+
}
|
|
62216
62260
|
startedAt = Date.now();
|
|
62217
62261
|
report = await untilHistorySourceSilent(walkWalletP03HistoryNow(args), startedAt);
|
|
62218
62262
|
}
|
|
@@ -62463,11 +62507,13 @@ async function compactFirst({
|
|
|
62463
62507
|
// `onListed` (PF146 (a), 2026-10-30: its pages passed; the fold and the deployment check follow).
|
|
62464
62508
|
...typeof onCompactList === "function" || typeof onListed === "function" ? { onList: (contexts) => {
|
|
62465
62509
|
try {
|
|
62466
|
-
onListed?.();
|
|
62510
|
+
onListed?.(true);
|
|
62467
62511
|
} catch {
|
|
62468
62512
|
}
|
|
62469
62513
|
onCompactList?.(contexts);
|
|
62470
62514
|
} } : {},
|
|
62515
|
+
// compact.mjs's cached-tail retry throws its first list away inside one try.
|
|
62516
|
+
...typeof onListed === "function" ? { onUnlist: () => onListed(false) } : {},
|
|
62471
62517
|
...signal !== void 0 ? { signal } : {},
|
|
62472
62518
|
// A program upgrade the list's pool read or deployment check meets: the AB175 channel fetch inside this read (compact.mjs
|
|
62473
62519
|
// programUpgrade), so the check runs again on this list instead of a second walk asking the page set again. It waits
|
|
@@ -62496,6 +62542,12 @@ async function compactFirst({
|
|
|
62496
62542
|
...firstPreRead !== void 0 ? { firstPreRead } : {}
|
|
62497
62543
|
} : options);
|
|
62498
62544
|
behindAnswer = void 0;
|
|
62545
|
+
if (!result.ok) {
|
|
62546
|
+
try {
|
|
62547
|
+
onListed?.(false);
|
|
62548
|
+
} catch {
|
|
62549
|
+
}
|
|
62550
|
+
}
|
|
62499
62551
|
if (!result.ok && signal?.aborted) throw signal.reason;
|
|
62500
62552
|
if (result.ok) {
|
|
62501
62553
|
markPhase("walk-compact");
|
|
@@ -62719,7 +62771,7 @@ function reportHistoryRpc(split3, source, result, crossChecked, rpcName) {
|
|
|
62719
62771
|
writeStderr(`history: ${who} answered ${list(split3.history)}; ${rpcName} answered ${list(split3.own)} (the pool's state on chain that the history must match, and the cross-check)${window2}${integrity}
|
|
62720
62772
|
`);
|
|
62721
62773
|
}
|
|
62722
|
-
var strictScope, recentScope, recentLoads, recentAgeStart, proofBuiltAt, historyCacheKey, sweptFolders, HISTORY_PREWARM_JOIN_MS, SHARED_WALK_WAIT_MS, JOINED_WALK_SLOW, PAGE0_PREREAD_AFTER_MS, SUBTREE_LEAVES4, prewarmedWalks, sharedWalks, PREWARMED_REPORTS, PAYMENT_TAKEN_REPORTS, REPORT_STARTED_AT, upgradeRefresh, upgradeRefreshRunning, upgradeRefreshTriedAt, UPGRADE_REFRESH_GAP_MS, behindPollMs, COMPACT_BEHIND_POLL_MS, COMPACT_BEHIND_POLL_MAX_MS, COMPACT_BEHIND_READ_MS, COMPACT_BEHIND_TOR_READ_MS, COMPACT_BEHIND_REFUSAL_MAX_BYTES, COMPACT_BEHIND_PAGE_BODY_MS, COMPACT_BEHIND_RETRY_MS, lastRunReports, writeStderr, OWN_WALK_STEPS, announcedSources, ownSourceWords;
|
|
62774
|
+
var strictScope, recentScope, recentLoads, recentAgeStart, proofBuiltAt, historyCacheKey, sweptFolders, HISTORY_PREWARM_JOIN_MS, SHARED_WALK_WAIT_MS, JOINED_WALK_SLOW, JOINED_WALK_UNLISTED, PAGE0_PREREAD_AFTER_MS, SUBTREE_LEAVES4, prewarmedWalks, sharedWalks, PREWARMED_REPORTS, PAYMENT_TAKEN_REPORTS, REPORT_STARTED_AT, upgradeRefresh, upgradeRefreshRunning, upgradeRefreshTriedAt, UPGRADE_REFRESH_GAP_MS, behindPollMs, COMPACT_BEHIND_POLL_MS, COMPACT_BEHIND_POLL_MAX_MS, COMPACT_BEHIND_READ_MS, COMPACT_BEHIND_TOR_READ_MS, COMPACT_BEHIND_REFUSAL_MAX_BYTES, COMPACT_BEHIND_PAGE_BODY_MS, COMPACT_BEHIND_RETRY_MS, lastRunReports, writeStderr, OWN_WALK_STEPS, announcedSources, ownSourceWords;
|
|
62723
62775
|
var init_walletHistory = __esm({
|
|
62724
62776
|
"wallet/src/history/walletHistory.mjs"() {
|
|
62725
62777
|
"use strict";
|
|
@@ -62746,6 +62798,7 @@ var init_walletHistory = __esm({
|
|
|
62746
62798
|
HISTORY_PREWARM_JOIN_MS = 1e4;
|
|
62747
62799
|
SHARED_WALK_WAIT_MS = 6e3;
|
|
62748
62800
|
JOINED_WALK_SLOW = /* @__PURE__ */ Symbol("joined_walk_slow");
|
|
62801
|
+
JOINED_WALK_UNLISTED = /* @__PURE__ */ Symbol("joined_walk_unlisted");
|
|
62749
62802
|
PAGE0_PREREAD_AFTER_MS = 4e4;
|
|
62750
62803
|
SUBTREE_LEAVES4 = 128n;
|
|
62751
62804
|
prewarmedWalks = /* @__PURE__ */ new Map();
|
|
@@ -70442,7 +70495,7 @@ function computeBalance({ store, snapshotRead, source = "local", now = Date.now(
|
|
|
70442
70495
|
let heldAtomic;
|
|
70443
70496
|
let heldWholeAtomic;
|
|
70444
70497
|
let spareMost = 0n;
|
|
70445
|
-
const report = (status, gross, next2, cause, largest2, change, changes) => {
|
|
70498
|
+
const report = (status, gross, next2, cause, largest2, change, changes, restOther) => {
|
|
70446
70499
|
const atomic4 = gross === null || privateSendPending === null ? null : gross > privateSendPending ? gross - privateSendPending : 0n;
|
|
70447
70500
|
if (atomic4 !== null && BigInt(detail.belowAccountsAtomic ?? "0") > atomic4) detail.belowAccountsAtomic = atomic4.toString();
|
|
70448
70501
|
const built = {
|
|
@@ -70485,6 +70538,7 @@ function computeBalance({ store, snapshotRead, source = "local", now = Date.now(
|
|
|
70485
70538
|
if (change !== void 0 && one === 0n && atomic4 > 0n) {
|
|
70486
70539
|
CHANGE_SETTLING.set(built, (change < atomic4 ? change : atomic4).toString());
|
|
70487
70540
|
if (Number.isSafeInteger(changes) && changes >= 2) CHANGE_COUNT.set(built, changes);
|
|
70541
|
+
if (restOther === true) CHANGE_REST_OTHER.add(built);
|
|
70488
70542
|
}
|
|
70489
70543
|
}
|
|
70490
70544
|
return built;
|
|
@@ -70811,7 +70865,8 @@ If a payment to this wallet settled, read the chain again with:
|
|
|
70811
70865
|
return change > most ? change : most;
|
|
70812
70866
|
}, 0n);
|
|
70813
70867
|
const changeFreeAtomic = sendHold === null || sendHold.unpacked.length === 0 ? changeAtomic : changeAtomic > privateSendPending ? changeAtomic - privateSendPending : 0n;
|
|
70814
|
-
const
|
|
70868
|
+
const restAtomic = sendHeldAtomic === null ? null : unspentAtomic - sendHeldAtomic - inputsAtomic;
|
|
70869
|
+
const changeOnly = settling.length > 0 && distinctInputs && (settling.length === 1 || sendHeldAtomic === 0n && privateSendPending === 0n) && settling.every((payment) => payment.join !== true && payment.exit !== true && inputsOf(payment) > payment.amountAtomic) && reservedAtomic === 0n && detail.joiningAtomic === "0" && successionMovableAtomic === 0n && restAtomic !== null && restAtomic >= 0n && changeFreeAtomic > 0n;
|
|
70815
70870
|
return report(
|
|
70816
70871
|
"stale",
|
|
70817
70872
|
spendable + successionMovableAtomic,
|
|
@@ -70821,7 +70876,8 @@ If a payment to this wallet settled, read the chain again with:
|
|
|
70821
70876
|
settlingRecent ? movedInAtomic === 0n && settling.length > 0 && settling.every((payment) => payment.join) ? "account_join" : "payment_settling" : movedInAtomic > 0n ? "pool_move" : void 0,
|
|
70822
70877
|
largest,
|
|
70823
70878
|
changeOnly ? changeFreeAtomic : void 0,
|
|
70824
|
-
settling.length
|
|
70879
|
+
settling.length,
|
|
70880
|
+
changeOnly && restAtomic > 0n
|
|
70825
70881
|
);
|
|
70826
70882
|
}
|
|
70827
70883
|
const newestSale = store.path ? newestSalePaidAt(store.path) : void 0;
|
|
@@ -70831,7 +70887,7 @@ If a payment to this wallet settled, read the chain again with:
|
|
|
70831
70887
|
}
|
|
70832
70888
|
return report("current", spendable + successionMovableAtomic, next, void 0, largest);
|
|
70833
70889
|
}
|
|
70834
|
-
var PAY_ME_WAL_SCHEMA, BALANCE_SNAPSHOT_SCHEMA, BALANCE_SNAPSHOT_FILE, STALE_CAUSES, LARGEST_PAYMENTS, CHANGE_SETTLING, CHANGE_COUNT, SPEND_INPUTS, SEND_HOLDS, PAYMENT_SETTLING_MS, NO_VALUE_TYPES, PLAN_ONLY_TYPES, UNSENT_SELF_PAY_FIELDS, isUnsentSelfPay, planOnly, SNAPSHOT_KEY_LABEL, MAINNET_USDC, SELF_PAY_ORIGIN, POCKET_FILL_RECORD, MERGE_RECORD, POOL_MOVE_SCHEMA, FLOAT_PAYMENT_SCHEMA, POOL_MOVE_PATH, POOL_SUCCESSION_SCHEMAS, digestKey, canonicalAtomic, SUCCESSION_JOB_SCHEMA, MERGE_PAYMENT_PATH, spendEntry, PROOF_RECORD;
|
|
70890
|
+
var PAY_ME_WAL_SCHEMA, BALANCE_SNAPSHOT_SCHEMA, BALANCE_SNAPSHOT_FILE, STALE_CAUSES, LARGEST_PAYMENTS, CHANGE_SETTLING, CHANGE_COUNT, CHANGE_REST_OTHER, SPEND_INPUTS, SEND_HOLDS, PAYMENT_SETTLING_MS, NO_VALUE_TYPES, PLAN_ONLY_TYPES, UNSENT_SELF_PAY_FIELDS, isUnsentSelfPay, planOnly, SNAPSHOT_KEY_LABEL, MAINNET_USDC, SELF_PAY_ORIGIN, POCKET_FILL_RECORD, MERGE_RECORD, POOL_MOVE_SCHEMA, FLOAT_PAYMENT_SCHEMA, POOL_MOVE_PATH, POOL_SUCCESSION_SCHEMAS, digestKey, canonicalAtomic, SUCCESSION_JOB_SCHEMA, MERGE_PAYMENT_PATH, spendEntry, PROOF_RECORD;
|
|
70835
70891
|
var init_balance = __esm({
|
|
70836
70892
|
"wallet/src/balance/balance.mjs"() {
|
|
70837
70893
|
"use strict";
|
|
@@ -70856,6 +70912,7 @@ var init_balance = __esm({
|
|
|
70856
70912
|
LARGEST_PAYMENTS = /* @__PURE__ */ new WeakMap();
|
|
70857
70913
|
CHANGE_SETTLING = /* @__PURE__ */ new WeakMap();
|
|
70858
70914
|
CHANGE_COUNT = /* @__PURE__ */ new WeakMap();
|
|
70915
|
+
CHANGE_REST_OTHER = /* @__PURE__ */ new WeakSet();
|
|
70859
70916
|
SPEND_INPUTS = /* @__PURE__ */ new WeakMap();
|
|
70860
70917
|
SEND_HOLDS = /* @__PURE__ */ new WeakMap();
|
|
70861
70918
|
PAYMENT_SETTLING_MS = 12e4;
|
package/shinjuku-wallet.mjs
CHANGED
|
@@ -44470,6 +44470,7 @@ async function routeOverOnions(argv2, {
|
|
|
44470
44470
|
onions: [...onions, ...spares],
|
|
44471
44471
|
live: onions.length,
|
|
44472
44472
|
spares,
|
|
44473
|
+
spareAfterMs,
|
|
44473
44474
|
waitMs: routeWaitMs,
|
|
44474
44475
|
label: origin,
|
|
44475
44476
|
// The line names the time and the spare wait, so a live run counts how often and when the spares join.
|
|
@@ -44499,10 +44500,11 @@ async function routeOverOnions(argv2, {
|
|
|
44499
44500
|
onions: [...onions, ...spares],
|
|
44500
44501
|
live: onions.length,
|
|
44501
44502
|
spares,
|
|
44503
|
+
spareAfterMs: HISTORY_SPARE_AFTER_MS,
|
|
44502
44504
|
path: HISTORY_PROBE_PATH,
|
|
44503
44505
|
label: "the history proxy",
|
|
44504
44506
|
kind: "history",
|
|
44505
|
-
onSpares: ({ afterMs, cause }) => err(`tor: the ${spares.length} spare history-proxy onion ${spareHosts} comes into use after ${(afterMs / 1e3).toFixed(1)} s (${SPARE_CAUSE[cause]}; the spare wait is ${
|
|
44507
|
+
onSpares: ({ afterMs, cause }) => err(`tor: the ${spares.length} spare history-proxy onion ${spareHosts} comes into use after ${(afterMs / 1e3).toFixed(1)} s (${SPARE_CAUSE[cause]}; the spare wait is ${HISTORY_SPARE_AFTER_MS / 1e3} s; Tor may still be fetching the onion addresses)
|
|
44506
44508
|
`),
|
|
44507
44509
|
onNone: () => err(`tor: no history-proxy onion answered its start probe (${liveOnions(group).length} tried); the pool history reads go to the pinned onion ${hostOf(onions[0])} and wait for it
|
|
44508
44510
|
`)
|
|
@@ -44595,7 +44597,7 @@ async function routeOverOnions(argv2, {
|
|
|
44595
44597
|
const spares = group.spares ?? [];
|
|
44596
44598
|
group.startSpares = race(group, liveOnions(group), {
|
|
44597
44599
|
...group.onNone ? { onNone: group.onNone } : {},
|
|
44598
|
-
...spares.length > 0 ? { spares, spareAfterMs, onSpares: (info) => {
|
|
44600
|
+
...spares.length > 0 ? { spares, spareAfterMs: group.spareAfterMs, onSpares: (info) => {
|
|
44599
44601
|
group.live = group.onions.length;
|
|
44600
44602
|
group.onSpares?.(info);
|
|
44601
44603
|
} } : {}
|
|
@@ -44821,7 +44823,7 @@ async function routeOverOnions(argv2, {
|
|
|
44821
44823
|
}
|
|
44822
44824
|
};
|
|
44823
44825
|
}
|
|
44824
|
-
var SITE_ONIONS, SITE_SPARE_ONIONS, PINNED_FACILITATOR_ONIONS, PINNED_SPARE_ONIONS, HISTORY_ONIONS, HISTORY_SPARE_ONIONS, PINNED_HISTORY_ONIONS, PINNED_HISTORY_SPARE_ONIONS, HISTORY_PROBE_PATH, SITE_PROBE_PATH, SITE_PROBE_ANSWERS, KEPT_ANSWER_MS, KEPT_ANSWER_BYTES, KEPT_BODY_MS, FACILITATOR_FLAGS, V3_ONION, DISCOVERY_TIMEOUT_MS, WARM_TIMEOUT_MS, RACE_TIMEOUT_MS, ROUTE_WAIT_MS, SPARE_AFTER_MS, HEDGE_MS, streamScope, requestStreams, socketRequests, guarded, STREAM_CHANNELS, streamSubscribers, streamWords, streamText, RESEND_LABELS, CHAIN_WAIT_LABELS, SPARE_CAUSE, routedGroups, liveOnions, hostOf, noAnswer, routedOnions, routedOrigins, onionsOfOrigin, routesOverOnion, routedGroupOf, answeredOn, noteAnswered, firstRaces, firstRaceRecords, firstRacesMarked, roleOf, ROUTE_LABELS, requestLabel, moveRecords, moveTimingLog, writeMove, firstOnionRace, onionDispatchers, ownTag, ownTagDispatchers, onOwnTagNow, ownTagInit;
|
|
44826
|
+
var SITE_ONIONS, SITE_SPARE_ONIONS, PINNED_FACILITATOR_ONIONS, PINNED_SPARE_ONIONS, HISTORY_ONIONS, HISTORY_SPARE_ONIONS, PINNED_HISTORY_ONIONS, PINNED_HISTORY_SPARE_ONIONS, HISTORY_PROBE_PATH, SITE_PROBE_PATH, SITE_PROBE_ANSWERS, KEPT_ANSWER_MS, KEPT_ANSWER_BYTES, KEPT_BODY_MS, FACILITATOR_FLAGS, V3_ONION, DISCOVERY_TIMEOUT_MS, WARM_TIMEOUT_MS, RACE_TIMEOUT_MS, ROUTE_WAIT_MS, SPARE_AFTER_MS, HISTORY_SPARE_AFTER_MS, HEDGE_MS, streamScope, requestStreams, socketRequests, guarded, STREAM_CHANNELS, streamSubscribers, streamWords, streamText, RESEND_LABELS, CHAIN_WAIT_LABELS, SPARE_CAUSE, routedGroups, liveOnions, hostOf, noAnswer, routedOnions, routedOrigins, onionsOfOrigin, routesOverOnion, routedGroupOf, answeredOn, noteAnswered, firstRaces, firstRaceRecords, firstRacesMarked, roleOf, ROUTE_LABELS, requestLabel, moveRecords, moveTimingLog, writeMove, firstOnionRace, onionDispatchers, ownTag, ownTagDispatchers, onOwnTagNow, ownTagInit;
|
|
44825
44827
|
var init_facilitatorOnion = __esm({
|
|
44826
44828
|
"wallet/src/net/facilitatorOnion.mjs"() {
|
|
44827
44829
|
"use strict";
|
|
@@ -44863,7 +44865,8 @@ var init_facilitatorOnion = __esm({
|
|
|
44863
44865
|
WARM_TIMEOUT_MS = 3e4;
|
|
44864
44866
|
RACE_TIMEOUT_MS = 9e4;
|
|
44865
44867
|
ROUTE_WAIT_MS = 15e3;
|
|
44866
|
-
SPARE_AFTER_MS =
|
|
44868
|
+
SPARE_AFTER_MS = 4e3;
|
|
44869
|
+
HISTORY_SPARE_AFTER_MS = 8e3;
|
|
44867
44870
|
HEDGE_MS = 5e3;
|
|
44868
44871
|
streamScope = new AsyncLocalStorage2();
|
|
44869
44872
|
requestStreams = /* @__PURE__ */ new WeakMap();
|
|
@@ -65452,6 +65455,7 @@ async function compactP03HistoryReportRun({
|
|
|
65452
65455
|
poolPreRead,
|
|
65453
65456
|
firstPreRead,
|
|
65454
65457
|
onList,
|
|
65458
|
+
onUnlist,
|
|
65455
65459
|
tailGrid,
|
|
65456
65460
|
heldPicks = {},
|
|
65457
65461
|
signal,
|
|
@@ -65628,6 +65632,10 @@ async function compactP03HistoryReportRun({
|
|
|
65628
65632
|
} catch (error) {
|
|
65629
65633
|
if (tailHit === void 0 || !TAIL_RETRY_REFUSALS.has(error?.compactHistoryRefusal)) throw error;
|
|
65630
65634
|
markPhase("compact-tail-refused-page0");
|
|
65635
|
+
try {
|
|
65636
|
+
onUnlist?.();
|
|
65637
|
+
} catch {
|
|
65638
|
+
}
|
|
65631
65639
|
readAgain = true;
|
|
65632
65640
|
lastFolds.delete(poolKey.toBase58());
|
|
65633
65641
|
try {
|
|
@@ -66651,10 +66659,17 @@ async function loadWalletP03History(args) {
|
|
|
66651
66659
|
const walkOwn = (signal) => {
|
|
66652
66660
|
ownStartedAt = Date.now();
|
|
66653
66661
|
const stop2 = new AbortController();
|
|
66654
|
-
const loading = loadWalletP03HistoryNow({ ...walkArgs, signal: stop2.signal });
|
|
66655
66662
|
let entry;
|
|
66663
|
+
const loading = loadWalletP03HistoryNow({
|
|
66664
|
+
...walkArgs,
|
|
66665
|
+
signal: stop2.signal,
|
|
66666
|
+
onListed: (listed) => {
|
|
66667
|
+
if (entry !== void 0) setListed(entry, listed);
|
|
66668
|
+
}
|
|
66669
|
+
});
|
|
66656
66670
|
if (joinable) {
|
|
66657
66671
|
entry = { startedAt: ownStartedAt, promise: loading, joined: false };
|
|
66672
|
+
endListed(entry);
|
|
66658
66673
|
sharedWalks.set(runKey, entry);
|
|
66659
66674
|
const ended2 = () => {
|
|
66660
66675
|
if (sharedWalks.get(runKey) === entry) sharedWalks.delete(runKey);
|
|
@@ -66678,7 +66693,7 @@ async function loadWalletP03History(args) {
|
|
|
66678
66693
|
prewarm.promise,
|
|
66679
66694
|
walkOwn,
|
|
66680
66695
|
"walk-prewarm-share",
|
|
66681
|
-
{ listed: () => prewarm.listedAt !== void 0 }
|
|
66696
|
+
{ listed: () => prewarm.listedAt !== void 0, unlisted: () => whenUnlisted(prewarm) }
|
|
66682
66697
|
);
|
|
66683
66698
|
if (taken?.own === true) return ownReport(taken.report);
|
|
66684
66699
|
if (taken !== void 0) {
|
|
@@ -66702,7 +66717,8 @@ async function loadWalletP03History(args) {
|
|
|
66702
66717
|
return loadWalletP03HistoryNow({ ...args, signal });
|
|
66703
66718
|
}, joinedRefresh ? "walk-joined-refresh" : "walk-prewarm", {
|
|
66704
66719
|
...joinedRefresh ? { untilMs: prewarm.ownAtMs } : {},
|
|
66705
|
-
listed: () => prewarm.listedAt !== void 0
|
|
66720
|
+
listed: () => prewarm.listedAt !== void 0,
|
|
66721
|
+
unlisted: () => whenUnlisted(prewarm)
|
|
66706
66722
|
});
|
|
66707
66723
|
if (taken?.own === true) {
|
|
66708
66724
|
if (runKey !== void 0) recentLoads.set(runKey, { startedAt: ownStartedAt, report: taken.report });
|
|
@@ -66732,7 +66748,7 @@ async function loadWalletP03History(args) {
|
|
|
66732
66748
|
const taken = await joinedWalkOrOwn(shared2.promise, (signal) => {
|
|
66733
66749
|
ownStartedAt = Date.now();
|
|
66734
66750
|
return loadWalletP03HistoryNow({ ...args, signal });
|
|
66735
|
-
}, "walk-shared");
|
|
66751
|
+
}, "walk-shared", { listed: () => shared2.listedAt !== void 0, unlisted: () => whenUnlisted(shared2) });
|
|
66736
66752
|
if (taken?.own === true) {
|
|
66737
66753
|
recentLoads.set(runKey, { startedAt: ownStartedAt, report: taken.report });
|
|
66738
66754
|
return taken.report;
|
|
@@ -66811,7 +66827,17 @@ function prewarmWalletP03History(args) {
|
|
|
66811
66827
|
rejectJoin(error);
|
|
66812
66828
|
});
|
|
66813
66829
|
});
|
|
66814
|
-
const joined = {
|
|
66830
|
+
const joined = {
|
|
66831
|
+
startedAt: shared2.startedAt,
|
|
66832
|
+
promise: bounded,
|
|
66833
|
+
settled: false,
|
|
66834
|
+
raw: shared2.promise,
|
|
66835
|
+
ownAtMs,
|
|
66836
|
+
of: shared2,
|
|
66837
|
+
get listedAt() {
|
|
66838
|
+
return shared2.listedAt;
|
|
66839
|
+
}
|
|
66840
|
+
};
|
|
66815
66841
|
joined.promise.then(() => {
|
|
66816
66842
|
joined.settled = true;
|
|
66817
66843
|
}, () => {
|
|
@@ -66825,9 +66851,8 @@ function prewarmWalletP03History(args) {
|
|
|
66825
66851
|
const marks = walletHistoryHomeMarks(args.store);
|
|
66826
66852
|
const entry = { startedAt: Date.now(), settled: false, marks };
|
|
66827
66853
|
const { paymentStartedAt: _paymentStartedAt, ...walkArgs } = args;
|
|
66828
|
-
entry.promise = loadWalletP03HistoryNow({ ...walkArgs, forceRead: false, onListed: () =>
|
|
66829
|
-
|
|
66830
|
-
} });
|
|
66854
|
+
entry.promise = loadWalletP03HistoryNow({ ...walkArgs, forceRead: false, onListed: (listed) => setListed(entry, listed) });
|
|
66855
|
+
endListed(entry);
|
|
66831
66856
|
entry.promise.then(prepareReport).catch(() => {
|
|
66832
66857
|
});
|
|
66833
66858
|
entry.promise.then((report) => {
|
|
@@ -66843,6 +66868,29 @@ function prewarmWalletP03History(args) {
|
|
|
66843
66868
|
return false;
|
|
66844
66869
|
}
|
|
66845
66870
|
}
|
|
66871
|
+
function setListed(entry, listed) {
|
|
66872
|
+
if (listed !== false) {
|
|
66873
|
+
entry.listedAt ??= Date.now();
|
|
66874
|
+
return;
|
|
66875
|
+
}
|
|
66876
|
+
if (entry.listedAt === void 0) return;
|
|
66877
|
+
entry.listedAt = void 0;
|
|
66878
|
+
const waiters = entry.unlistedWaiters;
|
|
66879
|
+
entry.unlistedWaiters = void 0;
|
|
66880
|
+
for (const wake of waiters ?? []) wake();
|
|
66881
|
+
}
|
|
66882
|
+
function whenUnlisted(entry) {
|
|
66883
|
+
const own = entry.of ?? entry;
|
|
66884
|
+
return new Promise((resolve43) => {
|
|
66885
|
+
(own.unlistedWaiters ??= /* @__PURE__ */ new Set()).add(resolve43);
|
|
66886
|
+
});
|
|
66887
|
+
}
|
|
66888
|
+
function endListed(entry) {
|
|
66889
|
+
const end2 = () => {
|
|
66890
|
+
entry.unlistedWaiters = void 0;
|
|
66891
|
+
};
|
|
66892
|
+
entry.promise.then(end2, end2);
|
|
66893
|
+
}
|
|
66846
66894
|
function walletHistoryHomeMarks(store) {
|
|
66847
66895
|
try {
|
|
66848
66896
|
const readAtMs = Date.now();
|
|
@@ -66859,7 +66907,7 @@ function walletHistoryHomeMarks(store) {
|
|
|
66859
66907
|
function latestPrewarmedWalletHistory() {
|
|
66860
66908
|
return latestPrewarm;
|
|
66861
66909
|
}
|
|
66862
|
-
async function joinedWalkOrOwn(joined, startOwn, mark, { untilMs = Date.now() + SHARED_WALK_WAIT_MS, listed } = {}) {
|
|
66910
|
+
async function joinedWalkOrOwn(joined, startOwn, mark, { untilMs = Date.now() + SHARED_WALK_WAIT_MS, listed, unlisted } = {}) {
|
|
66863
66911
|
const isReport = (report) => report !== null && typeof report === "object";
|
|
66864
66912
|
let timer;
|
|
66865
66913
|
let first;
|
|
@@ -66877,12 +66925,16 @@ async function joinedWalkOrOwn(joined, startOwn, mark, { untilMs = Date.now() +
|
|
|
66877
66925
|
markPhase(`${mark}-slow`);
|
|
66878
66926
|
if (listed?.() === true) {
|
|
66879
66927
|
markPhase(`${mark}-listed-wait`);
|
|
66928
|
+
const dropped = unlisted?.()?.then(() => JOINED_WALK_UNLISTED);
|
|
66929
|
+
let waited;
|
|
66880
66930
|
try {
|
|
66881
|
-
|
|
66882
|
-
return isReport(report) ? { own: false, report } : void 0;
|
|
66931
|
+
waited = await (dropped ? Promise.race([joined, dropped]) : joined);
|
|
66883
66932
|
} catch {
|
|
66884
66933
|
return void 0;
|
|
66885
66934
|
}
|
|
66935
|
+
if (waited !== JOINED_WALK_UNLISTED) return isReport(waited) ? { own: false, report: waited } : void 0;
|
|
66936
|
+
if (runEnded()) return void 0;
|
|
66937
|
+
markPhase(`${mark}-listed-dropped`);
|
|
66886
66938
|
}
|
|
66887
66939
|
const stop2 = new AbortController();
|
|
66888
66940
|
const own = startOwn(stop2.signal);
|
|
@@ -66936,6 +66988,10 @@ async function loadWalletP03HistoryNow(args) {
|
|
|
66936
66988
|
if (!await channelMovedSince(startedAt)) throw error;
|
|
66937
66989
|
if (args.signal?.aborted) throw error;
|
|
66938
66990
|
markPhase("walk-channel-refreshed");
|
|
66991
|
+
try {
|
|
66992
|
+
args.onListed?.(false);
|
|
66993
|
+
} catch {
|
|
66994
|
+
}
|
|
66939
66995
|
startedAt = Date.now();
|
|
66940
66996
|
report = await untilHistorySourceSilent(walkWalletP03HistoryNow(args), startedAt);
|
|
66941
66997
|
}
|
|
@@ -67191,11 +67247,13 @@ async function compactFirst({
|
|
|
67191
67247
|
// `onListed` (PF146 (a), 2026-10-30: its pages passed; the fold and the deployment check follow).
|
|
67192
67248
|
...typeof onCompactList === "function" || typeof onListed === "function" ? { onList: (contexts) => {
|
|
67193
67249
|
try {
|
|
67194
|
-
onListed?.();
|
|
67250
|
+
onListed?.(true);
|
|
67195
67251
|
} catch {
|
|
67196
67252
|
}
|
|
67197
67253
|
onCompactList?.(contexts);
|
|
67198
67254
|
} } : {},
|
|
67255
|
+
// compact.mjs's cached-tail retry throws its first list away inside one try.
|
|
67256
|
+
...typeof onListed === "function" ? { onUnlist: () => onListed(false) } : {},
|
|
67199
67257
|
...signal !== void 0 ? { signal } : {},
|
|
67200
67258
|
// A program upgrade the list's pool read or deployment check meets: the AB175 channel fetch inside this read (compact.mjs
|
|
67201
67259
|
// programUpgrade), so the check runs again on this list instead of a second walk asking the page set again. It waits
|
|
@@ -67224,6 +67282,12 @@ async function compactFirst({
|
|
|
67224
67282
|
...firstPreRead !== void 0 ? { firstPreRead } : {}
|
|
67225
67283
|
} : options);
|
|
67226
67284
|
behindAnswer = void 0;
|
|
67285
|
+
if (!result.ok) {
|
|
67286
|
+
try {
|
|
67287
|
+
onListed?.(false);
|
|
67288
|
+
} catch {
|
|
67289
|
+
}
|
|
67290
|
+
}
|
|
67227
67291
|
if (!result.ok && signal?.aborted) throw signal.reason;
|
|
67228
67292
|
if (result.ok) {
|
|
67229
67293
|
markPhase("walk-compact");
|
|
@@ -67456,7 +67520,7 @@ function reportHistoryRpc(split4, source, result, crossChecked, rpcName) {
|
|
|
67456
67520
|
writeStderr(`history: ${who} answered ${list(split4.history)}; ${rpcName} answered ${list(split4.own)} (the pool's state on chain that the history must match, and the cross-check)${window2}${integrity}
|
|
67457
67521
|
`);
|
|
67458
67522
|
}
|
|
67459
|
-
var prepareReport, strictScope, withStrictHistorySource, recentScope, withRecentWalletHistory, recentLoads, recentAgeStart, forgetRecentWalletHistory, proofBuiltAt, historyCacheKey, sweptFolders, latestPrewarm, HOME_MARKS_SETTLED_MS, PREWARM_RUNNING_MAX_MS, historyPrewarmRunning, HISTORY_PREWARM_JOIN_MS, SHARED_WALK_WAIT_MS, JOINED_WALK_SLOW, PAGE0_PREREAD_AFTER_MS, SUBTREE_LEAVES4, prewarmedWalks, sharedWalks, PREWARMED_REPORTS, PAYMENT_TAKEN_REPORTS, isPrewarmedWalletHistory, REPORT_STARTED_AT, walkStartedAtOf, upgradeRefresh, upgradeRefreshRunning, upgradeRefreshTriedAt, UPGRADE_REFRESH_GAP_MS, behindPollMs, COMPACT_BEHIND_POLL_MS, COMPACT_BEHIND_POLL_MAX_MS, COMPACT_BEHIND_READ_MS, COMPACT_BEHIND_TOR_READ_MS, COMPACT_BEHIND_REFUSAL_MAX_BYTES, COMPACT_BEHIND_PAGE_BODY_MS, COMPACT_BEHIND_RETRY_MS, lastRunReports, writeStderr, OWN_WALK_STEPS, announcedSources, ownSourceWords;
|
|
67523
|
+
var prepareReport, strictScope, withStrictHistorySource, recentScope, withRecentWalletHistory, recentLoads, recentAgeStart, forgetRecentWalletHistory, proofBuiltAt, historyCacheKey, sweptFolders, latestPrewarm, HOME_MARKS_SETTLED_MS, PREWARM_RUNNING_MAX_MS, historyPrewarmRunning, HISTORY_PREWARM_JOIN_MS, SHARED_WALK_WAIT_MS, JOINED_WALK_SLOW, JOINED_WALK_UNLISTED, PAGE0_PREREAD_AFTER_MS, SUBTREE_LEAVES4, prewarmedWalks, sharedWalks, PREWARMED_REPORTS, PAYMENT_TAKEN_REPORTS, isPrewarmedWalletHistory, REPORT_STARTED_AT, walkStartedAtOf, upgradeRefresh, upgradeRefreshRunning, upgradeRefreshTriedAt, UPGRADE_REFRESH_GAP_MS, behindPollMs, COMPACT_BEHIND_POLL_MS, COMPACT_BEHIND_POLL_MAX_MS, COMPACT_BEHIND_READ_MS, COMPACT_BEHIND_TOR_READ_MS, COMPACT_BEHIND_REFUSAL_MAX_BYTES, COMPACT_BEHIND_PAGE_BODY_MS, COMPACT_BEHIND_RETRY_MS, lastRunReports, writeStderr, OWN_WALK_STEPS, announcedSources, ownSourceWords;
|
|
67460
67524
|
var init_walletHistory = __esm({
|
|
67461
67525
|
"wallet/src/history/walletHistory.mjs"() {
|
|
67462
67526
|
"use strict";
|
|
@@ -67496,6 +67560,7 @@ var init_walletHistory = __esm({
|
|
|
67496
67560
|
HISTORY_PREWARM_JOIN_MS = 1e4;
|
|
67497
67561
|
SHARED_WALK_WAIT_MS = 6e3;
|
|
67498
67562
|
JOINED_WALK_SLOW = /* @__PURE__ */ Symbol("joined_walk_slow");
|
|
67563
|
+
JOINED_WALK_UNLISTED = /* @__PURE__ */ Symbol("joined_walk_unlisted");
|
|
67499
67564
|
PAGE0_PREREAD_AFTER_MS = 4e4;
|
|
67500
67565
|
SUBTREE_LEAVES4 = 128n;
|
|
67501
67566
|
prewarmedWalks = /* @__PURE__ */ new Map();
|
|
@@ -67677,6 +67742,17 @@ function spendHeads(spendableAtomic, largestAtomic, change = {}, options = {}) {
|
|
|
67677
67742
|
if (change?.changeSettling === true) {
|
|
67678
67743
|
const seconds2 = change.changeReadyInSeconds;
|
|
67679
67744
|
const upTo = String(change.changeUpToAtomic ?? "");
|
|
67745
|
+
if (change.changeRestOther === true) {
|
|
67746
|
+
const part = ATOMIC.test(upTo) && BigInt(upTo) > 0n && BigInt(upTo) < BigInt(spendable) ? usdcWords(upTo) : total;
|
|
67747
|
+
const settle = Number.isSafeInteger(change.changeCount) && change.changeCount >= 2 ? "once your recent payments settle" : "once your last payment settles";
|
|
67748
|
+
return [
|
|
67749
|
+
Number.isSafeInteger(seconds2) && seconds2 > 0 ? `You have ${total}; a payment now waits about ${seconds2} s, then can use up to ${part}` : `You have ${total}; a payment now can use up to ${part} ${settle}`,
|
|
67750
|
+
`You have ${total}; a payment can use up to ${part} after your ${settle.endsWith("settle") ? "recent ones settle" : "last one settles"}`,
|
|
67751
|
+
// 13 words: it fits the say with the longest public-USDC clause, 12 words with its read age (Codex round on 2ab1930a8,
|
|
67752
|
+
// P2: the say dropped the public 0.1 USDC); say.mjs drops its "counts a settling payment" clause first.
|
|
67753
|
+
`You have ${total}; ${part} can pay ${settle}`
|
|
67754
|
+
];
|
|
67755
|
+
}
|
|
67680
67756
|
if (Number.isSafeInteger(change.changeCount) && change.changeCount >= 2 && ATOMIC.test(upTo) && BigInt(upTo) > 0n && BigInt(upTo) < BigInt(spendable)) {
|
|
67681
67757
|
const part = usdcWords(upTo);
|
|
67682
67758
|
return Number.isSafeInteger(seconds2) && seconds2 > 0 ? [
|
|
@@ -114034,7 +114110,7 @@ function computeBalance({ store, snapshotRead, source = "local", now = Date.now(
|
|
|
114034
114110
|
let heldAtomic;
|
|
114035
114111
|
let heldWholeAtomic;
|
|
114036
114112
|
let spareMost = 0n;
|
|
114037
|
-
const report = (status, gross, next2, cause, largest2, change, changes) => {
|
|
114113
|
+
const report = (status, gross, next2, cause, largest2, change, changes, restOther) => {
|
|
114038
114114
|
const atomic5 = gross === null || privateSendPending === null ? null : gross > privateSendPending ? gross - privateSendPending : 0n;
|
|
114039
114115
|
if (atomic5 !== null && BigInt(detail.belowAccountsAtomic ?? "0") > atomic5) detail.belowAccountsAtomic = atomic5.toString();
|
|
114040
114116
|
const built = {
|
|
@@ -114077,6 +114153,7 @@ function computeBalance({ store, snapshotRead, source = "local", now = Date.now(
|
|
|
114077
114153
|
if (change !== void 0 && one === 0n && atomic5 > 0n) {
|
|
114078
114154
|
CHANGE_SETTLING.set(built, (change < atomic5 ? change : atomic5).toString());
|
|
114079
114155
|
if (Number.isSafeInteger(changes) && changes >= 2) CHANGE_COUNT.set(built, changes);
|
|
114156
|
+
if (restOther === true) CHANGE_REST_OTHER.add(built);
|
|
114080
114157
|
}
|
|
114081
114158
|
}
|
|
114082
114159
|
return built;
|
|
@@ -114403,7 +114480,8 @@ If a payment to this wallet settled, read the chain again with:
|
|
|
114403
114480
|
return change > most ? change : most;
|
|
114404
114481
|
}, 0n);
|
|
114405
114482
|
const changeFreeAtomic = sendHold === null || sendHold.unpacked.length === 0 ? changeAtomic : changeAtomic > privateSendPending ? changeAtomic - privateSendPending : 0n;
|
|
114406
|
-
const
|
|
114483
|
+
const restAtomic = sendHeldAtomic === null ? null : unspentAtomic - sendHeldAtomic - inputsAtomic;
|
|
114484
|
+
const changeOnly = settling.length > 0 && distinctInputs && (settling.length === 1 || sendHeldAtomic === 0n && privateSendPending === 0n) && settling.every((payment) => payment.join !== true && payment.exit !== true && inputsOf(payment) > payment.amountAtomic) && reservedAtomic === 0n && detail.joiningAtomic === "0" && successionMovableAtomic === 0n && restAtomic !== null && restAtomic >= 0n && changeFreeAtomic > 0n;
|
|
114407
114485
|
return report(
|
|
114408
114486
|
"stale",
|
|
114409
114487
|
spendable + successionMovableAtomic,
|
|
@@ -114413,7 +114491,8 @@ If a payment to this wallet settled, read the chain again with:
|
|
|
114413
114491
|
settlingRecent ? movedInAtomic === 0n && settling.length > 0 && settling.every((payment) => payment.join) ? "account_join" : "payment_settling" : movedInAtomic > 0n ? "pool_move" : void 0,
|
|
114414
114492
|
largest,
|
|
114415
114493
|
changeOnly ? changeFreeAtomic : void 0,
|
|
114416
|
-
settling.length
|
|
114494
|
+
settling.length,
|
|
114495
|
+
changeOnly && restAtomic > 0n
|
|
114417
114496
|
);
|
|
114418
114497
|
}
|
|
114419
114498
|
const newestSale = store.path ? newestSalePaidAt(store.path) : void 0;
|
|
@@ -114437,7 +114516,7 @@ function combinePoolBalances(partsAtomic, movingAtomic = "0") {
|
|
|
114437
114516
|
if (!canonicalAtomic(String(movingAtomic))) return null;
|
|
114438
114517
|
return (partsAtomic.reduce((total, part) => total + BigInt(part), 0n) + BigInt(movingAtomic)).toString();
|
|
114439
114518
|
}
|
|
114440
|
-
var PAY_ME_WAL_SCHEMA, BALANCE_SNAPSHOT_SCHEMA, BALANCE_SNAPSHOT_FILE, STALE_CAUSES, staleCauseOf, LARGEST_PAYMENTS, largestPaymentOf, CHANGE_SETTLING, changeSettlingOf, changeUpToOf, CHANGE_COUNT, changeCountOf, SPEND_INPUTS, SEND_HOLDS, sendHoldOf, PAYMENT_SETTLING_MS, NO_VALUE_TYPES, PLAN_ONLY_TYPES, UNSENT_SELF_PAY_FIELDS, isUnsentSelfPay, planOnly, SNAPSHOT_KEY_LABEL, SPEND_STATUSES, MAINNET_USDC, SELF_PAY_ORIGIN2, POCKET_FILL_RECORD, MERGE_RECORD2, POOL_MOVE_SCHEMA, FLOAT_PAYMENT_SCHEMA2, POOL_MOVE_PATH2, POOL_SUCCESSION_SCHEMAS, digestKey, canonicalAtomic, SUCCESSION_JOB_SCHEMA, MERGE_PAYMENT_PATH, spendEntry, PROOF_RECORD;
|
|
114519
|
+
var PAY_ME_WAL_SCHEMA, BALANCE_SNAPSHOT_SCHEMA, BALANCE_SNAPSHOT_FILE, STALE_CAUSES, staleCauseOf, LARGEST_PAYMENTS, largestPaymentOf, CHANGE_SETTLING, changeSettlingOf, changeUpToOf, CHANGE_COUNT, changeCountOf, CHANGE_REST_OTHER, changeRestOtherOf, SPEND_INPUTS, SEND_HOLDS, sendHoldOf, PAYMENT_SETTLING_MS, NO_VALUE_TYPES, PLAN_ONLY_TYPES, UNSENT_SELF_PAY_FIELDS, isUnsentSelfPay, planOnly, SNAPSHOT_KEY_LABEL, SPEND_STATUSES, MAINNET_USDC, SELF_PAY_ORIGIN2, POCKET_FILL_RECORD, MERGE_RECORD2, POOL_MOVE_SCHEMA, FLOAT_PAYMENT_SCHEMA2, POOL_MOVE_PATH2, POOL_SUCCESSION_SCHEMAS, digestKey, canonicalAtomic, SUCCESSION_JOB_SCHEMA, MERGE_PAYMENT_PATH, spendEntry, PROOF_RECORD;
|
|
114441
114520
|
var init_balance = __esm({
|
|
114442
114521
|
"wallet/src/balance/balance.mjs"() {
|
|
114443
114522
|
"use strict";
|
|
@@ -114467,6 +114546,8 @@ var init_balance = __esm({
|
|
|
114467
114546
|
changeUpToOf = (report) => report !== null && typeof report === "object" ? CHANGE_SETTLING.get(report) : void 0;
|
|
114468
114547
|
CHANGE_COUNT = /* @__PURE__ */ new WeakMap();
|
|
114469
114548
|
changeCountOf = (report) => report !== null && typeof report === "object" ? CHANGE_COUNT.get(report) : void 0;
|
|
114549
|
+
CHANGE_REST_OTHER = /* @__PURE__ */ new WeakSet();
|
|
114550
|
+
changeRestOtherOf = (report) => report !== null && typeof report === "object" && CHANGE_REST_OTHER.has(report);
|
|
114470
114551
|
SPEND_INPUTS = /* @__PURE__ */ new WeakMap();
|
|
114471
114552
|
SEND_HOLDS = /* @__PURE__ */ new WeakMap();
|
|
114472
114553
|
sendHoldOf = (report) => report !== null && typeof report === "object" ? SEND_HOLDS.get(report) : void 0;
|
|
@@ -122318,6 +122399,7 @@ function partsOf(report, store, snapshot) {
|
|
|
122318
122399
|
changeReadyInSeconds: changeSettling ? changeReadyInSeconds() : null,
|
|
122319
122400
|
changeUpToAtomic: changeSettling ? changeUpToOf(report) ?? null : null,
|
|
122320
122401
|
...changeSettling && Number.isSafeInteger(changeCountOf(report)) ? { changeCount: changeCountOf(report) } : {},
|
|
122402
|
+
...changeSettling && changeRestOtherOf(report) ? { changeRestOther: true } : {},
|
|
122321
122403
|
refundsInFlightAtomic: refunds.proven.toString(),
|
|
122322
122404
|
refundsNotCertainAtomic: refunds.notCertain.toString(),
|
|
122323
122405
|
refundsInFlight: refunds.provenFor,
|
|
@@ -122540,14 +122622,14 @@ var init_models = __esm({
|
|
|
122540
122622
|
});
|
|
122541
122623
|
MODELS = Object.freeze([
|
|
122542
122624
|
model("claude-opus-5", 5000000n, 25000000n, "strongest"),
|
|
122543
|
-
//
|
|
122544
|
-
// 2026-11-
|
|
122545
|
-
//
|
|
122546
|
-
// left none under the caps (the
|
|
122547
|
-
//
|
|
122548
|
-
//
|
|
122549
|
-
// 0.0036 USDC for 4096 tokens
|
|
122550
|
-
model("deepseek-v4-1-flash",
|
|
122625
|
+
// Input 106000 since 2026-11-12 (was 77800; output 567000 since 2026-11-06, for openrouter's 51000 / 567000 then):
|
|
122626
|
+
// usePod's list read 2026-11-12 15:24:54, 15:26:24 and 15:27:23 UTC (api.usepod.ai/v1/marketplace/models, through Tor;
|
|
122627
|
+
// the same list each time) gives its centralized providers nousresearch 106000 / 513000, openrouter, venice and together
|
|
122628
|
+
// 300000 / 1200000, uomi 354210 / 1432140, so 77800 left none under the caps (the gates on c93243b99, served models).
|
|
122629
|
+
// 106000 / 567000 fits nousresearch, the only one under 300000 in; the output cap stays (it still fits openrouter's
|
|
122630
|
+
// 567000 if that price comes back). A short answer stays under usePod's floor, so "at most 0.011 USDC" stays; the
|
|
122631
|
+
// "about" price from the listed prices (answerPriceOf) stays 0.0036 USDC for 4096 tokens and 0.0014 for 512.
|
|
122632
|
+
model("deepseek-v4-1-flash", 106000n, 567000n, "fast and cheap"),
|
|
122551
122633
|
model("qwen3-8-flash", 150000n, 470000n, `small; thinks before it answers, so its length limit is at least ${THINKING_MIN_MAX_TOKENS} tokens`, { thinks: true })
|
|
122552
122634
|
]);
|
|
122553
122635
|
}
|
|
@@ -123528,9 +123610,13 @@ function balanceLine(a, room = SAY_MAX_WORDS) {
|
|
|
123528
123610
|
}
|
|
123529
123611
|
if (a.refreshing === true && a.refreshReason === "first_check") return `You have ${balance} USDC private from your deposits. The wallet's first full check of your balance is not done yet.${pubPart}`;
|
|
123530
123612
|
if (a.refreshing === true && a.refreshReason === "payment_settling" && !moving) {
|
|
123613
|
+
if (a.changeSettling === true && a.changeRestOther === true) {
|
|
123614
|
+
return have(`. This number already counts a settling payment.${pubPart}`, ...pubPart ? [`.${pubPart}`] : [], ". This number already counts a settling payment.");
|
|
123615
|
+
}
|
|
123531
123616
|
return have(
|
|
123532
123617
|
`. A payment is still settling; this number already counts it.${pubPart}`,
|
|
123533
123618
|
`. This number already counts a settling payment.${pubPart}`,
|
|
123619
|
+
...a.changeSettling === true && pubPart ? [`.${pubPart}`] : [],
|
|
123534
123620
|
". This number already counts a settling payment."
|
|
123535
123621
|
);
|
|
123536
123622
|
}
|
|
@@ -138173,7 +138259,11 @@ function createAddFundsTool({
|
|
|
138173
138259
|
wake,
|
|
138174
138260
|
timing,
|
|
138175
138261
|
// Lotus to-do 75: the pool a new address derives from (the wallet's own pool), so a refusal names that family's reason.
|
|
138176
|
-
familyPool
|
|
138262
|
+
familyPool,
|
|
138263
|
+
// The time from the call's arrival by which the chain reads before an answer must end (tools.mjs MONEY_FIRST_ANSWER_MS).
|
|
138264
|
+
firstAnswerMs = 2e4,
|
|
138265
|
+
// True for a link this build stopped for an update (payMe.mjs stoppedForUpdate with the wallet's build): no chain read.
|
|
138266
|
+
stoppedForBuild = () => false
|
|
138177
138267
|
} = {}) {
|
|
138178
138268
|
const note = (line) => {
|
|
138179
138269
|
try {
|
|
@@ -138218,13 +138308,17 @@ function createAddFundsTool({
|
|
|
138218
138308
|
op = void 0;
|
|
138219
138309
|
}
|
|
138220
138310
|
if (typeof op !== "function") return NO_MARKS;
|
|
138311
|
+
let answered2 = false;
|
|
138312
|
+
const lateOutcome = (outcome) => typeof outcome === "string" && outcome ? `${outcome.slice(0, 91)}_late` : "late";
|
|
138221
138313
|
const write = (phase, outcome) => {
|
|
138222
138314
|
try {
|
|
138223
|
-
op(phase, outcome);
|
|
138315
|
+
op(phase, answered2 ? lateOutcome(outcome) : outcome);
|
|
138224
138316
|
} catch {
|
|
138225
138317
|
}
|
|
138226
138318
|
};
|
|
138227
|
-
return { mark: (step2, outcome) => write(`add-funds:${step2}`, outcome), write, requests: 0, tunnels: 0
|
|
138319
|
+
return { mark: (step2, outcome) => write(`add-funds:${step2}`, outcome), write, requests: 0, tunnels: 0, answered: () => {
|
|
138320
|
+
answered2 = true;
|
|
138321
|
+
} };
|
|
138228
138322
|
}
|
|
138229
138323
|
async function step(call2, name, task) {
|
|
138230
138324
|
if (call2 === NO_MARKS) return task();
|
|
@@ -138241,6 +138335,39 @@ function createAddFundsTool({
|
|
|
138241
138335
|
release();
|
|
138242
138336
|
}
|
|
138243
138337
|
}
|
|
138338
|
+
async function bounded(call2, name, task, deadline) {
|
|
138339
|
+
call2.mark(`${name}-start`);
|
|
138340
|
+
const release = call2 === NO_MARKS ? () => {
|
|
138341
|
+
} : watchRequests();
|
|
138342
|
+
let started;
|
|
138343
|
+
try {
|
|
138344
|
+
started = Promise.resolve(call2 === NO_MARKS ? task() : stepScope.run(call2, () => withPhaseScope(call2.write, "add-funds", task)));
|
|
138345
|
+
} catch (error) {
|
|
138346
|
+
started = Promise.reject(error);
|
|
138347
|
+
}
|
|
138348
|
+
const read = started.then((value2) => {
|
|
138349
|
+
call2.mark(`${name}-end`);
|
|
138350
|
+
return value2;
|
|
138351
|
+
}, (error) => {
|
|
138352
|
+
call2.mark(`${name}-failed`, error instanceof PayMeError ? error.code : codeOf5(error));
|
|
138353
|
+
throw error;
|
|
138354
|
+
}).finally(release);
|
|
138355
|
+
let timer;
|
|
138356
|
+
const late2 = new Promise((resolve43) => {
|
|
138357
|
+
timer = setTimeout(() => resolve43(LATE2), Math.max(0, deadline - Date.now()));
|
|
138358
|
+
});
|
|
138359
|
+
try {
|
|
138360
|
+
const value2 = await Promise.race([read, late2]);
|
|
138361
|
+
if (value2 === LATE2) {
|
|
138362
|
+
read.catch(() => {
|
|
138363
|
+
});
|
|
138364
|
+
call2.mark(`${name}-late`);
|
|
138365
|
+
}
|
|
138366
|
+
return value2;
|
|
138367
|
+
} finally {
|
|
138368
|
+
clearTimeout(timer);
|
|
138369
|
+
}
|
|
138370
|
+
}
|
|
138244
138371
|
function nextFor(answer, agentId, prefix = "") {
|
|
138245
138372
|
const original = typeof answer.next === "string" ? answer.next : "";
|
|
138246
138373
|
if (original && !/wallet_pay_me/.test(original)) return prefix + original;
|
|
@@ -138391,20 +138518,34 @@ function createAddFundsTool({
|
|
|
138391
138518
|
});
|
|
138392
138519
|
return run2;
|
|
138393
138520
|
};
|
|
138394
|
-
async function withoutId(amountAtomic, text3, call2) {
|
|
138521
|
+
async function withoutId(amountAtomic, text3, call2, deadline) {
|
|
138395
138522
|
call2.mark("queued-end");
|
|
138396
138523
|
const open5 = payMeList().filter((record) => AUTO_ID.test(String(record?.id)) && record.state === "open");
|
|
138397
138524
|
call2.mark("listed");
|
|
138398
138525
|
if (open5.length >= ADD_FUNDS_OPEN_NO_ID_MAX) {
|
|
138399
138526
|
const newest = [...open5].sort((a, b) => String(b.createdAt).localeCompare(String(a.createdAt)));
|
|
138400
138527
|
const candidate = newest.find((record) => record.amountAtomic === amountAtomic) ?? newest[0];
|
|
138528
|
+
const reuseBy = deadline - CREATE_BUDGET_MS;
|
|
138529
|
+
const heldPending = bounded(call2, "held", () => payMeHeld(candidate), reuseBy);
|
|
138530
|
+
const wrongPending = bounded(call2, "wrong-coins", () => wrongCoinsOf(candidate, { fresh: true }), reuseBy);
|
|
138531
|
+
wrongPending.catch(() => {
|
|
138532
|
+
});
|
|
138401
138533
|
let held2;
|
|
138402
138534
|
try {
|
|
138403
|
-
|
|
138535
|
+
const read = await heldPending;
|
|
138536
|
+
held2 = read === LATE2 ? void 0 : BigInt(String(read));
|
|
138404
138537
|
} catch {
|
|
138405
138538
|
held2 = void 0;
|
|
138406
138539
|
}
|
|
138407
|
-
|
|
138540
|
+
let wrong;
|
|
138541
|
+
if (held2 === 0n) {
|
|
138542
|
+
try {
|
|
138543
|
+
const read = await wrongPending;
|
|
138544
|
+
wrong = read === LATE2 ? void 0 : read;
|
|
138545
|
+
} catch {
|
|
138546
|
+
wrong = void 0;
|
|
138547
|
+
}
|
|
138548
|
+
}
|
|
138408
138549
|
if (held2 === 0n && Array.isArray(wrong) && wrong.length === 0) {
|
|
138409
138550
|
const backup = await step(call2, "backup", () => backupAddress(candidate.owner));
|
|
138410
138551
|
if (backup?.backupError) return backupRefusal(candidate.id, backup.backupError);
|
|
@@ -138425,6 +138566,7 @@ function createAddFundsTool({
|
|
|
138425
138566
|
}
|
|
138426
138567
|
async function answerCall(args, progress2, calledAt, call2) {
|
|
138427
138568
|
const given = args?.request_id;
|
|
138569
|
+
const deadline = (Number.isFinite(calledAt) ? calledAt : Date.now()) + firstAnswerMs;
|
|
138428
138570
|
if (!enabled()) {
|
|
138429
138571
|
const { step: step2, extra } = offStep();
|
|
138430
138572
|
return refuse9(
|
|
@@ -138473,7 +138615,7 @@ function createAddFundsTool({
|
|
|
138473
138615
|
if (given === void 0) {
|
|
138474
138616
|
call2.mark("queued-start");
|
|
138475
138617
|
try {
|
|
138476
|
-
return await oneAtATime(() => withoutId(amountAtomic, text3, call2));
|
|
138618
|
+
return await oneAtATime(() => withoutId(amountAtomic, text3, call2, deadline));
|
|
138477
138619
|
} catch (error) {
|
|
138478
138620
|
return failure3(error);
|
|
138479
138621
|
}
|
|
@@ -138509,6 +138651,9 @@ function createAddFundsTool({
|
|
|
138509
138651
|
}
|
|
138510
138652
|
const backup = await step(call2, "backup", () => backupAddress(existing.owner));
|
|
138511
138653
|
if (backup?.backupError) return backupRefusal(given, backup.backupError);
|
|
138654
|
+
const wrongPending = stoppedForBuild(existing) ? void 0 : bounded(call2, "wrong-coins", () => wrongCoinsOf(existing), deadline);
|
|
138655
|
+
wrongPending?.catch(() => {
|
|
138656
|
+
});
|
|
138512
138657
|
call2.mark("status-start");
|
|
138513
138658
|
const status = await payMeAnswerSoon(linkId, { reused: true }, { progress: progress2, ...Number.isFinite(calledAt) ? { startedAt: calledAt } : {} });
|
|
138514
138659
|
call2.mark("status-end");
|
|
@@ -138518,8 +138663,15 @@ function createAddFundsTool({
|
|
|
138518
138663
|
} catch {
|
|
138519
138664
|
stopped = false;
|
|
138520
138665
|
}
|
|
138521
|
-
|
|
138522
|
-
|
|
138666
|
+
let wrong = [];
|
|
138667
|
+
if (wrongPending && !stopped) {
|
|
138668
|
+
try {
|
|
138669
|
+
wrong = await wrongPending;
|
|
138670
|
+
} catch {
|
|
138671
|
+
wrong = [];
|
|
138672
|
+
}
|
|
138673
|
+
}
|
|
138674
|
+
return await reshape(status, given, void 0, call2, wrong === LATE2 ? [] : wrong ?? []);
|
|
138523
138675
|
} catch (error) {
|
|
138524
138676
|
return failure3(error, given);
|
|
138525
138677
|
}
|
|
@@ -138548,14 +138700,18 @@ function createAddFundsTool({
|
|
|
138548
138700
|
output2 = await answerCall(args, progress2, calledAt, call2);
|
|
138549
138701
|
} catch (error) {
|
|
138550
138702
|
call2.mark("crashed", codeOf5(error));
|
|
138703
|
+
call2.answered?.();
|
|
138551
138704
|
throw error;
|
|
138552
138705
|
}
|
|
138553
|
-
if (call2 !== NO_MARKS)
|
|
138706
|
+
if (call2 !== NO_MARKS) {
|
|
138707
|
+
call2.mark("answered", answerOutcome(output2));
|
|
138708
|
+
call2.answered();
|
|
138709
|
+
}
|
|
138554
138710
|
return output2;
|
|
138555
138711
|
}
|
|
138556
138712
|
};
|
|
138557
138713
|
}
|
|
138558
|
-
var WRONG_COIN_READ_EVERY_MS, json, refuse9, ADD_FUNDS_REQUEST_ID, RESERVED_ID2, AUTO_ID, ADD_FUNDS_OPEN_NO_ID_MAX, POLL_SECONDS, QR_NEXT, usdc, NEXT_DEPOSIT_WHEN, LINK_AS_TEXT, ADD_FUNDS_LEAST, codeOf5, NO_MARKS, stepScope, stepRequests, outcomeOfError, onRequestEvent, REQUEST_EVENTS, watching, subscribed, answerOutcome;
|
|
138714
|
+
var WRONG_COIN_READ_EVERY_MS, LATE2, CREATE_BUDGET_MS, json, refuse9, ADD_FUNDS_REQUEST_ID, RESERVED_ID2, AUTO_ID, ADD_FUNDS_OPEN_NO_ID_MAX, POLL_SECONDS, QR_NEXT, usdc, NEXT_DEPOSIT_WHEN, LINK_AS_TEXT, ADD_FUNDS_LEAST, codeOf5, NO_MARKS, stepScope, stepRequests, outcomeOfError, onRequestEvent, REQUEST_EVENTS, watching, subscribed, answerOutcome;
|
|
138559
138715
|
var init_addFunds = __esm({
|
|
138560
138716
|
"wallet/src/mcp/addFunds.mjs"() {
|
|
138561
138717
|
"use strict";
|
|
@@ -138566,6 +138722,8 @@ var init_addFunds = __esm({
|
|
|
138566
138722
|
init_relayLimit();
|
|
138567
138723
|
init_say();
|
|
138568
138724
|
WRONG_COIN_READ_EVERY_MS = 6e4;
|
|
138725
|
+
LATE2 = /* @__PURE__ */ Symbol("late");
|
|
138726
|
+
CREATE_BUDGET_MS = 5e3;
|
|
138569
138727
|
json = (value2) => ({ text: JSON.stringify(value2, null, 2) });
|
|
138570
138728
|
refuse9 = (error, detail, next, extra = {}) => json({ ok: false, error, detail, next, ...extra });
|
|
138571
138729
|
ADD_FUNDS_REQUEST_ID = /^[A-Za-z0-9._:-]{1,128}$/;
|
|
@@ -146498,6 +146656,8 @@ ${canonical5}`;
|
|
|
146498
146656
|
changeSettling: void 0,
|
|
146499
146657
|
changeReadyInSeconds: void 0,
|
|
146500
146658
|
changeUpToAtomic: void 0,
|
|
146659
|
+
changeCount: void 0,
|
|
146660
|
+
changeRestOther: void 0,
|
|
146501
146661
|
receivedOnly: void 0,
|
|
146502
146662
|
breakdown: { ...one.breakdown, shieldedAtomic: null, totalAtomic: null }
|
|
146503
146663
|
};
|
|
@@ -146706,7 +146866,7 @@ ${canonical5}`;
|
|
|
146706
146866
|
next = `${next}. Tell the user: ${failingSends.map((send3) => `payment ${send3.nextPayment} of ${send3.payments} of ${sendWords(send3)} did not go through in ${send3.failedTries} ${send3.failedTries === 1 ? "try" : "tries"}${send3.lastTryMinutesAgo !== void 0 ? ` (the last ${agoWords(send3.lastTryMinutesAgo)})` : ""}: ${send3.lastReason}. It sent ${usdcText3(send3.sentAtomic)} USDC so far. The wallet tries that payment again by itself at its next start`).join(". ")}. ` + failingSends.map((send3) => `${send3.tool === OLD_TRANSFER_TOOL ? "It is an older token transfer's send: no call runs it sooner" : `To try it now: wallet_unshield with request_id "${send3.requestId}" and the same arguments`}; to stop the send and return the USDC not sent yet to the private balance: ${cancelCall(send3)} (${sendWords(send3)})`).join(". ");
|
|
146707
146867
|
}
|
|
146708
146868
|
if (privateSends.length && one.largestPaymentAtomic === "0" && (one.changeSettling !== true || one.changeUpToAtomic !== void 0) && /^[1-9][0-9]*$/.test(String(one.balanceAtomic ?? ""))) {
|
|
146709
|
-
const soon = one.changeUpToAtomic === void 0 ? "" : `after the last payment settles${Number.isSafeInteger(one.changeReadyInSeconds) ? ` (about ${one.changeReadyInSeconds} s)` : ""}, one payment can use up to ${usdcText3(one.changeUpToAtomic)} USDC; the rest waits, `;
|
|
146869
|
+
const soon = one.changeUpToAtomic === void 0 ? "" : `after the last payment settles${Number.isSafeInteger(one.changeReadyInSeconds) ? ` (about ${one.changeReadyInSeconds} s)` : ""}, one payment can use up to ${usdcText3(one.changeUpToAtomic)} USDC; ${one.changeRestOther === true ? "some of the rest waits" : "the rest waits"}, `;
|
|
146710
146870
|
const many = privateSends.length > 1;
|
|
146711
146871
|
next = `${next}. Tell the user: ${soon || `no payment can use the ${usdcText3(one.balanceAtomic)} USDC yet, `}because ${privateSends.map(sendWords).join(" and ")} ${many ? "keep" : "keeps"} money aside for ${many ? "their" : "its"} unsent payments. A send keeps nothing after its last payment goes, and an earlier payment may free some (wallet_balance shows it). To pay now if the user asks: ${privateSends.map((send3) => `${cancelCall(send3)} (${sendWords(send3)})`).join(" or ")} stops the send and frees its money now`;
|
|
146712
146872
|
}
|
|
@@ -152845,6 +153005,8 @@ ${canonical5}`;
|
|
|
152845
153005
|
};
|
|
152846
153006
|
const addFunds2 = createAddFundsTool({
|
|
152847
153007
|
familyPool: () => session.pool,
|
|
153008
|
+
firstAnswerMs: MONEY_FIRST_ANSWER_MS,
|
|
153009
|
+
stoppedForBuild: (record) => stoppedForUpdate(record, walletBuild),
|
|
152848
153010
|
payMeCreate: ({ id, requestId, amountAtomic, note }) => createPayMeLeased({ store: session.openStore(), connection: session.connection, id, requestId, amountAtomic, note }),
|
|
152849
153011
|
payMeRead: (id) => readPayMe(session.openStore(), id),
|
|
152850
153012
|
payMeList: () => listPayMe(session.openStore()),
|
|
@@ -154663,7 +154825,8 @@ var init_tools = __esm({
|
|
|
154663
154825
|
...Number.isSafeInteger(one.changeReadyInSeconds) ? { changeReadyInSeconds: one.changeReadyInSeconds } : {},
|
|
154664
154826
|
...ATOMIC_TEXT.test(shown) && ATOMIC_TEXT.test(upTo) && BigInt(upTo) < BigInt(shown) ? { changeUpToAtomic: upTo } : {},
|
|
154665
154827
|
// UX129-9: the value is the changes of this many recent payments (2 or more); changeUpToAtomic is then the largest.
|
|
154666
|
-
...Number.isSafeInteger(one.changeCount) && one.changeCount >= 2 ? { changeCount: one.changeCount } : {}
|
|
154828
|
+
...Number.isSafeInteger(one.changeCount) && one.changeCount >= 2 ? { changeCount: one.changeCount } : {},
|
|
154829
|
+
...one.changeRestOther === true ? { changeRestOther: true } : {}
|
|
154667
154830
|
};
|
|
154668
154831
|
};
|
|
154669
154832
|
balanceAnswer = (one, { shown = true } = {}) => one ? { ...balanceTextFields(one), breakdown: shown ? shownBreakdown(one.breakdown) : one.breakdown } : {};
|
|
@@ -174427,7 +174590,7 @@ var COMMANDS = [
|
|
|
174427
174590
|
"Without --refresh, balance reads only local files: the last walk (recover or balance --refresh) and the wallet log. Outside a set-up home it makes no network call; in a set-up home it reads the chain once when the last walk is not current, and reads the public USDC on the wallet's own address (one RPC read, at most 3 s).",
|
|
174428
174591
|
"USDC on the wallet's own public address is not private: the line after the balance names it and how to make it private (publicOnOwnAddressAtomic in the JSON; null when not read).",
|
|
174429
174592
|
"shinjukuShielded is null when the last walk is missing, stale, or incomplete. reasons says why; next shows the command to run.",
|
|
174430
|
-
`In a terminal it prints one plain line: the private balance in USDC, and a short reason when it is not current (then the command to run). The wallet's own progress lines (Tor, the RPC relay, the pool history walk, the memo reads) show only with --verbose; warnings and failures always show. A program, or --json, gets the whole report as JSON (total, shinjukuShielded, status, reasons, next, detail). Its spend is the terminal's spend sentence ("You can spend X USDC, up to S USDC in one payment now"; the MCP says "X USDC (a payment above S USDC first gets the balance ready)"), and largestPaymentAtomic is the most one payment can spend now (changeSettling: 0 only while the last payment's change settles, about changeReadyInSeconds; then one payment can use all of it, or changeUpToAtomic when a private send holds the rest).`,
|
|
174593
|
+
`In a terminal it prints one plain line: the private balance in USDC, and a short reason when it is not current (then the command to run). The wallet's own progress lines (Tor, the RPC relay, the pool history walk, the memo reads) show only with --verbose; warnings and failures always show. A program, or --json, gets the whole report as JSON (total, shinjukuShielded, status, reasons, next, detail). Its spend is the terminal's spend sentence ("You can spend X USDC, up to S USDC in one payment now"; the MCP says "X USDC (a payment above S USDC first gets the balance ready)"), and largestPaymentAtomic is the most one payment can spend now (changeSettling: 0 only while the last payment's change settles, about changeReadyInSeconds; then one payment can use all of it, or changeUpToAtomic when a private send holds the rest or, with changeRestOther, other value no payment can use now).`,
|
|
174431
174594
|
"Payments that others send to this wallet appear only after a refresh.",
|
|
174432
174595
|
"With --refresh it also reads the one-time deposit addresses of this home's earlier pools (one address per request). USDC found there goes into this pool by itself (Shinjuku pays the fee), and earlierDeposits lists each one with a notice.",
|
|
174433
174596
|
"paymentsWithoutWaiting (and detail.fundedAccounts): your funded deposits that no in-flight work holds. A payment spends one funded deposit, and its change pays only after the next pool anchor, so this many payments can run before the next anchor without waiting (a funded deposit made since the last anchor, such as a change, waits for the next one). add-funds --split makes more of them."
|
|
@@ -177346,7 +177509,8 @@ async function runBalance(args, values, deps, io) {
|
|
|
177346
177509
|
...parts.changeSettling === true ? {
|
|
177347
177510
|
changeSettling: true,
|
|
177348
177511
|
...Number.isSafeInteger(parts.changeReadyInSeconds) ? { changeReadyInSeconds: parts.changeReadyInSeconds } : {},
|
|
177349
|
-
.../^[0-9]+$/.test(String(parts.changeUpToAtomic ?? "")) && BigInt(parts.changeUpToAtomic) < BigInt(parts.spendableAtomic) ? { changeUpToAtomic: parts.changeUpToAtomic } : {}
|
|
177512
|
+
.../^[0-9]+$/.test(String(parts.changeUpToAtomic ?? "")) && BigInt(parts.changeUpToAtomic) < BigInt(parts.spendableAtomic) ? { changeUpToAtomic: parts.changeUpToAtomic } : {},
|
|
177513
|
+
...parts.changeRestOther === true ? { changeRestOther: true } : {}
|
|
177350
177514
|
} : {},
|
|
177351
177515
|
spend: spendHeads(parts.spendableAtomic, parts.largestPaymentAtomic, parts, { surface: "cli" })[0] ?? null,
|
|
177352
177516
|
refundsInFlightAtomic: parts.refundsInFlightAtomic,
|