UNPKG

@perawallet/connect

Version:

JavaScript SDK for integrating Pera Wallet to web applications.

28 lines (27 loc) 1.17 kB
/** * Unified Webview Bridge * Handles communication with both Android and iOS platforms using JSON-RPC 2.0 * Combines JSON-RPC utilities, error handling, platform detection, message listener, and bridge functions */ /// <reference path="../../../../../../src/util/webview-api/webviewBridgeTypes.d.ts" /> import { type Platform } from "./webviewApiTypes"; /** * Mobile method names that can be called via the bridge */ export type MobileMethodName = "getPublicSettings"; /** * Detect the current platform * Reserved for future use */ export declare function detectPlatform(): Platform; /** * Call a mobile method that expects a response * Sends a JSON-RPC 2.0 request and waits for response via postMessage * Returns a promise that resolves when the matching response is received */ export declare function callMobileMethodWithResponse<T>(methodName: MobileMethodName, timeoutMs?: number, params?: unknown): Promise<T>; /** * Check if the mobile interface is available * With the unified handleRequest interface, method availability is handled by the mobile app */ export declare function isMobileMethodAvailable(): boolean;