From 1082abb7486d8ef95a8827ee3d1190d70d01b428 Mon Sep 17 00:00:00 2001 From: Yuki Kishimoto Date: Wed, 31 Jul 2024 13:57:25 -0400 Subject: [PATCH] sdk: use `Client::unwrap_gift_wrap` instead of `nip59::extract_rumor` in examples Signed-off-by: Yuki Kishimoto --- crates/nostr-sdk/examples/bot.rs | 2 +- crates/nostr-sdk/examples/client-with-opts.rs | 2 +- crates/nostr-sdk/examples/tor.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/nostr-sdk/examples/bot.rs b/crates/nostr-sdk/examples/bot.rs index 045ee23fa..1670f5e65 100644 --- a/crates/nostr-sdk/examples/bot.rs +++ b/crates/nostr-sdk/examples/bot.rs @@ -47,7 +47,7 @@ async fn main() -> Result<()> { .handle_notifications(|notification| async { if let RelayPoolNotification::Event { event, .. } = notification { if event.kind() == Kind::GiftWrap { - match UnwrappedGift::from_gift_wrap(&keys, &event) { + match client.unwrap_gift_wrap(&event).await { Ok(UnwrappedGift { rumor, sender }) => { if rumor.kind == Kind::PrivateDirectMessage { let content: String = match rumor.content.as_str() { diff --git a/crates/nostr-sdk/examples/client-with-opts.rs b/crates/nostr-sdk/examples/client-with-opts.rs index 9e42159c0..c42f472d0 100644 --- a/crates/nostr-sdk/examples/client-with-opts.rs +++ b/crates/nostr-sdk/examples/client-with-opts.rs @@ -49,7 +49,7 @@ async fn main() -> Result<()> { .handle_notifications(|notification| async { if let RelayPoolNotification::Event { event, .. } = notification { if event.kind() == Kind::GiftWrap { - let UnwrappedGift { rumor, .. } = nip59::extract_rumor(&my_keys, &event)?; + let UnwrappedGift { rumor, .. } = client.unwrap_gift_wrap(&event).await?; println!("Rumor: {}", rumor.as_json()); } else { println!("{:?}", event); diff --git a/crates/nostr-sdk/examples/tor.rs b/crates/nostr-sdk/examples/tor.rs index 1f898f980..fc17db4e6 100644 --- a/crates/nostr-sdk/examples/tor.rs +++ b/crates/nostr-sdk/examples/tor.rs @@ -39,7 +39,7 @@ async fn main() -> Result<()> { .handle_notifications(|notification| async { if let RelayPoolNotification::Event { event, .. } = notification { if event.kind() == Kind::GiftWrap { - let UnwrappedGift { rumor, .. } = nip59::extract_rumor(&my_keys, &event)?; + let UnwrappedGift { rumor, .. } = client.unwrap_gift_wrap(&event).await?; println!("Rumor: {}", rumor.as_json()); } else { println!("{:?}", event);