From 6de48f168be5b754b1a1379b19f3ada1489ab2e4 Mon Sep 17 00:00:00 2001 From: Rodrigo Sanchez Date: Thu, 22 Jun 2023 18:12:48 +0200 Subject: [PATCH] Fee > 0, show not finalized wallets, try catch utxo list --- src/Pages/ChannelRequests.razor | 6 +++--- src/Pages/Wallets.razor | 3 ++- src/Shared/UTXOSelectorModal.razor | 20 +++++++++++++++----- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/Pages/ChannelRequests.razor b/src/Pages/ChannelRequests.razor index 18b11cc5..648c680e 100644 --- a/src/Pages/ChannelRequests.razor +++ b/src/Pages/ChannelRequests.razor @@ -168,7 +168,7 @@ Custom - + @@ -411,7 +411,7 @@ private UTXOSelectorModal _utxoSelectorModalRef; private List SelectedUTXOs = new(); private MempoolRecommendedFeesTypes FeesSelection; - private long FeeAmount; + private long FeeAmount = 1; private MempoolRecommendedFees? _recommendedFees; // New Request integration @@ -947,7 +947,7 @@ FeeAmount = _recommendedFees.HalfHourFee; break; case MempoolRecommendedFeesTypes.CustomFee: - FeeAmount = 0; + FeeAmount = 1; break; } } diff --git a/src/Pages/Wallets.razor b/src/Pages/Wallets.razor index ee70ab66..1f48b35d 100644 --- a/src/Pages/Wallets.razor +++ b/src/Pages/Wallets.razor @@ -395,7 +395,8 @@ private async Task GetData() { - _wallets = _showNotAvailableWallets ? (await WalletRepository.GetAll()).Where(x => x.IsArchived || x.IsCompromised).ToList() : await WalletRepository.GetAvailableWallets(); + var allWallets = await WalletRepository.GetAll(); + _wallets = _showNotAvailableWallets ? allWallets.Where(x => x.IsArchived || x.IsCompromised).ToList() : allWallets.Where(x => !x.IsArchived && !x.IsCompromised).ToList(); var financeManagers = (await ApplicationUserRepository.GetUsersInRole(ApplicationUserRole.FinanceManager)); _financeManagers = financeManagers.Where(x => x.Keys.Any()).ToList(); diff --git a/src/Shared/UTXOSelectorModal.razor b/src/Shared/UTXOSelectorModal.razor index f763139c..57ad10e5 100644 --- a/src/Shared/UTXOSelectorModal.razor +++ b/src/Shared/UTXOSelectorModal.razor @@ -161,12 +161,22 @@ { limit = 0; } - var utxosList = await CoinSelectionService.GetAvailableUTXOsAsync(SelectedWallet.GetDerivationStrategy(), _selectedStrategy, limit, new Money(_amount, MoneyUnit.BTC).Satoshi, new Money(_closestTo, MoneyUnit.BTC).Satoshi); - UTXOList = utxosList; + try + { + var utxosList = await CoinSelectionService.GetAvailableUTXOsAsync(SelectedWallet.GetDerivationStrategy(), _selectedStrategy, limit, new Money(_amount, MoneyUnit.BTC).Satoshi, new Money(_closestTo, MoneyUnit.BTC).Satoshi); + UTXOList = utxosList; + + // Refresh the list with the new objects, or selection wont be preserved + var hashes = SelectedUTXOs.Select(utxos => utxos.Outpoint.Hash); + SelectedUTXOs = utxosList.Where(utxo => hashes.Contains(utxo.Outpoint.Hash)).ToList(); + } + catch + { + UTXOList = new(); + SelectedUTXOs = new(); + ToastService.ShowError("There was an unexpected error trying to get the UTXOs, please try again later."); + } - // Refresh the list with the new objects, or selection wont be preserved - var hashes = SelectedUTXOs.Select(utxos => utxos.Outpoint.Hash); - SelectedUTXOs = utxosList.Where(utxo => hashes.Contains(utxo.Outpoint.Hash)).ToList(); _btcPrice = PriceConversionHelper.GetBtcToUsdPrice(); await _modalRef.Show();