@quillai-network/x402-wach
v1.0.2
Published
CLI SDK for WACH.AI token risk analysis via x402 payments
Readme
x402-wach
A CLI & SDK for WACH.AI token risk analysis, powered by the x402 payment protocol. Pay-per-request in USDC on Base — no API keys, no subscriptions.
x402-wach verify-risk 0xA0b8...3E8 ethHow it works
- You run a command (or call the SDK).
- The SDK sends a request to
https://x402.wach.ai/verify-token. - The server responds with HTTP 402 Payment Required.
- The SDK automatically signs a USDC micro-payment on Base using your local wallet.
- The request is retried with the payment header — you get back the token risk report.
All payment logic is handled transparently by the @x402/axios interceptor.
Quick Start
Install
# Clone & install
git clone <repo-url> && cd x402-
npm install
npm run build
# Link the CLI globally
npm linkSet up a wallet
You need a wallet with USDC on Base to pay for requests.
# Option 1 — Generate a brand new wallet
x402-wach wallet create
# Option 2 — Import an existing wallet via private key
x402-wach wallet importBoth options save a wallet.json in your current directory. Fund the wallet address with USDC on Base before making requests.
Analyze a token
x402-wach verify-risk <TOKEN_ADDRESS> <CHAIN_NAME>Example:
x402-wach verify-risk 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 ethSupported Chains
| Short Name | Chain | Chain ID |
| ---------- | ------------------- | -------- |
| eth | Ethereum | 1 |
| pol | Polygon | 137 |
| base | Base | 8453 |
| bsc | Binance Smart Chain | 56 |
| sol | Solana | solana |
Note: The token you're analyzing can be on any supported chain. The payment always happens in USDC on Base.
CLI Commands
| Command | Description |
| -------------------------------------------------- | ---------------------------------------- |
| x402-wach verify-risk <tokenAddress> <chainName> | Analyze token risk (pays USDC on Base) |
| x402-wach wallet create | Generate a new wallet |
| x402-wach wallet import | Import wallet from a private key |
| x402-wach wallet info | Show current wallet address & file path |
| x402-wach chains | List all supported chains |
| x402-wach --help | Show help |
| x402-wach --version | Show version |
Programmatic Usage
You can also use x402-wach as a library in your own Node.js / TypeScript project:
import { verifyTokenRisk } from "x402-wach";
const report = await verifyTokenRisk(
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"eth"
);
console.log(report);See usage.md for the full programmatic API reference.
Project Structure
x402-/
├── src/
│ ├── cli.ts # CLI entry point (Commander.js)
│ ├── client.ts # x402 Axios wrapper & verifyTokenRisk()
│ ├── wallet.ts # Wallet create / import / load / save
│ ├── chains.ts # Chain mappings (short name → chain ID)
│ └── index.ts # Public SDK exports
├── dist/ # Compiled output
├── package.json
├── tsconfig.json
└── README.mdTech Stack
- @x402/axios — Axios interceptor for x402 HTTP 402 payment flow
- @x402/evm — EVM payment scheme (EIP-3009 / Permit2)
- viem — Wallet & account management
- Commander.js — CLI framework
- chalk / ora — Terminal styling & spinners
- inquirer — Interactive prompts
License
MIT
