Implement Send (without coins yet)
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendTabView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/SendTabView.xaml
<DockPanel LastChildFill="True">
<StackPanel DockPanel.Dock="Bottom" Margin="20 10" Gap="10" HorizontalAlignment="Left" MinWidth="1000">
<TextBox Text="{Binding Address}" Watermark="Address" UseFloatingWatermark="True" />
+ <TextBox Text="{Binding Label}" Watermark="Label" UseFloatingWatermark="True" />
<StackPanel Orientation="Horizontal" Gap="10">
<Button Content="Max" Command="{Binding MaxCommand}" />
<TextBox Text="{Binding Amount}" Watermark="Amount" UseFloatingWatermark="True" MinWidth="100" />
<StackPanel>
- <Slider Minimum="0" Maximum="10" Value="{Binding Fee}" />
+ <Slider Minimum="2" Maximum="1008" Value="{Binding Fee}" />
<StackPanel Orientation="Horizontal" Gap="4">
- <TextBlock Text="Confirmation Target:" />
+ <TextBlock Text="Confirmation Expected In:" />
<TextBlock Text="{Binding Fee, Converter={StaticResource FeeConfirmationTargetConverter}}" />
</StackPanel>
</StackPanel>
<Grid></Grid>
</DockPanel>
<TextBlock Text="{Binding WarningMessage}" Classes="warningMessage" />
- <TextBlock Text="{Binding ValidationMessage}" Classes="errorMessage" />
+ <TextBlock Text="{Binding SuccessMessage}" Classes="validationMessage" Foreground="Green" />
</StackPanel>
<controls:GroupBox Title="{Binding Title}" TextBlock.FontSize="30" Padding="20" Margin="10">

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
@@ -3,7 +3,9 @@ using System.Collections.Generic;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
+using NBitcoin;
using ReactiveUI;
+using WalletWasabi.Services;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
@@ -17,9 +19,12 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private int _fee;
private string _password;
private string _address;
+ private string _label;
private bool _isBusy;
- private const string BuildTransactionButtonTextString = "Build Transaction";
- private const string BuildingTransactionButtonTextString = "Building Transaction";
+ private string _warningMessage;
+ private string _successMessage;
+ private const string BuildTransactionButtonTextString = "Send Transaction";
+ private const string BuildingTransactionButtonTextString = "Sending Transaction...";
public SendTabViewModel(WalletViewModel walletViewModel)
: base("Send", walletViewModel)
@@ -47,14 +52,28 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
IsBusy = true;
try
{
- await Task.Delay(5000);
-
//CoinList.SelectedCoins
//IsMax = use all selected coins.
// backend stuff here.
+
+ if (string.IsNullOrWhiteSpace(Label))
+ {
+ throw new InvalidOperationException("Label is required.");
}
- catch
+
+ var address = BitcoinAddress.Create(Address, Global.Network);
+ var script = address.ScriptPubKey;
+ var amount = IsMax ? Money.Zero : Money.Parse(Amount);
+ var operation = new WalletService.Operation(script, amount, Label);
+ var result = await Global.WalletService.BuildTransactionAsync(Password, new[] { operation }, Fee, allowUnconfirmed: true);
+ await Global.WalletService.SendTransactionAsync(result.Transaction);
+ SuccessMessage = "Transaction is successfully sent!";
+ WarningMessage = "";
+ }
+ catch (Exception ex)
{
+ SuccessMessage = "";
+ WarningMessage = $"FAILED: {ex.ToTypeMessageString()}";
}
finally
{
@@ -139,6 +158,24 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
set { this.RaiseAndSetIfChanged(ref _address, value); }
}
+ public string Label
+ {
+ get { return _label; }
+ set { this.RaiseAndSetIfChanged(ref _label, value); }
+ }
+
+ public string WarningMessage
+ {
+ get { return _warningMessage; }
+ set { this.RaiseAndSetIfChanged(ref _warningMessage, value); }
+ }
+
+ public string SuccessMessage
+ {
+ get { return _successMessage; }
+ set { this.RaiseAndSetIfChanged(ref _successMessage, value); }
+ }
+
public ReactiveCommand BuildTransactionCommand { get; }
public ReactiveCommand MaxCommand { get; }

MODIFY
WalletWasabi.Gui/Converters/FeeConfirmationTargetConverter.cs
WalletWasabi.Gui/Converters/FeeConfirmationTargetConverter.cs
@@ -10,7 +10,18 @@ namespace WalletWasabi.Gui.Converters
{
if (value is int integer)
{
- return "20 minutes - 7 days";
+ if (integer >= 2 && integer <= 6) // minutes
+ {
+ return $"Minutes";
+ }
+ if (integer >= 7 && integer <= 144) // hours
+ {
+ return "Hours";
+ }
+ if (integer >= 145 && integer <= 1008) // days
+ {
+ return "Days";
+ }
}
throw new InvalidOperationException();

Implement Send (without coins yet)