web_lib

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

lib.ts (645B)


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