From 0762d44a9ec3d8a5477e171933428cd9749e0659 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Mon, 22 Jul 2024 15:26:44 +0100 Subject: chore: bump rust-nostr to v0.33.0 bump all rust-nostr packages move from using patched nip46 nip05 function to profile function in v33 fix send_events_to error message --- Cargo.lock | 40 ++++++++++++++++++++++++---------------- Cargo.toml | 10 +++++----- src/client.rs | 9 ++++++++- src/login.rs | 12 ++++++------ src/sub_commands/send.rs | 2 +- test_utils/Cargo.toml | 4 ++-- 6 files changed, 46 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 474adbb..9d5604b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1821,8 +1821,9 @@ checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" [[package]] name = "nostr" -version = "0.32.1" -source = "git+https://github.com/DanConwayDev/nostr?branch=v0.32-get-nip46-from-nip05-address#429f3c1396f05bf08793f60ed1d92d7bc02ea438" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f08db214560a34bf7c4c1fea09a8461b9412bae58ba06e99ce3177d89fa1e0a6" dependencies = [ "aes 0.8.4", "base64 0.21.7", @@ -1850,8 +1851,9 @@ dependencies = [ [[package]] name = "nostr-database" -version = "0.32.0" -source = "git+https://github.com/DanConwayDev/nostr?branch=v0.32-get-nip46-from-nip05-address#429f3c1396f05bf08793f60ed1d92d7bc02ea438" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f6c72d0d0842de637f7fba6e70764f719257d29dad8fc5f7352810b0f117ad" dependencies = [ "async-trait", "flatbuffers", @@ -1864,8 +1866,9 @@ dependencies = [ [[package]] name = "nostr-relay-pool" -version = "0.32.0" -source = "git+https://github.com/DanConwayDev/nostr?branch=v0.32-get-nip46-from-nip05-address#429f3c1396f05bf08793f60ed1d92d7bc02ea438" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afa5502a3df456790ca16d90cc688a677117d57ab56b079dcfa091390ac9f202" dependencies = [ "async-utility", "async-wsocket", @@ -1879,8 +1882,9 @@ dependencies = [ [[package]] name = "nostr-sdk" -version = "0.32.0" -source = "git+https://github.com/DanConwayDev/nostr?branch=v0.32-get-nip46-from-nip05-address#429f3c1396f05bf08793f60ed1d92d7bc02ea438" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b427dceefbbb49a9dd98abb8c4e40d25fdd467e99821aaad88615252bdb915bd" dependencies = [ "async-utility", "atomic-destructor", @@ -1898,8 +1902,9 @@ dependencies = [ [[package]] name = "nostr-signer" -version = "0.32.0" -source = "git+https://github.com/DanConwayDev/nostr?branch=v0.32-get-nip46-from-nip05-address#429f3c1396f05bf08793f60ed1d92d7bc02ea438" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "665268b316f41cd8fa791be54b6c7935c5a239461708c380a699d6677be9af38" dependencies = [ "async-utility", "nostr", @@ -1911,8 +1916,9 @@ dependencies = [ [[package]] name = "nostr-sqlite" -version = "0.32.0" -source = "git+https://github.com/DanConwayDev/nostr?branch=v0.32-get-nip46-from-nip05-address#429f3c1396f05bf08793f60ed1d92d7bc02ea438" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31f643ba919864f3a9bb004244c0d5c958646b07fe760823fdc33aae1c8fc0fc" dependencies = [ "async-trait", "nostr", @@ -1925,8 +1931,9 @@ dependencies = [ [[package]] name = "nostr-zapper" -version = "0.32.0" -source = "git+https://github.com/DanConwayDev/nostr?branch=v0.32-get-nip46-from-nip05-address#429f3c1396f05bf08793f60ed1d92d7bc02ea438" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69922e74f8eab1f9d287008c0c06acdec87277a2d8f44bd9d38e003422aea0ab" dependencies = [ "async-trait", "nostr", @@ -2026,8 +2033,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "nwc" -version = "0.32.0" -source = "git+https://github.com/DanConwayDev/nostr?branch=v0.32-get-nip46-from-nip05-address#429f3c1396f05bf08793f60ed1d92d7bc02ea438" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb2e04b3edb5e9572e95b62842430625f1718e8a4a3596a30aeb04e6734764ea" dependencies = [ "async-utility", "nostr", diff --git a/Cargo.toml b/Cargo.toml index 6248f6b..464abc8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,11 +23,11 @@ futures = "0.3.28" git2 = "0.18.1" indicatif = "0.17.7" keyring = "2.0.5" -nostr = { git = "https://github.com/DanConwayDev/nostr", branch= "v0.32-get-nip46-from-nip05-address" } -nostr-database = { git = "https://github.com/DanConwayDev/nostr", branch= "v0.32-get-nip46-from-nip05-address" } -nostr-sdk = { git = "https://github.com/DanConwayDev/nostr", branch= "v0.32-get-nip46-from-nip05-address" } -nostr-signer = { git = "https://github.com/DanConwayDev/nostr", branch= "v0.32-get-nip46-from-nip05-address" } -nostr-sqlite = { git = "https://github.com/DanConwayDev/nostr", branch= "v0.32-get-nip46-from-nip05-address" } +nostr = "0.33.0" +nostr-database = "0.33.0" +nostr-sdk = "0.33.0" +nostr-signer = "0.33.0" +nostr-sqlite = "0.33.0" passwords = "3.1.13" scrypt = "0.11.0" serde = { version = "1.0.181", features = ["derive"] } diff --git a/src/client.rs b/src/client.rs index 880cb6b..29d390f 100644 --- a/src/client.rs +++ b/src/client.rs @@ -204,11 +204,18 @@ impl Connect for Client { #[allow(clippy::large_futures)] self.client.connect_relay(url).await?; let res = self.client.send_event_to(vec![url], event.clone()).await?; + if let Some(err) = res.failed.get(&Url::parse(url)?) { + bail!(if let Some(err) = err { + err.to_string() + } else { + "error: unknown".to_string() + }); + } save_event_in_cache(git_repo_path, &event).await?; if event.kind().eq(&Kind::Custom(REPO_REF_KIND)) { save_event_in_global_cache(git_repo_path, &event).await?; } - Ok(res) + Ok(event.id()) } async fn get_events( diff --git a/src/login.rs b/src/login.rs index 9c7ca78..be358de 100644 --- a/src/login.rs +++ b/src/login.rs @@ -2,7 +2,7 @@ use std::{collections::HashSet, path::Path, str::FromStr, time::Duration}; use anyhow::{bail, Context, Result}; use nostr::{ - nips::{nip05::get_nip46, nip46::NostrConnectURI}, + nips::{nip05, nip46::NostrConnectURI}, PublicKey, }; use nostr_sdk::{ @@ -404,17 +404,17 @@ async fn fresh_login( pub async fn fetch_nip46_uri_from_nip05(nip05: &str) -> Result { let term = console::Term::stderr(); term.write_line("contacting login service provider...")?; - let res = get_nip46(&nip05, None).await; + let res = nip05::profile(&nip05, None).await; term.clear_last_lines(1)?; match res { - Ok((signer_public_key, relays)) => { - if relays.is_empty() { + Ok(profile) => { + if profile.nip46.is_empty() { println!("nip05 provider isn't configured for remote login"); bail!("nip05 provider isn't configured for remote login") } Ok(NostrConnectURI::Bunker { - signer_public_key, - relays, + signer_public_key: profile.public_key, + relays: profile.nip46, secret: None, }) } diff --git a/src/sub_commands/send.rs b/src/sub_commands/send.rs index 95d3eb0..33ce104 100644 --- a/src/sub_commands/send.rs +++ b/src/sub_commands/send.rs @@ -405,7 +405,7 @@ pub async fn send_events( console::style( e.to_string() .replace("relay pool error:", "error:") - .replace("event not published: ", ""), + .replace("event not published: ", "error: "), ) .for_stderr() .red() diff --git a/test_utils/Cargo.toml b/test_utils/Cargo.toml index 92f4dfd..b7010c9 100644 --- a/test_utils/Cargo.toml +++ b/test_utils/Cargo.toml @@ -9,8 +9,8 @@ assert_cmd = "2.0.12" dialoguer = "0.10.4" directories = "5.0.1" git2 = "0.18.1" -nostr = { git = "https://github.com/DanConwayDev/nostr", branch= "v0.32-get-nip46-from-nip05-address" } -nostr-sdk = { git = "https://github.com/DanConwayDev/nostr", branch= "v0.32-get-nip46-from-nip05-address" } +nostr = "0.33.0" +nostr-sdk = "0.33.0" once_cell = "1.18.0" rand = "0.8" rexpect = { git = "https://github.com/rust-cli/rexpect.git", rev = "9eb61dd" } -- cgit v1.2.3