import type { Network, ExtensionInjectedProvider, IntegratedBrowserInjectedProvider, Connector, ConnectorResult, SwitchNetworkResult, Namespace, DetectedEIP6963WalletInfo, DetectedSolanaWalletInfo, DetectedTronWalletInfo, DetectedTonWalletInfo, TransactionRequest, TransactionResult, NetworkRpcMap, EVMCapabilities, SignatureType, EIP712TypedData, WalletMetadata, TonConnectConfig, WalletLifecycleEvent, WalletLifecycleContext } from '@meshconnect/uwc-types'; import { type TronConnectorConfig } from '@meshconnect/uwc-tron-connector'; import type { SecondarySolanaConnectSkippedInfo, SecondarySolanaConnectGatheredInfo } from './services/connection-manager'; import type { LegacyInjectedSolanaDiscoveryFailure } from './wallet-standard-discovery'; /** * Constructor options for {@link InjectedConnector}. A single typed bag instead * of positional args: the two optional trailing callbacks (`onBridgeError`, * `onLegacyDiscoveryFailure`) occupy the same positional slot shape, so * positional passing risked wiring one where the other was expected — named * fields remove the ambiguity (the same reason the WalletConnect connector * moved to an options object). */ export interface InjectedConnectorOptions { networkRpcMap?: NetworkRpcMap | undefined; expectedWallets?: WalletMetadata[] | undefined; tonConnectConfig?: TonConnectConfig | undefined; tronConnectorConfig?: TronConnectorConfig | undefined; networks?: Network[] | undefined; /** Optional sink for BridgeChild discovery failures (wired to UWC's observer). */ onBridgeError?: ((info: { namespace: string; message: string; }) => void) | undefined; /** * Whether this session runs inside a wallet's in-app browser. Selects which * injected provider's Solana name the legacy fallback surfaces. */ usingIntegratedBrowser?: boolean | undefined; /** * Telemetry sink invoked when a configured legacy injected-Solana global is * present but the wrong shape (see wallet-standard-discovery). */ onLegacyDiscoveryFailure?: LegacyInjectedSolanaDiscoveryFailure | undefined; /** * Triage telemetry sink (ONC-3536 follow-up): the secondary Solana gather * was skipped for a legacy-`injectedId` wallet inside the wallet's own * browser (framed or top-level in-app) so an EVM send can't be parked on * the Solana namespace (see `ConnectionManager`). */ onSecondarySolanaConnectSkipped?: ((info: SecondarySolanaConnectSkippedInfo) => void) | undefined; /** * Positive telemetry sink (ONC-231): a legacy-`injectedId` wallet's secondary * Solana address WAS gathered (see `ConnectionManager`). Verifies the framed * gather works; filter `framed:true` in prod to confirm the fix. */ onSecondarySolanaConnectGathered?: ((info: SecondarySolanaConnectGatheredInfo) => void) | undefined; /** * Telemetry sink: the wallet-switch guard released live per-namespace state * that belonged to a different wallet (see `ConnectionManager`). Carries * only the released namespaces — never an address. */ onWalletConnectionsReleased?: ((info: { namespaces: Namespace[]; }) => void) | undefined; } export declare class InjectedConnector implements Connector { private readonly storageService; private ethereumService; private solanaService; private tronService; private tonService; private connectionManager; private signatureService; private transactionService; private networkRpcMap; private tonConnectManifestUrl; /** * Mesh-owned Tron connector. When set (via `tronConnectorConfig`), the Tron * namespace is routed through `@meshconnect/uwc-tron-connector` instead of the * legacy `window.tronWeb` path; the `tronService` is not consulted for Tron. */ private tronConnector; /** * Configured networks, used to resolve the Tron network for cross-namespace * Tron auto-connect (see `enrichWithTron`). */ private networks; /** * Selects which injected provider's Solana name the legacy fallback surfaces, * so it matches what core's `connectSolana` compares against. */ private usingIntegratedBrowser; private onLegacyDiscoveryFailure?; /** injectedIds already reported this session — dedupes the emit across the * repeated Solana detection cycles (mirrors the bridgeError source dedup). */ private readonly reportedLegacyFailures; /** Forward a legacy Solana discovery failure to the sink, once per injectedId. */ private reportLegacyDiscoveryFailure; constructor(options?: InjectedConnectorOptions); /** * Get available wallets for a specific namespace */ getAvailableWallets(namespace: Namespace, expectedWallets?: WalletMetadata[]): Promise; /** * Connect to a wallet */ connect(network: Network, provider: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider): Promise; /** Establish a fresh connection for the target namespace. */ private connectToNamespace; /** * Cross-namespace Tron gather: when the Tron connector is configured and the * wallet exposes a detected Tron provider, connect Tron and merge its address * into `availableAddresses` — the Tron equivalent of the ETH/Solana/TON * gathers in `ConnectionManager`. Best-effort: a missing Tron network, an * undetected wallet, or a declined prompt leaves the rest of the connection * intact (same as the other gathers, which swallow their failures). */ private enrichWithTron; /** * Switch to a different network */ switchNetwork(network: Network, provider: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider): Promise; /** * Disconnect from all wallets (only clears local state) */ disconnect(): Promise; /** * Observe post-connect lifecycle from the live provider of the namespace the * CALLER names in `context`. Routing must follow the session being attached * for, not a fixed service preference or ambient connector state: the * secondary-namespace gather (`checkAndAdd*Addresses`) can leave MORE than * one service holding a live surface — e.g. a Solana-primary Phantom session * with an authorized EVM side also sets the Ethereum service's provider — and * attaching the wrong one would label that provider's events with this * session's routing (an EVM chain switch reported against a Solana session) * and miss the active namespace's own signals. * * EVM (EIP-1193) and Solana (wallet-standard) have a live event surface today; * TRON / TON injected are follow-ons behind the same contract (until then they * return undefined → the core emits `lifecycleTelemetryUnavailable`). */ onLifecycleEvent(listener: (event: WalletLifecycleEvent) => void, context: WalletLifecycleContext): (() => void) | undefined; /** * Sign a message with the connected wallet */ signMessage(message: string, provider: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider): Promise; /** * Sign EIP-712 typed structured data (eth_signTypedData_v4). * EVM-only (eip155); used by ERC-3009 and EIP-2612 relay flows. The injected * connector owns its own provider reference (resolved from ethereumService), * so the optional `_provider` argument from the Connector interface is unused. */ signTypedData(typedData: EIP712TypedData, _provider?: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider): Promise; /** * Send a transaction with the connected wallet */ sendTransaction(request: TransactionRequest, provider: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider): Promise; /** * Get EVM wallet capabilities (EIP-5792). * Only valid for eip155 connections — non-EVM wallets don't support * wallet_getCapabilities and the hex address format it requires. */ getWalletCapabilities(from: string, networks: Network[]): Promise>; /** * Sign serialized Solana tx bytes without broadcasting (raw bytes in/out, no * @solana/web3.js for callers). Tries: bridge (iframe) → Wallet Standard * feature → legacy adapter. The feature path avoids Transaction.serialize(), * which crashes some mobile WebViews. Errors go through parseError (typed * "rejected" on user cancel). */ signSolanaTransactionBytes(serializedTx: Uint8Array): Promise; } //# sourceMappingURL=injected-connector.d.ts.map