Skip to content

Commit c075218

Browse files
committed
Bump nostr upstream deps to 0.42.0
Pull-Request: #11 Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
1 parent 6526da0 commit c075218

File tree

9 files changed

+134
-84
lines changed

9 files changed

+134
-84
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@
2525

2626
## Unreleased
2727

28+
### Breaking changes
29+
30+
- Rename `ExtractedComment` to `CommentTarget` (https://github.com/rust-nostr/nostr-sdk-ffi/pull/11)
31+
2832
### Changed
2933

3034
* Publish python wheels with cp39-abi3 (https://github.com/rust-nostr/nostr-sdk-ffi/pull/7)
35+
* Bump nostr upstream deps to 0.42.0 (see the [Upstream CHANGELOG] for more details, https://github.com/rust-nostr/nostr-sdk-ffi/pull/11)
3136

3237
### Added
3338

Cargo.lock

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

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ uniffi-cli = ["uniffi/cli"] # required for the `uniffi-bindgen` binary
2424
async-trait = "0.1"
2525
async-wsocket = "0.13"
2626
futures-util = "0.3.31"
27-
nostr = { version = "0.41.0", features = ["std", "all-nips"] }
28-
nostr-connect = "0.41.0"
29-
nostr-sdk = { version = "0.41.0", default-features = false, features = ["all-nips"] }
30-
nwc = "0.41.0"
27+
nostr = { git = "https://github.com/rust-nostr/nostr", rev = "184e686260daa5f631a94b97749547f7c2b28008", features = ["std", "all-nips"] }
28+
nostr-connect = { git = "https://github.com/rust-nostr/nostr", rev = "184e686260daa5f631a94b97749547f7c2b28008" }
29+
nostr-sdk = { git = "https://github.com/rust-nostr/nostr", rev = "184e686260daa5f631a94b97749547f7c2b28008", default-features = false, features = ["all-nips"] }
30+
nwc = { git = "https://github.com/rust-nostr/nostr", rev = "184e686260daa5f631a94b97749547f7c2b28008" }
3131
tokio = { version = "1", features = ["sync"] }
3232
tracing = { version = "0.1", features = ["std"] }
3333
tracing-subscriber = "0.3"

src/protocol/event/kind.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ pub enum KindStandard {
132132
Reaction,
133133
/// Badge Award (NIP58)
134134
BadgeAward,
135+
/// Blossom Authorization
136+
BlossomAuth,
135137
/// Channel Creation (NIP28)
136138
ChannelCreation,
137139
/// Channel Metadata (NIP28)
@@ -436,6 +438,7 @@ fn convert(k: nostr::Kind) -> Option<KindStandard> {
436438
nostr::Kind::CashuWalletUnspentProof => Some(KindStandard::CashuWalletUnspentProof),
437439
nostr::Kind::CashuWalletSpendingHistory => Some(KindStandard::CashuWalletSpendingHistory),
438440
nostr::Kind::CodeSnippet => Some(KindStandard::CodeSnippet),
441+
nostr::Kind::BlossomAuth => Some(KindStandard::BlossomAuth),
439442
nostr::Kind::Custom(..) => None,
440443
}
441444
}
@@ -453,6 +456,7 @@ impl From<KindStandard> for nostr::Kind {
453456
KindStandard::Comment => Self::Comment,
454457
KindStandard::Reaction => Self::Reaction,
455458
KindStandard::BadgeAward => Self::BadgeAward,
459+
KindStandard::BlossomAuth => Self::BlossomAuth,
456460
KindStandard::ChannelCreation => Self::ChannelCreation,
457461
KindStandard::ChannelMetadata => Self::ChannelMetadata,
458462
KindStandard::ChannelMessage => Self::ChannelMessage,

src/protocol/event/tag/kind.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ pub enum TagKind {
103103
Streaming,
104104
/// Recording
105105
Recording,
106+
/// Server
107+
Server,
106108
/// Starts
107109
Starts,
108110
/// Ends
@@ -186,6 +188,7 @@ impl From<tag::TagKind<'_>> for TagKind {
186188
tag::TagKind::Blurhash => Self::Blurhash,
187189
tag::TagKind::Streaming => Self::Streaming,
188190
tag::TagKind::Recording => Self::Recording,
191+
tag::TagKind::Server => Self::Server,
189192
tag::TagKind::Starts => Self::Starts,
190193
tag::TagKind::Ends => Self::Ends,
191194
tag::TagKind::Status => Self::Status,
@@ -255,6 +258,7 @@ impl From<TagKind> for tag::TagKind<'_> {
255258
TagKind::Blurhash => Self::Blurhash,
256259
TagKind::Streaming => Self::Streaming,
257260
TagKind::Recording => Self::Recording,
261+
TagKind::Server => Self::Server,
258262
TagKind::Starts => Self::Starts,
259263
TagKind::Ends => Self::Ends,
260264
TagKind::Status => Self::Status,

src/protocol/event/tag/standard.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ pub enum TagStandard {
219219
key: String,
220220
iv: String,
221221
},
222+
Server {
223+
url: String,
224+
},
222225
Sha256 {
223226
hash: String,
224227
},
@@ -504,6 +507,9 @@ impl From<tag::TagStandard> for TagStandard {
504507
},
505508
tag::TagStandard::MimeType(mime) => Self::MimeType { mime },
506509
tag::TagStandard::Aes256Gcm { key, iv } => Self::Aes256Gcm { key, iv },
510+
tag::TagStandard::Server(url) => Self::Server {
511+
url: url.to_string(),
512+
},
507513
tag::TagStandard::Sha256(hash) => Self::Sha256 {
508514
hash: hash.to_string(),
509515
},
@@ -753,6 +759,7 @@ impl TryFrom<TagStandard> for tag::TagStandard {
753759
TagStandard::UrlTag { url } => Ok(Self::Url(Url::parse(&url)?)),
754760
TagStandard::MimeType { mime } => Ok(Self::MimeType(mime)),
755761
TagStandard::Aes256Gcm { key, iv } => Ok(Self::Aes256Gcm { key, iv }),
762+
TagStandard::Server { url } => Ok(Self::Server(Url::parse(&url)?)),
756763
TagStandard::Sha256 { hash } => Ok(Self::Sha256(Sha256Hash::from_str(&hash)?)),
757764
TagStandard::Size { size } => Ok(Self::Size(size as usize)),
758765
TagStandard::Dim { dimensions } => Ok(Self::Dim(dimensions.into())),

src/protocol/nips/nip22.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
use std::ops::Deref;
66
use std::sync::Arc;
77

8-
use nostr::nips::nip22::{self, Comment};
8+
use nostr::nips::nip22;
99
use uniffi::Enum;
1010

1111
use super::nip01::Coordinate;
1212
use super::nip73::ExternalContentId;
1313
use crate::protocol::event::{Event, EventId, Kind};
1414
use crate::protocol::key::PublicKey;
1515

16-
/// Extracted NIP22 comment
16+
/// Comment target
1717
///
1818
/// <https://github.com/nostr-protocol/nips/blob/master/22.md>
1919
#[derive(Enum)]
20-
pub enum ExtractedComment {
20+
pub enum CommentTarget {
2121
/// Event
2222
Event {
2323
/// Event ID
@@ -49,10 +49,10 @@ pub enum ExtractedComment {
4949
},
5050
}
5151

52-
impl From<Comment<'_>> for ExtractedComment {
53-
fn from(comment: Comment<'_>) -> Self {
52+
impl From<nip22::CommentTarget<'_>> for CommentTarget {
53+
fn from(comment: nip22::CommentTarget<'_>) -> Self {
5454
match comment {
55-
Comment::Event {
55+
nip22::CommentTarget::Event {
5656
id,
5757
relay_hint,
5858
pubkey_hint,
@@ -63,7 +63,7 @@ impl From<Comment<'_>> for ExtractedComment {
6363
pubkey_hint: pubkey_hint.map(|p| Arc::new((*p).into())),
6464
kind: kind.map(|k| Arc::new((*k).into())),
6565
},
66-
Comment::Coordinate {
66+
nip22::CommentTarget::Coordinate {
6767
address,
6868
relay_hint,
6969
kind,
@@ -72,20 +72,20 @@ impl From<Comment<'_>> for ExtractedComment {
7272
relay_hint: relay_hint.map(|u| u.to_string()),
7373
kind: kind.map(|k| Arc::new((*k).into())),
7474
},
75-
Comment::External { content, hint } => Self::External {
75+
nip22::CommentTarget::External { content, hint } => Self::External {
7676
content: content.clone().into(),
7777
hint: hint.map(|u| u.to_string()),
7878
},
7979
}
8080
}
8181
}
8282

83-
/// Extract NIP22 root comment data
84-
pub fn nip22_extract_root(event: &Event) -> Option<ExtractedComment> {
83+
/// Extract NIP22 root comment target
84+
pub fn nip22_extract_root(event: &Event) -> Option<CommentTarget> {
8585
nip22::extract_root(event.deref()).map(|c| c.into())
8686
}
8787

88-
/// Extract NIP22 parent comment data
89-
pub fn nip22_extract_parent(event: &Event) -> Option<ExtractedComment> {
88+
/// Extract NIP22 parent comment target
89+
pub fn nip22_extract_parent(event: &Event) -> Option<CommentTarget> {
9090
nip22::extract_parent(event.deref()).map(|c| c.into())
9191
}

0 commit comments

Comments
 (0)