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