Skip to content

Commit 1082abb

Browse files
committed
sdk: use Client::unwrap_gift_wrap instead of nip59::extract_rumor in examples
Signed-off-by: Yuki Kishimoto <[email protected]>
1 parent e615152 commit 1082abb

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

crates/nostr-sdk/examples/bot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async fn main() -> Result<()> {
4747
.handle_notifications(|notification| async {
4848
if let RelayPoolNotification::Event { event, .. } = notification {
4949
if event.kind() == Kind::GiftWrap {
50-
match UnwrappedGift::from_gift_wrap(&keys, &event) {
50+
match client.unwrap_gift_wrap(&event).await {
5151
Ok(UnwrappedGift { rumor, sender }) => {
5252
if rumor.kind == Kind::PrivateDirectMessage {
5353
let content: String = match rumor.content.as_str() {

crates/nostr-sdk/examples/client-with-opts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async fn main() -> Result<()> {
4949
.handle_notifications(|notification| async {
5050
if let RelayPoolNotification::Event { event, .. } = notification {
5151
if event.kind() == Kind::GiftWrap {
52-
let UnwrappedGift { rumor, .. } = nip59::extract_rumor(&my_keys, &event)?;
52+
let UnwrappedGift { rumor, .. } = client.unwrap_gift_wrap(&event).await?;
5353
println!("Rumor: {}", rumor.as_json());
5454
} else {
5555
println!("{:?}", event);

crates/nostr-sdk/examples/tor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async fn main() -> Result<()> {
3939
.handle_notifications(|notification| async {
4040
if let RelayPoolNotification::Event { event, .. } = notification {
4141
if event.kind() == Kind::GiftWrap {
42-
let UnwrappedGift { rumor, .. } = nip59::extract_rumor(&my_keys, &event)?;
42+
let UnwrappedGift { rumor, .. } = client.unwrap_gift_wrap(&event).await?;
4343
println!("Rumor: {}", rumor.as_json());
4444
} else {
4545
println!("{:?}", event);

0 commit comments

Comments
 (0)