chore: A method to send an event builder

Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
Awiteb
2025-05-05 19:51:45 +00:00
parent 4dea4785b4
commit 273058fe3f

View File

@@ -22,13 +22,13 @@ pub mod utils;
use std::time::Duration;
use nostr::{
event::Kind,
event::{EventBuilder, EventId, Kind},
filter::Filter,
key::Keys,
nips::{nip19::Nip19Coordinate, nip34::GitRepositoryAnnouncement},
types::RelayUrl,
};
use nostr_sdk::Client;
use nostr_sdk::{Client, pool::Output};
use crate::{
cli::CliOptions,
@@ -83,6 +83,22 @@ impl NostrClient {
}
}
/// Sends an event builder to the specified relays.
pub async fn send_builder_to(
&self,
builder: EventBuilder,
relays: &[RelayUrl],
) -> N34Result<Output<EventId>> {
for relay in relays {
let _ = self.client.add_write_relay(relay).await;
}
self.client
.send_event_builder_to(relays, builder)
.await
.map_err(N34Error::from)
}
/// Try to fetch a repository and returns it
pub async fn fetch_repo(
&self,