UNPKG

@unielon/wallet-tg-sdk

Version:

unielon wallet sdk for telegram

55 lines (54 loc) 1.73 kB
import { DogecoinProvider } from '../unielon'; export declare function openLink(href: string, target?: string): void; /** * Opens a link in a new tab. * @param href */ export declare function openLinkBlank(href: string): void; export declare function getWindow(): Window | undefined; type TmaPlatform = "android" | "ios" | "macos" | "tdesktop" | "weba" | "web" | "unknown"; type TelegramWebviewProxy = { postEvent(eventType: string, eventData: string): void; }; type TelegramWebview = unknown; declare global { interface External { notify: (message: string) => void; } interface Window { TelegramWebviewProxy?: TelegramWebviewProxy | any; TelegramWebview?: TelegramWebview; unielon?: DogecoinProvider; Telegram?: { WebApp?: { platform?: TmaPlatform; version?: string; }; }; } } /** * Returns true if the app is running in TMA on the specified platform. * @param platforms */ export declare function isTmaPlatform(...platforms: TmaPlatform[]): boolean; /** * Returns true if the app is running in TMA. */ export declare function isInTMA(): boolean; /** * Returns true if the app is running in the Telegram browser. */ export declare function isInTelegramBrowser(): boolean; /** * Expand the app window. */ export declare function sendExpand(): void; /** * Opens link in TMA or in new tab and returns a function that closes the tab. * @param link The link to open. * @param fallback The function to call if the link can't be opened in TMA. */ export declare function sendOpenTelegramLink(link: string, fallback?: () => void): void; export declare function isAndroidMobile(): boolean; export {};