From 4356ebf4a1c16beb75ff223b956a83a890ea34ac Mon Sep 17 00:00:00 2001 From: smk762 Date: Sat, 21 Sep 2024 19:34:51 +0800 Subject: [PATCH 01/25] add `optional` header --- src/core/atomicdex/api/kdf/address_format.hpp | 1 + src/core/atomicdex/api/kdf/kdf.hpp | 1 + src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.hpp | 1 + src/core/atomicdex/config/raw.kdf.coins.cfg.hpp | 1 + 4 files changed, 4 insertions(+) diff --git a/src/core/atomicdex/api/kdf/address_format.hpp b/src/core/atomicdex/api/kdf/address_format.hpp index 894ae0b4a..a37f57a6f 100644 --- a/src/core/atomicdex/api/kdf/address_format.hpp +++ b/src/core/atomicdex/api/kdf/address_format.hpp @@ -16,6 +16,7 @@ #pragma once +#include #include #include diff --git a/src/core/atomicdex/api/kdf/kdf.hpp b/src/core/atomicdex/api/kdf/kdf.hpp index e29c410d0..42ca488ad 100644 --- a/src/core/atomicdex/api/kdf/kdf.hpp +++ b/src/core/atomicdex/api/kdf/kdf.hpp @@ -22,6 +22,7 @@ //! Deps #include #include +#include //! Project Headers #include "atomicdex/config/coins.cfg.hpp" diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.hpp index 26452f959..ae2d22a80 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.hpp @@ -17,6 +17,7 @@ #pragma once #include +#include #include //> nlohmann::json #include "atomicdex/api/kdf/rpc.hpp" diff --git a/src/core/atomicdex/config/raw.kdf.coins.cfg.hpp b/src/core/atomicdex/config/raw.kdf.coins.cfg.hpp index 795818efc..43352d06b 100644 --- a/src/core/atomicdex/config/raw.kdf.coins.cfg.hpp +++ b/src/core/atomicdex/config/raw.kdf.coins.cfg.hpp @@ -7,6 +7,7 @@ //! Deps #include #include +#include //! Project #include "atomicdex/api/kdf/kdf.constants.hpp" From e3c8ba850a59bc3bcf90e08fd3498a2a925d72b1 Mon Sep 17 00:00:00 2001 From: smk762 Date: Sat, 21 Sep 2024 21:06:04 +0800 Subject: [PATCH 02/25] Add IBC channel input for tendermint sends --- atomic_defi_design/Dex/Wallet/SendModal.qml | 32 +++++++++++++++++-- .../api/kdf/rpc_v2/rpc2.withdraw.hpp | 1 + src/core/atomicdex/pages/qt.wallet.page.cpp | 6 ++-- src/core/atomicdex/pages/qt.wallet.page.hpp | 2 +- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/atomic_defi_design/Dex/Wallet/SendModal.qml b/atomic_defi_design/Dex/Wallet/SendModal.qml index aedb0f768..42a76e7cf 100644 --- a/atomic_defi_design/Dex/Wallet/SendModal.qml +++ b/atomic_defi_design/Dex/Wallet/SendModal.qml @@ -47,7 +47,7 @@ MultipageModal function getCryptoAmount() { return _preparePage.cryptoSendMode ? input_amount.text : equivalentAmount.value } - function prepareSendCoin(address, amount, with_fees, fees_amount, is_special_token, gas_limit, gas_price, memo="") { + function prepareSendCoin(address, amount, with_fees, fees_amount, is_special_token, gas_limit, gas_price, memo="", ibc_channel_id="") { let max = parseFloat(current_ticker_infos.balance) === parseFloat(amount) // Save for later check async_param_max = max @@ -60,7 +60,7 @@ MultipageModal gas_price, gas_limit: gas_limit === "" ? 0 : parseInt(gas_limit) } - api_wallet_page.send(address, amount, max, with_fees, fees_info, memo) + api_wallet_page.send(address, amount, max, with_fees, fees_info, memo, ibc_channel_id) } function sendCoin() { @@ -579,6 +579,31 @@ MultipageModal } } + // IBC channel ID + DefaultRectangle + { + visible: (["TENDERMINT", "TENDERMINTTOKEN"].includes(current_ticker_infos.type)) + enabled: !root.is_send_busy + + Layout.preferredWidth: 500 + Layout.preferredHeight: 44 + Layout.alignment: Qt.AlignHCenter + + color: input_memo.background.color + radius: input_memo.background.radius + + DefaultTextField + { + id: input_ibc_channel_id + + width: 470 + height: 44 + placeholderText: qsTr("Enter IBC channel ID") + forceFocus: true + font: DexTypo.body3 + } + } + ColumnLayout { visible: General.getCustomFeeType(current_ticker_infos) @@ -786,7 +811,8 @@ MultipageModal General.isSpecialToken(current_ticker_infos), input_custom_fees_gas.text, input_custom_fees_gas_price.text, - input_memo.text + input_memo.text, + input_ibc_channel_id.text ) } } diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp index 76b4b74bd..478235fea 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp @@ -30,6 +30,7 @@ namespace atomic_dex::kdf std::string amount; ///< ignored if max is true std::optional fees{std::nullopt}; ///< ignored if std::nullopt std::optional memo; ///< memo for tendermint + std::optional ibc_channel_id; ///< ibc_channel_id for tendermint bool max{false}; }; diff --git a/src/core/atomicdex/pages/qt.wallet.page.cpp b/src/core/atomicdex/pages/qt.wallet.page.cpp index 97fe85771..61e2218fb 100644 --- a/src/core/atomicdex/pages/qt.wallet.page.cpp +++ b/src/core/atomicdex/pages/qt.wallet.page.cpp @@ -508,7 +508,7 @@ namespace atomic_dex } void - wallet_page::send(const QString& address, const QString& amount, bool max, bool with_fees, QVariantMap fees_data, const QString& memo) + wallet_page::send(const QString& address, const QString& amount, bool max, bool with_fees, QVariantMap fees_data, const QString& memo, const QString& ibc_channel_id) { //! Preparation this->set_send_busy(true); @@ -693,7 +693,8 @@ namespace atomic_dex .to = address.toStdString(), .amount = max ? "0" : amount.toStdString(), .memo = memo.toStdString(), - .max = max + .max = max, + .ibc_channel_id = ibc_channel_id.toStdString() }; auto json_fees = nlohmann::json::parse(QString(QJsonDocument(QVariant(fees_data).toJsonObject()).toJson()).toStdString()); @@ -735,6 +736,7 @@ namespace atomic_dex nlohmann::json json_data = kdf::template_request("withdraw", true); kdf::to_json(json_data, withdraw_req); + SPDLOG_DEBUG("withdraw request: {}", json_data.dump(4)); batch.push_back(json_data); diff --git a/src/core/atomicdex/pages/qt.wallet.page.hpp b/src/core/atomicdex/pages/qt.wallet.page.hpp index 97b90f739..4c7e42b0a 100644 --- a/src/core/atomicdex/pages/qt.wallet.page.hpp +++ b/src/core/atomicdex/pages/qt.wallet.page.hpp @@ -88,7 +88,7 @@ namespace atomic_dex bool is_auth, const QString& tx_hex, bool is_claiming, bool is_max, const QString& amount); // Broadcast requires OS local user credentials verification. This is called by the Q_INVOKABLE broadcast() method after // entering credentials. - Q_INVOKABLE void send(const QString& address, const QString& amount, bool max, bool with_fees, QVariantMap fees_data, const QString& memo); + Q_INVOKABLE void send(const QString& address, const QString& amount, bool max, bool with_fees, QVariantMap fees_data, const QString& memo, const QString& ibc_channel_id); // QML API Properties Q_PROPERTY(transactions_model* transactions_mdl READ get_transactions_mdl NOTIFY transactionsMdlChanged) From aa704fc2b3d09f3d1ea09ef6baa83a68595d5329 Mon Sep 17 00:00:00 2001 From: smk762 Date: Sat, 21 Sep 2024 23:00:50 +0800 Subject: [PATCH 03/25] DefaultTextField -> DexTextField --- atomic_defi_design/Dex/Components/AddressField.qml | 2 +- atomic_defi_design/Dex/Components/AmountField.qml | 2 +- atomic_defi_design/Dex/Components/AmountFloatField.qml | 2 +- atomic_defi_design/Dex/Components/AmountIntField.qml | 2 +- atomic_defi_design/Dex/Components/DefaultTextField.qml | 8 -------- atomic_defi_design/Dex/Components/DexSweetComboBox.qml | 2 +- atomic_defi_design/Dex/Components/SearchField.qml | 2 +- .../Dex/Components/TextFieldWithTitle.qml | 2 +- atomic_defi_design/Dex/Components/qmldir | 2 +- atomic_defi_design/Dex/Screens/Startup/WalletsView.qml | 2 +- atomic_defi_design/Dex/Settings/RecoverSeedModal.qml | 2 +- atomic_defi_design/Dex/Wallet/SendModal.qml | 10 +++++----- atomic_defi_design/Dex/Wallet/SendModalContactList.qml | 2 +- src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.cpp | 4 ++++ src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp | 2 +- src/core/atomicdex/pages/qt.wallet.page.cpp | 4 ++-- src/core/atomicdex/pages/qt.wallet.page.hpp | 2 +- 17 files changed, 24 insertions(+), 28 deletions(-) delete mode 100644 atomic_defi_design/Dex/Components/DefaultTextField.qml diff --git a/atomic_defi_design/Dex/Components/AddressField.qml b/atomic_defi_design/Dex/Components/AddressField.qml index aa972a1a9..d3c31e846 100644 --- a/atomic_defi_design/Dex/Components/AddressField.qml +++ b/atomic_defi_design/Dex/Components/AddressField.qml @@ -1,6 +1,6 @@ import QtQuick 2.15 -DefaultTextField { +DexTextField { readonly property int max_length: 50 validator: RegExpValidator { diff --git a/atomic_defi_design/Dex/Components/AmountField.qml b/atomic_defi_design/Dex/Components/AmountField.qml index 1d280a8bc..ed2ce8d9f 100644 --- a/atomic_defi_design/Dex/Components/AmountField.qml +++ b/atomic_defi_design/Dex/Components/AmountField.qml @@ -1,6 +1,6 @@ import QtQuick 2.15 -DefaultTextField +DexTextField { validator: RegExpValidator { diff --git a/atomic_defi_design/Dex/Components/AmountFloatField.qml b/atomic_defi_design/Dex/Components/AmountFloatField.qml index 06af631e1..17bc43ef5 100644 --- a/atomic_defi_design/Dex/Components/AmountFloatField.qml +++ b/atomic_defi_design/Dex/Components/AmountFloatField.qml @@ -1,6 +1,6 @@ import QtQuick 2.15 -DefaultTextField +DexTextField { validator: RegExpValidator { diff --git a/atomic_defi_design/Dex/Components/AmountIntField.qml b/atomic_defi_design/Dex/Components/AmountIntField.qml index 30dce4be6..6a78de3d8 100644 --- a/atomic_defi_design/Dex/Components/AmountIntField.qml +++ b/atomic_defi_design/Dex/Components/AmountIntField.qml @@ -1,6 +1,6 @@ import QtQuick 2.15 -DefaultTextField +DexTextField { property bool allowFloat: false validator: RegExpValidator diff --git a/atomic_defi_design/Dex/Components/DefaultTextField.qml b/atomic_defi_design/Dex/Components/DefaultTextField.qml deleted file mode 100644 index a0c57e16c..000000000 --- a/atomic_defi_design/Dex/Components/DefaultTextField.qml +++ /dev/null @@ -1,8 +0,0 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import "../Constants" -import App 1.0 - -DexTextField { - -} diff --git a/atomic_defi_design/Dex/Components/DexSweetComboBox.qml b/atomic_defi_design/Dex/Components/DexSweetComboBox.qml index cc47e64e6..cacef269b 100644 --- a/atomic_defi_design/Dex/Components/DexSweetComboBox.qml +++ b/atomic_defi_design/Dex/Components/DexSweetComboBox.qml @@ -85,7 +85,7 @@ ComboBox { anchors.rightMargin: 5 - DefaultTextField + DexTextField { id: input_coin_filter placeholderText: qsTr("Search") diff --git a/atomic_defi_design/Dex/Components/SearchField.qml b/atomic_defi_design/Dex/Components/SearchField.qml index 40bcae12d..34353082e 100644 --- a/atomic_defi_design/Dex/Components/SearchField.qml +++ b/atomic_defi_design/Dex/Components/SearchField.qml @@ -37,7 +37,7 @@ Rectangle } } - DefaultTextField + DexTextField { id: _textField diff --git a/atomic_defi_design/Dex/Components/TextFieldWithTitle.qml b/atomic_defi_design/Dex/Components/TextFieldWithTitle.qml index e0bd8aae3..4d74cd8f3 100644 --- a/atomic_defi_design/Dex/Components/TextFieldWithTitle.qml +++ b/atomic_defi_design/Dex/Components/TextFieldWithTitle.qml @@ -51,7 +51,7 @@ ColumnLayout } } - DefaultTextField + DexTextField { id: input_field diff --git a/atomic_defi_design/Dex/Components/qmldir b/atomic_defi_design/Dex/Components/qmldir index dab879424..248066ada 100644 --- a/atomic_defi_design/Dex/Components/qmldir +++ b/atomic_defi_design/Dex/Components/qmldir @@ -16,7 +16,7 @@ Rectangle 1.0 DefaultRectangle.qml ScrollView 1.0 DefaultScrollView.qml SearchField 1.0 SearchField.qml Text 1.0 DefaultText.qml -TextField 1.0 DefaultTextField.qml +TextField 1.0 DexTextField.qml TextFieldWithTitle 1.0 TextFieldWithTitle.qml ToolTip 1.0 DefaultTooltip.qml UserIcon 1.0 UserIcon.qml diff --git a/atomic_defi_design/Dex/Screens/Startup/WalletsView.qml b/atomic_defi_design/Dex/Screens/Startup/WalletsView.qml index 32b0c8592..e0b0fff90 100644 --- a/atomic_defi_design/Dex/Screens/Startup/WalletsView.qml +++ b/atomic_defi_design/Dex/Screens/Startup/WalletsView.qml @@ -79,7 +79,7 @@ SetupPage visible: wallet_count > 0 // Searchbar - DefaultTextField + DexTextField { id: wallet_search visible: wallet_count > 5 diff --git a/atomic_defi_design/Dex/Settings/RecoverSeedModal.qml b/atomic_defi_design/Dex/Settings/RecoverSeedModal.qml index 39253a778..967b29227 100644 --- a/atomic_defi_design/Dex/Settings/RecoverSeedModal.qml +++ b/atomic_defi_design/Dex/Settings/RecoverSeedModal.qml @@ -262,7 +262,7 @@ MultipageModal HorizontalLine { Layout.fillWidth: true } - DefaultTextField + DexTextField { visible: coinsList.visible enabled: coinsList.enabled diff --git a/atomic_defi_design/Dex/Wallet/SendModal.qml b/atomic_defi_design/Dex/Wallet/SendModal.qml index 42a76e7cf..0b19e98ee 100644 --- a/atomic_defi_design/Dex/Wallet/SendModal.qml +++ b/atomic_defi_design/Dex/Wallet/SendModal.qml @@ -47,7 +47,7 @@ MultipageModal function getCryptoAmount() { return _preparePage.cryptoSendMode ? input_amount.text : equivalentAmount.value } - function prepareSendCoin(address, amount, with_fees, fees_amount, is_special_token, gas_limit, gas_price, memo="", ibc_channel_id="") { + function prepareSendCoin(address, amount, with_fees, fees_amount, is_special_token, gas_limit, gas_price, memo="", ibc_source_channel="") { let max = parseFloat(current_ticker_infos.balance) === parseFloat(amount) // Save for later check async_param_max = max @@ -60,7 +60,7 @@ MultipageModal gas_price, gas_limit: gas_limit === "" ? 0 : parseInt(gas_limit) } - api_wallet_page.send(address, amount, max, with_fees, fees_info, memo, ibc_channel_id) + api_wallet_page.send(address, amount, max, with_fees, fees_info, memo, ibc_source_channel) } function sendCoin() { @@ -263,7 +263,7 @@ MultipageModal color: input_address.background.color radius: input_address.background.radius - DefaultTextField + DexTextField { id: input_address @@ -567,7 +567,7 @@ MultipageModal color: input_memo.background.color radius: input_memo.background.radius - DefaultTextField + DexTextField { id: input_memo @@ -592,7 +592,7 @@ MultipageModal color: input_memo.background.color radius: input_memo.background.radius - DefaultTextField + DexTextField { id: input_ibc_channel_id diff --git a/atomic_defi_design/Dex/Wallet/SendModalContactList.qml b/atomic_defi_design/Dex/Wallet/SendModalContactList.qml index 9e9bbd58a..ac9ace2a7 100644 --- a/atomic_defi_design/Dex/Wallet/SendModalContactList.qml +++ b/atomic_defi_design/Dex/Wallet/SendModalContactList.qml @@ -26,7 +26,7 @@ MultipageModal titleText: qsTr("Select a contact with an %1 address").arg(ticker) // Searchbar - DefaultTextField + DexTextField { Layout.alignment: Qt.AlignHCenter Layout.fillWidth: true diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.cpp index ac0b96a04..d0a9d1a34 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.cpp @@ -47,6 +47,10 @@ namespace atomic_dex::kdf obj["params"]["to"] = cfg.to; obj["params"]["max"] = cfg.max; if (cfg.memo.has_value()) + { + obj["params"]["ibc_source_channel"] = cfg.ibc_source_channel.value(); + } + if (cfg.memo.has_value()) { obj["params"]["memo"] = cfg.memo.value(); } diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp index 478235fea..2bd780fae 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp @@ -30,7 +30,7 @@ namespace atomic_dex::kdf std::string amount; ///< ignored if max is true std::optional fees{std::nullopt}; ///< ignored if std::nullopt std::optional memo; ///< memo for tendermint - std::optional ibc_channel_id; ///< ibc_channel_id for tendermint + std::optional ibc_source_channel; ///< ibc_source_channel for tendermint bool max{false}; }; diff --git a/src/core/atomicdex/pages/qt.wallet.page.cpp b/src/core/atomicdex/pages/qt.wallet.page.cpp index 61e2218fb..8caef21ed 100644 --- a/src/core/atomicdex/pages/qt.wallet.page.cpp +++ b/src/core/atomicdex/pages/qt.wallet.page.cpp @@ -508,7 +508,7 @@ namespace atomic_dex } void - wallet_page::send(const QString& address, const QString& amount, bool max, bool with_fees, QVariantMap fees_data, const QString& memo, const QString& ibc_channel_id) + wallet_page::send(const QString& address, const QString& amount, bool max, bool with_fees, QVariantMap fees_data, const QString& memo, const QString& ibc_source_channel) { //! Preparation this->set_send_busy(true); @@ -694,7 +694,7 @@ namespace atomic_dex .amount = max ? "0" : amount.toStdString(), .memo = memo.toStdString(), .max = max, - .ibc_channel_id = ibc_channel_id.toStdString() + .ibc_source_channel = ibc_source_channel.toStdString() }; auto json_fees = nlohmann::json::parse(QString(QJsonDocument(QVariant(fees_data).toJsonObject()).toJson()).toStdString()); diff --git a/src/core/atomicdex/pages/qt.wallet.page.hpp b/src/core/atomicdex/pages/qt.wallet.page.hpp index 4c7e42b0a..678d0164d 100644 --- a/src/core/atomicdex/pages/qt.wallet.page.hpp +++ b/src/core/atomicdex/pages/qt.wallet.page.hpp @@ -88,7 +88,7 @@ namespace atomic_dex bool is_auth, const QString& tx_hex, bool is_claiming, bool is_max, const QString& amount); // Broadcast requires OS local user credentials verification. This is called by the Q_INVOKABLE broadcast() method after // entering credentials. - Q_INVOKABLE void send(const QString& address, const QString& amount, bool max, bool with_fees, QVariantMap fees_data, const QString& memo, const QString& ibc_channel_id); + Q_INVOKABLE void send(const QString& address, const QString& amount, bool max, bool with_fees, QVariantMap fees_data, const QString& memo, const QString& ibc_source_channel); // QML API Properties Q_PROPERTY(transactions_model* transactions_mdl READ get_transactions_mdl NOTIFY transactionsMdlChanged) From 10dfa8df6d1d6b2edebf413a412d3dc729c1c4e8 Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 23 Sep 2024 09:54:33 +0800 Subject: [PATCH 04/25] rm duplicate struct --- src/core/atomicdex/api/kdf/balance_info.cpp | 12 ------------ src/core/atomicdex/api/kdf/balance_info.hpp | 16 ---------------- .../rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp | 6 +++--- .../api/kdf/rpc_v2/rpc2.enable_erc20.cpp | 2 +- .../api/kdf/rpc_v2/rpc2.enable_erc20.hpp | 4 ++-- .../kdf/rpc_v2/rpc2.enable_eth_with_tokens.hpp | 6 +++--- .../api/kdf/rpc_v2/rpc2.enable_slp_rpc.cpp | 2 +- .../api/kdf/rpc_v2/rpc2.enable_slp_rpc.hpp | 4 ++-- 8 files changed, 12 insertions(+), 40 deletions(-) delete mode 100644 src/core/atomicdex/api/kdf/balance_info.cpp delete mode 100644 src/core/atomicdex/api/kdf/balance_info.hpp diff --git a/src/core/atomicdex/api/kdf/balance_info.cpp b/src/core/atomicdex/api/kdf/balance_info.cpp deleted file mode 100644 index d300f6a1b..000000000 --- a/src/core/atomicdex/api/kdf/balance_info.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include - -#include "atomicdex/api/kdf/balance_info.hpp" - -namespace atomic_dex::kdf -{ - void from_json(const nlohmann::json& j, balance_info& in) - { - j.at("spendable").get_to(in.spendable); - j.at("unspendable").get_to(in.unspendable); - } -} \ No newline at end of file diff --git a/src/core/atomicdex/api/kdf/balance_info.hpp b/src/core/atomicdex/api/kdf/balance_info.hpp deleted file mode 100644 index 94f896197..000000000 --- a/src/core/atomicdex/api/kdf/balance_info.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include - -#include //> nlohmann::json - -namespace atomic_dex::kdf -{ - struct balance_info - { - std::string spendable; - std::string unspendable; - }; - - void from_json(const nlohmann::json& j, balance_info& in); -} \ No newline at end of file diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp index 038902918..658bc96f7 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp @@ -20,7 +20,7 @@ #include "atomicdex/config/electrum.cfg.hpp" #include "atomicdex/api/kdf/address_format.hpp" -#include "atomicdex/api/kdf/balance_info.hpp" +#include "atomicdex/api/kdf/balance_infos.hpp" #include "atomicdex/api/kdf/rpc.hpp" #include "atomicdex/api/kdf/utxo_merge_params.hpp" @@ -65,13 +65,13 @@ namespace atomic_dex::kdf { derivation_method_t derivation_method; std::string pubkey; - balance_info balances; + balance_infos balances; }; struct slp_address_infos_t { derivation_method_t derivation_method; std::string pubkey; - std::unordered_map balances; + std::unordered_map balances; }; std::size_t current_block; diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.cpp index b36673023..0587f0305 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.cpp @@ -21,6 +21,6 @@ namespace atomic_dex::kdf { j.at("platform_coin").get_to(in.platform_coin); j.at("required_confirmations").get_to(in.required_confirmations); - j.at("balances").get_to>(in.balances); + j.at("balances").get_to>(in.balances); } } \ No newline at end of file diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.hpp index ae2d22a80..c99b07fe7 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.hpp @@ -21,7 +21,7 @@ #include //> nlohmann::json #include "atomicdex/api/kdf/rpc.hpp" -#include "atomicdex/api/kdf/balance_info.hpp" +#include "atomicdex/api/kdf/balance_infos.hpp" namespace atomic_dex::kdf { @@ -40,7 +40,7 @@ namespace atomic_dex::kdf { std::string platform_coin; int required_confirmations; - std::unordered_map balances; + std::unordered_map balances; }; using expected_error_type = rpc_basic_error_type; diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_eth_with_tokens.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_eth_with_tokens.hpp index 3b40f1748..7e378aac2 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_eth_with_tokens.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_eth_with_tokens.hpp @@ -19,7 +19,7 @@ #include #include "atomicdex/api/kdf/rpc.hpp" -#include "atomicdex/api/kdf/balance_info.hpp" +#include "atomicdex/api/kdf/balance_infos.hpp" #include "atomicdex/config/enable.cfg.hpp" #include "atomicdex/constants/qt.coins.enums.hpp" @@ -60,13 +60,13 @@ namespace atomic_dex::kdf { derivation_method_t derivation_method; std::string pubkey; - balance_info balances; + balance_infos balances; }; struct erc20_address_infos_t { derivation_method_t derivation_method; std::string pubkey; - std::unordered_map balances; + std::unordered_map balances; }; std::size_t current_block; diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_slp_rpc.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_slp_rpc.cpp index 9906fae3c..0422df437 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_slp_rpc.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_slp_rpc.cpp @@ -22,6 +22,6 @@ namespace atomic_dex::kdf j.at("platform_coin").get_to(in.platform_coin); j.at("required_confirmations").get_to(in.required_confirmations); j.at("token_id").get_to(in.token_id); - j.at("balances").get_to>(in.balances); + j.at("balances").get_to>(in.balances); } } \ No newline at end of file diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_slp_rpc.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_slp_rpc.hpp index 1fbe40301..4ed2462a1 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_slp_rpc.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_slp_rpc.hpp @@ -23,7 +23,7 @@ #include //> nlohmann::json #include "atomicdex/api/kdf/rpc.hpp" -#include "atomicdex/api/kdf/balance_info.hpp" +#include "atomicdex/api/kdf/balance_infos.hpp" namespace atomic_dex::kdf { @@ -43,7 +43,7 @@ namespace atomic_dex::kdf std::string token_id; std::string platform_coin; int required_confirmations; - std::unordered_map balances; + std::unordered_map balances; }; using expected_error_type = rpc_basic_error_type; From 84208f2edfeef6bbb107e831fd0e2b4b0e41b0ad Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 23 Sep 2024 09:55:55 +0800 Subject: [PATCH 05/25] fix tendermint activation --- .../rpc_v2/rpc2.enable_tendermint_token.cpp | 2 +- .../rpc_v2/rpc2.enable_tendermint_token.hpp | 6 +++--- .../rpc2.enable_tendermint_with_assets.cpp | 1 + .../rpc2.enable_tendermint_with_assets.hpp | 7 ++++--- src/core/atomicdex/pages/qt.wallet.page.cpp | 4 ++-- .../atomicdex/services/kdf/kdf.service.cpp | 20 +++++++++++-------- 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_token.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_token.cpp index 81bafbc1b..cbdf20206 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_token.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_token.cpp @@ -20,6 +20,6 @@ namespace atomic_dex::kdf void from_json(const nlohmann::json& j, enable_tendermint_token_rpc_result& in) { j.at("platform_coin").get_to(in.platform_coin); - j.at("balances").get_to>(in.balances); + j.at("balances").get_to>(in.balances); } } \ No newline at end of file diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_token.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_token.hpp index 9597d1a38..fcf180a9f 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_token.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_token.hpp @@ -22,7 +22,7 @@ #include //> nlohmann::json #include "atomicdex/api/kdf/rpc.hpp" -#include "atomicdex/api/kdf/balance_info.hpp" +#include "atomicdex/api/kdf/balance_infos.hpp" namespace atomic_dex::kdf { @@ -40,7 +40,7 @@ namespace atomic_dex::kdf struct expected_result_type { std::string platform_coin; - std::unordered_map balances; + std::unordered_map balances; }; using expected_error_type = rpc_basic_error_type; @@ -48,7 +48,7 @@ namespace atomic_dex::kdf expected_request_type request; std::optional result; std::optional error; - std::string raw_result; + std::string raw_result; }; using enable_tendermint_token_rpc_request = enable_tendermint_token_rpc::expected_request_type; diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.cpp index cc28a43f4..95c578ad9 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.cpp @@ -25,6 +25,7 @@ namespace atomic_dex::kdf void from_json(const nlohmann::json& json, enable_tendermint_with_assets_result_rpc& out) { + out.ticker = json["ticker"]; out.address = json["address"]; out.current_block = json["current_block"]; out.tendermint_balances_infos = json["balance"].get(); diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.hpp index 6bad7330a..05325f95a 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.hpp @@ -3,7 +3,7 @@ #include #include "atomicdex/api/kdf/rpc.hpp" -#include "atomicdex/api/kdf/balance_info.hpp" +#include "atomicdex/api/kdf/balance_infos.hpp" #include "atomicdex/config/electrum.cfg.hpp" namespace atomic_dex::kdf @@ -33,13 +33,14 @@ namespace atomic_dex::kdf { struct tendermint_balance_infos_t { - balance_info balances; + balance_infos balances; }; + std::string ticker; std::string address; std::size_t current_block; tendermint_balance_infos_t tendermint_balances_infos; - std::unordered_map tendermint_token_balances_infos; + std::unordered_map tendermint_token_balances_infos; }; using expected_error_type = rpc_basic_error_type; diff --git a/src/core/atomicdex/pages/qt.wallet.page.cpp b/src/core/atomicdex/pages/qt.wallet.page.cpp index 8caef21ed..d9b7fa9d5 100644 --- a/src/core/atomicdex/pages/qt.wallet.page.cpp +++ b/src/core/atomicdex/pages/qt.wallet.page.cpp @@ -693,8 +693,8 @@ namespace atomic_dex .to = address.toStdString(), .amount = max ? "0" : amount.toStdString(), .memo = memo.toStdString(), - .max = max, - .ibc_source_channel = ibc_source_channel.toStdString() + .ibc_source_channel = ibc_source_channel.toStdString(), + .max = max }; auto json_fees = nlohmann::json::parse(QString(QJsonDocument(QVariant(fees_data).toJsonObject()).toJson()).toStdString()); diff --git a/src/core/atomicdex/services/kdf/kdf.service.cpp b/src/core/atomicdex/services/kdf/kdf.service.cpp index 71469bd2e..3e07a9f8a 100644 --- a/src/core/atomicdex/services/kdf/kdf.service.cpp +++ b/src/core/atomicdex/services/kdf/kdf.service.cpp @@ -1031,16 +1031,16 @@ namespace atomic_dex { for (const auto& tendermint_coin_info : rpc.request.tokens_params) { - SPDLOG_ERROR("{} {}: ", tendermint_coin_info.ticker, rpc.error->error_type); - fetch_single_balance(get_coin_info(tendermint_coin_info.ticker)); std::unique_lock lock(m_coin_cfg_mutex); m_coins_informations[tendermint_coin_info.ticker].currently_enabled = true; + fetch_single_balance(get_coin_info(tendermint_coin_info.ticker)); dispatcher_.trigger(coin_fully_initialized{.tickers = {tendermint_coin_info.ticker}}); } } } else { + SPDLOG_DEBUG("{} failed to activate", rpc.request.ticker); std::unique_lock lock(m_coin_cfg_mutex); m_coins_informations[rpc.request.ticker].currently_enabled = false; update_coin_active({rpc.request.ticker}, false); @@ -1058,12 +1058,9 @@ namespace atomic_dex for (const auto& tendermint_token_addresses_info : rpc.result->tendermint_token_balances_infos) { dispatcher_.trigger(coin_fully_initialized{.tickers = {tendermint_token_addresses_info.first}}); - process_balance_answer(rpc); - std::unique_lock lock(m_coin_cfg_mutex); m_coins_informations[tendermint_token_addresses_info.first].currently_enabled = true; } } - process_balance_answer(rpc); } }; @@ -1176,7 +1173,6 @@ namespace atomic_dex { const auto& answer = rpc.result.value(); kdf::balance_answer balance_answer; - balance_answer.address = answer.balances.begin()->first; balance_answer.balance = answer.balances.begin()->second.spendable; balance_answer.coin = answer.platform_coin; @@ -1193,7 +1189,7 @@ namespace atomic_dex { kdf::balance_answer balance_answer; - balance_answer.coin = rpc.request.ticker; + balance_answer.coin = answer.ticker; balance_answer.balance = answer.tendermint_balances_infos.balances.spendable; balance_answer.address = answer.address; { @@ -1518,10 +1514,18 @@ namespace atomic_dex { auto& answer = answers[i]; std::string ticker; + // SPDLOG_DEBUG("batch_balance_and_tx answer: {}", answer.dump(4)); if (batch_array[i].contains("mmrpc") && batch_array[i].at("mmrpc") == "2.0") { - ticker = batch_array[i].at("params").at("coin"); + if (batch_array[i].at("params").contains("coin")) + { + ticker = batch_array[i].at("params").at("coin"); + } + else if (batch_array[i].at("params").contains("ticker")) + { + ticker = batch_array[i].at("params").at("ticker"); + } } else { From b9ab86335817983a68faa6fd550382415182d1f0 Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 23 Sep 2024 09:56:16 +0800 Subject: [PATCH 06/25] accomodate tendermint tx history --- src/core/atomicdex/api/kdf/kdf.client.cpp | 33 ++++++++++--------- .../atomicdex/api/kdf/transaction.data.cpp | 19 ++++++++++- .../atomicdex/api/kdf/transaction.data.hpp | 2 ++ 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/src/core/atomicdex/api/kdf/kdf.client.cpp b/src/core/atomicdex/api/kdf/kdf.client.cpp index 8fc267787..7e89ce851 100644 --- a/src/core/atomicdex/api/kdf/kdf.client.cpp +++ b/src/core/atomicdex/api/kdf/kdf.client.cpp @@ -71,6 +71,7 @@ namespace json_req.insert(json_req.end(), json_data); } request.set_body(json_req.dump()); + // SPDLOG_DEBUG("request: {}", json_req.dump()); return request; } @@ -78,17 +79,18 @@ namespace Rpc process_rpc_answer(const web::http::http_response& answer) { std::string body = TO_STD_STR(answer.extract_string(true).get()); - // SPDLOG_DEBUG("body: {}", body); + // SPDLOG_INFO("body: {}", body); nlohmann::json json_answer; Rpc rpc; try { json_answer = nlohmann::json::parse(body); - // SPDLOG_DEBUG("rpc answer: {}", json_answer.dump(4)); + // SPDLOG_DEBUG("json_answer: {}", json_answer.dump(4)); } catch (const nlohmann::json::parse_error& error) { SPDLOG_ERROR("rpc answer error: {}", error.what()); + // SPDLOG_DEBUG("body: {}", body); } if (Rpc::is_v2) @@ -103,7 +105,6 @@ namespace SPDLOG_DEBUG("rpc2 answer: error"); rpc.error = json_answer.get(); rpc.raw_result = json_answer.dump(); - SPDLOG_DEBUG("rpc.raw_result: {}", rpc.raw_result); } } else @@ -206,19 +207,19 @@ namespace atomic_dex::kdf generate_client() .request(http_request, m_token_source.get_token()) .template then([on_rpc_processed, request](const web::http::http_response& resp) - { - try - { - auto rpc = process_rpc_answer(resp); - rpc.request = request; - on_rpc_processed(rpc); - } - catch (const std::exception& ex) - { - // SPDLOG_DEBUG("process_rpc_answer rpc.result: {}", rpc.raw_result); - SPDLOG_ERROR(ex.what()); - } - }); + { + try + { + auto rpc = process_rpc_answer(resp); + rpc.request = request; + on_rpc_processed(rpc); + } + catch (const std::exception& ex) + { + SPDLOG_ERROR(ex.what()); + } + } + ); } void diff --git a/src/core/atomicdex/api/kdf/transaction.data.cpp b/src/core/atomicdex/api/kdf/transaction.data.cpp index c9975f984..f8b97c6cb 100644 --- a/src/core/atomicdex/api/kdf/transaction.data.cpp +++ b/src/core/atomicdex/api/kdf/transaction.data.cpp @@ -114,7 +114,24 @@ namespace atomic_dex::kdf if (j.contains("transaction_type")) { - cfg.transaction_type = j.at("transaction_type").get(); + // Check if the "transaction_type" is an object for tendermint + if (j.at("transaction_type").is_object()) + { + for (auto& [k, v] : j.at("transaction_type").items()) { + cfg.tendermint_transaction_type = k; + cfg.tendermint_transaction_type_hash = v; + } + } + // Check if "transaction_type" is a string + else if (j.at("transaction_type").is_string()) + { + cfg.transaction_type = j.at("transaction_type").get(); + } + else + { + // Handle the case where "transaction_type" is neither a string nor an object + SPDLOG_ERROR("Unexpected type for transaction_type in JSON"); + } } // transaction_fee only in ZHTLC response diff --git a/src/core/atomicdex/api/kdf/transaction.data.hpp b/src/core/atomicdex/api/kdf/transaction.data.hpp index f25c9e9bf..296c89efe 100644 --- a/src/core/atomicdex/api/kdf/transaction.data.hpp +++ b/src/core/atomicdex/api/kdf/transaction.data.hpp @@ -74,6 +74,8 @@ namespace atomic_dex::kdf std::optional internal_id; std::optional confirmations; std::optional transaction_type; + std::optional tendermint_transaction_type; + std::optional tendermint_transaction_type_hash; std::optional memo; std::string timestamp_as_date; ///< human readeable timestamp }; From cd5e85d4681f4c8eb1f306a1b097c3ad7aebc60e Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 23 Sep 2024 09:56:34 +0800 Subject: [PATCH 07/25] use feature branch of coins repo --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 49fa003f6..50cba46fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,7 +78,7 @@ FetchContent_Declare( ) FetchContent_Declare(jl777-coins - URL https://github.com/KomodoPlatform/coins/archive/master.zip) + URL https://github.com/KomodoPlatform/coins/archive/add/tendermint-coins.zip) #FetchContent_Declare(adex-generics-coins # URL https://github.com/KomodoPlatform/komodo-wallet-desktop/archive/main.zip) From 64d1c68aa45ccd90bee8e27722650f8c1636f6ca Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 26 Sep 2024 23:05:53 +0800 Subject: [PATCH 08/25] set default timespoan for chart --- src/core/atomicdex/pages/qt.portfolio.page.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/atomicdex/pages/qt.portfolio.page.hpp b/src/core/atomicdex/pages/qt.portfolio.page.hpp index 7df303ed2..5a39a2ba1 100644 --- a/src/core/atomicdex/pages/qt.portfolio.page.hpp +++ b/src/core/atomicdex/pages/qt.portfolio.page.hpp @@ -51,7 +51,7 @@ namespace atomic_dex global_coins_cfg_model* m_global_cfg_mdl; QString m_current_balance_all{"0"}; QString m_main_current_balance_all{"0"}; - WalletChartsCategories m_current_chart_category; + WalletChartsCategories m_current_chart_category{WalletChartsCategories::OneMonth}; public: //! Constructor From e4b900288d8517451d3aeeca1249e189f0648937 Mon Sep 17 00:00:00 2001 From: smk762 Date: Fri, 27 Sep 2024 14:12:07 +0800 Subject: [PATCH 09/25] dont fetch infos while activation in progress --- src/core/atomicdex/services/kdf/kdf.service.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/atomicdex/services/kdf/kdf.service.cpp b/src/core/atomicdex/services/kdf/kdf.service.cpp index 3e07a9f8a..6bfeda71e 100644 --- a/src/core/atomicdex/services/kdf/kdf.service.cpp +++ b/src/core/atomicdex/services/kdf/kdf.service.cpp @@ -332,10 +332,14 @@ namespace atomic_dex } } - if (s_info >= 29s) + if (s_info >= 23s) { - fetch_infos_thread(); // leads to batch_balance_and_tx - m_info_clock = std::chrono::high_resolution_clock::now(); + std::unique_lock lock(m_activation_mutex); + if (m_activation_queue.empty()) + { + fetch_infos_thread(); // leads to batch_balance_and_tx + m_info_clock = std::chrono::high_resolution_clock::now(); + } } } From 5a8a0859d22dd7d1c18469f2c7b1673369083ccd Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 24 Oct 2024 12:57:44 +0800 Subject: [PATCH 10/25] use dev branch api --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 49fa003f6..75083b98a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,13 +60,13 @@ endif () ##! We fetch our dependencies if (APPLE) FetchContent_Declare(kdf - URL https://github.com/KomodoPlatform/komodo-defi-framework/releases/download/v2.1.0-beta/mm2-35e923949-Darwin-Release.zip) + URL https://sdk.devbuilds.komodo.earth/dev/mm2_b35a818-mac-x86-64.zip) elseif (UNIX AND NOT APPLE) FetchContent_Declare(kdf - URL https://github.com/KomodoPlatform/komodo-defi-framework/releases/download/v2.1.0-beta/mm2-35e923949-Linux-Release.zip) + URL https://sdk.devbuilds.komodo.earth/dev/mm2_b35a818-linux-x86-64.zip) else () FetchContent_Declare(kdf - URL https://github.com/KomodoPlatform/komodo-defi-framework/releases/download/v2.1.0-beta/mm2-35e923949-Win64.zip) + URL https://sdk.devbuilds.komodo.earth/dev/mm2_b35a818-win-x86-64.zip) endif () #FetchContent_Declare(qmaterial URL https://github.com/KomodoPlatform/Qaterial/archive/last-clang-working-2.zip) From 6f772cb7dfd9786147597ca5028c727a028bc094 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 24 Oct 2024 13:05:47 +0800 Subject: [PATCH 11/25] increment version --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/workflows/atomicdex-desktop-cd.yml | 2 +- .github/workflows/atomicdex-desktop-ci.yml | 2 +- CMakeLists.txt | 2 +- cmake/project.metadata.cmake | 2 +- src/core/atomicdex/version/version.hpp | 8 ++++---- vcpkg.json | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index c83aeedff..2f0984199 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -26,7 +26,7 @@ Please describe what you expected to happen. **Operating Environment(s):** - OS: [e.g. Windows/OSX/Linux. If Linux, include distro. ] - OS version: [e.g. 7/10/11, 10.13/10.15, 18.04/20.04 ] - - Komodo Wallet Desktop Version: [e.g. 0.8.0] + - Komodo Wallet Desktop Version: [e.g. 0.8.1] - Build branch: [e.g. master/dev] diff --git a/.github/workflows/atomicdex-desktop-cd.yml b/.github/workflows/atomicdex-desktop-cd.yml index 18d8bc396..0066556a3 100644 --- a/.github/workflows/atomicdex-desktop-cd.yml +++ b/.github/workflows/atomicdex-desktop-cd.yml @@ -9,7 +9,7 @@ env: DEX_PROJECT_NAME: "komodo-wallet" DEX_DISPLAY_NAME: "Komodo Wallet" DEX_COMPANY: "KomodoPlatform" - DEX_VERSION: "0.8.0" + DEX_VERSION: "0.8.1" DEX_WEBSITE: "https://atomicdex.io/" jobs: diff --git a/.github/workflows/atomicdex-desktop-ci.yml b/.github/workflows/atomicdex-desktop-ci.yml index 87af63785..61e7bc499 100644 --- a/.github/workflows/atomicdex-desktop-ci.yml +++ b/.github/workflows/atomicdex-desktop-ci.yml @@ -17,7 +17,7 @@ env: DEX_PROJECT_NAME: "komodo-wallet" DEX_DISPLAY_NAME: "Komodo Wallet" DEX_COMPANY: "KomodoPlatform" - DEX_VERSION: "0.8.0" + DEX_VERSION: "0.8.1" DEX_WEBSITE: "https://atomicdex.io/" VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/b/vcpkg_cache VCPKG_BINARY_SOURCES: clear;x-gha,readwrite diff --git a/CMakeLists.txt b/CMakeLists.txt index 75083b98a..2372d2063 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ include(vcpkg_prerequisites) include(qt_prerequisites) include(cfg_hash) -project(${DEX_PROJECT_NAME} LANGUAGES CXX VERSION 0.8.0) +project(${DEX_PROJECT_NAME} LANGUAGES CXX VERSION 0.8.1) message(STATUS "${PROJECT_NAME} is version ${PROJECT_VERSION}") include(cmake_default_options) diff --git a/cmake/project.metadata.cmake b/cmake/project.metadata.cmake index b799e8dbf..d4001dfd3 100644 --- a/cmake/project.metadata.cmake +++ b/cmake/project.metadata.cmake @@ -7,7 +7,7 @@ set(DEX_DISPLAY_NAME "Komodo Wallet") set(DEX_MAINTENANCE_TOOL_NAME "Komodo Wallet Maintenance Tool") set(DEX_COMPANY "KomodoPlatform") set(DEX_WEBSITE "https://atomicdex.io/") -set(DEX_VERSION "0.8.0") +set(DEX_VERSION "0.8.1") set(DEX_SUPPORT_PAGE "https://support.komodoplatform.com/support/home") set(DEX_DISCORD "https://komodoplatform.com/discord") set(DEX_TWITTER "https://twitter.com/AtomicDEX") diff --git a/src/core/atomicdex/version/version.hpp b/src/core/atomicdex/version/version.hpp index 921a49078..11c2aac03 100644 --- a/src/core/atomicdex/version/version.hpp +++ b/src/core/atomicdex/version/version.hpp @@ -21,24 +21,24 @@ namespace atomic_dex constexpr const char* get_version() { - return "0.8.0-beta"; + return "0.8.1-beta"; } constexpr int get_num_version() noexcept { - return 80; + return 81; } constexpr const char* get_raw_version() { - return "0.8.0"; + return "0.8.1"; } constexpr const char* get_precedent_raw_version() { - return "0.7.2"; + return "0.8.0"; } } // namespace atomic_dex diff --git a/vcpkg.json b/vcpkg.json index d53535cd4..031888ed4 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,6 @@ { "name": "komodo-wallet-desktop", - "version-string": "0.8.0", + "version-string": "0.8.1", "dependencies": [ "entt", "boost-multiprecision", From 4af13412d09f2aceb7f25486967fc0893daf4065 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 24 Oct 2024 15:56:25 +0800 Subject: [PATCH 12/25] fix some build warnings --- src/core/atomicdex/models/qt.orderbook.model.cpp | 2 +- src/core/atomicdex/models/qt.portfolio.model.cpp | 2 ++ src/core/atomicdex/pages/qt.portfolio.page.cpp | 4 +++- src/core/atomicdex/pages/qt.portfolio.page.hpp | 2 +- src/core/atomicdex/pages/qt.settings.page.cpp | 2 +- src/core/atomicdex/pages/qt.trading.page.cpp | 2 +- src/core/atomicdex/services/price/global.provider.cpp | 8 ++++++++ 7 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/core/atomicdex/models/qt.orderbook.model.cpp b/src/core/atomicdex/models/qt.orderbook.model.cpp index 16b68c1b1..06b542a34 100644 --- a/src/core/atomicdex/models/qt.orderbook.model.cpp +++ b/src/core/atomicdex/models/qt.orderbook.model.cpp @@ -524,7 +524,7 @@ namespace atomic_dex void orderbook_model::refresh_orderbook_model_data(const t_orders_contents& orderbook, bool is_bestorders) { - // SPDLOG_DEBUG("[orderbook_model::refresh_orderbook_model_data], is_bestorders: {}", is_bestorders); + SPDLOG_DEBUG("[orderbook_model::refresh_orderbook_model_data], is_bestorders: {}", is_bestorders); auto refresh_functor = [this](const std::vector& contents) { for (auto&& order: contents) diff --git a/src/core/atomicdex/models/qt.portfolio.model.cpp b/src/core/atomicdex/models/qt.portfolio.model.cpp index f05d01f8f..850241aed 100644 --- a/src/core/atomicdex/models/qt.portfolio.model.cpp +++ b/src/core/atomicdex/models/qt.portfolio.model.cpp @@ -131,7 +131,9 @@ namespace atomic_dex QJsonObject status = nlohmann_json_object_to_qt_json_object(coin_info.activation_status); update_value(ActivationStatus, status, idx, *this); SPDLOG_DEBUG("updated activation status of: {}", ticker); + return true; } + return false; } } diff --git a/src/core/atomicdex/pages/qt.portfolio.page.cpp b/src/core/atomicdex/pages/qt.portfolio.page.cpp index d958da586..4e4a227d0 100644 --- a/src/core/atomicdex/pages/qt.portfolio.page.cpp +++ b/src/core/atomicdex/pages/qt.portfolio.page.cpp @@ -163,12 +163,14 @@ namespace atomic_dex void portfolio_page::set_chart_category(WalletChartsCategories category) { + SPDLOG_INFO("new m_current_chart_category: {}", m_current_chart_category); + SPDLOG_INFO("qint32(category): {}", qint32(category)); SPDLOG_INFO("new chart category: {}", QMetaEnum::fromType().valueToKey(category)); if (m_current_chart_category != category) { m_current_chart_category = category; QSettings& settings = entity_registry_.ctx(); - settings.setValue("WalletChartsCategory", qint32(m_current_chart_category)); + settings.setValue("WalletChartsCategory", qint32(category)); if (m_system_manager.get_system().is_kdf_running() && m_system_manager.has_system()) { m_system_manager.get_system().manual_refresh("set_chart_category"); diff --git a/src/core/atomicdex/pages/qt.portfolio.page.hpp b/src/core/atomicdex/pages/qt.portfolio.page.hpp index 7df303ed2..5a39a2ba1 100644 --- a/src/core/atomicdex/pages/qt.portfolio.page.hpp +++ b/src/core/atomicdex/pages/qt.portfolio.page.hpp @@ -51,7 +51,7 @@ namespace atomic_dex global_coins_cfg_model* m_global_cfg_mdl; QString m_current_balance_all{"0"}; QString m_main_current_balance_all{"0"}; - WalletChartsCategories m_current_chart_category; + WalletChartsCategories m_current_chart_category{WalletChartsCategories::OneMonth}; public: //! Constructor diff --git a/src/core/atomicdex/pages/qt.settings.page.cpp b/src/core/atomicdex/pages/qt.settings.page.cpp index c28589032..251f2046d 100644 --- a/src/core/atomicdex/pages/qt.settings.page.cpp +++ b/src/core/atomicdex/pages/qt.settings.page.cpp @@ -315,7 +315,7 @@ namespace atomic_dex { SPDLOG_WARN("Cannot change currency to {} for reason: {}", current_currency.toStdString(), reason); // Try next in line - int8_t selected_idx = utils::get_index_str(m_config.possible_currencies, current_currency.toStdString()); + unsigned long selected_idx = utils::get_index_str(m_config.possible_currencies, current_currency.toStdString()); if (selected_idx < m_config.possible_currencies.size() - 1) { set_current_currency(QString::fromStdString(m_config.possible_currencies[selected_idx + 1])); diff --git a/src/core/atomicdex/pages/qt.trading.page.cpp b/src/core/atomicdex/pages/qt.trading.page.cpp index 9becdbea2..78bfa6cb1 100644 --- a/src/core/atomicdex/pages/qt.trading.page.cpp +++ b/src/core/atomicdex/pages/qt.trading.page.cpp @@ -810,7 +810,7 @@ namespace atomic_dex SPDLOG_WARN("KDF service not available, required to clear forms - skipping"); return; } - // SPDLOG_DEBUG("clearing forms : {}", from.toStdString()); + SPDLOG_DEBUG("clearing forms : {}", from.toStdString()); if (m_preferred_order.has_value() && m_current_trading_mode == TradingModeGadget::Simple && m_selected_order_status == SelectedOrderGadget::OrderNotExistingAnymore) diff --git a/src/core/atomicdex/services/price/global.provider.cpp b/src/core/atomicdex/services/price/global.provider.cpp index 8648436e0..772577cc0 100644 --- a/src/core/atomicdex/services/price/global.provider.cpp +++ b/src/core/atomicdex/services/price/global.provider.cpp @@ -99,6 +99,14 @@ namespace atomic_dex global_price_service::refresh_other_coins_rates( const std::string& quote_id, const std::string& ticker, bool with_update_providers, std::atomic_uint16_t nb_try) { + SPDLOG_DEBUG("refresh_other_coins_rates: {} - {} - {} - {}", quote_id, ticker, with_update_providers, nb_try); + if (nb_try > 3) + { + SPDLOG_ERROR("Failed to fetch rates for ticker after 3 tries: {}", ticker); + this->m_coin_rate_providers[ticker] = "0.00"; + return; + } + t_float_50 price = safe_float(get_rate_conversion("USD", ticker, true)); if (price <= 0) { From 7940fbaebb78284d51f757d9285aa63db8188c5e Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 24 Oct 2024 16:00:57 +0800 Subject: [PATCH 13/25] fix windows CI build error --- src/core/atomicdex/api/kdf/kdf.client.cpp | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/core/atomicdex/api/kdf/kdf.client.cpp b/src/core/atomicdex/api/kdf/kdf.client.cpp index 8fc267787..0d01945d3 100644 --- a/src/core/atomicdex/api/kdf/kdf.client.cpp +++ b/src/core/atomicdex/api/kdf/kdf.client.cpp @@ -205,20 +205,20 @@ namespace atomic_dex::kdf auto http_request = make_request(request); generate_client() .request(http_request, m_token_source.get_token()) - .template then([on_rpc_processed, request](const web::http::http_response& resp) - { - try - { - auto rpc = process_rpc_answer(resp); - rpc.request = request; - on_rpc_processed(rpc); - } - catch (const std::exception& ex) - { - // SPDLOG_DEBUG("process_rpc_answer rpc.result: {}", rpc.raw_result); - SPDLOG_ERROR(ex.what()); - } - }); + .then([on_rpc_processed, request](const web::http::http_response& resp) + { + try + { + auto rpc = process_rpc_answer(resp); + rpc.request = request; + on_rpc_processed(rpc); + } + catch (const std::exception& ex) + { + // SPDLOG_DEBUG("process_rpc_answer rpc.result: {}", rpc.raw_result); + SPDLOG_ERROR(ex.what()); + } + }); } void From d0441548aff5394c52783b9050bf4429f411aadd Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 24 Oct 2024 16:09:18 +0800 Subject: [PATCH 14/25] fix macos build errors --- .github/workflows/atomicdex-desktop-cd.yml | 4 ++++ ci_tools_atomic_dex/ci_scripts/osx_script.sh | 2 ++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/atomicdex-desktop-cd.yml b/.github/workflows/atomicdex-desktop-cd.yml index 0066556a3..92a2c5a1c 100644 --- a/.github/workflows/atomicdex-desktop-cd.yml +++ b/.github/workflows/atomicdex-desktop-cd.yml @@ -255,6 +255,8 @@ jobs: - name: Install deps (MacOS/Release) run: | + rm '/usr/local/bin/2to3-3.12' + rm '/usr/local/bin/idle3' brew update brew upgrade brew install autoconf \ @@ -319,6 +321,8 @@ jobs: - name: Install deps (MacOS/Debug) run: | + rm '/usr/local/bin/2to3-3.12' + rm '/usr/local/bin/idle3' brew update brew upgrade brew install autoconf \ diff --git a/ci_tools_atomic_dex/ci_scripts/osx_script.sh b/ci_tools_atomic_dex/ci_scripts/osx_script.sh index 35c101b08..afd3cc31e 100755 --- a/ci_tools_atomic_dex/ci_scripts/osx_script.sh +++ b/ci_tools_atomic_dex/ci_scripts/osx_script.sh @@ -2,6 +2,8 @@ # Workaround for https://github.com/actions/setup-python/issues/577 +rm '/usr/local/bin/2to3-3.12' +rm '/usr/local/bin/idle3' brew update brew install autoconf \ automake \ From a3f5aa2e4ea644b9a56461876b29912892f5b89c Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 24 Oct 2024 18:06:56 +0800 Subject: [PATCH 15/25] handle llvm dep symlink fail --- .github/workflows/atomicdex-desktop-cd.yml | 2 -- ci_tools_atomic_dex/ci_scripts/osx_script.sh | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/atomicdex-desktop-cd.yml b/.github/workflows/atomicdex-desktop-cd.yml index 92a2c5a1c..24778dc32 100644 --- a/.github/workflows/atomicdex-desktop-cd.yml +++ b/.github/workflows/atomicdex-desktop-cd.yml @@ -255,8 +255,6 @@ jobs: - name: Install deps (MacOS/Release) run: | - rm '/usr/local/bin/2to3-3.12' - rm '/usr/local/bin/idle3' brew update brew upgrade brew install autoconf \ diff --git a/ci_tools_atomic_dex/ci_scripts/osx_script.sh b/ci_tools_atomic_dex/ci_scripts/osx_script.sh index afd3cc31e..67e569b9f 100755 --- a/ci_tools_atomic_dex/ci_scripts/osx_script.sh +++ b/ci_tools_atomic_dex/ci_scripts/osx_script.sh @@ -2,8 +2,6 @@ # Workaround for https://github.com/actions/setup-python/issues/577 -rm '/usr/local/bin/2to3-3.12' -rm '/usr/local/bin/idle3' brew update brew install autoconf \ automake \ @@ -14,9 +12,12 @@ brew install autoconf \ gnu-sed \ coreutils \ libtool \ - llvm \ gnu-getopt +brew unlink python@3.12 +brew install llvm +brew link --overwrite python@3.12 + pip3 install yq export CC=clang export CXX=clang++ From 1f8e41d34a47245621d68e065d6d71463bff706c Mon Sep 17 00:00:00 2001 From: smk762 Date: Fri, 25 Oct 2024 14:01:15 +0800 Subject: [PATCH 16/25] brew fermenting --- .github/workflows/atomicdex-desktop-cd.yml | 2 -- .github/workflows/atomicdex-desktop-ci.yml | 8 ++++---- ci_tools_atomic_dex/ci_scripts/osx_script.sh | 2 ++ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/atomicdex-desktop-cd.yml b/.github/workflows/atomicdex-desktop-cd.yml index 24778dc32..0066556a3 100644 --- a/.github/workflows/atomicdex-desktop-cd.yml +++ b/.github/workflows/atomicdex-desktop-cd.yml @@ -319,8 +319,6 @@ jobs: - name: Install deps (MacOS/Debug) run: | - rm '/usr/local/bin/2to3-3.12' - rm '/usr/local/bin/idle3' brew update brew upgrade brew install autoconf \ diff --git a/.github/workflows/atomicdex-desktop-ci.yml b/.github/workflows/atomicdex-desktop-ci.yml index 61e7bc499..0728505c9 100644 --- a/.github/workflows/atomicdex-desktop-ci.yml +++ b/.github/workflows/atomicdex-desktop-ci.yml @@ -204,7 +204,7 @@ jobs: - name: import code signing certificates (macos) if: runner.os == 'macOS' && 'KomodoPlatform/komodo-wallet-desktop' == github.repository - uses: Apple-Actions/import-codesign-certs@v1 + uses: Apple-Actions/import-codesign-certs@v3 with: keychain: ${{ github.run_id }} keychain-password: ${{ github.run_id }} @@ -213,7 +213,7 @@ jobs: - name: import installer code signing certificates (macos) if: runner.os == 'macOS' && 'KomodoPlatform/komodo-wallet-desktop' == github.repository - uses: apple-actions/import-codesign-certs@v1 + uses: apple-actions/import-codesign-certs@v3 with: keychain: ${{ github.run_id }} keychain-password: ${{ github.run_id }} @@ -232,7 +232,7 @@ jobs: echo $HOME/sdk ls $HOME/sdk export MAC_SIGN_IDENTITY="${{ secrets.MAC_SIGN_IDENTITY }}" - export INSTALLER_MAC_SIGN_IDENTITY="${{ secrets.INSTALLER_MAC_SIGN_IDENTITY }}" + export INSTALLER_MAC_SIGN_IDENTITY="${{ secrets.MAC_SIGN_IDENTITY }}" export APPLE_ATOMICDEX_PASSWORD="${{ secrets.APPLE_ATOMICDEX_PASSWORD }}" export APPLE_ID="${{ secrets.APPLE_ID }}" export ASC_PUBLIC_ID="${{ secrets.ASC_PUBLIC_ID }}" @@ -382,7 +382,7 @@ jobs: if: runner.os == 'macOS' && 'KomodoPlatform/komodo-wallet-desktop' == github.repository run: | export MAC_SIGN_IDENTITY="${{ secrets.MAC_SIGN_IDENTITY }}" - export INSTALLER_MAC_SIGN_IDENTITY="${{ secrets.INSTALLER_MAC_SIGN_IDENTITY }}" + export INSTALLER_MAC_SIGN_IDENTITY="${{ secrets.MAC_SIGN_IDENTITY }}" export APPLE_ATOMICDEX_PASSWORD="${{ secrets.APPLE_ATOMICDEX_PASSWORD }}" export APPLE_ID="${{ secrets.APPLE_ID }}" export ASC_PUBLIC_ID="${{ secrets.ASC_PUBLIC_ID }}" diff --git a/ci_tools_atomic_dex/ci_scripts/osx_script.sh b/ci_tools_atomic_dex/ci_scripts/osx_script.sh index 67e569b9f..4fa728be8 100755 --- a/ci_tools_atomic_dex/ci_scripts/osx_script.sh +++ b/ci_tools_atomic_dex/ci_scripts/osx_script.sh @@ -15,8 +15,10 @@ brew install autoconf \ gnu-getopt brew unlink python@3.12 +brew unlink python@3.13 brew install llvm brew link --overwrite python@3.12 +brew link --overwrite python@3.13 pip3 install yq export CC=clang From 99c7775b9749dd1268c09185055bb142f0969c97 Mon Sep 17 00:00:00 2001 From: smk762 Date: Fri, 25 Oct 2024 19:50:33 +0800 Subject: [PATCH 17/25] update ci upload action --- .github/workflows/atomicdex-desktop-cd.yml | 12 ++++++------ .github/workflows/atomicdex-desktop-ci.yml | 14 +++++++------- ci_tools_atomic_dex/ci_scripts/osx_script.sh | 2 -- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/atomicdex-desktop-cd.yml b/.github/workflows/atomicdex-desktop-cd.yml index 0066556a3..679363b76 100644 --- a/.github/workflows/atomicdex-desktop-cd.yml +++ b/.github/workflows/atomicdex-desktop-cd.yml @@ -120,7 +120,7 @@ jobs: zip AtomicDEX-Pro-Installer.zip ./installer/AtomicDEX-Pro-Installer - name: Upload artifacts (Linux) - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: AtomicDEX-Pro-Installer-linux-release path: ./ci_tools_atomic_dex/AtomicDEX-Pro-Installer.zip @@ -232,7 +232,7 @@ jobs: zip AtomicDEX-Pro-Installer.zip ./installer/AtomicDEX-Pro-Installer - name: Upload artifacts (Linux/Debug) - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: AtomicDEX-Pro-Installer-linux-debug path: ./ci_tools_atomic_dex/AtomicDEX-Pro-Installer.zip @@ -296,7 +296,7 @@ jobs: ls bundle-Release/atomicDEX-Pro.dmg - name: Upload artifacts (MacOS/Release) - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: dexpro-mac-release.dmg path: ./ci_tools_atomic_dex/bundle-Release/atomicDEX-Pro.dmg @@ -360,7 +360,7 @@ jobs: ls bundle-Debug/atomicDEX-Pro.dmg - name: Upload artifacts (MacOS/Debug) - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: dexpro-mac-debug.dmg path: ./ci_tools_atomic_dex/bundle-Debug/atomicDEX-Pro.dmg @@ -438,7 +438,7 @@ jobs: ls bundle-Release/bundle.zip - name: Upload artifacts (Win/Release) - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: dexpro-win-release path: ./ci_tools_atomic_dex/bundle-Release/bundle.zip @@ -516,7 +516,7 @@ jobs: ls bundle-Debug/bundle.zip - name: Upload artifacts (Windows/Debug) - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: dexpro-win-debug path: ./ci_tools_atomic_dex/bundle-Debug/bundle.zip diff --git a/.github/workflows/atomicdex-desktop-ci.yml b/.github/workflows/atomicdex-desktop-ci.yml index 0728505c9..0c885eafd 100644 --- a/.github/workflows/atomicdex-desktop-ci.yml +++ b/.github/workflows/atomicdex-desktop-ci.yml @@ -288,7 +288,7 @@ jobs: - name: Upload bundle artifact (Linux ZSTD) if: runner.os == 'Linux' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ env.artifact_name_zstd }} path: ./bundled/linux/${{ env.target_name_zstd }} @@ -296,7 +296,7 @@ jobs: - name: Upload bundle artifact (Linux ZIP) if: runner.os == 'Linux' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ env.artifact_name_zip }} path: ./bundled/linux/${{ env.target_name_zip }} @@ -304,7 +304,7 @@ jobs: - name: Upload bundle artifact (Linux AppImage) if: runner.os == 'Linux' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ env.artifact_name_appimage }} path: ./bundled/linux/${{ env.target_name_appimage }} @@ -318,7 +318,7 @@ jobs: - name: Upload artifacts (MacOS dmg) if: runner.os == 'macOS' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ env.artifact_name_dmg }} path: ./bundled/osx/${{ env.DEX_PROJECT_NAME }}.dmg @@ -326,7 +326,7 @@ jobs: - name: Upload artifacts (MacOS installer) if: runner.os == 'macOS' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ env.artifact_name_installer }} path: ./bundled/osx/${{ env.DEX_PROJECT_NAME }}_installer.7z @@ -341,7 +341,7 @@ jobs: - name: Upload artifacts (Windows zip) if: runner.os == 'Windows' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ env.artifact_name_zip }} path: ./bundled/windows/${{ env.DEX_PROJECT_NAME }}.zip @@ -349,7 +349,7 @@ jobs: - name: Upload artifacts (Windows installer) if: runner.os == 'Windows' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ env.artifact_name_installer }} path: ./bundled/windows/${{ env.DEX_PROJECT_NAME }}_installer.exe diff --git a/ci_tools_atomic_dex/ci_scripts/osx_script.sh b/ci_tools_atomic_dex/ci_scripts/osx_script.sh index 4fa728be8..67e569b9f 100755 --- a/ci_tools_atomic_dex/ci_scripts/osx_script.sh +++ b/ci_tools_atomic_dex/ci_scripts/osx_script.sh @@ -15,10 +15,8 @@ brew install autoconf \ gnu-getopt brew unlink python@3.12 -brew unlink python@3.13 brew install llvm brew link --overwrite python@3.12 -brew link --overwrite python@3.13 pip3 install yq export CC=clang From 389312a7e3a3f6355b593781e243bb889712e0ff Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 29 Oct 2024 23:42:03 +0800 Subject: [PATCH 18/25] add electrum connection limit params to activation --- src/core/atomicdex/services/kdf/kdf.service.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/atomicdex/services/kdf/kdf.service.cpp b/src/core/atomicdex/services/kdf/kdf.service.cpp index 71469bd2e..179b8600d 100644 --- a/src/core/atomicdex/services/kdf/kdf.service.cpp +++ b/src/core/atomicdex/services/kdf/kdf.service.cpp @@ -856,6 +856,8 @@ namespace atomic_dex .coin_type = coin_config.coin_type, .is_testnet = coin_config.is_testnet.value_or(false), .with_tx_history = true + .min_connected = 1 + .max_connected = 3 }; if (coin_config.merge_utxos.value_or(false)) { From 195aca51393c864db4964541f6038aa37c135b3a Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 30 Oct 2024 12:01:43 +0800 Subject: [PATCH 19/25] add missing commas --- src/core/atomicdex/services/kdf/kdf.service.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/atomicdex/services/kdf/kdf.service.cpp b/src/core/atomicdex/services/kdf/kdf.service.cpp index 179b8600d..f1df43e9c 100644 --- a/src/core/atomicdex/services/kdf/kdf.service.cpp +++ b/src/core/atomicdex/services/kdf/kdf.service.cpp @@ -855,8 +855,8 @@ namespace atomic_dex .servers = coin_config.electrum_urls.value_or(get_electrum_server_from_token(coin_config.ticker)), .coin_type = coin_config.coin_type, .is_testnet = coin_config.is_testnet.value_or(false), - .with_tx_history = true - .min_connected = 1 + .with_tx_history = true, + .min_connected = 1, .max_connected = 3 }; if (coin_config.merge_utxos.value_or(false)) From cfc95455363e7be9081e5f4fd41da7afab78433e Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 30 Oct 2024 18:59:56 +0800 Subject: [PATCH 20/25] add new params to struct and json transform --- src/core/atomicdex/api/kdf/rpc_v1/rpc.electrum.cpp | 4 +++- src/core/atomicdex/api/kdf/rpc_v1/rpc.electrum.hpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/atomicdex/api/kdf/rpc_v1/rpc.electrum.cpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.electrum.cpp index 9b6d678da..d381fd5c7 100644 --- a/src/core/atomicdex/api/kdf/rpc_v1/rpc.electrum.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.electrum.cpp @@ -29,6 +29,8 @@ namespace atomic_dex::kdf { j["coin"] = cfg.coin_name; j["tx_history"] = cfg.with_tx_history; + j["min_connected"] = 1; + j["max_connected"] = 3; if (!cfg.servers.empty()) { @@ -70,4 +72,4 @@ namespace atomic_dex::kdf j.at("balance").get_to(cfg.balance); j.at("result").get_to(cfg.result); } -} // namespace atomic_dex::kdf \ No newline at end of file +} // namespace atomic_dex::kdf diff --git a/src/core/atomicdex/api/kdf/rpc_v1/rpc.electrum.hpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.electrum.hpp index 1a12c2ca4..749b9d96f 100644 --- a/src/core/atomicdex/api/kdf/rpc_v1/rpc.electrum.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.electrum.hpp @@ -39,6 +39,8 @@ namespace atomic_dex::kdf std::optional merge_params; std::optional> bchd_urls; std::optional allow_slp_unsafe_conf; + int min_connected{1}; + int max_connected{3}; }; struct electrum_answer @@ -59,4 +61,4 @@ namespace atomic_dex { using t_electrum_request = kdf::electrum_request; using t_electrum_answer = kdf::electrum_answer; -} // namespace atomic_dex \ No newline at end of file +} // namespace atomic_dex From bc24099a1a38c6e2742e79af168b2979cada2f07 Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 11 Nov 2024 18:45:41 +0800 Subject: [PATCH 21/25] use latest dev kdf --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2372d2063..689a88efa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,13 +60,13 @@ endif () ##! We fetch our dependencies if (APPLE) FetchContent_Declare(kdf - URL https://sdk.devbuilds.komodo.earth/dev/mm2_b35a818-mac-x86-64.zip) + URL https://sdk.devbuilds.komodo.earth/dev/mm2_dfca6b7-mac-x86-64.zip) elseif (UNIX AND NOT APPLE) FetchContent_Declare(kdf - URL https://sdk.devbuilds.komodo.earth/dev/mm2_b35a818-linux-x86-64.zip) + URL https://sdk.devbuilds.komodo.earth/dev/mm2_dfca6b7-linux-x86-64.zip) else () FetchContent_Declare(kdf - URL https://sdk.devbuilds.komodo.earth/dev/mm2_b35a818-win-x86-64.zip) + URL https://sdk.devbuilds.komodo.earth/dev/mm2_dfca6b7-win-x86-64.zip) endif () #FetchContent_Declare(qmaterial URL https://github.com/KomodoPlatform/Qaterial/archive/last-clang-working-2.zip) From 48b385f476538d07297f704e78f9f9e92f8f5ddb Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 12 Nov 2024 20:30:21 +0800 Subject: [PATCH 22/25] fix v2.2.0+ tendermint activation format --- .../rpc2.enable_tendermint_with_assets.cpp | 2 +- .../rpc2.enable_tendermint_with_assets.hpp | 4 +- src/core/atomicdex/config/coins.cfg.cpp | 8 +-- src/core/atomicdex/config/coins.cfg.hpp | 2 +- .../atomicdex/services/kdf/kdf.service.cpp | 61 ++++++++----------- .../atomicdex/services/kdf/kdf.service.hpp | 3 +- 6 files changed, 32 insertions(+), 48 deletions(-) diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.cpp index 95c578ad9..280d6b757 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.cpp @@ -7,7 +7,7 @@ namespace atomic_dex::kdf void to_json(nlohmann::json& j, const enable_tendermint_with_assets_request_rpc& in) { j["ticker"] = in.ticker; - j["rpc_urls"] = in.rpc_urls; + j["nodes"] = in.nodes; j["tx_history"] = in.tx_history; j["tokens_params"] = in.tokens_params; if (in.required_confirmations.has_value()) diff --git a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.hpp index 05325f95a..714f1f810 100644 --- a/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.hpp @@ -3,6 +3,7 @@ #include #include "atomicdex/api/kdf/rpc.hpp" +#include "atomicdex/config/enable.cfg.hpp" #include "atomicdex/api/kdf/balance_infos.hpp" #include "atomicdex/config/electrum.cfg.hpp" @@ -20,9 +21,8 @@ namespace atomic_dex::kdf std::string ticker; std::optional required_confirmations; }; - std::string ticker; - std::vector rpc_urls; + std::vector nodes; bool tx_history{true}; std::vector tokens_params; std::optional required_confirmations; diff --git a/src/core/atomicdex/config/coins.cfg.cpp b/src/core/atomicdex/config/coins.cfg.cpp index 9f0d9c806..c5c0ba503 100644 --- a/src/core/atomicdex/config/coins.cfg.cpp +++ b/src/core/atomicdex/config/coins.cfg.cpp @@ -217,13 +217,7 @@ namespace atomic_dex } if (j.contains("rpc_urls")) { - auto rpc_urls_obj = j.at("rpc_urls").get>(); - std::vector rpc_urls_list; - cfg.rpc_urls = rpc_urls_list; - for (const auto& url : rpc_urls_obj) - { - cfg.rpc_urls->push_back(url.url); - } + cfg.rpc_urls = j.at("rpc_urls").get>(); } if (j.contains("allow_slp_unsafe_conf")) { diff --git a/src/core/atomicdex/config/coins.cfg.hpp b/src/core/atomicdex/config/coins.cfg.hpp index 319a68db7..f4fa5bcd5 100644 --- a/src/core/atomicdex/config/coins.cfg.hpp +++ b/src/core/atomicdex/config/coins.cfg.hpp @@ -91,7 +91,7 @@ namespace atomic_dex std::optional> other_types; std::optional electrum_urls; std::optional urls; - std::optional rpc_urls; + std::optional rpc_urls; std::optional z_urls; std::optional eth_family_urls; std::optional bchd_urls; diff --git a/src/core/atomicdex/services/kdf/kdf.service.cpp b/src/core/atomicdex/services/kdf/kdf.service.cpp index 1d3b2ca15..69bef4137 100644 --- a/src/core/atomicdex/services/kdf/kdf.service.cpp +++ b/src/core/atomicdex/services/kdf/kdf.service.cpp @@ -18,6 +18,10 @@ #include #include #include +#include +#include +#include + #include #include @@ -543,9 +547,7 @@ namespace atomic_dex t_coins slp_coins; t_coins slp_testnet_coins; t_coins zhtlc_coins; - t_coins osmosis_coins; - t_coins iris_coins; - t_coins cosmos_coins; + t_coins tendermint_coins; t_coins bep20_coins; t_coins bep20_testnet_coins; @@ -571,23 +573,7 @@ namespace atomic_dex } else if (coin_cfg.coin_type == CoinType::TENDERMINT || coin_cfg.coin_type == CoinType::TENDERMINTTOKEN) { - if (coin_cfg.parent_coin == "ATOM") - { - cosmos_coins.push_back(coin_cfg); - } - else if (coin_cfg.parent_coin == "IRIS") - { - iris_coins.push_back(coin_cfg); - } - else if (coin_cfg.parent_coin == "OSMO") - { - osmosis_coins.push_back(coin_cfg); - } - else - { - SPDLOG_WARN("Unexpected Tendermint ticker: {}", coin_cfg.ticker); - SPDLOG_WARN("Parent coin: {}", coin_cfg.parent_coin); - } + tendermint_coins.push_back(coin_cfg); } else if (coin_cfg.coin_type == CoinType::ZHTLC) { @@ -643,20 +629,12 @@ namespace atomic_dex SPDLOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>> Enabling {} zhtlc_coins <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<", zhtlc_coins.size()); enable_zhtlc(zhtlc_coins); } - if (iris_coins.size() > 0) + if (tendermint_coins.size() > 0) { - SPDLOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>> Enabling {} iris_coins <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<", iris_coins.size()); - enable_tendermint_coins(iris_coins, "IRIS"); - } - if (cosmos_coins.size() > 0) - { - SPDLOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>> Enabling {} cosmos_coins <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<", cosmos_coins.size()); - enable_tendermint_coins(cosmos_coins, "ATOM"); - } - if (osmosis_coins.size() > 0) - { - SPDLOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>> Enabling {} osmosis_coins <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<", osmosis_coins.size()); - enable_tendermint_coins(osmosis_coins, "OSMO"); + SPDLOG_INFO(">>>>>>>>>>>>>>>>>>>>>>>>>>> Enabling {} tendermint_coins <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<", tendermint_coins.size()); + for (const auto& [parent_coin, coins_vector] : groupByParentCoin(tendermint_coins)) { + enable_tendermint_coins(coins_vector, parent_coin); + } } } @@ -1014,9 +992,20 @@ namespace atomic_dex SPDLOG_DEBUG("kdf_service::enable_erc20_coins done for {}", parent_ticker); } - void kdf_service::enable_tendermint_coin(coin_config_t coin_config, std::string parent_ticker) + + std::map> + kdf_service::groupByParentCoin(const std::vector& coins) { + std::map> groupedCoins; + for (const auto& coin : coins) { + groupedCoins[coin.parent_coin].push_back(coin); + } + return groupedCoins; + } + + + void kdf_service::enable_tendermint_coin(coin_config_t coin_config) { - enable_tendermint_coins(t_coins{std::move(coin_config)}, parent_ticker); + enable_tendermint_coins(t_coins{std::move(coin_config)}, coin_config.parent_coin); } void kdf_service::enable_tendermint_coins(const t_coins& coins, const std::string parent_ticker) @@ -1098,7 +1087,7 @@ namespace atomic_dex kdf::enable_tendermint_with_assets_rpc rpc; rpc.request.ticker = parent_ticker_info.ticker; - rpc.request.rpc_urls = parent_ticker_info.rpc_urls.value_or(std::vector{}); + rpc.request.nodes = parent_ticker_info.rpc_urls.value_or(std::vector{}); for (const auto& coin_config : coins) { if (coin_config.ticker == parent_ticker_info.ticker) diff --git a/src/core/atomicdex/services/kdf/kdf.service.hpp b/src/core/atomicdex/services/kdf/kdf.service.hpp index 131d54226..6bcca6cd5 100644 --- a/src/core/atomicdex/services/kdf/kdf.service.hpp +++ b/src/core/atomicdex/services/kdf/kdf.service.hpp @@ -185,7 +185,7 @@ namespace atomic_dex void enable_slp_testnet_coins(const t_coins& coins); void enable_erc20_coin(coin_config_t coin_config, std::string parent_ticker); void enable_erc20_coins(const t_coins& coins, const std::string parent_ticker); - void enable_tendermint_coin(coin_config_t coin_config, std::string parent_ticker); + void enable_tendermint_coin(coin_config_t coin_config); void enable_tendermint_coins(const t_coins& coins, const std::string parent_ticker); void enable_zhtlc(const t_coins& coins); @@ -207,6 +207,7 @@ namespace atomic_dex [[nodiscard]] bool is_zhtlc_coin_ready(const std::string coin) const; [[nodiscard]] nlohmann::json get_zhtlc_status(const std::string coin) const; + std::map groupByParentCoin(const t_coins& coins); //! Cancel zhtlc activation void enable_z_coin_cancel(const std::int8_t task_id); From 11899c5a92e922c642badd95e5b0a4ee50f26587 Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 19 Nov 2024 17:02:52 +0800 Subject: [PATCH 23/25] update kdf commit --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 36679e302..086f93317 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,13 +60,13 @@ endif () ##! We fetch our dependencies if (APPLE) FetchContent_Declare(kdf - URL https://sdk.devbuilds.komodo.earth/dev/mm2_dfca6b7-mac-x86-64.zip) + URL https://sdk.devbuilds.komodo.earth/dev/mm2_22719c0-mac-x86-64.zip) elseif (UNIX AND NOT APPLE) FetchContent_Declare(kdf - URL https://sdk.devbuilds.komodo.earth/dev/mm2_dfca6b7-linux-x86-64.zip) + URL https://sdk.devbuilds.komodo.earth/dev/mm2_22719c0-linux-x86-64.zip) else () FetchContent_Declare(kdf - URL https://sdk.devbuilds.komodo.earth/dev/mm2_dfca6b7-win-x86-64.zip) + URL https://sdk.devbuilds.komodo.earth/dev/mm2_22719c0-win-x86-64.zip) endif () #FetchContent_Declare(qmaterial URL https://github.com/KomodoPlatform/Qaterial/archive/last-clang-working-2.zip) From 7254e9812ccef66670cac3550b71bee66bde34a8 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 20 Nov 2024 20:17:32 +0800 Subject: [PATCH 24/25] use UtxoPerKbyte for custom utxo fees --- atomic_defi_design/Dex/Wallet/SendModal.qml | 2 +- src/core/atomicdex/pages/qt.wallet.page.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/atomic_defi_design/Dex/Wallet/SendModal.qml b/atomic_defi_design/Dex/Wallet/SendModal.qml index 0b19e98ee..c6f61248a 100644 --- a/atomic_defi_design/Dex/Wallet/SendModal.qml +++ b/atomic_defi_design/Dex/Wallet/SendModal.qml @@ -681,7 +681,7 @@ MultipageModal Layout.preferredHeight: 38 Layout.alignment: Qt.AlignHCenter - placeholderText: qsTr("Enter the custom fee") + " [" + api_wallet_page.ticker + "]" + placeholderText: qsTr("Enter the custom fee") + " (" + api_wallet_page.ticker + "/kb)" } // Token coins diff --git a/src/core/atomicdex/pages/qt.wallet.page.cpp b/src/core/atomicdex/pages/qt.wallet.page.cpp index d9b7fa9d5..2d7e438a9 100644 --- a/src/core/atomicdex/pages/qt.wallet.page.cpp +++ b/src/core/atomicdex/pages/qt.wallet.page.cpp @@ -526,7 +526,7 @@ namespace atomic_dex qDebug() << fees_data; auto json_fees = nlohmann::json::parse(QString(QJsonDocument(QVariant(fees_data).toJsonObject()).toJson()).toStdString()); withdraw_init_req.fees = t_withdraw_init_fees{ - .type = "UtxoFixed", + .type = "UtxoPerKbyte", .amount = json_fees.at("fees_amount").get() }; } @@ -702,7 +702,7 @@ namespace atomic_dex { qDebug() << fees_data; withdraw_req.fees = t_withdraw_fees{ - .type = "UtxoFixed", + .type = "UtxoPerKbyte", .amount = json_fees.at("fees_amount").get(), .gas_limit = json_fees.at("gas_limit").get()}; if (coin_info.coin_type == CoinType::ERC20) From d45100e19a2ce75312c2ad41cc9bea7aaa13ed02 Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 25 Nov 2024 16:57:38 +0800 Subject: [PATCH 25/25] use v2.20 release kdf --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 086f93317..5d9c73c4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,13 +60,13 @@ endif () ##! We fetch our dependencies if (APPLE) FetchContent_Declare(kdf - URL https://sdk.devbuilds.komodo.earth/dev/mm2_22719c0-mac-x86-64.zip) + URL https://github.com/KomodoPlatform/komodo-defi-framework/releases/download/v2.2.0-beta/mm2-bb749a993-Darwin-Release.zip) elseif (UNIX AND NOT APPLE) FetchContent_Declare(kdf - URL https://sdk.devbuilds.komodo.earth/dev/mm2_22719c0-linux-x86-64.zip) + URL https://github.com/KomodoPlatform/komodo-defi-framework/releases/download/v2.2.0-beta/mm2-bb749a993-Linux-Release.zip) else () FetchContent_Declare(kdf - URL https://sdk.devbuilds.komodo.earth/dev/mm2_22719c0-win-x86-64.zip) + URL https://github.com/KomodoPlatform/komodo-defi-framework/releases/download/v2.2.0-beta/mm2-bb749a993-Win64.zip) endif () #FetchContent_Declare(qmaterial URL https://github.com/KomodoPlatform/Qaterial/archive/last-clang-working-2.zip) @@ -78,7 +78,7 @@ FetchContent_Declare( ) FetchContent_Declare(jl777-coins - URL https://github.com/KomodoPlatform/coins/archive/add/tendermint-coins.zip) + URL https://github.com/KomodoPlatform/coins/archive/master.zip) #FetchContent_Declare(adex-generics-coins # URL https://github.com/KomodoPlatform/komodo-wallet-desktop/archive/main.zip)