From 0a6d56572bef9712944188014ffe4fc233f5a9a5 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 24 Mar 2023 13:20:37 -0400 Subject: [PATCH] *Make relay optional. *Have RpcNetwork.simpleQuery take an options bag --- src/index.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/index.ts b/src/index.ts index f927285..bc7e145 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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; }) {