*Update dist

This commit is contained in:
Derrick Hammer 2022-09-22 09:36:04 -04:00
parent 47356ed6e0
commit 7399d4aa35
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
5 changed files with 24 additions and 3 deletions

3
dist/network.d.ts vendored
View File

@ -23,6 +23,9 @@ export default class RpcNetwork {
private _bypassCache; private _bypassCache;
get bypassCache(): boolean; get bypassCache(): boolean;
set bypassCache(value: boolean); set bypassCache(value: boolean);
private _maxRelays;
get maxRelays(): number;
set maxRelays(value: number);
addRelay(pubkey: string): void; addRelay(pubkey: string): void;
removeRelay(pubkey: string): boolean; removeRelay(pubkey: string): boolean;
clearRelays(): void; clearRelays(): void;

View File

@ -1 +1 @@
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":";AAAA,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAG/C,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAE/C,MAAM,CAAC,OAAO,OAAO,UAAU;gBACjB,GAAG,MAAY;IAI3B,OAAO,CAAC,IAAI,CAAa;IAEzB,IAAI,GAAG,QAEN;IAED,OAAO,CAAC,kBAAkB,CAAQ;IAElC,IAAI,iBAAiB,IAAI,MAAM,CAE9B;IAED,IAAI,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAElC;IAED,OAAO,CAAC,aAAa,CAAM;IAE3B,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED,IAAI,YAAY,CAAC,KAAK,EAAE,MAAM,EAE7B;IAED,OAAO,CAAC,aAAa,CAAK;IAE1B,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED,IAAI,YAAY,CAAC,KAAK,EAAE,MAAM,EAE7B;IAED,OAAO,CAAC,OAAO,CAAgB;IAE/B,IAAI,MAAM,IAAI,MAAM,EAAE,CAErB;IAED,OAAO,CAAC,MAAM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,GAC5B,iBAAiB;IASb,WAAW,CAChB,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,MAAM,GAAG,GAAG,EAAO,EACzB,WAAW,GAAE,OAAe,EAC5B,OAAO,GAAE,eAAoB,GAC5B,cAAc;CAalB"}

7
dist/network.js vendored
View File

@ -50,6 +50,13 @@ export default class RpcNetwork {
set bypassCache(value) { set bypassCache(value) {
this._bypassCache = value; this._bypassCache = value;
} }
_maxRelays = 0;
get maxRelays() {
return this._maxRelays;
}
set maxRelays(value) {
this._maxRelays = value;
}
addRelay(pubkey) { addRelay(pubkey) {
this._relays.push(pubkey); this._relays.push(pubkey);
this._relays = [...new Set(this._relays)]; this._relays = [...new Set(this._relays)];

View File

@ -1 +1 @@
{"version":3,"file":"wisdom.d.ts","sourceRoot":"","sources":["../../src/query/wisdom.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,WAAW,CAAC;AAcrC,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,YAAY;IACtD,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,MAAM,CAAK;IAEnB,SAAS,CAAC,cAAc,IAAI,IAAI;IA0DhC,OAAO,CAAC,KAAK;IAWb,SAAS,CAAC,SAAS,IAAI,MAAM,EAAE,GAAG,EAAE;CAGrC"} {"version":3,"file":"wisdom.d.ts","sourceRoot":"","sources":["../../src/query/wisdom.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,WAAW,CAAC;AAcrC,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,YAAY;IACtD,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,MAAM,CAAK;IAEnB,SAAS,CAAC,cAAc,IAAI,IAAI;IA0DhC,OAAO,CAAC,KAAK;IAWb,SAAS,CAAC,SAAS,IAAI,MAAM,EAAE,GAAG,EAAE;CAmBrC"}

11
dist/query/wisdom.js vendored
View File

@ -64,6 +64,17 @@ export default class WisdomRpcQuery extends RpcQueryBase {
this.run(); this.run();
} }
getRelays() { getRelays() {
if (this._network.maxRelays === 0 ||
this._network.relays.length <= this._network.maxRelays) {
return this._network.relays; return this._network.relays;
} }
const list = [];
let available = this._network.relays;
while (list.length < this._network.maxRelays) {
const item = Math.floor(Math.random() * available.length);
list.push(available[item]);
available.splice(item, 1);
}
return list;
}
} }