mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 03:59:23 +00:00
fix min sats being stuck at 2500
This commit is contained in:
parent
bfd35e493d
commit
e32203945a
2 changed files with 6 additions and 17 deletions
|
@ -112,9 +112,9 @@ abstract class LightningInvoicePageViewModelBase with Store {
|
|||
}
|
||||
|
||||
Future<void> _fetchLimits() async {
|
||||
List<String> limits = await lightningViewModel.invoiceLimitsSats();
|
||||
minimum = double.parse(limits[0]);
|
||||
maximum = double.parse(limits[1]);
|
||||
List<int> limits = await lightningViewModel.invoiceSoftLimitsSats();
|
||||
minimum = limits[0].toDouble();
|
||||
maximum = limits[1].toDouble();
|
||||
}
|
||||
|
||||
@action
|
||||
|
|
|
@ -37,19 +37,6 @@ abstract class LightningViewModelBase with Store {
|
|||
return res.lnInvoice.bolt11;
|
||||
}
|
||||
|
||||
Future<List<String>> invoiceLimitsSats() async {
|
||||
final sdk = await BreezSDK();
|
||||
ReceivePaymentRequest? req = null;
|
||||
req = ReceivePaymentRequest(
|
||||
amountMsat: 10000 * 1000, // 10000 sats
|
||||
description: "limits",
|
||||
);
|
||||
final res = await sdk.receivePayment(req: req);
|
||||
int min = (res.openingFeeMsat ?? (2500 * 1000)) ~/ 1000;
|
||||
int max = 1000000000 * 1000 * 10; // 10 BTC
|
||||
return [min.toString(), max.toString()];
|
||||
}
|
||||
|
||||
Future<List<int>> invoiceSoftLimitsSats() async {
|
||||
final sdk = await BreezSDK();
|
||||
ReceivePaymentRequest? req = null;
|
||||
|
@ -59,7 +46,6 @@ abstract class LightningViewModelBase with Store {
|
|||
);
|
||||
final res = await sdk.receivePayment(req: req);
|
||||
int min = (res.openingFeeMsat ?? (2500 * 1000)) ~/ 1000;
|
||||
|
||||
int max = 1000000000 * 1000 * 10; // 10 BTC
|
||||
|
||||
int balance = 0;
|
||||
|
@ -68,6 +54,9 @@ abstract class LightningViewModelBase with Store {
|
|||
final nodeState = (await sdk.nodeInfo())!;
|
||||
max = nodeState.inboundLiquidityMsats ~/ 1000;
|
||||
balance = nodeState.channelsBalanceMsat ~/ 1000;
|
||||
if (balance > 0) {
|
||||
min = 0;
|
||||
}
|
||||
} catch (_) {}
|
||||
return [min, max, balance];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue