*Make relay optional.

*Have RpcNetwork.simpleQuery take an options bag
This commit is contained in:
Derrick Hammer 2023-03-24 13:20:37 -04:00
parent 1d61ec5e55
commit 0a6d56572b
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 13 additions and 8 deletions

View File

@ -37,12 +37,17 @@ export class RpcNetwork extends Client {
network: this._networkId,
});
}
public simpleQuery(
relay: Buffer | string,
query: ClientRPCRequest,
data: object | any[] = {},
options: RpcQueryOptions = {}
): SimpleRpcQuery {
public simpleQuery({
relay,
query,
data = {},
options = {},
}: {
relay?: Buffer | string;
query: ClientRPCRequest;
data: object | any[];
options: RpcQueryOptions;
}): SimpleRpcQuery {
return new SimpleRpcQuery({
network: this,
relay,
@ -94,7 +99,7 @@ export abstract class RpcQueryBase extends Client {
}
export class SimpleRpcQuery extends RpcQueryBase {
protected _relay: string | Buffer;
protected _relay?: string | Buffer;
constructor({
network,
relay,
@ -102,7 +107,7 @@ export class SimpleRpcQuery extends RpcQueryBase {
options,
}: {
network: RpcNetwork;
relay: string | Buffer;
relay?: string | Buffer;
query: RPCRequest;
options: RpcQueryOptions;
}) {