Skip to content

Commit

Permalink
naming, imports
Browse files Browse the repository at this point in the history
  • Loading branch information
leo-lox committed Dec 23, 2024
1 parent e02ac37 commit 8857ff4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ class InvoiceResponse {
String? nostrPubkey;

/// .
InvoiceResponse({required this.invoice, this.nostrPubkey, required this.amountSats});
InvoiceResponse(
{required this.invoice, this.nostrPubkey, required this.amountSats});
}
31 changes: 26 additions & 5 deletions packages/ndk/lib/domain_layer/usecases/zaps/zap_receipt.dart
Original file line number Diff line number Diff line change
@@ -1,23 +1,44 @@
import 'dart:convert';

import 'package:ndk/domain_layer/entities/nip_01_event.dart';
import 'package:ndk/domain_layer/usecases/lnurl/lnurl.dart';

import '../../../shared/logger/logger.dart';
import '../../entities/nip_01_event.dart';
import '../lnurl/lnurl.dart';

class ZapReceipt {
/// zap receipt kind
static const KIND = 9735;

/// time payment happend
int? paidAt;

/// amount in sats
int? amountSats;

/// pubKey
String? pubKey;

/// invoice
String? bolt11;

/// invoice preimage
String? preimage;

/// pubkey of recipient
String? recipient;

/// nostr eventId
String? eventId;

/// user defined comment
String? comment;

/// pubkey sender
String? sender;

///
String? anon;

/// lnurl
String? lnurl;

ZapReceipt.fromEvent(Nip01Event event) {
Expand Down Expand Up @@ -70,13 +91,13 @@ class ZapReceipt {
return false;
}
// - The invoiceAmount contained in the bolt11 tag of the zap receipt MUST equal the amount tag of the zap request (if present).
if (bolt11!=null && bolt11!.isNotEmpty) {
if (bolt11 != null && bolt11!.isNotEmpty) {
if (amountSats != Lnurl.getAmountFromBolt11(bolt11!)) {
return false;
}
}
// - The lnurl tag of the zap request (if present) SHOULD equal the recipient's lnurl.
if (lnurl!=null && lnurl!.isNotEmpty) {
if (lnurl != null && lnurl!.isNotEmpty) {
if (lnurl != recipientLnurl) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:ndk/domain_layer/entities/nip_01_event.dart';
import '../../entities/nip_01_event.dart';

/// Zap Request
class ZapRequest extends Nip01Event {
Expand Down
2 changes: 1 addition & 1 deletion packages/ndk/lib/domain_layer/usecases/zaps/zaps.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import '../nwc/nwc.dart';
import '../nwc/nwc_connection.dart';
import '../nwc/responses/pay_invoice_response.dart';
import '../requests/requests.dart';
import 'Invoice_response.dart';
import 'invoice_response.dart';
import 'zap_receipt.dart';
import 'zap_request.dart';

Expand Down

0 comments on commit 8857ff4

Please sign in to comment.