> ## Documentation Index
> Fetch the complete documentation index at: https://docs.x402x.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Detector 参数

> TokenDetector 构造与方法参数

## 构造

```ts theme={null}
new TokenDetector(publicClient);
```

## 方法

* `detect(token)` → `TokenDetectionResult`
* `getRecommendedMethod(token)` → `"eip3009" | "permit" | "permit2" | null`
* `initialize(tokens)` → 预热缓存
* `getCacheStats/clearCache`

## 签名与入参

```ts theme={null}
// 检测单个 Token
detect(tokenAddress: string): Promise<TokenDetectionResult>;

// 推荐支付方法
getRecommendedMethod(tokenAddress: string): Promise<"eip3009" | "permit" | "permit2" | null>;

// 批量初始化
initialize(tokenAddresses: string[]): Promise<TokenDetectionResult[]>;

// 清理缓存
clearCache(tokenAddress?: string): Promise<void>;

// 检测收款地址的结算能力（EIP-7702 + x402x 扩展）
detectSettleMethods(
  client: PublicClient,
  address: string,
  logger?: Logger | null
): Promise<{
  supportsSettleWithPermit: boolean;
  supportsSettleWithERC3009: boolean;
  supportsSettleWithPermit2: boolean;
}>;
```

> 输入地址应为合法 EVM 地址（`0x` + 40 hex），内部大小写不敏感。
