From 522d4d3a7c09ebaf0aac785f5dbc0d7e0ab812e4 Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Thu, 26 Sep 2024 10:41:28 +0530 Subject: [PATCH] fix: remove optional getRelays nostr provider method --- .../actions/nostr/getRelays.ts | 29 ------------------- .../background-script/actions/nostr/index.ts | 2 -- src/extension/background-script/router.ts | 1 - src/extension/content-script/nostr.js | 1 - src/extension/providers/nostr/index.ts | 5 ---- 5 files changed, 38 deletions(-) delete mode 100644 src/extension/background-script/actions/nostr/getRelays.ts diff --git a/src/extension/background-script/actions/nostr/getRelays.ts b/src/extension/background-script/actions/nostr/getRelays.ts deleted file mode 100644 index 99e15f6a4d..0000000000 --- a/src/extension/background-script/actions/nostr/getRelays.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { getHostFromSender } from "~/common/utils/helpers"; -import db from "~/extension/background-script/db"; -import { MessageDefaultPublic, Sender } from "~/types"; - -const getRelays = async (message: MessageDefaultPublic, sender: Sender) => { - const host = getHostFromSender(sender); - if (!host) return; - - const allowance = await db.allowances.get({ host }); - - if (!allowance?.id) { - return { error: "Could not find an allowance for this host" }; - } - - return { - data: { - "wss://relay.damus.io": { read: true, write: true }, - "wss://nostr1.tunnelsats.com": { read: true, write: true }, - "wss://nostr-pub.wellorder.net": { read: true, write: true }, - "wss://relay.nostr.info": { read: true, write: true }, - "wss://nostr-relay.wlvs.space": { read: true, write: true }, - "wss://nostr.bitcoiner.social": { read: true, write: true }, - "wss://nostr-01.bolt.observer": { read: true, write: true }, - "wss://relayer.fiatjaf.com": { read: true, write: true }, - }, - }; -}; - -export default getRelays; diff --git a/src/extension/background-script/actions/nostr/index.ts b/src/extension/background-script/actions/nostr/index.ts index c1db56ac37..6a4717316f 100644 --- a/src/extension/background-script/actions/nostr/index.ts +++ b/src/extension/background-script/actions/nostr/index.ts @@ -6,7 +6,6 @@ import encryptOrPrompt from "./encryptOrPrompt"; import generatePrivateKey from "./generatePrivateKey"; import getPrivateKey from "./getPrivateKey"; import getPublicKeyOrPrompt from "./getPublicKeyOrPrompt"; -import getRelays from "./getRelays"; import isEnabled from "./isEnabled"; import nip44DecryptOrPrompt from "./nip44DecryptOrPrompt"; import nip44EncryptOrPrompt from "./nip44EncryptOrPrompt"; @@ -23,7 +22,6 @@ export { getPrivateKey, getPublicKey, getPublicKeyOrPrompt, - getRelays, isEnabled, nip44DecryptOrPrompt, nip44EncryptOrPrompt, diff --git a/src/extension/background-script/router.ts b/src/extension/background-script/router.ts index 2378b6de4a..d331f1697f 100644 --- a/src/extension/background-script/router.ts +++ b/src/extension/background-script/router.ts @@ -125,7 +125,6 @@ const routes = { getPublicKeyOrPrompt: nostr.getPublicKeyOrPrompt, signEventOrPrompt: nostr.signEventOrPrompt, signSchnorrOrPrompt: nostr.signSchnorrOrPrompt, - getRelays: nostr.getRelays, encryptOrPrompt: nostr.encryptOrPrompt, decryptOrPrompt: nostr.decryptOrPrompt, nip44EncryptOrPrompt: nostr.nip44EncryptOrPrompt, diff --git a/src/extension/content-script/nostr.js b/src/extension/content-script/nostr.js index 74283138c4..a6ddf235da 100644 --- a/src/extension/content-script/nostr.js +++ b/src/extension/content-script/nostr.js @@ -9,7 +9,6 @@ const nostrCalls = [ "nostr/getPublicKeyOrPrompt", "nostr/signEventOrPrompt", "nostr/signSchnorrOrPrompt", - "nostr/getRelays", "nostr/enable", "nostr/encryptOrPrompt", "nostr/decryptOrPrompt", diff --git a/src/extension/providers/nostr/index.ts b/src/extension/providers/nostr/index.ts index 48c264404e..d06cff2b53 100644 --- a/src/extension/providers/nostr/index.ts +++ b/src/extension/providers/nostr/index.ts @@ -31,11 +31,6 @@ export default class NostrProvider extends ProviderBase { return this.execute("signSchnorrOrPrompt", { sigHash }); } - async getRelays() { - await this.enable(); - return this.execute("getRelays"); - } - //override method from base class, we don't want to throw error if not enabled async on(...args: Parameters) { await this.enable();