UNPKG

@coinmeca/wallet-sdk

Version:
91 lines 3.99 kB
import { Chain } from "./types"; export declare const pattern: { chainId: RegExp; address: RegExp; hex: RegExp; }; export declare const encode: { string: (value: string) => Buffer; uint: (type: string, value: string | number | bigint) => Buffer; int: (type: string, value: string | number | bigint) => Buffer; address: (value: string) => Buffer; bytes: (type: string, value: Buffer) => Buffer; array: (type: string, value: Array<any>) => Buffer; }; export declare function encodeParameter(type: string, value: any): Buffer; export declare function flattenMessage(types: any, message: any, primaryType: string): any[]; export declare const toBytes: (value: string | number | bigint, pad?: number | { start?: number; end?: number; }) => Uint8Array; export declare const enable: (...checks: boolean[]) => boolean; export declare const valid: { chainId: (...chainId: (number | string | undefined)[]) => boolean; address: (...address: (string | undefined)[]) => boolean; bigint: (value: string | number | bigint, type?: string) => bigint | false; }; export declare const objectToUrlParams: (obj: { [x: string | number | symbol]: any; }) => string; export declare const getAppName: () => string; export declare const getFaviconUrl: () => string; export declare const getFaviconUri: () => Promise<string | null>; export declare const openWindow: (target: string, size?: number | { width?: number; height?: number; }) => any; export declare function parseChainId(chain: number | string | Chain): number; export declare function formatChainId(chain: number | string | Chain): string; export declare const isMobile: () => boolean; export declare const encrypt: (data?: string, salt?: string) => string | undefined; export declare const decrypt: (data?: string | null, salt?: string) => string | undefined; export declare const format: (value?: any) => string | undefined; export declare const parse: (value?: string | null) => any; export interface StorageController { get: (key: string) => any; gets: (keys: string[]) => Record<string, any>; getAll: () => Record<string, any>; set: (key: string, value: any) => void; sets: (map: string[][]) => void; remove: (key: string) => void; removes: (keys: string[]) => void; clear: () => void; } export declare const loadStorage: (prefix: string, storage?: CloudStorage | Storage, isTelegram?: boolean, salt?: string) => StorageController; export interface TelegramController { telegram: Telegram["WebApp"] | undefined; user: Telegram["WebApp"]["initDataUnsafe"]["user"] | undefined; isInApp?: boolean; isExpanded?: boolean; isVerticalSwipe?: boolean; isCloseConfirm?: boolean; storage?: CloudStorage; send: (text: string) => void | undefined; enable: { vertical: () => void | undefined; closeConfirm: () => void | undefined; }; disable: { vertical: () => void | undefined; closeConfirm: () => void | undefined; }; bio: { request: (reason?: string) => BiometricManager | undefined; auth: (reason?: string) => BiometricManager | undefined; }; show: { alert: (message: string, callback?: () => void) => void | undefined; confirm: (title: string, callback?: (ok: boolean) => void) => void | undefined; popup: (popup: PopupParams, callback?: ((button_id: string) => void) | undefined) => void | undefined; scanQR: (text: string, callback?: (data: string) => void) => void | undefined; }; open: { internal: (url: string, callback?: Function) => void; external: (url: string, try_instant_view?: boolean, callback?: Function) => void; }; expand: (callback?: Function) => void; exit: (callback?: Function) => void; } export declare const loadTelegram: (telegram?: Telegram["WebApp"]) => TelegramController; export declare const favicon: () => string; //# sourceMappingURL=utils.d.ts.map