import { SchemeNetworkServer, Network, MoneyParser, Price, AssetAmount, PaymentRequirements } from '@x402/core/types'; type ExactX402xEvmServerAssetConfig = { address: `0x${string}`; decimals: number; /** * 可选:写入 requirements.extra,用于客户端/促进方签名与校验 * (缺失时,本包的 client/facilitator 会尝试链上读取) */ name?: string; version?: string; }; /** * x402x EVM server implementation for x402 "exact" scheme. * * 重点:提供资产注册能力(BSC/USD1 等)。 */ declare class ExactX402xEvmServer implements SchemeNetworkServer { readonly scheme: "exact:eip7702"; private moneyParsers; private readonly assets; private readonly defaultAssetByNetwork; /** * 注册一个网络默认资产(用于 Money 价格转换)。 * * @param network - CAIP-2 网络,如 "eip155:56" * @param symbol - 资产符号(仅用于本地 key) * @param config - 资产配置 * @returns The server instance for chaining */ registerAsset(network: Network, symbol: string, config: ExactX402xEvmServerAssetConfig): this; /** * 设置某个网络的默认资产符号(必须已 registerAsset)。 * * @param network - CAIP-2 网络,如 "eip155:56" * @param symbol - 资产符号 * @returns The server instance for chaining */ setDefaultAsset(network: Network, symbol: string): this; /** * 注册一个 Money 价格转换器。 * * @param parser - 价格转换器 * @returns The server instance for chaining */ registerMoneyParser(parser: MoneyParser): this; /** * 解析一个价格并转换为资产金额。 * * @param price - 价格 * @param network - CAIP-2 网络 * @returns The asset amount */ parsePrice(price: Price, network: Network): Promise; /** * Build payment requirements for this scheme/network combination * * @param paymentRequirements - The base payment requirements * @param supportedKind - The supported kind from facilitator (unused) * @param supportedKind.x402Version - The x402 version * @param supportedKind.scheme - The logical payment scheme * @param supportedKind.network - The network identifier in CAIP-2 format * @param supportedKind.extra - Optional extra metadata regarding scheme/network implementation details * @param extensionKeys - Extension keys supported by the facilitator (unused) * @returns Payment requirements ready to be sent to clients */ enhancePaymentRequirements(paymentRequirements: PaymentRequirements, supportedKind: { x402Version: number; scheme: string; network: Network; extra?: Record; }, extensionKeys: string[]): Promise; /** * Parse money to decimal. * * @param money - The money to parse (e.g., "$1.50") * @returns The amount in decimal */ private parseMoneyToDecimal; /** * Default money conversion implementation. * * @param amount - The amount in decimal (e.g., 1.50) * @param network - The network identifier in CAIP-2 format * @returns The asset amount */ private defaultMoneyConversion; /** * Convert decimal amount to token amount. * * @param decimalAmount - The amount in decimal (e.g., 1.50) * @param decimals - The number of decimals * @returns The amount in token */ private convertToTokenAmount; /** * Get the asset config for a network and symbol. * * @param network - The network identifier in CAIP-2 format * @param symbol - The symbol of the asset * @returns The asset config */ private getAsset; /** * Generate a unique asset key for a network and symbol. * * @param network - The network identifier in CAIP-2 format * @param symbol - The symbol of the asset * @returns The asset key */ private assetKey; } export { ExactX402xEvmServer as E, type ExactX402xEvmServerAssetConfig as a };