x402-proxy 0.11.5 → 0.12.0
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/CHANGELOG.md +100 -1
- package/README.md +3 -3
- package/dist/bin/cli.js +91 -25
- package/dist/index.js +2 -0
- package/dist/setup-5KzHDwRR.js +3 -0
- package/dist/{setup-q91MbrZT.js → setup-C-fXZBSh.js} +1 -1
- package/dist/{status-DjZdIeES.js → status-CALRKYFp.js} +1 -1
- package/dist/status-CawITnuz.js +3 -0
- package/dist/{wallet-CUCoLEqs.js → wallet-PKXYPnrG.js} +28 -5
- package/dist/wallet-sqd5HaHh.js +3 -0
- package/package.json +2 -2
- package/dist/setup-DPuLACk7.js +0 -3
- package/dist/status-B2xUewrq.js +0 -3
- package/dist/wallet-BsCgqUun.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,96 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.12.0] - 2026-06-11
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Monad mainnet (`eip155:143`) support: `--network monad` selects Monad payment options, and the free public RPC (`https://rpc.monad.xyz`) is wired into `wallet info` for USDC/MON balances. Payments settle gaslessly via x402 `transferWithAuthorization` on Monad USDC (`0x754704Bc059F8C67012fEd69BC8A327a5aafb603`).
|
|
15
|
+
|
|
16
|
+
## [0.11.6] - 2026-04-07
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Fix HTTP 404 on OpenClaw inference proxy: upstream URL was missing `/v1` suffix, causing requests to hit `/api/v1/inference/chat/completions` instead of `/api/v1/inference/v1/chat/completions`
|
|
21
|
+
- Fix `fetchUpstreamModels` URL construction after upstream URL correction
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- 5 missing models in `MODEL_METADATA`: `z-ai/glm-5.1`, `x-ai/grok-4.20-multi-agent-beta`, `x-ai/grok-4.1-fast:online`, `x-ai/grok-4.20-beta:online`, `x-ai/grok-4.20-multi-agent-beta:online`
|
|
26
|
+
- Catalog auto-sync: `fetchUpstreamModels()` now called in catalog `run` to fetch live model list from upstream on gateway restart
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- Downgrade plugin startup logs from `info` to `debug` to reduce log spam during `oc status`/`oc doctor`
|
|
31
|
+
|
|
32
|
+
## [0.11.5] - 2026-04-07
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- Fix race condition in MPP MCP proxy: concurrent tool calls no longer overwrite each other's payment amounts (replaced shared mutable variable with AsyncLocalStorage per-call context)
|
|
37
|
+
|
|
38
|
+
## [0.11.4] - 2026-04-03
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- Model catalog: Claude Opus 4.5, Claude Sonnet 4.5, Grok 4.1 Fast, MiniMax M2.7
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- Refactor model defaults from array to record-based `MODEL_METADATA` lookup
|
|
47
|
+
- Provider auth now returns config patch when wallet already exists (fixes missing provider config on re-setup)
|
|
48
|
+
- Remove `autoEnableWhenConfiguredProviders` from plugin manifest (unnecessary for explicitly installed plugins)
|
|
49
|
+
|
|
50
|
+
## [0.11.3] - 2026-04-03
|
|
51
|
+
|
|
52
|
+
### Changed
|
|
53
|
+
|
|
54
|
+
- README rewritten to Standard Readme spec (badges, ToC, Install/Usage/Contributing sections)
|
|
55
|
+
- SKILL.md updated for consistency (MCP proxy mention, unified flag style)
|
|
56
|
+
- Unified package description across README, SKILL.md, and package.json
|
|
57
|
+
|
|
58
|
+
## [0.11.2] - 2026-04-02
|
|
59
|
+
|
|
60
|
+
### Fixed
|
|
61
|
+
|
|
62
|
+
- Strip surrounding quotes from mnemonic in `/x_wallet setup import` (Telegram copy-paste)
|
|
63
|
+
- Show actual word count in mnemonic validation errors
|
|
64
|
+
|
|
65
|
+
## [0.11.1] - 2026-04-02
|
|
66
|
+
|
|
67
|
+
### Fixed
|
|
68
|
+
|
|
69
|
+
- Fix x402-proxy-openclaw publish workflow permissions
|
|
70
|
+
|
|
71
|
+
## [0.11.0] - 2026-04-02
|
|
72
|
+
|
|
73
|
+
### Added
|
|
74
|
+
|
|
75
|
+
- OpenClaw `providerAuthChoices` wallet setup flow - interactive generate/import via gateway prompter
|
|
76
|
+
- `/x_wallet setup` subcommand for Telegram/slash-command wallet creation (generate or import mnemonic)
|
|
77
|
+
- BIP-39 mnemonic validation on import (both interactive and slash-command paths)
|
|
78
|
+
- `createWalletFile()` helper in config module
|
|
79
|
+
|
|
80
|
+
### Changed
|
|
81
|
+
|
|
82
|
+
- Converted dynamic imports in `handler.ts` to static imports (mppx, viem/accounts)
|
|
83
|
+
- Updated example URLs from POST `{"ref":"CoinbaseDev"}` to simpler GET `/twitter/user/openclaw`
|
|
84
|
+
- Usage examples now show `npx x402-proxy` prefix consistently
|
|
85
|
+
- OpenClaw compat bumped to `2026.4.1`
|
|
86
|
+
- Wallet-not-found error messages now suggest `/x_wallet setup` instead of CLI-only instructions
|
|
87
|
+
|
|
88
|
+
### Removed
|
|
89
|
+
|
|
90
|
+
- Default model display from `/x_wallet` info output
|
|
91
|
+
|
|
92
|
+
## [0.10.12] - 2026-04-02
|
|
93
|
+
|
|
94
|
+
### Fixed
|
|
95
|
+
|
|
96
|
+
- Restore explicit SetComputeUnitLimit instruction for Solana transactions
|
|
97
|
+
- Strip `outputSchema` from proxied MCP tool definitions
|
|
98
|
+
- Downgrade @modelcontextprotocol/sdk to 1.27.1 for compatibility
|
|
99
|
+
|
|
10
100
|
## [0.10.9] - 2026-04-02
|
|
11
101
|
|
|
12
102
|
### Fixed
|
|
@@ -413,7 +503,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
413
503
|
- `appendHistory` / `readHistory` / `calcSpend` - JSONL transaction history
|
|
414
504
|
- Re-exports from `@x402/fetch`, `@x402/svm`, `@x402/evm`
|
|
415
505
|
|
|
416
|
-
[Unreleased]: https://github.com/cascade-protocol/x402-proxy/compare/v0.
|
|
506
|
+
[Unreleased]: https://github.com/cascade-protocol/x402-proxy/compare/v0.12.0...HEAD
|
|
507
|
+
[0.12.0]: https://github.com/cascade-protocol/x402-proxy/compare/v0.11.6...v0.12.0
|
|
508
|
+
[0.11.6]: https://github.com/cascade-protocol/x402-proxy/compare/v0.11.5...v0.11.6
|
|
509
|
+
[0.11.5]: https://github.com/cascade-protocol/x402-proxy/compare/v0.11.4...v0.11.5
|
|
510
|
+
[0.11.4]: https://github.com/cascade-protocol/x402-proxy/compare/v0.11.3...v0.11.4
|
|
511
|
+
[0.11.3]: https://github.com/cascade-protocol/x402-proxy/compare/v0.11.2...v0.11.3
|
|
512
|
+
[0.11.2]: https://github.com/cascade-protocol/x402-proxy/compare/v0.11.1...v0.11.2
|
|
513
|
+
[0.11.1]: https://github.com/cascade-protocol/x402-proxy/compare/v0.11.0...v0.11.1
|
|
514
|
+
[0.11.0]: https://github.com/cascade-protocol/x402-proxy/compare/v0.10.12...v0.11.0
|
|
515
|
+
[0.10.12]: https://github.com/cascade-protocol/x402-proxy/compare/v0.10.9...v0.10.12
|
|
417
516
|
[0.10.9]: https://github.com/cascade-protocol/x402-proxy/compare/v0.10.8...v0.10.9
|
|
418
517
|
[0.10.8]: https://github.com/cascade-protocol/x402-proxy/compare/v0.10.7...v0.10.8
|
|
419
518
|
[0.10.7]: https://github.com/cascade-protocol/x402-proxy/compare/v0.10.6...v0.10.7
|
package/README.md
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
[](LICENSE)
|
|
5
5
|
[](https://github.com/RichardLitt/standard-readme)
|
|
6
6
|
|
|
7
|
-
curl for x402 and MPP paid APIs with MCP proxy support. Auto-pays HTTP 402 on Base, Solana, and Tempo.
|
|
7
|
+
curl for x402 and MPP paid APIs with MCP proxy support. Auto-pays HTTP 402 on Base, Monad, Solana, and Tempo.
|
|
8
8
|
|
|
9
|
-
Zero crypto code on the buyer side. One mnemonic derives both EVM (Base/Tempo) and Solana keypairs - fund any chain and go. Supports one-time payments (x402, MPP charge) and pay-per-token streaming (MPP sessions). Use it as a CLI, an MCP proxy for AI agents, or as a Node.js library.
|
|
9
|
+
Zero crypto code on the buyer side. One mnemonic derives both EVM (Base/Monad/Tempo) and Solana keypairs - fund any chain and go. Supports one-time payments (x402, MPP charge) and pay-per-token streaming (MPP sessions). Use it as a CLI, an MCP proxy for AI agents, or as a Node.js library.
|
|
10
10
|
|
|
11
11
|
## Table of Contents
|
|
12
12
|
|
|
@@ -29,7 +29,7 @@ npx x402-proxy https://surf.cascade.fyi/api/v1/twitter/user/openclaw
|
|
|
29
29
|
|
|
30
30
|
That's it. The endpoint returns 402, x402-proxy pays and streams the response.
|
|
31
31
|
|
|
32
|
-
No wallet? It'll walk you through setup automatically. One mnemonic derives both EVM (Base/Tempo) and Solana keypairs. Fund any chain and go.
|
|
32
|
+
No wallet? It'll walk you through setup automatically. One mnemonic derives both EVM (Base/Monad/Tempo) and Solana keypairs. Fund any chain and go.
|
|
33
33
|
|
|
34
34
|
## Usage
|
|
35
35
|
|
package/dist/bin/cli.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { i as __toESM } from "../chunk-DjEMn6fM.js";
|
|
3
3
|
import { C as run, S as buildRouteMap, _ as base58, a as getDebugLogPath, b as buildApplication, c as isConfigured, d as saveConfig, f as saveSession, i as getConfigDirShort, l as loadConfig, o as getHistoryPath, r as ensureConfigDir, t as clearSession, u as loadWalletFile, x as buildCommand, y as require_picocolors } from "../config-cyNyKO4-.js";
|
|
4
|
-
import { C as
|
|
4
|
+
import { C as success, S as isTTY, _ as wrapFetchWithPayment, b as error, c as buildX402Client, d as calcSpend, f as displayNetwork, g as readHistory, h as formatUsdcValue, l as resolveWallet, m as formatTxLine, n as fetchAllBalances, p as formatAmount, s as walletInfoCommand, u as appendHistory, v as decodePaymentResponseHeader, w as warn, x as info, y as dim } from "../wallet-PKXYPnrG.js";
|
|
5
5
|
import { i as deserializeSessionReceipt, n as tempo, o as parseUnits, r as parseEvent, t as create } from "../client-DqtxTnu6.js";
|
|
6
6
|
import { t as privateKeyToAccount } from "../accounts-D9KsVVpJ.js";
|
|
7
|
-
import { a as Nt, c as Wt, i as Jt, l as Ct, n as setupCommand, o as R, r as Gt, s as Rt, t as runSetup } from "../setup-
|
|
8
|
-
import { n as statusCommand } from "../status-
|
|
7
|
+
import { a as Nt, c as Wt, i as Jt, l as Ct, n as setupCommand, o as R, r as Gt, s as Rt, t as runSetup } from "../setup-C-fXZBSh.js";
|
|
8
|
+
import { n as statusCommand } from "../status-CALRKYFp.js";
|
|
9
9
|
import { dirname, join, normalize, resolve } from "node:path";
|
|
10
10
|
import { spawn } from "node:child_process";
|
|
11
11
|
import { once } from "node:events";
|
|
@@ -17,7 +17,7 @@ import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
17
17
|
//#region packages/x402-proxy/src/openclaw/defaults.ts
|
|
18
18
|
const DEFAULT_SURF_PROVIDER_ID = "surf";
|
|
19
19
|
const DEFAULT_SURF_BASE_URL = "/x402-proxy/v1";
|
|
20
|
-
const DEFAULT_SURF_UPSTREAM_URL = "https://surf.cascade.fyi/api/v1/inference";
|
|
20
|
+
const DEFAULT_SURF_UPSTREAM_URL = "https://surf.cascade.fyi/api/v1/inference/v1";
|
|
21
21
|
/** Known model metadata for cost/capability enrichment. */
|
|
22
22
|
const MODEL_METADATA = {
|
|
23
23
|
"anthropic/claude-opus-4.6": {
|
|
@@ -163,6 +163,71 @@ const MODEL_METADATA = {
|
|
|
163
163
|
},
|
|
164
164
|
contextWindow: 128e3
|
|
165
165
|
},
|
|
166
|
+
"z-ai/glm-5.1": {
|
|
167
|
+
name: "GLM-5.1",
|
|
168
|
+
maxTokens: 202e3,
|
|
169
|
+
reasoning: true,
|
|
170
|
+
input: ["text"],
|
|
171
|
+
cost: {
|
|
172
|
+
input: .002,
|
|
173
|
+
output: .006,
|
|
174
|
+
cacheRead: 0,
|
|
175
|
+
cacheWrite: 0
|
|
176
|
+
},
|
|
177
|
+
contextWindow: 202e3
|
|
178
|
+
},
|
|
179
|
+
"x-ai/grok-4.20-multi-agent-beta": {
|
|
180
|
+
name: "Grok 4.20 Multi-Agent Beta",
|
|
181
|
+
maxTokens: 131072,
|
|
182
|
+
reasoning: true,
|
|
183
|
+
input: ["text"],
|
|
184
|
+
cost: {
|
|
185
|
+
input: .003,
|
|
186
|
+
output: .015,
|
|
187
|
+
cacheRead: 0,
|
|
188
|
+
cacheWrite: 0
|
|
189
|
+
},
|
|
190
|
+
contextWindow: 131072
|
|
191
|
+
},
|
|
192
|
+
"x-ai/grok-4.1-fast:online": {
|
|
193
|
+
name: "Grok 4.1 Fast (Online)",
|
|
194
|
+
maxTokens: 131072,
|
|
195
|
+
reasoning: false,
|
|
196
|
+
input: ["text"],
|
|
197
|
+
cost: {
|
|
198
|
+
input: .001,
|
|
199
|
+
output: .005,
|
|
200
|
+
cacheRead: 0,
|
|
201
|
+
cacheWrite: 0
|
|
202
|
+
},
|
|
203
|
+
contextWindow: 131072
|
|
204
|
+
},
|
|
205
|
+
"x-ai/grok-4.20-beta:online": {
|
|
206
|
+
name: "Grok 4.20 Beta (Online)",
|
|
207
|
+
maxTokens: 131072,
|
|
208
|
+
reasoning: true,
|
|
209
|
+
input: ["text"],
|
|
210
|
+
cost: {
|
|
211
|
+
input: .004,
|
|
212
|
+
output: .015,
|
|
213
|
+
cacheRead: 0,
|
|
214
|
+
cacheWrite: 0
|
|
215
|
+
},
|
|
216
|
+
contextWindow: 131072
|
|
217
|
+
},
|
|
218
|
+
"x-ai/grok-4.20-multi-agent-beta:online": {
|
|
219
|
+
name: "Grok 4.20 Multi-Agent Beta (Online)",
|
|
220
|
+
maxTokens: 131072,
|
|
221
|
+
reasoning: true,
|
|
222
|
+
input: ["text"],
|
|
223
|
+
cost: {
|
|
224
|
+
input: .004,
|
|
225
|
+
output: .015,
|
|
226
|
+
cacheRead: 0,
|
|
227
|
+
cacheWrite: 0
|
|
228
|
+
},
|
|
229
|
+
contextWindow: 131072
|
|
230
|
+
},
|
|
166
231
|
"qwen/qwen-2.5-7b-instruct": {
|
|
167
232
|
name: "Qwen 2.5 7B Instruct",
|
|
168
233
|
maxTokens: 32768,
|
|
@@ -235,7 +300,7 @@ function resolveProviders(config) {
|
|
|
235
300
|
const entries = Object.entries(raw).length > 0 ? Object.entries(raw).map(([id, provider]) => ({
|
|
236
301
|
id,
|
|
237
302
|
baseUrl: provider.baseUrl || "/x402-proxy/v1",
|
|
238
|
-
upstreamUrl: provider.upstreamUrl || "https://surf.cascade.fyi/api/v1/inference",
|
|
303
|
+
upstreamUrl: provider.upstreamUrl || "https://surf.cascade.fyi/api/v1/inference/v1",
|
|
239
304
|
protocol: resolveProtocol(provider.protocol, defaultProtocol),
|
|
240
305
|
mppSessionBudget: resolveMppSessionBudget(provider.mppSessionBudget, defaultMppSessionBudget),
|
|
241
306
|
models: provider.models && provider.models.length > 0 ? provider.models : DEFAULT_SURF_MODELS
|
|
@@ -1309,7 +1374,7 @@ async function resolveWalletForServe(flags) {
|
|
|
1309
1374
|
solanaKey: flags.solanaKey
|
|
1310
1375
|
});
|
|
1311
1376
|
if (wallet.source !== "none") return wallet;
|
|
1312
|
-
const { runSetup } = await import("../setup-
|
|
1377
|
+
const { runSetup } = await import("../setup-5KzHDwRR.js");
|
|
1313
1378
|
if (isTTY()) {
|
|
1314
1379
|
dim(" No wallet found. Let's set one up first.\n");
|
|
1315
1380
|
await runSetup();
|
|
@@ -1364,7 +1429,7 @@ async function startServeServer(options = {}) {
|
|
|
1364
1429
|
const resolvedProtocol = resolveProtocol(options.protocol ?? config?.preferredProtocol);
|
|
1365
1430
|
const configuredMppBudget = resolveMppSessionBudget(config?.mppSessionBudget);
|
|
1366
1431
|
const preferredNetwork = config?.defaultNetwork ?? await detectPreferredNetwork(wallet);
|
|
1367
|
-
const upstreamUrl = options.upstreamUrl ?? "https://surf.cascade.fyi/api/v1/inference";
|
|
1432
|
+
const upstreamUrl = options.upstreamUrl ?? "https://surf.cascade.fyi/api/v1/inference/v1";
|
|
1368
1433
|
const x402Proxy = createX402ProxyHandler({ client: await buildX402Client(wallet, {
|
|
1369
1434
|
preferredNetwork: preferredNetwork || void 0,
|
|
1370
1435
|
network: options.network,
|
|
@@ -1468,7 +1533,7 @@ Examples:
|
|
|
1468
1533
|
},
|
|
1469
1534
|
network: {
|
|
1470
1535
|
kind: "parsed",
|
|
1471
|
-
brief: "Preferred or required network (base, solana, tempo)",
|
|
1536
|
+
brief: "Preferred or required network (base, monad, solana, tempo)",
|
|
1472
1537
|
parse: String,
|
|
1473
1538
|
optional: true
|
|
1474
1539
|
},
|
|
@@ -1565,7 +1630,7 @@ not listed above.`
|
|
|
1565
1630
|
},
|
|
1566
1631
|
network: {
|
|
1567
1632
|
kind: "parsed",
|
|
1568
|
-
brief: "Preferred or required network (base, solana, tempo)",
|
|
1633
|
+
brief: "Preferred or required network (base, monad, solana, tempo)",
|
|
1569
1634
|
parse: String,
|
|
1570
1635
|
optional: true
|
|
1571
1636
|
},
|
|
@@ -1599,7 +1664,7 @@ not listed above.`
|
|
|
1599
1664
|
async func(flags, ...rawClaudeArgs) {
|
|
1600
1665
|
const debug = process.env.X402_PROXY_DEBUG === "1";
|
|
1601
1666
|
const started = await startServeServer({
|
|
1602
|
-
upstreamUrl: flags.upstream ?? "https://surf.cascade.fyi/api/v1/inference",
|
|
1667
|
+
upstreamUrl: flags.upstream ?? "https://surf.cascade.fyi/api/v1/inference/v1",
|
|
1603
1668
|
port: Number(flags.port),
|
|
1604
1669
|
protocol: flags.protocol ?? "mpp",
|
|
1605
1670
|
network: flags.network,
|
|
@@ -1650,13 +1715,14 @@ not listed above.`
|
|
|
1650
1715
|
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
1651
1716
|
const VALID_KEYS = {
|
|
1652
1717
|
defaultNetwork: {
|
|
1653
|
-
description: "Preferred network (base, solana, tempo)",
|
|
1718
|
+
description: "Preferred network (base, monad, solana, tempo)",
|
|
1654
1719
|
parse: (v) => {
|
|
1655
1720
|
if (![
|
|
1656
1721
|
"base",
|
|
1722
|
+
"monad",
|
|
1657
1723
|
"solana",
|
|
1658
1724
|
"tempo"
|
|
1659
|
-
].includes(v)) throw new Error("Must be one of: base, solana, tempo");
|
|
1725
|
+
].includes(v)) throw new Error("Must be one of: base, monad, solana, tempo");
|
|
1660
1726
|
return v;
|
|
1661
1727
|
}
|
|
1662
1728
|
},
|
|
@@ -1846,7 +1912,7 @@ Examples:
|
|
|
1846
1912
|
},
|
|
1847
1913
|
network: {
|
|
1848
1914
|
kind: "parsed",
|
|
1849
|
-
brief: "Require specific network (base, solana, tempo)",
|
|
1915
|
+
brief: "Require specific network (base, monad, solana, tempo)",
|
|
1850
1916
|
parse: String,
|
|
1851
1917
|
optional: true
|
|
1852
1918
|
},
|
|
@@ -1895,7 +1961,7 @@ Examples:
|
|
|
1895
1961
|
};
|
|
1896
1962
|
if (!url) {
|
|
1897
1963
|
if (isConfigured()) {
|
|
1898
|
-
const { displayStatus } = await import("../status-
|
|
1964
|
+
const { displayStatus } = await import("../status-CawITnuz.js");
|
|
1899
1965
|
await displayStatus();
|
|
1900
1966
|
console.log();
|
|
1901
1967
|
console.log(import_picocolors.default.dim(" Commands:"));
|
|
@@ -1950,7 +2016,7 @@ Examples:
|
|
|
1950
2016
|
process.exit(1);
|
|
1951
2017
|
}
|
|
1952
2018
|
dim(" No wallet found. Let's set one up first.\n");
|
|
1953
|
-
const { runSetup } = await import("../setup-
|
|
2019
|
+
const { runSetup } = await import("../setup-5KzHDwRR.js");
|
|
1954
2020
|
await runSetup();
|
|
1955
2021
|
console.log();
|
|
1956
2022
|
wallet = resolveWallet();
|
|
@@ -1963,7 +2029,7 @@ Examples:
|
|
|
1963
2029
|
verbose(`protocol: ${resolvedProtocol ?? "auto-detect"}, maxDeposit: ${maxDeposit}`);
|
|
1964
2030
|
let preferredNetwork = config?.defaultNetwork;
|
|
1965
2031
|
if (!preferredNetwork && wallet.evmAddress && wallet.solanaAddress) {
|
|
1966
|
-
const { fetchAllBalances } = await import("../wallet-
|
|
2032
|
+
const { fetchAllBalances } = await import("../wallet-sqd5HaHh.js");
|
|
1967
2033
|
const balances = await fetchAllBalances(wallet.evmAddress, wallet.solanaAddress);
|
|
1968
2034
|
const evmUsdc = balances.evm ? Number(balances.evm.usdc) : 0;
|
|
1969
2035
|
const solUsdc = balances.sol ? Number(balances.sol.usdc) : 0;
|
|
@@ -2130,7 +2196,7 @@ Examples:
|
|
|
2130
2196
|
const hasSolana = accepts.some((a) => a.network.startsWith("solana:"));
|
|
2131
2197
|
const hasMpp = detected.mpp;
|
|
2132
2198
|
const hasOther = accepts.some((a) => !a.network.startsWith("eip155:") && !a.network.startsWith("solana:"));
|
|
2133
|
-
const { fetchAllBalances } = await import("../wallet-
|
|
2199
|
+
const { fetchAllBalances } = await import("../wallet-sqd5HaHh.js");
|
|
2134
2200
|
const balances = await fetchAllBalances(wallet.evmAddress, wallet.solanaAddress);
|
|
2135
2201
|
const evmUsdc = hasEvm && balances.evm ? Number(balances.evm.usdc) : 0;
|
|
2136
2202
|
const solUsdc = hasSolana && balances.sol ? Number(balances.sol.usdc) : 0;
|
|
@@ -2357,7 +2423,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
2357
2423
|
},
|
|
2358
2424
|
network: {
|
|
2359
2425
|
kind: "parsed",
|
|
2360
|
-
brief: "Require specific network (base, solana, tempo)",
|
|
2426
|
+
brief: "Require specific network (base, monad, solana, tempo)",
|
|
2361
2427
|
parse: String,
|
|
2362
2428
|
optional: true
|
|
2363
2429
|
},
|
|
@@ -2383,7 +2449,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
2383
2449
|
});
|
|
2384
2450
|
if (wallet.source === "none") {
|
|
2385
2451
|
dim("No wallet found. Auto-generating...");
|
|
2386
|
-
const { runSetup } = await import("../setup-
|
|
2452
|
+
const { runSetup } = await import("../setup-5KzHDwRR.js");
|
|
2387
2453
|
await runSetup({ nonInteractive: true });
|
|
2388
2454
|
const fresh = resolveWallet({
|
|
2389
2455
|
evmKey: flags.evmKey,
|
|
@@ -2427,7 +2493,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
2427
2493
|
async function startX402Proxy() {
|
|
2428
2494
|
let preferredNetwork = config?.defaultNetwork;
|
|
2429
2495
|
if (!preferredNetwork && wallet.evmAddress && wallet.solanaAddress) {
|
|
2430
|
-
const { fetchAllBalances } = await import("../wallet-
|
|
2496
|
+
const { fetchAllBalances } = await import("../wallet-sqd5HaHh.js");
|
|
2431
2497
|
const balances = await fetchAllBalances(wallet.evmAddress, wallet.solanaAddress);
|
|
2432
2498
|
const evmUsdc = balances.evm ? Number(balances.evm.usdc) : 0;
|
|
2433
2499
|
const solUsdc = balances.sol ? Number(balances.sol.usdc) : 0;
|
|
@@ -2446,7 +2512,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
2446
2512
|
}
|
|
2447
2513
|
const remoteClient = new Client({
|
|
2448
2514
|
name: "x402-proxy",
|
|
2449
|
-
version: "0.
|
|
2515
|
+
version: "0.12.0"
|
|
2450
2516
|
});
|
|
2451
2517
|
await connectTransport(remoteClient);
|
|
2452
2518
|
function recordX402Payment(ctx) {
|
|
@@ -2477,7 +2543,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
2477
2543
|
}
|
|
2478
2544
|
const localServer = new Server({
|
|
2479
2545
|
name: "x402-proxy",
|
|
2480
|
-
version: "0.
|
|
2546
|
+
version: "0.12.0"
|
|
2481
2547
|
}, { capabilities: {
|
|
2482
2548
|
tools: tools.length > 0 ? {} : void 0,
|
|
2483
2549
|
resources: remoteResources.length > 0 ? {} : void 0
|
|
@@ -2551,7 +2617,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
2551
2617
|
}));
|
|
2552
2618
|
const remoteClient = new Client({
|
|
2553
2619
|
name: "x402-proxy",
|
|
2554
|
-
version: "0.
|
|
2620
|
+
version: "0.12.0"
|
|
2555
2621
|
});
|
|
2556
2622
|
await connectTransport(remoteClient);
|
|
2557
2623
|
const mppClient = McpClient.wrap(remoteClient, { methods: wrappedMethods });
|
|
@@ -2566,7 +2632,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
2566
2632
|
}
|
|
2567
2633
|
const localServer = new Server({
|
|
2568
2634
|
name: "x402-proxy",
|
|
2569
|
-
version: "0.
|
|
2635
|
+
version: "0.12.0"
|
|
2570
2636
|
}, { capabilities: {
|
|
2571
2637
|
tools: tools.length > 0 ? {} : void 0,
|
|
2572
2638
|
resources: remoteResources.length > 0 ? {} : void 0
|
|
@@ -2954,7 +3020,7 @@ const app = buildApplication(buildRouteMap({
|
|
|
2954
3020
|
docs: { brief: "curl for x402 paid APIs" }
|
|
2955
3021
|
}), {
|
|
2956
3022
|
name: "x402-proxy",
|
|
2957
|
-
versionInfo: { currentVersion: "0.
|
|
3023
|
+
versionInfo: { currentVersion: "0.12.0" },
|
|
2958
3024
|
scanner: { caseStyle: "allow-kebab-for-camel" }
|
|
2959
3025
|
});
|
|
2960
3026
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -47548,6 +47548,7 @@ function explorerUrl(net, tx) {
|
|
|
47548
47548
|
if (net.startsWith("eip155:")) {
|
|
47549
47549
|
const chainId = net.split(":")[1];
|
|
47550
47550
|
if (chainId === "4217") return `https://explore.mainnet.tempo.xyz/tx/${tx}`;
|
|
47551
|
+
if (chainId === "143") return `https://monadscan.com/tx/${tx}`;
|
|
47551
47552
|
if (chainId === "8453") return `https://basescan.org/tx/${tx}`;
|
|
47552
47553
|
return `https://basescan.org/tx/${tx}`;
|
|
47553
47554
|
}
|
|
@@ -47562,6 +47563,7 @@ function shortModel(model) {
|
|
|
47562
47563
|
}
|
|
47563
47564
|
function shortNetwork(net) {
|
|
47564
47565
|
if (net === "eip155:8453") return "base";
|
|
47566
|
+
if (net === "eip155:143") return "monad";
|
|
47565
47567
|
if (net === "eip155:4217") return "tempo";
|
|
47566
47568
|
if (net.startsWith("eip155:")) return `evm:${net.split(":")[1]}`;
|
|
47567
47569
|
if (net.startsWith("solana:")) return "sol";
|
|
@@ -998,7 +998,7 @@ async function runSetup(opts) {
|
|
|
998
998
|
message: "Preferred payment protocol?",
|
|
999
999
|
options: [{
|
|
1000
1000
|
value: "x402",
|
|
1001
|
-
label: "x402 - on-chain payments (Base, Solana)"
|
|
1001
|
+
label: "x402 - on-chain payments (Base, Monad, Solana)"
|
|
1002
1002
|
}, {
|
|
1003
1003
|
value: "mpp",
|
|
1004
1004
|
label: "MPP - machine payments over HTTP 402 (Tempo)"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { i as __toESM } from "./chunk-DjEMn6fM.js";
|
|
3
3
|
import { i as getConfigDirShort, l as loadConfig, o as getHistoryPath, x as buildCommand, y as require_picocolors } from "./config-cyNyKO4-.js";
|
|
4
|
-
import {
|
|
4
|
+
import { d as calcSpend, g as readHistory, h as formatUsdcValue, l as resolveWallet, m as formatTxLine, n as fetchAllBalances, p as formatAmount, t as balanceLine, y as dim } from "./wallet-PKXYPnrG.js";
|
|
5
5
|
//#region packages/x402-proxy/src/commands/status.ts
|
|
6
6
|
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
7
7
|
async function displayStatus() {
|
|
@@ -17263,6 +17263,7 @@ function explorerUrl(net, tx) {
|
|
|
17263
17263
|
if (net.startsWith("eip155:")) {
|
|
17264
17264
|
const chainId = net.split(":")[1];
|
|
17265
17265
|
if (chainId === "4217") return `https://explore.mainnet.tempo.xyz/tx/${tx}`;
|
|
17266
|
+
if (chainId === "143") return `https://monadscan.com/tx/${tx}`;
|
|
17266
17267
|
if (chainId === "8453") return `https://basescan.org/tx/${tx}`;
|
|
17267
17268
|
return `https://basescan.org/tx/${tx}`;
|
|
17268
17269
|
}
|
|
@@ -17277,6 +17278,7 @@ function shortModel(model) {
|
|
|
17277
17278
|
}
|
|
17278
17279
|
function displayNetwork(net) {
|
|
17279
17280
|
if (net === "eip155:8453") return "Base";
|
|
17281
|
+
if (net === "eip155:143") return "Monad";
|
|
17280
17282
|
if (net === "eip155:4217") return "Tempo";
|
|
17281
17283
|
if (net.startsWith("eip155:")) return `EVM (${net.split(":")[1]})`;
|
|
17282
17284
|
if (net.startsWith("solana:")) return "Solana";
|
|
@@ -17284,6 +17286,7 @@ function displayNetwork(net) {
|
|
|
17284
17286
|
}
|
|
17285
17287
|
function shortNetwork(net) {
|
|
17286
17288
|
if (net === "eip155:8453") return "base";
|
|
17289
|
+
if (net === "eip155:143") return "monad";
|
|
17287
17290
|
if (net === "eip155:4217") return "tempo";
|
|
17288
17291
|
if (net.startsWith("eip155:")) return `evm:${net.split(":")[1]}`;
|
|
17289
17292
|
if (net.startsWith("solana:")) return "sol";
|
|
@@ -17576,6 +17579,7 @@ function solanaAddressFromKey(keyBytes) {
|
|
|
17576
17579
|
function networkToCaipPrefix(name) {
|
|
17577
17580
|
switch (name.toLowerCase()) {
|
|
17578
17581
|
case "base": return "eip155:8453";
|
|
17582
|
+
case "monad": return "eip155:143";
|
|
17579
17583
|
case "tempo": return "eip155:4217";
|
|
17580
17584
|
case "solana": return "solana:";
|
|
17581
17585
|
default: return name;
|
|
@@ -17663,8 +17667,10 @@ async function buildX402Client(wallet, opts) {
|
|
|
17663
17667
|
const BASE_RPC = "https://mainnet.base.org";
|
|
17664
17668
|
const SOLANA_RPC = "https://api.mainnet-beta.solana.com";
|
|
17665
17669
|
const TEMPO_RPC = "https://rpc.presto.tempo.xyz";
|
|
17670
|
+
const MONAD_RPC = "https://rpc.monad.xyz";
|
|
17666
17671
|
const USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
17667
17672
|
const USDC_TEMPO = "0x20C000000000000000000000b9537d11c60E8b50";
|
|
17673
|
+
const USDC_MONAD = "0x754704Bc059F8C67012fEd69BC8A327a5aafb603";
|
|
17668
17674
|
const USDC_SOLANA_MINT = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
17669
17675
|
const TOKEN_PROGRAM = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
17670
17676
|
const ATA_PROGRAM = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
@@ -17700,6 +17706,17 @@ async function fetchTempoBalances(address) {
|
|
|
17700
17706
|
}, "latest"]);
|
|
17701
17707
|
return { usdc: res.result ? formatUsdcValue(Number(BigInt(res.result)) / 1e6) : "?" };
|
|
17702
17708
|
}
|
|
17709
|
+
async function fetchMonadBalances(address) {
|
|
17710
|
+
const usdcData = `0x70a08231${address.slice(2).padStart(64, "0")}`;
|
|
17711
|
+
const [monRes, usdcRes] = await Promise.all([rpcCall(MONAD_RPC, "eth_getBalance", [address, "latest"]), rpcCall(MONAD_RPC, "eth_call", [{
|
|
17712
|
+
to: USDC_MONAD,
|
|
17713
|
+
data: usdcData
|
|
17714
|
+
}, "latest"])]);
|
|
17715
|
+
return {
|
|
17716
|
+
mon: monRes.result ? (Number(BigInt(monRes.result)) / 0xde0b6b3a7640000).toFixed(6) : "?",
|
|
17717
|
+
usdc: usdcRes.result ? formatUsdcValue(Number(BigInt(usdcRes.result)) / 1e6) : "?"
|
|
17718
|
+
};
|
|
17719
|
+
}
|
|
17703
17720
|
async function getUsdcAta(owner) {
|
|
17704
17721
|
const encoder = getAddressEncoder();
|
|
17705
17722
|
const [ata] = await getProgramDerivedAddress({
|
|
@@ -17726,15 +17743,17 @@ function balanceLine(usdc, native, nativeSymbol) {
|
|
|
17726
17743
|
return import_picocolors.default.dim(` (${usdc} USDC, ${native} ${nativeSymbol})`);
|
|
17727
17744
|
}
|
|
17728
17745
|
async function fetchAllBalances(evmAddress, solanaAddress) {
|
|
17729
|
-
const [evmResult, solResult, tempoResult] = await Promise.allSettled([
|
|
17746
|
+
const [evmResult, solResult, tempoResult, monadResult] = await Promise.allSettled([
|
|
17730
17747
|
evmAddress ? fetchEvmBalances(evmAddress) : Promise.resolve(null),
|
|
17731
17748
|
solanaAddress ? fetchSolanaBalances(solanaAddress) : Promise.resolve(null),
|
|
17732
|
-
evmAddress ? fetchTempoBalances(evmAddress) : Promise.resolve(null)
|
|
17749
|
+
evmAddress ? fetchTempoBalances(evmAddress) : Promise.resolve(null),
|
|
17750
|
+
evmAddress ? fetchMonadBalances(evmAddress) : Promise.resolve(null)
|
|
17733
17751
|
]);
|
|
17734
17752
|
return {
|
|
17735
17753
|
evm: evmResult.status === "fulfilled" ? evmResult.value : null,
|
|
17736
17754
|
sol: solResult.status === "fulfilled" ? solResult.value : null,
|
|
17737
|
-
tempo: tempoResult.status === "fulfilled" ? tempoResult.value : null
|
|
17755
|
+
tempo: tempoResult.status === "fulfilled" ? tempoResult.value : null,
|
|
17756
|
+
monad: monadResult.status === "fulfilled" ? monadResult.value : null
|
|
17738
17757
|
};
|
|
17739
17758
|
}
|
|
17740
17759
|
const walletInfoCommand = buildCommand({
|
|
@@ -17761,11 +17780,15 @@ const walletInfoCommand = buildCommand({
|
|
|
17761
17780
|
info("Wallet");
|
|
17762
17781
|
console.log();
|
|
17763
17782
|
console.log(import_picocolors.default.dim(` Source: ${wallet.source}`));
|
|
17764
|
-
const { evm, sol, tempo } = await fetchAllBalances(wallet.evmAddress, wallet.solanaAddress);
|
|
17783
|
+
const { evm, sol, tempo, monad } = await fetchAllBalances(wallet.evmAddress, wallet.solanaAddress);
|
|
17765
17784
|
if (wallet.evmAddress) {
|
|
17766
17785
|
const bal = evm ? balanceLine(evm.usdc, evm.eth, "ETH") : import_picocolors.default.dim(" (network error)");
|
|
17767
17786
|
console.log(` Base: ${import_picocolors.default.green(wallet.evmAddress)}${bal}`);
|
|
17768
17787
|
}
|
|
17788
|
+
if (wallet.evmAddress) {
|
|
17789
|
+
const bal = monad ? balanceLine(monad.usdc, monad.mon, "MON") : import_picocolors.default.dim(" (network error)");
|
|
17790
|
+
console.log(` Monad: ${import_picocolors.default.green(wallet.evmAddress)}${bal}`);
|
|
17791
|
+
}
|
|
17769
17792
|
if (wallet.evmAddress) {
|
|
17770
17793
|
const bal = tempo ? import_picocolors.default.dim(` (${tempo.usdc} USDC)`) : import_picocolors.default.dim(" (network error)");
|
|
17771
17794
|
console.log(` Tempo: ${import_picocolors.default.green(wallet.evmAddress)}${bal}`);
|
|
@@ -17800,4 +17823,4 @@ const walletInfoCommand = buildCommand({
|
|
|
17800
17823
|
}
|
|
17801
17824
|
});
|
|
17802
17825
|
//#endregion
|
|
17803
|
-
export {
|
|
17826
|
+
export { success as C, isTTY as S, wrapFetchWithPayment as _, fetchSolanaBalances as a, error as b, buildX402Client as c, calcSpend as d, displayNetwork as f, readHistory as g, formatUsdcValue as h, fetchMonadBalances as i, resolveWallet as l, formatTxLine as m, fetchAllBalances as n, fetchTempoBalances as o, formatAmount as p, fetchEvmBalances as r, walletInfoCommand as s, balanceLine as t, appendHistory as u, decodePaymentResponseHeader as v, warn as w, info as x, dim as y };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x402-proxy",
|
|
3
|
-
"description": "curl for x402 paid APIs. Auto-pays any endpoint on Base, Solana, and Tempo.",
|
|
4
|
-
"version": "0.
|
|
3
|
+
"description": "curl for x402 paid APIs. Auto-pays any endpoint on Base, Monad, Solana, and Tempo.",
|
|
4
|
+
"version": "0.12.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"license": "Apache-2.0",
|
package/dist/setup-DPuLACk7.js
DELETED
package/dist/status-B2xUewrq.js
DELETED
package/dist/wallet-BsCgqUun.js
DELETED