aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/nip17.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-03-06 08:39:18 -0800
committerAdam Soltys <[email protected]>2026-03-06 08:39:18 -0800
commit7e45e1b48c382f29c2d3bd114a4751a0f6b89d51 (patch)
tree7cbfc937afdcccab812d7f97c8f85b681c0d4687 /src/lib/nip17.ts
parent3b18232d52957dbd1a5a0c12891020d2a6e3295e (diff)
downloadcoinos-ui-7e45e1b48c382f29c2d3bd114a4751a0f6b89d51.tar.gz
coinos-ui-7e45e1b48c382f29c2d3bd114a4751a0f6b89d51.zip
group chats
Diffstat (limited to 'src/lib/nip17.ts')
-rw-r--r--src/lib/nip17.ts11
1 files changed, 11 insertions, 0 deletions
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<number> => {
+ 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) => {