From d018d341a81c6d9daae9250c617b0b45bd5ed7e7 Mon Sep 17 00:00:00 2001 From: mocodesmo Date: Sun, 5 Jan 2025 16:12:40 +0530 Subject: [PATCH] send fixes --- lib/_repository/network_repository.dart | 11 ++++++++++- lib/_repository/wallet_service.dart | 1 - lib/_ui/app_bar.dart | 3 ++- lib/home/transactions.dart | 5 ++++- lib/network_fees/bloc/networkfees_cubit.dart | 1 + lib/send/bloc/send_cubit.dart | 6 +++++- lib/send/send_page.dart | 6 +++--- lib/transaction/transaction_page.dart | 4 +++- lib/wallet/wallet_txs.dart | 5 ++++- 9 files changed, 32 insertions(+), 10 deletions(-) diff --git a/lib/_repository/network_repository.dart b/lib/_repository/network_repository.dart index c49101d1..c10dcc34 100644 --- a/lib/_repository/network_repository.dart +++ b/lib/_repository/network_repository.dart @@ -226,12 +226,21 @@ class NetworkRepository { } double get pickLiquidFees { + if (testnet) { + switch (_data.value.selectedLiquidNetwork) { + case LiquidElectrumTypes.custom: + case LiquidElectrumTypes.blockstream: + return 0.1; + case LiquidElectrumTypes.bullbitcoin: + return 0.1; + } + } switch (_data.value.selectedLiquidNetwork) { case LiquidElectrumTypes.custom: case LiquidElectrumTypes.blockstream: return 0.1; case LiquidElectrumTypes.bullbitcoin: - return 0.01; // 0.01; TODO: Sai for liquid testnet + return 0.01; } } diff --git a/lib/_repository/wallet_service.dart b/lib/_repository/wallet_service.dart index 2feb0545..50a4a149 100644 --- a/lib/_repository/wallet_service.dart +++ b/lib/_repository/wallet_service.dart @@ -320,7 +320,6 @@ class WalletService { updateTypes: [ UpdateWalletTypes.transactions, UpdateWalletTypes.addresses, - UpdateWalletTypes.transactions, UpdateWalletTypes.utxos, ], ); diff --git a/lib/_ui/app_bar.dart b/lib/_ui/app_bar.dart index de2f6d02..8e7613d8 100644 --- a/lib/_ui/app_bar.dart +++ b/lib/_ui/app_bar.dart @@ -32,7 +32,8 @@ class BBAppBar extends StatelessWidget { ).animate(delay: 100.ms).fadeIn(), ), ], - const Spacer(), + // const Spacer(), + const Gap(16), Padding( padding: const EdgeInsets.only(bottom: 8), child: BBText.titleLarge( diff --git a/lib/home/transactions.dart b/lib/home/transactions.dart index 95962a4c..514e22e9 100644 --- a/lib/home/transactions.dart +++ b/lib/home/transactions.dart @@ -283,7 +283,10 @@ class HomeTxItem2 extends StatelessWidget { // final showOnlySwap = tx.pageLayout == TxLayout.onlySwapTx; // if (showOnlySwap) return _SwapTxHomeListItem(transaction: tx); - final label = tx.label ?? ''; + final label = (tx.label != null && tx.label!.length > 20) + ? '${tx.label!.substring(0, 20)}...' + : tx.label ?? ''; + final isReceive = tx.isReceived(); final amount = context.select( diff --git a/lib/network_fees/bloc/networkfees_cubit.dart b/lib/network_fees/bloc/networkfees_cubit.dart index ac04b9cc..675baaeb 100644 --- a/lib/network_fees/bloc/networkfees_cubit.dart +++ b/lib/network_fees/bloc/networkfees_cubit.dart @@ -68,6 +68,7 @@ class NetworkFeesCubit extends Cubit { Future loadFees() async { emit(state.copyWith(loadingFees: true, errLoadingFees: '')); final testnet = _networkRepository.testnet; + await Future.delayed(const Duration(milliseconds: 50)); final (fees, err) = await _mempoolAPI.getFees(testnet); if (err != null) { diff --git a/lib/send/bloc/send_cubit.dart b/lib/send/bloc/send_cubit.dart index 05575bbe..ccdf1733 100644 --- a/lib/send/bloc/send_cubit.dart +++ b/lib/send/bloc/send_cubit.dart @@ -1082,7 +1082,11 @@ class SendCubit extends Cubit { return feeAmt ?? 0; } - Future processSendButton(String label, int feeRate, int amt) async { + Future processSendButton({ + required String label, + required int feeRate, + required int amt, + }) async { final network = _networkRepository.getBBNetwork; final (_, addressError) = await state.getPaymentNetwork(state.address, network); diff --git a/lib/send/send_page.dart b/lib/send/send_page.dart index ba3dd20f..dd4599a4 100644 --- a/lib/send/send_page.dart +++ b/lib/send/send_page.dart @@ -633,9 +633,9 @@ class _SendButton extends StatelessWidget { .state .selectedOrFirst(true); context.read().processSendButton( - txLabel, - amt, - feeRate, + label: txLabel, + feeRate: feeRate, + amt: amt, ); }, label: buttonLabel, diff --git a/lib/transaction/transaction_page.dart b/lib/transaction/transaction_page.dart index 93581cc4..0f7d2691 100644 --- a/lib/transaction/transaction_page.dart +++ b/lib/transaction/transaction_page.dart @@ -118,9 +118,11 @@ class _TxAppBar extends StatelessWidget { @override Widget build(BuildContext context) { - final label = + var label = context.select((TransactionCubit cubit) => cubit.state.tx.label ?? ''); + label = (label.length > 20) ? '${label.substring(0, 20)}...' : label; + return BBAppBar( text: label.isNotEmpty ? label : 'Transaction', onBack: () { diff --git a/lib/wallet/wallet_txs.dart b/lib/wallet/wallet_txs.dart index 6b8650df..b83b33a5 100644 --- a/lib/wallet/wallet_txs.dart +++ b/lib/wallet/wallet_txs.dart @@ -132,7 +132,10 @@ class HomeTxItem extends StatelessWidget { @override Widget build(BuildContext context) { - final label = tx.label ?? ''; + // final label = tx.label ?? ''; + final label = (tx.label != null && tx.label!.length > 20) + ? '${tx.label!.substring(0, 20)}...' + : tx.label ?? ''; final isReceive = tx.isReceived(); var amount = context.select(