Skip to main content

Constructor

new TokenDetector(publicClient);

Methods

  • detect(token)TokenDetectionResult
  • getRecommendedMethod(token)"eip3009" | "permit" | "permit2" | null
  • initialize(tokens) → warm up cache
  • getCacheStats/clearCache

Signatures and inputs

// Detect a single token
detect(tokenAddress: string): Promise<TokenDetectionResult>;

// Recommend a payment method
getRecommendedMethod(tokenAddress: string): Promise<"eip3009" | "permit" | "permit2" | null>;

// Batch initialize
initialize(tokenAddresses: string[]): Promise<TokenDetectionResult[]>;

// Clear cache
clearCache(tokenAddress?: string): Promise<void>;

// Detect settlement capability of a recipient (EIP-7702 + x402x extensions)
detectSettleMethods(
  client: PublicClient,
  address: string,
  logger?: Logger | null
): Promise<{
  supportsSettleWithPermit: boolean;
  supportsSettleWithERC3009: boolean;
  supportsSettleWithPermit2: boolean;
}>;
Input addresses should be valid EVM addresses (0x + 40 hex), case-insensitive internally.