readme updated

This commit is contained in:
Anderson Juhasc 2025-05-19 09:55:20 -03:00 committed by fiatjaf_
parent eff9ea9579
commit 666a02027e
1 changed files with 17 additions and 3 deletions

View File

@ -67,9 +67,11 @@ import { SimplePool } from 'nostr-tools/pool'
const pool = new SimplePool()
// let's query for an event that exists
const event = relay.get(
['wss://relay.example.com'],
const relays = ['wss://relay.example.com', 'wss://relay.example2.com']
// let's query for one event that exists
const event = pool.get(
relays,
{
ids: ['d7dd5eb3ab747e16f8d0212d53032ea2a7cadef53837e5a6c66d42849fcb9027'],
},
@ -78,6 +80,18 @@ if (event) {
console.log('it exists indeed on this relay:', event)
}
// let's query for more than one event that exists
const events = pool.querySync(
relays,
{
kinds: [1],
limit: 10
},
)
if (events) {
console.log('it exists indeed on this relay:', events)
}
// let's publish a new event while simultaneously monitoring the relay for it
let sk = generateSecretKey()
let pk = getPublicKey(sk)