interface SystemInterface {
    checkSigs: boolean;
    get Sockets(): ConnectionStateSnapshot[];
    get eventsCache(): FeedCache<NostrEvent>;
    get optimizer(): Optimizer;
    get pool(): ConnectionPool;
    get profileLoader(): ProfileLoaderService;
    get relayCache(): RelayCache;
    get relayLoader(): RelayMetadataLoader;
    BroadcastEvent(ev, cb?): Promise<OkResponse[]>;
    ConnectToRelay(address, options): Promise<void>;
    DisconnectRelay(address): void;
    Fetch(req, cb?): Promise<TaggedNostrEvent[]>;
    GetQuery(id): undefined | QueryLike;
    HandleEvent(ev): void;
    Init(): Promise<void>;
    Query(req): QueryLike;
    WriteOnceToRelay(relay, ev): Promise<OkResponse>;
}

Implemented by

Properties

checkSigs: boolean

Check event signatures (reccomended)

Accessors

  • get optimizer(): Optimizer
  • Query optimizer

    Returns Optimizer

  • get pool(): ConnectionPool
  • Main connection pool

    Returns ConnectionPool

  • get relayCache(): RelayCache
  • Relay cache for "Gossip" model

    Returns RelayCache

Methods

  • Send an event to all permanent connections

    Parameters

    • ev: NostrEvent

      Event to broadcast

    • Optional cb: ((rsp) => void)

      Callback to handle OkResponse as they arrive

    Returns Promise<OkResponse[]>

  • Create a new permanent connection to a relay

    Parameters

    • address: string

      Relay URL

    • options: RelaySettings

      Read/Write settings

    Returns Promise<void>

  • Disconnect permanent relay connection

    Parameters

    • address: string

      Relay URL

    Returns void

  • Fetch data from nostr relays asynchronously

    Parameters

    • req: RequestBuilder

      Request to send to relays

    • Optional cb: ((evs) => void)

      A callback which will fire every 100ms when new data is received

    Returns Promise<TaggedNostrEvent[]>

  • Get an active query by ID

    Parameters

    • id: string

      Query ID

    Returns undefined | QueryLike

  • Push an event into the system from external source

    Parameters

    Returns void

  • Do some initialization

    Returns Promise<void>

  • Open a new query to relays

    Parameters

    Returns QueryLike

  • Connect to a specific relay and send an event and wait for the response

    Parameters

    • relay: string

      Relay URL

    • ev: NostrEvent

      Event to send

    Returns Promise<OkResponse>

Generated using TypeDoc