diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a25e12bb..c5079fcb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,7 @@ ### Removed +* sdk: remove `nwc` dep ([Yuki Kishimoto]) * ffi: drop support for `i686-linux-android` target ([Yuki Kishimoto]) * ffi: remove `MockRelay` ([Yuki Kishimoto]) * ffi: remove `RawEvent` and `RawEventRecord` ([Yuki Kishimoto]) diff --git a/Cargo.lock b/Cargo.lock index f8aeecdf4..2b9315cd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3283,7 +3283,6 @@ name = "nostr-sdk" version = "0.37.0" dependencies = [ "async-utility", - "atomic-destructor", "lnurl-pay", "nostr", "nostr-connect", @@ -3308,6 +3307,7 @@ dependencies = [ "nostr", "nostr-connect", "nostr-sdk", + "nwc", "paranoid-android", "tracing", "tracing-subscriber", @@ -3332,6 +3332,7 @@ dependencies = [ "js-sys", "nostr-connect", "nostr-sdk", + "nwc", "tracing", "tracing-subscriber", "wasm-bindgen", diff --git a/bindings/nostr-sdk-ffi/Cargo.toml b/bindings/nostr-sdk-ffi/Cargo.toml index e2b560631..b0a500a1b 100644 --- a/bindings/nostr-sdk-ffi/Cargo.toml +++ b/bindings/nostr-sdk-ffi/Cargo.toml @@ -22,8 +22,9 @@ uniffi-cli = ["uniffi/cli"] # required for the `uniffi-bindgen` binary [dependencies] async-trait.workspace = true nostr = { workspace = true, features = ["std", "all-nips"] } -nostr-connect.workspace = true +nostr-connect = { workspace = true, features = ["tor"] } nostr-sdk = { workspace = true, default-features = false, features = ["all-nips", "tor"] } +nwc = { workspace = true, features = ["tor"] } tracing = { workspace = true, features = ["std"] } tracing-subscriber.workspace = true uniffi = { git = "https://github.com/yukibtc/uniffi-rs", rev = "4f98679df9ae2a98effba3b274ff48379041d6d7", features = ["tokio"] } diff --git a/bindings/nostr-sdk-ffi/src/client/zapper.rs b/bindings/nostr-sdk-ffi/src/client/zapper.rs index 7e3fd62c6..c0c394161 100644 --- a/bindings/nostr-sdk-ffi/src/client/zapper.rs +++ b/bindings/nostr-sdk-ffi/src/client/zapper.rs @@ -5,8 +5,8 @@ use core::ops::Deref; use std::sync::Arc; +use nostr_sdk::client; use nostr_sdk::zapper::{DynNostrZapper, IntoNostrZapper}; -use nostr_sdk::{client, nwc}; use uniffi::Object; use crate::nwc::NWC; diff --git a/bindings/nostr-sdk-ffi/src/nwc/mod.rs b/bindings/nostr-sdk-ffi/src/nwc/mod.rs index 4521920d4..155b654b5 100644 --- a/bindings/nostr-sdk-ffi/src/nwc/mod.rs +++ b/bindings/nostr-sdk-ffi/src/nwc/mod.rs @@ -4,7 +4,6 @@ use std::ops::Deref; -use nostr_sdk::nwc; use uniffi::Object; pub mod options; diff --git a/bindings/nostr-sdk-ffi/src/nwc/options.rs b/bindings/nostr-sdk-ffi/src/nwc/options.rs index d804a48f9..f4dd7ecea 100644 --- a/bindings/nostr-sdk-ffi/src/nwc/options.rs +++ b/bindings/nostr-sdk-ffi/src/nwc/options.rs @@ -5,7 +5,7 @@ use std::ops::Deref; use std::time::Duration; -use nostr_sdk::{nwc, pool}; +use nostr_sdk::pool; use uniffi::Object; use crate::error::Result; diff --git a/bindings/nostr-sdk-js/Cargo.toml b/bindings/nostr-sdk-js/Cargo.toml index 36753b068..4e1e06953 100644 --- a/bindings/nostr-sdk-js/Cargo.toml +++ b/bindings/nostr-sdk-js/Cargo.toml @@ -12,6 +12,7 @@ console_error_panic_hook = "0.1" js-sys.workspace = true nostr-connect.workspace = true nostr-sdk = { workspace = true, default-features = false, features = ["all-nips", "indexeddb", "webln"] } +nwc.workspace = true tracing.workspace = true tracing-subscriber.workspace = true wasm-bindgen = { workspace = true, features = ["std"] } diff --git a/bindings/nostr-sdk-js/src/client/zapper.rs b/bindings/nostr-sdk-js/src/client/zapper.rs index 02342a123..ac53804d0 100644 --- a/bindings/nostr-sdk-js/src/client/zapper.rs +++ b/bindings/nostr-sdk-js/src/client/zapper.rs @@ -6,6 +6,7 @@ use core::ops::Deref; use std::sync::Arc; use nostr_sdk::prelude::*; +use nwc::prelude::*; use wasm_bindgen::prelude::*; use crate::error::{into_err, Result}; diff --git a/bindings/nostr-sdk-js/src/nwc/mod.rs b/bindings/nostr-sdk-js/src/nwc/mod.rs index 9532a767c..93c5c7fde 100644 --- a/bindings/nostr-sdk-js/src/nwc/mod.rs +++ b/bindings/nostr-sdk-js/src/nwc/mod.rs @@ -5,7 +5,7 @@ use std::ops::Deref; use js_sys::Array; -use nostr_sdk::prelude::*; +use nwc::prelude::*; use wasm_bindgen::prelude::*; pub mod options; diff --git a/bindings/nostr-sdk-js/src/nwc/options.rs b/bindings/nostr-sdk-js/src/nwc/options.rs index 58939872a..3237dea52 100644 --- a/bindings/nostr-sdk-js/src/nwc/options.rs +++ b/bindings/nostr-sdk-js/src/nwc/options.rs @@ -4,7 +4,7 @@ use std::ops::Deref; -use nostr_sdk::prelude::*; +use nwc::prelude::*; use wasm_bindgen::prelude::*; use crate::duration::JsDuration; diff --git a/crates/nostr-sdk/Cargo.toml b/crates/nostr-sdk/Cargo.toml index 149a66358..da9fe95dc 100644 --- a/crates/nostr-sdk/Cargo.toml +++ b/crates/nostr-sdk/Cargo.toml @@ -30,20 +30,18 @@ nip06 = ["nostr/nip06"] nip07 = ["nostr/nip07"] nip11 = ["nostr/nip11", "nostr-relay-pool/nip11"] nip44 = ["nostr/nip44"] -nip47 = ["nostr/nip47", "dep:nwc"] +nip47 = ["nostr/nip47"] nip49 = ["nostr/nip49"] nip57 = ["nostr/nip57", "dep:nostr-zapper", "dep:lnurl-pay"] nip59 = ["nostr/nip59"] [dependencies] async-utility.workspace = true -atomic-destructor.workspace = true lnurl-pay = { version = "0.6", features = ["api"], optional = true } nostr = { workspace = true, features = ["std"] } nostr-database.workspace = true nostr-relay-pool.workspace = true nostr-zapper = { workspace = true, optional = true } -nwc = { workspace = true, optional = true } thiserror.workspace = true tokio = { workspace = true, features = ["sync"] } tracing = { workspace = true, features = ["std", "attributes"] } @@ -57,6 +55,7 @@ nostr-indexeddb = { workspace = true, optional = true } [dev-dependencies] nostr-connect.workspace = true +nwc.workspace = true tokio = { workspace = true, features = ["macros"] } tracing-subscriber = { workspace = true, features = ["env-filter"] } diff --git a/crates/nostr-sdk/README.md b/crates/nostr-sdk/README.md index 94320b10b..531fdf7d8 100644 --- a/crates/nostr-sdk/README.md +++ b/crates/nostr-sdk/README.md @@ -19,7 +19,6 @@ If you're attempting something more custom, you might be interested in [these](h ```rust,no_run use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4}; -use std::str::FromStr; use nostr_sdk::prelude::*; @@ -79,28 +78,6 @@ async fn main() -> Result<()> { client.send_event_builder(builder).await?; // Send to all relays // client.send_event_builder_to(["wss://relay.damus.io"], builder).await?; // Send to specific relay - // --------- Zap! ------------- - - // Configure zapper - let uri = NostrWalletConnectURI::from_str("nostr+walletconnect://...")?; - let zapper = NWC::new(uri); // Use `WebLNZapper::new().await` for WebLN - client.set_zapper(zapper).await; - - // Send SAT without zap event - let public_key = PublicKey::from_bech32( - "npub1drvpzev3syqt0kjrls50050uzf25gehpz9vgdw08hvex7e0vgfeq0eseet", - )?; - client.zap(public_key, 1000, None).await?; - - // Zap profile - let details = ZapDetails::new(ZapType::Public).message("Test"); - client.zap(public_key, 1000, Some(details)).await?; - - // Zap event - let event = Nip19Event::from_bech32("nevent1qqsr0q447ylm3y3tvw07vt69w3kzk026vl6yn3dwm9fweay0dw0jttgpz3mhxue69uhhyetvv9ujumn0wd68ytnzvupzq6xcz9jerqgqkldy8lpg7lglcyj4g3nwzy2cs6u70wejdaj7csnjqvzqqqqqqygequ53")?; - let details = ZapDetails::new(ZapType::Anonymous).message("Anonymous Zap!"); - client.zap(event, 1000, Some(details)).await?; - Ok(()) } ``` diff --git a/crates/nostr-sdk/examples/zapper.rs b/crates/nostr-sdk/examples/zapper.rs index ea6a80d9c..fb98d3d08 100644 --- a/crates/nostr-sdk/examples/zapper.rs +++ b/crates/nostr-sdk/examples/zapper.rs @@ -5,6 +5,7 @@ use std::str::FromStr; use nostr_sdk::prelude::*; +use nwc::prelude::*; #[tokio::main] async fn main() -> Result<()> { diff --git a/crates/nostr-sdk/src/lib.rs b/crates/nostr-sdk/src/lib.rs index 8778d3bd2..9a2a767a6 100644 --- a/crates/nostr-sdk/src/lib.rs +++ b/crates/nostr-sdk/src/lib.rs @@ -36,9 +36,6 @@ pub use nostr_relay_pool::{ #[doc(hidden)] #[cfg(feature = "nip57")] pub use nostr_zapper::{self as zapper, *}; -#[doc(hidden)] -#[cfg(feature = "nip47")] -pub use nwc::{self, NostrWalletConnectOptions, NWC}; pub mod client; mod gossip;