UNPKG

node-red-contrib-nostr

Version:

Node-RED nodes for seamless Nostr protocol integration. Features robust WebSocket handling, event filtering, and NPUB-based routing. Built with TypeScript for type safety and extensive testing. Perfect for Nostr automation flows.

29 lines (28 loc) 914 B
import WebSocket from 'ws'; import { NostrEvent, NostrFilter } from './types'; export declare class NostrWebSocket extends WebSocket { private subscriptionId; private filter; private onEvent; private onError; constructor(url: string, subscriptionId: string, filter: object, onEvent: (event: NostrEvent) => void, onError: (error: Error) => void); close(): void; } export declare class WebSocketManager { private ws?; private url; private onConnect; private onDisconnect; private onError; constructor(config: { relayUrl: string; onConnect: () => void; onDisconnect: () => void; onError: (error: Error) => void; }); connect(): void; disconnect(): Promise<void>; sendEvent(event: NostrEvent): Promise<void>; subscribe(filters: NostrFilter[]): Promise<string>; unsubscribe(subscriptionId: string): Promise<void>; }