aboutsummaryrefslogtreecommitdiffstats
path: root/src/nostr.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-01 12:30:57 -0700
committerAdam Soltys <[email protected]>2026-08-01 12:30:57 -0700
commit37989576d91d21b4f727a67470eef9e07e85dd07 (patch)
treead6f3e97d93208245c38368bbfbe10c5a86e3254 /src/nostr.js
parentcdfda57c06e60ea235e54815a7734ad66484016f (diff)
downloadcoinosv3-37989576d91d21b4f727a67470eef9e07e85dd07.tar.gz
coinosv3-37989576d91d21b4f727a67470eef9e07e85dd07.zip
Pass a single filter to subscribeMany — arrays are rejected by relays
nostr-tools ≥2.23 changed subscribeMany to take one filter object; the old array form now serializes as ["REQ",id,[{...}]], which every relay answers with CLOSED "provided filter is not an object". That killed the NWC request subscription (the Amethyst forever-spinner), the device-sync live subscription, and the push notifier's relay watch — all silently. Co-Authored-By: Claude Fable 5 <[email protected]>
Diffstat (limited to 'src/nostr.js')
-rw-r--r--src/nostr.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nostr.js b/src/nostr.js
index 0b902e1..e1f1c14 100644
--- a/src/nostr.js
+++ b/src/nostr.js
@@ -29,7 +29,10 @@ const pool = new SimplePool();
// request lands somewhere the wallet isn't and it waits forever.
export function subscribeOn(relays, filter, onEvent, extra = {}) {
try {
- const sub = pool.subscribeMany(relays, [filter], { onevent: onEvent, ...extra });
+ // nostr-tools ≥2.23 takes a single filter object here; wrapping it in an
+ // array serializes as ["REQ",id,[{...}]] which every relay rejects with
+ // "provided filter is not an object" — and the subscription dies silently.
+ const sub = pool.subscribeMany(relays, filter, { onevent: onEvent, ...extra });
return () => { try { sub.close(); } catch {} };
} catch { return () => {}; }
}
@@ -247,7 +250,8 @@ export class NostrSync {
// Live subscription; returns an unsubscribe function.
subscribeEvents(filter, onEvent) {
try {
- const sub = pool.subscribeMany(this.relays, [filter], { onevent: onEvent });
+ // single filter object — see subscribeOn for the array-wrapping trap
+ const sub = pool.subscribeMany(this.relays, filter, { onevent: onEvent });
return () => { try { sub.close(); } catch {} };
} catch { return () => {}; }
}