/** * Provider detection utilities for identifying wallet providers */ import { EIP1193Provider } from "../types"; /** * Default icon for providers without custom icons */ export declare const DEFAULT_PROVIDER_ICON: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIiBmaWxsPSIjRkZGIi8+CjxwYXRoIGQ9Ik0xNiA4TDggMjRoMTZMMTYgOHoiIGZpbGw9IiMzMzMiLz4KPC9zdmc+Cg=="; /** * Common wallet provider flags used for detection */ export interface WalletProviderFlags { isMetaMask?: boolean; isCoinbaseWallet?: boolean; isWalletConnect?: boolean; isTrust?: boolean; isBraveWallet?: boolean; isPhantom?: boolean; } /** * Provider information returned by detection */ export interface ProviderInfo { name: string; rdns: string; uuid: string; icon: `data:image/${string}`; } /** * Attempts to detect information about an injected provider by examining * common wallet-specific flags and properties. * * @param provider The injected provider to analyze * @returns Provider information with fallback values if detection fails * * @example * ```typescript * const provider = window.ethereum; * const info = detectInjectedProviderInfo(provider); * console.log(info.name); // "MetaMask" or "Injected Provider" * ``` */ export declare function detectInjectedProviderInfo(provider: EIP1193Provider): ProviderInfo; /** * Was this error the USER declining, whatever transport delivered it? * * Three dialects say "the user said no": * - EIP-1193: code 4001 (UserRejectedRequest). * - WalletConnect sdkErrors: codes 5000-5005 (USER_REJECTED and its * variants). A LIVE MetaMask Mobile session rejecting a transaction * produced one of these and the SDK's 4001-only match reported nothing - * every WalletConnect rejection was silently uncounted. * - viem: a typed UserRejectedRequestError, sometimes without the numeric * code surviving the wrapping. * * The real code often hides under `cause` (viem nests, WC wraps), so the * chain is walked a few levels. */ export declare function isUserRejectionError(error: unknown): boolean; /** * The wallet on the far side of a WalletConnect session. * * WalletConnect is a transport, not a wallet: the signing wallet (Ledger * Live, MetaMask Mobile, Safe, ...) identifies itself in the session's peer * metadata. Reporting only "WalletConnect" hides every wallet behind it - * production showed Ledger at effectively zero while its sessions were being * tracked under the transport's name. Reads synchronous state only; never * issues an RPC. */ export declare function readWalletConnectPeer(provider: EIP1193Provider): { name: string; url?: string; } | undefined; /** * Validates that a provider implements the required EIP-1193 interface * * @param provider The provider to validate * @returns true if the provider has all required methods * * @example * ```typescript * if (isValidProvider(window.ethereum)) { * // Safe to use provider * } * ``` */ export declare function isValidProvider(provider: EIP1193Provider | undefined | null): provider is EIP1193Provider; //# sourceMappingURL=detection.d.ts.map