UNPKG

@uxuycom/web3-tg-sdk

Version:

web3 sdk for tg

54 lines (53 loc) 1.7 kB
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; TelegramWebview?: TelegramWebview; Telegram?: { WebApp?: { platform?: TmaPlatform; version?: string; openTelegramLink?: (url: string) => void; }; }; } } /** * 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 {};