import type { NetworkId, Namespace } from './networks' import type { Session } from './session' export interface UniversalWalletConnectorState { session: Session } export interface DetectedEIP6963WalletInfo { uuid: string name: string icon: string rdns: string } export interface DetectedSolanaWalletInfo { uuid: string name: string features: string[] /** * True when this wallet was discovered via the legacy injected-Solana fallback * (a `window[injectedId]` global, e.g. Coinbase/Base Wallet's `coinbaseSolana`) * rather than the Wallet Standard registry (MFS-805). Absent/false for registry * wallets. Telemetry-only signal so a dashboard can confirm the legacy path was * exercised — never a wallet id or address. */ legacyInjected?: boolean } export interface DetectedTronWalletInfo { uuid: string name: string /** * The `namespaceMetaData.tron.injectedId` used to detect this wallet — the * value from the consumer's metadata, reported verbatim (the dotted window * path, e.g. `tronLink`). Lets discovery match results back to catalog * wallets whose `id` is not a stable wallet key (e.g. a backend GUID). */ injectedId?: string } export interface DetectedTonWalletInfo { uuid: string name: string icon: string jsBridgeKey: string } export interface Eip155Metadata { eip155Name: string injectedId: string supportsAddingNetworks: boolean requiresUserApprovalOnNetworkSwitch: boolean installed?: boolean detectedWallet?: DetectedEIP6963WalletInfo } export interface SolanaMetadata { walletStandardName?: string injectedId?: string ignoredInjectedIds?: string[] installed?: boolean detectedWallet?: DetectedSolanaWalletInfo } export interface TronMetadata { injectedId: string installed?: boolean detectedWallet?: DetectedTronWalletInfo } export interface TonMetadata { /** JS Bridge key for injected wallets (e.g. 'tonkeeper'). Optional for HTTP-bridge-only wallets. */ jsBridgeKey?: string installed?: boolean detectedWallet?: DetectedTonWalletInfo } /** Keys are CAIP-2 namespace identifiers. Types use brand names (e.g. tvm → TonMetadata). */ interface NamespaceMetaDataRegistry { eip155: Eip155Metadata solana: SolanaMetadata tron: TronMetadata tvm: TonMetadata } type NamespaceMetaDataMap = { [K in Namespace]?: K extends keyof NamespaceMetaDataRegistry ? NamespaceMetaDataRegistry[K] : undefined } export interface ExtensionInjectedProvider { supportedNetworkIds: NetworkId[] namespaceMetaData: Partial requiresUserApprovalOnNamespaceSwitch?: boolean } export interface IntegratedBrowserInjectedProvider extends ExtensionInjectedProvider { integratedBrowserDeeplink: string } export type DeeplinkType = 'universal' | 'native' export interface WalletConnectProvider { supportedNetworkIds: NetworkId[] deeplinks: { universal: string native: string preferredDeeplink?: DeeplinkType /** @deprecated Use preferredDeeplink instead */ androidPreferredDeeplink?: DeeplinkType /** @deprecated Use preferredDeeplink instead */ iOSPreferredDeeplink?: DeeplinkType } } /** Per-wallet config for TON Connect mobile flow (QR/universal link). */ export interface TonConnectWalletProvider { supportedNetworkIds: NetworkId[] /** * app_name used to look up this wallet in the TonConnect wallets-v2.json list * (the SDK resolves bridgeUrl + universalLink from it). Defaults to jsBridgeKey, * which is correct for most wallets; set it only when the list's app_name * differs — e.g. OKX (jsBridgeKey 'okxTonWallet', wallet-list entry 'okxWallet'). */ walletListAppName?: string } /** Global TON Connect configuration — passed once to ConnectionProvider. */ export interface TonConnectConfig { manifestUrl: string | (() => string) walletsListSource?: string /** * Fired once, synchronously, when a session is resumed from storage instead of * a fresh handshake (just before connect() resolves its ConnectorResult). * Intended for a single telemetry tag (e.g. restored: true). Optional — * omitting it keeps restoration working, only the signal is dropped. */ onSessionRestored?: () => void } // eslint-disable-next-line @typescript-eslint/no-explicit-any export interface WalletMetadata> { id: string name: string metadata: T extensionInjectedProvider?: ExtensionInjectedProvider integratedBrowserInjectedProvider?: IntegratedBrowserInjectedProvider walletConnectProvider?: WalletConnectProvider tonConnectProvider?: TonConnectWalletProvider }