Skip to content

feat: add x402-browser-proxy sample#29

Merged
arein merged 1 commit into
mainfrom
feat/x402-browser-proxy
Mar 4, 2026
Merged

feat: add x402-browser-proxy sample#29
arein merged 1 commit into
mainfrom
feat/x402-browser-proxy

Conversation

@arein
Copy link
Copy Markdown
Contributor

@arein arein commented Mar 4, 2026

Summary

  • Adds samples/x402-browser-proxy/ — a MITM proxy that intercepts HTTP 402 responses and auto-signs x402 payments via CWP (CLI Wallet Protocol)
  • Uses companion-wallet (or any CWP provider) for signing — no private keys needed
  • Core innovation: cwp-signer.ts bridges @x402/evm's ClientEvmSigner interface to CWP walletExec, making x402 payments work with any CWP-compatible wallet
  • Adds samples/* to workspaces and eslint config

Test plan

  • npm run build — all packages + sample build successfully
  • npm run lint — passes
  • npm run test — all 61 existing tests pass
  • End-to-end test with mock server (node test-server.mjs --test) — passes
  • End-to-end test against real PayAI endpoint (x402.payai.network) — passes
  • CI passes

🤖 Generated with Claude Code

MITM proxy that intercepts HTTP 402 responses and auto-signs x402
payments via CWP (CLI Wallet Protocol). Uses companion-wallet or any
CWP-compatible provider for signing — no private keys needed.

Key components:
- cwp-signer.ts: bridges @x402/evm ClientEvmSigner to CWP walletExec
- proxy.ts: http-mitm-proxy that intercepts 402s and retries with payment
- x402-client.ts: x402 protocol client (CWP-only, no private key path)
- test-server.mjs: mock x402 server for testing

Adds samples/* to workspaces and eslint config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@arein arein merged commit 06a3489 into main Mar 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant