fetchZappedReceipts method

Stream<ZapReceipt> fetchZappedReceipts({
  1. required String pubKey,
  2. String? eventId,
  3. Duration? timeout,
})

fetch all zap receipts matching given pubKey and optional event id, in sats

Implementation

Stream<ZapReceipt> fetchZappedReceipts(
    {required String pubKey, String? eventId, Duration? timeout}) {
  NdkResponse? response =
      _requests.query(timeout: timeout ?? Duration(seconds: 10), filters: [
    eventId != null
        ? Filter(kinds: [ZapReceipt.kKind], eTags: [eventId], pTags: [pubKey])
        : Filter(kinds: [ZapReceipt.kKind], pTags: [pubKey])
  ]);
  // TODO how to check validity of zap receipts without nostrPubKey and recipientLnurl????
  return response.stream.map((event) => ZapReceipt.fromEvent(event));
  // List<Nip01Event> events = await response.future;
  // return events.map((event) => ZapReceipt.fromEvent(event)).toList();
}