Skip to content

Instantly share code, notes, and snippets.

@SamSamskies
Last active September 22, 2024 15:46
Show Gist options
  • Save SamSamskies/0088e7a14f3df37550c796481b54d0fe to your computer and use it in GitHub Desktop.
Save SamSamskies/0088e7a14f3df37550c796481b54d0fe to your computer and use it in GitHub Desktop.
#thepoofening
import 'websocket-polyfill'
import {SimplePool, finishEvent, nip19} from 'nostr-tools'
import 'dotenv/config'
const privateKey = nip19.decode(process.env.NOSTR_NSEC).data;
const pool = new SimplePool()
const relays = ['wss://nostr.mutinywallet.com']
const events = await pool.list(relays, [{
kinds: [1, 6, 30023],
authors: ['604e96e099936a104883958b040b47672e0f048c98ac793f37ffe4c720279eb2'],
limit: 256
}])
const tags = events.map(({id}) => ["e", id])
const event = {
kind: 5,
created_at: Math.floor(Date.now() / 1000),
tags,
content: '#thepoofening',
}
const signedEvent = finishEvent(event, privateKey)
const pubs = pool.publish(relays, signedEvent)
await Promise.all(pubs)
console.log(JSON.stringify(signedEvent, null, 2))
console.log(events.length)
process.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment