mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-22 18:54:47 +00:00
save before adding translations
This commit is contained in:
parent
45595250db
commit
8633eb6a70
2 changed files with 35 additions and 3 deletions
|
@ -171,11 +171,24 @@ class LightningInvoicePage extends BasePage {
|
|||
child:
|
||||
Container(child: Center(child: CircularProgressIndicator())));
|
||||
}
|
||||
String min = (snapshot.data as List<String>)[0];
|
||||
min = satsToLightningString(double.parse(min));
|
||||
late String min;
|
||||
bool zeroBalance = false;
|
||||
if (zeroBalance) {
|
||||
min = (snapshot.data as List<String>)[0];
|
||||
min = satsToLightningString(double.parse(min));
|
||||
min = S.of(context).lightning_invoice_min(min);
|
||||
} else {
|
||||
min = (snapshot.data as List<String>)[0];
|
||||
String max = (snapshot.data as List<String>)[1];
|
||||
min = satsToLightningString(double.parse(min));
|
||||
max = satsToLightningString(double.parse(max));
|
||||
// min = S.of(context).lightning_invoice_min_max(min, max);
|
||||
min = "$min $max";
|
||||
}
|
||||
|
||||
return Expanded(
|
||||
child: Text(
|
||||
S.of(context).lightning_invoice_min(min),
|
||||
min,
|
||||
maxLines: 4,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
|
|
|
@ -49,4 +49,23 @@ abstract class LightningViewModelBase with Store {
|
|||
int max = 1000000000 * 1000 * 10; // 10 BTC
|
||||
return [min.toString(), max.toString()];
|
||||
}
|
||||
|
||||
Future<List<String>> invoiceSoftLimitsSats() 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
|
||||
|
||||
try {
|
||||
final nodeState = (await sdk.nodeInfo())!;
|
||||
max = nodeState.inboundLiquidityMsats ~/ 1000;
|
||||
} catch (_) {}
|
||||
return [min.toString(), max.toString()];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue