| 42 | ] |
| 43 | |
| 44 | function showHelp(): string { |
| 45 | return `x402 — HTTP 402 Crypto Payment Protocol (USDC on Base) |
| 46 | |
| 47 | Usage: |
| 48 | /x402 setup Generate a new wallet for x402 payments |
| 49 | /x402 setup <key> Import an existing private key (hex) |
| 50 | /x402 status Show wallet info and session payment history |
| 51 | /x402 enable Enable automatic x402 payments |
| 52 | /x402 disable Disable x402 payments |
| 53 | /x402 set-limit <amt> Set max payment per request (USD) |
| 54 | /x402 set-session <amt> Set max session spend (USD) |
| 55 | /x402 network <name> Switch network (base, base-sepolia, ethereum, ethereum-sepolia) |
| 56 | /x402 remove Remove wallet and disable payments |
| 57 | /x402 Show this help |
| 58 | |
| 59 | When enabled, x402 automatically handles HTTP 402 Payment Required responses |
| 60 | by signing USDC payment authorizations within your configured limits. |
| 61 | |
| 62 | Environment: |
| 63 | X402_PRIVATE_KEY Override wallet private key (for CI/automation) |
| 64 | |
| 65 | Learn more: https://github.com/coinbase/x402` |
| 66 | } |
| 67 | |
| 68 | function handleSetup(args: string): string { |
| 69 | const parts = args.trim().split(/\s+/) |