From 7cebc490cad3d809425ea114b4b7c05393d064e9 Mon Sep 17 00:00:00 2001 From: Bytemalte Date: Fri, 16 Jan 2026 21:53:55 +0100 Subject: [PATCH] fix: try 2 to fix sending message error --- src/nips/nip17.rs | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/src/nips/nip17.rs b/src/nips/nip17.rs index 8c32ea4..154b1de 100644 --- a/src/nips/nip17.rs +++ b/src/nips/nip17.rs @@ -13,15 +13,10 @@ pub struct Message { } pub async fn send_dm(client: &Client, receiver: PublicKey, message: &str) -> Result { - println!("[SDK] Sending NIP-17 message to: {}", receiver.to_bech32()?); - - // send_private_msg in newer nostr-sdk versions handles NIP-17 wrapping. - // Important: It must be broadcasted to relays that both you and the receiver use. + // In current nostr-sdk versions, send_private_msg sends the GiftWrap to the receiver + // and usually a copy to yourself so you can see your own history. let output = client.send_private_msg(receiver, message, None).await?; - - // We wait briefly to ensure the relays acknowledged the event println!("[SDK] Event broadcasted successfully. ID: {}", output.id()); - Ok(*output.id()) } @@ -32,17 +27,17 @@ pub async fn get_dm_messages(client: &Client, contact_npub: &str) -> Result Result Result