feat: add BIP21 support (#414)

Co-authored-by: Erdem Yerebasmaz <erdem@yerebasmaz.com>
Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
This commit is contained in:
yse
2024-08-22 12:23:36 +02:00
committed by GitHub
parent 5248dfc235
commit 1a89bcd6c1
44 changed files with 5039 additions and 3089 deletions

View File

@@ -17,7 +17,7 @@ class _SendPaymentDialogState extends State<SendPaymentDialog> {
bool paymentInProgress = false;
PrepareSendResponse? sendPaymentReq;
SendPaymentRequest? sendPaymentReq;
@override
void initState() {
@@ -50,7 +50,7 @@ class _SendPaymentDialogState extends State<SendPaymentDialog> {
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Please confirm that you agree to the payment fee of ${sendPaymentReq!.feesSat} sats.',
'Please confirm that you agree to the payment fee of ${sendPaymentReq!.prepareResponse.feesSat} sats.',
),
],
),
@@ -84,12 +84,16 @@ class _SendPaymentDialogState extends State<SendPaymentDialog> {
onPressed: () async {
try {
setState(() => paymentInProgress = true);
PrepareSendRequest prepareSendReq =
PrepareSendRequest(invoice: invoiceController.text);
PrepareSendResponse req =
await widget.liquidSdk.prepareSendPayment(req: prepareSendReq);
debugPrint("PrepareSendResponse for ${req.invoice}, fees: ${req.feesSat}");
setState(() => sendPaymentReq = req);
PrepareSendRequest prepareSendReq = PrepareSendRequest(
destination: invoiceController.text,
);
PrepareSendResponse req = await widget.liquidSdk.prepareSendPayment(
req: prepareSendReq,
);
debugPrint(
"PrepareSendResponse for ${req.destination}, fees: ${req.feesSat}",
);
setState(() => sendPaymentReq = SendPaymentRequest(prepareResponse: req));
} catch (e) {
final errMsg = "Error preparing payment: $e";
debugPrint(errMsg);