shinjuku-shield 0.3.136 → 0.3.137
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 +5 -5
- package/manifest.json +4 -4
- package/package.json +3 -3
- package/shinjuku-wallet.mjs +54 -9
package/README.md
CHANGED
|
@@ -6,19 +6,19 @@ answers privately, in a terminal chat or for your agent app. Its `mcp`
|
|
|
6
6
|
command runs a local MCP server (stdio) for your agent. Your keys never
|
|
7
7
|
leave your machine.
|
|
8
8
|
|
|
9
|
-
This is version 0.3.
|
|
9
|
+
This is version 0.3.137. The npm packages `shinjuku-shield` and
|
|
10
10
|
`shinjuku-shielded` hold the same files. The command is `shinjuku`.
|
|
11
11
|
|
|
12
12
|
## Set up
|
|
13
13
|
|
|
14
14
|
```sh
|
|
15
|
-
npm install -g shinjuku@0.3.
|
|
15
|
+
npm install -g shinjuku@0.3.137
|
|
16
16
|
shinjuku setup
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
Type the two lines as they are. `npx install shinjuku` does not work: npx
|
|
20
20
|
reads `install` as the name of another npm package. To set up without
|
|
21
|
-
installing, type `npx shinjuku@0.3.
|
|
21
|
+
installing, type `npx shinjuku@0.3.137 setup`.
|
|
22
22
|
|
|
23
23
|
Setup makes the wallet on this machine, a private passphrase file, and the
|
|
24
24
|
checked proof tools (about 191 MB), and writes `config.json`. It also writes
|
|
@@ -36,13 +36,13 @@ Every wallet command works after `shinjuku`, for example `shinjuku balance`,
|
|
|
36
36
|
Claude Code:
|
|
37
37
|
|
|
38
38
|
```sh
|
|
39
|
-
claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.
|
|
39
|
+
claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.137 mcp
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
Claude Desktop (`claude_desktop_config.json`) or Cursor (`~/.cursor/mcp.json`):
|
|
43
43
|
|
|
44
44
|
```json
|
|
45
|
-
{ "mcpServers": { "shinjuku": { "command": "npx", "args": ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.
|
|
45
|
+
{ "mcpServers": { "shinjuku": { "command": "npx", "args": ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.137", "mcp"] } } }
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
On native Windows, if the host cannot find `npx`, use `"command": "cmd"` and
|
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": "65cad6591d92c21ba417dd24845ebb1f978e8ba59a0341a0e2c75e22b3bbe0b1",
|
|
5
|
+
"bytes": 8904356,
|
|
6
|
+
"sourceCommit": "617204b71a573393e425009ec68e3267e3b4d19d",
|
|
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",
|
|
@@ -1037,5 +1037,5 @@
|
|
|
1037
1037
|
"version": "1.8.0"
|
|
1038
1038
|
}
|
|
1039
1039
|
],
|
|
1040
|
-
"publishedAt": "2026-10-
|
|
1040
|
+
"publishedAt": "2026-10-31T18:02:49.677Z"
|
|
1041
1041
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinjuku-shield",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.137",
|
|
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": "65cad659",
|
|
7
|
+
"shinjukuSha256": "65cad6591d92c21ba417dd24845ebb1f978e8ba59a0341a0e2c75e22b3bbe0b1",
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
9
9
|
"author": "Shinjuku Shielded",
|
|
10
10
|
"homepage": "https://github.com/ShinjukuStaition/shinjuku-shield#readme",
|
package/shinjuku-wallet.mjs
CHANGED
|
@@ -108374,7 +108374,14 @@ function spendSentence(a, tails = ["."], room = SAY_MAX_WORDS) {
|
|
|
108374
108374
|
const refund = refundInFlight(a);
|
|
108375
108375
|
const refunds = !positive(refund) ? [""] : a.refreshReason === "refund_check" ? [`, plus a ${refund} USDC refund the wallet is checking`, `, plus ${refund} refund being checked`] : [`, plus ${refund} USDC refund on its way`, `, plus ${refund} refund coming`];
|
|
108376
108376
|
const unsure = usdcText2(a.breakdown?.refundsNotCertainAtomic);
|
|
108377
|
-
const
|
|
108377
|
+
const open4 = usdcText2(a.breakdown?.openPaymentsAtomic);
|
|
108378
|
+
const longNotes = [
|
|
108379
|
+
positive(open4) ? `${open4} USDC is in a payment still waiting on its seller; asking again finishes it, else it comes back by itself` : "",
|
|
108380
|
+
positive(unsure) ? `${unsure} USDC more is not certain yet` : ""
|
|
108381
|
+
].filter(Boolean);
|
|
108382
|
+
const shortNotes = [positive(open4) ? `${open4} USDC waits on its seller` : "", positive(unsure) ? `${unsure} more not certain yet` : ""].filter(Boolean);
|
|
108383
|
+
const midNotes = [positive(open4) ? `${open4} USDC waits on its seller; asking again finishes it, else it comes back` : "", ...shortNotes.slice(positive(open4) ? 1 : 0)];
|
|
108384
|
+
const unsures = longNotes.length ? [[` (${longNotes.join("; ")})`, ` (${midNotes.join("; ")})`, ` (${shortNotes.join("; ")})`], [""]] : [[""]];
|
|
108378
108385
|
const lines = unsures.flatMap((notes) => tails.flatMap((tail) => heads.flatMap((head) => notes.flatMap((note) => refunds.map((part) => `${head}${part}${note}${tail}`)))));
|
|
108379
108386
|
return lines.find((line) => words(line) <= room) ?? lines.at(-1);
|
|
108380
108387
|
}
|
|
@@ -109003,6 +109010,7 @@ function zeroOnTheWay(a) {
|
|
|
109003
109010
|
if (Object.hasOwn(a, "depositArrivingAtomic")) return `your deposit${of(a.depositArrivingAtomic)} is on its way; ask again once it arrives.`;
|
|
109004
109011
|
if (Object.hasOwn(a, "refundComingAtomic")) return `a refund${of(a.refundComingAtomic)} is on its way to it; ask again once it arrives.`;
|
|
109005
109012
|
if (Object.hasOwn(a, "refundMayComeAtomic")) return `a refund${of(a.refundMayComeAtomic)} may still come back to it; that is not certain yet.`;
|
|
109013
|
+
if (Object.hasOwn(a, "paymentWaitingAtomic")) return `a payment${of(a.paymentWaitingAtomic)} waits on its seller; asking again finishes it, else it comes back by itself.`;
|
|
109006
109014
|
return void 0;
|
|
109007
109015
|
}
|
|
109008
109016
|
function emptyUnshieldSay(a) {
|
|
@@ -112203,6 +112211,8 @@ function floatRefunds(store, snapshot) {
|
|
|
112203
112211
|
let notCertain = 0n;
|
|
112204
112212
|
const provenFor = [];
|
|
112205
112213
|
const notCertainFor = [];
|
|
112214
|
+
let open4 = 0n;
|
|
112215
|
+
const openFor = [];
|
|
112206
112216
|
for (const name of store.listWal()) {
|
|
112207
112217
|
if (!name.startsWith(FLOAT_PAYMENT_WAL_PREFIX2)) continue;
|
|
112208
112218
|
let record;
|
|
@@ -112216,6 +112226,12 @@ function floatRefunds(store, snapshot) {
|
|
|
112216
112226
|
if (floatLegNeverLanded(store, record.innerRequestId)) continue;
|
|
112217
112227
|
const state = floatRecordState(record);
|
|
112218
112228
|
const refusedOpen = state === "submitted" && record.ambiguous === true;
|
|
112229
|
+
if (state === "submitted" && !refusedOpen && !floatRefundHeld(snapshot, record)) {
|
|
112230
|
+
const { refundAtomic, ...payment } = refundOf(record);
|
|
112231
|
+
open4 += BigInt(record.paidAtomic);
|
|
112232
|
+
openFor.push({ ...payment, paidAtomic: refundAtomic });
|
|
112233
|
+
continue;
|
|
112234
|
+
}
|
|
112219
112235
|
if (state !== "refund_pending" && !refusedOpen || floatRefundHeld(snapshot, record)) continue;
|
|
112220
112236
|
if (refusedOpen || !knowsRecipients) {
|
|
112221
112237
|
notCertain += BigInt(record.paidAtomic);
|
|
@@ -112225,7 +112241,7 @@ function floatRefunds(store, snapshot) {
|
|
|
112225
112241
|
provenFor.push(refundOf(record));
|
|
112226
112242
|
}
|
|
112227
112243
|
}
|
|
112228
|
-
return { proven, notCertain, provenFor, notCertainFor };
|
|
112244
|
+
return { proven, notCertain, provenFor, notCertainFor, open: open4, openFor };
|
|
112229
112245
|
}
|
|
112230
112246
|
function balanceView(store) {
|
|
112231
112247
|
const neverReceived = /* @__PURE__ */ new Set();
|
|
@@ -112263,6 +112279,7 @@ function partsOf(report, store, snapshot) {
|
|
|
112263
112279
|
changeUpToAtomic: null,
|
|
112264
112280
|
refundsInFlightAtomic: null,
|
|
112265
112281
|
refundsNotCertainAtomic: null,
|
|
112282
|
+
openPaymentsAtomic: null,
|
|
112266
112283
|
setAsideAtomic: null,
|
|
112267
112284
|
totalAtomic: null,
|
|
112268
112285
|
privateSendPendingAtomic: report?.split?.privateSendPendingAtomic ?? null,
|
|
@@ -112286,6 +112303,8 @@ function partsOf(report, store, snapshot) {
|
|
|
112286
112303
|
refundsNotCertainAtomic: refunds.notCertain.toString(),
|
|
112287
112304
|
refundsInFlight: refunds.provenFor,
|
|
112288
112305
|
refundsNotCertain: refunds.notCertainFor,
|
|
112306
|
+
openPaymentsAtomic: refunds.open.toString(),
|
|
112307
|
+
openPayments: refunds.openFor,
|
|
112289
112308
|
setAsideAtomic: setAside.toString(),
|
|
112290
112309
|
totalAtomic: (spendable + setAside + refunds.proven).toString(),
|
|
112291
112310
|
privateSendPendingAtomic: report.split.privateSendPendingAtomic,
|
|
@@ -112331,6 +112350,14 @@ function balanceNow(store, { programId, source = "local", now, firstDepositEstim
|
|
|
112331
112350
|
return null;
|
|
112332
112351
|
}
|
|
112333
112352
|
}
|
|
112353
|
+
function openPaymentWords(parts) {
|
|
112354
|
+
if (!POSITIVE2.test(String(parts?.openPaymentsAtomic ?? ""))) return "";
|
|
112355
|
+
const list = Array.isArray(parts.openPayments) ? parts.openPayments : [];
|
|
112356
|
+
const one = list.length === 1 ? list[0] : void 0;
|
|
112357
|
+
const which = one?.seller ? `the payment to ${one.seller}` : list.length > 1 ? "those payments" : "that payment";
|
|
112358
|
+
const rerun = one?.requestId ? `run the same command again with --request-id ${one.requestId}` : "run the same command again with its --request-id";
|
|
112359
|
+
return `To finish ${which}, ${rerun} (it never pays twice); if the seller never takes it, Shinjuku sends it back to your private balance by itself within about ${Math.round(FLOAT_REFUND_ETA_SECONDS / 60)} minutes.`;
|
|
112360
|
+
}
|
|
112334
112361
|
function balanceWords(parts, { afterSend = false } = {}) {
|
|
112335
112362
|
const prepareCommand = commandLine("prepare");
|
|
112336
112363
|
const heads = parts && parts.spendableAtomic !== null ? spendHeads(parts.spendableAtomic, parts.largestPaymentAtomic, parts, { surface: "cli", prepareCommand }) : [];
|
|
@@ -112338,6 +112365,7 @@ function balanceWords(parts, { afterSend = false } = {}) {
|
|
|
112338
112365
|
if (spend === void 0) return void 0;
|
|
112339
112366
|
const positive2 = (atomic4) => POSITIVE2.test(String(atomic4 ?? ""));
|
|
112340
112367
|
const notes = [
|
|
112368
|
+
positive2(parts.openPaymentsAtomic) ? `${usdcWords(parts.openPaymentsAtomic)} in a payment waiting on its seller` : "",
|
|
112341
112369
|
positive2(parts.refundsNotCertainAtomic) ? `${usdcWords(parts.refundsNotCertainAtomic)} refund not certain yet` : "",
|
|
112342
112370
|
positive2(parts.setAsideAtomic) ? `${usdcWords(parts.setAsideAtomic)} set aside by an older version` : ""
|
|
112343
112371
|
].filter(Boolean);
|
|
@@ -112418,11 +112446,12 @@ function knownShortBalance(store, { needAtomic = 1n, payment = false, maxAgeMs }
|
|
|
112418
112446
|
addFundsOpen: deposits2.some((deposit) => deposit.addFunds),
|
|
112419
112447
|
refundsInFlightAtomic: parts.refundsInFlightAtomic,
|
|
112420
112448
|
refundsNotCertainAtomic: parts.refundsNotCertainAtomic,
|
|
112449
|
+
openPaymentsAtomic: parts.openPaymentsAtomic,
|
|
112421
112450
|
parts
|
|
112422
112451
|
};
|
|
112423
112452
|
}
|
|
112424
112453
|
function plainZero(short, { deposits: deposits2 = false } = {}) {
|
|
112425
|
-
return short !== void 0 && !short.receivedOnly && BigInt(short.spendableAtomic) === 0n && (deposits2 || short.deposits.length === 0) && ![short.refundsInFlightAtomic, short.refundsNotCertainAtomic].some((atomic4) => ABOVE_0.test(String(atomic4 ?? "")));
|
|
112454
|
+
return short !== void 0 && !short.receivedOnly && BigInt(short.spendableAtomic) === 0n && (deposits2 || short.deposits.length === 0) && ![short.refundsInFlightAtomic, short.refundsNotCertainAtomic, short.openPaymentsAtomic].some((atomic4) => ABOVE_0.test(String(atomic4 ?? "")));
|
|
112426
112455
|
}
|
|
112427
112456
|
function shortBalanceSentences(short, { costAtomic, outcome = short.payment ? "paid" : "send" } = {}) {
|
|
112428
112457
|
const balance = usdcWords(short.spendableAtomic);
|
|
@@ -112431,6 +112460,9 @@ function shortBalanceSentences(short, { costAtomic, outcome = short.payment ? "p
|
|
|
112431
112460
|
const sentences = [short.receivedOnly ? `${spendHeads(short.spendableAtomic, "0", { report: short.parts?.report })[0]}.${outcome === "paid" ? ` ${paid}` : ""}` : outcome === "none" ? `Your private balance is ${balance}.` : outcome === "send" ? BigInt(short.spendableAtomic) === 0n ? `Your private balance is ${balance}, so there is nothing to send.` : `Your private balance is ${balance}, less than ${usdcWords(short.needAtomic)}, so nothing was sent.` : cost ? `Your private balance is ${balance}. ${paid}` : `Your private balance is ${balance}, so nothing was paid.`];
|
|
112432
112461
|
if (ABOVE_0.test(String(short.refundsInFlightAtomic ?? ""))) sentences.push(`A refund of ${usdcWords(short.refundsInFlightAtomic)} is on its way to your private balance.`);
|
|
112433
112462
|
if (ABOVE_0.test(String(short.refundsNotCertainAtomic ?? ""))) sentences.push(`A refund of ${usdcWords(short.refundsNotCertainAtomic)} may still come back; that is not certain yet.`);
|
|
112463
|
+
if (ABOVE_0.test(String(short.openPaymentsAtomic ?? ""))) {
|
|
112464
|
+
sentences.push(`A payment of ${usdcWords(short.openPaymentsAtomic)} waits on its seller: asking for the same thing again finishes it (it never pays twice); if the seller never takes it, it comes back to your private balance by itself within about ${Math.round(FLOAT_REFUND_ETA_SECONDS / 60)} minutes.`);
|
|
112465
|
+
}
|
|
112434
112466
|
for (const addFunds2 of [false, true]) {
|
|
112435
112467
|
const open4 = short.deposits.filter((deposit) => deposit.addFunds === addFunds2);
|
|
112436
112468
|
if (!open4.length) continue;
|
|
@@ -112448,6 +112480,7 @@ var init_knownZero = __esm({
|
|
|
112448
112480
|
"use strict";
|
|
112449
112481
|
init_balanceNow();
|
|
112450
112482
|
init_usdcWords();
|
|
112483
|
+
init_floatPay();
|
|
112451
112484
|
ATOMIC6 = /^[0-9]{1,31}$/;
|
|
112452
112485
|
ABOVE_0 = /^0*[1-9]/;
|
|
112453
112486
|
}
|
|
@@ -128967,6 +129000,9 @@ function balanceFields(parts) {
|
|
|
128967
129000
|
// another payment's 0.011 USDC refund with no payment named, and the agent read it as this payment's refund.
|
|
128968
129001
|
...parts.refundsInFlight?.length ? { refundsInFlight: parts.refundsInFlight } : {},
|
|
128969
129002
|
...parts.refundsNotCertain?.length ? { refundsNotCertain: parts.refundsNotCertain } : {},
|
|
129003
|
+
// UX136-1: a payment whose seller answered an error while Shinjuku's transfer is open (balanceNow.mjs openPaymentsAtomic).
|
|
129004
|
+
openPaymentsAtomic: parts.openPaymentsAtomic,
|
|
129005
|
+
...parts.openPayments?.length ? { openPayments: parts.openPayments } : {},
|
|
128970
129006
|
setAsideAtomic: parts.setAsideAtomic,
|
|
128971
129007
|
totalAtomic: parts.totalAtomic,
|
|
128972
129008
|
// Parts of a running wallet_unshield private send not sent yet: already taken off shieldedAtomic (R4, no overspend in flight).
|
|
@@ -129520,7 +129556,7 @@ function createWalletTools({
|
|
|
129520
129556
|
const parts = balanceNow(session.openStore(), { programId: session.programId });
|
|
129521
129557
|
if (ATOMIC_TEXT.test(String(parts?.totalAtomic ?? ""))) {
|
|
129522
129558
|
const atomicOf = (value2) => ATOMIC_TEXT.test(String(value2 ?? "")) ? BigInt(value2) : 0n;
|
|
129523
|
-
whole = BigInt(parts.totalAtomic) + atomicOf(parts.refundsNotCertainAtomic) + (parts.report?.detail?.pendingDeposits ?? []).reduce((sum2, deposit) => sum2 + atomicOf(deposit?.amountAtomic), 0n);
|
|
129559
|
+
whole = BigInt(parts.totalAtomic) + atomicOf(parts.refundsNotCertainAtomic) + atomicOf(parts.openPaymentsAtomic) + (parts.report?.detail?.pendingDeposits ?? []).reduce((sum2, deposit) => sum2 + atomicOf(deposit?.amountAtomic), 0n);
|
|
129524
129560
|
}
|
|
129525
129561
|
} catch {
|
|
129526
129562
|
whole = void 0;
|
|
@@ -130354,12 +130390,14 @@ ${canonical5}`;
|
|
|
130354
130390
|
const above0 = (atomic4) => /^0*[1-9]/.test(String(atomic4 ?? "")) ? String(atomic4) : void 0;
|
|
130355
130391
|
const refund = above0(short.refundsInFlightAtomic);
|
|
130356
130392
|
const mayCome = above0(short.refundsNotCertainAtomic);
|
|
130393
|
+
const waitsOnSeller = above0(short.openPaymentsAtomic);
|
|
130357
130394
|
return {
|
|
130358
130395
|
balanceAtomic: "0",
|
|
130359
130396
|
...waiting.length ? { depositWaitingAtomic: sum2(waiting), ...waiting.some((deposit) => deposit.addFunds) ? { depositAddFunds: true } : {} } : {},
|
|
130360
130397
|
...arriving.length ? { depositArrivingAtomic: sum2(arriving) } : {},
|
|
130361
130398
|
...refund ? { refundComingAtomic: refund } : {},
|
|
130362
|
-
...mayCome ? { refundMayComeAtomic: mayCome } : {}
|
|
130399
|
+
...mayCome ? { refundMayComeAtomic: mayCome } : {},
|
|
130400
|
+
...waitsOnSeller ? { paymentWaitingAtomic: waitsOnSeller } : {}
|
|
130363
130401
|
};
|
|
130364
130402
|
};
|
|
130365
130403
|
const shortZeroStep = (short, then) => {
|
|
@@ -131679,6 +131717,9 @@ ${canonical5}`;
|
|
|
131679
131717
|
const inFlight = /^[1-9][0-9]*$/.test(String(one.breakdown?.refundsInFlightAtomic ?? "")) && !refundNotices?.length ? usdcText3(one.breakdown.refundsInFlightAtomic) : void 0;
|
|
131680
131718
|
const checking = refresh.refreshing === true && (refresh.refreshReason === void 0 || refresh.refreshReason === "refund_check");
|
|
131681
131719
|
const lines = [!known ? `Private balance: not known yet (${reading})${landing}` : checking ? `Private balance: last known ${usdcText3(one.balanceAtomic)} USDC${inFlight ? `, plus a ${inFlight} USDC refund` : ""}; the wallet is checking it now${landing}` : `Private balance: ${spendHeads(one.balanceAtomic, one.largestPaymentAtomic, one)[0].replace(/^You /, "you ")}${inFlight ? `, plus ${inFlight} USDC refund on its way` : ""}${landing}`];
|
|
131720
|
+
if (/^[1-9][0-9]*$/.test(String(one.breakdown?.openPaymentsAtomic ?? ""))) {
|
|
131721
|
+
lines.push(`Payment waiting on its seller: ${usdcText3(one.breakdown.openPaymentsAtomic)} USDC (asking for the same thing again finishes it and never pays twice; if the seller never takes it, Shinjuku sends it back by itself within about ${Math.round(FLOAT_REFUND_ETA_SECONDS / 60)} minutes)`);
|
|
131722
|
+
}
|
|
131682
131723
|
if (ATOMIC_TEXT.test(String(unshielded.unshieldedAtomic ?? ""))) lines.push(`Public USDC on this wallet's own key: ${usdcText3(unshielded.unshieldedAtomic)} USDC`);
|
|
131683
131724
|
let mode;
|
|
131684
131725
|
try {
|
|
@@ -131708,7 +131749,7 @@ ${canonical5}`;
|
|
|
131708
131749
|
const balance = {
|
|
131709
131750
|
name: "wallet_balance",
|
|
131710
131751
|
title: "Balance",
|
|
131711
|
-
description: `Use this when the user asks "what is my balance" or "how much USDC do I have": it answers ONE balance (balanceAtomic, what a payment can spend) and the public (unshielded) USDC. Always safe: it ${BALANCE_READ_DOES}.
|
|
131752
|
+
description: `Use this when the user asks "what is my balance" or "how much USDC do I have": it answers ONE balance (balanceAtomic, what a payment can spend) and the public (unshielded) USDC. Always safe: it ${BALANCE_READ_DOES}. On "show my wallet", print \`card\` as it is (at most 8 lines). largestPaymentAtomic: the most ONE payment can spend now; a payment above it is not refused: x402_pay gets the balance ready first (a tell-first answer, then doneInMinutesLow to doneInMinutesHigh minutes) (changeSettling: 0 only while the last payment's change settles, about changeReadyInSeconds; then one payment can use it all, or up to changeUpToAtomic). balanceParts (only above 1): never tell the user about parts, accounts or a merge; say only that a large payment or send first gets the balance ready. balanceAtomic is one number; breakdown names the rest (shieldedAtomic is the same value; privateSendPendingAtomic is what a running private send has not sent yet, already taken off; refundsInFlightAtomic is a refund Shinjuku proved, on its way, not in balanceAtomic; refundsNotCertainAtomic a refund the seller may have kept, in no number; openPaymentsAtomic: paid, waiting on its seller (same request_id finishes it, else refunded);setAsideAtomic (when not 0): value an older version set aside; totalAtomic adds these; during a pool move, pools lists each pool's share and movingAtomic is value on its way from the old pool to the new one; the move field shows the move, poolSwitches each switch). unshieldedAtomic is the public USDC on the wallet's own Solana key (ownAddress), which wallet_shield makes private; unshieldedSolLamports is that key's SOL (Shinjuku pays every fee and rent). A stale balance (a new deposit, a received payment) reads the chain first; past about 20 s it answers the last balance with refreshing: true and finishes in the background (call 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 gets its own balance ready to send and the number counts all of it; pool_move: value from the old pool arrives and the number counts it; refund_check: a refund counted from an old read, which the wallet checks now (never tell the user it is still on its way); 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. ownKeyTokens: the other tokens on ownAddress (not its USDC; [] when none; null when not read now: say nothing of other tokens), 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 (when any): USDC at an earlier pool's one-time deposit address, each with a notice line to tell the user; the wallet moves it by itself. addFunds (when any): each wallet_add_funds address still open, with its state and the USDC known to wait there (heldAtomic; null with heldNote when not read in time). startsAtNextRequest true (old name): its deposit starts by itself once USDC is seen there (startsInMinutes; 0: at once). 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 when next says. session: the spending limits (null or "none": no limit), what is left, and how to change them (session.summary, only when a limit is set). With no limit set, say nothing about limits or the session counters. To add money, use wallet_add_funds. version: this wallet's version. Amounts are atomic units (1000000 = 1 USDC); say and usdc give USDC.`,
|
|
131712
131753
|
inputSchema: { type: "object", properties: {
|
|
131713
131754
|
verbose: { type: "boolean", description: "Optional. true adds `internal`: the engineering numbers (funded balance records, notes, payments without waiting, a 0 set-aside value). Default false." }
|
|
131714
131755
|
}, additionalProperties: false },
|
|
@@ -138959,7 +139000,7 @@ var init_tools = __esm({
|
|
|
138959
139000
|
});
|
|
138960
139001
|
stageWords = (stage) => STAGE_WORDS[stage] ?? String(stage ?? "").replace(/self-pay/g, "preparing").replace(/^part (\d+\/\d+)/, "payment $1");
|
|
138961
139002
|
INTERNAL_BALANCE_DETAIL = /* @__PURE__ */ new Set(["successionMovableAtomic", "unspentNotes", "fundedAccounts", "budget", "unspentAccounts"]);
|
|
138962
|
-
shownBreakdown = (breakdown) => breakdown && typeof breakdown === "object" ? Object.fromEntries(Object.entries(breakdown).filter(([name, value2]) => !(["setAsideAtomic", "refundsInFlightAtomic", "refundsNotCertainAtomic"].includes(name) && value2 === "0"))) : breakdown;
|
|
139003
|
+
shownBreakdown = (breakdown) => breakdown && typeof breakdown === "object" ? Object.fromEntries(Object.entries(breakdown).filter(([name, value2]) => !(["setAsideAtomic", "refundsInFlightAtomic", "refundsNotCertainAtomic", "openPaymentsAtomic"].includes(name) && value2 === "0"))) : breakdown;
|
|
138963
139004
|
sessionLeftShown = (policy, store) => {
|
|
138964
139005
|
if (String(policy.limits?.maxSessionAtomic) === NO_LIMIT_ATOMIC) return null;
|
|
138965
139006
|
if (store) {
|
|
@@ -155276,8 +155317,10 @@ function privateBalanceLine(parts, { afterSend = false } = {}) {
|
|
|
155276
155317
|
const why = report && report.status !== "current" && report.status !== "empty" ? ` (${balanceNotCurrentWhy(report)})` : "";
|
|
155277
155318
|
return `Your private balance is not known yet${why}; run ${cli2()} balance --refresh to read it.`;
|
|
155278
155319
|
}
|
|
155279
|
-
|
|
155280
|
-
|
|
155320
|
+
const open4 = openPaymentWords(parts);
|
|
155321
|
+
const next = open4 ? ` ${open4}` : "";
|
|
155322
|
+
if (report.status === "current" || report.status === "empty") return `${words2}.${next}`;
|
|
155323
|
+
return `${words2} (not final yet: ${balanceNotCurrentWhy(report)}; ${cli2()} balance --refresh reads it again).${next}`;
|
|
155281
155324
|
}
|
|
155282
155325
|
async function refreshAfterUnshield(walletFile, values, deps, io) {
|
|
155283
155326
|
const pool2 = /([1-9A-HJ-NP-Za-km-z]{32,44})[\\/]wallet\.json$/.exec(resolve33(walletFile))?.[1];
|
|
@@ -156247,6 +156290,8 @@ async function runBalance(args, values, deps, io) {
|
|
|
156247
156290
|
spend: spendHeads(parts.spendableAtomic, parts.largestPaymentAtomic, parts, { surface: "cli", prepareCommand: `${cli2()} prepare` })[0] ?? null,
|
|
156248
156291
|
refundsInFlightAtomic: parts.refundsInFlightAtomic,
|
|
156249
156292
|
refundsNotCertainAtomic: parts.refundsNotCertainAtomic,
|
|
156293
|
+
openPaymentsAtomic: parts.openPaymentsAtomic,
|
|
156294
|
+
...parts.openPayments?.length ? { openPayments: parts.openPayments } : {},
|
|
156250
156295
|
setAsideAtomic: parts.setAsideAtomic,
|
|
156251
156296
|
totalAtomic: parts.totalAtomic,
|
|
156252
156297
|
total: parts.totalAtomic === null ? null : formatAtomic(BigInt(parts.totalAtomic), Number(store.state.decimals)),
|