@reclaimprotocol/attestor-core
Version:
<div> <div> <img src="https://raw.githubusercontent.com/reclaimprotocol/.github/main/assets/banners/Attestor-Core.png" /> </div> </div>
21 lines (20 loc) • 1.17 kB
TypeScript
import { EventBus } from '../external-rpc/event-bus.ts';
import type { ExternalRPCAppClient, ExternalRPCIncomingMsg, ExternalRPCOutgoingMsg, ExternalRPCRequest, ExternalRPCResponse } from '../external-rpc/types.ts';
export declare const RPC_MSG_BRIDGE: EventBus<ExternalRPCIncomingMsg>;
export declare function getCurrentMemoryUsage(): Promise<{
available: boolean;
content: string;
}>;
export declare function generateRpcRequestId(): string;
/**
* The window RPC will be served from the same origin as the API server.
* so we can get the API server's origin from the location.
*/
export declare function getWsApiUrlFromBaseUrl(): string;
export declare function rpcRequest<T extends keyof ExternalRPCAppClient>(opts: ExternalRPCRequest<ExternalRPCAppClient, T>): Promise<ExternalRPCResponse<ExternalRPCAppClient, T>['response']>;
export declare function waitForResponse<T extends keyof ExternalRPCAppClient>(type: T, requestId: string, timeoutMs?: number): Promise<Awaited<ReturnType<ExternalRPCAppClient[T]>>>;
/**
* Sends a message back to the host app
* @param data
*/
export declare function sendMessageToApp(data: ExternalRPCOutgoingMsg): void;