Skip to content

Commit

Permalink
Rename EventBuilder arg
Browse files Browse the repository at this point in the history
  • Loading branch information
ok300 committed Sep 9, 2023
1 parent 01adb3f commit e8a1572
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions bindings/nostr-ffi/src/event/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ impl EventBuilder {
sender_keys: Arc<Keys>,
receiver_pubkey: Arc<PublicKey>,
content: String,
reply: Option<Arc<EventId>>,
reply_to: Option<Arc<EventId>>,
) -> Result<Self> {
Ok(Self {
builder: EventBuilderSdk::new_encrypted_direct_msg(
sender_keys.deref(),
*receiver_pubkey.as_ref().deref(),
content,
reply.map(|id| id.as_ref().into()),
reply_to.map(|id| id.as_ref().into()),
)?,
})
}
Expand Down
4 changes: 2 additions & 2 deletions bindings/nostr-js/src/event/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ impl JsEventBuilder {
sender_keys: &JsKeys,
receiver_pubkey: &JsPublicKey,
content: String,
reply: Option<JsEventId>,
reply_to: Option<JsEventId>,
) -> Result<JsEventBuilder> {
Ok(Self {
builder: EventBuilder::new_encrypted_direct_msg(
sender_keys.deref(),
receiver_pubkey.into(),
content,
reply.map(|id| id.into()),
reply_to.map(|id| id.into()),
)
.map_err(into_err)?,
})
Expand Down
6 changes: 3 additions & 3 deletions crates/nostr-sdk/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ impl Client {
&self,
receiver: XOnlyPublicKey,
msg: S,
reply: Option<EventId>,
reply_to: Option<EventId>,
) -> Result<EventId, Error>
where
S: Into<String>,
Expand All @@ -1010,11 +1010,11 @@ impl Client {
return Err(Error::ResponseNotMatchRequest);
}
} else {
EventBuilder::new_encrypted_direct_msg(&self.keys, receiver, msg, reply)?
EventBuilder::new_encrypted_direct_msg(&self.keys, receiver, msg, reply_to)?
};

#[cfg(not(feature = "nip46"))]
let builder = EventBuilder::new_encrypted_direct_msg(&self.keys, receiver, msg, reply)?;
let builder = EventBuilder::new_encrypted_direct_msg(&self.keys, receiver, msg, reply_to)?;

self.send_event_builder(builder).await
}
Expand Down
6 changes: 3 additions & 3 deletions crates/nostr/src/event/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,14 @@ impl EventBuilder {
sender_keys: &Keys,
receiver_pubkey: XOnlyPublicKey,
content: S,
reply: Option<EventId>,
reply_to: Option<EventId>,
) -> Result<Self, Error>
where
S: Into<String>,
{
let mut tags: Vec<Tag> = vec![Tag::PubKey(receiver_pubkey, None)];
if let Some(reply) = reply {
tags.push(Tag::Event(reply, None, None));
if let Some(reply_to) = reply_to {
tags.push(Tag::Event(reply_to, None, None));
}
Ok(Self::new(
Kind::EncryptedDirectMessage,
Expand Down

0 comments on commit e8a1572

Please sign in to comment.