ZapRequest constructor

ZapRequest({
  1. required String pubKey,
  2. required List<List<String>> tags,
  3. required String content,
  4. String? sig,
})

creates a zap request
pubKey the pubkey of the zap requester
tags the tags of the zap request
content the content of the zap request
sig the signature of the zap request (optional)
returns the zap request \

Implementation

factory ZapRequest({
  required String pubKey,
  required List<List<String>> tags,
  required String content,
  String? sig,
}) {
  final calculatedId = Nip01Utils.calculateEventIdSync(
    pubKey: pubKey,
    createdAt: DateTime.now().millisecondsSinceEpoch ~/ 1000,
    kind: kZapRequestKind,
    tags: tags,
    content: content,
  );

  return ZapRequest._(
    pubKey: pubKey,
    tags: tags,
    content: content,
    id: calculatedId,
    sig: sig,
  );
}