Merge pull request #99 from NicolasDorier/fix-not-found-inv

Fix: BlinkLightningClient.GetInvoice should not crash when the invoice is not found
This commit is contained in:
Andrew Camilleri
2025-07-02 16:32:44 +02:00
committed by GitHub

View File

@@ -179,9 +179,8 @@ query InvoiceByPaymentHash($paymentHash: PaymentHash!, $walletId: WalletId!) {
}
};
var response = await _client.SendQueryAsync<dynamic>(reques, cancellation);
return response.Data is null ? null : ToInvoice(response.Data.me.defaultAccount.walletById.invoiceByPaymentHash);
var result = response.Data?.SelectToken("me.defaultAccount.walletById.invoiceByPaymentHash") as JObject;
return result is null ? null : ToInvoice(result);
}
public LightningInvoice? ToInvoice(JObject invoice)