UNPKG

@broxus/tvm-connect

Version:

TypeScript SDK for connecting to Nekoton-compatible wallets using a unified interface.

46 lines (45 loc) 1.99 kB
import { type TvmNetworkConfig, AbstractStore } from '@broxus/js-core'; import Events from 'events'; import { type NekotonConnector } from '../core'; import { type TvmConnectService } from '../services'; import { type PopupType, type TvmWalletProviderConfig } from '../types'; export interface TvmConnectDialogStoreCtorParams { popupType?: PopupType; qrEnabled?: boolean; recentMetaStorageKey?: string; } export interface TvmConnectDialogStoreData { connectingProvider?: TvmWalletProviderConfig | null; network?: TvmNetworkConfig; } export interface TvmConnectDialogStoreState { error?: Error | null; isActive?: boolean; popupType?: PopupType; qrEnabled?: boolean; requestState?: 'connecting' | 'installation' | 'mobile'; } export interface DialogConnectOptions { network?: TvmNetworkConfig; popupType?: PopupType; qrEnabled?: boolean; onClose?: VoidFunction; onConnect?: (connector: NekotonConnector) => Promise<void> | void; } export declare class TvmConnectDialogStore extends AbstractStore<TvmConnectDialogStoreData, TvmConnectDialogStoreState> { protected readonly _service: TvmConnectService; protected readonly params?: Readonly<TvmConnectDialogStoreCtorParams> | undefined; protected _events: Events; constructor(_service: TvmConnectService, params?: Readonly<TvmConnectDialogStoreCtorParams> | undefined); connect(options?: DialogConnectOptions): void; connectTo(providerConfig: TvmWalletProviderConfig, options?: DialogConnectOptions): Promise<void>; open(): void; close(): void; reset(): void; get connectingProvider(): TvmConnectDialogStoreData['connectingProvider']; get error(): TvmConnectDialogStoreState['error']; get isActive(): TvmConnectDialogStoreState['isActive']; get popupType(): TvmConnectDialogStoreState['popupType']; get qrEnabled(): TvmConnectDialogStoreState['qrEnabled']; get requestState(): TvmConnectDialogStoreState['requestState']; }