update kind 41

This commit is contained in:
Ren Amamiya
2023-05-10 17:00:07 +07:00
parent e7bcf6c3f8
commit 62d6f06b39
4 changed files with 43 additions and 42 deletions

View File

@@ -9,7 +9,7 @@ import { DEFAULT_AVATAR, WRITEONLY_RELAYS } from '@stores/constants';
import { dateToUnix } from '@utils/date';
import { useActiveAccount } from '@utils/hooks/useActiveAccount';
import { getChannel, updateChannelMetadata } from '@utils/storage';
import { getChannel } from '@utils/storage';
import { Dialog, Transition } from '@headlessui/react';
import { getEventHash, signEvent } from 'nostr-tools';
@@ -58,15 +58,13 @@ export default function ChannelUpdateModal({ id }: { id: string }) {
created_at: dateToUnix(),
kind: 41,
pubkey: account.pubkey,
tags: [],
tags: [['e', id]],
};
event.id = getEventHash(event);
event.sig = signEvent(event, account.privkey);
// publish channel
pool.publish(event, WRITEONLY_RELAYS);
// update channel metadata in database
updateChannelMetadata(event.id, event.content);
// reset form
reset();
// close modal