diff --git a/crates/nostr-sdk/examples/comment.rs b/crates/nostr-sdk/examples/comment.rs new file mode 100644 index 000000000..18aec0c7d --- /dev/null +++ b/crates/nostr-sdk/examples/comment.rs @@ -0,0 +1,32 @@ +// Copyright (c) 2022-2023 Yuki Kishimoto +// Copyright (c) 2023-2024 Rust Nostr Developers +// Distributed under the MIT software license + +use nostr_sdk::prelude::*; + +#[tokio::main] +async fn main() -> Result<()> { + tracing_subscriber::fmt::init(); + + let keys = Keys::generate(); + let client = Client::builder().signer(keys).build(); + + client.add_relay("wss://relay.damus.io/").await?; + client.add_relay("wss://relay.primal.net/").await?; + + client.connect().await; + + let event_id = + EventId::from_bech32("note1hrrgx2309my3wgeecx2tt6fl2nl8hcwl0myr3xvkcqpnq24pxg2q06armr")?; + let events = client + .fetch_events(vec![Filter::new().id(event_id)], None) + .await?; + + let reply_to = events.first().unwrap(); + let builder = EventBuilder::comment("This is a reply", reply_to, None, None); + + let output = client.send_event_builder(builder).await?; + println!("Output: {:?}", output); + + Ok(()) +} diff --git a/crates/nostr/src/event/builder.rs b/crates/nostr/src/event/builder.rs index 3925f6de9..fdbbbc251 100644 --- a/crates/nostr/src/event/builder.rs +++ b/crates/nostr/src/event/builder.rs @@ -521,7 +521,7 @@ impl EventBuilder { tags.push(Tag::from_standardized_without_cell(TagStandard::Event { event_id: root.id, relay_url: relay_url.clone(), - marker: Some(Marker::Root), + marker: None, public_key: Some(root.pubkey), uppercase: true, })); @@ -550,7 +550,7 @@ impl EventBuilder { tags.push(Tag::from_standardized_without_cell(TagStandard::Event { event_id: reply_to.id, relay_url, - marker: Some(Marker::Reply), + marker: None, public_key: Some(reply_to.pubkey), uppercase: false, }));