From 661266c67bbe8c494223e9e91b7f8361c8623302 Mon Sep 17 00:00:00 2001
From: Awiteb
Date: Sun, 18 May 2025 08:58:13 +0000
Subject: [PATCH] chore(nostr): A function to add user read relays to a vector
Signed-off-by: Awiteb
---
src/nostr_utils/mod.rs | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/nostr_utils/mod.rs b/src/nostr_utils/mod.rs
index a9992c1..26d221d 100644
--- a/src/nostr_utils/mod.rs
+++ b/src/nostr_utils/mod.rs
@@ -165,4 +165,16 @@ impl NostrClient {
.await?
.map(|e| e.pubkey))
}
+
+ /// Adds read relays from the user to the given vector of relays.
+ pub async fn read_relays_from_user(
+ &self,
+ vector: Vec,
+ user: PublicKey,
+ ) -> Vec {
+ utils::add_read_relays(
+ vector,
+ self.user_relays_list(user).await.ok().flatten().as_ref(),
+ )
+ }
}