From 5e3de30f51ba870dacc046f21836faf56835d996 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Mon, 27 Jun 2022 16:25:53 -0400 Subject: [PATCH] *Add method to remove a relay and clear relays --- src/rpcNetwork.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/rpcNetwork.ts b/src/rpcNetwork.ts index fb281a2..597c81a 100644 --- a/src/rpcNetwork.ts +++ b/src/rpcNetwork.ts @@ -69,6 +69,21 @@ export default class RpcNetwork { this._relays = [...new Set(this._relays)]; } + public removeRelay(pubkey: string): boolean { + if (!this._relays.includes(pubkey)) { + return false; + } + + delete this._relays[this._relays.indexOf(pubkey)]; + this._relays = Object.values(this._relays); + + return true; + } + + public clearRelays(): void { + this._relays = []; + } + public query( query: string, chain: string,