*Update and bug fix rpc classes

This commit is contained in:
Derrick Hammer 2022-08-31 17:32:52 -04:00
parent 389e3d1ac4
commit 7f6bd96b33
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 17 additions and 2 deletions

View File

@ -213,6 +213,7 @@ export abstract class RpcQueryBase {
} }
export class SimpleRpcQuery extends RpcQueryBase { export class SimpleRpcQuery extends RpcQueryBase {
private _relay: string | Buffer;
constructor( constructor(
network: RpcNetwork, network: RpcNetwork,
relay: string | Buffer, relay: string | Buffer,
@ -220,10 +221,23 @@ export class SimpleRpcQuery extends RpcQueryBase {
options: RpcQueryOptions options: RpcQueryOptions
) { ) {
super(network, query, options, "simpleQuery"); super(network, query, options, "simpleQuery");
this._relay = relay;
}
public run(): this {
this._promise = this._network.processQueue().then(() =>
callModule(RPC_MODULE, this._queryType, {
relay: this._relay,
query: this._query,
options: this._options,
network: this._network.networkId,
})
);
return this;
} }
} }
export class StreamingRpcQuery extends RpcQueryBase { export class StreamingRpcQuery extends SimpleRpcQuery {
protected _options: StreamingRpcQueryOptions; protected _options: StreamingRpcQueryOptions;
constructor( constructor(
@ -232,8 +246,9 @@ export class StreamingRpcQuery extends RpcQueryBase {
query: RPCRequest, query: RPCRequest,
options: StreamingRpcQueryOptions options: StreamingRpcQueryOptions
) { ) {
super(network, query, options, "streamingQuery"); super(network, relay, query, options);
this._options = options; this._options = options;
this._queryType = "streamingQuery";
} }
public run(): this { public run(): this {