Skip to content

Commit

Permalink
sdk: use Client::unwrap_gift_wrap instead of nip59::extract_rumor
Browse files Browse the repository at this point in the history
… in examples

Signed-off-by: Yuki Kishimoto <[email protected]>
  • Loading branch information
yukibtc committed Jul 31, 2024
1 parent e615152 commit 1082abb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/nostr-sdk/examples/bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion crates/nostr-sdk/examples/client-with-opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion crates/nostr-sdk/examples/tor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1082abb

Please sign in to comment.