import { Network, PaymentRequirements, ResourceServerExtension, SchemeNetworkFacilitator, PaymentPayload } from '@x402/core/types'; export { Network, PaymentPayload, PaymentRequirements } from '@x402/core/types'; import { Chain, Address as Address$1 } from 'viem'; import { x402ResourceServer } from '@x402/core/server'; export { ClientEvmSigner, ExactEvmSchemeWithRouterSettlement, injectX402xExtensionHandler, registerX402xScheme } from './client/index.js'; import '@x402/core/client'; /** * Type definitions for @x402x/extensions * * Re-exports official x402 v2 types from @x402/core */ /** * Signer interface for x402x * Compatible with x402 v2 client signer patterns */ interface Signer { address: string; signTypedData?: (params: unknown) => Promise; [key: string]: unknown; } /** * Commitment calculation parameters * All parameters must match exactly with SettlementRouter.sol */ interface CommitmentParams { /** Chain ID (e.g., 84532 for Base Sepolia) */ chainId: number; /** SettlementRouter contract address */ hub: string; /** Asset contract address (ERC-3009 token, e.g., USDC) */ asset: string; /** Payer address */ from: string; /** Payment amount in asset's smallest unit */ value: string; /** Authorization valid after timestamp */ validAfter: string; /** Authorization valid before timestamp */ validBefore: string; /** Unique salt for idempotency (32 bytes) */ salt: string; /** Final recipient address */ payTo: string; /** Facilitator fee amount */ facilitatorFee: string; /** Hook contract address */ hook: string; /** Encoded hook parameters */ hookData: string; } /** * Gas model for different networks */ type GasModel = "eip1559" | "legacy"; /** * Network metadata containing protocol-level information */ interface NetworkMetadata { /** Gas pricing model used by the network */ gasModel: GasModel; /** Native token symbol */ nativeToken: string; } /** * Demo hooks configuration for showcase examples */ interface DemoHooks { /** NFTMintHook contract address */ nftMint?: string; /** RandomNFT contract address */ randomNFT?: string; /** RewardHook contract address */ reward?: string; /** RewardToken contract address */ rewardToken?: string; } /** * Network configuration for x402x */ interface NetworkConfig { /** Chain ID */ chainId: number; /** Network Name */ name: string; /** Network Type */ type: "mainnet" | "testnet"; /** Network Address Explorer Base URL */ addressExplorerBaseUrl: string; /** Network Transaction Explorer Base URL */ txExplorerBaseUrl: string; /** SettlementRouter contract address */ settlementRouter: string; /** Default asset configuration (ERC-3009 token, typically USDC) */ defaultAsset: { /** Asset contract address */ address: string; /** Asset decimals */ decimals: number; /** EIP-712 domain info for signing */ eip712: { /** Asset contract name (for EIP-712) */ name: string; /** Asset contract version (for EIP-712) */ version: string; }; }; /** Builtin hook addresses */ hooks: { /** TransferHook address */ transfer: string; }; /** Demo hooks configuration (optional, for showcase examples) */ demoHooks?: DemoHooks; /** Network metadata */ metadata?: NetworkMetadata; } /** * Core settlement parameters (without EIP-712 domain info) */ interface SettlementExtraCore { /** SettlementRouter contract address */ settlementRouter: string; /** Unique salt for idempotency (32 bytes) */ salt: string; /** Final recipient address */ payTo: string; /** Facilitator fee amount */ facilitatorFee: string; /** Hook contract address */ hook: string; /** Encoded hook parameters */ hookData: string; } /** * Settlement extra parameters for PaymentRequirements * Includes EIP-712 domain info (name, version) for asset signature validation */ interface SettlementExtra extends SettlementExtraCore { /** Asset contract name (for EIP-712) */ name: string; /** Asset contract version (for EIP-712) */ version: string; } /** * Error thrown when settlement extra parameters are invalid */ declare class SettlementExtraError extends Error { constructor(message: string); } /** * Money type - string or number representing USD amount */ type Money = string | number; /** * Resource information for payment required responses */ interface Resource { url: string; description?: string; mimeType?: string; } /** * Middleware utility functions for x402x v2 packages * * These utilities provide helpers for route matching, JSON encoding, * and other common middleware operations. */ /** * Route configuration for payment requirements */ interface RouteConfig { price: string | number; network?: string; extra?: Record; extensions?: Record; } /** * Routes configuration - mapping of route patterns to configs */ type RoutesConfig = Record; /** * Compiled route pattern with regex */ interface RoutePattern { verb: string; pattern: RegExp; config: RouteConfig; } /** * Compute route patterns from routes config * * Converts route configuration into compiled patterns with regex matching. * * **Note**: When a route is specified as a simple price value (string or number), * it is automatically converted to a RouteConfig with network defaulting to "base-sepolia". * For production use, explicitly specify the network in your route configuration. * * @param routes - Routes configuration * @returns Array of route patterns * * @example * ```typescript * const routes = { * 'GET /api/data': { price: '0.01', network: 'base-sepolia' }, * '/public/*': '0' // Defaults to base-sepolia network * }; * const patterns = computeRoutePatterns(routes); * ``` */ declare function computeRoutePatterns(routes: RoutesConfig): RoutePattern[]; /** * Find matching route for given path and method * * @param routePatterns - Compiled route patterns * @param path - Request path * @param method - HTTP method * @returns Matching route pattern or undefined * * @example * ```typescript * const route = findMatchingRoute(patterns, '/api/data', 'GET'); * ``` */ declare function findMatchingRoute(routePatterns: RoutePattern[], path: string, method: string): RoutePattern | undefined; /** * Find matching payment requirements from list * * This is a placeholder for finding requirements that match certain criteria. * In v2, this logic is typically handled by the x402Client/x402ResourceServer classes. * * @param requirements - List of payment requirements * @param network - Optional network filter * @returns First matching requirement or undefined */ declare function findMatchingPaymentRequirements(requirements: T[], network?: string): T | undefined; /** * Convert value to JSON-safe format * * Handles BigInt and other non-JSON-serializable types. * * @param value - Value to convert * @returns JSON-safe representation * * @example * ```typescript * const safe = toJsonSafe({ amount: 1000000n }); // { amount: "1000000" } * ``` */ declare function toJsonSafe(value: unknown): unknown; /** * Commitment calculation utilities * * The commitment hash binds all settlement parameters to the client's signature, * preventing parameter tampering attacks. */ /** * Calculate commitment hash for x402x settlement * * This hash becomes the EIP-3009 nonce, cryptographically binding all settlement * parameters to the client's signature. The parameter order must exactly match * SettlementRouter.sol. * * @param params - All settlement parameters * @returns bytes32 commitment hash * * @example * ```typescript * const commitment = calculateCommitment({ * chainId: 84532, * hub: '0x...', * asset: '0x...', * from: '0x...', * value: '100000', * validAfter: '0', * validBefore: '1234567890', * salt: '0x...', * payTo: '0x...', * facilitatorFee: '10000', * hook: '0x...', * hookData: '0x', * }); * ``` */ declare function calculateCommitment(params: CommitmentParams): string; /** * Generate a random salt for settlement uniqueness * * Works in both Node.js and browser environments. * Uses crypto.getRandomValues (Web Crypto API) which is available in: * - Modern browsers * - Node.js 15+ (via global crypto) * - Older Node.js (via crypto.webcrypto) * * @returns bytes32 hex string (0x + 64 hex characters) * * @example * ```typescript * const salt = generateSalt(); * // => '0x1234567890abcdef...' * ``` */ declare function generateSalt(): string; /** * Validate commitment parameters * * @param params - Commitment parameters to validate * @throws Error if validation fails */ declare function validateCommitmentParams(params: CommitmentParams): void; /** * Network configuration for x402x * * Contains deployed contract addresses and configuration for each supported network. * Uses official x402 v2 CAIP-2 network identifiers as keys. */ /** * Network configurations for all supported networks * * Uses CAIP-2 format as keys for consistency with x402 v2 protocol. * This ensures compatibility across different ecosystems and simplifies * adding new networks (only need chain ID). */ declare const networks: Record; /** * Get network configuration by network identifier * * Accepts both CAIP-2 format (preferred) and human-readable network names (legacy). * This provides backward compatibility while encouraging migration to CAIP-2. * * @param network - Network identifier, accepts either: * - CAIP-2 format (preferred): 'eip155:84532', 'eip155:8453' * - Human-readable name (legacy): 'base-sepolia', 'base' * @returns Network configuration * @throws Error if network is not supported * * @example * ```typescript * // Preferred: CAIP-2 format * const config = getNetworkConfig('eip155:84532'); * * // Legacy: human-readable name * const config2 = getNetworkConfig('base-sepolia'); * * console.log(config.settlementRouter); * ``` */ declare function getNetworkConfig(network: string | Network): NetworkConfig; /** * Check if a network is supported * * Accepts both CAIP-2 format and human-readable network names. * * @param network - Network identifier (CAIP-2 or human-readable name) * @returns True if network is supported * * @example * ```typescript * if (isNetworkSupported('eip155:84532')) { * // proceed... * } * * if (isNetworkSupported('base-sepolia')) { * // also works... * } * ``` */ declare function isNetworkSupported(network: string | Network): boolean; /** * Get list of all supported network aliases (v1 configuration names) * * Returns user-friendly network aliases like "base-sepolia", "base", etc. * These aliases are used for configuration files and backward compatibility. * Use this for UI display, configuration, and user-facing operations. * * This function provides backward compatibility by returning v1 aliases * even though the internal storage uses CAIP-2 format. * * @returns Array of v1 network aliases * * @example * ```typescript * const aliases = getSupportedNetworkAliases(); * // => ['base-sepolia', 'base', 'x-layer-testnet', ...] * * // For UI dropdown * * ``` */ declare function getSupportedNetworkAliases(): string[]; /** * Get list of all supported networks (CAIP-2 format) * * Returns network identifiers in CAIP-2 format (e.g., "eip155:84532"). * This is the canonical format used internally and in x402 v2. * * @returns Array of CAIP-2 network identifiers * * @example * ```typescript * const networks = getSupportedNetworks(); * // => ['eip155:84532', 'eip155:8453', 'eip155:1952', ...] * ``` */ declare function getSupportedNetworks(): Network[]; /** * Chain definitions for x402x supported networks * * This module provides viem chain configurations for all supported networks, * including custom definitions for chains not in viem's standard list. */ /** * Get viem chain configuration for a network * * Accepts both CAIP-2 format (preferred) and human-readable network names (legacy). * Checks custom chains first, then falls back to viem's standard chains. * * @param network - Network identifier (CAIP-2 or human-readable name) * @returns Viem chain configuration * @throws Error if network is not supported * * @example * ```typescript * // Preferred: CAIP-2 format * const chain = getChain("eip155:1952"); * // => { id: 1952, name: "X Layer Testnet", ... } * * // Legacy: human-readable name * const baseChain = getChain("base-sepolia"); * // => { id: 84532, name: "Base Sepolia", ... } * ``` */ declare function getChain(network: string | Network): Chain; /** * Get viem chain configuration by chain ID * * @param chainId - Chain ID * @returns Viem chain configuration * @throws Error if chain ID is not supported * * @example * ```typescript * const chain = getChainById(1952); * // => { id: 1952, name: "X Layer Testnet", ... } * ``` */ declare function getChainById(chainId: number): Chain; /** * Get all custom chain definitions * * @returns Record of chain ID to chain configuration * * @example * ```typescript * const customs = getCustomChains(); * // => { 1952: { id: 1952, name: "X Layer Testnet", ... }, ... } * ``` */ declare function getCustomChains(): Record; /** * Check if a chain ID has a custom definition * * @param chainId - Chain ID to check * @returns True if chain has custom definition * * @example * ```typescript * isCustomChain(1952); // true (X Layer Testnet) * isCustomChain(84532); // false (Base Sepolia - in viem) * ``` */ declare function isCustomChain(chainId: number): boolean; /** * TransferHook utilities * * TransferHook is a builtin hook that supports two modes: * 1. Simple Transfer: Direct transfer to a single recipient (data = '0x') * 2. Distributed Transfer: Split transfer to multiple recipients by percentage */ /** * Split configuration for distributed transfer */ interface Split { /** Recipient address */ recipient: Address$1; /** Basis points (1-10000, where 10000 = 100%, 1 = 0.01%) */ bips: number; } /** * TransferHook utilities namespace */ declare namespace TransferHook { /** * Encode hookData for TransferHook * * Supports two modes: * * **Mode 1 - Simple Transfer** (no parameters): * - Transfers entire amount to the `recipient` address in ExecuteParams * - Most gas efficient * - Returns '0x' * * **Mode 2 - Distributed Transfer** (with splits): * - Distributes amount to multiple recipients based on percentage (bips) * - Each split specifies recipient address and basis points (1-10000) * - If total bips < 10000, remaining goes to the `recipient` in ExecuteParams * - If total bips = 10000, `recipient` receives nothing * * @param splits - Optional array of split configurations * @returns Encoded hookData as hex string * @throws Error if validation fails (invalid addresses, bips > 10000, etc.) * * @example Simple transfer * ```typescript * // All amount goes to recipient * const hookData = TransferHook.encode(); * // => '0x' * * await client.execute({ * hook: TransferHook.getAddress('base-sepolia'), * hookData, * amount: '100', * recipient: '0xAlice...' // Alice receives 100% * }); * ``` * * @example Distributed transfer - full split * ```typescript * // Split between Alice (60%) and Bob (40%) * const hookData = TransferHook.encode([ * { recipient: '0xAlice...', bips: 6000 }, // 60% * { recipient: '0xBob...', bips: 4000 } // 40% * ]); * * await client.execute({ * hook: TransferHook.getAddress('base-sepolia'), * hookData, * amount: '100', * recipient: '0xCharity...' // Charity receives 0% (total = 100%) * }); * ``` * * @example Distributed transfer - partial split * ```typescript * // Platform takes 30%, creator gets the rest * const hookData = TransferHook.encode([ * { recipient: '0xPlatform...', bips: 3000 } // 30% * ]); * * await client.execute({ * hook: TransferHook.getAddress('base-sepolia'), * hookData, * amount: '100', * recipient: '0xCreator...' // Creator receives 70% * }); * ``` */ function encode(splits?: Split[]): string; /** * Get TransferHook address for a specific network * * Accepts both CAIP-2 format (preferred) and human-readable network names (legacy). * * @param network - Network identifier (CAIP-2 or human-readable name) * @returns TransferHook contract address * @throws Error if network is not supported * * @example * ```typescript * // Preferred: CAIP-2 format * const address = TransferHook.getAddress('eip155:84532'); * // => '0x4DE234059C6CcC94B8fE1eb1BD24804794083569' * * // Legacy: human-readable name * const address2 = TransferHook.getAddress('base-sepolia'); * // => '0x4DE234059C6CcC94B8fE1eb1BD24804794083569' * ``` */ function getAddress(network: string | Network): string; } /** * Demo hooks utilities for showcase examples * * Provides encoding/decoding and address lookup for demo hooks used in showcase examples. * These hooks are optional and may not be deployed on all networks. */ /** * NFT Mint Configuration */ interface MintConfig { /** Address of the NFT contract to mint from */ nftContract: Address$1; } /** * Reward Hook Configuration */ interface RewardConfig { /** Address of the ERC20 reward token contract */ rewardToken: Address$1; } /** * NFTMintHook utilities for showcase examples */ declare namespace NFTMintHook { /** * Get NFTMintHook contract address for a specific network * * Accepts both CAIP-2 format and human-readable network names. * * @param network - Network identifier (CAIP-2 or human-readable name) * @returns The contract address for the specified network * @throws Error if demo hooks are not configured for the network */ function getAddress(network: string | Network): `0x${string}`; /** * Get the NFT contract address for a specific network * * This is the address of the ERC721 contract that will be minted from. * Accepts both CAIP-2 format and human-readable network names. * * @param network - Network identifier (CAIP-2 or human-readable name) * @returns The NFT contract address for the specified network * @throws Error if demo hooks are not configured for the network */ function getNFTContractAddress(network: string | Network): `0x${string}`; /** * Encode MintConfig into hookData for NFTMintHook * * The NFTMintHook contract expects a specific ABI-encoded struct format. * This method handles the encoding for you. * * @param config - The mint configuration * @returns ABI-encoded hookData ready to use with x402x execute */ function encode(config: MintConfig): `0x${string}`; } /** * RewardHook utilities for showcase examples */ declare namespace RewardHook { /** * Get RewardHook contract address for a specific network * * Accepts both CAIP-2 format and human-readable network names. * * @param network - Network identifier (CAIP-2 or human-readable name) * @returns The contract address for the specified network * @throws Error if demo hooks are not configured for the network */ function getAddress(network: string | Network): `0x${string}`; /** * Get the reward token (ERC20) address for a specific network * * This is the address of the ERC20 contract that will be distributed as rewards. * Accepts both CAIP-2 format and human-readable network names. * * @param network - Network identifier (CAIP-2 or human-readable name) * @returns The reward token contract address for the specified network * @throws Error if demo hooks are not configured for the network */ function getTokenAddress(network: string | Network): `0x${string}`; /** * Encode RewardConfig into hookData for RewardHook * * The RewardHook contract expects a specific ABI-encoded struct format. * This method handles the encoding for you. * * @param config - The reward configuration * @returns ABI-encoded hookData ready to use with x402x execute */ function encode(config: RewardConfig): `0x${string}`; } /** * Utility functions for x402x */ /** * Add settlement extension to PaymentRequirements * * This function enriches standard x402 PaymentRequirements with settlement-specific * parameters in the `extra` field. * * @param requirements - Base PaymentRequirements (standard x402) * @param params - Settlement parameters * @returns Enhanced PaymentRequirements with settlement extra * * @example * ```typescript * import { addSettlementExtra, TransferHook, getNetworkConfig } from '@x402x/core'; * * const baseRequirements = { * scheme: 'exact', * network: 'base-sepolia', * maxAmountRequired: '100000', * asset: '0x036CbD53842c5426634e7929541eC2318f3dCF7e', * payTo: '0x...', * resource: '/api/payment', * }; * * const requirements = addSettlementExtra(baseRequirements, { * hook: TransferHook.getAddress('base-sepolia'), * hookData: TransferHook.encode(), * facilitatorFee: '10000', * payTo: merchantAddress, * }); * ``` */ declare function addSettlementExtra(requirements: PaymentRequirements, params: { hook: string; hookData: string; facilitatorFee?: string; payTo?: string; salt?: string; }): PaymentRequirements; /** * Extension helpers for x402x * Implements x402x-router-settlement extension for PaymentRequired.extensions */ /** * Router settlement extension info * Contains all settlement-specific parameters that were previously in extra */ interface RouterSettlementExtensionInfo { /** Schema version for the extension */ schemaVersion: number; /** Optional description of the extension */ description?: string; /** Unique salt for idempotency (32 bytes hex, dynamically generated) */ salt?: string; /** Settlement router contract address */ settlementRouter?: string; /** Hook contract address */ hook?: string; /** Encoded hook parameters (hex string) */ hookData?: string; /** Final recipient address (renamed from payTo to avoid confusion with accepts[].payTo) */ finalPayTo?: string; /** Facilitator fee amount in token's smallest unit */ facilitatorFee?: string; } /** * Router settlement extension structure * Location: PaymentRequired.extensions["x402x-router-settlement"] */ interface RouterSettlementExtension { /** Extension information */ info: RouterSettlementExtensionInfo; /** Optional JSON schema for validation */ schema?: Record; } /** * Create x402x-router-settlement extension declaration * * This extension informs clients that the server supports router settlement functionality. * Clients MUST echo extensions in their payment payload. * * @param params - Extension parameters * @param params.description - Optional description of the extension * @param params.schema - Optional JSON schema for validation * @param params.salt - Optional salt (will be auto-generated by enrichDeclaration if not provided) * @param params.settlementRouter - Settlement router contract address * @param params.hook - Hook contract address * @param params.hookData - Encoded hook parameters * @param params.finalPayTo - Final recipient address * @param params.facilitatorFee - Facilitator fee amount * @returns Extension object for PaymentRequired.extensions["x402x-router-settlement"] * * @example * ```typescript * const extension = createRouterSettlementExtension({ * description: "Settlement router with atomic fee distribution", * settlementRouter: "0x...", * hook: "0x...", * hookData: "0x", * finalPayTo: "0x...", * facilitatorFee: "0", * salt: "0x..." // Optional, will be auto-generated if not provided * }); * * const paymentRequired = { * x402Version: 2, * resource: { url: "/api/payment", ... }, * accepts: [...], * extensions: { * "x402x-router-settlement": extension * } * }; * ``` */ declare function createRouterSettlementExtension(params?: { description?: string; schema?: Record; salt?: string; settlementRouter?: string; hook?: string; hookData?: string; finalPayTo?: string; facilitatorFee?: string; }): RouterSettlementExtension; /** * Get the extension key for router settlement * * @returns The extension key "x402x-router-settlement" */ declare function getRouterSettlementExtensionKey(): string; /** * x402x Router Settlement Server Extension * * Implements ResourceServerExtension interface to integrate router settlement * functionality into x402 v2 resource servers. */ /** * Extension key constant */ declare const ROUTER_SETTLEMENT_KEY = "x402x-router-settlement"; /** * x402x Router Settlement ResourceServerExtension * * This extension enriches PaymentRequired responses with router settlement * information, enabling clients to use the SettlementRouter for atomic payments. * * The extension dynamically generates per-request values like salt to ensure * each payment authorization is unique and cannot be replayed. * * @example * ```typescript * import { x402ResourceServer } from "@x402/core/server"; * import { routerSettlementServerExtension } from "@x402x/extensions"; * * const server = new x402ResourceServer(facilitatorClient); * server.registerExtension(routerSettlementServerExtension); * ``` */ declare const routerSettlementServerExtension: ResourceServerExtension; /** * Create extension declaration for routes * * Helper function to create properly formatted extension declarations * for use in route configurations. The extension enables dynamic salt * generation per request and includes all settlement parameters. * * @param params - Extension parameters including settlement info * @returns Extension declaration object * * @example * ```typescript * const routes = { * "GET /api/data": { * accepts: { scheme: "exact", price: "$0.01", network: "eip155:84532", payTo: "0x..." }, * extensions: createExtensionDeclaration({ * description: "Router settlement with dynamic salt", * settlementRouter: "0x...", * hook: "0x...", * hookData: "0x", * finalPayTo: "0x...", * facilitatorFee: "0", * salt: "0x..." // Optional, will be auto-generated if not provided * }) * } * }; * ``` */ declare function createExtensionDeclaration(params?: { description?: string; schema?: Record; settlementRouter?: string; hook?: string; hookData?: string; finalPayTo?: string; facilitatorFee?: string; salt?: string; }): Record; /** * Settlement Routes Helper * * Provides utilities for creating route configurations with router settlement support. * This module bridges the gap between x402 v2 official SDK's RoutesConfig and x402x * settlement requirements. * * Key Design: Use AssetAmount with x402x default assets to bypass official SDK's hardcoded default asset table. */ /** * Route configuration from @x402/core * Re-exported for convenience with settlement prefix to avoid naming conflicts */ interface SettlementRouteConfig { accepts: SettlementPaymentOption | SettlementPaymentOption[]; resource?: string; description?: string; mimeType?: string; extensions?: Record; unpaidResponseBody?: (context: unknown) => Promise<{ contentType: string; body: unknown; }> | { contentType: string; body: unknown; }; customPaywallHtml?: string; } /** * Payment option from @x402/core * Enhanced to support dynamic price generation with x402x assets */ interface SettlementPaymentOption { scheme: string; network: string; payTo: string | ((context: unknown) => string | Promise); price: string | number | AssetAmount | ((context: unknown) => string | number | AssetAmount | Promise); maxTimeoutSeconds?: number; extra?: Record; } /** * AssetAmount type from @x402/core * Represents explicit asset/amount specification bypassing default asset lookup */ interface AssetAmount { asset: string; amount: string; extra?: Record; } /** * Settlement options for route configuration */ interface SettlementOptions { /** Hook contract address (optional, defaults to TransferHook for the network) */ hook?: string; /** Encoded hook data (optional, defaults to TransferHook.encode()) */ hookData?: string; /** * Facilitator fee amount (optional). * - If not provided, will be dynamically calculated by calling facilitator /calculate-fee endpoint * - If provided, will be used as fixed fee for all networks */ facilitatorFee?: string; /** Final recipient address (optional, defaults to original option.payTo before settlementRouter override) */ finalPayTo?: string; /** Optional description for the extension */ description?: string; /** * Facilitator service URL for dynamic fee calculation (optional) * Defaults to https://facilitator.x402x.dev * Only used when facilitatorFee is not explicitly provided */ facilitatorUrl?: string; } /** * Configuration for settlement hooks */ interface SettlementHooksConfig { /** Whether to enable automatic salt extraction from extension info */ enableSaltExtraction?: boolean; /** Whether to validate settlement router parameters */ validateSettlementParams?: boolean; } /** * Create a route configuration with router settlement support * * This helper wraps the standard x402 RouteConfig and adds settlement-specific * configuration including hooks, settlement router address, and dynamic extensions. * * Key Design (v2 + x402x + dynamic fee): * - Uses DynamicPrice to enable probe-quote-replay flow: * - First request (no payment): generates salt + queries facilitator fee → returns AssetAmount * - Retry (with payment): decodes paymentPayload.accepted and replays it → ensures deepEqual match * - Converts Money price to AssetAmount using x402x default asset config per network * - Embeds EIP-712 domain + x402x settlement info into price.extra * - This bypasses official SDK's hardcoded getDefaultAsset() and allows x402x to define assets for all networks * * @param baseConfig - Base route configuration (accepts can use Money price like "$1.00") * @param settlementOptions - Settlement-specific options (all fields optional with sensible defaults) * @returns Enhanced route configuration with dynamic AssetAmount prices containing full x402x context * * @example Minimal usage (all defaults, dynamic fee from facilitator) * ```typescript * const routes = { * "POST /api/purchase": createSettlementRouteConfig({ * accepts: supportedNetworks.map(network => ({ * scheme: "exact", * network, * payTo: merchantAddress, // Used as finalPayTo, overridden to settlementRouter * price: "$1.00", * })), * description: "Purchase endpoint", * }) * // settlementOptions omitted: uses DEFAULT_FACILITATOR_URL for fee query * }; * ``` * * @example With custom facilitator URL * ```typescript * const routes = { * "POST /api/purchase": createSettlementRouteConfig({ * accepts: [...], * description: "Purchase endpoint", * }, { * facilitatorUrl: "https://custom-facilitator.example.com", * }) * }; * ``` * * @example With fixed facilitator fee (no dynamic query) * ```typescript * const routes = { * "POST /api/purchase": createSettlementRouteConfig({ * accepts: [...], * description: "Purchase endpoint", * }, { * facilitatorFee: "1000", // Fixed fee, skips dynamic calculation * }) * }; * ``` */ declare function createSettlementRouteConfig(baseConfig: SettlementRouteConfig, settlementOptions?: SettlementOptions): SettlementRouteConfig; /** * Register settlement-specific hooks with the resource server * * This function registers lifecycle hooks for handling settlement-specific logic: * - Extract salt from extension info before verification * - Validate settlement router parameters * * @param server - x402ResourceServer instance * @param config - Hook configuration options * * @example * ```typescript * import { registerSettlementHooks } from "@x402x/extensions"; * * registerSettlementHooks(server, { * enableSaltExtraction: true, * validateSettlementParams: true, * }); * ``` */ declare function registerSettlementHooks(server: x402ResourceServer, config?: SettlementHooksConfig): void; /** * Type definitions for facilitator services * * These types define the interfaces and configurations used by facilitator * implementations that handle payment verification and settlement. */ /** * Ethereum address type */ type Address = `0x${string}`; /** * Response from facilitator verification */ interface VerifyResponse$1 { /** Whether the payment payload is valid */ isValid: boolean; /** Reason for invalidity if isValid is false */ invalidReason?: string; /** Payer address extracted from the payload */ payer?: string; } /** * Response from facilitator settlement */ interface SettleResponse$1 { /** Whether the settlement was successful */ success: boolean; /** Transaction hash of the settlement */ transaction: string; /** Network the settlement was executed on (CAIP-2 format) */ network: Network; /** Payer address */ payer?: string; /** Error reason if settlement failed */ errorReason?: string; } /** * Configuration for RouterSettlementFacilitator */ interface FacilitatorConfig { /** Signer address for facilitating settlements (optional, will be derived from privateKey if not provided) */ signer?: Address; /** Private key for local signing (enables sending transactions on standard RPC providers) */ privateKey?: string; /** Allowed SettlementRouter addresses per network */ allowedRouters?: Record; /** Optional RPC URLs per network */ rpcUrls?: Record; /** Gas configuration */ gasConfig?: { maxGasLimit: bigint; gasMultiplier: number; }; /** Fee configuration */ feeConfig?: { minFee: string; maxFee: string; }; /** Timeouts in milliseconds */ timeouts?: { verify: number; settle: number; }; } /** * Parameters for SettlementRouter.settleAndExecute */ interface SettlementRouterParams { token: Address; from: Address; value: string; validAfter: string; validBefore: string; nonce: string; signature: string; salt: string; payTo: Address; facilitatorFee: string; hook: Address; hookData: string; settlementRouter: Address; } /** * Error types for facilitator operations */ declare class FacilitatorValidationError extends Error { constructor(message: string); } declare class SettlementRouterError extends Error { readonly cause?: unknown | undefined; constructor(message: string, cause?: unknown | undefined); } /** * Helper functions for x402x router settlement integration * * Provides convenient utilities for working with x402 v2 resource servers * and router settlement extensions. */ /** * Register router settlement extension with a resource server * * @param server - x402ResourceServer instance * @returns The server instance for chaining * * @example * ```typescript * import { x402ResourceServer } from "@x402/core/server"; * import { registerExactEvmScheme } from "@x402/evm/exact/server/register"; * import { registerRouterSettlement } from "@x402x/extensions"; * * const server = new x402ResourceServer(facilitatorClient); * registerExactEvmScheme(server, {}); * registerRouterSettlement(server); * ``` */ declare function registerRouterSettlement(server: x402ResourceServer): x402ResourceServer; /** * Create a router settlement facilitator * * Factory function to create a RouterSettlementFacilitator instance. * * Note: This requires @x402x/facilitator-sdk to be installed separately. * * @param config - Facilitator configuration * @returns RouterSettlementFacilitator instance * * @example * ```typescript * // First install the dependency: * // pnpm install @x402x/facilitator-sdk * * import { createX402xFacilitator } from "@x402x/extensions"; * // Or import directly: * // import { createRouterSettlementFacilitator } from "@x402x/facilitator-sdk"; * * const facilitator = createX402xFacilitator({ * privateKey: process.env.FACILITATOR_PRIVATE_KEY, * rpcUrls: { * "base-sepolia": "https://sepolia.base.org", * }, * allowedRouters: { * "base-sepolia": ["0x817e4f0ee2fbdaac426f1178e149f7dc98873ecb"], * }, * }); * ``` */ declare function createX402xFacilitator(config: FacilitatorConfig): Promise; /** * Options for adding router settlement parameters */ interface WithRouterSettlementOptions { /** Hook contract address (required) */ hook: string; /** Encoded hook data (required) */ hookData: string; /** Facilitator fee amount in atomic units (required) */ facilitatorFee: string; /** Final recipient address (required) */ payTo: string; /** Unique salt for idempotency (optional, will be auto-generated if not provided) */ salt?: string; /** Asset name for EIP-712 (optional, will use network config default if not provided) */ name?: string; /** Asset version for EIP-712 (optional, will use network config default if not provided) */ version?: string; } /** * Add router settlement parameters to PaymentRequirements * * Enriches payment requirements with settlement router extra fields needed * for atomic settlement through the SettlementRouter contract. * * @param requirements - Base payment requirements from x402 middleware * @param options - Router settlement options * @returns Enhanced payment requirements with settlement extra * * @example * ```typescript * import { withRouterSettlement, TransferHook } from "@x402x/extensions"; * * const baseRequirements = { * scheme: "exact", * network: "eip155:84532", * asset: "0x036CbD53842c5426634e7929541eC2318f3dCF7e", * amount: "1000000", // 1 USDC * payTo: merchantAddress, * }; * * const requirements = withRouterSettlement(baseRequirements, { * hook: TransferHook.getAddress("base-sepolia"), * hookData: TransferHook.encode(), * facilitatorFee: "10000", // 0.01 USDC * payTo: merchantAddress, * }); * ``` */ declare function withRouterSettlement(requirements: Partial, options: WithRouterSettlementOptions): PaymentRequirements; /** * Check if payment requirements use router settlement mode * * @param requirements - Payment requirements to check * @returns True if router settlement is enabled * * @example * ```typescript * if (isRouterSettlement(requirements)) { * console.log("Using router settlement mode"); * } * ``` */ declare function isRouterSettlement(requirements: PaymentRequirements): boolean; /** * Validation helpers for PaymentRequirements.extra (settlement parameters) */ /** * Validation result */ interface ValidationResult { /** Whether the validation passed */ valid: boolean; /** Error message if validation failed */ error?: string; } /** * Validate Ethereum address format (0x followed by 40 hex characters) * * @param address - Address to validate * @returns true if valid Ethereum address */ declare function isValidAddress(address: string): boolean; /** * Validate hex string format (0x followed by even number of hex characters) * * @param hex - Hex string to validate * @returns true if valid hex string */ declare function isValidHex(hex: string): boolean; /** * Validate 32-byte hex string (0x followed by 64 hex characters) * * @param hex - Hex string to validate * @returns true if valid 32-byte hex string */ declare function isValid32ByteHex(hex: string): boolean; /** * Validate numeric string (non-negative integer) * * @param value - Value to validate * @returns true if valid numeric string */ declare function isValidNumericString(value: string): boolean; /** * Validate settlement extra parameters * * This validates all required fields for settlement through SettlementRouter. * * @param extra - Settlement extra parameters to validate * @returns Validation result with error message if invalid * * @example * ```typescript * const result = validateSettlementExtra({ * settlementRouter: "0x1234...", * payTo: "0x5678...", * facilitatorFee: "10000", * hook: "0xabcd...", * hookData: "0x", * name: "USDC", * version: "2", * salt: "0x1234..." * }); * * if (!result.valid) { * throw new Error(result.error); * } * ``` */ declare function validateSettlementExtra(extra: Partial): ValidationResult; /** * Assert that settlement extra parameters are valid * Throws SettlementExtraError if validation fails * * @param extra - Settlement extra parameters to validate * @throws {SettlementExtraError} If validation fails * * @example * ```typescript * try { * assertValidSettlementExtra(extra); * // Extra is valid, proceed with settlement * } catch (error) { * console.error("Invalid settlement extra:", error.message); * } * ``` */ declare function assertValidSettlementExtra(extra: Partial): asserts extra is SettlementExtra; /** * Amount parsing and formatting utilities for x402x default asset (USDC) */ /** * Error class for amount-related validation errors */ declare class AmountError extends Error { constructor(message: string); } /** * Parse amount from various formats to atomic units for the default asset (USDC) * * Supports multiple input formats: * - Dollar format: '$1.2' or '$1.20' → '1200000' (1.2 USDC) * - Decimal string: '1.2' or '1.20' → '1200000' * - Number: 1.2 → '1200000' * * Uses x402's processPriceToAtomicAmount for parsing. All string/number inputs * are treated as USD amounts, not atomic units. * * @param amount - Amount in various formats (USD, not atomic units) * @param network - Network name (required) - used to determine token decimals * @returns Amount in atomic units as string * @throws AmountError if amount format is invalid * * @example * ```typescript * parseDefaultAssetAmount('$1.2', 'base-sepolia') // '1200000' * parseDefaultAssetAmount('1.2', 'base-sepolia') // '1200000' * parseDefaultAssetAmount(1.2, 'base-sepolia') // '1200000' * parseDefaultAssetAmount('100', 'base-sepolia') // '100000000' (100 USDC, not 100 atomic units) * ``` */ declare function parseDefaultAssetAmount(amount: string | number, network: string | Network): string; /** * Format atomic units to human-readable decimal string for the default asset (USDC) * * Automatically determines decimals from the network's default asset configuration. * * @param amount - Amount in atomic units * @param network - Network name (required) - used to determine token decimals * @returns Human-readable decimal string * @throws AmountError if amount is invalid * * @example * ```typescript * formatDefaultAssetAmount('1200000', 'base-sepolia') // '1.2' * formatDefaultAssetAmount('1000000', 'base-sepolia') // '1' * formatDefaultAssetAmount('1', 'base-sepolia') // '0.000001' * ``` */ declare function formatDefaultAssetAmount(amount: string, network: string | Network): string; /** * Facilitator API client utilities for x402x * * Provides client-side functions to interact with facilitator HTTP APIs. * This includes fee calculation and caching utilities, as well as * helper functions for settlement mode detection and validation. */ /** * Check if a payment request requires SettlementRouter mode * * This is a client-side utility to determine which settlement flow to use. * * @param paymentRequirements - Payment requirements from 402 response * @returns True if settlement mode is required * * @example * ```typescript * if (isSettlementMode(paymentRequirements)) { * // Use Settlement Router mode * await submitToFacilitator(...); * } else { * // Use standard x402 mode * await settle(...); * } * ``` */ declare function isSettlementMode(paymentRequirements: PaymentRequirements): boolean; /** * Parse and validate settlement extra parameters * * This is useful for clients to validate payment requirements before submission. * * @param extra - Extra field from PaymentRequirements * @returns Parsed settlement extra parameters * @throws SettlementExtraError if parameters are invalid * * @example * ```typescript * try { * const extra = parseSettlementExtra(paymentRequirements.extra); * console.log('Hook:', extra.hook); * console.log('Facilitator Fee:', extra.facilitatorFee); * } catch (error) { * console.error('Invalid settlement parameters:', error); * } * ``` */ declare function parseSettlementExtra(extra: unknown): SettlementExtraCore; /** * Result of facilitator fee calculation * * This interface represents the response from facilitator's /calculate-fee endpoint. * Only essential information is included - internal cost breakdown is not exposed. */ interface FeeCalculationResult { network: string; hook: string; hookData?: string; hookAllowed: boolean; facilitatorFee: string; facilitatorFeeUSD: string; calculatedAt: string; validitySeconds: number; token: { address: string; symbol: string; decimals: number; }; } /** * Calculate recommended facilitator fee by querying the facilitator service * * @param facilitatorUrl - Facilitator service base URL * @param network - Network name * @param hook - Hook contract address * @param hookData - Optional encoded hook parameters * @param useCache - Whether to use caching (default: true) * @returns Fee calculation result with sufficient safety margin * * @example * ```typescript * const feeResult = await calculateFacilitatorFee( * 'https://facilitator.x402x.dev', * 'base-sepolia', * '0x1234...', * '0x' * ); * console.log(`Recommended fee: ${feeResult.facilitatorFee} (${feeResult.facilitatorFeeUSD} USD)`); * ``` */ declare function calculateFacilitatorFee(facilitatorUrl: string, network: string, hook: string, hookData?: string, useCache?: boolean): Promise; /** * Clear the fee calculation cache * * Useful for testing or forcing fresh calculations */ declare function clearFeeCache(): void; /** * Response from facilitator verify endpoint * * Indicates whether a payment payload is valid without executing it. */ interface VerifyResponse { /** Whether the payment payload is valid */ isValid: boolean; /** Reason for invalidity if isValid is false */ invalidReason?: string; /** Payer address extracted from the payload */ payer: string; } /** * Response from facilitator settle endpoint * * Contains the result of settlement execution on-chain. */ interface SettleResponse { /** Whether the settlement was successful */ success: boolean; /** Transaction hash of the settlement */ transaction: string; /** Network the settlement was executed on */ network: string; /** Payer address */ payer: string; /** Error reason if settlement failed */ errorReason?: string; } /** * Verify a payment payload with the facilitator * * Calls the facilitator's `/verify` endpoint to validate a payment without executing it. * This is useful for pre-validation before actual settlement. * * @param facilitatorUrl - Facilitator service base URL * @param paymentPayload - Payment payload from client (x402 standard) * @param paymentRequirements - Payment requirements (x402 standard) * @returns Verification response indicating validity * * @throws Error if network request fails or response is invalid * * @example * ```typescript * import { verify } from '@x402x/core'; * * const result = await verify( * 'https://facilitator.x402x.dev', * paymentPayload, * paymentRequirements * ); * * if (result.isValid) { * console.log('Payment is valid, payer:', result.payer); * } else { * console.error('Invalid payment:', result.invalidReason); * } * ``` */ declare function verify(facilitatorUrl: string, paymentPayload: PaymentPayload, paymentRequirements: PaymentRequirements): Promise; /** * Settle a payment with the facilitator * * Calls the facilitator's `/settle` endpoint to execute the payment on-chain. * This is the core function that submits a signed payment for blockchain execution. * * @param facilitatorUrl - Facilitator service base URL * @param paymentPayload - Payment payload from client (x402 standard) * @param paymentRequirements - Payment requirements (x402 standard) * @param timeout - Optional timeout in milliseconds (default: 30000) * @returns Settlement response with transaction details * * @throws Error if network request fails, response is invalid, or settlement fails * * @example * ```typescript * import { settle } from '@x402x/core'; * * const result = await settle( * 'https://facilitator.x402x.dev', * paymentPayload, * paymentRequirements, * 30000 // 30 second timeout * ); * * if (result.success) { * console.log('Settlement successful!'); * console.log('Transaction:', result.transaction); * console.log('Network:', result.network); * } else { * console.error('Settlement failed:', result.errorReason); * } * ``` */ declare function settle(facilitatorUrl: string, paymentPayload: PaymentPayload, paymentRequirements: PaymentRequirements, timeout?: number): Promise; /** * ABI definitions for x402x contracts */ /** * Settlement Router ABI * * Contains functions used by facilitators for settlement and fee management. */ declare const SETTLEMENT_ROUTER_ABI: readonly [{ readonly type: "function"; readonly name: "settleAndExecute"; readonly inputs: readonly [{ readonly name: "token"; readonly type: "address"; }, { readonly name: "from"; readonly type: "address"; }, { readonly name: "value"; readonly type: "uint256"; }, { readonly name: "validAfter"; readonly type: "uint256"; }, { readonly name: "validBefore"; readonly type: "uint256"; }, { readonly name: "nonce"; readonly type: "bytes32"; }, { readonly name: "signature"; readonly type: "bytes"; }, { readonly name: "salt"; readonly type: "bytes32"; }, { readonly name: "payTo"; readonly type: "address"; }, { readonly name: "facilitatorFee"; readonly type: "uint256"; }, { readonly name: "hook"; readonly type: "address"; }, { readonly name: "hookData"; readonly type: "bytes"; }]; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; }, { readonly type: "function"; readonly name: "calculateCommitment"; readonly inputs: readonly [{ readonly name: "token"; readonly type: "address"; }, { readonly name: "from"; readonly type: "address"; }, { readonly name: "value"; readonly type: "uint256"; }, { readonly name: "validAfter"; readonly type: "uint256"; }, { readonly name: "validBefore"; readonly type: "uint256"; }, { readonly name: "salt"; readonly type: "bytes32"; }, { readonly name: "payTo"; readonly type: "address"; }, { readonly name: "facilitatorFee"; readonly type: "uint256"; }, { readonly name: "hook"; readonly type: "address"; }, { readonly name: "hookData"; readonly type: "bytes"; }]; readonly outputs: readonly [{ readonly name: ""; readonly type: "bytes32"; }]; readonly stateMutability: "view"; }, { readonly type: "function"; readonly name: "calculateContextKey"; readonly inputs: readonly [{ readonly name: "from"; readonly type: "address"; }, { readonly name: "token"; readonly type: "address"; }, { readonly name: "nonce"; readonly type: "bytes32"; }]; readonly outputs: readonly [{ readonly name: ""; readonly type: "bytes32"; }]; readonly stateMutability: "pure"; }, { readonly type: "function"; readonly name: "isSettled"; readonly inputs: readonly [{ readonly name: "contextKey"; readonly type: "bytes32"; }]; readonly outputs: readonly [{ readonly name: ""; readonly type: "bool"; }]; readonly stateMutability: "view"; }, { readonly type: "function"; readonly name: "getPendingFees"; readonly inputs: readonly [{ readonly name: "facilitator"; readonly type: "address"; }, { readonly name: "token"; readonly type: "address"; }]; readonly outputs: readonly [{ readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "view"; }, { readonly type: "function"; readonly name: "claimFees"; readonly inputs: readonly [{ readonly name: "tokens"; readonly type: "address[]"; }]; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; }]; /** * Network utility functions for x402x core_v2 * * These utilities provide helpers for working with CAIP-2 network identifiers * and accessing network-specific asset information. */ /** * Asset information including EIP-712 domain parameters */ interface AssetInfo { address: string; decimals: number; eip712: { name: string; version: string; }; } /** * Primary mapping from human-readable network names to CAIP-2 identifiers * * This is the SINGLE SOURCE OF TRUTH for network name mappings. * When adding a new network, only update this mapping and the corresponding * entries in networks.ts and DEFAULT_ASSETS. */ declare const NETWORK_ALIASES_V1_TO_V2: Record; /** * CAIP-2 network ID to network alias mapping (reverse lookup) * * Maps CAIP-2 identifiers to v1 configuration aliases (e.g., "eip155:84532" → "base-sepolia"). * These aliases are used in configuration files and for backward compatibility. * * Automatically generated from NETWORK_ALIASES_V1_TO_V2. * DO NOT edit this manually - it will be regenerated. */ declare const NETWORK_ALIASES: Record; /** * Get network alias from CAIP-2 network ID * * Returns the v1 configuration alias (e.g., "base-sepolia") for a given CAIP-2 identifier. * These aliases are used in configuration files and for backward compatibility. * * @param network - CAIP-2 network identifier (e.g., 'eip155:84532') * @returns Network alias (e.g., 'base-sepolia') * @throws Error if network ID is not supported * * @example * ```typescript * const alias = getNetworkAlias('eip155:84532'); // 'base-sepolia' * ``` */ declare function getNetworkAlias(network: Network): string; /** * Get default asset (USDC) information for a network * * @param network - CAIP-2 network identifier (e.g., 'eip155:84532') * @returns Asset information including address, decimals, and EIP-712 domain * @throws Error if network is not supported * * @example * ```typescript * const asset = getDefaultAsset('eip155:84532'); * // { address: '0x036Cb...', decimals: 6, eip712: { name: 'USDC', version: '2' } } * ``` */ declare function getDefaultAsset(network: string | Network): AssetInfo; /** * Process price to atomic amount for the default asset on a network * * This function converts various price formats to atomic units (smallest denomination). * For USDC with 6 decimals: 1.5 USD -> '1500000' * * @param price - Price as string or number (in USD, not atomic units) * @param network - CAIP-2 network identifier * @returns Object with amount as string in atomic units, or error * * @example * ```typescript * const result = processPriceToAtomicAmount('1.5', 'eip155:84532'); * // { amount: '1500000' } * ``` */ declare function processPriceToAtomicAmount(price: string | number, network: string | Network): { amount: string; } | { error: string; }; /** * Get list of all supported network IDs (CAIP-2 identifiers) * * Returns protocol-level CAIP-2 network identifiers like "eip155:84532". * Use this for x402 v2 protocol operations and facilitator configuration. * * @returns Array of CAIP-2 network identifiers * * @example * ```typescript * const networkIds = getSupportedNetworkIds(); * // => ['eip155:84532', 'eip155:8453', 'eip155:1952', ...] * * // For x402 v2 protocol * const facilitator = createFacilitator({ * networks: getSupportedNetworkIds() * }); * ``` */ declare function getSupportedNetworkIds(): Network[]; /** * Get the alias mapping from v1 network names to v2 CAIP-2 identifiers * * @returns Record mapping v1 names to v2 CAIP-2 keys * * @example * ```typescript * const aliases = getNetworkAliasesV1ToV2(); * // => { 'base-sepolia': 'eip155:84532', 'x-layer-testnet': 'eip155:1952', ... } * ``` */ declare function getNetworkAliasesV1ToV2(): Record; /** * Convert any network identifier to its canonical v2 CAIP-2 key * * Handles both v1 human-readable names and v2 CAIP-2 identifiers, * returning the canonical v2 CAIP-2 identifier for all inputs. * * @param network - Network identifier (v1 name or v2 CAIP-2) * @returns Canonical v2 CAIP-2 network identifier * @throws Error if network is not supported * * @example * ```typescript * toCanonicalNetworkKey('base-sepolia'); // 'eip155:84532' * toCanonicalNetworkKey('eip155:84532'); // 'eip155:84532' * toCanonicalNetworkKey('x-layer'); // 'eip155:196' * ``` */ declare function toCanonicalNetworkKey(network: string): Network; export { type Address, AmountError, type CommitmentParams, type DemoHooks, type FacilitatorConfig, type SettleResponse$1 as FacilitatorSettleResponse, FacilitatorValidationError, type VerifyResponse$1 as FacilitatorVerifyResponse, type FeeCalculationResult, type RouteConfig as LegacyRouteConfig, type MintConfig, type Money, NETWORK_ALIASES, NETWORK_ALIASES_V1_TO_V2, NFTMintHook, type NetworkConfig, ROUTER_SETTLEMENT_KEY, type Resource, type RewardConfig, RewardHook, type RoutePattern, type RouterSettlementExtension, type RouterSettlementExtensionInfo, type RoutesConfig, SETTLEMENT_ROUTER_ABI, type SettleResponse, type SettlementExtra, type SettlementExtraCore, SettlementExtraError, type SettlementHooksConfig, type SettlementOptions, type SettlementPaymentOption, type SettlementRouteConfig, SettlementRouterError, type SettlementRouterParams, type Signer, TransferHook, type ValidationResult, type VerifyResponse, type WithRouterSettlementOptions, addSettlementExtra, assertValidSettlementExtra, calculateCommitment, calculateFacilitatorFee, clearFeeCache, computeRoutePatterns, createExtensionDeclaration, createRouterSettlementExtension, createSettlementRouteConfig, createX402xFacilitator, findMatchingPaymentRequirements, findMatchingRoute, formatDefaultAssetAmount, generateSalt, getChain, getChainById, getCustomChains, getDefaultAsset, getNetworkAlias, getNetworkAliasesV1ToV2, getNetworkConfig, getRouterSettlementExtensionKey, getSupportedNetworkAliases, getSupportedNetworkIds, getSupportedNetworks, isCustomChain, isNetworkSupported, isRouterSettlement, isSettlementMode, isValid32ByteHex, isValidAddress, isValidHex, isValidNumericString, networks, parseDefaultAssetAmount, parseSettlementExtra, processPriceToAtomicAmount, registerRouterSettlement, registerSettlementHooks, routerSettlementServerExtension, settle, toCanonicalNetworkKey, toJsonSafe, validateCommitmentParams, validateSettlementExtra, verify, withRouterSettlement };