mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 16:48:50 +00:00
readme updated
This commit is contained in:
committed by
fiatjaf_
parent
eff9ea9579
commit
666a02027e
20
README.md
20
README.md
@@ -67,9 +67,11 @@ import { SimplePool } from 'nostr-tools/pool'
|
|||||||
|
|
||||||
const pool = new SimplePool()
|
const pool = new SimplePool()
|
||||||
|
|
||||||
// let's query for an event that exists
|
const relays = ['wss://relay.example.com', 'wss://relay.example2.com']
|
||||||
const event = relay.get(
|
|
||||||
['wss://relay.example.com'],
|
// let's query for one event that exists
|
||||||
|
const event = pool.get(
|
||||||
|
relays,
|
||||||
{
|
{
|
||||||
ids: ['d7dd5eb3ab747e16f8d0212d53032ea2a7cadef53837e5a6c66d42849fcb9027'],
|
ids: ['d7dd5eb3ab747e16f8d0212d53032ea2a7cadef53837e5a6c66d42849fcb9027'],
|
||||||
},
|
},
|
||||||
@@ -78,6 +80,18 @@ if (event) {
|
|||||||
console.log('it exists indeed on this relay:', 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's publish a new event while simultaneously monitoring the relay for it
|
||||||
let sk = generateSecretKey()
|
let sk = generateSecretKey()
|
||||||
let pk = getPublicKey(sk)
|
let pk = getPublicKey(sk)
|
||||||
|
|||||||
Reference in New Issue
Block a user