wire up screens.
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/OptimisePrivacyViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/OptimisePrivacyViewModel.cs
using NBitcoin;
-using System.Collections;
-using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive.Concurrency;
using System.Reactive.Disposables;
+using System.Reactive.Linq;
using ReactiveUI;
using WalletWasabi.Blockchain.TransactionBuilding;
-using WalletWasabi.Blockchain.TransactionOutputs;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Wallets;
@@ -31,6 +29,12 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
_transactionInfo = transactionInfo;
_privacySuggestions = new ObservableCollection<PrivacySuggestionControlViewModel>();
+
+ NextCommand = ReactiveCommand.Create(() =>
+ {
+ Navigate().To(new TransactionPreviewViewModel(wallet, transactionInfo,
+ SelectedPrivacySuggestion!.TransactionResult));
+ }, this.WhenAnyValue(x => x.SelectedPrivacySuggestion).Select(x => x is { }));
}
protected override void OnNavigatedTo(bool inStack, CompositeDisposable disposables)
@@ -41,9 +45,9 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
RxApp.MainThreadScheduler.Schedule(async () =>
{
var intent = new PaymentIntent(
- destination: _transactionInfo.Address,
- amount: MoneyRequest.CreateAllRemaining(subtractFee: true),
- label: _transactionInfo.Labels);
+ _transactionInfo.Address,
+ MoneyRequest.CreateAllRemaining(subtractFee: true),
+ _transactionInfo.Labels);
if (_requestedTransaction.SpentCoins.Count() > 1)
{
@@ -58,10 +62,14 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
.Skip(1)
.Select(x => x.OutPoint));
- _privacySuggestions.Add(new PrivacySuggestionControlViewModel(_transactionInfo.Amount.ToDecimal(MoneyUnit.BTC), smallerTransaction, PrivacyOptimisationLevel.Better, "Improved Privacy", "Save on Transaction Fee", "Send Less"));
+ _privacySuggestions.Add(new PrivacySuggestionControlViewModel(
+ _transactionInfo.Amount.ToDecimal(MoneyUnit.BTC), smallerTransaction,
+ PrivacyOptimisationLevel.Better, "Improved Privacy", "Save on Transaction Fee", "Send Less"));
}
- var exactSuggestion = new PrivacySuggestionControlViewModel(_transactionInfo.Amount.ToDecimal(MoneyUnit.BTC), _requestedTransaction, PrivacyOptimisationLevel.Standard, "Send the Exact Amount");
+ var exactSuggestion = new PrivacySuggestionControlViewModel(
+ _transactionInfo.Amount.ToDecimal(MoneyUnit.BTC), _requestedTransaction,
+ PrivacyOptimisationLevel.Standard, "Send the Exact Amount");
_privacySuggestions.Add(exactSuggestion);
@@ -69,10 +77,12 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
_wallet.Kitchen.SaltSoup(),
intent,
FeeStrategy.CreateFromFeeRate(_transactionInfo.FeeRate),
- allowUnconfirmed: true,
+ true,
_requestedTransaction.SpentCoins.Select(x => x.OutPoint));
- _privacySuggestions.Add(new PrivacySuggestionControlViewModel(_transactionInfo.Amount.ToDecimal(MoneyUnit.BTC), largerTransaction, PrivacyOptimisationLevel.Better, "Improved Privacy", "Save on Transaction Fee"));
+ _privacySuggestions.Add(new PrivacySuggestionControlViewModel(
+ _transactionInfo.Amount.ToDecimal(MoneyUnit.BTC), largerTransaction,
+ PrivacyOptimisationLevel.Better, "Improved Privacy", "Save on Transaction Fee"));
SelectedPrivacySuggestion = exactSuggestion;

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacySuggestionControlViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacySuggestionControlViewModel.cs
using System;
+using System.Globalization;
using System.Linq;
using NBitcoin;
using WalletWasabi.Blockchain.TransactionBuilding;
+using WalletWasabi.Fluent.Helpers;
namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
{
@@ -21,35 +23,14 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
_optimisationLevel = optimisationLevel;
_benefits = benefits;
- decimal total;
+ decimal total = transactionResult.CalculateDestinationAmount().ToDecimal(MoneyUnit.BTC);
if (optimisationLevel == PrivacyOptimisationLevel.Better)
{
- total = transactionResult.OuterWalletOutputs
- .Select(x => x.Amount)
- .Concat(transactionResult.InnerWalletOutputs.Select(x => x.Amount))
- .Sum().ToDecimal(MoneyUnit.BTC);
-
var pcDifference = ((total - originalAmount) / originalAmount) * 100;
_caption = pcDifference > 0 ? $"{pcDifference:F}% More" : $"{Math.Abs(pcDifference):F}% Less";
}
- else
- {
- if (!transactionResult.OuterWalletOutputs.Any()) // self spend
- {
- total = transactionResult.InnerWalletOutputs
- .Where(x => !x.HdPubKey.IsInternal)
- .Select(x => x.Amount)
- .Sum().ToDecimal(MoneyUnit.BTC);
- }
- else
- {
- total = transactionResult.OuterWalletOutputs
- .Select(x => x.Amount)
- .Sum().ToDecimal(MoneyUnit.BTC);
- }
- }
_title = $"{total} BTC";
}
@@ -58,5 +39,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
[AutoNotify] private string _caption;
[AutoNotify] private string[] _benefits;
[AutoNotify] private PrivacyOptimisationLevel _optimisationLevel;
+
+ public BuildTransactionResult TransactionResult => _transactionResult;
}
}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/Views/Wallets/Send/PrivacySuggestionControl.axaml
WalletWasabi.Fluent/Views/Wallets/Send/PrivacySuggestionControl.axaml
x:CompileBindings="True"
x:Class="WalletWasabi.Fluent.Views.Wallets.Send.PrivacySuggestionControl">
<StackPanel Spacing="30">
- <Panel Height="160" Width="160">
- <Ellipse Stroke="{Binding OptimisationLevel, Converter={x:Static conv:PrivacyOptimisationLevelConverters.OptimisationLevelToBrushConverter}}" StrokeThickness="2" />
+ <Panel>
<StackPanel Spacing="10" VerticalAlignment="Center">
<TextBlock Text="{Binding Title}" FontSize="20" HorizontalAlignment="Center" />
<TextBlock Text="{Binding Caption}" HorizontalAlignment="Center" Opacity="0.6" />
</StackPanel>
</Panel>
- <Separator Height="1" Background="#FFFFFF" Opacity="0.2" />
+ <Separator Height="2" Background="{Binding OptimisationLevel, Converter={x:Static conv:PrivacyOptimisationLevelConverters.OptimisationLevelToBrushConverter}}" />
<ItemsControl Items="{Binding Benefits}">
<ItemsControl.Styles>
<Style Selector="TextBlock">

MODIFY
WalletWasabi.Fluent/Views/Wallets/Send/TransactionPreviewView.axaml
WalletWasabi.Fluent/Views/Wallets/Send/TransactionPreviewView.axaml
xmlns:c="using:WalletWasabi.Fluent.Controls"
xmlns:vm="using:WalletWasabi.Fluent.ViewModels.Wallets.Send"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
- x:DataType="vm:OptimisePrivacyViewModel"
+ x:DataType="vm:TransactionPreviewViewModel"
x:CompileBindings="True"
x:Class="WalletWasabi.Fluent.Views.Wallets.Send.TransactionPreviewView">
<c:ContentArea Title="Send" Caption=""
HorizontalAlignment="Left"
EnableCancel="False"
EnableNext="True"
- NextContent="Continue"
+ NextContent="Confirm"
ScrollViewer.VerticalScrollBarVisibility="Disabled">
+ <StackPanel Spacing="100">
+ <TextBlock Text="{Binding Instruction}" />
+ <TextBlock Text="{Binding Execution}" />
+ </StackPanel>
</c:ContentArea>
</UserControl>

wire up screens.