@x402janus/sdk
v0.1.1
Published
TypeScript SDK for x402janus wallet security scans with automatic x402 micropayment handling
Maintainers
Readme
@x402janus/sdk
Wallet security for AI agents. One API call. Forensic wallet analysis. Deterministic risk score.
x402-native — no API keys, no accounts. Your agent pays per scan with USDC on Base.
Install
npm install @x402janus/sdkQuick Start
import { JanusClient } from "@x402janus/sdk";
const janus = new JanusClient({
privateKey: process.env.PRIVATE_KEY, // Agent wallet key
});
const result = await janus.scan("0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18");
if (result.safe) {
// proceed with transaction
} else {
console.log("Blocked:", result.findings);
console.log("Revoke txs:", result.revokeTxs);
}How Payment Works
- Your agent calls
janus.scan(address) - The SDK hits the x402janus API, which returns HTTP 402 with payment requirements
- The SDK signs an EIP-3009
TransferWithAuthorizationfor the required USDC amount - The signed payment is sent in the
X-PAYMENTheader on retry - The Thirdweb facilitator verifies and settles USDC on Base
- Scan results are returned
Your agent needs:
- A private key (for signing — never sent to the API)
- USDC on Base (for scan payments)
API
new JanusClient(config?)
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| privateKey | string | process.env.PRIVATE_KEY | Agent wallet private key |
| baseUrl | string | https://x402janus.com | API endpoint |
| defaultTier | "quick" \| "standard" \| "deep" | "quick" | Default scan tier |
janus.scan(address, options?)
Scan a wallet for security risks.
const result = await janus.scan("0x...", { tier: "deep" });
// result: { scanId, safe, risk, findings, revokeTxs }janus.approvals(address)
List active token approvals with risk assessment.
janus.revoke(address)
Get pre-built revoke transactions for dangerous approvals.
janus.health()
Check API health status.
Scan Tiers
| Tier | Price | Response Time | Coverage |
|------|-------|---------------|----------|
| quick | $0.01 | <3s | Deterministic risk score, approval list |
| standard | $0.05 | <10s | + AI threat analysis |
| deep | $0.25 | <30s | + Full graph analysis, drainer fingerprinting |
Types
All types are exported with Zod schemas for runtime validation:
import { ScanResult, ScanResultSchema, Finding, RevokeTx } from "@x402janus/sdk";License
MIT
