Skip to content

Commit aa03dfa

Browse files
committed
ffi(nostr): add nip65
1 parent fc5327b commit aa03dfa

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

bindings/nostr-ffi/src/nips/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub mod nip47;
1717
pub mod nip48;
1818
pub mod nip53;
1919
pub mod nip57;
20+
pub mod nip65;
2021
pub mod nip90;
2122
pub mod nip94;
2223
pub mod nip98;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) 2023-2024 Rust Nostr Developers
2+
// Distributed under the MIT software license
3+
4+
use std::{ops::Deref, sync::Arc};
5+
6+
use nostr::nips::nip65;
7+
8+
use crate::{Event, RelayMetadata};
9+
10+
/// Extracts the relay info (url, optional read/write flag) from the event
11+
pub fn extract_relay_list(event: Arc<Event>) -> Vec<(String, Option<RelayMetadata>)> {
12+
nip65::extract_relay_list(event.deref())
13+
.into_iter()
14+
.map(|(s, r)| (s.to_string(), r.map(|r| r.into())))
15+
.collect()
16+
}

0 commit comments

Comments
 (0)