///
import EventEmitter from 'events';
import { Event, Relay, Sub } from 'nostr-tools';
import { RequestOpts } from './interfaces';
export declare class NostrRPC {
relay: string;
self: {
pubkey: string;
secret: string;
};
event: Event | undefined;
[key: string]: any;
events: EventEmitter;
relayCallConnection: Relay | undefined;
relayListenConnection: Relay | undefined;
constructor(opts: {
relay: string;
secretKey: string;
});
initRelayConnection(): Promise;
call({ target, request: { id, method, params }, }: {
target: string;
request: {
id?: string;
method: string;
params?: any[];
};
}, opts?: RequestOpts): Promise;
listen(): Promise;
private handleRequest;
disconnectRelays(): Promise;
}
export declare function now(): number;
export declare function randomID(): string;
export declare function prepareRequest(id: string, method: string, params: any[]): string;
export declare function prepareResponse(id: string, result: any, error: any): string;
export declare function prepareEvent(secretKey: string, pubkey: string, content: string): Promise;
export declare function isValidRequest(payload: any): boolean;
export declare function isValidResponse(payload: any): boolean;
export declare function connectToRelay(realayURL: string): Promise;
export declare function broadcastToRelay(relay: Relay, event: Event, skipSeen?: boolean): Promise;