import { AccountContext } from '@components/accountProvider'; import { RelayContext } from '@components/relaysProvider'; import { WRITEONLY_RELAYS } from '@stores/constants'; import { dateToUnix } from '@utils/getDate'; import { getEventHash, signEvent } from 'nostr-tools'; import { useContext, useState } from 'react'; export default function FormComment({ eventID }: { eventID: any }) { const pool: any = useContext(RelayContext); const activeAccount: any = useContext(AccountContext); const [value, setValue] = useState(''); const profile = JSON.parse(activeAccount.metadata); const submitEvent = () => { const event: any = { content: value, created_at: dateToUnix(), kind: 1, pubkey: activeAccount.pubkey, tags: [['e', eventID]], }; event.id = getEventHash(event); event.sig = signEvent(event, activeAccount.privkey); // publish note pool.publish(event, WRITEONLY_RELAYS); // send notification // sendNotification('Comment has been published successfully'); }; return (
{activeAccount.pubkey}