From 9e375bdfc233efce36623638d8b142f0289eccfe Mon Sep 17 00:00:00 2001 From: thesimplekid Date: Thu, 24 Oct 2024 09:26:43 +0100 Subject: [PATCH] chore: update nostr sdk --- crates/cdk-cli/Cargo.toml | 8 +++++++- crates/cdk-cli/src/sub_commands/receive.rs | 17 +++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/crates/cdk-cli/Cargo.toml b/crates/cdk-cli/Cargo.toml index bd3b26b0..70d7409e 100644 --- a/crates/cdk-cli/Cargo.toml +++ b/crates/cdk-cli/Cargo.toml @@ -25,8 +25,14 @@ tracing = { version = "0.1", default-features = false, features = ["attributes", tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } rand = "0.8.5" home = "0.5.5" -nostr-sdk = { version = "0.33.0", default-features = false, features = [ +nostr-sdk = { version = "0.35.0", default-features = false, features = [ "nip04", "nip44" ]} +reqwest = { version = "0.12", default-features = false, features = [ + "json", + "rustls-tls", + "rustls-tls-native-roots", + "socks", +]} url = "2.3" diff --git a/crates/cdk-cli/src/sub_commands/receive.rs b/crates/cdk-cli/src/sub_commands/receive.rs index 24eea39b..f7e621cb 100644 --- a/crates/cdk-cli/src/sub_commands/receive.rs +++ b/crates/cdk-cli/src/sub_commands/receive.rs @@ -184,20 +184,25 @@ async fn nostr_receive( let client = nostr_sdk::Client::default(); - client.add_relays(relays).await?; - client.connect().await; - let events = client.get_events_of(vec![filter], None).await?; + let events = client + .get_events_of( + vec![filter], + nostr_sdk::EventSource::Relays { + timeout: None, + specific_relays: Some(relays), + }, + ) + .await?; let mut tokens: HashSet = HashSet::new(); let keys = Keys::from_str(&(nostr_signing_key).to_secret_hex())?; for event in events { - if event.kind() == Kind::EncryptedDirectMessage { - if let Ok(msg) = nip04::decrypt(keys.secret_key()?, event.author_ref(), event.content()) - { + if event.kind == Kind::EncryptedDirectMessage { + if let Ok(msg) = nip04::decrypt(keys.secret_key(), &event.pubkey, event.content) { if let Some(token) = cdk::wallet::util::token_from_text(&msg) { tokens.insert(token.to_string()); }