Skip to content
Permalink
Browse files

Enable sending queued coins.

  • Loading branch information...
nopara73 committed Nov 19, 2018
1 parent 4770314 commit 2b07ebbd5ae72e32d6ddd4b4b9fffcd61e04b393
Showing with 15 additions and 4 deletions.
  1. +15 −4 WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
@@ -106,9 +106,10 @@ public SendTabViewModel(WalletViewModel walletViewModel)
return;
}

var selectedCoins = CoinList.Coins.Where(cvm => cvm.IsSelected).Select(cvm => new TxoRef(cvm.Model.TransactionId, cvm.Model.Index)).ToList();
var selectedCoinViewModels = CoinList.Coins.Where(cvm => cvm.IsSelected);
var selectedCoinReferences = selectedCoinViewModels.Select(cvm => new TxoRef(cvm.Model.TransactionId, cvm.Model.Index)).ToList();

if (!selectedCoins.Any())
if (!selectedCoinReferences.Any())
{
SetWarningMessage("No coins are selected to spend.");
return;
@@ -139,7 +140,17 @@ public SendTabViewModel(WalletViewModel walletViewModel)
var label = Label.Trim(',', ' ').Trim();
var operation = new WalletService.Operation(script, amount, label);

var result = await Task.Run(async () => await Global.WalletService.BuildTransactionAsync(Password, new[] { operation }, Fee, allowUnconfirmed: true, allowedInputs: selectedCoins));
try
{
await Global.ChaumianClient.DequeueCoinsFromMixAsync(selectedCoinReferences.Select(x => (x.TransactionId, x.Index)).ToArray());
}
catch
{
SetWarningMessage("Spending coins those are being actively mixed is not allowed.");
return;
}

var result = await Task.Run(async () => await Global.WalletService.BuildTransactionAsync(Password, new[] { operation }, Fee, allowUnconfirmed: true, allowedInputs: selectedCoinReferences));

await Task.Run(async () => await Global.WalletService.SendTransactionAsync(result.Transaction));

@@ -164,7 +175,7 @@ public SendTabViewModel(WalletViewModel walletViewModel)
IsBusy = false;
}
},
this.WhenAny(x => x.IsMax, x => x.Amount, x => x.Address, x => x.IsBusy,
(this).WhenAny(x => x.IsMax, x => x.Amount, x => x.Address, x => x.IsBusy,
(isMax, amount, address, busy) => ((isMax.Value || !string.IsNullOrWhiteSpace(amount.Value)) && !string.IsNullOrWhiteSpace(Address) && !IsBusy)));

MaxCommand = ReactiveCommand.Create(() =>

0 comments on commit 2b07ebb

Please sign in to comment.
You can’t perform that action at this time.