kernel-rpc-client/dist/index.d.ts

90 lines
2.2 KiB
TypeScript
Raw Normal View History

2022-08-31 01:39:52 +00:00
/// <reference types="node" />
2022-07-20 07:36:21 +00:00
import { ErrTuple } from "libskynet";
2022-08-31 02:18:07 +00:00
import type { RPCRequest, RPCResponse } from "@lumeweb/relay-types";
2022-08-31 01:49:59 +00:00
import {
RpcQueryOptions,
StreamHandlerFunction,
StreamingRpcQueryOptions,
} from "@lumeweb/dht-rpc-client";
2022-08-31 01:39:52 +00:00
import { Buffer } from "buffer";
2022-07-20 07:36:21 +00:00
export declare class RpcNetwork {
2022-08-31 01:49:59 +00:00
private _actionQueue;
private _addQueue;
private _removeQueue;
2022-08-31 18:42:49 +00:00
private _def;
constructor(def?: boolean);
private _networkId;
get networkId(): number;
2022-08-31 01:49:59 +00:00
get ready(): Promise<ErrTuple>;
2022-08-31 18:42:49 +00:00
private static deleteItem;
2022-08-31 01:49:59 +00:00
addRelay(pubkey: string): void;
removeRelay(pubkey: string): void;
clearRelays(): void;
wisdomQuery(
method: string,
module: string,
data?: object | any[],
bypassCache?: boolean,
options?: RpcQueryOptions
): WisdomRpcQuery;
streamingQuery(
relay: Buffer | string,
method: string,
module: string,
streamHandler: StreamHandlerFunction,
data?: object | any[],
options?: RpcQueryOptions
): StreamingRpcQuery;
simpleQuery(
relay: Buffer | string,
method: string,
module: string,
data?: object | any[],
options?: RpcQueryOptions
): SimpleRpcQuery;
processQueue(): Promise<void>;
2022-07-20 07:36:21 +00:00
}
2022-08-31 01:39:52 +00:00
export declare abstract class RpcQueryBase {
2022-08-31 01:49:59 +00:00
protected _promise?: Promise<any>;
protected _network: RpcNetwork;
protected _query: RPCRequest;
protected _options: RpcQueryOptions;
protected _queryType: string;
constructor(
network: RpcNetwork,
query: RPCRequest,
options: RpcQueryOptions | undefined,
queryType: string
);
2022-08-31 02:18:07 +00:00
get result(): Promise<RPCResponse>;
2022-08-31 18:42:49 +00:00
run(): this;
2022-07-20 07:36:21 +00:00
}
2022-08-31 01:39:52 +00:00
export declare class SimpleRpcQuery extends RpcQueryBase {
2022-08-31 21:33:29 +00:00
private _relay;
2022-08-31 01:49:59 +00:00
constructor(
network: RpcNetwork,
relay: string | Buffer,
query: RPCRequest,
options: RpcQueryOptions
);
2022-08-31 21:33:29 +00:00
run(): this;
2022-08-31 01:39:52 +00:00
}
2022-08-31 21:33:29 +00:00
export declare class StreamingRpcQuery extends SimpleRpcQuery {
2022-08-31 01:49:59 +00:00
protected _options: StreamingRpcQueryOptions;
constructor(
network: RpcNetwork,
relay: string | Buffer,
query: RPCRequest,
options: StreamingRpcQueryOptions
);
run(): this;
2022-08-31 01:39:52 +00:00
}
export declare class WisdomRpcQuery extends RpcQueryBase {
2022-08-31 01:49:59 +00:00
constructor(
network: RpcNetwork,
query: RPCRequest,
options?: RpcQueryOptions
);
2022-08-31 01:39:52 +00:00
}
2022-08-31 01:49:59 +00:00
//# sourceMappingURL=index.d.ts.map