mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-22 07:08:49 +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 {
|
Future<void> _fetchLimits() async {
|
||||||
List<String> limits = await lightningViewModel.invoiceLimitsSats();
|
List<int> limits = await lightningViewModel.invoiceSoftLimitsSats();
|
||||||
minimum = double.parse(limits[0]);
|
minimum = limits[0].toDouble();
|
||||||
maximum = double.parse(limits[1]);
|
maximum = limits[1].toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
|
|
|
@ -37,19 +37,6 @@ abstract class LightningViewModelBase with Store {
|
||||||
return res.lnInvoice.bolt11;
|
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 {
|
Future<List<int>> invoiceSoftLimitsSats() async {
|
||||||
final sdk = await BreezSDK();
|
final sdk = await BreezSDK();
|
||||||
ReceivePaymentRequest? req = null;
|
ReceivePaymentRequest? req = null;
|
||||||
|
@ -59,7 +46,6 @@ abstract class LightningViewModelBase with Store {
|
||||||
);
|
);
|
||||||
final res = await sdk.receivePayment(req: req);
|
final res = await sdk.receivePayment(req: req);
|
||||||
int min = (res.openingFeeMsat ?? (2500 * 1000)) ~/ 1000;
|
int min = (res.openingFeeMsat ?? (2500 * 1000)) ~/ 1000;
|
||||||
|
|
||||||
int max = 1000000000 * 1000 * 10; // 10 BTC
|
int max = 1000000000 * 1000 * 10; // 10 BTC
|
||||||
|
|
||||||
int balance = 0;
|
int balance = 0;
|
||||||
|
@ -68,6 +54,9 @@ abstract class LightningViewModelBase with Store {
|
||||||
final nodeState = (await sdk.nodeInfo())!;
|
final nodeState = (await sdk.nodeInfo())!;
|
||||||
max = nodeState.inboundLiquidityMsats ~/ 1000;
|
max = nodeState.inboundLiquidityMsats ~/ 1000;
|
||||||
balance = nodeState.channelsBalanceMsat ~/ 1000;
|
balance = nodeState.channelsBalanceMsat ~/ 1000;
|
||||||
|
if (balance > 0) {
|
||||||
|
min = 0;
|
||||||
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
return [min, max, balance];
|
return [min, max, balance];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue