import * as jsonrpc from 'jsonrpc-lite'; export declare type RequestObject = jsonrpc.RequestObject | jsonrpc.NotificationObject; export declare type SuccessObject = Omit & { result: T; }; export declare type ErrorObject = Omit & { error: T; }; export declare type NotificationObject = Omit & { params: T; }; export declare type NotificationCallback = (notification: NotificationObject) => void; declare type VersionParam = { version?: string; }; declare type RequestParams = VersionParam & jsonrpc.RpcParams; export declare class JSONRpc { private emitter; private methodMap; toStream: (payload: RequestObject) => void; constructor(); /** * handle stringified message. * parse -> emit */ handleMessage(stringified: string): void; /** * Send json rpc message by using `toStream` function, * and receive result */ call(method: string, params: RequestParams): Promise | ErrorObject>; on(method: string, callback: NotificationCallback): void; off(method: string, callback: NotificationCallback): void; } export {};