x402-proxy 0.5.2 → 0.7.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 +37 -1
- package/README.md +20 -2
- package/dist/bin/cli.js +518 -168
- package/dist/{derive-CISr_ond.js → derive-ibF2UinV.js} +2 -2
- package/dist/index.d.ts +43 -8
- package/dist/index.js +108 -13
- package/dist/openclaw/plugin.d.ts +55 -0
- package/dist/openclaw/plugin.js +1120 -0
- package/dist/openclaw.plugin.json +28 -0
- package/dist/{setup-gla-Qyqi.js → setup-hJGkO2Lo.js} +1 -1
- package/dist/setup-j_xQ14-4.js +4 -0
- package/dist/{status-BoH_1kIH.js → status-JNGv2Ghp.js} +12 -6
- package/dist/{status-BVIU3-b6.js → status-w5y-fhhe.js} +1 -1
- package/dist/wallet-DjixXCHy.js +4 -0
- package/dist/{wallet-BMYYtAP6.js → wallet-DxKCHa7U.js} +45 -11
- package/openclaw.plugin.json +28 -0
- package/package.json +29 -4
- package/skills/SKILL.md +22 -7
- package/dist/setup-Crq9TylJ.js +0 -4
- package/dist/wallet-BoY0fgX7.js +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.7.0] - 2026-03-20
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `--verbose` flag on `fetch` command - debug logging for protocol negotiation, headers, session lifecycle, and payment flow
|
|
14
|
+
- OpenClaw plugin integration (`x402-proxy/openclaw`) - registers `x_balance` tool, `x_payment` tool, `/x_wallet` command, and HTTP route proxy for upstream x402 endpoints
|
|
15
|
+
- `openclaw.plugin.json` manifest with config schema for providers, keypair path, RPC URL, and dashboard URL
|
|
16
|
+
- `./openclaw` subpath export in package.json
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- MPP SSE requests silently losing `Content-Type` and other headers when `Headers` instances are spread (workaround for mppx SDK bug, upstream fix: wevm/mppx#209)
|
|
20
|
+
- MPP session `close()` errors no longer crash the CLI - wrapped in try/catch with verbose error reporting
|
|
21
|
+
- MPP payment history now includes `amount` (converted from base units) and `channelId` in transaction records
|
|
22
|
+
- MPP streaming history records now use `channelId` as fallback for `tx` field when no receipt reference is available
|
|
23
|
+
|
|
24
|
+
## [0.6.0] - 2026-03-19
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- MPP (Machine Payments Protocol) support via `mppx` SDK - pay-per-token streaming and charge-per-request on the Tempo network
|
|
28
|
+
- `--protocol` flag for `fetch` and `mcp` commands - choose between `x402` and `mpp` payment protocols
|
|
29
|
+
- MPP streaming: `--protocol mpp` with `"stream": true` in body uses session-based SSE with mid-stream voucher cycling
|
|
30
|
+
- MPP MCP proxy: `--protocol mpp` on `mcp` command wraps tool calls with MPP payments via `mppx/mcp-sdk`
|
|
31
|
+
- Auto-detect fallback: if x402 returns 402 and server advertises MPP via `WWW-Authenticate: Payment`, falls through to MPP automatically
|
|
32
|
+
- Tempo USDC balance shown in `wallet` and `status` commands
|
|
33
|
+
- `preferredProtocol` and `mppSessionBudget` config options
|
|
34
|
+
- `detectProtocols()`, `createMppProxyHandler()`, `TEMPO_NETWORK` exported from library
|
|
35
|
+
- `MppPaymentInfo`, `MppProxyHandler`, `DetectedProtocols` types exported
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
- `PaymentInfo` type now includes `protocol: "x402"` discriminator
|
|
39
|
+
- `extractTxSignature()` now also extracts references from MPP `Payment-Receipt` headers
|
|
40
|
+
- 402 error display shows Tempo balances and MPP-accepting endpoints
|
|
41
|
+
- `appendHistory` creates parent directory automatically (removed `ensureConfigDir` calls)
|
|
42
|
+
- Balance fetching consolidated into `fetchAllBalances()` helper
|
|
43
|
+
|
|
10
44
|
## [0.5.2] - 2026-03-19
|
|
11
45
|
|
|
12
46
|
### Fixed
|
|
@@ -152,7 +186,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
152
186
|
- `appendHistory` / `readHistory` / `calcSpend` - JSONL transaction history
|
|
153
187
|
- Re-exports from `@x402/fetch`, `@x402/svm`, `@x402/evm`
|
|
154
188
|
|
|
155
|
-
[Unreleased]: https://github.com/cascade-protocol/x402-proxy/compare/v0.
|
|
189
|
+
[Unreleased]: https://github.com/cascade-protocol/x402-proxy/compare/v0.7.0...HEAD
|
|
190
|
+
[0.7.0]: https://github.com/cascade-protocol/x402-proxy/compare/v0.6.0...v0.7.0
|
|
191
|
+
[0.6.0]: https://github.com/cascade-protocol/x402-proxy/compare/v0.5.2...v0.6.0
|
|
156
192
|
[0.5.2]: https://github.com/cascade-protocol/x402-proxy/compare/v0.5.1...v0.5.2
|
|
157
193
|
[0.5.1]: https://github.com/cascade-protocol/x402-proxy/compare/v0.5.0...v0.5.1
|
|
158
194
|
[0.5.0]: https://github.com/cascade-protocol/x402-proxy/compare/v0.4.2...v0.5.0
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# x402-proxy
|
|
2
2
|
|
|
3
|
-
`curl` for [x402](https://www.x402.org/) paid APIs. Auto-pays HTTP 402 responses with USDC on Base and
|
|
3
|
+
`curl` for [x402](https://www.x402.org/) paid APIs. Auto-pays HTTP 402 responses with USDC on Base, Solana, and Tempo - zero crypto code on the buyer side. Supports both [x402](https://www.x402.org/) and [MPP](https://mpp.dev/) payment protocols.
|
|
4
4
|
|
|
5
5
|
## Quick Start
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ npx x402-proxy https://twitter.surf.cascade.fyi/users/cascade_fyi
|
|
|
10
10
|
|
|
11
11
|
That's it. The endpoint returns 402, x402-proxy pays and streams the response.
|
|
12
12
|
|
|
13
|
-
No wallet? It'll walk you through setup automatically. One mnemonic derives both EVM (Base) and Solana keypairs. Fund
|
|
13
|
+
No wallet? It'll walk you through setup automatically. One mnemonic derives both EVM (Base/Tempo) and Solana keypairs. Fund any chain and go.
|
|
14
14
|
|
|
15
15
|
## MCP Proxy
|
|
16
16
|
|
|
@@ -49,6 +49,16 @@ $ npx x402-proxy --method POST \
|
|
|
49
49
|
# Force a specific network
|
|
50
50
|
$ npx x402-proxy --network base https://api.example.com/data
|
|
51
51
|
|
|
52
|
+
# Debug protocol negotiation and payment flow
|
|
53
|
+
$ npx x402-proxy --verbose https://api.example.com/data
|
|
54
|
+
|
|
55
|
+
# Use MPP protocol for streaming payments
|
|
56
|
+
$ npx x402-proxy --protocol mpp \
|
|
57
|
+
--method POST \
|
|
58
|
+
--header "Content-Type: application/json" \
|
|
59
|
+
--body '{"model":"minimax/minimax-m2.5","stream":true,"messages":[{"role":"user","content":"Hello"}]}' \
|
|
60
|
+
https://inference.surf.cascade.fyi/v1/chat/completions
|
|
61
|
+
|
|
52
62
|
# Pipe-safe
|
|
53
63
|
$ npx x402-proxy https://api.example.com/data | jq '.results'
|
|
54
64
|
```
|
|
@@ -100,7 +110,9 @@ Resolution order: flags > env vars > mnemonic env > `wallet.json` file.
|
|
|
100
110
|
```ts
|
|
101
111
|
import {
|
|
102
112
|
createX402ProxyHandler,
|
|
113
|
+
createMppProxyHandler,
|
|
103
114
|
extractTxSignature,
|
|
115
|
+
detectProtocols,
|
|
104
116
|
appendHistory,
|
|
105
117
|
readHistory,
|
|
106
118
|
calcSpend,
|
|
@@ -109,6 +121,12 @@ import {
|
|
|
109
121
|
|
|
110
122
|
See the [library API docs](https://github.com/cascade-protocol/x402-proxy/tree/main/packages/x402-proxy#library-api) for details.
|
|
111
123
|
|
|
124
|
+
## OpenClaw Plugin
|
|
125
|
+
|
|
126
|
+
x402-proxy ships as an [OpenClaw](https://openclaw.dev) plugin, giving your gateway automatic x402 payment capabilities. Registers `x_balance` and `x_payment` tools, `/x_wallet` command, and an HTTP route proxy for upstream x402 endpoints.
|
|
127
|
+
|
|
128
|
+
Configure providers and models in OpenClaw plugin settings. Uses the standard wallet resolution (env vars or `wallet.json`).
|
|
129
|
+
|
|
112
130
|
## License
|
|
113
131
|
|
|
114
132
|
Apache-2.0
|