Skip to content

Commit

Permalink
sdk: remove nwc dep
Browse files Browse the repository at this point in the history
`nwc` dependency is only re-exported and never used in `nostr-sdk`, so remove it.

Signed-off-by: Yuki Kishimoto <[email protected]>
  • Loading branch information
yukibtc committed Dec 4, 2024
1 parent 563ba33 commit 397fe20
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 36 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion bindings/nostr-sdk-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion bindings/nostr-sdk-ffi/src/client/zapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion bindings/nostr-sdk-ffi/src/nwc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use std::ops::Deref;

use nostr_sdk::nwc;
use uniffi::Object;

pub mod options;
Expand Down
2 changes: 1 addition & 1 deletion bindings/nostr-sdk-ffi/src/nwc/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-sdk-js/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-sdk-js/src/client/zapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion bindings/nostr-sdk-js/src/nwc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion bindings/nostr-sdk-js/src/nwc/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use std::ops::Deref;

use nostr_sdk::prelude::*;
use nwc::prelude::*;
use wasm_bindgen::prelude::*;

use crate::duration::JsDuration;
Expand Down
5 changes: 2 additions & 3 deletions crates/nostr-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand All @@ -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"] }

Expand Down
23 changes: 0 additions & 23 deletions crates/nostr-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down Expand Up @@ -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(())
}
```
Expand Down
1 change: 1 addition & 0 deletions crates/nostr-sdk/examples/zapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use std::str::FromStr;

use nostr_sdk::prelude::*;
use nwc::prelude::*;

#[tokio::main]
async fn main() -> Result<()> {
Expand Down
3 changes: 0 additions & 3 deletions crates/nostr-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 397fe20

Please sign in to comment.