[skipci] save

This commit is contained in:
Matthew Fosse 2024-03-07 10:17:56 -08:00
parent f6dfe935d6
commit 21da36f268
4 changed files with 24 additions and 6 deletions

View file

@ -172,11 +172,12 @@ class LightningInvoicePage extends BasePage {
InvoiceSoftLimitsResult limits =
snapshot.data as InvoiceSoftLimitsResult;
if (limits.inboundLiquidity == 0) {
finalText = S
.of(context)
.lightning_invoice_min(lightning!.satsToLightningString(limits.minFee));
finalText = S.of(context).lightning_invoice_min(
limits.feePercent.toString(),
lightning!.satsToLightningString(limits.minFee));
} else {
finalText = S.of(context).lightning_invoice_min_max(
limits.feePercent.toString(),
lightning!.satsToLightningString(limits.minFee),
lightning!.satsToLightningString(limits.inboundLiquidity),
);

View file

@ -213,6 +213,7 @@ class LightningReceiveOnchainPage extends BasePage {
S.of(context).lightning_receive_limits(
lightning!.satsToLightningString(results.minAllowedDeposit),
lightning!.satsToLightningString(results.maxAllowedDeposit),
results.feePercent.toString(),
lightning!.satsToLightningString(results.fee),
),
maxLines: 10,

View file

@ -23,7 +23,7 @@ class QrImage extends StatelessWidget {
return qr.QrImageView(
data: data,
errorCorrectionLevel: errorCorrectionLevel,
version: 9,// Previous value: 7 something happened after flutter upgrade monero wallets addresses are longer than ver. 7 ???
version: version ?? 9,// Previous value: 7 something happened after flutter upgrade monero wallets addresses are longer than ver. 7 ???
size: size,
foregroundColor: foregroundColor,
backgroundColor: backgroundColor,

View file

@ -23,12 +23,26 @@ abstract class LightningViewModelBase with Store {
BZG.SwapInfo swapInfo = await sdk.receiveOnchain(req: req);
print("Minimum amount allowed to deposit in sats: ${swapInfo.minAllowedDeposit}");
print("Maximum amount allowed to deposit in sats: ${swapInfo.maxAllowedDeposit}");
int fee = swapInfo.channelOpeningFees?.minMsat ?? 2000;
fee = fee ~/ 1000;
int fee = 0;
double feePercent = 0;
try {
final nodeState = (await sdk.nodeInfo())!;
int inboundLiquidity = nodeState.inboundLiquidityMsats ~/ 1000;
final openingFees = await sdk.openChannelFee(
req: BZG.OpenChannelFeeRequest(amountMsat: inboundLiquidity + 1));
if (openingFees.usedFeeParams != null) {
feePercent = (openingFees.usedFeeParams!.proportional * 100) / 1000000;
fee = openingFees.usedFeeParams!.minMsat ~/ 1000;
}
} catch (_) {}
return ReceiveOnchainResult(
bitcoinAddress: swapInfo.bitcoinAddress,
minAllowedDeposit: swapInfo.minAllowedDeposit,
maxAllowedDeposit: swapInfo.maxAllowedDeposit,
feePercent: feePercent,
fee: fee,
);
}
@ -88,12 +102,14 @@ class ReceiveOnchainResult {
final int minAllowedDeposit;
final int maxAllowedDeposit;
final int fee;
final double feePercent;
ReceiveOnchainResult({
required this.bitcoinAddress,
required this.minAllowedDeposit,
required this.maxAllowedDeposit,
required this.fee,
required this.feePercent,
});
}