oc · docs
docs / documentation

@orangecheck/nostr-core


@orangecheck/nostr-core / queryEvents

Function: queryEvents()

function queryEvents(
   filter: Filter, 
   relays?: readonly string[], 
   timeoutMs?: number, 
auth?: AuthSigner): Promise<QueryResult>;

Defined in: index.ts:509

Issue a NIP-01 REQ across all relays in parallel. Returns deduplicated events sorted newest-first plus per-relay status.

Every event a relay returns is checked before it is kept: the id is recomputed, the signature verified, and the filter re-applied. Events that fail are dropped and counted in that relay's rejected; dedupe is keyed on the verified id only.

Default timeout 1500ms — short enough that a momentary blip on any one relay (including relay.ochk.io) never holds up the racing reads. Pass an explicit timeoutMs for slow filters or for use cases where waiting on the slowest relay matters.

Parameters

ParameterTypeDefault value
filterFilterundefined
relaysreadonly string[]DEFAULT_RELAYS
timeoutMsnumber1500
auth?AuthSignerundefined

Returns

Promise&lt;QueryResult>