diff --git a/assets/config/0.5.6-coins.json b/assets/config/0.5.6-coins.json index 1f63629094..26235a617d 100644 --- a/assets/config/0.5.6-coins.json +++ b/assets/config/0.5.6-coins.json @@ -1758,6 +1758,30 @@ "currently_enabled": false, "wallet_only": true }, + "CHTA": { + "coin": "CHTA", + "name": "Cheetahcoin", + "type": "UTXO", + "coingecko_id": "test-coin", + "coinpaprika_id": "chta-cheetahcoin", + "nomics_id": "CHTA", + "electrum": [ + { + "url": "electrum.shorelinecrypto.com:10007" + }, + { + "url": "electrum1.mooo.com:10007" + }, + { + "url": "electrum2.mooo.com:10007" + } + ], + "explorer_url": [ + "http://chtaexplorer.mooo.com:3002/" + ], + "active": false, + "currently_enabled": false + }, "CLC": { "coin": "CLC", "name": "Collider Coin", @@ -3826,6 +3850,29 @@ "active": false, "currently_enabled": false }, + "LNC": { + "coin": "LNC", + "name": "LightningCash", + "coinpaprika_id": "lnc-lightningcash", + "coingecko_id": "lightningcash", + "nomics_id": "LNC3", + "electrum": [ + { + "url": "74.208.95.26:50001" + }, + { + "url": "74.56.11.23:50001" + } + ], + "explorer_url": [ + "https://explorer.lightningcash-coin.com/" + ], + "explorer_tx_url": "tx/", + "explorer_address_url": "address/", + "type": "UTXO", + "active": false, + "currently_enabled": false + }, "LOOM-ERC20": { "coin": "LOOM-ERC20", "name": "Loom Network", @@ -5224,6 +5271,29 @@ "active": false, "currently_enabled": false }, + "AVN": { + "coin": "AVN", + "name": "Avian", + "coinpaprika_id": "avn-avian", + "coingecko_id": "avian-network", + "nomics_id": "AVN3", + "electrum": [ + { + "url": "electrum-us.avn.network:50001", + "protocol": "TCP" + }, + { + "url": "electrum-eu.avn.network:50001", + "protocol": "TCP" + } + ], + "explorer_url": [ + "https://explorer.avn.network/" + ], + "type": "UTXO", + "active": false, + "currently_enabled": false + }, "AWC": { "active": false, "coin": "AWC", diff --git a/atomic_defi_design/Dex/Constants/Style.qml b/atomic_defi_design/Dex/Constants/Style.qml index e1f1e21788..83e54c3016 100644 --- a/atomic_defi_design/Dex/Constants/Style.qml +++ b/atomic_defi_design/Dex/Constants/Style.qml @@ -238,6 +238,7 @@ QtObject { "AUR": "#0A6C5E", "AVA": "#5B567F", "AVAX": "#E84142", + "AVN": "#33E0CE", "AXS": "#0055D5", "BAL": "#4D4D4D", "BNB": "#F9D987", @@ -324,6 +325,7 @@ QtObject { "CRYPTO": "#F58736", "LABS": "#C1F6E1", "LCC": "#068210", + "LNC": "#C3A635", "MESH": "#0098DA", "MGW": "#854F2F", "MONA": "#DEC799", @@ -384,6 +386,7 @@ QtObject { "CEL": "#4055A6", "CELR": "#595959", "CENNZ": "#2E87F1", + "CHTA": "#C3A634", "COMP": "#00DBA3", "CRO": "#243565", "CVC": "#3AB03E", diff --git a/atomic_defi_design/Dex/Wallet/Main.qml b/atomic_defi_design/Dex/Wallet/Main.qml index 8ab39aa3e1..738df03707 100644 --- a/atomic_defi_design/Dex/Wallet/Main.qml +++ b/atomic_defi_design/Dex/Wallet/Main.qml @@ -20,16 +20,18 @@ Item { id: root property alias send_modal: send_modal - readonly property int layout_margin: 20 - readonly property string headerTitleColor: Style.colorText2 - readonly property string headerTitleFont: Style.textSizeMid1 - readonly property string headerTextColor: Dex.CurrentTheme.foregroundColor - readonly property string headerTextFont: Style.textSize - readonly property string headerSmallTitleFont: Style.textSizeSmall4 - readonly property string headerSmallFont: Style.textSizeSmall2 - readonly property string addressURL: General.getAddressExplorerURL(api_wallet_page.ticker, current_ticker_infos.address) - - function loadingPercentage(remaining) { + + readonly property int layout_margin: 20 + readonly property string headerTitleColor: Style.colorText2 + readonly property string headerTitleFont: Style.textSizeMid1 + readonly property string headerTextColor: Dex.CurrentTheme.foregroundColor + readonly property string headerTextFont: Style.textSize + readonly property string headerSmallTitleFont: Style.textSizeSmall4 + readonly property string headerSmallFont: Style.textSizeSmall2 + readonly property string addressURL: General.getAddressExplorerURL(api_wallet_page.ticker, current_ticker_infos.address) + + function loadingPercentage(remaining) + { return General.formatPercent((100 * (1 - parseFloat(remaining)/parseFloat(current_ticker_infos.current_block))).toFixed(3), false) } @@ -937,7 +939,6 @@ Item { width: parent.width height: parent.height - model: transactions_mdl.proxy_mdl } ColumnLayout @@ -994,10 +995,7 @@ Item cursorShape: Qt.PointingHandCursor anchors.fill: parent hoverEnabled: true - onClicked: { - console.log(addressURL) - Qt.openUrlExternally(addressURL) - } + onClicked: Qt.openUrlExternally(addressURL) } } diff --git a/atomic_defi_design/Dex/Wallet/Sidebar.qml b/atomic_defi_design/Dex/Wallet/Sidebar.qml index 4b54ce976d..aca26235ad 100644 --- a/atomic_defi_design/Dex/Wallet/Sidebar.qml +++ b/atomic_defi_design/Dex/Wallet/Sidebar.qml @@ -9,6 +9,7 @@ import "../Components" import "../Constants" as Constants import App 1.0 import Dex.Themes 1.0 as Dex +import Dex.Components 1.0 as Dex // Coins bar at left side Item @@ -59,7 +60,7 @@ Item Layout.preferredHeight: 38 textField.placeholderText: qsTr("Search") - forceFocus: true + //forceFocus: true searchModel: portfolio_coins } @@ -71,14 +72,21 @@ Item Layout.fillHeight: true Layout.alignment: Qt.AlignHCenter color: 'transparent' - content: DexListView { + content: Dex.ListView + { id: list height: list_bg.height model: portfolio_coins topMargin: 5 bottomMargin: 5 scrollbar_visible: false - DexRectangle { + + reuseItems: true + + delegate: SidebarItemDelegate { } + + Dex.Rectangle + { anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter width: parent.width + 4 @@ -94,23 +102,21 @@ Item } } - DexRectangle { + Dex.Rectangle + { anchors.horizontalCenter: parent.horizontalCenter width: parent.width + 4 height: 30 radius: 8 opacity: .5 visible: list.position > 0 ? true : false - Qaterial.Icon { + Qaterial.Icon + { anchors.centerIn: parent - color: DexTheme.foregroundColor + color: Dex.CurrentTheme.foregroundColor icon: Qaterial.Icons.arrowUpCircleOutline } } - - reuseItems: true - - delegate: SidebarItemDelegate { } } } diff --git a/atomic_defi_design/Dex/Wallet/SidebarItemDelegate.qml b/atomic_defi_design/Dex/Wallet/SidebarItemDelegate.qml index 407fe48bf4..41a4ecd409 100644 --- a/atomic_defi_design/Dex/Wallet/SidebarItemDelegate.qml +++ b/atomic_defi_design/Dex/Wallet/SidebarItemDelegate.qml @@ -9,7 +9,8 @@ import "../Components" import "../Constants" as Dex import App 1.0 -GradientRectangle { +GradientRectangle +{ width: list_bg.width - list_bg.border.width*2 - 6 height: 44 radius: Dex.Style.rectangleCornerRadius + 4 @@ -24,23 +25,16 @@ GradientRectangle { hoverEnabled: true acceptedButtons: Qt.LeftButton | Qt.RightButton - onClicked: { - if(!can_change_ticker) return - + onClicked: + { if (mouse.button === Qt.RightButton) context_menu.popup() else api_wallet_page.ticker = ticker } - onPressAndHold: { - if(!can_change_ticker) return - - if (mouse.source === Qt.MouseEventNotSynthesized) context_menu.popup() - } + onPressAndHold: if (mouse.source === Qt.MouseEventNotSynthesized) context_menu.popup() } // Right click menu - CoinMenu { - id: context_menu - } + CoinMenu { id: context_menu } readonly property double side_margin: 16 diff --git a/atomic_defi_design/Dex/Wallet/Transactions.qml b/atomic_defi_design/Dex/Wallet/Transactions.qml index a195fc610b..30e94fa2b8 100644 --- a/atomic_defi_design/Dex/Wallet/Transactions.qml +++ b/atomic_defi_design/Dex/Wallet/Transactions.qml @@ -5,8 +5,9 @@ import QtQuick.Controls 2.15 import "../Components" import "../Constants" import Dex.Themes 1.0 as Dex +import Dex.Components 1.0 as Dex -DefaultListView +Dex.ListView { id: list @@ -18,14 +19,10 @@ DefaultListView property real _feeColumnWidth: 225 property real _dateColumnWidth: 170 - ModalLoader - { - id: tx_details_modal - sourceComponent: TransactionDetailsModal {} - } + model: transactions_mdl.proxy_mdl // Row - delegate: DexRectangle + delegate: Dex.Rectangle { id: rectangle width: list.width @@ -35,7 +32,7 @@ DefaultListView colorAnimation: false color: mouse_area.containsMouse ? Dex.CurrentTheme.buttonColorHovered : 'transparent' - DexMouseArea + Dex.MouseArea { id: mouse_area anchors.fill: parent @@ -47,14 +44,17 @@ DefaultListView } } - RowLayout { + RowLayout + { id: tx_row anchors.fill: parent anchors.margins: 15 - RowLayout { + RowLayout + { spacing: 3 Layout.preferredWidth: _categoryColumnWidth + Circle { id: note_tag @@ -70,7 +70,7 @@ DefaultListView } // Description - DexLabel + Dex.Text { id: description horizontalAlignment: Qt.AlignLeft @@ -80,7 +80,7 @@ DefaultListView } // Crypto - DexLabel + Dex.Text { id: crypto_amount Layout.preferredWidth: _cryptoColumnWidth @@ -98,7 +98,7 @@ DefaultListView } // Fiat - DexLabel + Dex.Text { Layout.preferredWidth: _fiatColumnWidth horizontalAlignment: Text.AlignRight @@ -109,7 +109,7 @@ DefaultListView } // Fee - DexLabel + Dex.Text { Layout.preferredWidth: _feeColumnWidth horizontalAlignment: Text.AlignRight @@ -120,7 +120,7 @@ DefaultListView } // Date - DexLabel + Dex.Text { Layout.preferredWidth: _dateColumnWidth horizontalAlignment: Text.AlignRight @@ -130,4 +130,10 @@ DefaultListView } } } + + ModalLoader + { + id: tx_details_modal + sourceComponent: TransactionDetailsModal {} + } } diff --git a/atomic_defi_design/assets/images/coins/avn.png b/atomic_defi_design/assets/images/coins/avn.png new file mode 100644 index 0000000000..a22e149551 Binary files /dev/null and b/atomic_defi_design/assets/images/coins/avn.png differ diff --git a/atomic_defi_design/assets/images/coins/chta.png b/atomic_defi_design/assets/images/coins/chta.png new file mode 100755 index 0000000000..250081362e Binary files /dev/null and b/atomic_defi_design/assets/images/coins/chta.png differ diff --git a/atomic_defi_design/assets/images/coins/lnc.png b/atomic_defi_design/assets/images/coins/lnc.png new file mode 100644 index 0000000000..c71ff557db Binary files /dev/null and b/atomic_defi_design/assets/images/coins/lnc.png differ diff --git a/src/core/atomicdex/api/mm2/transaction.data.cpp b/src/core/atomicdex/api/mm2/transaction.data.cpp index 1775466385..54dbf4b2e8 100644 --- a/src/core/atomicdex/api/mm2/transaction.data.cpp +++ b/src/core/atomicdex/api/mm2/transaction.data.cpp @@ -1,24 +1,16 @@ -// -// Created by Sztergbaum Roman on 08/06/2021. -// - -//! Deps #include -//! Our Headers #include "atomicdex/api/mm2/transaction.data.hpp" #include "atomicdex/utilities/global.utilities.hpp" namespace atomic_dex::mm2 { - void - from_json(const nlohmann::json& j, fee_regular_coin& cfg) + void from_json(const nlohmann::json& j, fee_regular_coin& cfg) { j.at("amount").get_to(cfg.amount); } - void - from_json(const nlohmann::json& j, fee_erc_coin& cfg) + void from_json(const nlohmann::json& j, fee_erc_coin& cfg) { j.at("coin").get_to(cfg.coin); j.at("gas").get_to(cfg.gas); @@ -26,8 +18,7 @@ namespace atomic_dex::mm2 j.at("total_fee").get_to(cfg.total_fee); } - void - from_json(const nlohmann::json& j, fee_qrc_coin& cfg) + void from_json(const nlohmann::json& j, fee_qrc_coin& cfg) { j.at("coin").get_to(cfg.coin); j.at("gas_limit").get_to(cfg.gas_limit); @@ -36,8 +27,7 @@ namespace atomic_dex::mm2 j.at("total_gas_fee").get_to(cfg.total_gas_fee); } - void - from_json(const nlohmann::json& j, fees_data& cfg) + void from_json(const nlohmann::json& j, fees_data& cfg) { if (j.count("amount") == 1) { @@ -56,8 +46,7 @@ namespace atomic_dex::mm2 } } - void - from_json(const nlohmann::json& j, transaction_data& cfg) + void from_json(const nlohmann::json& j, transaction_data& cfg) { j.at("block_height").get_to(cfg.block_height); j.at("coin").get_to(cfg.coin); diff --git a/src/core/atomicdex/events/events.hpp b/src/core/atomicdex/events/events.hpp index 072848741c..9f19cd0f7f 100644 --- a/src/core/atomicdex/events/events.hpp +++ b/src/core/atomicdex/events/events.hpp @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2013-2021 The Komodo Platform Developers. * + * Copyright © 2013-2022 The Komodo Platform Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -20,7 +20,6 @@ #include #include -//! Project Headers #include namespace atomic_dex diff --git a/src/core/atomicdex/models/qt.wallet.transactions.model.cpp b/src/core/atomicdex/models/transactions_model.cpp similarity index 88% rename from src/core/atomicdex/models/qt.wallet.transactions.model.cpp rename to src/core/atomicdex/models/transactions_model.cpp index 8b464b7229..26245134a0 100644 --- a/src/core/atomicdex/models/qt.wallet.transactions.model.cpp +++ b/src/core/atomicdex/models/transactions_model.cpp @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2013-2021 The Komodo Platform Developers. * + * Copyright © 2013-2022 The Komodo Platform Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -14,8 +14,7 @@ * * ******************************************************************************/ -//! Project Headers -#include "atomicdex/models/qt.wallet.transactions.model.hpp" +#include "transactions_model.hpp" #include "atomicdex/managers/qt.wallet.manager.hpp" #include "atomicdex/pages/qt.settings.page.hpp" #include "atomicdex/services/price/global.provider.hpp" @@ -38,10 +37,10 @@ namespace atomic_dex this->m_model_proxy->sort(0); } - QHash - transactions_model::roleNames() const + QHash transactions_model::roleNames() const { - return { + return + { {AmountRole, "amount"}, {AmISenderRole, "am_i_sender"}, {DateRole, "date"}, @@ -55,18 +54,16 @@ namespace atomic_dex {BlockheightRole, "blockheight"}, {ConfirmationsRole, "confirmations"}, {UnconfirmedRole, "unconfirmed"}, - {TransactionNoteRole, "transaction_note"}}; + {TransactionNoteRole, "transaction_note"} + }; } - int - transactions_model::rowCount([[maybe_unused]] const QModelIndex& parent) const + int transactions_model::rowCount([[maybe_unused]] const QModelIndex& parent) const { - // return m_model_data.size(); return static_cast(m_file_count); } - bool - atomic_dex::transactions_model::setData(const QModelIndex& index, const QVariant& value, int role) + bool atomic_dex::transactions_model::setData(const QModelIndex& index, const QVariant& value, int role) { if (!hasIndex(index.row(), index.column(), index.parent()) || !value.isValid()) { @@ -119,8 +116,7 @@ namespace atomic_dex return true; } - QVariant - transactions_model::data(const QModelIndex& index, int role) const + QVariant transactions_model::data(const QModelIndex& index, int role) const { if (!hasIndex(index.row(), index.column(), index.parent())) { @@ -182,8 +178,7 @@ namespace atomic_dex return {}; } - void - atomic_dex::transactions_model::reset() + void atomic_dex::transactions_model::reset() { this->m_file_count = 0; this->beginResetModel(); @@ -192,13 +187,11 @@ namespace atomic_dex emit lengthChanged(); } - void - transactions_model::init_transactions(const t_transactions& transactions) + void transactions_model::init_transactions(const t_transactions& transactions) { if (m_model_data.size() == 0) { SPDLOG_DEBUG("first time initialization, inserting {} transactions", transactions.size()); - //! First time insertion beginResetModel(); m_model_data = transactions; m_file_count = transactions.size() < g_file_count_limit ? transactions.size() : g_file_count_limit; @@ -228,13 +221,13 @@ namespace atomic_dex emit lengthChanged(); } - void - atomic_dex::transactions_model::update_transaction(const tx_infos& tx) + void atomic_dex::transactions_model::update_transaction(const tx_infos& tx) { if (const auto res = this->match(this->index(0, 0), TxHashRole, QString::fromStdString(tx.tx_hash)); not res.isEmpty()) { - const QModelIndex& idx = res.at(0); - quint64 timestamp = tx.timestamp; + const QModelIndex& idx = res.at(0); + quint64 timestamp = tx.timestamp; + update_value(TimestampRole, timestamp, idx, *this); update_value(DateRole, QString::fromStdString(tx.date), idx, *this); update_value(ConfirmationsRole, static_cast(tx.confirmations), idx, *this); @@ -242,8 +235,7 @@ namespace atomic_dex } } - void - atomic_dex::transactions_model::update_or_insert_transactions(const t_transactions& transactions) + void atomic_dex::transactions_model::update_or_insert_transactions(const t_transactions& transactions) { if (m_model_data.size() > transactions.size()) { @@ -285,20 +277,17 @@ namespace atomic_dex } } - int - transactions_model::get_length() const + int transactions_model::get_length() const { return rowCount(); } - transactions_proxy_model* - transactions_model::get_transactions_proxy() const + transactions_proxy_model* transactions_model::get_transactions_proxy() const { return m_model_proxy; } - void - atomic_dex::transactions_model::fetchMore(const QModelIndex& parent) + void atomic_dex::transactions_model::fetchMore(const QModelIndex& parent) { if (parent.isValid()) { @@ -317,10 +306,8 @@ namespace atomic_dex emit lengthChanged(); } - bool - atomic_dex::transactions_model::canFetchMore([[maybe_unused]] const QModelIndex& parent) const + bool atomic_dex::transactions_model::canFetchMore([[maybe_unused]] const QModelIndex& parent) const { return (m_file_count < m_model_data.size()); } - } // namespace atomic_dex diff --git a/src/core/atomicdex/models/qt.wallet.transactions.model.hpp b/src/core/atomicdex/models/transactions_model.hpp similarity index 90% rename from src/core/atomicdex/models/qt.wallet.transactions.model.hpp rename to src/core/atomicdex/models/transactions_model.hpp index ef9c453851..b76b85a8fd 100644 --- a/src/core/atomicdex/models/qt.wallet.transactions.model.hpp +++ b/src/core/atomicdex/models/transactions_model.hpp @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2013-2021 The Komodo Platform Developers. * + * Copyright © 2013-2022 The Komodo Platform Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -16,12 +16,10 @@ #pragma once -//! QT Headers #include #include -//! Project Headers -#include "atomicdex/models/qt.wallet.transactions.proxy.filter.model.hpp" +#include "transactions_proxy_model.hpp" #include "atomicdex/services/mm2/mm2.service.hpp" namespace atomic_dex @@ -29,6 +27,7 @@ namespace atomic_dex class transactions_model final : public QAbstractListModel { Q_OBJECT + Q_PROPERTY(int length READ get_length NOTIFY lengthChanged); Q_PROPERTY(transactions_proxy_model* proxy_mdl READ get_transactions_proxy NOTIFY transactionsProxyMdlChanged) @@ -37,7 +36,7 @@ namespace atomic_dex t_transactions m_model_data; std::size_t m_file_count{0}; - public: + public: enum TransactionsRoles { AmountRole = Qt::UserRole + 1, @@ -56,15 +55,15 @@ namespace atomic_dex TransactionNoteRole }; - transactions_model(ag::ecs::system_manager& system_manager, QObject* parent = nullptr) ; - ~transactions_model() final = default; + transactions_model(ag::ecs::system_manager& system_manager, QObject* parent = nullptr); + ~transactions_model() final = default; void reset(); void init_transactions(const t_transactions& transactions); void update_or_insert_transactions(const t_transactions& transactions); void update_transaction(const tx_infos& tx); - //! Override + // Override [[nodiscard]] QHash roleNames() const final; [[nodiscard]] QVariant data(const QModelIndex& index, int role) const final; [[nodiscard]] int rowCount(const QModelIndex& parent = QModelIndex()) const final; @@ -72,11 +71,11 @@ namespace atomic_dex void fetchMore(const QModelIndex& parent) final; bool canFetchMore(const QModelIndex& parent) const final; - //! Props - [[nodiscard]] int get_length() const ; - [[nodiscard]] transactions_proxy_model* get_transactions_proxy() const ; + // Getters + [[nodiscard]] int get_length() const; + [[nodiscard]] transactions_proxy_model* get_transactions_proxy() const; - signals: + signals: void lengthChanged(); void transactionsProxyMdlChanged(); }; diff --git a/src/core/atomicdex/models/qt.wallet.transactions.proxy.filter.model.cpp b/src/core/atomicdex/models/transactions_proxy_model.cpp similarity index 88% rename from src/core/atomicdex/models/qt.wallet.transactions.proxy.filter.model.cpp rename to src/core/atomicdex/models/transactions_proxy_model.cpp index d58b6da5e0..fcbc68ecbc 100644 --- a/src/core/atomicdex/models/qt.wallet.transactions.proxy.filter.model.cpp +++ b/src/core/atomicdex/models/transactions_proxy_model.cpp @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2013-2021 The Komodo Platform Developers. * + * Copyright © 2013-2022 The Komodo Platform Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -14,9 +14,8 @@ * * ******************************************************************************/ -//! Project Headers -#include "atomicdex/models/qt.wallet.transactions.proxy.filter.model.hpp" -#include "atomicdex/models/qt.wallet.transactions.model.hpp" +#include "transactions_proxy_model.hpp" +#include "transactions_model.hpp" namespace atomic_dex { @@ -24,8 +23,7 @@ namespace atomic_dex { } - bool - transactions_proxy_model::lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const + bool transactions_proxy_model::lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const { int role = this->sortRole(); QVariant left_data = sourceModel()->data(source_left, role); diff --git a/src/core/atomicdex/models/qt.wallet.transactions.proxy.filter.model.hpp b/src/core/atomicdex/models/transactions_proxy_model.hpp similarity index 85% rename from src/core/atomicdex/models/qt.wallet.transactions.proxy.filter.model.hpp rename to src/core/atomicdex/models/transactions_proxy_model.hpp index a27cf8705f..ff6cdf9a54 100644 --- a/src/core/atomicdex/models/qt.wallet.transactions.proxy.filter.model.hpp +++ b/src/core/atomicdex/models/transactions_proxy_model.hpp @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2013-2021 The Komodo Platform Developers. * + * Copyright © 2013-2022 The Komodo Platform Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -22,17 +22,14 @@ namespace atomic_dex { class transactions_proxy_model final : public QSortFilterProxyModel { - Q_OBJECT + Q_OBJECT - public: - //! Constructor + public: transactions_proxy_model(QObject* parent); + ~transactions_proxy_model() final = default; - //! Destructor - ~transactions_proxy_model() final = default; - - protected: - //! Override member functions + protected: + // Override [[nodiscard]] bool lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const final; }; } diff --git a/src/core/atomicdex/pages/qt.wallet.page.hpp b/src/core/atomicdex/pages/qt.wallet.page.hpp index 89ba9a3b71..033699279b 100644 --- a/src/core/atomicdex/pages/qt.wallet.page.hpp +++ b/src/core/atomicdex/pages/qt.wallet.page.hpp @@ -5,7 +5,7 @@ #include #include -#include "atomicdex/models/qt.wallet.transactions.model.hpp" +#include "atomicdex/models/transactions_model.hpp" namespace atomic_dex { diff --git a/src/core/atomicdex/services/mm2/mm2.service.hpp b/src/core/atomicdex/services/mm2/mm2.service.hpp index f2c1197c54..639ec8218f 100644 --- a/src/core/atomicdex/services/mm2/mm2.service.hpp +++ b/src/core/atomicdex/services/mm2/mm2.service.hpp @@ -1,18 +1,18 @@ /****************************************************************************** - * Copyright © 2013-2022 The Komodo Platform Developers. * - * * - * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * - * the top-level directory of this distribution for the individual copyright * - * holder information and the developer policies on copyright and licensing. * - * * - * Unless otherwise agreed in a custom licensing agreement, no part of the * - * Komodo Platform software, including this file may be copied, modified, * - * propagated or distributed except according to the terms contained in the * - * LICENSE file * - * * - * Removal or modification of this copyright notice is prohibited. * - * * - ******************************************************************************/ +* Copyright © 2013-2022 The Komodo Platform Developers. * +* * +* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * +* the top-level directory of this distribution for the individual copyright * +* holder information and the developer policies on copyright and licensing. * +* * +* Unless otherwise agreed in a custom licensing agreement, no part of the * +* Komodo Platform software, including this file may be copied, modified, * +* propagated or distributed except according to the terms contained in the * +* LICENSE file * +* * +* Removal or modification of this copyright notice is prohibited. * +* * +******************************************************************************/ #pragma once @@ -46,235 +46,235 @@ namespace atomic_dex { - namespace bm = boost::multiprecision; - namespace ag = antara::gaming; - - template - using t_shared_synchronized_value = boost::synchronized_value; - - using t_ticker = std::string; - using t_coins_registry = std::unordered_map; - using t_coins = std::vector; - - class ENTT_API mm2_service final : public ag::ecs::pre_update_system - { - public: - using t_pair_max_vol = std::pair; - using t_pair_min_vol = std::pair; - - private: - using t_mm2_time_point = std::chrono::high_resolution_clock::time_point; - using t_balance_registry = std::unordered_map; - using t_tx_registry = t_shared_synchronized_value>>; - using t_orderbook = boost::synchronized_value; - using t_orders_and_swaps = boost::synchronized_value; - using t_synchronized_ticker_pair = boost::synchronized_value>; - using t_synchronized_max_taker_vol = boost::synchronized_value; - using t_synchronized_min_taker_vol = boost::synchronized_value; - using t_synchronized_ticker = boost::synchronized_value; - - ag::ecs::system_manager& m_system_manager; - - mm2::mm2_client m_mm2_client; - - //! Current ticker - t_synchronized_ticker m_current_ticker{g_primary_dex_coin}; - - //! Current orderbook - t_synchronized_ticker_pair m_synchronized_ticker_pair{std::make_pair(g_primary_dex_coin, g_second_primary_dex_coin)}; - t_synchronized_max_taker_vol m_synchronized_max_taker_vol; - t_synchronized_min_taker_vol m_synchronized_min_taker_vol; - - //! Timers - t_mm2_time_point m_orderbook_clock; - t_mm2_time_point m_info_clock; - - //! Atomicity / Threads - std::atomic_bool m_mm2_running{false}; - std::atomic_bool m_orderbook_thread_active{false}; - std::atomic_bool m_zhtlc_enable_thread_active{false}; - std::atomic_size_t m_nb_update_required{0}; - std::thread m_mm2_init_thread; - - //! Current wallet name - std::string m_current_wallet_name; - - //! Mutex - mutable std::shared_mutex m_balance_mutex; - mutable std::shared_mutex m_coin_cfg_mutex; - mutable std::shared_mutex m_raw_coin_cfg_mutex; - - //! Concurrent Registry. - t_coins_registry& m_coins_informations{entity_registry_.set()}; - t_balance_registry m_balance_informations; - t_tx_registry m_tx_informations; - t_orderbook m_orderbook{t_orderbook_answer{}}; - t_orders_and_swaps m_orders_and_swaps{orders_and_swaps{}}; - t_mm2_raw_coins_registry m_mm2_raw_coins_cfg{parse_raw_mm2_coins_file()}; - - //! Balance factor - double m_balance_factor{1.0}; - - //! Refresh the orderbook registry (internal) - nlohmann::json prepare_batch_orderbook(bool is_a_reset); - - //! Batch balance / tx - std::tuple, std::vector> prepare_batch_balance_and_tx(bool only_tx = false) const; - auto batch_balance_and_tx(bool is_a_reset, std::vector tickers = {}, bool is_during_enabling = false, bool only_tx = false); - void process_balance_answer(const nlohmann::json& answer); - void process_tx_answer(const nlohmann::json& answer_json, std::string ticker); - void process_tx_tokenscan(const std::string& ticker, bool is_a_refresh); - void fetch_single_balance(const coin_config& cfg_infos); - - //! - std::pair process_batch_enable_answer(const nlohmann::json& answer); - [[nodiscard]] std::pair get_tx(t_mm2_ec& ec) const; - std::vector get_electrum_server_from_token(const std::string& ticker); - std::vector retrieve_coins_informations(); - - void handle_exception_pplx_task(pplx::task previous_task, const std::string& from, nlohmann::json batch); - - public: - //! Constructor - explicit mm2_service(entt::registry& registry, ag::ecs::system_manager& system_manager); - - //! Delete useless operator - mm2_service(const mm2_service& other) = delete; - mm2_service(const mm2_service&& other) = delete; - mm2_service& operator=(const mm2_service& other) = delete; - mm2_service& operator=(const mm2_service&& other) = delete; - - //! Destructor - ~mm2_service() final; - - //! Events - void on_refresh_orderbook(const orderbook_refresh& evt); - - void on_gui_enter_trading(const gui_enter_trading& evt); - - void on_gui_leave_trading(const gui_leave_trading& evt); - - void on_zhtlc_enter_enabling(const zhtlc_enter_enabling& evt); - - void on_zhtlc_leave_enabling(const zhtlc_leave_enabling& evt); - - //! Spawn mm2 instance with given seed - void spawn_mm2_instance(std::string wallet_name, std::string passphrase, bool with_pin_cfg = false); - - //! Refresh the current info (internally call process_balance and process_tx) - void fetch_infos_thread(bool is_a_fresh = true, bool only_tx = false); - - // Coins enabling functions - bool enable_default_coins(); // Enables required coins + coins enabled in the config - void enable_coins(const std::vector& tickers); - void enable_coins(const t_coins& coins); - void enable_coin(const std::string& ticker); - void enable_coin(const coin_config& coin_config); - private: - void enable_erc_family_coin(const coin_config& coin_config); - void enable_erc_family_coins(const t_coins& coins); - void enable_utxo_qrc20_coin(coin_config coin_config); - void enable_utxo_qrc20_coins(const t_coins& coins); - void enable_slp_coin(coin_config coin_config); - void enable_slp_coins(const t_coins& coins); - void enable_slp_testnet_coin(coin_config coin_config); - void enable_slp_testnet_coins(const t_coins& coins); - void enable_zhtlc(const t_coins& coins); - - // Balances processing functions - void process_balance_answer(const mm2::enable_bch_with_tokens_rpc& rpc); // Called after enabling SLP coins along tBCH/BCH. - void process_balance_answer(const mm2::enable_slp_rpc& rpc); // Called after enabling an SLP coin. + namespace bm = boost::multiprecision; + namespace ag = antara::gaming; + + template + using t_shared_synchronized_value = boost::synchronized_value; + + using t_ticker = std::string; + using t_coins_registry = std::unordered_map; + using t_coins = std::vector; + + class ENTT_API mm2_service final : public ag::ecs::pre_update_system + { + public: + using t_pair_max_vol = std::pair; + using t_pair_min_vol = std::pair; + + private: + using t_mm2_time_point = std::chrono::high_resolution_clock::time_point; + using t_balance_registry = std::unordered_map; + using t_tx_registry = t_shared_synchronized_value>>; + using t_orderbook = boost::synchronized_value; + using t_orders_and_swaps = boost::synchronized_value; + using t_synchronized_ticker_pair = boost::synchronized_value>; + using t_synchronized_max_taker_vol = boost::synchronized_value; + using t_synchronized_min_taker_vol = boost::synchronized_value; + using t_synchronized_ticker = boost::synchronized_value; + + ag::ecs::system_manager& m_system_manager; + + mm2::mm2_client m_mm2_client; + + //! Current ticker + t_synchronized_ticker m_current_ticker{g_primary_dex_coin}; + + //! Current orderbook + t_synchronized_ticker_pair m_synchronized_ticker_pair{std::make_pair(g_primary_dex_coin, g_second_primary_dex_coin)}; + t_synchronized_max_taker_vol m_synchronized_max_taker_vol; + t_synchronized_min_taker_vol m_synchronized_min_taker_vol; + + //! Timers + t_mm2_time_point m_orderbook_clock; + t_mm2_time_point m_info_clock; + + //! Atomicity / Threads + std::atomic_bool m_mm2_running{false}; + std::atomic_bool m_orderbook_thread_active{false}; + std::atomic_bool m_zhtlc_enable_thread_active{false}; + std::atomic_size_t m_nb_update_required{0}; + std::thread m_mm2_init_thread; + + //! Current wallet name + std::string m_current_wallet_name; + + //! Mutex + mutable std::shared_mutex m_balance_mutex; + mutable std::shared_mutex m_coin_cfg_mutex; + mutable std::shared_mutex m_raw_coin_cfg_mutex; + + //! Concurrent Registry. + t_coins_registry& m_coins_informations{entity_registry_.set()}; + t_balance_registry m_balance_informations; + t_tx_registry m_tx_informations; + t_orderbook m_orderbook{t_orderbook_answer{}}; + t_orders_and_swaps m_orders_and_swaps{orders_and_swaps{}}; + t_mm2_raw_coins_registry m_mm2_raw_coins_cfg{parse_raw_mm2_coins_file()}; + + //! Balance factor + double m_balance_factor{1.0}; + + //! Refresh the orderbook registry (internal) + nlohmann::json prepare_batch_orderbook(bool is_a_reset); + + //! Batch balance / tx + std::tuple, std::vector> prepare_batch_balance_and_tx(bool only_tx = false) const; + auto batch_balance_and_tx(bool is_a_reset, std::vector tickers = {}, bool is_during_enabling = false, bool only_tx = false); + void process_balance_answer(const nlohmann::json& answer); + void process_tx_answer(const nlohmann::json& answer_json, std::string ticker); + void process_tx_tokenscan(const std::string& ticker, bool is_a_refresh); + void fetch_single_balance(const coin_config& cfg_infos); + + //! + std::pair process_batch_enable_answer(const nlohmann::json& answer); + [[nodiscard]] std::pair get_tx(t_mm2_ec& ec) const; + std::vector get_electrum_server_from_token(const std::string& ticker); + std::vector retrieve_coins_informations(); + + void handle_exception_pplx_task(pplx::task previous_task, const std::string& from, nlohmann::json batch); + + public: + //! Constructor + explicit mm2_service(entt::registry& registry, ag::ecs::system_manager& system_manager); + + //! Delete useless operator + mm2_service(const mm2_service& other) = delete; + mm2_service(const mm2_service&& other) = delete; + mm2_service& operator=(const mm2_service& other) = delete; + mm2_service& operator=(const mm2_service&& other) = delete; + + //! Destructor + ~mm2_service() final; + + //! Events + void on_refresh_orderbook(const orderbook_refresh& evt); + + void on_gui_enter_trading(const gui_enter_trading& evt); + + void on_gui_leave_trading(const gui_leave_trading& evt); + + void on_zhtlc_enter_enabling(const zhtlc_enter_enabling& evt); + + void on_zhtlc_leave_enabling(const zhtlc_leave_enabling& evt); + + //! Spawn mm2 instance with given seed + void spawn_mm2_instance(std::string wallet_name, std::string passphrase, bool with_pin_cfg = false); + + //! Refresh the current info (internally call process_balance and process_tx) + void fetch_infos_thread(bool is_a_fresh = true, bool only_tx = false); + + // Coins enabling functions + bool enable_default_coins(); // Enables required coins + coins enabled in the config + void enable_coins(const std::vector& tickers); + void enable_coins(const t_coins& coins); + void enable_coin(const std::string& ticker); + void enable_coin(const coin_config& coin_config); + private: + void enable_erc_family_coin(const coin_config& coin_config); + void enable_erc_family_coins(const t_coins& coins); + void enable_utxo_qrc20_coin(coin_config coin_config); + void enable_utxo_qrc20_coins(const t_coins& coins); + void enable_slp_coin(coin_config coin_config); + void enable_slp_coins(const t_coins& coins); + void enable_slp_testnet_coin(coin_config coin_config); + void enable_slp_testnet_coins(const t_coins& coins); + void enable_zhtlc(const t_coins& coins); + + // Balances processing functions + void process_balance_answer(const mm2::enable_bch_with_tokens_rpc& rpc); // Called after enabling SLP coins along tBCH/BCH. + void process_balance_answer(const mm2::enable_slp_rpc& rpc); // Called after enabling an SLP coin. - public: - //! Add a new coin in the coin_info cfg add_new_coin(normal_cfg, mm2_cfg) - void add_new_coin(const nlohmann::json& coin_cfg_json, const nlohmann::json& raw_coin_cfg_json); - void remove_custom_coin(const std::string& ticker); - [[nodiscard]] bool is_this_ticker_present_in_raw_cfg(const std::string& ticker) const; - [[nodiscard]] bool is_this_ticker_present_in_normal_cfg(const std::string& ticker) const; - [[nodiscard]] bool is_zhtlc_coin_ready(const std::string coin) const; + public: + //! Add a new coin in the coin_info cfg add_new_coin(normal_cfg, mm2_cfg) + void add_new_coin(const nlohmann::json& coin_cfg_json, const nlohmann::json& raw_coin_cfg_json); + void remove_custom_coin(const std::string& ticker); + [[nodiscard]] bool is_this_ticker_present_in_raw_cfg(const std::string& ticker) const; + [[nodiscard]] bool is_this_ticker_present_in_normal_cfg(const std::string& ticker) const; + [[nodiscard]] bool is_zhtlc_coin_ready(const std::string coin) const; - //! Disable a single coin - bool disable_coin(const std::string& ticker, std::error_code& ec); + //! Disable a single coin + bool disable_coin(const std::string& ticker, std::error_code& ec); - //! Disable multiple coins, prefer this function if you want persistent disabling - void disable_multiple_coins(const std::vector& tickers); + //! Disable multiple coins, prefer this function if you want persistent disabling + void disable_multiple_coins(const std::vector& tickers); - //! Called every ticks, and execute tasks if the timer expire. - void update() final; + //! Called every ticks, and execute tasks if the timer expire. + void update() final; - //! Retrieve public address of the given ticker - std::string address(const std::string& ticker, t_mm2_ec& ec) const; + //! Retrieve public address of the given ticker + std::string address(const std::string& ticker, t_mm2_ec& ec) const; - //! Is MM2 Process correctly running ? - [[nodiscard]] const std::atomic_bool& is_mm2_running() const; + //! Is MM2 Process correctly running ? + [[nodiscard]] const std::atomic_bool& is_mm2_running() const; - //! Retrieve my balance for a given ticker as a string. - [[nodiscard]] std::string my_balance(const std::string& ticker, t_mm2_ec& ec) const; + //! Retrieve my balance for a given ticker as a string. + [[nodiscard]] std::string my_balance(const std::string& ticker, t_mm2_ec& ec) const; - //! Refresh the current orderbook (internally call process_orderbook) - void fetch_current_orderbook_thread(bool is_a_reset = false); + //! Refresh the current orderbook (internally call process_orderbook) + void fetch_current_orderbook_thread(bool is_a_reset = false); - void process_orderbook(bool is_a_reset = false); + void process_orderbook(bool is_a_reset = false); - //! Last 50 transactions maximum - [[nodiscard]] t_transactions get_tx_history(t_mm2_ec& ec) const; + //! Last 50 transactions maximum + [[nodiscard]] t_transactions get_tx_history(t_mm2_ec& ec) const; - //! Last 50 transactions maximum - [[nodiscard]] t_tx_state get_tx_state(t_mm2_ec& ec) const; + //! Last 50 transactions maximum + [[nodiscard]] t_tx_state get_tx_state(t_mm2_ec& ec) const; - //! Get coins that are currently enabled - [[nodiscard]] t_coins get_enabled_coins() const; + //! Get coins that are currently enabled + [[nodiscard]] t_coins get_enabled_coins() const; - //! Get coins that are active, but may be not enabled - [[nodiscard]] t_coins get_active_coins() const; + //! Get coins that are active, but may be not enabled + [[nodiscard]] t_coins get_active_coins() const; - //! Get Specific info about one coin - [[nodiscard]] coin_config get_coin_info(const std::string& ticker) const; - - // Tells if the given coin is enabled. - [[nodiscard]] bool is_coin_enabled(const std::string& ticker) const; - - // Tells if the given is coin is present inside the config. - [[nodiscard]] bool has_coin(const std::string& ticker) const; + //! Get Specific info about one coin + [[nodiscard]] coin_config get_coin_info(const std::string& ticker) const; + + // Tells if the given coin is enabled. + [[nodiscard]] bool is_coin_enabled(const std::string& ticker) const; + + // Tells if the given is coin is present inside the config. + [[nodiscard]] bool has_coin(const std::string& ticker) const; - //! Get Current orderbook - [[nodiscard]] t_orderbook_answer get_orderbook(t_mm2_ec& ec) const; + //! Get Current orderbook + [[nodiscard]] t_orderbook_answer get_orderbook(t_mm2_ec& ec) const; - //! Get Swaps - [[nodiscard]] orders_and_swaps get_orders_and_swaps() const; + //! Get Swaps + [[nodiscard]] orders_and_swaps get_orders_and_swaps() const; - //! Get balance with locked funds for a given ticker as a boost::multiprecision::cpp_dec_float_50. - [[nodiscard]] t_float_50 get_balance(const std::string& ticker) const; + //! Get balance with locked funds for a given ticker as a boost::multiprecision::cpp_dec_float_50. + [[nodiscard]] t_float_50 get_balance(const std::string& ticker) const; - //! Return true if we the balance of the `ticker` > amount, false otherwise. - [[nodiscard]] bool do_i_have_enough_funds(const std::string& ticker, const t_float_50& amount) const; + //! Return true if we the balance of the `ticker` > amount, false otherwise. + [[nodiscard]] bool do_i_have_enough_funds(const std::string& ticker, const t_float_50& amount) const; - [[nodiscard]] bool is_orderbook_thread_active() const; - [[nodiscard]] bool is_zhtlc_enable_thread_active() const; + [[nodiscard]] bool is_orderbook_thread_active() const; + [[nodiscard]] bool is_zhtlc_enable_thread_active() const; - [[nodiscard]] nlohmann::json get_raw_mm2_ticker_cfg(const std::string& ticker) const; + [[nodiscard]] nlohmann::json get_raw_mm2_ticker_cfg(const std::string& ticker) const; - [[nodiscard]] t_pair_max_vol get_taker_vol() const; - [[nodiscard]] t_pair_min_vol get_min_vol() const; + [[nodiscard]] t_pair_max_vol get_taker_vol() const; + [[nodiscard]] t_pair_min_vol get_min_vol() const; - //! Pin cfg api - [[nodiscard]] bool is_pin_cfg_enabled() const; - void reset_fake_balance_to_zero(const std::string& ticker); - void decrease_fake_balance(const std::string& ticker, const std::string& amount); - void batch_fetch_orders_and_swap(bool after_manual_reset = false); - - //! Async API - mm2::mm2_client& get_mm2_client(); - - //! Wallet api - [[nodiscard]] std::string get_current_ticker() const; - bool set_current_ticker(const std::string& ticker); + //! Pin cfg api + [[nodiscard]] bool is_pin_cfg_enabled() const; + void reset_fake_balance_to_zero(const std::string& ticker); + void decrease_fake_balance(const std::string& ticker, const std::string& amount); + void batch_fetch_orders_and_swap(bool after_manual_reset = false); + + //! Async API + mm2::mm2_client& get_mm2_client(); + + //! Wallet api + [[nodiscard]] std::string get_current_ticker() const; + bool set_current_ticker(const std::string& ticker); - //! Pagination - void set_orders_and_swaps_pagination_infos(std::size_t current_page = 1, std::size_t limit = 50, t_filtering_infos infos = {}); + //! Pagination + void set_orders_and_swaps_pagination_infos(std::size_t current_page = 1, std::size_t limit = 50, t_filtering_infos infos = {}); - void change_segwit_status(std::string ticker, bool status); - }; + void change_segwit_status(std::string ticker, bool status); + }; } // namespace atomic_dex REFL_AUTO(type(atomic_dex::mm2_service)) diff --git a/src/core/atomicdex/services/price/orderbook.scanner.service.cpp b/src/core/atomicdex/services/price/orderbook.scanner.service.cpp index 42f7645cb4..ca6fbce557 100644 --- a/src/core/atomicdex/services/price/orderbook.scanner.service.cpp +++ b/src/core/atomicdex/services/price/orderbook.scanner.service.cpp @@ -60,7 +60,7 @@ namespace atomic_dex //! Prepare request nlohmann::json batch = nlohmann::json::array(); - nlohmann::json best_orders_req_json = mm2::template_request("best_orders"); + nlohmann::json best_orders_req_json = mm2::template_request("best_orders", true); to_json(best_orders_req_json, req); batch.push_back(best_orders_req_json); diff --git a/src/core/atomicdex/utilities/qt.utilities.hpp b/src/core/atomicdex/utilities/qt.utilities.hpp index 036c8c0df7..ab760bc71d 100644 --- a/src/core/atomicdex/utilities/qt.utilities.hpp +++ b/src/core/atomicdex/utilities/qt.utilities.hpp @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2013-2021 The Komodo Platform Developers. * + * Copyright © 2013-2022 The Komodo Platform Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -16,7 +16,6 @@ #pragma once -//! QT Headers #include #include #include @@ -25,7 +24,6 @@ #include #include //> QCryptographicHash::hash, QCryptographicHash::Keccak_256 -//! Project Headers #include "atomicdex/config/app.cfg.hpp" #include "atomicdex/config/coins.cfg.hpp" #include "atomicdex/config/wallet.cfg.hpp" @@ -33,9 +31,8 @@ namespace atomic_dex { - template - auto - update_value(int role, const QVariant& value, const QModelIndex& idx, TModel& model) + template + inline auto update_value(int role, const QVariant& value, const QModelIndex& idx, QtModel& model) { if (auto prev_value = model.data(idx, role); value != prev_value) { @@ -54,8 +51,7 @@ namespace atomic_dex const atomic_dex::komodo_prices_provider& provider, const atomic_dex::coin_config& coin, const atomic_dex::cfg& config, const ag::ecs::system_manager& system_manager); - [[nodiscard]] QString - inline sha256_qstring_from_qt_byte_array(const QByteArray& byte_array) + [[nodiscard]] QString inline sha256_qstring_from_qt_byte_array(const QByteArray& byte_array) { return QLatin1String(QCryptographicHash::hash(byte_array, QCryptographicHash::Sha256).toHex()); }