Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit 2041318

Browse files
committed
Update rust-nostr to v0.26
1 parent 10e519d commit 2041318

File tree

9 files changed

+231
-134
lines changed

9 files changed

+231
-134
lines changed

Cargo.lock

Lines changed: 107 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mutiny-core/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ futures-util = { version = "0.3", default-features = false }
3838
reqwest = { version = "0.11", default-features = false, features = ["json"] }
3939
async-trait = "0.1.68"
4040
url = { version = "2.3.1", features = ["serde"] }
41-
nostr = { version = "0.24.0", default-features = false, features = ["nip47"] }
42-
nostr-sdk = { version = "0.24.0", default-features = false }
41+
nostr = { version = "0.26.0", default-features = false, features = ["nip47"] }
42+
nostr-sdk = { version = "0.26.0", default-features = false }
4343
cbc = { version = "0.1", features = ["alloc"] }
4444
aes = { version = "0.8" }
4545
jwt-compact = { version = "0.8.0-beta.1", features = ["es256k"] }

mutiny-core/src/lib.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use crate::{
6767
use crate::{nodemanager::NodeManager, nostr::ProfileType};
6868
use crate::{nostr::NostrManager, utils::sleep};
6969
use ::nostr::key::XOnlyPublicKey;
70-
use ::nostr::{Event, Kind, Metadata};
70+
use ::nostr::{Event, JsonUtil, Kind, Metadata};
7171
use bdk_chain::ConfirmationTime;
7272
use bip39::Mnemonic;
7373
use bitcoin::util::bip32::ExtendedPrivKey;
@@ -479,19 +479,12 @@ impl<S: MutinyStorage> MutinyWallet<S> {
479479
log_warn!(logger, "Failed to clear expired NWC invoices: {e}");
480480
}
481481

482-
// clear successful single-use profiles
483-
484482
let client = Client::new(&nostr.primary_key);
485483

486-
#[cfg(target_arch = "wasm32")]
487-
let add_relay_res = client.add_relays(nostr.get_relays()).await;
488-
489-
#[cfg(not(target_arch = "wasm32"))]
490-
let add_relay_res = client
491-
.add_relays(nostr.get_relays().into_iter().map(|s| (s, None)).collect())
492-
.await;
493-
494-
add_relay_res.expect("Failed to add relays");
484+
client
485+
.add_relays(nostr.get_relays())
486+
.await
487+
.expect("Failed to add relays");
495488
client.connect().await;
496489

497490
let mut last_filters = nostr.get_nwc_filters();
@@ -519,7 +512,7 @@ impl<S: MutinyStorage> MutinyWallet<S> {
519512
select! {
520513
notification = read_fut => {
521514
match notification {
522-
Ok(RelayPoolNotification::Event(_url, event)) => {
515+
Ok(RelayPoolNotification::Event { event, .. }) => {
523516
if event.kind == Kind::WalletConnectRequest && event.verify().is_ok() {
524517
match nostr.handle_nwc_request(event, &self_clone).await {
525518
Ok(Some(event)) => {
@@ -534,7 +527,7 @@ impl<S: MutinyStorage> MutinyWallet<S> {
534527
}
535528
}
536529
},
537-
Ok(RelayPoolNotification::Message(_, _)) => {}, // ignore messages
530+
Ok(RelayPoolNotification::Message { .. }) => {}, // ignore messages
538531
Ok(RelayPoolNotification::Shutdown) => break, // if we disconnect, we restart to reconnect
539532
Ok(RelayPoolNotification::Stop) => {}, // Currently unused
540533
Ok(RelayPoolNotification::RelayStatus { .. }) => {}, // Currently unused

mutiny-core/src/nodemanager.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ use lightning_transaction_sync::EsploraSyncClient;
5050
use lnurl::lnurl::LnUrl;
5151
use lnurl::{AsyncClient as LnUrlClient, LnUrlResponse, Response};
5252
use nostr::key::XOnlyPublicKey;
53-
use nostr::{EventBuilder, Keys, Kind, Tag, TagKind};
53+
use nostr::{EventBuilder, JsonUtil, Keys, Kind, Tag, TagKind};
5454
use payjoin::{PjUri, PjUriExt};
5555
use reqwest::Client;
5656
use serde::{Deserialize, Serialize};
@@ -1694,13 +1694,20 @@ impl<S: MutinyStorage> NodeManager<S> {
16941694
let zap_request = match zap_npub {
16951695
Some(zap_npub) => {
16961696
let tags = vec![
1697-
Tag::PubKey(zap_npub, None),
1698-
Tag::Amount(msats),
1697+
Tag::PublicKey {
1698+
public_key: zap_npub,
1699+
relay_url: None,
1700+
alias: None,
1701+
},
1702+
Tag::Amount {
1703+
millisats: msats,
1704+
bolt11: None,
1705+
},
16991706
Tag::Lnurl(lnurl.to_string()),
17001707
Tag::Relays(vec!["wss://nostr.mutinywallet.com".into()]),
17011708
Tag::Generic(TagKind::Custom("anon".to_string()), vec![]),
17021709
];
1703-
EventBuilder::new(Kind::ZapRequest, "", &tags)
1710+
EventBuilder::new(Kind::ZapRequest, "", tags)
17041711
.to_event(&Keys::generate())
17051712
.ok()
17061713
.map(|z| z.as_json())

0 commit comments

Comments
 (0)