chore: use latest nostr sdk

This commit is contained in:
2024-10-28 16:19:50 +07:00
parent cfb017f70b
commit d87371aec4
6 changed files with 65 additions and 86 deletions

View File

@@ -50,11 +50,22 @@ pub async fn get_profile(
return Ok(profile.metadata().as_json());
};
let metadata = client
.fetch_metadata(public_key, Some(Duration::from_secs(3)))
let filter = Filter::new()
.author(public_key)
.kind(Kind::Metadata)
.limit(1);
let mut metadata = Metadata::new();
let mut rx = client
.stream_events(vec![filter], Some(Duration::from_secs(5)))
.await
.map_err(|e| e.to_string())?;
while let Some(event) = rx.next().await {
metadata = Metadata::from_json(&event.content).map_err(|e| e.to_string())?;
}
Ok(metadata.as_json())
}