import { VersionedTransaction } from '@solana/web3.js'; import { Network } from '@payai/x402/types'; /** * Solana-specific x402 Protocol Types (v2) * These are Solana-only variants of x402 protocol types */ declare const SOLANA_MAINNET_CAIP2: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"; declare const SOLANA_DEVNET_CAIP2: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"; /** * Solana network type - supports both simple and CAIP-2 formats * Simple: "solana" | "solana-devnet" (for user-facing config) * CAIP-2: "solana:chainId" (used in protocol) */ type SolanaNetworkSimple = "solana" | "solana-devnet"; type SolanaNetworkCAIP2 = typeof SOLANA_MAINNET_CAIP2 | typeof SOLANA_DEVNET_CAIP2; type SolanaNetwork = SolanaNetworkSimple | SolanaNetworkCAIP2; /** * Check if a network string is a Solana network (any format) */ declare function isSolanaNetwork(network: string): network is SolanaNetwork; /** * Check if network is mainnet */ declare function isSolanaMainnet(network: string): boolean; /** * Check if network is devnet */ declare function isSolanaDevnet(network: string): boolean; /** * Convert simple network name to CAIP-2 format */ declare function toCAIP2Network(network: SolanaNetworkSimple): Network; /** * Convert CAIP-2 network to simple name (for display/config) */ declare function toSimpleNetwork(network: string): SolanaNetworkSimple; /** * Solana-specific payment types (v2) */ /** * Wallet adapter interface - framework agnostic * Compatible with both Anza wallet-adapter and custom implementations */ interface WalletAdapter { /** Anza wallet-adapter standard - wallet public key */ publicKey?: { toString(): string; }; /** Alternative property for address */ address?: string; /** Sign a transaction - required for payment */ signTransaction: (tx: VersionedTransaction) => Promise; } /** * Client configuration for x402 Solana client */ interface X402ClientConfig { /** Connected wallet adapter */ wallet: WalletAdapter; /** Solana network (simple format: "solana" | "solana-devnet") */ network: SolanaNetworkSimple; /** Custom RPC URL (defaults to public endpoint) */ rpcUrl?: string; /** Maximum payment amount in atomic units (0 = no limit) */ amount?: bigint; /** * Optional custom fetch function for making HTTP requests. * Useful for routing requests through a proxy server to avoid CORS issues * or adding custom request/response handling. * * @default globalThis.fetch */ customFetch?: typeof fetch; /** Enable verbose logging for debugging (default: false) */ verbose?: boolean; } /** * Token asset configuration */ interface TokenAsset { /** Token mint address */ address: string; /** Token decimals */ decimals: number; } /** * Server configuration for x402 payment handler */ interface X402ServerConfig { /** Solana network (simple format: "solana" | "solana-devnet") */ network: SolanaNetworkSimple; /** Treasury address where payments are sent */ treasuryAddress: string; /** Facilitator service URL */ facilitatorUrl: string; /** Custom RPC URL (defaults to public endpoint) */ rpcUrl?: string; /** Default token to accept (defaults to USDC) */ defaultToken?: TokenAsset; /** Default description for payments */ defaultDescription?: string; /** Default timeout in seconds */ defaultTimeoutSeconds?: number; } /** * Route configuration for protected endpoints */ interface RouteConfig { /** Price in atomic units */ amount: string; /** Token asset for payment */ asset: TokenAsset; /** Resource description */ description?: string; /** Response MIME type */ mimeType?: string; /** Payment timeout in seconds */ maxTimeoutSeconds?: number; } export { type RouteConfig as R, SOLANA_MAINNET_CAIP2 as S, type TokenAsset as T, type WalletAdapter as W, type X402ClientConfig as X, type X402ServerConfig as a, SOLANA_DEVNET_CAIP2 as b, type SolanaNetworkSimple as c, type SolanaNetworkCAIP2 as d, type SolanaNetwork as e, isSolanaMainnet as f, isSolanaDevnet as g, toSimpleNetwork as h, isSolanaNetwork as i, toCAIP2Network as t };