Why Nostr? What is Njump?
2024-08-02 14:58:13
in reply to

Yuki Kishimoto on Nostr: Weird, I'm not able to reproduce the issue. Can you provide a simple example to ...

Weird, I'm not able to reproduce the issue.

Can you provide a simple example to reproduce it?

I tried this but works:

```rust
use nostr_sdk::prelude::*;

#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt::init();

let database = SQLiteDatabase::open("./db/sqlite.db").await?;
let client: Client = ClientBuilder::default().database(database).build();

client.add_relay("wss://relay.damus.io").await?;
client.connect().await;

// Negentropy reconcile
let filter = Filter::new().kind(Kind::GitRepoAnnouncement);
client
.reconcile(filter, NegentropyOptions::default())
.await?;

// Query events from database
let coordinate = [
// rust-nostr repo
Coordinate::parse("naddr1qq98yatnwskkummnw3eqz9thwden5te0wp6hyurvv4ex2mrp0yhxxmmdqgsx3kq3vkgczq9hmfplc28h687py42yvms3zkyxh8nmkvn0vhkyyusrqsqqqaue3uzvg2")?,
// example repo
Coordinate::parse("naddr1qqrkxcf3xyuxzcgpp4mhxue69uhkummn9ekx7mqzyzsq3hh327t0h2dq6matqn5064cgj2zanl2stkj6s0lg4t2h5dty6qcyqqq80xg2w8nml")?
];
let filter = Filter::new()
.kind(Kind::GitRepoAnnouncement)
.identifiers(
coordinate
.iter()
.map(|c| c.identifier.clone())
.collect::<Vec<String>>(),
)
.authors(
coordinate
.iter()
.map(|c| c.public_key)
.collect::<Vec<PublicKey>>(),
);
let events = client.database().query(vec![filter], Order::Desc).await?;
for event in events.into_iter() {
println!("{}", event.as_json());
}

Ok(())
}
```

The output that I receive is:
```json
{"id":"7f7a9fac2584002b6beb97d62989affdbd4b13659b277fa9d90a034f44dbdee2","pubkey":"a008def15796fba9a0d6fab04e8fd57089285d9fd505da5a83fe8aad57a3564d","created_at":1722589461,"kind":30617,"tags":[["d","ca118aa"],["r","ca118aac0e3fa285da167a315f3e68b2654ff792","euc"],["name","Example Repo"],["description","demonstrate ngit and gitworkshop features"],["clone","https://github.com/DanConwayDev/ExampleRepo.git";],["web","https://gitworkshop.dev/repo/ca118aa";],["relays","wss://relay.nostr.band/","wss://nos.lol/","wss://relay.damus.io/"],["maintainers","a008def15796fba9a0d6fab04e8fd57089285d9fd505da5a83fe8aad57a3564d"],["alt","git repository: Example Repo"]],"content":"","sig":"d5e9ef370add7e06f9b5706a40674a47597c4dfa0961fc77db4aa76108b2423bd331ddcffdedd0ff1513c6b75263e85b8c9a6d85435a68845d08300b889ce915"}
{"id":"6988cf03ed1e6f4c684ef04997b087820fb36bc6650912bc241e45d35db8fb53","pubkey":"68d81165918100b7da43fc28f7d1fc12554466e1115886b9e7bb326f65ec4272","created_at":1719967094,"kind":30617,"tags":[["d","rust-nostr"],["r","73f7c34fd424cae57a0da1be1f5fd31d9b8075c0"],["name","rust-nostr"],["description","Nostr protocol implementation, SDK and FFI"],["clone","https://github.com/rust-nostr/nostr.git";],["web","https://rust-nostr.org";],["relays","wss://relay.damus.io","wss://nos.lol","wss://nostr.mom","wss://nostr.oxtr.dev","wss://relay.nostr.bg"],["maintainers","68d81165918100b7da43fc28f7d1fc12554466e1115886b9e7bb326f65ec4272"]],"content":"","sig":"84af432928a39f892b117e86c2bd205fa3dc2e840e3373eb1229a0719707f5f5621e7379a48a6ef309a33089b29cdb8b0f2bb0d8f432e443586f29117a968f11"}
```
Author Public Key
npub1drvpzev3syqt0kjrls50050uzf25gehpz9vgdw08hvex7e0vgfeq0eseet