From 69a7b8e89a0add6c86791bf00b4f62cde2aca6ff Mon Sep 17 00:00:00 2001 From: Patrick Ulrich Date: Mon, 26 Jan 2026 01:17:03 -0500 Subject: [PATCH] fix(nostr): correct nostr-tools API usage for subscribe and publish Two bugs fixed: 1. subscribeMany filter incorrectly wrapped in array - Was: `pool.subscribeMany(relays, [{ kinds: [4], ... }], ...)` - Fix: `pool.subscribeMany(relays, { kinds: [4], ... }, ...)` - subscribeMany expects `Filter`, not `Filter[]` - This prevented inbound NIP-04 DMs from being received 2. publish return value not properly awaited - Was: `await pool.publish([relay], event)` - Fix: `await pool.publish([relay], event)[0]` - publish returns `Promise[]`, not `Promise` - Awaiting an array doesn't resolve the promises inside - This meant errors weren't caught and success was assumed prematurely --- extensions/nostr/src/nostr-bus.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/nostr/src/nostr-bus.ts b/extensions/nostr/src/nostr-bus.ts index 25ae6f082..810d0a479 100644 --- a/extensions/nostr/src/nostr-bus.ts +++ b/extensions/nostr/src/nostr-bus.ts @@ -512,7 +512,7 @@ export async function startNostrBus( const sub = pool.subscribeMany( relays, - [{ kinds: [4], "#p": [pk], since }], + { kinds: [4], "#p": [pk], since }, { onevent: handleEvent, oneose: () => { @@ -657,7 +657,7 @@ async function sendEncryptedDm( const startTime = Date.now(); try { - await pool.publish([relay], reply); + await pool.publish([relay], reply)[0]; const latency = Date.now() - startTime; // Record success