Skip to content

Commit

Permalink
sdk: add negentropy example
Browse files Browse the repository at this point in the history
  • Loading branch information
yukibtc committed Sep 28, 2023
1 parent 4c5a376 commit fe4b809
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions crates/nostr-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,8 @@ name = "shutdown-on-drop"
name = "subscriptions"
required-features = ["all-nips"]

[[example]]
name = "negentropy"

[[example]]
name = "nip65"
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,21 @@ async fn main() -> Result<()> {

client.connect().await;

let my_items = Vec::new();
let filter = Filter::new()
.author(my_keys.public_key().to_string())
.limit(10);
let relay = client.relay("wss://atl.purplerelay.com").await?;
relay.reconcilie(filter, Vec::new()).await?;
relay.reconcilie(filter, my_items).await?;

client
.handle_notifications(|notification| async {
if let RelayPoolNotification::Event(_url, event) = notification {
println!("{:?}", event);
}
Ok(false) // Set to true to exit from the loop
})
.await?;

Ok(())
}

0 comments on commit fe4b809

Please sign in to comment.