fecthInvoice method

Future<InvoiceResponse?> fecthInvoice({
  1. required String lud16Link,
  2. required int amountSats,
  3. ZapRequest? zapRequest,
  4. String? comment,
})

creates an invoice with an optional zap request encoded if signer, pubKey & relays are non empty

Implementation

Future<InvoiceResponse?> fecthInvoice(
    {required String lud16Link,
    required int amountSats,
    ZapRequest? zapRequest,
    String? comment}) async {
  final lnurlResponse = await _lnurl.getLnurlResponse(lud16Link);
  if (lnurlResponse == null) {
    return null;
  }

  try {
    return _lnurl.fetchInvoice(
        lnurlResponse: lnurlResponse, amountSats: amountSats, zapRequest: zapRequest);
  } catch (e) {
    Logger.log.d(e);
    return null;
  }
}