Structured files/directories and nip01, nip02, nip17 implementation
This commit is contained in:
23
src/nips/nip02.rs
Normal file
23
src/nips/nip02.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
use anyhow::Result;
|
||||
use nostr_sdk::prelude::*;
|
||||
use std::time::Duration;
|
||||
|
||||
/// Ruft das letzte Kontaktlisten-Event (Kind 3) für den Benutzer ab.
|
||||
pub async fn get_contact_list_event(client: &Client) -> Result<Option<Event>> {
|
||||
let signer = client.signer().await?;
|
||||
|
||||
// FIX: Die Methode heißt jetzt get_public_key()
|
||||
let public_key = signer.get_public_key().await?;
|
||||
|
||||
let filter = Filter::new()
|
||||
.author(public_key)
|
||||
.kind(Kind::ContactList)
|
||||
.limit(1);
|
||||
|
||||
let timeout = Duration::from_secs(10);
|
||||
|
||||
// fetch_events nimmt einen einzelnen Filter
|
||||
let events = client.fetch_events(filter, timeout).await?;
|
||||
|
||||
Ok(events.into_iter().next())
|
||||
}
|
||||
Reference in New Issue
Block a user