Overview
x402x-detector automatically identifies an ERC-20 token’s “gasless payment capability” — covering EIP-2612 Permit, EIP-3009, and Permit2 — and handles common proxy patterns (EIP-1967 / UUPS). Results are cached for millisecond-level access.
Key features
- Full detection: Permit / EIP-3009 / Permit2
- Proxy handling: EIP-1967 / UUPS / custom implementation
- High performance: 2–5s on first run,
<1mswith cache hits - Simple API:
detect/getRecommendedMethod/initialize
Install
Quick start
Examples
- Functional API (no cache)
- TokenDetector class (with cache)
- Server integration (Express)
- Detect recipient (EIP-7702 + settle)
Create
detect.ts, core logic:Full example (functional API)
Full example (functional API)
Detection details
- Permit:
permit() / DOMAIN_SEPARATOR() / nonces(owner) - EIP-3009:
transferWithAuthorization()/authorizationState() - Permit2:
allowance(user, token, spender)
proxiableUUID(), etc.)
Recommended usage
- Warm up on startup:
detector.initialize([USDC, DAI, ...]) - Choose a recommended type:
detector.getRecommendedMethod(token) - For non-standard proxies, manually verify implementation address
API reference (condensed)
- Parameters:
/en/parameters-responses/detector/parameters - Responses:
/en/parameters-responses/detector/responses
Performance and optimization
- Warm up hot tokens:
initialize([tokens])on service startup - Parallel detection: prefer
initializefor batch parallel detection - Detect on demand: slow the first time, fast afterwards (cache hits)
- Periodic refresh: re-detect popular tokens on a schedule
Resources
- Source:
https://github.com/WTFLabs-WTF/x402x/tree/main/typescript/packages/x402x-detector - Issues:
https://github.com/WTFLabs-WTF/x402x/issues