From c914333524606b349109b7ae1cd2357e4bcadcc6 Mon Sep 17 00:00:00 2001 From: Nikolay Veprikov <nikolai.veprikov@demlabs.net> Date: Mon, 13 Feb 2023 03:58:41 +0300 Subject: [PATCH 1/2] Fixed LastActions history. --- .../handlers/DapGetAllWalletHistoryCommand.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/chain/wallet/handlers/DapGetAllWalletHistoryCommand.cpp b/chain/wallet/handlers/DapGetAllWalletHistoryCommand.cpp index 6fbf283f..9c415340 100644 --- a/chain/wallet/handlers/DapGetAllWalletHistoryCommand.cpp +++ b/chain/wallet/handlers/DapGetAllWalletHistoryCommand.cpp @@ -42,11 +42,11 @@ QVariant DapGetAllWalletHistoryCommand::respondToClient(const QVariant &arg1, co // qDebug() << "isLastActions" << isLastActions; - qint64 lastTime = 0; +/* qint64 lastTime = 0; QString lastDate = ""; qint64 prevTime = 0; - QString prevDate = ""; + QString prevDate = "";*/ QString walletName = ""; @@ -118,7 +118,7 @@ QVariant DapGetAllWalletHistoryCommand::respondToClient(const QVariant &arg1, co txHeader.insert("date", date.toString("yyyy-MM-dd")); txHeader.insert("date_to_secs", QString::number(date_to_secs)); - if (lastTime < date_to_secs) +/* if (lastTime < date_to_secs) { lastTime = date_to_secs; lastDate = date.toString("yyyy-MM-dd"); @@ -130,7 +130,7 @@ QVariant DapGetAllWalletHistoryCommand::respondToClient(const QVariant &arg1, co { prevTime = date_to_secs; prevDate = date.toString("yyyy-MM-dd"); - } + }*/ int posDataBegin = match.capturedEnd(); int posDataEnd = result.indexOf("TX hash", posDataBegin); @@ -199,7 +199,7 @@ QVariant DapGetAllWalletHistoryCommand::respondToClient(const QVariant &arg1, co } } - if (isLastActions) +/* if (isLastActions) { // qDebug() << "txLastActions" << "lastDate" << lastDate // << "prevDate" << prevDate; @@ -217,7 +217,7 @@ QVariant DapGetAllWalletHistoryCommand::respondToClient(const QVariant &arg1, co qDebug() << "txLastActions.size()" << txLastActions.size(); txHistory = txLastActions; - } + }*/ QJsonObject resultObject; resultObject.insert("history", txHistory); -- GitLab From 5dfe7339652fc21957fa9f54393dd9aa430d41f8 Mon Sep 17 00:00:00 2001 From: "denis.sumin" <denis.sumin@demlabs.net> Date: Wed, 15 Feb 2023 17:18:14 +0300 Subject: [PATCH 2/2] [*] update history parser --- .../DapGetAllWalletHistoryCommand.cpp | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/chain/wallet/handlers/DapGetAllWalletHistoryCommand.cpp b/chain/wallet/handlers/DapGetAllWalletHistoryCommand.cpp index 6fbf283f..5d24df11 100644 --- a/chain/wallet/handlers/DapGetAllWalletHistoryCommand.cpp +++ b/chain/wallet/handlers/DapGetAllWalletHistoryCommand.cpp @@ -142,7 +142,7 @@ QVariant DapGetAllWalletHistoryCommand::respondToClient(const QVariant &arg1, co posDataEnd - posDataBegin + 2); QRegularExpression regularData( - R"(\n\t(recv|send) (\S+) (\S+) (\S+) (\S+))", QRegularExpression::MultilineOption); + R"(\n\t(recv|send) (\S+) (\S+) (\S+) (\S+) (\S+))", QRegularExpression::MultilineOption); QRegularExpressionMatchIterator matchItrData = regularData.globalMatch(data); // qlonglong fee = 0; @@ -152,28 +152,32 @@ QVariant DapGetAllWalletHistoryCommand::respondToClient(const QVariant &arg1, co uint256_t fee = dap_cvt_str_to_uint256("0"); uint256_t value = dap_cvt_str_to_uint256("0"); QString feeToken = ""; + QString value_str = ""; while (matchItrData.hasNext()) { QRegularExpressionMatch match = matchItrData.next(); - if (feeFlags.contains(match.captured(5))) + if (feeFlags.contains(match.captured(6))) { SUM_256_256(fee, - dap_cvt_str_to_uint256(match.captured(2).toStdString().data()), + dap_cvt_str_to_uint256(match.captured(3).toStdString().data()), &fee); - feeToken = match.captured(3); + feeToken = match.captured(4); // fee += match.captured(2).toLongLong(); } else { - txHeader.insert("address", match.captured(5)); + txHeader.insert("address", match.captured(6)); txHeader.insert("status", match.captured(1) == "send" ? "Sent" : "Received"); // txHeader.insert("value", match.captured(2)); - txHeader.insert("token", match.captured(3)); - txHeader.insert("direction", match.captured(4)); + txHeader.insert("token", match.captured(4)); + txHeader.insert("direction", match.captured(5)); // value = match.captured(2).toLongLong(); - value = dap_cvt_str_to_uint256(match.captured(2).toStdString().data()); + value_str = match.captured(2); + QString buff = match.captured(3).split("(")[1].split(")")[0]; + value = dap_cvt_str_to_uint256(buff.toStdString().data()); + } // qDebug() << match.captured(5) << feeFlags.contains(match.captured(5)); -- GitLab