import { EmbeddedProviderConfig, EmbeddedProviderAuthType, ConnectResult as ConnectResult$1, WalletAddress, EmbeddedProviderEvent, EventCallback } from '@phantom/embedded-provider-core'; export { ConnectErrorEventData, ConnectEventData, ConnectStartEventData, DisconnectEventData, EmbeddedProviderEvent, EmbeddedProviderEventMap, EventCallback, SignAndSendTransactionParams, SignMessageParams, SignMessageResult, SignedTransaction, WalletAddress } from '@phantom/embedded-provider-core'; import { IEthereumChain, ISolanaChain } from '@phantom/chain-interfaces'; export { EthTransactionRequest, IEthereumChain, ISolanaChain, SignAndSendTransactionOptions } from '@phantom/chain-interfaces'; import { AddressType } from '@phantom/client'; export { AddressType, PresignTransactionContext } from '@phantom/client'; import { AutoConfirmEnableParams, AutoConfirmResult, AutoConfirmSupportedChainsResult } from '@phantom/browser-injected-sdk/auto-confirm'; export { AutoConfirmEnableParams, AutoConfirmResult, AutoConfirmSupportedChainsResult } from '@phantom/browser-injected-sdk/auto-confirm'; export { NetworkId, PHANTOM_ICON } from '@phantom/constants'; export { base64urlDecode, base64urlEncode } from '@phantom/base64url'; declare enum DebugLevel { ERROR = 0, WARN = 1, INFO = 2, DEBUG = 3 } interface DebugMessage { timestamp: number; level: DebugLevel; category: string; message: string; data?: any; } type DebugCallback = (message: DebugMessage) => void; declare class Debug { private static instance; private callback?; private level; private enabled; private constructor(); static getInstance(): Debug; setCallback(callback: DebugCallback): void; setLevel(level: DebugLevel): void; enable(): void; disable(): void; private writeLog; error(category: string, message: string, data?: any): void; warn(category: string, message: string, data?: any): void; info(category: string, message: string, data?: any): void; debug(category: string, message: string, data?: any): void; log(category: string, message: string, data?: any): void; } declare const debug: Debug; declare const DebugCategory: { readonly BROWSER_SDK: "BrowserSDK"; readonly PROVIDER_MANAGER: "ProviderManager"; readonly EMBEDDED_PROVIDER: "EmbeddedProvider"; readonly INJECTED_PROVIDER: "InjectedProvider"; readonly PHANTOM_CONNECT_AUTH: "PhantomConnectAuth"; readonly JWT_AUTH: "JWTAuth"; readonly STORAGE: "Storage"; readonly SESSION: "Session"; }; interface PhantomAppLoginOptions { publicKey: string; appId: string; sessionId: string; } interface PhantomAppLoginResult { walletId: string; organizationId: string; accountDerivationIndex?: number; expiresInMs?: number; authUserId?: string; } interface PhantomApp { login(options: PhantomAppLoginOptions): Promise; features(): Promise<{ features: string[]; }>; getUser(): Promise<{ authUserId?: string; } | undefined>; } declare global { interface Window { phantom?: { solana?: unknown; ethereum?: unknown; app?: PhantomApp; } | undefined; } } interface InjectedProviderConfig { addressTypes: AddressType[]; } type InjectedWalletId = string; interface WalletProviders { /** EIP-6963 Ethereum provider (window.ethereum-like) */ ethereum?: IEthereumChain; /** Wallet Standard Solana wallet object */ solana?: ISolanaChain; } interface InjectedWalletInfo { id: InjectedWalletId; name: string; icon?: string; addressTypes: AddressType[]; providers?: WalletProviders; /** Reverse DNS identifier from EIP-6963 (for potential future matching with Wallet Standard) */ rdns?: string; discovery?: "standard" | "eip6963" | "phantom" | "custom"; } interface DebugConfig { enabled?: boolean; level?: DebugLevel; callback?: DebugCallback; } type BrowserSDKConfig = Prettify & InjectedProviderConfig & { providers: AuthProviderType[]; appId?: string; apiBaseUrl?: string; embeddedWalletType?: "app-wallet" | "user-wallet"; authOptions?: { authUrl?: string; redirectUrl?: string; authApiBaseUrl?: string; }; }>; type Prettify = { [K in keyof T]: T[K]; } & {}; type AuthProviderType = EmbeddedProviderAuthType | "injected" | "deeplink"; type AuthOptions = { provider: AuthProviderType; walletId?: string; customAuthData?: Record; }; type ConnectResultWalletInfo = Omit; type ConnectResult = Omit & { authProvider?: AuthProviderType | undefined; walletId?: string | undefined; wallet?: ConnectResultWalletInfo | undefined; }; interface Provider { connect(authOptions: AuthOptions): Promise; disconnect(): Promise; getAddresses(): WalletAddress[]; isConnected(): boolean; autoConnect(): Promise; getEnabledAddressTypes(): AddressType[]; solana: ISolanaChain; ethereum: IEthereumChain; } interface ProviderPreference { type: "injected" | "embedded"; embeddedWalletType?: "app-wallet" | "user-wallet"; } declare class BrowserSDK { private providerManager; private walletRegistry; private config; isLoading: boolean; constructor(config: BrowserSDKConfig); discoverWallets(): Promise; /** * Access Solana chain operations */ get solana(): ISolanaChain; /** * Access Ethereum chain operations */ get ethereum(): IEthereumChain; /** * Connect to the wallet */ connect(options: AuthOptions): Promise; /** * Disconnect from the wallet */ disconnect(): Promise; /** * Check if the SDK is connected to a wallet */ isConnected(): boolean; /** * Get all connected wallet addresses */ getAddresses(): WalletAddress[]; /** * Get information about the current provider */ getCurrentProviderInfo(): ProviderPreference | null; /** * Get enabled address types for the current provider * - For embedded provider: returns config.addressTypes * - For Phantom injected: returns config.addressTypes * - For discovered wallets: returns the wallet's addressTypes from registry */ getEnabledAddressTypes(): AddressType[]; /** * Add event listener for provider events (connect, connect_start, connect_error, disconnect, error) * Works with both embedded and injected providers */ on(event: EmbeddedProviderEvent, callback: EventCallback): void; /** * Remove event listener for provider events * Works with both embedded and injected providers */ off(event: EmbeddedProviderEvent, callback: EventCallback): void; /** * Attempt auto-connection using existing session * Should be called after setting up event listeners * Tries embedded provider first, then injected provider as fallback */ autoConnect(): Promise; enableDebug(): void; disableDebug(): void; setDebugLevel(level: DebugLevel): void; setDebugCallback(callback: DebugCallback): void; configureDebug(config: { enabled?: boolean; level?: DebugLevel; callback?: DebugCallback; }): void; /** * Enable auto-confirm for transactions * Only available for injected providers */ enableAutoConfirm(params: AutoConfirmEnableParams): Promise; /** * Disable auto-confirm for transactions * Only available for injected providers */ disableAutoConfirm(): Promise; /** * Get current auto-confirm status * Only available for injected providers */ getAutoConfirmStatus(): Promise; /** * Get supported chains for auto-confirm * Only available for injected providers */ getSupportedAutoConfirmChains(): Promise; getDiscoveredWallets(): InjectedWalletInfo[]; } /** * Browser detection utility to identify browser name and version */ interface BrowserInfo { name: string; version: string; userAgent: string; } /** * Parse browser information from a user agent string * This is the core parsing logic that can be unit tested independently */ declare function parseBrowserFromUserAgent(userAgent: string, hasBraveAPI?: boolean): BrowserInfo; /** * Detect the current browser and version from the user agent string */ declare function detectBrowser(): BrowserInfo; /** * Get a formatted platform name for use in authenticator names * Format: "browsername-v123" (e.g., "chrome-v120", "firefox-v119") */ declare function getPlatformName(): string; /** * Get detailed browser information as a string * Format: "Chrome 120.0" or "Firefox 119.0" */ declare function getBrowserDisplayName(): string; /** * Detect if the current device is a mobile device * Checks user agent for mobile indicators and screen size */ declare function isMobileDevice(): boolean; /** * Generates a deeplink URL to open the current page in Phantom mobile app * @param ref Optional referrer parameter * @returns Phantom mobile app deeplink URL */ declare function getDeeplinkToPhantom(ref?: string, currentHref?: string): string; /** * Wait for Phantom extension to be available with retry logic * * @param timeoutMs - Maximum time to wait in milliseconds (default: 3000) * @returns Promise - true if Phantom extension is available, false if timeout reached * * Usage: * ```typescript * const isAvailable = await waitForPhantomExtension(5000); * if (isAvailable) { * console.log("Phantom extension is available!"); * } else { * console.log("Phantom extension not found or timed out"); * } * ``` */ declare function waitForPhantomExtension(timeoutMs?: number): Promise; /** * Check if Phantom Login is available * * This function checks if: * 1. The Phantom extension is installed * 2. The extension supports the phantom_login feature * * @param timeoutMs - Maximum time to wait for extension in milliseconds (default: 3000) * @returns Promise - true if Phantom Login is available, false otherwise * * Usage: * ```typescript * const isAvailable = await isPhantomLoginAvailable(); * ``` */ declare function isPhantomLoginAvailable(timeoutMs?: number): Promise; export { AuthOptions, AuthProviderType, BrowserInfo, BrowserSDK, BrowserSDKConfig, ConnectResult, DebugCallback, DebugCategory, DebugConfig, DebugLevel, DebugMessage, InjectedWalletId, InjectedWalletInfo, Provider, debug, detectBrowser, getBrowserDisplayName, getDeeplinkToPhantom, getPlatformName, isMobileDevice, isPhantomLoginAvailable, parseBrowserFromUserAgent, waitForPhantomExtension };