web_lib

Common web application libraries
git clone https://radroots.dev/git/web_lib.git
Log | Files | Refs | LICENSE

lib.ts (638B)


      1 import { KIND_COMMENT, type RadrootsComment } from "@radroots/events-bindings";
      2 import type { NostrEventFigure, NostrSignedEvent } from "../../types/nostr.js";
      3 import { nostr_event_create } from "../lib.js";
      4 import { tags_comment } from "./tags.js";
      5 
      6 export const nostr_event_comment = async (
      7     opts: NostrEventFigure<{ data: RadrootsComment }>,
      8 ): Promise<NostrSignedEvent | undefined> => {
      9     const { data } = opts;
     10     const tags = await tags_comment(data);
     11     return nostr_event_create({
     12         ...opts,
     13         basis: {
     14             kind: KIND_COMMENT,
     15             content: data.content,
     16             tags,
     17         },
     18     });
     19 };