From ad7b09b43323d0ffc0a8ddabb43e4838a184c697 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 24 Feb 2026 13:18:42 -0800 Subject: formatting --- lib/nostr.ts | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) (limited to 'lib/nostr.ts') diff --git a/lib/nostr.ts b/lib/nostr.ts index 354f928b..bcb20ea1 100644 --- a/lib/nostr.ts +++ b/lib/nostr.ts @@ -12,13 +12,9 @@ import { Relay } from "nostr-tools/relay"; export const EX = 60 * 60 * 24; const coinos = await Relay.connect(config.nostr); -export const serverSecret = bytesToHex( - nip19.decode(config.nostrKey).data as Uint8Array, -); +export const serverSecret = bytesToHex(nip19.decode(config.nostrKey).data as Uint8Array); -export const serverSecret2 = bytesToHex( - nip19.decode(config.nostrKey2).data as Uint8Array, -); +export const serverSecret2 = bytesToHex(nip19.decode(config.nostrKey2).data as Uint8Array); export const serverPubkey = getPublicKey(hexToBytes(serverSecret)); export const serverPubkey2 = getPublicKey(hexToBytes(serverSecret2)); @@ -54,29 +50,21 @@ export async function handleZap(invoice, sender = undefined) { fail("No tags found"); } - const ptags = zapreq.tags.filter( - (t) => t?.length && t.length >= 2 && t[0] === "p", - ); + const ptags = zapreq.tags.filter((t) => t?.length && t.length >= 2 && t[0] === "p"); if (ptags.length !== 1) { fail("None or multiple p tags found"); } - const etags = zapreq.tags.filter( - (t) => t?.length && t.length >= 2 && t[0] === "e", - ); + const etags = zapreq.tags.filter((t) => t?.length && t.length >= 2 && t[0] === "e"); if (!(etags.length === 0 || etags.length === 1)) { fail("Expected none or 1 e tags"); } - const atags = zapreq.tags.filter( - (t) => t?.length && t.length >= 2 && t[0] === "a", - ); + const atags = zapreq.tags.filter((t) => t?.length && t.length >= 2 && t[0] === "a"); - const relays_tag = zapreq.tags.find( - (t) => t?.length && t.length >= 2 && t[0] === "relays", - ); + const relays_tag = zapreq.tags.find((t) => t?.length && t.length >= 2 && t[0] === "relays"); if (!relays_tag) { fail("No relays tag found"); @@ -168,8 +156,7 @@ export const getCount = async (pubkey) => { if (follows === null) { const result = await get({ authors: [pubkey], kinds: [3] }); follows = result ? result.tags.filter((t) => t[0] === "p").length : 0; - if (follows?.length) - await db.set(`${pubkey}:follows:n`, JSON.stringify(follows), { EX }); + if (follows?.length) await db.set(`${pubkey}:follows:n`, JSON.stringify(follows), { EX }); } const k = `${pubkey}:followers:n`; -- cgit v1.2.3