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