shinjuku-shielded 0.3.13 → 0.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/manifest.json +3 -3
- package/package.json +3 -3
- package/shinjuku-wallet.mjs +65 -44
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": "6a87b0a15ec5979313adc3e9b7f19e239c2f14af1c46565e958054dbc60e8af7",
|
|
5
|
+
"bytes": 11122024,
|
|
6
|
+
"sourceCommit": "b5ba33a6fa8251d6c6226defa8fbfd235efe5817",
|
|
7
7
|
"sourceDirty": false,
|
|
8
8
|
"installRecordMatchesLockfile": true,
|
|
9
9
|
"releaseRule": "valid only when two fresh npm ci --ignore-scripts builds on different OSes give the same sha256; installRecordMatchesLockfile true means every entry npm installed equals its package-lock.json entry and every entry not marked optional, devOptional included, is installed: an optional entry (a package for another platform) may be absent",
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinjuku-shielded",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.15",
|
|
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": "6a87b0a1",
|
|
7
|
+
"shinjukuSha256": "6a87b0a15ec5979313adc3e9b7f19e239c2f14af1c46565e958054dbc60e8af7",
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
9
9
|
"author": "Shinjuku Shielded",
|
|
10
10
|
"homepage": "https://github.com/ShinjukuStaition/shinjuku-mcp#readme",
|
package/shinjuku-wallet.mjs
CHANGED
|
@@ -58607,9 +58607,6 @@ async function prepareRelayedDepositLeased({ store, connection, programId, proof
|
|
|
58607
58607
|
const minimum = closing ? config.closingSourceMinimumAtomic : pocketIndex !== void 0 && config.pocketMinimumAtomic !== void 0 ? config.pocketMinimumAtomic : config.minimumAtomic;
|
|
58608
58608
|
if (legacySource && amount < minimum) throw legacyBelowMinimum(legacySource, amount, minimum);
|
|
58609
58609
|
if (amount < minimum) fail11(pocketIndex !== void 0 && config.pocketMinimumAtomic === void 0 ? "relay_pocket_reshield_not_offered" : "relay_amount_below_facilitator_minimum");
|
|
58610
|
-
if (!record && pocketIndex === void 0 && !legacySource && config.depositUnitAtomic !== void 0 && amount % config.depositUnitAtomic !== 0n) {
|
|
58611
|
-
fail11("relay_amount_not_whole_unit");
|
|
58612
|
-
}
|
|
58613
58610
|
const pool = await poolState(connection, id);
|
|
58614
58611
|
if (amount > pool.maxDepositValue) fail11("amount_above_pool_deposit_cap");
|
|
58615
58612
|
if (BigInt(pool.depositCount) >= BigInt(pool.maxDeposits)) fail11("pool_at_deposit_cap");
|
|
@@ -58713,7 +58710,6 @@ async function readRelayConfig({ serviceUrl: serviceUrl2, fetchImpl, id }) {
|
|
|
58713
58710
|
minimumAtomic: BigInt(config.minimumAtomic),
|
|
58714
58711
|
closesSource: config.sourceCloseAuthority !== void 0,
|
|
58715
58712
|
...config.pocketMinimumAtomic === void 0 ? {} : { pocketMinimumAtomic: BigInt(config.pocketMinimumAtomic) },
|
|
58716
|
-
...config.depositUnitAtomic === void 0 ? {} : { depositUnitAtomic: BigInt(config.depositUnitAtomic) },
|
|
58717
58713
|
...config.closingSourceMinimumAtomic === void 0 ? {} : { closingSourceMinimumAtomic: BigInt(config.closingSourceMinimumAtomic) }
|
|
58718
58714
|
};
|
|
58719
58715
|
}
|
|
@@ -61876,6 +61872,8 @@ var init_errorCodes = __esm({
|
|
|
61876
61872
|
"mcp_unshield_to_not_allowed",
|
|
61877
61873
|
"mcp_unshield_to_invalid",
|
|
61878
61874
|
"mcp_shield_cap_exceeded",
|
|
61875
|
+
"mcp_shield_above_balance_cap",
|
|
61876
|
+
"mcp_balance_unknown",
|
|
61879
61877
|
"mcp_unshield_cap_exceeded",
|
|
61880
61878
|
"mcp_request_id_reused",
|
|
61881
61879
|
"mcp_shield_failed",
|
|
@@ -62362,6 +62360,7 @@ var init_errorCodes = __esm({
|
|
|
62362
62360
|
"float_not_ready",
|
|
62363
62361
|
"float_seller_uses_our_facilitator",
|
|
62364
62362
|
"float_payment_in_flight",
|
|
62363
|
+
"float_quote_open",
|
|
62365
62364
|
"float_already_paid",
|
|
62366
62365
|
"float_paid",
|
|
62367
62366
|
"p03_payer_float_wallet_pool_mismatch",
|
|
@@ -90984,9 +90983,9 @@ async function payViaFloat({
|
|
|
90984
90983
|
});
|
|
90985
90984
|
} catch (error) {
|
|
90986
90985
|
if (seen.refusal) {
|
|
90987
|
-
if (seen.refusal.code
|
|
90986
|
+
if (REGENERATE_CODES.has(seen.refusal.code) && !regenerated && innerUnsent()) {
|
|
90988
90987
|
regenerated = true;
|
|
90989
|
-
const refundTo = await ownRefundAddress(store, connection);
|
|
90988
|
+
const refundTo = await (deps.ownRefundAddress ?? ownRefundAddress)(store, connection);
|
|
90990
90989
|
const body = canonicalBody({ requestId, resourceUrl: record.url, requirement: record.requirement, refundTo });
|
|
90991
90990
|
record = { ...record, floatId: body.floatId, bodyBase64: body.bodyBase64, refundTo };
|
|
90992
90991
|
store.writeWal(walName2, record);
|
|
@@ -91090,7 +91089,7 @@ function paidResult(record, replayed) {
|
|
|
91090
91089
|
float: { floatId: record.floatId }
|
|
91091
91090
|
};
|
|
91092
91091
|
}
|
|
91093
|
-
var import_web3109, FLOAT_PAYMENT_SCHEMA, FLOAT_PAYMENT_WAL_PREFIX, FLOAT_CONFIG_SCHEMA, FLOAT_PAY_PATH, MAX_BODY_BYTES, FLOAT_REFUND_ETA_SECONDS, REFUND_SETTLED_AFTER_MS, FINISHING_POLL_MS, FINISHING_LIMIT_MS, SELLER_TIMEOUT_MS, CONFIG_TIMEOUT_MS, DECIMAL3, POSITIVE, PENDING_CODES, hash9, fail18, floatPaymentWalName, plainText;
|
|
91092
|
+
var import_web3109, FLOAT_PAYMENT_SCHEMA, REGENERATE_CODES, FLOAT_PAYMENT_WAL_PREFIX, FLOAT_CONFIG_SCHEMA, FLOAT_PAY_PATH, MAX_BODY_BYTES, FLOAT_REFUND_ETA_SECONDS, REFUND_SETTLED_AFTER_MS, FINISHING_POLL_MS, FINISHING_LIMIT_MS, SELLER_TIMEOUT_MS, CONFIG_TIMEOUT_MS, DECIMAL3, POSITIVE, PENDING_CODES, hash9, fail18, floatPaymentWalName, plainText;
|
|
91094
91093
|
var init_floatPay = __esm({
|
|
91095
91094
|
"wallet/src/pay/floatPay.mjs"() {
|
|
91096
91095
|
"use strict";
|
|
@@ -91107,6 +91106,7 @@ var init_floatPay = __esm({
|
|
|
91107
91106
|
init_proxy();
|
|
91108
91107
|
init_payResource();
|
|
91109
91108
|
FLOAT_PAYMENT_SCHEMA = "carbon-shielded-wallet/float-payment/v1";
|
|
91109
|
+
REGENERATE_CODES = /* @__PURE__ */ new Set(["float_payment_in_flight", "float_quote_open"]);
|
|
91110
91110
|
FLOAT_PAYMENT_WAL_PREFIX = "float-";
|
|
91111
91111
|
FLOAT_CONFIG_SCHEMA = "carbon-shielded-x402/float-config/v1";
|
|
91112
91112
|
FLOAT_PAY_PATH = "/api/x402/float/pay/";
|
|
@@ -124406,7 +124406,7 @@ async function readOwnPublicBalance({ session, store }) {
|
|
|
124406
124406
|
solLamports: String(solAccount?.lamports ?? 0)
|
|
124407
124407
|
};
|
|
124408
124408
|
}
|
|
124409
|
-
async function runShield({ session, depositId, amountAtomic,
|
|
124409
|
+
async function runShield({ session, depositId, amountAtomic, onStage, steps = {} }) {
|
|
124410
124410
|
const store = session.openStore();
|
|
124411
124411
|
const existing = store.readWal(`deposit-${depositId}`);
|
|
124412
124412
|
if (existing && !existing.relay) return runSelfBroadcastShield({ session, depositId, onStage });
|
|
@@ -124424,9 +124424,8 @@ async function runShield({ session, depositId, amountAtomic, unitAtomic, onStage
|
|
|
124424
124424
|
...common,
|
|
124425
124425
|
amountAtomic,
|
|
124426
124426
|
ownKey: true,
|
|
124427
|
-
// The CLI deposit's own admission check (shielded-wallet.mjs runSelfCustodyDeposit)
|
|
124427
|
+
// The CLI deposit's own admission check (shielded-wallet.mjs runSelfCustodyDeposit); any amount (no deposit unit).
|
|
124428
124428
|
checkAmount: ({ amount, pool, sourceAmount, vaultAmount }) => resolveAgentDepositAmount({
|
|
124429
|
-
denominationAtomic: unitAtomic,
|
|
124430
124429
|
requestedAtomic: amount,
|
|
124431
124430
|
walletBalanceAtomic: sourceAmount,
|
|
124432
124431
|
maxDepositValueAtomic: pool.maxDepositValue,
|
|
@@ -124469,7 +124468,7 @@ var usdcText = (atomic3, decimals = 6) => {
|
|
|
124469
124468
|
const text3 = formatAtomic(BigInt(atomic3), decimals);
|
|
124470
124469
|
return text3.includes(".") ? text3.replace(/0+$/, "").replace(/\.$/, "") : text3;
|
|
124471
124470
|
};
|
|
124472
|
-
async function runShieldFromElsewhere({ session, depositId, amountAtomic,
|
|
124471
|
+
async function runShieldFromElsewhere({ session, depositId, amountAtomic, onStage, steps = {} }) {
|
|
124473
124472
|
const store = session.openStore();
|
|
124474
124473
|
const common = {
|
|
124475
124474
|
store,
|
|
@@ -124486,9 +124485,8 @@ async function runShieldFromElsewhere({ session, depositId, amountAtomic, unitAt
|
|
|
124486
124485
|
await (steps.prepare ?? prepareRelayedDeposit)({
|
|
124487
124486
|
...common,
|
|
124488
124487
|
amountAtomic,
|
|
124489
|
-
// The CLI deposit --relay admission check
|
|
124488
|
+
// The CLI deposit --relay admission check (any amount, no deposit unit); the source is the one-time address.
|
|
124490
124489
|
checkAmount: ({ amount, pool, sourceAmount, vaultAmount }) => resolveAgentDepositAmount({
|
|
124491
|
-
denominationAtomic: unitAtomic,
|
|
124492
124490
|
requestedAtomic: amount,
|
|
124493
124491
|
walletBalanceAtomic: sourceAmount,
|
|
124494
124492
|
maxDepositValueAtomic: pool.maxDepositValue,
|
|
@@ -124720,6 +124718,7 @@ var REFRESH_RETRY_MS = 6e4;
|
|
|
124720
124718
|
var SWITCH_WAIT_MS = 4e4;
|
|
124721
124719
|
var ELICIT_TIMEOUT_MS = 5 * 6e4;
|
|
124722
124720
|
var POLL_SECONDS2 = 30;
|
|
124721
|
+
var MAX_SHIELDED_BALANCE_ATOMIC = 5000000n;
|
|
124723
124722
|
function createWalletTools({
|
|
124724
124723
|
session,
|
|
124725
124724
|
policy,
|
|
@@ -125691,8 +125690,6 @@ function createWalletTools({
|
|
|
125691
125690
|
else if (/another_deposit_unresolved/.test(code)) {
|
|
125692
125691
|
const waiting = waitingElsewhereIds();
|
|
125693
125692
|
next = waiting.length > 0 ? `Nothing new was moved. A wallet_shield_from_elsewhere address of this wallet still waits for its USDC (request_id ${waiting.map((id) => `"${id}"`).join(", ")}), and the wallet runs one deposit at a time. Either fund it and call wallet_shield_from_elsewhere again with that request_id until it is done, or, if nothing was sent to it, close it: call wallet_shield_from_elsewhere with action "cancel" and request_id "${waiting[0]}" (it refuses when any USDC or any transaction already reached the address; then only the owner's CLI deposit-reclaim frees it). Then call this one again` : `Nothing new was moved. Another deposit of this wallet is not finished (a wallet_shield, or a wallet_shield_from_elsewhere): call that tool again with its request_id until it is done, then call this one again. If no tool knows it, tell your owner: ${code} (the CLI's deposit records show which one)`;
|
|
125694
|
-
} else if (/relay_amount_not_whole_unit/.test(code)) {
|
|
125695
|
-
next = `Nothing was moved and no address was made. This pool takes deposits in whole units of its pocket size (the facilitator's /api/x402/deposit shows depositUnitAtomic): call ${KINDS[kind].tool} with a NEW request_id and amount_atomic a whole multiple of it`;
|
|
125696
125693
|
} else if (kind === "shield" && /relay_amount_below_facilitator_minimum/.test(code)) {
|
|
125697
125694
|
next = "Nothing was moved. The facilitator does not relay a deposit this small: call wallet_shield with a NEW request_id and a larger amount_atomic";
|
|
125698
125695
|
} else if (kind === "shield" && /relay_not_offered|relay_config_mismatch|relay_config_invalid|relay_service_required|proof_tools_missing/.test(code)) {
|
|
@@ -125730,13 +125727,6 @@ function createWalletTools({
|
|
|
125730
125727
|
if (typeof amount !== "string" || !POSITIVE_ATOMIC4.test(amount)) {
|
|
125731
125728
|
return { refusal: ["mcp_argument_invalid", "amount_atomic must be a positive whole number of atomic units (USDC: 1000000 = 1 USDC)", 'pass amount_atomic as a string, like "1000000"'] };
|
|
125732
125729
|
}
|
|
125733
|
-
if (kind !== "unshield" && money.depositUnitAtomic && BigInt(amount) % BigInt(money.depositUnitAtomic) !== 0n) {
|
|
125734
|
-
return { refusal: [
|
|
125735
|
-
"mcp_argument_invalid",
|
|
125736
|
-
`amount_atomic must be a whole multiple of ${money.depositUnitAtomic} on this pool (whole deposit units); nothing was moved`,
|
|
125737
|
-
`pass a multiple of ${money.depositUnitAtomic}, like ${money.depositUnitAtomic}`
|
|
125738
|
-
] };
|
|
125739
|
-
}
|
|
125740
125730
|
if (kind === "unshield") {
|
|
125741
125731
|
let canonical5 = false;
|
|
125742
125732
|
try {
|
|
@@ -125902,6 +125892,35 @@ function createWalletTools({
|
|
|
125902
125892
|
const detail = `this MCP session already moved ${total} of its ${spec.capFlag} ${max}; ${amount} more is above it`;
|
|
125903
125893
|
return refuse9(spec.capCode, `${detail}; nothing ${record ? "more " : ""}was moved`, ownerNext(detail), { requestId: request.requestId });
|
|
125904
125894
|
}
|
|
125895
|
+
if (kind !== "unshield" && !record) {
|
|
125896
|
+
let stale;
|
|
125897
|
+
try {
|
|
125898
|
+
stale = shieldedUnknown(session.openStore());
|
|
125899
|
+
} catch {
|
|
125900
|
+
stale = true;
|
|
125901
|
+
}
|
|
125902
|
+
if (stale) await refreshShared().catch(() => {
|
|
125903
|
+
});
|
|
125904
|
+
const one = localBalance(session);
|
|
125905
|
+
if (one?.balanceAtomic === null || one?.balanceAtomic === void 0) {
|
|
125906
|
+
return refuse9(
|
|
125907
|
+
"mcp_balance_unknown",
|
|
125908
|
+
`the shielded balance could not be read just now (the chain read failed, or another wallet command holds this wallet), so the wallet cannot check the ${usdcText(MAX_SHIELDED_BALANCE_ATOMIC)} USDC balance cap; nothing was moved`,
|
|
125909
|
+
`call ${spec.tool} again with the same request_id and amount_atomic in ${POLL_SECONDS2} s`,
|
|
125910
|
+
{ requestId: request.requestId }
|
|
125911
|
+
);
|
|
125912
|
+
}
|
|
125913
|
+
const room = MAX_SHIELDED_BALANCE_ATOMIC - BigInt(one.balanceAtomic);
|
|
125914
|
+
if (BigInt(request.amountAtomic) > room) {
|
|
125915
|
+
const left = room > 0n ? room : 0n;
|
|
125916
|
+
return refuse9(
|
|
125917
|
+
"mcp_shield_above_balance_cap",
|
|
125918
|
+
`the shielded balance may hold at most ${usdcText(MAX_SHIELDED_BALANCE_ATOMIC)} USDC; it holds ${usdcText(one.balanceAtomic)} USDC, so at most ${usdcText(left)} USDC more can be shielded now; nothing was moved`,
|
|
125919
|
+
left > 0n ? `Tell the user the cap. Call ${spec.tool} with a NEW request_id and amount_atomic at most "${left}"` : "Tell the user the shielded balance is at its cap: spend some with x402_pay, or send some out with wallet_unshield, before shielding more",
|
|
125920
|
+
{ requestId: request.requestId, balanceAtomic: one.balanceAtomic, maxBalanceAtomic: MAX_SHIELDED_BALANCE_ATOMIC.toString(), roomAtomic: left.toString() }
|
|
125921
|
+
);
|
|
125922
|
+
}
|
|
125923
|
+
}
|
|
125905
125924
|
if (!deferCount) {
|
|
125906
125925
|
moved[spec.counter] += amount;
|
|
125907
125926
|
counted.set(key, amount);
|
|
@@ -126007,7 +126026,6 @@ function createWalletTools({
|
|
|
126007
126026
|
session,
|
|
126008
126027
|
depositId: moneyId(job.requestId),
|
|
126009
126028
|
amountAtomic: job.amountAtomic,
|
|
126010
|
-
unitAtomic: money.depositUnitAtomic,
|
|
126011
126029
|
onStage,
|
|
126012
126030
|
steps: { prepare: ops.prepareOwnRelayed, submit: ops.submitOwnRelayed }
|
|
126013
126031
|
});
|
|
@@ -126017,7 +126035,6 @@ function createWalletTools({
|
|
|
126017
126035
|
session,
|
|
126018
126036
|
depositId: elsewhereId(job.requestId),
|
|
126019
126037
|
amountAtomic: job.amountAtomic,
|
|
126020
|
-
unitAtomic: money.depositUnitAtomic,
|
|
126021
126038
|
onStage,
|
|
126022
126039
|
steps: { prepare: ops.prepareRelayed, submit: ops.submitRelayed }
|
|
126023
126040
|
});
|
|
@@ -126158,11 +126175,11 @@ function createWalletTools({
|
|
|
126158
126175
|
const shield = {
|
|
126159
126176
|
name: "wallet_shield",
|
|
126160
126177
|
title: "Shield USDC (make it private)",
|
|
126161
|
-
description: `Use this when the user says "shield 5 USDC", "make my USDC private", or "add funds to my shielded balance": it moves amount_atomic of the plain public USDC on this wallet's own Solana key (wallet_balance unshieldedAtomic) into the SHIELDED balance, which x402_pay and wallet_unshield spend. The USDC stays the user's. Cost: no SOL. The wallet's key only signs an approval of the amount; the facilitator's relayer submits the deposit and pays every network fee and rent.
|
|
126178
|
+
description: `Use this when the user says "shield 5 USDC", "make my USDC private", or "add funds to my shielded balance": it moves amount_atomic of the plain public USDC on this wallet's own Solana key (wallet_balance unshieldedAtomic) into the SHIELDED balance, which x402_pay and wallet_unshield spend. The USDC stays the user's. Cost: no SOL. The wallet's key only signs an approval of the amount; the facilitator's relayer submits the deposit and pays every network fee and rent. Any amount from 0.01 USDC (amount_atomic 10000; the facilitator's minimum) works, cents included, while the shielded balance stays at most 5 USDC (mcp_shield_above_balance_cap says how much more fits). Privacy: the chain shows this key depositing this amount; later payments from the shielded balance do not show this wallet. It takes a few minutes: the first call starts it and answers stage (proving, submitting, done); call wallet_shield again with the SAME request_id and amount_atomic in ${POLL_SECONDS2} s for the status. When the deposit lands, the wallet reads it from the chain by itself (refreshing: true until it is spendable) and writes an encrypted backup (backupPath). The same request_id never deposits twice, also after a restart. One deposit at a time. An optional owner cap (--max-shield) may bound each call and this session (mcp_shield_cap_exceeded: tell the owner). Refusals: mcp_argument_invalid, mcp_request_id_reused, wallet_locked, mcp_tool_disabled, mcp_shield_failed, and the deposit's own p03_deposit_* codes.`,
|
|
126162
126179
|
inputSchema: {
|
|
126163
126180
|
type: "object",
|
|
126164
126181
|
properties: {
|
|
126165
|
-
amount_atomic: { type: "string", pattern: "^[1-9][0-9]*$", description: "USDC to shield, in atomic units (1000000 = 1 USDC
|
|
126182
|
+
amount_atomic: { type: "string", pattern: "^[1-9][0-9]*$", description: "USDC to shield, in atomic units (1000000 = 1 USDC, 370000 = 0.37 USDC): any amount from 10000 (0.01 USDC) while the balance stays at most 5 USDC." },
|
|
126166
126183
|
request_id: { type: "string", pattern: "^[A-Za-z0-9_-]{1,44}$", description: "Your stable name for this deposit, like shield-1; pass it again to read the status." }
|
|
126167
126184
|
},
|
|
126168
126185
|
required: ["amount_atomic", "request_id"],
|
|
@@ -126195,7 +126212,7 @@ function createWalletTools({
|
|
|
126195
126212
|
inputSchema: {
|
|
126196
126213
|
type: "object",
|
|
126197
126214
|
properties: {
|
|
126198
|
-
amount_atomic: { type: "string", pattern: "^[1-9][0-9]*$", description: "USDC to shield, in atomic units (1000000 = 1 USDC
|
|
126215
|
+
amount_atomic: { type: "string", pattern: "^[1-9][0-9]*$", description: "USDC to shield, in atomic units (1000000 = 1 USDC, 370000 = 0.37 USDC): any amount from 10000 (0.01 USDC) while the balance stays at most 5 USDC. Required unless action is cancel." },
|
|
126199
126216
|
request_id: { type: "string", pattern: "^[A-Za-z0-9_-]{1,44}$", description: "Your stable name for this deposit, like from-phantom-1; pass it again (with the same amount_atomic) to read the status." },
|
|
126200
126217
|
action: { type: "string", enum: ["deposit", "cancel"], description: "deposit (the default): start or read this deposit. cancel: close this request's one-time address while nothing at all reached it (no amount_atomic needed)." }
|
|
126201
126218
|
},
|
|
@@ -126772,8 +126789,7 @@ function moneyOptions({
|
|
|
126772
126789
|
exitProofToolsPath,
|
|
126773
126790
|
profilePath,
|
|
126774
126791
|
proofToolsPath,
|
|
126775
|
-
memoServiceUrl
|
|
126776
|
-
depositUnitAtomic
|
|
126792
|
+
memoServiceUrl
|
|
126777
126793
|
}, asText = (value) => value === void 0 || value === null ? "" : String(value)) {
|
|
126778
126794
|
if (noShield === true && allowShield === true) setupInvalid("--no-shield and --allow-shield contradict each other; pass one");
|
|
126779
126795
|
const shieldCap = asText(maxShieldAtomic);
|
|
@@ -126828,8 +126844,7 @@ function moneyOptions({
|
|
|
126828
126844
|
...shieldOn && shieldCap ? { maxShieldAtomic: shieldCap } : {},
|
|
126829
126845
|
allowUnshield: unshieldOn,
|
|
126830
126846
|
unshieldTo: Object.freeze([...new Set(addresses)]),
|
|
126831
|
-
...unshieldOn ? { ...unshieldCap ? { maxUnshieldAtomic: unshieldCap } : {}, exitProofTools, profile, facilitatorOrigin: facilitatorOrigin2 } : {}
|
|
126832
|
-
...depositUnitAtomic ? { depositUnitAtomic: asText(depositUnitAtomic) } : {}
|
|
126847
|
+
...unshieldOn ? { ...unshieldCap ? { maxUnshieldAtomic: unshieldCap } : {}, exitProofTools, profile, facilitatorOrigin: facilitatorOrigin2 } : {}
|
|
126833
126848
|
});
|
|
126834
126849
|
}
|
|
126835
126850
|
async function runMcpServer({ input = process.stdin, output: output2 = process.stdout, errorOutput = process.stderr, updateCheck, ...options } = {}) {
|
|
@@ -126876,7 +126891,6 @@ async function openWalletServer({
|
|
|
126876
126891
|
maxUnshieldAtomic,
|
|
126877
126892
|
exitProofToolsPath,
|
|
126878
126893
|
profilePath,
|
|
126879
|
-
depositUnitAtomic,
|
|
126880
126894
|
autoPockets = true,
|
|
126881
126895
|
readyPockets,
|
|
126882
126896
|
discoverWarmup = false,
|
|
@@ -126904,8 +126918,7 @@ async function openWalletServer({
|
|
|
126904
126918
|
exitProofToolsPath,
|
|
126905
126919
|
profilePath,
|
|
126906
126920
|
proofToolsPath,
|
|
126907
|
-
memoServiceUrl
|
|
126908
|
-
depositUnitAtomic
|
|
126921
|
+
memoServiceUrl
|
|
126909
126922
|
}, asText);
|
|
126910
126923
|
const live = {
|
|
126911
126924
|
...proofToolsPath ? { proofToolsPath: resolve23(proofToolsPath) } : {},
|
|
@@ -131995,8 +132008,6 @@ function mcpServerOptions(values, deps) {
|
|
|
131995
132008
|
...values.has("--max-unshield") ? { maxUnshieldAtomic: values.get("--max-unshield") } : {},
|
|
131996
132009
|
...values.has("--exit-proof-tools") ? { exitProofToolsPath: values.get("--exit-proof-tools") } : {},
|
|
131997
132010
|
...values.has("--profile") ? { profilePath: values.get("--profile") } : {},
|
|
131998
|
-
// A wallet_shield deposit takes whole units of this service's pools, as a relayed deposit does.
|
|
131999
|
-
...!values.has("--no-shield") && RELAYED_DEPOSIT_UNIT[pool] ? { depositUnitAtomic: RELAYED_DEPOSIT_UNIT[pool] } : {},
|
|
132000
132011
|
// Automatic pockets: on by default (they fill with the unshield inputs, which config.json from setup holds).
|
|
132001
132012
|
autoPockets: !values.has("--no-auto-pockets"),
|
|
132002
132013
|
...values.has("--ready-pockets") ? { readyPockets: values.get("--ready-pockets") } : {},
|
|
@@ -132988,7 +132999,7 @@ var COMMANDS = [
|
|
|
132988
132999
|
"The provers are Linux programs. Linux: ready. Windows: the wallet runs them through WSL; setup checks that wsl.exe runs (wsl --install -d Ubuntu otherwise). macOS: not supported; setup says so and creates nothing.",
|
|
132989
133000
|
"Run it again at any time: it never changes an existing wallet, keeps the recorded caps unless you pass new ones, checks every proof-tool file again, downloads what is missing or newer, and rewrites config.json.",
|
|
132990
133001
|
"Then mcp needs no flags: npx -y shinjuku-shielded mcp reads config.json (a flag on the command line still wins). Before setup, mcp in a terminal offers to run setup; started by an agent host, it serves shinjuku_setup, which runs this same setup after you confirm in the host.",
|
|
132991
|
-
"A command that takes --pool (balance, recover, deposit, add-funds, and others) takes it, and the passphrase of this home's wallet, from config.json when you leave them out: shinjuku-wallet balance needs no flags. A flag or SHIELDED_WALLET_PASSPHRASE still wins; init and restore never use config.json, and move reads it itself."
|
|
133002
|
+
"A command that takes --pool (balance, recover, deposit, add-funds, and others) takes it, and the passphrase of this home's wallet, from config.json when you leave them out: shinjuku-wallet balance needs no flags. A pocket command (pocket list, scan, reshield, release, fill) takes this home's --wallet and passphrase file the same way, and --program, --proof-tools, --facilitator when it needs them. A flag or SHIELDED_WALLET_PASSPHRASE still wins; init and restore never use config.json, and move reads it itself."
|
|
132992
133003
|
],
|
|
132993
133004
|
next: `start it from your agent host with npx -y shinjuku-shielded mcp (or ${CLI2} mcp), then ask your agent "what is my balance"`,
|
|
132994
133005
|
run: (args, values, deps, io) => deps.setupMain(values, { ...deps, io })
|
|
@@ -133669,17 +133680,30 @@ function configDefaults(command, args, deps) {
|
|
|
133669
133680
|
const passphraseFileSpec = command.flags.find((spec) => spec.name === "--passphrase-file");
|
|
133670
133681
|
const envPassphrase = Boolean(deps.env[PASSPHRASE_ENV2]);
|
|
133671
133682
|
const wantPool = has2("--pool") && !given.has("--pool") && !given.has("--wallet");
|
|
133683
|
+
const wantWallet = !has2("--pool") && has2("--wallet") && !given.has("--wallet");
|
|
133672
133684
|
const wantFile = Boolean(passphraseFileSpec) && !given.has("--passphrase-file") && (passphraseFileSpec.required || !envPassphrase);
|
|
133673
133685
|
const wantEnv = !passphraseFileSpec && command.env.includes(PASSPHRASE_ENV2) && !envPassphrase;
|
|
133674
|
-
if (!wantPool && !wantFile && !wantEnv) return unchanged;
|
|
133686
|
+
if (!wantPool && !wantWallet && !wantFile && !wantEnv) return unchanged;
|
|
133675
133687
|
const home = setupHome(deps.env);
|
|
133676
133688
|
const config = setupConfigOf(home);
|
|
133677
133689
|
if (!config) return unchanged;
|
|
133678
|
-
const added = wantPool ? ["--pool", config.pool] : [];
|
|
133690
|
+
const added = wantPool ? ["--pool", config.pool] : wantWallet ? ["--wallet", homeWalletPath(home, config.pool)] : [];
|
|
133691
|
+
const fromConfig = [
|
|
133692
|
+
["--program", config.program],
|
|
133693
|
+
["--proof-tools", config.proofTools],
|
|
133694
|
+
["--facilitator", config.memoService],
|
|
133695
|
+
["--service", config.memoService]
|
|
133696
|
+
];
|
|
133697
|
+
if (wantPool || wantWallet || given.has("--wallet") || given.get("--pool") === config.pool) {
|
|
133698
|
+
for (const [name, value] of fromConfig) {
|
|
133699
|
+
if (typeof value === "string" && command.flags.some((spec) => spec.name === name && spec.required) && !given.has(name)) added.push(name, value);
|
|
133700
|
+
}
|
|
133701
|
+
}
|
|
133679
133702
|
const pool = wantPool ? config.pool : given.get("--pool");
|
|
133680
133703
|
const homePools = [config.pool, ...(config.previousPools ?? []).map((entry) => entry.pool)];
|
|
133681
|
-
const ownWallet = given.has("--wallet") ? homePools.some((entry) => resolve35(given.get("--wallet")) === resolve35(homeWalletPath(home, entry))) : homePools.includes(pool);
|
|
133682
|
-
if (!ownWallet
|
|
133704
|
+
const ownWallet = wantWallet || (given.has("--wallet") ? homePools.some((entry) => resolve35(given.get("--wallet")) === resolve35(homeWalletPath(home, entry))) : homePools.includes(pool));
|
|
133705
|
+
if (!ownWallet) return unchanged;
|
|
133706
|
+
if (!wantFile && !wantEnv) return { args: [...args, ...added], passphrase: void 0 };
|
|
133683
133707
|
const where = `config.json (${join34(home, "config.json")})`;
|
|
133684
133708
|
if (wantFile) {
|
|
133685
133709
|
if (!config.passphraseFile) {
|
|
@@ -134478,9 +134502,6 @@ function relayDepositFailureHint(reason) {
|
|
|
134478
134502
|
if (/p03_deposit_token_balance_unreadable/.test(reason)) {
|
|
134479
134503
|
return "the RPC did not answer a USDC balance read (after 5 tries), so the wallet stopped: it never reads a failed read as 0. Do NOT send more USDC because of this; nothing was sent. Rerun the same command later, or use another --rpc";
|
|
134480
134504
|
}
|
|
134481
|
-
if (/p03_deposit_relay_amount_not_whole_unit/.test(reason)) {
|
|
134482
|
-
return "this pool takes deposits in whole units of its pocket size (GET <facilitator>/api/x402/deposit shows depositUnitAtomic), so no amount marks one depositor; nothing was recorded or sent. Rerun with --amount a whole multiple of it";
|
|
134483
|
-
}
|
|
134484
134505
|
if (/p03_deposit_relay_amount_below_facilitator_minimum/.test(reason)) {
|
|
134485
134506
|
return "the facilitator relays deposits of at least its minimum (GET <facilitator>/api/x402/deposit shows minimumAtomic); nothing was recorded. Rerun with a larger --amount";
|
|
134486
134507
|
}
|