From 7e45e1b48c382f29c2d3bd114a4751a0f6b89d51 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 6 Mar 2026 08:39:18 -0800 Subject: group chats --- src/lib/nip17.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/lib/nip17.ts') diff --git a/src/lib/nip17.ts b/src/lib/nip17.ts index 62e1a8b3..c6021339 100644 --- a/src/lib/nip17.ts +++ b/src/lib/nip17.ts @@ -402,6 +402,17 @@ export const subscribeToMessages = async ( return () => closers.forEach((close) => close()); }; +// Lightweight count of new gift wraps since a timestamp (no decryption needed). +export const countNewGiftWraps = async (pubkey: string, since: number): Promise => { + const events = await pool.querySync(DM_RELAYS_LIST, { + kinds: [1059], + "#p": [pubkey], + since, + limit: 100, + }); + return events.length; +}; + // Sends a NIP-17 message from `user` to `recipient`. // If expiryDays is set, messages will expire after that many days. export const send = async (message: string, user: any, recipient: any, expiryDays?: number) => { -- cgit v1.2.3