import type { Event, Filter } from 'nostr-tools' import { SimplePool } from 'nostr-tools' /** * Extended SimplePool interface that includes the sub method * The sub method exists in nostr-tools but is not properly typed in the TypeScript definitions */ export interface SimplePoolWithSub extends SimplePool { sub(relays: string[], filters: Filter[]): { on(event: 'event', callback: (event: Event) => void): void on(event: 'eose', callback: () => void): void unsub(): void } } /** * Type guard to check if a SimplePool has the sub method */ export function hasSubMethod(pool: SimplePool): pool is SimplePoolWithSub { return typeof (pool as SimplePoolWithSub).sub === 'function' }