Are there any #nostr request example repositories or anything out there? For example what does requesting a profile look like, or requesting all profiles etc.
Discussion
I can help with. Have you looked at nostr-tools? Can you be more specific on what you are looking for??
Thanks! Yeah I was trying to run a query for all profiles on a relay
Nostr-tools is your best friend. You can run it on the terminal and watch the data you get..!
Nice! You just write a node script? What’s your process?
right. Start with a node init and npm install nostr-tools. Here’s a simple connect and log events.
const {WebSocket} = require('websocket-polyfill');
const {
SimplePool
} = require('nostr-tools');
async function run() {
let relays = ['wss://nos.lol',
'wss://nostr1.current.fyi',
'wss://eden.nostr.land',
'wss://relay.current.fyi',
'wss://nos.lol',
'wss://nostr21.com',
'wss://spore.ws',
'wss://nostr.bitcoiner.social',
'wss://offchain.pub',
'wss://relay.plebstr.com',
'wss://nostr.mom',
'wss://no.str.cr',
'wss://relay.nostr.bg',
'wss://nostr.oxtr.dev',
'wss://relay.snort.social',
'wss://relay.nostr.bg',
'wss://no.str.cr',
'wss://nostr.wine',
'wss://nostr-pub.wellorder.net',
'wss://nostr-relay.nokotaro.com',
'wss://relay.nostr.wirednet.jp'
]
const pool = new SimplePool();
let sub = pool.sub(
relays,
[
{
limit: 100,
kinds: [1],
//tags: ['t']
authors: ['c7063ccd7e9adc0ddd4b77c6bfabffc8399b41e24de3a668a6ab62ede2c8aabd']
}
]
)
sub.on('event', async event => {
console.log(event);
})
}
run().catch(console.log);
Thanks 🤙
I have used nostr-tools so that would work
Might check out NDK as well https://ndk.fyi
Thanks! I will