Compare commits

...

2 Commits

Author SHA1 Message Date
Derrick Hammer ebaa1cac25
*Update dist 2023-03-24 13:20:57 -04:00
Derrick Hammer 0a6d56572b
*Make relay optional.
*Have RpcNetwork.simpleQuery take an options bag
2023-03-24 13:20:37 -04:00
4 changed files with 28 additions and 18 deletions

21
dist/index.d.ts vendored
View File

@ -14,12 +14,17 @@ export declare class RpcNetwork extends Client {
private _networkId; private _networkId;
get networkId(): number; get networkId(): number;
get ready(): Promise<ErrTuple>; get ready(): Promise<ErrTuple>;
simpleQuery( simpleQuery({
relay: Buffer | string, relay,
query: ClientRPCRequest, query,
data?: object | any[], data,
options?: RpcQueryOptions options,
): SimpleRpcQuery; }: {
relay?: Buffer | string;
query: ClientRPCRequest;
data: object | any[];
options: RpcQueryOptions;
}): SimpleRpcQuery;
} }
export declare abstract class RpcQueryBase extends Client { export declare abstract class RpcQueryBase extends Client {
protected _promise?: Promise<any>; protected _promise?: Promise<any>;
@ -37,7 +42,7 @@ export declare abstract class RpcQueryBase extends Client {
run(): this; run(): this;
} }
export declare class SimpleRpcQuery extends RpcQueryBase { export declare class SimpleRpcQuery extends RpcQueryBase {
protected _relay: string | Buffer; protected _relay?: string | Buffer;
constructor({ constructor({
network, network,
relay, relay,
@ -45,7 +50,7 @@ export declare class SimpleRpcQuery extends RpcQueryBase {
options, options,
}: { }: {
network: RpcNetwork; network: RpcNetwork;
relay: string | Buffer; relay?: string | Buffer;
query: RPCRequest; query: RPCRequest;
options: RpcQueryOptions; options: RpcQueryOptions;
}); });

2
dist/index.d.ts.map vendored
View File

@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EA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,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC,CAQjC;IAEM,GAAG,IAAI,IAAI;CASnB;AAED,qBAAa,cAAe,SAAQ,YAAY;IAC9C,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;gBACvB,EACV,OAAO,EACP,KAAK,EACL,KAAK,EACL,OAAO,GACR,EAAE;QACD,OAAO,EAAE,UAAU,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACxB,KAAK,EAAE,UAAU,CAAC;QAClB,OAAO,EAAE,eAAe,CAAC;KAC1B;IAIM,GAAG,IAAI,IAAI;CAUnB;AAED,eAAO,MAAM,YAAY,8BAA8C,CAAC"}

2
dist/index.js vendored
View File

@ -23,7 +23,7 @@ export class RpcNetwork extends Client {
network: this._networkId, network: this._networkId,
}); });
} }
simpleQuery(relay, query, data = {}, options = {}) { simpleQuery({ relay, query, data = {}, options = {}, }) {
return new SimpleRpcQuery({ return new SimpleRpcQuery({
network: this, network: this,
relay, relay,

View File

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