From d3e830ee2dd12f4d03cc46f0a78a997438860cf0 Mon Sep 17 00:00:00 2001 From: fosse Date: Tue, 27 Feb 2024 14:24:02 -0500 Subject: [PATCH] save --- lib/src/screens/receive/lightning_invoice_page.dart | 2 +- lib/src/screens/receive/lightning_receive_page.dart | 11 ++++++++--- lib/view_model/lightning_view_model.dart | 5 +++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/src/screens/receive/lightning_invoice_page.dart b/lib/src/screens/receive/lightning_invoice_page.dart index f69d6aad5..9c878add0 100644 --- a/lib/src/screens/receive/lightning_invoice_page.dart +++ b/lib/src/screens/receive/lightning_invoice_page.dart @@ -167,7 +167,7 @@ class LightningInvoicePage extends BasePage { min = bitcoinAmountToLightningString(amount: int.parse(min) ~/ 1000); return Expanded( child: Text( - S.of(context).lightning_invoice_min(min), + /*S.of(context).lightning_invoice_min(min)*/"Needs fixing!", maxLines: 3, style: TextStyle( fontSize: 14, diff --git a/lib/src/screens/receive/lightning_receive_page.dart b/lib/src/screens/receive/lightning_receive_page.dart index a54bcc389..15a11cae1 100644 --- a/lib/src/screens/receive/lightning_receive_page.dart +++ b/lib/src/screens/receive/lightning_receive_page.dart @@ -201,16 +201,21 @@ class LightningReceiveOnchainPage extends BasePage { child: Image.asset("assets/images/warning.png"), ), FutureBuilder( - future: lightningViewModel.invoiceLimitsSats(), + future: lightningViewModel.receiveOnchain(), builder: (context, snapshot) { if (snapshot.data == null) { return SizedBox(); } - String min = (snapshot.data as List)[0]; + String min = (snapshot.data as List)[1]; + String max = (snapshot.data as List)[2]; + String fee = (snapshot.data as List)[3]; min = bitcoinAmountToLightningString(amount: int.parse(min) ~/ 1000); + max = bitcoinAmountToLightningString(amount: int.parse(min) ~/ 1000); + fee = bitcoinAmountToLightningString(amount: int.parse(min) ~/ 1000); return Expanded( child: Text( - "Send more than 20,029 sats and up to 3,998,387 sats to this address. A setup fee of 0.4% with a minimum of 2,079 sats will be applied upon receiving this invoice. This will convert any received Bitcoin into Lightning. An on-chain fee will be applied. This address can only be used once.", + // S.of(context).lightning_receive_limits(min, max, fee), + "Needs fixing!: $min, $max, $fee", maxLines: 10, style: TextStyle( fontSize: 14, diff --git a/lib/view_model/lightning_view_model.dart b/lib/view_model/lightning_view_model.dart index 3f8e66518..e6e5feb1c 100644 --- a/lib/view_model/lightning_view_model.dart +++ b/lib/view_model/lightning_view_model.dart @@ -18,13 +18,13 @@ abstract class LightningViewModelBase with Store { ReceiveOnchainRequest req = const ReceiveOnchainRequest(); SwapInfo swapInfo = await sdk.receiveOnchain(req: req); - print(swapInfo.bitcoinAddress); print("Minimum amount allowed to deposit in sats: ${swapInfo.minAllowedDeposit}"); print("Maximum amount allowed to deposit in sats: ${swapInfo.maxAllowedDeposit}"); return [ swapInfo.bitcoinAddress, swapInfo.minAllowedDeposit.toString(), - swapInfo.maxAllowedDeposit.toString() + swapInfo.maxAllowedDeposit.toString(), + swapInfo.channelOpeningFees?.minMsat.toString() ?? "2000", ]; } @@ -45,6 +45,7 @@ abstract class LightningViewModelBase with Store { description: "limits", ); final res = await sdk.receivePayment(req: req); + final res = await sdk. int min = (res.openingFeeMsat ?? (2500 * 1000)); int max = 1000000000 * 1000 * 10;// 10 BTC return [min.toString(), max.toString()];