public override IWalletTransactionHistory InsertTransactionHistoryEntry(ITransaction transaction, AccountId targetAccountId, string note) { this.EnsureWalletLoaded(); IWalletTransactionHistory historyEntry = base.InsertTransactionHistoryEntry(transaction, targetAccountId, note); if (historyEntry is INeuraliumWalletTransactionHistory neuraliumWalletTransactionHistory) { this.InsertNeuraliumTransactionTimelineEntry(transaction, targetAccountId, neuraliumWalletTransactionHistory); } return(historyEntry); }
protected override void FillWalletTransactionHistoryEntry(IWalletTransactionHistory walletAccountTransactionHistory, ITransaction transaction, AccountId targetAccountId, string note) { this.EnsureWalletLoaded(); base.FillWalletTransactionHistoryEntry(walletAccountTransactionHistory, transaction, targetAccountId, note); if (walletAccountTransactionHistory is INeuraliumWalletTransactionHistory neuraliumWalletTransactionHistory) { bool ours = transaction.TransactionId.Account == targetAccountId; //here we record the impact amount. + value increases our amount. - reduces if (transaction is INeuraliumTransferTransaction neuraliumTransferTransaction) { neuraliumWalletTransactionHistory.Amount = neuraliumTransferTransaction.Amount; neuraliumWalletTransactionHistory.MoneratyTransactionType = NeuraliumWalletTransactionHistory.MoneratyTransactionTypes.Debit; neuraliumWalletTransactionHistory.Recipient = neuraliumTransferTransaction.Recipient.ToString(); } else if (transaction is INeuraliumMultiTransferTransaction neuraliumMultiTransferTransaction) { if (ours) { neuraliumWalletTransactionHistory.Amount = neuraliumMultiTransferTransaction.Total; } else { neuraliumWalletTransactionHistory.Amount = neuraliumMultiTransferTransaction.Recipients.SingleOrDefault(r => r.Recipient == targetAccountId).Amount; } neuraliumWalletTransactionHistory.MoneratyTransactionType = NeuraliumWalletTransactionHistory.MoneratyTransactionTypes.Debit; neuraliumWalletTransactionHistory.Recipient = string.Join(",", neuraliumMultiTransferTransaction.Recipients.Select(a => a.Recipient).OrderBy(a => a.ToLongRepresentation())); } else if (transaction is INeuraliumRefillNeuraliumsTransaction neuraliumsTransaction) { if (ours) { neuraliumWalletTransactionHistory.Amount = 1000; neuraliumWalletTransactionHistory.MoneratyTransactionType = NeuraliumWalletTransactionHistory.MoneratyTransactionTypes.Credit; neuraliumWalletTransactionHistory.Recipient = neuraliumsTransaction.TransactionId.Account.ToString(); } } if (transaction is ITipTransaction tipTransaction) { neuraliumWalletTransactionHistory.Tip = tipTransaction.Tip; } } }