lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README | LICENSE

nip11.rs (598B)


      1 #[cfg(all(feature = "http", feature = "codec"))]
      2 use radroots_events::relay_document::RadrootsRelayDocument;
      3 
      4 #[cfg(all(feature = "http", feature = "codec"))]
      5 use crate::util::ws_to_http;
      6 
      7 #[cfg(all(feature = "http", feature = "codec"))]
      8 pub async fn fetch_nip11(ws_url: &str) -> Option<RadrootsRelayDocument> {
      9     let http_url = ws_to_http(ws_url)?;
     10     let client = reqwest::Client::new();
     11     client
     12         .get(&http_url)
     13         .header("Accept", "application/nostr+json")
     14         .send()
     15         .await
     16         .ok()?
     17         .json::<RadrootsRelayDocument>()
     18         .await
     19         .ok()
     20 }