query method

NdkResponse query({
  1. required List<Filter> filters,
  2. String name = '',
  3. RelaySet? relaySet,
  4. bool cacheRead = true,
  5. bool cacheWrite = true,
  6. int? timeout,
  7. Iterable<String>? explicitRelays,
  8. int? desiredCoverage,
})

Performs a low-level Nostr query

filters A list of filters to apply to the query
name An optional name used as an ID prefix
relaySet An optional set of relays to query
cacheRead Whether to read from cache
cacheWrite Whether to write results to cache
timeout An optional timeout in seconds for the query
explicitRelays A list of specific relays to use, bypassing inbox/outbox
desiredCoverage The number of relays per pubkey to query, default: 2 \

Returns an NdkResponse containing the query result stream, future

Implementation

NdkResponse query({
  required List<Filter> filters,
  String name = '',
  RelaySet? relaySet,
  bool cacheRead = true,
  bool cacheWrite = true,
  int? timeout,
  Iterable<String>? explicitRelays,
  int? desiredCoverage,
}) {
  return requestNostrEvent(NdkRequest.query(
    '$name-${Helpers.getRandomString(10)}',
    name: name,
    filters: filters,
    relaySet: relaySet,
    cacheRead: cacheRead,
    cacheWrite: cacheWrite,
    timeout: timeout,
    explicitRelays: explicitRelays,
    desiredCoverage:
        desiredCoverage ?? RequestDefaults.DEFAULT_BEST_RELAYS_MIN_COUNT,
  ));
}