v0.2.0
[0.2.0] — 2026-05-12
The v0.2 pre/post-payment debugger. v0.1 owned mid-flight (proxy) + post-settlement (reconcile); v0.2 adds pre-flight (validate) and offline failure diagnosis (explain), sharing a new pure rule engine in src/diagnose/. Closes pain ranks #3 (generic 402 with no error reason) and #4 (wallet-state pre-flight gap) from the X402-6 ranking. 278 tests, same Base Sepolia / exact EVM scope as v0.1 per ADR-002. Apache-2.0.
Added
x402trace validate <wallet> <service-url>(X402-21) — read-only pre-flight before signing. Fetches the 402 challenge, queries on-chain USDC balance + EIP-3009 nonce status + wallet kind (EOA vs Smart Wallet viagetCode), synthesises a hypotheticalPaymentPayload, runs the diagnose engine, renders a plain-English report. Exits0forwould-succeed,2forwould-fail,0foruncertain(or2with--strict).x402trace explain <jsonl-log-file>(X402-21) — read a JSONL log produced byproxy --reconcile, find every exchange wherereconcile.result.kind != 'settled_on_chain'plus everydecoder.error, run the same rule engine against captured state, print per-failure prose with actionable fixes. CI-friendly: exits2if any failures rendered,0if log was clean.src/diagnose/(X402-21) — pure rule engine (no I/O, noDate.now). 10 rules covering network match, scheme match, recipient match, value sufficiency,validBefore/validAfterwindow, payer USDC balance, EIP-3009 nonce freshness, wallet kind (EOA + Smart Wallet; ERC-6492 deferred to v0.3 per ADR-002), and Base Sepolia USDC asset address. Each rule returnspass/fail/skip;skipmeans the context lacked the data (e.g.explaindoesn't have live wallet state). Top-level status iswould-succeed/would-fail/uncertain(the latter when the two critical chain-state rules are skipped).- Chain client extensions (X402-21) —
getUsdcBalance(wallet),isNonceConsumed(authorizer, nonce),detectWalletKind(wallet)read-only methods onChainClient, plus a narrowUSDC_READ_ABI(justbalanceOf+authorizationState). Used byvalidate; reusable by future v0.3 features. - v0.2 feature pick (X402-20) — ADR-002 records the decision + 4 rejected alternatives. SPEC.md § 5 flipped from "v0.2 stretch (deferred)" to "v0.2 scope" with a new v0.3 stretch list catching the deferrals. CLAUDE.md current-focus flipped to v0.2.
- CI release workflow
contents: writefix — release.yml'sCreate GitHub Releasestep had failed on the v0.1.0 cut with HTTP 403 because the job hadcontents: read. Promoted towriteso v0.2.0+ tag-pushes self-create the GitHub Release without manual intervention.
Tests
- 278 total (+63 from v0.1.0's 215). New: 36 unit tests for
diagnose-rules, 14 forvalidate-command, 9 forexplain-command, +4 forcli-dispatchercovering the new subcommands.
Notes
package.jsonbin layout unchanged from v0.1.0 —x402traceresolves to four subcommands (proxy,inspect,validate,explain).tsconfig.build.jsonis still the published-bundle config; tarball stays ~62 files / ~156 KB.