add balance calculation
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryItemViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryItemViewModel.cs
@@ -8,10 +8,11 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History
{
public class HistoryItemViewModel
{
- public HistoryItemViewModel(TransactionSummary transactionSummary, BitcoinStore bitcoinStore)
+ public HistoryItemViewModel(TransactionSummary transactionSummary, BitcoinStore bitcoinStore, Money balance)
{
Date = transactionSummary.DateTime.ToLocalTime();
IsCoinJoin = transactionSummary.IsLikelyCoinJoinOutput;
+ Balance = balance;
var confirmations = transactionSummary.Height.Type == HeightType.Chain ? (int) bitcoinStore.SmartHeaderChain.TipHeight - transactionSummary.Height.Value + 1 : 0;
IsConfirmed = confirmations > 0;

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs
@@ -5,6 +5,7 @@ using System.Reactive.Linq;
using System.Threading.Tasks;
using DynamicData;
using DynamicData.Binding;
+using NBitcoin;
using ReactiveUI;
using WalletWasabi.Blockchain.Transactions;
using WalletWasabi.Logging;
@@ -62,8 +63,13 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.History
var txRecordList = await Task.Run(historyBuilder.BuildHistorySummary);
_transactionSourceList.Clear();
- var trs = txRecordList.Select(transactionSummary => new HistoryItemViewModel(transactionSummary, _bitcoinStore));
- _transactionSourceList.AddRange(trs.Reverse());
+
+ Money balance = Money.Zero;
+ foreach (var transactionSummary in txRecordList)
+ {
+ balance += transactionSummary.Amount;
+ _transactionSourceList.Add(new HistoryItemViewModel(transactionSummary, _bitcoinStore, balance));
+ }
}
catch (Exception ex)
{

add balance calculation