Skip to content

Commit baa984b

Browse files
committed
nostr: add notifications field to NIP47 GetInfoResponse
Signed-off-by: Yuki Kishimoto <[email protected]>
1 parent cd12395 commit baa984b

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
* nostr: add `EventBuilder::dedup_tags` method ([Yuki Kishimoto])
9292
* nostr: impl `FromIterator<Tag>` for `Tags` ([Yuki Kishimoto])
9393
* nostr: add `EventDeletionRequest` struct ([Yuki Kishimoto])
94+
* nostr: add `notifications` field to NIP47 `GetInfoResponse` ([Yuki Kishimoto])
9495
* pool: event verification cache ([Yuki Kishimoto])
9596
* pool: add `AdmitPolicy` trait ([Yuki Kishimoto])
9697
* ffi: add Mac Catalyst support in Swift package ([Yuki Kishimoto])

bindings/nostr-sdk-ffi/src/protocol/nips/nip47.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ pub struct GetInfoResponse {
734734
pub block_hash: String,
735735
/// Available methods for this connection
736736
pub methods: Vec<String>,
737+
/// List of supported notifications for this connection (optional)
738+
pub notifications: Vec<String>,
737739
}
738740

739741
impl From<nip47::GetInfoResponse> for GetInfoResponse {
@@ -746,6 +748,7 @@ impl From<nip47::GetInfoResponse> for GetInfoResponse {
746748
block_height: value.block_height,
747749
block_hash: value.block_hash,
748750
methods: value.methods,
751+
notifications: value.notifications,
749752
}
750753
}
751754
}
@@ -760,6 +763,7 @@ impl From<GetInfoResponse> for nip47::GetInfoResponse {
760763
block_height: value.block_height,
761764
block_hash: value.block_hash,
762765
methods: value.methods,
766+
notifications: value.notifications,
763767
}
764768
}
765769
}

bindings/nostr-sdk-js/src/protocol/nips/nip47.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,9 @@ pub struct JsGetInfoResponse {
557557
/// Available methods for this connection
558558
#[wasm_bindgen(getter_with_clone)]
559559
pub methods: Vec<String>,
560+
/// List of supported notifications for this connection (optional)
561+
#[wasm_bindgen(getter_with_clone)]
562+
pub notifications: Vec<String>,
560563
}
561564

562565
impl From<GetInfoResponse> for JsGetInfoResponse {
@@ -569,6 +572,7 @@ impl From<GetInfoResponse> for JsGetInfoResponse {
569572
block_height: value.block_height,
570573
block_hash: value.block_hash,
571574
methods: value.methods,
575+
notifications: value.notifications,
572576
}
573577
}
574578
}
@@ -583,6 +587,7 @@ impl From<JsGetInfoResponse> for GetInfoResponse {
583587
block_height: value.block_height,
584588
block_hash: value.block_hash,
585589
methods: value.methods,
590+
notifications: value.notifications,
586591
}
587592
}
588593
}

crates/nostr/src/nips/nip47.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,10 @@ pub struct GetInfoResponse {
607607
pub block_hash: String,
608608
/// Available methods for this connection
609609
pub methods: Vec<String>,
610+
/// List of supported notifications for this connection (optional)
611+
#[serde(default)]
612+
#[serde(skip_serializing_if = "Vec::is_empty")]
613+
pub notifications: Vec<String>,
610614
}
611615

612616
/// NIP47 Response Result

0 commit comments

Comments
 (0)