@x402-lens/cli 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +57 -3
- package/dist/index.js +1197 -0
- package/dist/index.js.map +1 -0
- package/package.json +39 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 x402-lens contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,57 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# `x402-lens` CLI
|
|
2
|
+
|
|
3
|
+
Explain and verify x402 v2 payments. See the [main README](../../README.md) for
|
|
4
|
+
the full picture.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
x402-lens inspect <url> [--method GET] [--header "K: V"] [--timeout 15000]
|
|
8
|
+
x402-lens explain [--challenge ...] [--payment ...] [--verify ...] [--settle ...]
|
|
9
|
+
x402-lens doctor [--facilitator <url>] [--network <caip2>] [--networks <a,b>]
|
|
10
|
+
x402-lens reconcile --tx <hash> [--network <caip2>] [--rpc <url>]
|
|
11
|
+
x402-lens add "<METHOD> <path>" --file <path> --price <amount> [--write]
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## inspect
|
|
15
|
+
|
|
16
|
+
Fetches an endpoint unpaid, decodes `PAYMENT-REQUIRED`, validates it against the
|
|
17
|
+
v2 schema, and reports CORS readiness for browser buyers. Exits non-zero when
|
|
18
|
+
anything is wrong, so it works as a smoke test in CI.
|
|
19
|
+
|
|
20
|
+
## explain
|
|
21
|
+
|
|
22
|
+
Takes any subset of a failed exchange and prints findings ordered by severity,
|
|
23
|
+
each with the field at fault and a fix. Arguments accept raw base64 header
|
|
24
|
+
values, decoded JSON, or `@file`.
|
|
25
|
+
|
|
26
|
+
## doctor
|
|
27
|
+
|
|
28
|
+
Verifies that configuration can accept payments: CAIP-2 format, address shape,
|
|
29
|
+
facilitator reachability, and that `GET /supported` lists the configured network
|
|
30
|
+
with `x402Version: 2` and the `exact` scheme. Exits non-zero on any failure.
|
|
31
|
+
|
|
32
|
+
With more than one network configured it also checks every one of them, because
|
|
33
|
+
the SDK validates them all at startup and **exits the process** if any is
|
|
34
|
+
missing — a failure that returns no 402 and no error response, only a server that
|
|
35
|
+
stopped. Run `doctor` in CI so that cannot reach production.
|
|
36
|
+
|
|
37
|
+
## reconcile
|
|
38
|
+
|
|
39
|
+
Asks a public RPC whether a settlement transaction confirmed. Use after
|
|
40
|
+
`settlement_pending` — never retry the payment until you know. Supports
|
|
41
|
+
`eip155:*` (receipt status) and `solana:*` (signature lookup). Pass `--rpc` to
|
|
42
|
+
override the default public endpoint.
|
|
43
|
+
|
|
44
|
+
## add
|
|
45
|
+
|
|
46
|
+
Adds protection to an existing Express route. Prints a unified diff by default;
|
|
47
|
+
`--write` applies it. Idempotent, and it refuses non-Express files or routes it
|
|
48
|
+
cannot rewrite safely rather than guessing.
|
|
49
|
+
|
|
50
|
+
Adding a second route to a server that already calls `paymentLens()` extends
|
|
51
|
+
the existing `routes` map in place — same indentation, same trailing-comma
|
|
52
|
+
style — instead of mounting a second middleware. The array form
|
|
53
|
+
(`routes: [{ route, price }]`) and computed route maps are refused with the
|
|
54
|
+
exact snippet to paste, because rewriting them can change what is protected.
|
|
55
|
+
|
|
56
|
+
Requires `X402_FACILITATOR_URL`, `X402_NETWORK`, and `X402_PAY_TO` at runtime:
|
|
57
|
+
`paymentLens()` will not start without them.
|