add progressring while building transaction
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/OptimisePrivacyViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/OptimisePrivacyViewModel.cs
@@ -5,6 +5,7 @@ using System.Linq;
using System.Reactive.Concurrency;
using System.Reactive.Disposables;
using System.Reactive.Linq;
+using System.Threading.Tasks;
using ReactiveUI;
using WalletWasabi.Blockchain.TransactionBroadcasting;
using WalletWasabi.Blockchain.TransactionBuilding;
@@ -46,13 +47,14 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
protected override void OnNavigatedTo(bool inHistory, CompositeDisposable disposables)
{
- IsBusy = true;
base.OnNavigatedTo(inHistory, disposables);
if (!inHistory)
{
RxApp.MainThreadScheduler.Schedule(async () =>
{
+ IsBusy = true;
+
var intent = new PaymentIntent(
_transactionInfo.Address,
MoneyRequest.CreateAllRemaining(subtractFee: true),
@@ -60,7 +62,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
if (_requestedTransaction.SpentCoins.Count() > 1)
{
- var smallerTransaction = _wallet.BuildTransaction(
+ var smallerTransaction = await Task.Run(() => _wallet.BuildTransaction(
_wallet.Kitchen.SaltSoup(),
intent,
FeeStrategy.CreateFromFeeRate(_transactionInfo.FeeRate),
@@ -69,7 +71,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
.SpentCoins
.OrderBy(x => x.Amount)
.Skip(1)
- .Select(x => x.OutPoint));
+ .Select(x => x.OutPoint)));
_privacySuggestions.Add(new PrivacySuggestionControlViewModel(
_transactionInfo.Amount.ToDecimal(MoneyUnit.BTC), smallerTransaction,
@@ -82,12 +84,12 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
_privacySuggestions.Add(_defaultSelection);
- var largerTransaction = _wallet.BuildTransaction(
+ var largerTransaction = await Task.Run(() => _wallet.BuildTransaction(
_wallet.Kitchen.SaltSoup(),
intent,
FeeStrategy.CreateFromFeeRate(_transactionInfo.FeeRate),
true,
- _requestedTransaction.SpentCoins.Select(x => x.OutPoint));
+ _requestedTransaction.SpentCoins.Select(x => x.OutPoint)));
_privacySuggestions.Add(new PrivacySuggestionControlViewModel(
_transactionInfo.Amount.ToDecimal(MoneyUnit.BTC), largerTransaction,

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
@@ -5,6 +5,7 @@ using System.Linq;
using System.Reactive;
using System.Reactive.Disposables;
using System.Reactive.Linq;
+using System.Threading.Tasks;
using System.Windows.Input;
using Avalonia;
using Avalonia.Threading;
@@ -134,13 +135,14 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
var mixedCoins = wallet.Coins.Where(x => x.HdPubKey.AnonymitySet >= targetAnonymitySet).ToList();
var totalMixedCoinsAmount = Money.FromUnit(mixedCoins.Sum(coin => coin.Amount), MoneyUnit.Satoshi);
+
if (transactionInfo.Amount <= totalMixedCoinsAmount)
{
try
{
try
{
- var txRes = TransactionHelpers.BuildTransaction(wallet, transactionInfo.Address, transactionInfo.Amount, transactionInfo.Labels, transactionInfo.FeeRate, mixedCoins, subtractFee: false);
+ var txRes = await Task.Run(() => TransactionHelpers.BuildTransaction(wallet, transactionInfo.Address, transactionInfo.Amount, transactionInfo.Labels, transactionInfo.FeeRate, mixedCoins, subtractFee: false));
Navigate().To(new OptimisePrivacyViewModel(wallet, transactionInfo, broadcaster, txRes));
return;
}
@@ -151,7 +153,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
if (result.Result)
{
- var txRes = TransactionHelpers.BuildTransaction(wallet, transactionInfo.Address, totalMixedCoinsAmount, transactionInfo.Labels, transactionInfo.FeeRate, mixedCoins, subtractFee: true);
+ var txRes = await Task.Run(() => TransactionHelpers.BuildTransaction(wallet, transactionInfo.Address, totalMixedCoinsAmount, transactionInfo.Labels, transactionInfo.FeeRate, mixedCoins, subtractFee: true));
Navigate().To(new OptimisePrivacyViewModel(wallet, transactionInfo, broadcaster, txRes));
return;
}
@@ -167,6 +169,8 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
Navigate().To(new PrivacyControlViewModel(wallet, transactionInfo, broadcaster));
}, nextCommandCanExecute);
+
+ EnableAutoBusyOn(NextCommand);
}
public ICommand PasteCommand { get; }

MODIFY
WalletWasabi.Fluent/Views/Wallets/Send/SendView.axaml
WalletWasabi.Fluent/Views/Wallets/Send/SendView.axaml
EnableNext="True"
NextContent="Continue"
ClipToBounds="False"
+ IsBusy="{Binding IsBusy}"
ScrollViewer.VerticalScrollBarVisibility="Disabled">
<DockPanel Margin="0 0 0 -32">

add progressring while building transaction