diff --git a/crates/nostr/src/event/builder.rs b/crates/nostr/src/event/builder.rs index 4fc283890..b1e834e12 100644 --- a/crates/nostr/src/event/builder.rs +++ b/crates/nostr/src/event/builder.rs @@ -34,7 +34,7 @@ use crate::types::time::TimeSupplier; use crate::types::{ChannelId, Contact, Metadata, Timestamp}; #[cfg(feature = "std")] use crate::SECP256K1; -use crate::{JsonUtil, UncheckedUrl}; +use crate::{JsonUtil, RelayMetadata, UncheckedUrl}; /// [`EventBuilder`] error #[derive(Debug)] @@ -298,6 +298,17 @@ impl EventBuilder { Self::new(Kind::RecommendRelay, url.as_ref(), &[]) } + /// Relay list metadata (NIP65) + /// + /// + pub fn relay_list(list: Vec<(UncheckedUrl, Option)>) -> Self { + let tags: Vec = list + .into_iter() + .map(|(url, metadata)| Tag::RelayMetadata(url, metadata)) + .collect(); + Self::new(Kind::RelayList, "", &tags) + } + /// Text note /// ///