From e47d3b5a359fa38b38b8f5c36dcfa45aa6d256c1 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Tue, 29 Jan 2019 15:18:38 -0800 Subject: [PATCH] #91 Store sent Tx address, handle multiple sent addresses case. --- src/senttxstore.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/senttxstore.cpp b/src/senttxstore.cpp index 9237a3c..3fc66ac 100644 --- a/src/senttxstore.cpp +++ b/src/senttxstore.cpp @@ -84,12 +84,22 @@ void SentTxStore::addToSentTx(Tx tx, QString txid) { totalAmount += i.amount; } + QString toAddresses; + if (tx.toAddrs.length() == 1) { + toAddresses = tx.toAddrs[0].addr; + } else { + // Concatenate all the toAddresses + for (auto a : tx.toAddrs) { + toAddresses += a.addr % "(" % Settings::getZECDisplayFormat(a.amount) % ") "; + } + } + auto list = jsonDoc.array(); QJsonObject txItem; txItem["type"] = "sent"; txItem["from"] = tx.fromAddr; txItem["datetime"] = QDateTime::currentMSecsSinceEpoch() / (qint64)1000; - txItem["address"] = QString(); // The sent address is blank, to be consistent with t-Addr sent behaviour + txItem["address"] = toAddresses; txItem["txid"] = txid; txItem["amount"] = -totalAmount; txItem["fee"] = -tx.fee;