import { MultichainOptions, MultichainCore } from '@metamask/connect-multichain'; import { Wallet } from '@wallet-standard/base'; /** * Solana network names supported by the client. */ type SolanaNetwork = 'mainnet' | 'devnet' | 'testnet'; /** * A record mapping Solana network names to their RPC URLs. * * @example * ```typescript * const networks: SolanaSupportedNetworks = { * mainnet: 'https://api.mainnet-beta.solana.com', * devnet: 'https://api.devnet.solana.com', * }; * ``` */ type SolanaSupportedNetworks = Partial>; /** * Configuration options for creating a Solana client. * * Derived from MultichainOptions to ensure consistency with the core SDK. */ type SolanaConnectOptions = Pick & { /** * Optional API configuration. * Maps network names (mainnet, devnet, testnet) to RPC URLs. */ api?: { supportedNetworks?: SolanaSupportedNetworks; }; /** Enable debug logging */ debug?: boolean; /** Skip auto-registering the wallet during creation. Defaults to false. Set to true for manual control. */ skipAutoRegister?: boolean; }; /** * The Solana client instance returned by createSolanaClient. */ type SolanaClient = { /** The underlying MultichainCore instance */ core: MultichainCore; /** * Gets the wallet-standard compatible MetaMask wallet instance. * * @returns The wallet instance */ getWallet: () => Wallet; /** * Registers the MetaMask wallet with the wallet-standard registry. * This makes MetaMask automatically discoverable by Solana dapps. */ registerWallet: () => Promise; /** * Disconnects from the wallet and revokes the session. */ disconnect: () => Promise; }; /** * Generates Infura RPC URLs for Solana networks keyed by Solana network name. * * The returned map is intended for `createSolanaClient({ api: { supportedNetworks } })`. * * @param options - The options for generating Solana Infura RPC URLs * @param options.infuraApiKey - The Infura API key * @param options.networks - Solana networks to include in the returned map * @returns A map of Solana network names to Infura RPC URLs */ declare const getInfuraRpcUrls: ({ infuraApiKey, networks, }: { infuraApiKey: string; networks: SolanaNetwork[]; }) => SolanaSupportedNetworks; /** * Creates a new Solana client for connecting to MetaMask via wallet-standard. * * This function initializes the MultichainSDK and provides methods to get or register * a wallet-standard compatible wallet. The wallet handles session creation internally * when users connect through the Solana wallet adapter UI. * * @param options - Configuration options for the Solana client * @param options.dapp - Dapp identification and branding settings * @param options.api - Optional API configuration with supported networks * @param options.api.supportedNetworks - Record mapping network names (mainnet, devnet, testnet) to RPC URLs * @param [options.analytics] - Analytics configuration * @param [options.analytics.enabled] - Whether to enable dapp-side analytics (defaults to true) * @param [options.analytics.integrationType] - Integration type for analytics (defaults to 'direct') * @param options.debug - Enable debug logging * @param options.skipAutoRegister - Skip auto-registering the wallet during creation (defaults to false) * @returns A promise that resolves to the Solana client instance * * @example * ```typescript * import { createSolanaClient } from '@metamask/connect-solana'; * * // Wallet is auto-registered and ready to use * const client = await createSolanaClient({ * dapp: { * name: 'My Solana DApp', * url: 'https://mydapp.com', * }, * api: { * supportedNetworks: { * mainnet: 'https://api.mainnet-beta.solana.com', * devnet: 'https://api.devnet.solana.com', * }, * }, * }); * * // Get the wallet instance directly * const wallet = client.getWallet(); * ``` */ declare function createSolanaClient(options: SolanaConnectOptions): Promise; export { type SolanaClient, type SolanaConnectOptions, type SolanaNetwork, type SolanaSupportedNetworks, createSolanaClient, getInfuraRpcUrls };