Skip to content

Commit

Permalink
Display error message if LSP cannot open a new channel on LN Address …
Browse files Browse the repository at this point in the history
…page
  • Loading branch information
erdemyerebasmaz committed Apr 14, 2024
1 parent 906ecc9 commit bfb1e7c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/routes/ln_address/ln_address_fee_message.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:math';

import 'package:auto_size_text/auto_size_text.dart';
import 'package:breez_sdk/bridge_generated.dart';
import 'package:breez_translations/breez_translations_locales.dart';
import 'package:c_breez/bloc/account/account_bloc.dart';
Expand All @@ -16,11 +17,29 @@ class LnAddressFeeMessage extends StatelessWidget {

@override
Widget build(BuildContext context) {
final texts = context.texts();
final themeData = Theme.of(context);
final accountState = context.read<AccountBloc>().state;
final lspState = context.watch<LSPBloc>().state;
final isChannelOpeningAvailable = lspState?.isChannelOpeningAvailable ?? false;
final openingFeeParams = lspState?.lspInfo?.openingFeeParamsList.values.first;

if (!isChannelOpeningAvailable && accountState.maxInboundLiquidity <= 0) {
return WarningBox(
boxPadding: const EdgeInsets.fromLTRB(16, 30, 16, 16),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
texts.lsp_error_cannot_open_channel,
style: themeData.textTheme.titleLarge,
textAlign: TextAlign.center,
),
],
),
);
}

return isChannelOpeningAvailable
? WarningBox(
boxPadding: const EdgeInsets.fromLTRB(16, 30, 16, 16),
Expand Down

0 comments on commit bfb1e7c

Please sign in to comment.