2022-08-28 06:33:49 +00:00
|
|
|
/// <reference types="node" />
|
|
|
|
import { Buffer } from "buffer";
|
|
|
|
import RpcNetwork from "../network.js";
|
|
|
|
import { RpcQueryOptions } from "../types.js";
|
2022-08-29 02:18:04 +00:00
|
|
|
import type { RPCRequest, RPCResponse } from "@lumeweb/relay-types";
|
2022-08-28 06:33:49 +00:00
|
|
|
export default abstract class RpcQueryBase {
|
|
|
|
protected _network: RpcNetwork;
|
|
|
|
protected _query: RPCRequest;
|
|
|
|
protected _options: RpcQueryOptions;
|
|
|
|
protected _promise?: Promise<any>;
|
|
|
|
protected _timeoutTimer?: any;
|
|
|
|
protected _timeout: boolean;
|
|
|
|
protected _completed: boolean;
|
|
|
|
protected _responses: {
|
|
|
|
[relay: string]: RPCResponse;
|
|
|
|
};
|
|
|
|
protected _errors: {
|
|
|
|
[relay: string]: any;
|
|
|
|
};
|
|
|
|
protected _promiseResolve?: (data: any) => void;
|
|
|
|
constructor(
|
|
|
|
network: RpcNetwork,
|
|
|
|
query: RPCRequest,
|
|
|
|
options?: RpcQueryOptions
|
|
|
|
);
|
|
|
|
get result(): Promise<RPCResponse>;
|
|
|
|
private handeTimeout;
|
|
|
|
protected resolve(data?: RPCResponse, timeout?: boolean): void;
|
|
|
|
run(): this;
|
|
|
|
protected queryRelay(relay: string | Buffer): Promise<any>;
|
|
|
|
protected abstract checkResponses(): void;
|
|
|
|
protected abstract getRelays(): string[] | Buffer[];
|
|
|
|
}
|
|
|
|
//# sourceMappingURL=base.d.ts.map
|