export declare class RPCError extends Error {
    private _message;
    private _code;
    constructor(message: string, code: number);
    get message(): string;
    get code(): number;
    toString(): string;
    toResponse(id?: string): {
        jsonrpc: string;
        id: string;
        error: {
            code: number;
            message: string;
        };
    };
}
export declare class RPCResult {
    private _result;
    constructor(result: any);
    get result(): any;
    toResponse(id?: string): {
        jsonrpc: string;
        id: string;
        result: any;
    };
}
export type RPCRequest = {
    jsonrpc: '2.0';
    id?: string;
    method: string;
    params: any | any[];
};
export type RPCResultResponse = {
    jsonrpc: '2.0';
    id?: string;
    result: any;
};
export type RPCErrorResponse = {
    jsonrpc: '2.0';
    id?: string;
    error: {
        code: number;
        message: string;
    };
};
type LogFn = (message?: any, ...optionalParams: any[]) => void;
export type RPCLogger = {
    info: LogFn;
    debug: LogFn;
    warn: LogFn;
    error: LogFn;
};
export type RPCSend = (data: RPCRequest | RPCResultResponse | RPCErrorResponse) => Promise<void> | void;
export type RPCOptions = {
    timeout?: number;
    logger?: RPCLogger;
    ready?: boolean;
};
declare class RPC {
    static Error: typeof RPCError;
    static isBuffer: Function;
    static bufferEncode: Function;
    static bufferDecode: Function;
    private _send;
    private _options;
    private _promises;
    private _callingHandlers;
    private _patterns;
    private _hashedFunctions;
    private _hashedRemoteFunctions;
    private _remoteObjects;
    private _remoteObjectClusters;
    private _proxiedRemoteObjects;
    constructor(send: RPCSend, options?: RPCOptions);
    stat(): {
        functions: {
            [hash: string]: Function;
        };
        objects: {};
    };
    setTimeout(timeout: number): void;
    private _decodeNonScalars;
    private _encodeNonScalars;
    private _makeRemoteObject;
    private _extendedRPCs;
    extends(rpc: RPC): void;
    private _getHandler;
    receive(request: any): void;
    private _sendResult;
    private _sendError;
    private _sendRequest;
    private _readyPromise;
    private _readyCallbacks;
    private _notReadyPromise;
    private _notReadyCallbacks;
    setReady(ready?: boolean): void;
    setOptions(options: Partial<RPCOptions>): void;
    whenReady(callback: () => void): void;
    whenNotReady(callback: () => void): void;
    notify(method: string, params?: any): void;
    call(method: string, params?: any, timeout?: number): Promise<unknown>;
    once(method: string, callback: Function): this;
    on(method: string | RegExp, callback: Function, once?: boolean): this;
    off(method: string | RegExp): this;
}
export { RPC };
export default RPC;
