UNPKG

@turnkey/core

Version:

A core JavaScript web and React Native package for interfacing with Turnkey's infrastructure.

51 lines 2.55 kB
import { CrossPlatformWalletStamper } from "../stamper"; import { CrossPlatformWalletConnector } from "../connector"; import { TWalletManagerConfig, WalletInterface, WalletProvider, WalletInterfaceType, Chain } from "@types"; export declare class MobileWalletManager { private initializers; private wcClient?; readonly wallets: Partial<Record<WalletInterfaceType, WalletInterface>>; private chainToInterfaces; readonly stamper?: CrossPlatformWalletStamper; readonly connector?: CrossPlatformWalletConnector; /** * Constructs a MobileWalletManager that only uses WalletConnect. * * - Determines enabled chains based on provided namespaces for Ethereum and Solana. * - Initializes WalletConnect wallet interface and maps it to supported chains. * - Optionally enables stamping and connecting flows based on feature flags that live in the cfg. * - Sets up `CrossPlatformWalletStamper` and `CrossPlatformWalletConnector` if auth or connecting features are enabled. * * @param cfg - Wallet manager configuration (we only use WalletConnect fields). */ constructor(cfg: TWalletManagerConfig); /** * Initializes WalletConnect components and any registered wallet interfaces. * * - First initializes the low-level WalletConnect client with the provided config. * - Then initializes higher-level wallet interface `WalletConnectWallet` using registered async initializers. * * @param cfg - Wallet manager configuration used for initializing the WalletConnect client. */ init(cfg: TWalletManagerConfig): Promise<void>; /** * Retrieves available wallet providers, optionally filtered by chain. * * - If a chain is specified, filters wallet interfaces that support that chain. * - Aggregates providers across all registered wallet interfaces. * - Filters WalletConnect results to match the specified chain. * * @param chain - Optional chain to filter providers by. * @returns A promise that resolves to an array of `WalletProvider` objects. * @throws {Error} If no wallet interface is registered for the given chain. */ getProviders(chain?: Chain): Promise<WalletProvider[]>; /** * Registers a wallet interface type as supporting a specific blockchain chain. * * @param chain - Chain (e.g., Ethereum, Solana). * @param interfaceType - Wallet interface type to associate with the chain. */ private addChainInterface; } //# sourceMappingURL=manager.d.ts.map