Files
flotilla/src/app/reports.ts
T
2026-06-08 17:07:39 -07:00

27 lines
609 B
TypeScript

import type {TrustedEvent} from "@welshman/util"
import {REPORT, makeEvent} from "@welshman/util"
import {publishThunk} from "@welshman/app"
export type ReportParams = {
event: TrustedEvent
content: string
reason: string
}
export const makeReport = ({event, reason, content}: ReportParams) => {
const tags = [
["p", event.pubkey],
["e", event.id, reason],
]
return makeEvent(REPORT, {content, tags})
}
export const publishReport = ({
relays,
event,
reason,
content,
}: ReportParams & {relays: string[]}) =>
publishThunk({event: makeReport({event, reason, content}), relays})