From 3fdca224f4c5938299878c2133afe1115bfcc417 Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 30 Jul 2024 17:07:00 +0800 Subject: [PATCH 01/23] use dev api --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 27a70b272e..9fcee9712d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,13 +60,13 @@ endif () ##! We fetch our dependencies if (APPLE) FetchContent_Declare(mm2 - URL https://github.com/KomodoPlatform/komodo-defi-framework/releases/download/v2.0.0-beta/mm2-b0fd99e84-Darwin-Release.zip) + URL https://sdk.devbuilds.komodo.earth/dev/mm2_a81f2a1-mac-x86-64.zip) elseif (UNIX AND NOT APPLE) FetchContent_Declare(mm2 - URL https://github.com/KomodoPlatform/komodo-defi-framework/releases/download/v2.0.0-beta/mm2-b0fd99e84-Linux-Release.zip) + URL https://sdk.devbuilds.komodo.earth/dev/mm2_a81f2a1-linux-x86-64.zip) else () FetchContent_Declare(mm2 - URL https://github.com/KomodoPlatform/komodo-defi-framework/releases/download/v2.0.0-beta/mm2-b0fd99e84-Win64.zip) + URL https://sdk.devbuilds.komodo.earth/dev/mm2_a81f2a1-win-x86-64.zip) endif () #FetchContent_Declare(qmaterial URL https://github.com/KomodoPlatform/Qaterial/archive/last-clang-working-2.zip) From 92b39a5ec38d71ba865b608e5ab6d53a4d852804 Mon Sep 17 00:00:00 2001 From: smk762 Date: Fri, 9 Aug 2024 18:01:08 +0800 Subject: [PATCH 02/23] mm2 -> kdf --- .github/workflows/atomicdex-desktop-ci.yml | 2 +- .gitignore | 2 +- CMakeLists.txt | 26 +- assets/tools/.gitignore | 1 + atomic_defi_design/Dex/Constants/General.qml | 4 +- .../Dex/Exchange/Trade/ConfirmTradeModal.qml | 2 +- .../Dex/Screens/Startup/Logging.qml | 2 +- .../Dex/Settings/AddCustomCoinModal.qml | 2 +- .../Dex/Settings/SettingModal.qml | 8 +- .../assets/languages/atomic_defi_de.ts | 378 +++++++------ .../assets/languages/atomic_defi_en.ts | 347 ++++++------ .../assets/languages/atomic_defi_es.ts | 366 ++++++------ .../assets/languages/atomic_defi_fr.ts | 375 +++++++------ .../assets/languages/atomic_defi_ru.ts | 375 +++++++------ .../assets/languages/atomic_defi_tr.ts | 375 +++++++------ cmake/install/macos/osx_post_install.cmake | 2 +- cmake/project.metadata.cmake | 2 +- src/CMakeLists.txt | 16 +- src/app/app.cpp | 80 +-- src/app/app.hpp | 10 +- src/app/main.prerequisites.hpp | 4 +- .../api/{mm2 => kdf}/address_format.cpp | 6 +- .../api/{mm2 => kdf}/address_format.hpp | 2 +- .../api/{mm2 => kdf}/balance_info.cpp | 4 +- .../api/{mm2 => kdf}/balance_info.hpp | 2 +- .../api/{mm2 => kdf}/balance_infos.cpp | 4 +- .../api/{mm2 => kdf}/balance_infos.hpp | 2 +- src/core/atomicdex/api/kdf/fraction.cpp | 12 + .../api/{mm2 => kdf}/fraction.fwd.hpp | 2 +- .../atomicdex/api/{mm2 => kdf}/fraction.hpp | 4 +- .../api/{mm2 => kdf}/generic.error.cpp | 6 +- .../api/{mm2 => kdf}/generic.error.hpp | 4 +- .../atomicdex/api/{mm2 => kdf}/generics.cpp | 26 +- .../atomicdex/api/{mm2 => kdf}/generics.hpp | 2 +- .../mm2.client.cpp => kdf/kdf.client.cpp} | 88 +-- .../mm2.client.hpp => kdf/kdf.client.hpp} | 16 +- .../kdf.constants.hpp} | 0 .../api/{mm2/mm2.cpp => kdf/kdf.cpp} | 50 +- .../kdf.error.code.cpp} | 12 +- .../kdf.error.code.hpp} | 2 +- .../api/{mm2/mm2.hpp => kdf/kdf.hpp} | 26 +- .../{mm2 => kdf}/orderbook.order.contents.cpp | 8 +- .../{mm2 => kdf}/orderbook.order.contents.hpp | 6 +- .../api/{mm2 => kdf}/paging_options.cpp | 4 +- .../api/{mm2 => kdf}/paging_options.hpp | 2 +- src/core/atomicdex/api/{mm2 => kdf}/rpc.cpp | 4 +- src/core/atomicdex/api/{mm2 => kdf}/rpc.hpp | 2 +- .../api/{mm2 => kdf}/rpc.tx.history.cpp | 4 +- .../api/{mm2 => kdf}/rpc.tx.history.hpp | 10 +- .../api/{mm2 => kdf}/rpc_v1/rpc.buy.cpp | 8 +- .../api/{mm2 => kdf}/rpc_v1/rpc.buy.hpp | 12 +- .../rpc_v1/rpc.convertaddress.cpp | 8 +- .../rpc_v1/rpc.convertaddress.hpp | 10 +- .../{mm2 => kdf}/rpc_v1/rpc.disable_coin.cpp | 8 +- .../{mm2 => kdf}/rpc_v1/rpc.disable_coin.hpp | 8 +- .../api/{mm2 => kdf}/rpc_v1/rpc.electrum.cpp | 6 +- .../api/{mm2 => kdf}/rpc_v1/rpc.electrum.hpp | 10 +- .../api/{mm2 => kdf}/rpc_v1/rpc.enable.cpp | 10 +- .../api/{mm2 => kdf}/rpc_v1/rpc.enable.hpp | 10 +- .../{mm2 => kdf}/rpc_v1/rpc.max_taker_vol.cpp | 8 +- .../{mm2 => kdf}/rpc_v1/rpc.max_taker_vol.hpp | 10 +- .../rpc_v1/rpc.min_trading_vol.cpp | 8 +- .../rpc_v1/rpc.min_trading_vol.hpp | 12 +- .../{mm2 => kdf}/rpc_v1/rpc.my_balance.cpp | 6 +- .../{mm2 => kdf}/rpc_v1/rpc.my_balance.hpp | 8 +- .../{mm2 => kdf}/rpc_v1/rpc.my_tx_history.hpp | 4 +- .../rpc_v1/rpc.recover_funds_of_swap.cpp | 4 +- .../rpc_v1/rpc.recover_funds_of_swap.hpp | 8 +- .../api/{mm2 => kdf}/rpc_v1/rpc.sell.cpp | 8 +- .../api/{mm2 => kdf}/rpc_v1/rpc.sell.hpp | 12 +- .../api/{mm2 => kdf}/rpc_v1/rpc.setprice.cpp | 4 +- .../api/{mm2 => kdf}/rpc_v1/rpc.setprice.hpp | 4 +- .../rpc_v1/rpc.update_maker_order.cpp | 8 +- .../rpc_v1/rpc.update_maker_order.hpp | 6 +- .../rpc_v1/rpc.validateaddress.cpp | 10 +- .../rpc_v1/rpc.validateaddress.hpp | 10 +- .../{mm2 => kdf}/rpc_v2/rpc2.bestorders.cpp | 8 +- .../{mm2 => kdf}/rpc_v2/rpc2.bestorders.hpp | 8 +- .../rpc2.enable_bch_with_tokens_rpc.cpp | 6 +- .../rpc2.enable_bch_with_tokens_rpc.hpp | 10 +- .../{mm2 => kdf}/rpc_v2/rpc2.enable_erc20.cpp | 4 +- .../{mm2 => kdf}/rpc_v2/rpc2.enable_erc20.hpp | 6 +- .../rpc_v2/rpc2.enable_eth_with_tokens.cpp | 4 +- .../rpc_v2/rpc2.enable_eth_with_tokens.hpp | 6 +- .../rpc_v2/rpc2.enable_slp_rpc.cpp | 2 +- .../rpc_v2/rpc2.enable_slp_rpc.hpp | 6 +- .../rpc_v2/rpc2.enable_tendermint_token.cpp | 2 +- .../rpc_v2/rpc2.enable_tendermint_token.hpp | 6 +- .../rpc2.enable_tendermint_with_assets.cpp | 2 +- .../rpc2.enable_tendermint_with_assets.hpp | 6 +- .../rpc_v2/rpc2.get_public_key.cpp | 4 +- .../rpc_v2/rpc2.get_public_key.hpp | 4 +- .../rpc_v2/rpc2.my_tx_history.cpp | 4 +- .../rpc_v2/rpc2.my_tx_history.hpp | 8 +- .../{mm2 => kdf}/rpc_v2/rpc2.orderbook.cpp | 6 +- .../{mm2 => kdf}/rpc_v2/rpc2.orderbook.hpp | 6 +- .../rpc_v2/rpc2.task.enable_z_coin.cancel.cpp | 6 +- .../rpc_v2/rpc2.task.enable_z_coin.cancel.hpp | 10 +- .../rpc_v2/rpc2.task.enable_z_coin.init.cpp | 6 +- .../rpc_v2/rpc2.task.enable_z_coin.init.hpp | 6 +- .../rpc_v2/rpc2.task.enable_z_coin.status.cpp | 6 +- .../rpc_v2/rpc2.task.enable_z_coin.status.hpp | 10 +- .../rpc_v2/rpc2.task.withdraw.init.cpp | 6 +- .../rpc_v2/rpc2.task.withdraw.init.hpp | 8 +- .../rpc_v2/rpc2.task.withdraw.status.cpp | 6 +- .../rpc_v2/rpc2.task.withdraw.status.hpp | 10 +- .../rpc_v2/rpc2.trade_preimage.cpp | 8 +- .../rpc_v2/rpc2.trade_preimage.fwd.hpp | 6 +- .../rpc_v2/rpc2.trade_preimage.hpp | 14 +- .../api/{mm2 => kdf}/rpc_v2/rpc2.withdraw.cpp | 4 +- .../api/{mm2 => kdf}/rpc_v2/rpc2.withdraw.hpp | 14 +- .../rpc_v2/rpc2.z_coin_tx_history.cpp | 6 +- .../rpc_v2/rpc2.z_coin_tx_history.hpp | 10 +- .../{mm2 => kdf}/trading.order.contents.cpp | 4 +- .../{mm2 => kdf}/trading.order.contents.hpp | 2 +- .../api/{mm2 => kdf}/transaction.data.cpp | 6 +- .../api/{mm2 => kdf}/transaction.data.hpp | 2 +- .../api/{mm2 => kdf}/utxo_merge_params.cpp | 2 +- .../api/{mm2 => kdf}/utxo_merge_params.hpp | 2 +- src/core/atomicdex/api/mm2/fraction.cpp | 12 - src/core/atomicdex/config/coins.cfg.hpp | 4 +- .../config/{mm2.cfg.hpp => kdf.cfg.hpp} | 14 +- ...m2.coins.cfg.hpp => raw.kdf.coins.cfg.hpp} | 38 +- .../data/dex/orders.and.swaps.data.hpp | 2 +- .../atomicdex/data/dex/qt.orders.data.hpp | 6 +- src/core/atomicdex/data/wallet/tx.data.hpp | 4 +- src/core/atomicdex/events/events.hpp | 4 +- .../atomicdex/managers/qt.wallet.manager.cpp | 6 +- .../atomicdex/managers/qt.wallet.manager.hpp | 2 +- .../atomicdex/models/qt.orderbook.model.cpp | 8 +- .../atomicdex/models/qt.orderbook.model.hpp | 6 +- src/core/atomicdex/models/qt.orders.model.cpp | 52 +- src/core/atomicdex/models/qt.orders.model.hpp | 2 +- .../atomicdex/models/qt.portfolio.model.cpp | 26 +- .../atomicdex/models/qt.portfolio.model.hpp | 2 +- .../atomicdex/models/transactions_model.cpp | 8 +- .../atomicdex/models/transactions_model.hpp | 2 +- .../atomicdex/pages/qt.portfolio.page.cpp | 2 +- src/core/atomicdex/pages/qt.settings.page.cpp | 142 ++--- src/core/atomicdex/pages/qt.settings.page.hpp | 2 +- src/core/atomicdex/pages/qt.trading.page.cpp | 110 ++-- src/core/atomicdex/pages/qt.trading.page.hpp | 4 +- src/core/atomicdex/pages/qt.wallet.page.cpp | 180 +++--- .../pages/widgets/dex/qt.orderbook.cpp | 12 +- .../pages/widgets/dex/qt.orderbook.hpp | 4 +- .../pages/widgets/dex/qt.orders.widget.cpp | 44 +- .../services/exporter/exporter.service.cpp | 16 +- .../internet/internet.checker.service.cpp | 28 +- .../internet/internet.checker.service.hpp | 2 +- .../auto.update.maker.order.service.cpp | 34 +- .../auto.update.maker.order.service.hpp | 0 .../mm2.service.cpp => kdf/kdf.service.cpp} | 522 +++++++++--------- .../mm2.service.hpp => kdf/kdf.service.hpp} | 104 ++-- .../mm2_events.hpp => kdf/kdf_events.hpp} | 4 +- .../price/coingecko/coingecko.provider.cpp | 12 +- .../price/coingecko/coingecko.provider.hpp | 4 +- .../coingecko/coingecko.wallet.charts.cpp | 6 +- .../atomicdex/services/price/defi.stats.hpp | 8 +- .../services/price/global.provider.cpp | 22 +- .../services/price/global.provider.hpp | 2 +- .../price/orderbook.scanner.service.cpp | 18 +- .../price/orderbook.scanner.service.hpp | 6 +- .../atomicdex/utilities/global.utilities.cpp | 10 +- .../atomicdex/utilities/global.utilities.hpp | 2 +- .../utilities/security.utilities.cpp | 2 +- .../enable_bch_with_tokens_rpc_tests.cpp | 6 +- .../kdf.api.address_format.tests.cpp} | 6 +- .../kdf.api.balance_infos.tests.cpp} | 8 +- .../kdf.api.utxo_merge_params.tests.cpp} | 8 +- .../kdf.fraction.tests.cpp} | 8 +- .../kdf.rpc2.trade_preimage.tests.cpp} | 52 +- .../atomic.dex.provider.cex.prices.tests.cpp | 12 +- src/tests/atomic.dex.tests.hpp | 14 +- src/tests/config/coins.cfg.tests.cpp | 4 +- 174 files changed, 2499 insertions(+), 2290 deletions(-) rename src/core/atomicdex/api/{mm2 => kdf}/address_format.cpp (94%) rename src/core/atomicdex/api/{mm2 => kdf}/address_format.hpp (98%) rename src/core/atomicdex/api/{mm2 => kdf}/balance_info.cpp (74%) rename src/core/atomicdex/api/{mm2 => kdf}/balance_info.hpp (90%) rename src/core/atomicdex/api/{mm2 => kdf}/balance_infos.cpp (96%) rename src/core/atomicdex/api/{mm2 => kdf}/balance_infos.hpp (98%) create mode 100644 src/core/atomicdex/api/kdf/fraction.cpp rename src/core/atomicdex/api/{mm2 => kdf}/fraction.fwd.hpp (59%) rename src/core/atomicdex/api/{mm2 => kdf}/fraction.hpp (69%) rename src/core/atomicdex/api/{mm2 => kdf}/generic.error.cpp (76%) rename src/core/atomicdex/api/{mm2 => kdf}/generic.error.hpp (87%) rename src/core/atomicdex/api/{mm2 => kdf}/generics.cpp (80%) rename src/core/atomicdex/api/{mm2 => kdf}/generics.hpp (98%) rename src/core/atomicdex/api/{mm2/mm2.client.cpp => kdf/kdf.client.cpp} (78%) rename src/core/atomicdex/api/{mm2/mm2.client.hpp => kdf/kdf.client.hpp} (79%) rename src/core/atomicdex/api/{mm2/mm2.constants.hpp => kdf/kdf.constants.hpp} (100%) rename src/core/atomicdex/api/{mm2/mm2.cpp => kdf/kdf.cpp} (95%) rename src/core/atomicdex/api/{mm2/mm2.error.code.cpp => kdf/kdf.error.code.cpp} (94%) rename src/core/atomicdex/api/{mm2/mm2.error.code.hpp => kdf/kdf.error.code.hpp} (98%) rename src/core/atomicdex/api/{mm2/mm2.hpp => kdf/kdf.hpp} (92%) rename src/core/atomicdex/api/{mm2 => kdf}/orderbook.order.contents.cpp (96%) rename src/core/atomicdex/api/{mm2 => kdf}/orderbook.order.contents.hpp (96%) rename src/core/atomicdex/api/{mm2 => kdf}/paging_options.cpp (81%) rename src/core/atomicdex/api/{mm2 => kdf}/paging_options.hpp (92%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc.cpp (85%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc.hpp (98%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc.tx.history.cpp (98%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc.tx.history.hpp (92%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.buy.cpp (95%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.buy.hpp (91%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.convertaddress.cpp (80%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.convertaddress.hpp (80%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.disable_coin.cpp (77%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.disable_coin.hpp (81%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.electrum.cpp (96%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.electrum.hpp (92%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.enable.cpp (94%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.enable.hpp (92%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.max_taker_vol.cpp (94%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.max_taker_vol.hpp (89%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.min_trading_vol.cpp (79%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.min_trading_vol.hpp (74%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.my_balance.cpp (93%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.my_balance.hpp (91%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.my_tx_history.hpp (93%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.recover_funds_of_swap.cpp (91%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.recover_funds_of_swap.hpp (84%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.sell.cpp (96%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.sell.hpp (91%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.setprice.cpp (96%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.setprice.hpp (95%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.update_maker_order.cpp (84%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.update_maker_order.hpp (85%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.validateaddress.cpp (71%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v1/rpc.validateaddress.hpp (80%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.bestorders.cpp (94%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.bestorders.hpp (94%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.enable_bch_with_tokens_rpc.cpp (94%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp (95%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.enable_erc20.cpp (90%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.enable_erc20.hpp (96%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.enable_eth_with_tokens.cpp (95%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.enable_eth_with_tokens.hpp (97%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.enable_slp_rpc.cpp (96%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.enable_slp_rpc.hpp (96%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.enable_tendermint_token.cpp (96%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.enable_tendermint_token.hpp (96%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.enable_tendermint_with_assets.cpp (98%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.enable_tendermint_with_assets.hpp (95%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.get_public_key.cpp (94%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.get_public_key.hpp (97%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.my_tx_history.cpp (95%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.my_tx_history.hpp (89%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.orderbook.cpp (98%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.orderbook.hpp (96%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.task.enable_z_coin.cancel.cpp (94%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.task.enable_z_coin.cancel.hpp (89%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.task.enable_z_coin.init.cpp (95%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.task.enable_z_coin.init.hpp (93%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.task.enable_z_coin.status.cpp (96%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.task.enable_z_coin.status.hpp (91%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.task.withdraw.init.cpp (94%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.task.withdraw.init.hpp (91%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.task.withdraw.status.cpp (93%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.task.withdraw.status.hpp (88%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.trade_preimage.cpp (94%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.trade_preimage.fwd.hpp (91%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.trade_preimage.hpp (89%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.withdraw.cpp (97%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.withdraw.hpp (83%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.z_coin_tx_history.cpp (96%) rename src/core/atomicdex/api/{mm2 => kdf}/rpc_v2/rpc2.z_coin_tx_history.hpp (94%) rename src/core/atomicdex/api/{mm2 => kdf}/trading.order.contents.cpp (95%) rename src/core/atomicdex/api/{mm2 => kdf}/trading.order.contents.hpp (98%) rename src/core/atomicdex/api/{mm2 => kdf}/transaction.data.cpp (97%) rename src/core/atomicdex/api/{mm2 => kdf}/transaction.data.hpp (98%) rename src/core/atomicdex/api/{mm2 => kdf}/utxo_merge_params.cpp (98%) rename src/core/atomicdex/api/{mm2 => kdf}/utxo_merge_params.hpp (98%) delete mode 100644 src/core/atomicdex/api/mm2/fraction.cpp rename src/core/atomicdex/config/{mm2.cfg.hpp => kdf.cfg.hpp} (91%) rename src/core/atomicdex/config/{raw.mm2.coins.cfg.hpp => raw.kdf.coins.cfg.hpp} (89%) rename src/core/atomicdex/services/{mm2 => kdf}/auto.update.maker.order.service.cpp (88%) rename src/core/atomicdex/services/{mm2 => kdf}/auto.update.maker.order.service.hpp (100%) rename src/core/atomicdex/services/{mm2/mm2.service.cpp => kdf/kdf.service.cpp} (89%) rename src/core/atomicdex/services/{mm2/mm2.service.hpp => kdf/kdf.service.hpp} (80%) rename src/core/atomicdex/services/{mm2/mm2_events.hpp => kdf/kdf_events.hpp} (81%) rename src/tests/api/{mm2 => kdf}/enable_bch_with_tokens_rpc_tests.cpp (97%) rename src/tests/api/{mm2/mm2.api.address_format.tests.cpp => kdf/kdf.api.address_format.tests.cpp} (90%) rename src/tests/api/{mm2/mm2.api.balance_infos.tests.cpp => kdf/kdf.api.balance_infos.tests.cpp} (88%) rename src/tests/api/{mm2/mm2.api.utxo_merge_params.tests.cpp => kdf/kdf.api.utxo_merge_params.tests.cpp} (88%) rename src/tests/api/{mm2/mm2.fraction.tests.cpp => kdf/kdf.fraction.tests.cpp} (73%) rename src/tests/api/{mm2/mm2.rpc2.trade_preimage.tests.cpp => kdf/kdf.rpc2.trade_preimage.tests.cpp} (92%) diff --git a/.github/workflows/atomicdex-desktop-ci.yml b/.github/workflows/atomicdex-desktop-ci.yml index d5a2357d17..45c8fa9ec1 100644 --- a/.github/workflows/atomicdex-desktop-ci.yml +++ b/.github/workflows/atomicdex-desktop-ci.yml @@ -11,7 +11,7 @@ on: workflow_dispatch: env: - DEX_API: "mm2_kmd" + DEX_API: "kdf_kwd" DEX_RPCPORT: 7762 DEX_RPC: "http://127.0.0.1:7762" DEX_PROJECT_NAME: "komodo-wallet" diff --git a/.gitignore b/.gitignore index 93ff04824c..2d8737bf37 100644 --- a/.gitignore +++ b/.gitignore @@ -69,7 +69,7 @@ Thumbs.db # -------- *.exe -/assets/tools/mm2/ +/assets/tools/kdf/ /ci_tools_atomic_dex/vcpkg-repo/ /ci_tools_atomic_dex/ci_tools_atomic_dex ci_tools_atomic_dex/build-Release diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fcee9712d..35f69d82e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,14 +59,14 @@ endif () ##! We fetch our dependencies if (APPLE) - FetchContent_Declare(mm2 - URL https://sdk.devbuilds.komodo.earth/dev/mm2_a81f2a1-mac-x86-64.zip) + FetchContent_Declare(kdf + URL https://sdk.devbuilds.komodo.earth/main/kdf_35e9239-mac-x86-64.zip) elseif (UNIX AND NOT APPLE) - FetchContent_Declare(mm2 - URL https://sdk.devbuilds.komodo.earth/dev/mm2_a81f2a1-linux-x86-64.zip) + FetchContent_Declare(kdf + URL https://sdk.devbuilds.komodo.earth/main/kdf_35e9239-linux-x86-64.zip) else () - FetchContent_Declare(mm2 - URL https://sdk.devbuilds.komodo.earth/dev/mm2_a81f2a1-win-x86-64.zip) + FetchContent_Declare(kdf + URL https://sdk.devbuilds.komodo.earth/main/kdf_35e9239-win-x86-64.zip) endif () #FetchContent_Declare(qmaterial URL https://github.com/KomodoPlatform/Qaterial/archive/last-clang-working-2.zip) @@ -83,20 +83,20 @@ FetchContent_Declare(jl777-coins #FetchContent_Declare(adex-generics-coins # URL https://github.com/KomodoPlatform/komodo-wallet-desktop/archive/main.zip) -FetchContent_MakeAvailable(mm2 jl777-coins qmaterial) +FetchContent_MakeAvailable(kdf jl777-coins qmaterial) ##! Configure our needs. if (UNIX) configure_file(${jl777-coins_SOURCE_DIR}/utils/coins_config_tcp.json ${CMAKE_CURRENT_SOURCE_DIR}/assets/config/${PROJECT_VERSION}-coins.json COPYONLY) - configure_file(${jl777-coins_SOURCE_DIR}/coins ${CMAKE_CURRENT_SOURCE_DIR}/assets/tools/mm2/coins COPYONLY) - configure_file(${mm2_SOURCE_DIR}/mm2 ${CMAKE_CURRENT_SOURCE_DIR}/assets/tools/mm2/${DEX_API} COPYONLY) + configure_file(${jl777-coins_SOURCE_DIR}/coins ${CMAKE_CURRENT_SOURCE_DIR}/assets/tools/kdf/coins COPYONLY) + configure_file(${kdf_SOURCE_DIR}/kdf ${CMAKE_CURRENT_SOURCE_DIR}/assets/tools/kdf/${DEX_API} COPYONLY) file(COPY ${jl777-coins_SOURCE_DIR}/icons/ DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/atomic_defi_design/assets/images/coins/) else () configure_file(${jl777-coins_SOURCE_DIR}/utils/coins_config_tcp.json ${CMAKE_BINARY_DIR}/bin/assets/config/${PROJECT_VERSION}-coins.json COPYONLY) - configure_file(${jl777-coins_SOURCE_DIR}/coins ${CMAKE_BINARY_DIR}/bin/assets/tools/mm2/coins COPYONLY) - configure_file(${mm2_SOURCE_DIR}/mm2.exe ${CMAKE_BINARY_DIR}/bin/assets/tools/mm2/${DEX_API}.exe COPYONLY) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ci_tools_atomic_dex/windows_misc/msvcp140.dll ${CMAKE_BINARY_DIR}/bin/assets/tools/mm2/msvcp140.dll COPYONLY) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ci_tools_atomic_dex/windows_misc/vcruntime140.dll ${CMAKE_BINARY_DIR}/bin/assets/tools/mm2/vcruntime140.dll COPYONLY) + configure_file(${jl777-coins_SOURCE_DIR}/coins ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/coins COPYONLY) + configure_file(${kdf_SOURCE_DIR}/kdf.exe ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/${DEX_API}.exe COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ci_tools_atomic_dex/windows_misc/msvcp140.dll ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/msvcp140.dll COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ci_tools_atomic_dex/windows_misc/vcruntime140.dll ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/vcruntime140.dll COPYONLY) endif () diff --git a/assets/tools/.gitignore b/assets/tools/.gitignore index b7e0b1c746..a9ab3e54fd 100644 --- a/assets/tools/.gitignore +++ b/assets/tools/.gitignore @@ -1,2 +1,3 @@ mm2 coins +kdf \ No newline at end of file diff --git a/atomic_defi_design/Dex/Constants/General.qml b/atomic_defi_design/Dex/Constants/General.qml index d9625cdb59..8f626296f7 100644 --- a/atomic_defi_design/Dex/Constants/General.qml +++ b/atomic_defi_design/Dex/Constants/General.qml @@ -175,7 +175,7 @@ QtObject { } function coinContractAddress(ticker) { - var cfg = API.app.trading_pg.get_raw_mm2_coin_cfg(ticker) + var cfg = API.app.trading_pg.get_raw_kdf_coin_cfg(ticker) if (cfg.hasOwnProperty('protocol')) { if (cfg.protocol.hasOwnProperty('protocol_data')) { if (cfg.protocol.protocol_data.hasOwnProperty('contract_address')) { @@ -187,7 +187,7 @@ QtObject { } function coinPlatform(ticker) { - var cfg = API.app.trading_pg.get_raw_mm2_coin_cfg(ticker) + var cfg = API.app.trading_pg.get_raw_kdf_coin_cfg(ticker) if (cfg.hasOwnProperty('protocol')) { if (cfg.protocol.hasOwnProperty('protocol_data')) { if (cfg.protocol.protocol_data.hasOwnProperty('platform')) { diff --git a/atomic_defi_design/Dex/Exchange/Trade/ConfirmTradeModal.qml b/atomic_defi_design/Dex/Exchange/Trade/ConfirmTradeModal.qml index 8056ecbef9..6337d84d9e 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/ConfirmTradeModal.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/ConfirmTradeModal.qml @@ -84,7 +84,7 @@ MultipageModal { id: config_section - readonly property var default_config: API.app.trading_pg.get_raw_mm2_coin_cfg(rel_ticker) + readonly property var default_config: API.app.trading_pg.get_raw_kdf_coin_cfg(rel_ticker) readonly property bool is_dpow_configurable: config_section.default_config.requires_notarization || false width: dex_pair_badges.width - 40 diff --git a/atomic_defi_design/Dex/Screens/Startup/Logging.qml b/atomic_defi_design/Dex/Screens/Startup/Logging.qml index 81c63ff6d0..5613551727 100644 --- a/atomic_defi_design/Dex/Screens/Startup/Logging.qml +++ b/atomic_defi_design/Dex/Screens/Startup/Logging.qml @@ -39,7 +39,7 @@ SetupPage DefaultText { Layout.alignment: Qt.AlignHCenter - text_value: (current_status === "initializing_mm2" ? qsTr("Initializing MM2") : + text_value: (current_status === "initializing_kdf" ? qsTr("Initializing KDF") : current_status === "enabling_coins" ? qsTr("Enabling assets") : qsTr("Getting ready")) + "..." } } diff --git a/atomic_defi_design/Dex/Settings/AddCustomCoinModal.qml b/atomic_defi_design/Dex/Settings/AddCustomCoinModal.qml index d48dffbc28..a8fc9d57f3 100644 --- a/atomic_defi_design/Dex/Settings/AddCustomCoinModal.qml +++ b/atomic_defi_design/Dex/Settings/AddCustomCoinModal.qml @@ -44,7 +44,7 @@ MultipageModal onCustom_token_dataChanged: { const data = custom_token_data - if(!data.mm2_cfg) return + if(!data.kdf_cfg) return var fields = General.clone(config_fields) diff --git a/atomic_defi_design/Dex/Settings/SettingModal.qml b/atomic_defi_design/Dex/Settings/SettingModal.qml index 246d38c9b3..c069496e00 100644 --- a/atomic_defi_design/Dex/Settings/SettingModal.qml +++ b/atomic_defi_design/Dex/Settings/SettingModal.qml @@ -725,15 +725,15 @@ Qaterial.Dialog { Layout.alignment: Qt.AlignVCenter Layout.fillWidth: true - text: qsTr("MM2 version") + text: qsTr("KDF version") } DexCopyableLabel { Layout.alignment: Qt.AlignVCenter - text: API.app.settings_pg.get_mm2_version() - onCopyNotificationTitle: qsTr("MM2 Version") - onCopyNotificationMsg: qsTr("MM2 Version copied to clipboard.") + text: API.app.settings_pg.get_kdf_version() + onCopyNotificationTitle: qsTr("KDF Version") + onCopyNotificationMsg: qsTr("KDF Version copied to clipboard.") } } diff --git a/atomic_defi_design/assets/languages/atomic_defi_de.ts b/atomic_defi_design/assets/languages/atomic_defi_de.ts index dd48b90277..11040980fc 100644 --- a/atomic_defi_design/assets/languages/atomic_defi_de.ts +++ b/atomic_defi_design/assets/languages/atomic_defi_de.ts @@ -760,83 +760,93 @@ Beispiel: Kennwort = 1234 Suffix=56 Eingabe beim Login=123456 ConfirmTradeModal - + Confirm Exchange Details Bestätigen Sie die Austausch-Details - + Trade price is more than 50% different to CEX! Confirm? Der Handelspreis unterscheidet sich um mehr als 50% vom CEX-Preis. Bestätigen? - + This swap request can not be undone and is a final event! Diese Tauschanfrage kann nicht rückgängig gemacht werden und ist ein endgültiges Ereignis! - + This transaction can take up to 60 mins - DO NOT close this application! Diese Transaktion kann bis zu 60 Minuten dauern - schließen Sie diese Anwendung NICHT! - + Loading fees... Lade Gebühren... - + <b>Total %1 fees:</b> <b>Gesamt %1 Gebühren:</b> - + Security configuration Sicherheitskonfiguration - + %1 confirmations for incoming %2 transactions %1 Bestätigungen für eingehende %2 Transaktionen - + Read more about dPoW Lesen Sie mehr über dPoW - + + Cancel all existing orders for %1/%2? + + + + + Good until cancelled (order will remain on orderbook until filled or cancelled) + + + + Use custom protection settings for incoming %1 transactions TICKER Benutzerdefinierte Schutzeinstellungen für eingehende %1 Transaktionen verwenden - + Enable Komodo dPoW security Komodo dPoW-Sicherheit aktivieren - + dPoW protected dPoW-gesichert - + Required Confirmations Erforderliche Bestätigungen - + Warning, this atomic swap is not dPoW protected! Achtung, dieser Atomic Swap ist nicht dPoW-geschützt! - + Cancel Abbrechen - + Confirm Bestätigen @@ -1760,11 +1770,11 @@ Try again or select 'Allow custom seed' to continue. - Best Orders - Die günstigsten Order + Best Orders for %1 + - + Enter volume to see best orders. @@ -1772,17 +1782,22 @@ Try again or select 'Allow custom seed' to continue. ListDelegate - + %1 is not enabled - Do you want to enable it to be able to select %2 best orders ?<br><a href='#'>Yes</a> - <a href='#no'>No</a> %1 ist nicht aktiviert - Möchten Sie es aktivieren, um die günstigsten Order von %2 auswählen zu können? <br><a href='#'>Ja</a> - <a href='#no'>Nein</a> - + %1 is not enabled - Please enable it through the coin activation menu - + + Orderbook is disabled while creating maker orders + + + + This order requires a minimum amount of %1 %2 <br>You don't have enough funds.<br> %3 Für diese Order ist ein Mindestbetrag von %1 %2 erforderlich. <br>Ihr Guthaben reicht nicht aus.<br> %3 @@ -1804,8 +1819,8 @@ Try again or select 'Allow custom seed' to continue. - Initializing MM2 - MM2 initialisieren + Initializing KDF + @@ -1914,7 +1929,7 @@ They will be removed from the orderbook until you log in again. Empfangen - + Swap Tausch @@ -1945,84 +1960,69 @@ They will be removed from the orderbook until you log in again. - - - + + + Public Key Öffentlicher Schlüssel - + Copied to Clipboard In die Zwischenablage kopiert - + Explore - + There is no chart data for this ticker yet Für diesen Ticker liegen noch keine Chartdaten vor - + Fetching transactions... Transaktionen werden abgerufen... - + No transactions available. - + Please wait, %1 is %2 - + Loading ticker chart data - + % activated... - + Chart Chart - - + + Orders Order - - + + History Historie - - - Place Order - Order platzieren - - - - Order Selected - Order ausgewählt - - - - START SWAP - TAUSCH STARTEN - @@ -2074,6 +2074,16 @@ They will be removed from the orderbook until you log in again. This contact does not have any registered address. Dieser Kontakt hat keine registrierte Adresse. + + + Taker Order + Taker-Order + + + + Maker Order + Maker-Order + Market @@ -2091,13 +2101,13 @@ They will be removed from the orderbook until you log in again. MarketModeSelector - + Sell %1 TICKER %1 Verkaufen - + Buy %1 TICKER %1 Kaufen @@ -2531,95 +2541,110 @@ They will be removed from the orderbook until you log in again. OrderForm - + Price Preis - + Reduce 1% relative to CEX market price. - + Use CEX market price. - + Increase 1% relative to CEX market price. - + Send Senden - + Receive Empfangen - + Max Max - + Swap 25% of your tradable balance. - + Swap 50% of your tradable balance. - + Swap 100% of your tradable balance. - + Min Volume - + Min amount to sell - + Min amount to receive - + Minimum accepted trade equals 10% of order volume. - + Minimum accepted trade equals 25% of order volume. - + Minimum accepted trade equals 50% of order volume. - + Min volume: Mindestvolumen: - + Use custom minimum trade amount Benutzerdefinierten Mindesthandelsbetrag verwenden + + + Order Selected + Order ausgewählt + + + + CREATE MAKER SWAP + + + + + START TAKER SWAP + + OrderLine @@ -2640,104 +2665,114 @@ They will be removed from the orderbook until you log in again. OrderModal - + Order Type Orderart - + Maker Order Maker-Order - + Taker Order Taker-Order - + Refund State Rückerstattungsstatus - + Your swap failed but the auto-refund process for your payment started already. Please wait and keep application opened until you receive your payment back Ihr Umtausch ist fehlgeschlagen, aber der automatische Rückerstattungsprozess für Ihre Zahlung hat bereits begonnen. Bitte warten Sie und lassen Sie die Anwendung geöffnet, bis Sie Ihre Zahlung zurückerhalten - + Date Datum - + Error ID Fehler-ID - - + + Error Log Fehlerprotokoll - + Close Schließen - + Cancel Order Order Abbrechen - - + + Min Volume + + + + + Max Volume + + + + + Swap ID Swap ID - + Maker Payment Sent Transaction ID Maker-Zahlung gesendet: Transaktions-ID - + Maker Payment Spent Transaction ID Maker-Zahlung ausgegeben: Transaktions-ID - + Maker Payment TXID Maker-Zahlung: TXID - + Taker Payment Spent Transaction ID Taker-Zahlung ausgegeben: Transaktions-ID - + Taker Payment Sent Transaction ID Taker-Zahlung gesendet: Transaktions-ID - + Taker Payment TXID Taker-Zahlung: TXID - + Recover Funds Rückerstattung der Geldmittel - + Refunding... Rückzahlung… - + View on Explorer Ansicht im Explorer @@ -2751,10 +2786,9 @@ They will be removed from the orderbook until you log in again. - The selected order does not exist anymore, it might have been matched or canceled, and no order with a better price is available. + The selected order does not exist anymore, it might have been matched or cancelled, and no order with a better price is available. Please select a new order. - Die ausgewählte Order existiert nicht mehr! Sie wurde möglicherweise zugeordnet oder storniert und es ist keine Order mit einem besseren Preis verfügbar. -Bitte wählen Sie eine neue Order aus. + @@ -2906,23 +2940,23 @@ Bitte wählen Sie eine neue Order aus. Ausgewählt - + Expensive Teuer - + Expedient Sinnvoll - + %1 compared to CEX PRICE_DIFF% %1 im Vergleich zu CEX - + CEXchange rate CEX-Wechselkurs @@ -2945,17 +2979,17 @@ Bitte wählen Sie eine neue Order aus. CEX-Wechselkurs - + Expensive Teuer - + Expedient Sinnvoll - + %1 compared to CEX PRICE_DIFF% %1 im Vergleich zu CEX @@ -2964,12 +2998,12 @@ Bitte wählen Sie eine neue Order aus. ProView - + Failed to place the order Die Order konnte nicht platziert werden - + Placed the order Order platziert @@ -3438,7 +3472,7 @@ Bitte wählen Sie eine neue Order aus. SettingModal - + Cancel Abbrechen @@ -3533,63 +3567,83 @@ Bitte wählen Sie eine neue Order aus. Design zu %1 geändert - + + Show orders after placement + + + + Disable 2FA? 2FA deaktivieren? - + Enter your wallet password to confirm Geben Sie zur Bestätigung das Kennwort ihrer Brieftasche ein - + Type password Kennwort eingeben - + 2FA status 2FA Status - + 2FA disabled successfully 2FA erfolgreich deaktiviert - - + + Ok Ok - + Wrong password! Falsches Kennwort! - + Wallet password is incorrect Kennwort der Brieftasche ist falsch - + Reuse static RPC password - + Application Version Anwendungsversion - + copied to clipboard In die Zwischenablage kopiert - + + KDF version + + + + + KDF Version + + + + + KDF Version copied to clipboard. + + + + Search for Update @@ -3611,100 +3665,85 @@ Bitte wählen Sie eine neue Order aus. - + Confirm Bestätigen - + Ask system's password before sending coins ? (2FA) Vor dem Senden von Coins nach dem Kennwort des Systems fragen? (2FA) - + View seed and private keys Seed- und privaten Schlüsseln anzeigen - - + + Show Zeigen - + Setup Camouflage Password Tarnkennwort einrichten - + Open Öffnen - + Disclaimer and ToS Haftungsausschluss und Nutzungsbedingungen - + Application version Anwendungsversion - - MM2 version - MM2 Version - - - - MM2 Version - MM2 Version - - - - MM2 Version copied to clipboard. - MM2 Version in die Zwischenablage kopiert. - - - - + + RPC Port - + RPC Port copied to clipboard. - - + + Peer ID - + Peer ID copied to clipboard. - + Qt version Qt Version - + Qt Version Qt Version - + Qt Version copied to clipboard. Qt Version in die Zwischenablage kopiert. - + Logout Abmelden @@ -4292,25 +4331,20 @@ There is a toggle in settings where you can turn on/off the display of these tra Display Settings Bildschirmeinstellungen - - - Ticker Selectors - Ticker Selektoren - - Trading Information - Handelsinformationen + Order Book + Orderbuch - Markets + Order Form - - Place Order - Order platzieren + + Trading Information + Handelsinformationen @@ -4465,8 +4499,8 @@ There is a toggle in settings where you can turn on/off the display of these tra Vertical - Order Book - Orderbuch + %1 Orderbook + @@ -4587,7 +4621,7 @@ This might take a few minutes... atomic_dex::settings_page - + An error has occurred. diff --git a/atomic_defi_design/assets/languages/atomic_defi_en.ts b/atomic_defi_design/assets/languages/atomic_defi_en.ts index 2ce0fd7f4a..19b66dd495 100644 --- a/atomic_defi_design/assets/languages/atomic_defi_en.ts +++ b/atomic_defi_design/assets/languages/atomic_defi_en.ts @@ -759,83 +759,93 @@ ConfirmTradeModal - + Confirm Exchange Details - + Trade price is more than 50% different to CEX! Confirm? - + This swap request can not be undone and is a final event! - + This transaction can take up to 60 mins - DO NOT close this application! - + Loading fees... - + <b>Total %1 fees:</b> - + Security configuration - + %1 confirmations for incoming %2 transactions - + Read more about dPoW - + + Cancel all existing orders for %1/%2? + + + + + Good until cancelled (order will remain on orderbook until filled or cancelled) + + + + Use custom protection settings for incoming %1 transactions TICKER - + Enable Komodo dPoW security - + dPoW protected - + Required Confirmations - + Warning, this atomic swap is not dPoW protected! - + Cancel Cancel - + Confirm @@ -1759,11 +1769,11 @@ Try again or select 'Allow custom seed' to continue. - Best Orders + Best Orders for %1 - + Enter volume to see best orders. @@ -1771,17 +1781,22 @@ Try again or select 'Allow custom seed' to continue. ListDelegate - + %1 is not enabled - Do you want to enable it to be able to select %2 best orders ?<br><a href='#'>Yes</a> - <a href='#no'>No</a> - + %1 is not enabled - Please enable it through the coin activation menu - + + Orderbook is disabled while creating maker orders + + + + This order requires a minimum amount of %1 %2 <br>You don't have enough funds.<br> %3 @@ -1803,7 +1818,7 @@ Try again or select 'Allow custom seed' to continue. - Initializing MM2 + Initializing KDF @@ -1913,7 +1928,7 @@ They will be removed from the orderbook until you log in again. - + Swap @@ -1944,84 +1959,69 @@ They will be removed from the orderbook until you log in again. - - - + + + Public Key - + Copied to Clipboard - + Explore - + There is no chart data for this ticker yet - + Fetching transactions... - + No transactions available. - + Please wait, %1 is %2 - + Loading ticker chart data - + % activated... - + Chart - - + + Orders - - + + History - - - Place Order - - - - - Order Selected - - - - - START SWAP - - @@ -2073,6 +2073,16 @@ They will be removed from the orderbook until you log in again. This contact does not have any registered address. + + + Taker Order + + + + + Maker Order + + Market @@ -2090,13 +2100,13 @@ They will be removed from the orderbook until you log in again. MarketModeSelector - + Sell %1 TICKER - + Buy %1 TICKER @@ -2530,95 +2540,110 @@ They will be removed from the orderbook until you log in again. OrderForm - + Price - + Reduce 1% relative to CEX market price. - + Use CEX market price. - + Increase 1% relative to CEX market price. - + Send - + Receive - + Max - + Swap 25% of your tradable balance. - + Swap 50% of your tradable balance. - + Swap 100% of your tradable balance. - + Min Volume - + Min amount to sell - + Min amount to receive - + Minimum accepted trade equals 10% of order volume. - + Minimum accepted trade equals 25% of order volume. - + Minimum accepted trade equals 50% of order volume. - + Min volume: - + Use custom minimum trade amount + + + Order Selected + + + + + CREATE MAKER SWAP + + + + + START TAKER SWAP + + OrderLine @@ -2639,104 +2664,114 @@ They will be removed from the orderbook until you log in again. OrderModal - + Order Type - + Maker Order - + Taker Order - + Refund State - + Your swap failed but the auto-refund process for your payment started already. Please wait and keep application opened until you receive your payment back - + Date - + Error ID - - + + Error Log - + Close - + Cancel Order - - + + Min Volume + + + + + Max Volume + + + + + Swap ID - + Maker Payment Sent Transaction ID - + Maker Payment Spent Transaction ID - + Maker Payment TXID - + Taker Payment Spent Transaction ID - + Taker Payment Sent Transaction ID - + Taker Payment TXID - + Recover Funds - + Refunding... - + View on Explorer @@ -2750,7 +2785,7 @@ They will be removed from the orderbook until you log in again. - The selected order does not exist anymore, it might have been matched or canceled, and no order with a better price is available. + The selected order does not exist anymore, it might have been matched or cancelled, and no order with a better price is available. Please select a new order. @@ -2904,23 +2939,23 @@ Please select a new order. - + Expensive - + Expedient - + %1 compared to CEX PRICE_DIFF% - + CEXchange rate @@ -2943,17 +2978,17 @@ Please select a new order. - + Expensive - + Expedient - + %1 compared to CEX PRICE_DIFF% @@ -2962,12 +2997,12 @@ Please select a new order. ProView - + Failed to place the order - + Placed the order @@ -3436,7 +3471,7 @@ Please select a new order. SettingModal - + Cancel Cancel @@ -3511,12 +3546,12 @@ Please select a new order. - + Application Version - + copied to clipboard @@ -3558,151 +3593,156 @@ Please select a new order. - + Confirm - + + Show orders after placement + + + + Ask system's password before sending coins ? (2FA) - + Disable 2FA? - + Enter your wallet password to confirm - + Type password - + 2FA status - + 2FA disabled successfully - - + + Ok - + Wrong password! - + Wallet password is incorrect - + View seed and private keys - - + + Show - + Setup Camouflage Password - + Open - + Reuse static RPC password - + Disclaimer and ToS - + Application version - - MM2 version + + KDF version - - MM2 Version + + KDF Version - - MM2 Version copied to clipboard. + + KDF Version copied to clipboard. - - + + RPC Port - + RPC Port copied to clipboard. - - + + Peer ID - + Peer ID copied to clipboard. - + Qt version - + Qt Version - + Qt Version copied to clipboard. - + Search for Update - + Logout @@ -4282,24 +4322,19 @@ There is a toggle in settings where you can turn on/off the display of these tra Display Settings - - - Ticker Selectors - - - Trading Information + Order Book - Markets + Order Form - - Place Order + + Trading Information @@ -4455,7 +4490,7 @@ There is a toggle in settings where you can turn on/off the display of these tra Vertical - Order Book + %1 Orderbook @@ -4577,7 +4612,7 @@ This might take a few minutes... atomic_dex::settings_page - + An error has occurred. diff --git a/atomic_defi_design/assets/languages/atomic_defi_es.ts b/atomic_defi_design/assets/languages/atomic_defi_es.ts index d87b5995c1..6cd3ee4058 100644 --- a/atomic_defi_design/assets/languages/atomic_defi_es.ts +++ b/atomic_defi_design/assets/languages/atomic_defi_es.ts @@ -759,83 +759,93 @@ ConfirmTradeModal - + Confirm Exchange Details Confirmar Detalles de Intercambio - + Trade price is more than 50% different to CEX! Confirm? ¡El precio comercial es más del 50% diferente al de CEX! ¿Confirmar? - + This swap request can not be undone and is a final event! ¡Esta solicitud de intercambio no se puede deshacer y es un evento final! - + This transaction can take up to 60 mins - DO NOT close this application! Esta transacción puede demorar hasta 60 minutos. ¡NO cierre esta aplicación! - + Loading fees... Cargando tarifas... - + <b>Total %1 fees:</b> <b>Cuota total de %1:</b> - + Security configuration Configuración de seguridad - + %1 confirmations for incoming %2 transactions %1 confirmaciones para %2 transacciones entrantes - + Read more about dPoW Obtenga más información sobre dPoW - + + Cancel all existing orders for %1/%2? + + + + + Good until cancelled (order will remain on orderbook until filled or cancelled) + + + + Use custom protection settings for incoming %1 transactions TICKER Utilice configuraciones de protección personalizadas para %1 transacciones entrantes - + Enable Komodo dPoW security Habilite la seguridad dPoW de Komodo - + dPoW protected Protegido por dPoW - + Required Confirmations Confirmaciones Requeridas - + Warning, this atomic swap is not dPoW protected! Advertencia, este intercambio atómico no está protegido por dPoW! - + Cancel Cancelar - + Confirm Confirmar @@ -1760,11 +1770,11 @@ Vuelva a intentarlo o seleccione 'Permitir semilla personalizada' pers - Best Orders - Mejores Ordenes + Best Orders for %1 + - + Enter volume to see best orders. Introduce el volumen para ver los mejores ordenes @@ -1772,17 +1782,22 @@ Vuelva a intentarlo o seleccione 'Permitir semilla personalizada' pers ListDelegate - + %1 is not enabled - Do you want to enable it to be able to select %2 best orders ?<br><a href='#'>Yes</a> - <a href='#no'>No</a> %1 no está habilitado. ¿Desea habilitarlo para poder seleccionar %2 mejores ordenes?<br><a href='#'>Sí</a> - <a href='#no'>No</a> - + %1 is not enabled - Please enable it through the coin activation menu - + + Orderbook is disabled while creating maker orders + + + + This order requires a minimum amount of %1 %2 <br>You don't have enough funds.<br> %3 Este pedido requiere una cantidad mínima de %1 %2 <br>No tiene fondos suficientes.<br> %3 @@ -1804,8 +1819,8 @@ Vuelva a intentarlo o seleccione 'Permitir semilla personalizada' pers - Initializing MM2 - Inicializando MM2 + Initializing KDF + @@ -1916,7 +1931,7 @@ Se eliminarán del libro de pedidos hasta que vuelva a iniciar sesión.Recibir - + Swap Intercambiar @@ -1947,84 +1962,69 @@ Se eliminarán del libro de pedidos hasta que vuelva a iniciar sesión. - - - + + + Public Key Clave Pública - + Copied to Clipboard Copiada en el Portapapeles - + Explore - + There is no chart data for this ticker yet No hay datos de gráficos para este ticker aún - + Fetching transactions... Obteniendo transacciones... - + No transactions available. - + Please wait, %1 is %2 Por favor espera %1 es %2 - + Loading ticker chart data - + % activated... % activado... - + Chart Gráfico - - + + Orders Pedidos - - + + History Historial - - - Place Order - Realizar pedido - - - - Order Selected - Pedido seleccionado - - - - START SWAP - INICIO INTERCAMBIAR - @@ -2076,6 +2076,16 @@ Se eliminarán del libro de pedidos hasta que vuelva a iniciar sesión.This contact does not have any registered address. Este contacto no tiene ninguna dirección registrada. + + + Taker Order + Orden de Taker + + + + Maker Order + Orden de Maker + Market @@ -2093,13 +2103,13 @@ Se eliminarán del libro de pedidos hasta que vuelva a iniciar sesión. MarketModeSelector - + Sell %1 TICKER Vender %1 - + Buy %1 TICKER Comprar %1 @@ -2533,95 +2543,110 @@ Se eliminarán del libro de pedidos hasta que vuelva a iniciar sesión. OrderForm - + Price Precio - + Reduce 1% relative to CEX market price. Reducción del 1% en relación con el precio de mercado CEX. - + Use CEX market price. Utilice el precio de mercado CEX. - + Increase 1% relative to CEX market price. Aumento del 1% en relación con el precio de mercado de CEX. - + Send Enviar - + Receive Recibir - + Max Max - + Swap 25% of your tradable balance. Usar el 25% de su saldo comercial. - + Swap 50% of your tradable balance. Usar el 50% de su saldo comercial. - + Swap 100% of your tradable balance. Usar el 100% de su saldo comercial. - + Min Volume Volumen Mínimo - + Min amount to sell Cantidad mínima para vender - + Min amount to receive Cantidad mínimo para recibir - + Minimum accepted trade equals 10% of order volume. El comercio mínimo aceptado es igual al 10% del volumen del pedido. - + Minimum accepted trade equals 25% of order volume. El comercio mínimo aceptado es igual al 25% del volumen del pedido. - + Minimum accepted trade equals 50% of order volume. El comercio mínimo aceptado es igual al 50% del volumen del pedido. - + Min volume: Volumen mínimo: - + Use custom minimum trade amount Utilizar una cantidad personalizada de intercambio mínima + + + Order Selected + Pedido seleccionado + + + + CREATE MAKER SWAP + + + + + START TAKER SWAP + + OrderLine @@ -2642,104 +2667,114 @@ Se eliminarán del libro de pedidos hasta que vuelva a iniciar sesión. OrderModal - + Order Type Tipo de Orden - + Maker Order Orden de Maker - + Taker Order Orden de Taker - + Refund State Estado del Reembolso - + Your swap failed but the auto-refund process for your payment started already. Please wait and keep application opened until you receive your payment back Su intercambio falló, pero el proceso de reembolso automático para su pago ya comenzó. Espere y mantenga la aplicación abierta hasta que reciba su pago - + Date Fecha - + Error ID ID de Error - - + + Error Log Registro de Error - + Close Cerrar - + Cancel Order Cancelar Pedido - - + + Min Volume + Volumen Mínimo + + + + Max Volume + + + + + Swap ID ID de Intercambio - + Maker Payment Sent Transaction ID ID de la transacción pago enviada de Maker - + Maker Payment Spent Transaction ID ID de la transacción pago gastado de Maker - + Maker Payment TXID TXID del pago de Maker - + Taker Payment Spent Transaction ID ID de la transacción pago gastado de Taker - + Taker Payment Sent Transaction ID ID de la transacción pago enviada de Taker - + Taker Payment TXID TXID del pago de Taker - + Recover Funds Recuperar fondos - + Refunding... Reembolso... - + View on Explorer Ver en Explorer @@ -2753,10 +2788,9 @@ Se eliminarán del libro de pedidos hasta que vuelva a iniciar sesión. - The selected order does not exist anymore, it might have been matched or canceled, and no order with a better price is available. + The selected order does not exist anymore, it might have been matched or cancelled, and no order with a better price is available. Please select a new order. - El pedido seleccionado ya no existe, puede haber sido igualado o cancelado, y no hay un pedido con mejor precio disponible. -Seleccione un nuevo pedido. + @@ -2908,23 +2942,23 @@ Seleccione un nuevo pedido. Seleccionada - + Expensive Caro - + Expedient Expediente - + %1 compared to CEX PRICE_DIFF% %1 en comparación con CEX - + CEXchange rate Tasa de cambio CEX @@ -2947,17 +2981,17 @@ Seleccione un nuevo pedido. Tasa de cambio CEX - + Expensive Caro - + Expedient Expediente - + %1 compared to CEX PRICE_DIFF% %1 en comparación con CEX @@ -2966,12 +3000,12 @@ Seleccione un nuevo pedido. ProView - + Failed to place the order Error al realizar el pedido - + Placed the order Realizó el pedido El @@ -3440,7 +3474,7 @@ Seleccione un nuevo pedido. SettingModal - + Cancel Cancelar @@ -3515,12 +3549,12 @@ Seleccione un nuevo pedido. Cambiando el tema a %1 - + Application Version La versión de la aplicación - + copied to clipboard copiado al portapapeles @@ -3562,151 +3596,156 @@ Seleccione un nuevo pedido. - + Confirm Confirmar - + + Show orders after placement + + + + Ask system's password before sending coins ? (2FA) ¿Preguntar la contraseña del sistema antes de enviar monedas? (2FA) - + Disable 2FA? ¿Deshabilitar 2FA? - + Enter your wallet password to confirm Ingrese la contraseña de su billetera para confirmar - + Type password Escriba la contraseña - + 2FA status Estado 2FA - + 2FA disabled successfully 2FA deshabilitado correctamente - - + + Ok Ok - + Wrong password! ¡Contraseña incorrecta! - + Wallet password is incorrect Contraseña de la billetera es incorrecta - + View seed and private keys Ver semilla y claves privadas - - + + Show Mostrar - + Setup Camouflage Password Configuración de Contraseña Camuflaje - + Open Abrir - + Reuse static RPC password - + Disclaimer and ToS Descargo de Responsabilidad y Terminos de Servicio - + Application version Versión de Aplicación - - MM2 version - Versión MM2 + + KDF version + - - MM2 Version - Versión MM2 + + KDF Version + - - MM2 Version copied to clipboard. - Versión MM2 copiada al portapapeles. + + KDF Version copied to clipboard. + - - + + RPC Port - + RPC Port copied to clipboard. - - + + Peer ID - + Peer ID copied to clipboard. - + Qt version Versión Qt - + Qt Version Versión Qt - + Qt Version copied to clipboard. Versión de Qt copiada al portapapeles. - + Search for Update - + Logout Cerrar sesión @@ -4294,25 +4333,20 @@ There is a toggle in settings where you can turn on/off the display of these tra Display Settings Configuracion de Vista - - - Ticker Selectors - Selectores - - Trading Information - Información de Intercambios + Order Book + Libro de Ordenes - Markets + Order Form - - Place Order - Realizar pedido + + Trading Information + Información de Intercambios @@ -4467,8 +4501,8 @@ There is a toggle in settings where you can turn on/off the display of these tra Vertical - Order Book - Libro de Ordenes + %1 Orderbook + @@ -4590,7 +4624,7 @@ Esto puede tardar unos minutos... atomic_dex::settings_page - + An error has occurred. Se ha producido un error. diff --git a/atomic_defi_design/assets/languages/atomic_defi_fr.ts b/atomic_defi_design/assets/languages/atomic_defi_fr.ts index d1ce976885..9a64fb3d97 100644 --- a/atomic_defi_design/assets/languages/atomic_defi_fr.ts +++ b/atomic_defi_design/assets/languages/atomic_defi_fr.ts @@ -759,83 +759,93 @@ ConfirmTradeModal - + Confirm Exchange Details Détails de la confirmation de l'échange - + This swap request can not be undone and is a final event! La requête de ce swap ne peut pas être annulé, c'est irréversible ! - + Security configuration Configuration de la sécurité - + Read more about dPoW En savoir plus sur dPoW - + Use custom protection settings for incoming %1 transactions TICKER Utiliser les paramètres de protection personnalisés pour les transactions %1 entrantes - + Enable Komodo dPoW security Activer la sécurité de Komodo dPoW - + %1 confirmations for incoming %2 transactions Il y a %1 confirmations pour les transactions entrantes du ticker %2 - + This transaction can take up to 60 mins - DO NOT close this application! Cette transaction peut prendre jusqu'à 60 minutes - NE fermez PAS cette application ! - + Trade price is more than 50% different to CEX! Confirm? Le prix est supérieur à 50% du prix sur les CEX ! Êtes-vous sûr ? - + Loading fees... - + <b>Total %1 fees:</b> Frais totaux %1: - + + Cancel all existing orders for %1/%2? + + + + + Good until cancelled (order will remain on orderbook until filled or cancelled) + + + + dPoW protected Protégé par dPoW - + Required Confirmations Confirmations requises - + Warning, this atomic swap is not dPoW protected! Attention, ce swap atomique n'est pas protégé par dPoW ! - + Cancel Annuler - + Confirm Confirmer @@ -1759,11 +1769,11 @@ Try again or select 'Allow custom seed' to continue. - Best Orders - Meilleurs offres + Best Orders for %1 + - + Enter volume to see best orders. @@ -1771,17 +1781,22 @@ Try again or select 'Allow custom seed' to continue. ListDelegate - + %1 is not enabled - Do you want to enable it to be able to select %2 best orders ?<br><a href='#'>Yes</a> - <a href='#no'>No</a> %1 n'est pas activé - Souhaitez vous l'activer pour pouvoir selectionnez les meilleurs offres %2 ?<br><a href='#'>Oui</a> - <a href='#no'>Non</a> - + %1 is not enabled - Please enable it through the coin activation menu - + + Orderbook is disabled while creating maker orders + + + + This order requires a minimum amount of %1 %2 <br>You don't have enough funds.<br> %3 Cette commande nécessite un montant minimum de %1 %2 <br>Vous n'avez pas assez de fonds.<br> %3 @@ -1803,8 +1818,8 @@ Try again or select 'Allow custom seed' to continue. - Initializing MM2 - Initialisation de MM2 + Initializing KDF + @@ -1913,7 +1928,7 @@ They will be removed from the orderbook until you log in again. Recevoir - + Swap Échange @@ -1944,84 +1959,69 @@ They will be removed from the orderbook until you log in again. - - - + + + Public Key - + Copied to Clipboard Copier dans le presse-papier - + Explore - + There is no chart data for this ticker yet Il n'y a pas encore de données graphiques pour ce ticker - + Fetching transactions... - + No transactions available. - + Please wait, %1 is %2 - + Loading ticker chart data - + % activated... - + Chart Chart - - + + Orders Ordres - - + + History Historique - - - Place Order - Placer l'ordre - - - - Order Selected - Ordre séléctionné - - - - START SWAP - COMMENCER L'ÉCHANGE - @@ -2073,6 +2073,16 @@ They will be removed from the orderbook until you log in again. This contact does not have any registered address. + + + Taker Order + Ordre d'achat + + + + Maker Order + Ordre de vente + Market @@ -2090,13 +2100,13 @@ They will be removed from the orderbook until you log in again. MarketModeSelector - + Sell %1 TICKER - + Buy %1 TICKER @@ -2530,92 +2540,107 @@ They will be removed from the orderbook until you log in again. OrderForm - + Send Envoyez - + Receive Recevoir - + Max Max - + Swap 25% of your tradable balance. - + Swap 50% of your tradable balance. - + Swap 100% of your tradable balance. - + Min Volume - + Min amount to sell - + Min amount to receive - + Minimum accepted trade equals 10% of order volume. - + Minimum accepted trade equals 25% of order volume. - + Minimum accepted trade equals 50% of order volume. - + Min volume: Min volume : - + Use custom minimum trade amount Utiliser le montant d'échange minimum personnalisé - + + Order Selected + Ordre séléctionné + + + + CREATE MAKER SWAP + + + + + START TAKER SWAP + + + + Price Prix - + Reduce 1% relative to CEX market price. - + Use CEX market price. - + Increase 1% relative to CEX market price. @@ -2639,104 +2664,114 @@ They will be removed from the orderbook until you log in again. OrderModal - + Order Type - + Maker Order Ordre de vente - + Taker Order Ordre d'achat - + + Min Volume + + + + + Max Volume + + + + Refund State État de remboursement - + Your swap failed but the auto-refund process for your payment started already. Please wait and keep application opened until you receive your payment back Votre échange a échoué, mais le processus de remboursement automatique de votre paiement a déjà commencé. Veuillez patienter et garder l'application ouverte jusqu'à ce que vous receviez votre remboursement - + Date Date - + Recover Funds Récupérer des fonds - + Refunding... Remboursement... - + View on Explorer Voir dans l'explorateur - + Cancel Order Annuler l'ordre - + Error ID ID de l'erreur - - + + Swap ID ID du Swap - + Maker Payment Sent Transaction ID - + Maker Payment Spent Transaction ID - + Maker Payment TXID - + Taker Payment Spent Transaction ID - + Taker Payment Sent Transaction ID - + Taker Payment TXID - - + + Error Log Journal des erreurs - + Close Fermer @@ -2750,7 +2785,7 @@ They will be removed from the orderbook until you log in again. - The selected order does not exist anymore, it might have been matched or canceled, and no order with a better price is available. + The selected order does not exist anymore, it might have been matched or cancelled, and no order with a better price is available. Please select a new order. @@ -2904,23 +2939,23 @@ Please select a new order. Choisi - + Expensive Coûteuse - + Expedient Abordable - + %1 compared to CEX PRICE_DIFF% %1 par rapport aux CEX - + CEXchange rate Taux du CEX @@ -2943,17 +2978,17 @@ Please select a new order. Taux du CEX - + Expensive Coûteuse - + Expedient Abordable - + %1 compared to CEX PRICE_DIFF% %1 par rapport aux CEX @@ -2962,12 +2997,12 @@ Please select a new order. ProView - + Failed to place the order Échec lors du placement de l'ordre - + Placed the order L'ordre a été placé avec succès @@ -3436,7 +3471,7 @@ Please select a new order. SettingModal - + Cancel Annuler @@ -3523,7 +3558,7 @@ Please select a new order. - + Confirm Confirmer @@ -3533,63 +3568,83 @@ Please select a new order. Changer le thème en %1 - + + Show orders after placement + + + + Disable 2FA? - + Enter your wallet password to confirm - + Type password Tapez votre mot de passe - + 2FA status - + 2FA disabled successfully - - + + Ok Ok - + Wrong password! - + Wallet password is incorrect - + Reuse static RPC password - + Application Version - + copied to clipboard copié dans le presse-papier - + + KDF version + + + + + KDF Version + + + + + KDF Version copied to clipboard. + + + + Search for Update @@ -3614,95 +3669,80 @@ Please select a new order. Thème - + Ask system's password before sending coins ? (2FA) Demander le mot de passe du système avant d'envoyer des actifs ? (2FA) - + Application version Version de l'application - - MM2 version - Version de MM2 - - - - MM2 Version - MM2 Version - - - - MM2 Version copied to clipboard. - MM2 Version copiée dans le presse-papiers. - - - - + + RPC Port - + RPC Port copied to clipboard. - - + + Peer ID - + Peer ID copied to clipboard. - + Qt version Version de Qt - + Qt Version Qt Version - + Qt Version copied to clipboard. Version Qt copiée dans le presse-papiers. - + Logout Se déconnecter - + View seed and private keys Afficher la phrase de récupération et les clefs privées - - + + Show Montrer - + Setup Camouflage Password Configurer le mot de passe de camouflage - + Open Ouvrir - + Disclaimer and ToS Clause de non-responsabilité et conditions d'utilisation @@ -4282,25 +4322,20 @@ There is a toggle in settings where you can turn on/off the display of these tra Display Settings - - - Ticker Selectors - - - Trading Information - Informations de Trading + Order Book + Carnet d'ordres - Markets + Order Form - - Place Order - Placer l'ordre + + Trading Information + Informations de Trading @@ -4455,8 +4490,8 @@ There is a toggle in settings where you can turn on/off the display of these tra Vertical - Order Book - Carnet d'ordres + %1 Orderbook + @@ -4577,7 +4612,7 @@ This might take a few minutes... atomic_dex::settings_page - + An error has occurred. diff --git a/atomic_defi_design/assets/languages/atomic_defi_ru.ts b/atomic_defi_design/assets/languages/atomic_defi_ru.ts index 661ad84490..eb6959a146 100644 --- a/atomic_defi_design/assets/languages/atomic_defi_ru.ts +++ b/atomic_defi_design/assets/languages/atomic_defi_ru.ts @@ -759,83 +759,93 @@ ConfirmTradeModal - + Confirm Exchange Details Подтвердить данные обмена - + Trade price is more than 50% different to CEX! Confirm? Стоимость обмена в сравнении с CEX дороже более чем на 50%, вы подтверждаете сделку? - + This swap request can not be undone and is a final event! Этот запрос на своп не может быть отменен и является окончательным! - + This transaction can take up to 60 mins - DO NOT close this application! Эта транзакция может занять до 60 минут - НЕ закрывайте приложение! - + Loading fees... - + <b>Total %1 fees:</b> - + Security configuration Настройки безопасности - + %1 confirmations for incoming %2 transactions %1 подтверждений для входящих %2 транзакций - + Read more about dPoW Узнать больше о dPoW - + + Cancel all existing orders for %1/%2? + + + + + Good until cancelled (order will remain on orderbook until filled or cancelled) + + + + Use custom protection settings for incoming %1 transactions TICKER Использовать пользовательские настройки защиты для входящих транзакций %1 - + Enable Komodo dPoW security Включить Komodo dPoW - + dPoW protected dPoW защита - + Required Confirmations Необходимое количество подтверждений - + Warning, this atomic swap is not dPoW protected! Предупреждение, этот атомарный своп не защищен dPoW! - + Cancel Отменить - + Confirm Подтверждение @@ -1765,11 +1775,11 @@ Try again or select 'Allow custom seed' to continue. - Best Orders - Лучшие ордеры + Best Orders for %1 + - + Enter volume to see best orders. @@ -1777,17 +1787,22 @@ Try again or select 'Allow custom seed' to continue. ListDelegate - + %1 is not enabled - Do you want to enable it to be able to select %2 best orders ?<br><a href='#'>Yes</a> - <a href='#no'>No</a> %1 не активирован -Вы хотите активировать этот %2 актив чтобы видеть лучшие ордеры для него ?<br><a href='#'>Да</a> - <a href='#no'>Нет</a> - + %1 is not enabled - Please enable it through the coin activation menu - + + Orderbook is disabled while creating maker orders + + + + This order requires a minimum amount of %1 %2 <br>You don't have enough funds.<br> %3 @@ -1809,8 +1824,8 @@ Try again or select 'Allow custom seed' to continue. - Initializing MM2 - Инициализация MM2 + Initializing KDF + @@ -1919,7 +1934,7 @@ They will be removed from the orderbook until you log in again. Получить - + Swap Обменять @@ -1950,84 +1965,69 @@ They will be removed from the orderbook until you log in again. - - - + + + Public Key - + Copied to Clipboard Скопировано в буфер обмена - + Explore - + There is no chart data for this ticker yet Для данного актива пока еще нет графиков данных - + Fetching transactions... - + No transactions available. - + Please wait, %1 is %2 - + Loading ticker chart data - + % activated... - + Chart График - - + + Orders Ордеры - - + + History История - - - Place Order - Разместить ордер - - - - Order Selected - Ордер выбран - - - - START SWAP - НАЧАТЬ ОБМЕН - @@ -2079,6 +2079,16 @@ They will be removed from the orderbook until you log in again. This contact does not have any registered address. + + + Taker Order + Тейкер ордер + + + + Maker Order + Мейкер ордер + Market @@ -2096,13 +2106,13 @@ They will be removed from the orderbook until you log in again. MarketModeSelector - + Sell %1 TICKER - + Buy %1 TICKER @@ -2536,95 +2546,110 @@ They will be removed from the orderbook until you log in again. OrderForm - + Price Цена - + Reduce 1% relative to CEX market price. - + Use CEX market price. - + Increase 1% relative to CEX market price. - + Send Отправить - + Receive Получить - + Max Макс - + Swap 25% of your tradable balance. - + Swap 50% of your tradable balance. - + Swap 100% of your tradable balance. - + Min Volume - + Min amount to sell - + Min amount to receive - + Minimum accepted trade equals 10% of order volume. - + Minimum accepted trade equals 25% of order volume. - + Minimum accepted trade equals 50% of order volume. - + Min volume: Мин. объем: - + Use custom minimum trade amount Задать минимальный объем сделки + + + Order Selected + Ордер выбран + + + + CREATE MAKER SWAP + + + + + START TAKER SWAP + + OrderLine @@ -2645,104 +2670,114 @@ They will be removed from the orderbook until you log in again. OrderModal - + Order Type - + Maker Order Мейкер ордер - + Taker Order Тейкер ордер - + Refund State Статус рефанда - + Your swap failed but the auto-refund process for your payment started already. Please wait and keep application opened until you receive your payment back Обмен не был завершен, но процесс автоматического рефанда уже начался. Пожалуйста, подождите, оставляя приложение открытым, пока вы не получите свои средства - + Date Дата - + Error ID ID ошибки - - + + Error Log Лог ошибки - + Close Закрыть - + Cancel Order Отменить ордер - - + + Min Volume + + + + + Max Volume + + + + + Swap ID ID обмена - + Maker Payment Sent Transaction ID - + Maker Payment Spent Transaction ID - + Maker Payment TXID - + Taker Payment Spent Transaction ID - + Taker Payment Sent Transaction ID - + Taker Payment TXID - + Recover Funds Восстановить средства - + Refunding... Возмещается... - + View on Explorer Показать в эксплорере @@ -2756,7 +2791,7 @@ They will be removed from the orderbook until you log in again. - The selected order does not exist anymore, it might have been matched or canceled, and no order with a better price is available. + The selected order does not exist anymore, it might have been matched or cancelled, and no order with a better price is available. Please select a new order. @@ -2910,23 +2945,23 @@ Please select a new order. Выбрано - + Expensive Невыгодный курс - + Expedient Выгодный курс - + %1 compared to CEX PRICE_DIFF% %1 по сравнению с CEX - + CEXchange rate CEXchange Цена @@ -2949,17 +2984,17 @@ Please select a new order. CEXchange Цена - + Expensive Невыгодный курс - + Expedient Выгодный курс - + %1 compared to CEX PRICE_DIFF% %1 по сравнению с CEX @@ -2968,12 +3003,12 @@ Please select a new order. ProView - + Failed to place the order Не удалось разместить ордер - + Placed the order Ордер размещен @@ -3442,7 +3477,7 @@ Please select a new order. SettingModal - + Cancel Отмена @@ -3529,7 +3564,7 @@ Please select a new order. - + Confirm Подтвердить @@ -3539,63 +3574,83 @@ Please select a new order. Изменить тему на %1 - + + Show orders after placement + + + + Disable 2FA? - + Enter your wallet password to confirm - + Type password Введите пароль - + 2FA status - + 2FA disabled successfully - - + + Ok Ок - + Wrong password! - + Wallet password is incorrect - + Reuse static RPC password - + Application Version - + copied to clipboard скопировано в буфер - + + KDF version + + + + + KDF Version + + + + + KDF Version copied to clipboard. + + + + Search for Update @@ -3620,95 +3675,80 @@ Please select a new order. Тема - + Ask system's password before sending coins ? (2FA) Спрашивать системный пароль перед отправкой монет? (2FA) - + Application version Версия приложения - - MM2 version - Версия MM2 - - - - MM2 Version - Версия MM2 - - - - MM2 Version copied to clipboard. - Версия MM2 скопирована в буфер обмена. - - - - + + RPC Port - + RPC Port copied to clipboard. - - + + Peer ID - + Peer ID copied to clipboard. - + Qt version Версия Qt - + Qt Version Версия Qt - + Qt Version copied to clipboard. Версия Qt скопирована в буфер обмена. - + Logout Выход - + View seed and private keys Показать seed-фразу и приватные ключи - - + + Show Показать - + Setup Camouflage Password Установить камуфляжный пароль - + Open Установить - + Disclaimer and ToS Дисклеймер и Условия Использования @@ -4288,25 +4328,20 @@ There is a toggle in settings where you can turn on/off the display of these tra Display Settings - - - Ticker Selectors - - - Trading Information - Торговая информация + Order Book + Ордербук - Markets + Order Form - - Place Order - Разместить ордер + + Trading Information + Торговая информация @@ -4461,8 +4496,8 @@ There is a toggle in settings where you can turn on/off the display of these tra Vertical - Order Book - Ордербук + %1 Orderbook + @@ -4583,7 +4618,7 @@ This might take a few minutes... atomic_dex::settings_page - + An error has occurred. diff --git a/atomic_defi_design/assets/languages/atomic_defi_tr.ts b/atomic_defi_design/assets/languages/atomic_defi_tr.ts index ecda9ba8ef..9871e932e8 100644 --- a/atomic_defi_design/assets/languages/atomic_defi_tr.ts +++ b/atomic_defi_design/assets/languages/atomic_defi_tr.ts @@ -759,83 +759,93 @@ ConfirmTradeModal - + Confirm Exchange Details Al-Sat Detaylarını Onayla - + This swap request can not be undone and is a final event! Bu takas isteği geri döndürülemez! - + Security configuration Güvenlik yapılandırması - + Read more about dPoW dPoW hakkında daha fazla bilgi - + Use custom protection settings for incoming %1 transactions TICKER %1 işlemleri için özel güvenlik ayarları kullan - + Enable Komodo dPoW security Komodo dPoW güvenliğini etkinleştir - + %1 confirmations for incoming %2 transactions Gelen %2 işlemleri için %1 onay - + This transaction can take up to 60 mins - DO NOT close this application! Bu işlem 60 dakikayı bulabilir - Programı KAPATMAYINIZ! - + Trade price is more than 50% different to CEX! Confirm? Takas ücreti CEX ile karşılaştırıldığında %50'den daha fazla farka sahip. Onaylıyor musunuz? - + Loading fees... - + <b>Total %1 fees:</b> <b>Toplam %1 işlem giderleri: </b> - + + Cancel all existing orders for %1/%2? + + + + + Good until cancelled (order will remain on orderbook until filled or cancelled) + + + + dPoW protected dPoW korumalı - + Required Confirmations Gereken Onaylar - + Warning, this atomic swap is not dPoW protected! Uyarı, bu atomik takas dPoW korumalı değil! - + Cancel İptal - + Confirm Onayla @@ -1753,11 +1763,11 @@ Try again or select 'Allow custom seed' to continue. - Best Orders - En İyi Emirler + Best Orders for %1 + - + Enter volume to see best orders. @@ -1765,17 +1775,22 @@ Try again or select 'Allow custom seed' to continue. ListDelegate - + %1 is not enabled - Do you want to enable it to be able to select %2 best orders ?<br><a href='#'>Yes</a> - <a href='#no'>No</a> %1 etkin değil - En iyi %2 siparişini seçebilmesi için etkinleştirmek istiyor musunuz ? <br><a href='#'>Evet</a> - <a href='#no'>Hayır</a> - + %1 is not enabled - Please enable it through the coin activation menu - + + Orderbook is disabled while creating maker orders + + + + This order requires a minimum amount of %1 %2 <br>You don't have enough funds.<br> %3 @@ -1797,8 +1812,8 @@ Try again or select 'Allow custom seed' to continue. - Initializing MM2 - MM2 başlatılıyor + Initializing KDF + @@ -1907,7 +1922,7 @@ They will be removed from the orderbook until you log in again. Al - + Swap Takasla @@ -1938,84 +1953,69 @@ They will be removed from the orderbook until you log in again. - - - + + + Public Key - + Copied to Clipboard Panoya Kopyalandı - + Explore - + There is no chart data for this ticker yet Henüz bu hisse senedi için grafik verisi yok - + Fetching transactions... - + No transactions available. - + Please wait, %1 is %2 - + Loading ticker chart data - + % activated... - + Chart Grafik - - + + Orders Emirler - - + + History Tarihçe - - - Place Order - Emir Ver - - - - Order Selected - Emir Seçildi - - - - START SWAP - Takası başlat - @@ -2067,6 +2067,16 @@ They will be removed from the orderbook until you log in again. This contact does not have any registered address. + + + Taker Order + Alıcı Emri + + + + Maker Order + Yapıcı Emri + Market @@ -2084,13 +2094,13 @@ They will be removed from the orderbook until you log in again. MarketModeSelector - + Sell %1 TICKER - + Buy %1 TICKER @@ -2524,92 +2534,107 @@ They will be removed from the orderbook until you log in again. OrderForm - + Send Gönder - + Receive Al - + Max Maks - + Swap 25% of your tradable balance. - + Swap 50% of your tradable balance. - + Swap 100% of your tradable balance. - + Min Volume - + Min amount to sell - + Min amount to receive - + Minimum accepted trade equals 10% of order volume. - + Minimum accepted trade equals 25% of order volume. - + Minimum accepted trade equals 50% of order volume. - + Min volume: - + Use custom minimum trade amount - + + Order Selected + Emir Seçildi + + + + CREATE MAKER SWAP + + + + + START TAKER SWAP + + + + Price Fiyat - + Reduce 1% relative to CEX market price. - + Use CEX market price. - + Increase 1% relative to CEX market price. @@ -2633,104 +2658,114 @@ They will be removed from the orderbook until you log in again. OrderModal - + Order Type - + Maker Order Yapıcı Emri - + Taker Order Alıcı Emri - + + Min Volume + + + + + Max Volume + + + + Refund State Geri Ödeme Durumu - + Your swap failed but the auto-refund process for your payment started already. Please wait and keep application opened until you receive your payment back Takas işlemi başarısız oldu, ancak otomatik geri ödeme süreci başladı. Lütfen bekleyin ve ödemenizi geri alana kadar uygulamayı açık tutun - + Date Tarih - + Recover Funds Fon Kurtar - + Refunding... - + View on Explorer Explorer'da Göster - + Cancel Order Emri İptal Et - + Error ID Hata ID - - + + Swap ID - + Maker Payment Sent Transaction ID - + Maker Payment Spent Transaction ID - + Maker Payment TXID - + Taker Payment Spent Transaction ID - + Taker Payment Sent Transaction ID - + Taker Payment TXID - - + + Error Log Hata Kaydı - + Close Kapat @@ -2744,7 +2779,7 @@ They will be removed from the orderbook until you log in again. - The selected order does not exist anymore, it might have been matched or canceled, and no order with a better price is available. + The selected order does not exist anymore, it might have been matched or cancelled, and no order with a better price is available. Please select a new order. @@ -2898,23 +2933,23 @@ Please select a new order. Seçili - + Expensive Pahalı - + Expedient Uygun - + %1 compared to CEX PRICE_DIFF% CEX ile karşılaştırıldığında %1 - + CEXchange rate CEXchange kuru @@ -2937,17 +2972,17 @@ Please select a new order. CEXchange kuru - + Expensive Pahalı - + Expedient Uygun - + %1 compared to CEX PRICE_DIFF% CEX ile karşılaştırıldığında %1 @@ -2956,12 +2991,12 @@ Please select a new order. ProView - + Failed to place the order Emir başarısız oldu - + Placed the order Emir başarılı @@ -3430,7 +3465,7 @@ Please select a new order. SettingModal - + Cancel İptal @@ -3517,7 +3552,7 @@ Please select a new order. - + Confirm Onayla @@ -3527,63 +3562,83 @@ Please select a new order. - + + Show orders after placement + + + + Disable 2FA? - + Enter your wallet password to confirm - + Type password - + 2FA status - + 2FA disabled successfully - - + + Ok Tamam - + Wrong password! - + Wallet password is incorrect - + Reuse static RPC password - + Application Version - + copied to clipboard - + + KDF version + + + + + KDF Version + + + + + KDF Version copied to clipboard. + + + + Search for Update @@ -3608,95 +3663,80 @@ Please select a new order. Tema - + Ask system's password before sending coins ? (2FA) Para göndermeden önce sistem parolası sorulsun mu ? (2FA) - + Application version Uygulama sürümü - - MM2 version - MM2 sürümü - - - - MM2 Version - - - - - MM2 Version copied to clipboard. - - - - - + + RPC Port - + RPC Port copied to clipboard. - - + + Peer ID - + Peer ID copied to clipboard. - + Qt version Qt sürümü - + Qt Version - + Qt Version copied to clipboard. - + Logout Çıkış - + View seed and private keys Seed ve özel anahtarları görüntüle - - + + Show Göster - + Setup Camouflage Password Kamuflaj Parolasını Ayarla - + Open - + Disclaimer and ToS Sorumluluk Reddi ve K.Ş. @@ -4276,25 +4316,20 @@ There is a toggle in settings where you can turn on/off the display of these tra Display Settings - - - Ticker Selectors - - - Trading Information - Al Sat Bilgisi + Order Book + Emir Defteri - Markets + Order Form - - Place Order - Emir Ver + + Trading Information + Al Sat Bilgisi @@ -4449,8 +4484,8 @@ There is a toggle in settings where you can turn on/off the display of these tra Vertical - Order Book - Emir Defteri + %1 Orderbook + @@ -4571,7 +4606,7 @@ This might take a few minutes... atomic_dex::settings_page - + An error has occurred. diff --git a/cmake/install/macos/osx_post_install.cmake b/cmake/install/macos/osx_post_install.cmake index 51f1c6cc4d..5aa979b41f 100644 --- a/cmake/install/macos/osx_post_install.cmake +++ b/cmake/install/macos/osx_post_install.cmake @@ -54,7 +54,7 @@ if (NOT EXISTS ${CMAKE_SOURCE_DIR}/bin/${DEX_PROJECT_NAME}.dmg) ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE) - execute_process(COMMAND codesign --deep --force -v -s "$ENV{MAC_SIGN_IDENTITY}" -o runtime --timestamp ${PROJECT_APP_PATH}/Contents/Resources/assets/tools/mm2/${DEX_API} + execute_process(COMMAND codesign --deep --force -v -s "$ENV{MAC_SIGN_IDENTITY}" -o runtime --timestamp ${PROJECT_APP_PATH}/Contents/Resources/assets/tools/kdf/${DEX_API} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE) diff --git a/cmake/project.metadata.cmake b/cmake/project.metadata.cmake index ea2771af2f..e15cabe5e2 100644 --- a/cmake/project.metadata.cmake +++ b/cmake/project.metadata.cmake @@ -1,5 +1,5 @@ # Default project values -set(DEX_API "mm2_kmd") +set(DEX_API "kdf_kwd") set(DEX_RPCPORT 7762) set(DEX_RPC "http://127.0.0.1:7762") set(DEX_PROJECT_NAME "komodo-wallet") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f5d49ac68a..35673f74e8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -113,11 +113,11 @@ add_executable(${PROJECT_NAME}_tests MACOSX_BUNDLE ${ICON} ##! API tests/api/coingecko/coingecko.tests.cpp tests/api/komodo_prices/komodo.prices.tests.cpp - tests/api/mm2/mm2.api.address_format.tests.cpp - tests/api/mm2/mm2.api.utxo_merge_params.tests.cpp - tests/api/mm2/mm2.api.balance_infos.tests.cpp - tests/api/mm2/mm2.fraction.tests.cpp - tests/api/mm2/mm2.rpc2.trade_preimage.tests.cpp + tests/api/kdf/kdf.api.address_format.tests.cpp + tests/api/kdf/kdf.api.utxo_merge_params.tests.cpp + tests/api/kdf/kdf.api.balance_infos.tests.cpp + tests/api/kdf/kdf.fraction.tests.cpp + tests/api/kdf/kdf.rpc2.trade_preimage.tests.cpp ##! CFG tests/config/coins.cfg.tests.cpp @@ -125,9 +125,9 @@ add_executable(${PROJECT_NAME}_tests MACOSX_BUNDLE ${ICON} ##! API tests/api/coingecko/coingecko.tests.cpp tests/api/komodo_prices/komodo.prices.tests.cpp - tests/api/mm2/mm2.rpc2.trade_preimage.tests.cpp - tests/api/mm2/mm2.fraction.tests.cpp - tests/api/mm2/enable_bch_with_tokens_rpc_tests.cpp + tests/api/kdf/kdf.rpc2.trade_preimage.tests.cpp + tests/api/kdf/kdf.fraction.tests.cpp + tests/api/kdf/enable_bch_with_tokens_rpc_tests.cpp ##! Utilities tests/utilities/qt.utilities.tests.cpp diff --git a/src/app/app.cpp b/src/app/app.cpp index a3a8fdf0cd..8036d57e47 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -40,7 +40,7 @@ //! Project Headers #include "app.hpp" #include "atomicdex/services/exporter/exporter.service.hpp" -#include "atomicdex/services/mm2/auto.update.maker.order.service.hpp" +#include "atomicdex/services/kdf/auto.update.maker.order.service.hpp" #include "atomicdex/services/price/komodo_prices/komodo.prices.provider.hpp" #include "atomicdex/services/price/coingecko/coingecko.wallet.charts.hpp" #include "atomicdex/services/price/orderbook.scanner.service.hpp" @@ -73,17 +73,17 @@ namespace atomic_dex std::vector coins_std{}; coins_std.reserve(coins.size()); - atomic_dex::mm2_service& mm2 = get_mm2(); + atomic_dex::kdf_service& kdf = get_kdf(); std::unordered_set extra_coins; for (auto&& coin : coins) { - auto coin_info = mm2.get_coin_info(coin.toStdString()); + auto coin_info = kdf.get_coin_info(coin.toStdString()); if (coin_info.has_parent_fees_ticker && coin_info.ticker != coin_info.fees_ticker && !coins.contains(QString::fromStdString(coin_info.fees_ticker))) { - auto coin_parent_info = mm2.get_coin_info(coin_info.fees_ticker); + auto coin_parent_info = kdf.get_coin_info(coin_info.fees_ticker); // todo: why can it be empty when it has been found ? // refactor coins enabling logic!!! if (coin_parent_info.ticker != "") @@ -100,7 +100,7 @@ namespace atomic_dex { coins_std.push_back(extra_coin); } - mm2.enable_coins(coins_std); + kdf.enable_coins(coins_std); return true; } @@ -114,14 +114,14 @@ namespace atomic_dex QString primary_coin = QString::fromStdString(g_primary_dex_coin); QString secondary_coin = QString::fromStdString(g_second_primary_dex_coin); QStringList coins_copy; - const auto& mm2 = system_manager_.get_system(); + const auto& kdf = system_manager_.get_system(); for (auto&& coin : coins) { - const auto coin_info = mm2.get_coin_info(coin.toStdString()); + const auto coin_info = kdf.get_coin_info(coin.toStdString()); bool has_parent_fees = coin_info.has_parent_fees_ticker; if (not get_orders()->swap_is_in_progress(coin) && coin != primary_coin && coin != secondary_coin) { - if (!get_mm2().is_zhtlc_coin_ready(coin.toStdString())) + if (!get_kdf().is_zhtlc_coin_ready(coin.toStdString())) { this->dispatcher_.trigger(coin.toStdString(), "Can't disable until fully activated."); } @@ -147,13 +147,13 @@ namespace atomic_dex coins_std.reserve(coins_copy.size()); for (auto&& coin : coins_copy) { - if (QString::fromStdString(get_mm2().get_current_ticker()) == coin && m_primary_coin_fully_enabled) + if (QString::fromStdString(get_kdf().get_current_ticker()) == coin && m_primary_coin_fully_enabled) { system_manager_.get_system().set_current_ticker(primary_coin); } coins_std.push_back(coin.toStdString()); } - get_mm2().disable_multiple_coins(coins_std); + get_kdf().disable_multiple_coins(coins_std); this->dispatcher_.trigger(false); } @@ -202,7 +202,7 @@ namespace atomic_dex std::string wallet_custom_cfg_filename = "custom-tokens."s + wallet_name + ".json"s; const fs::path wallet_custom_cfg_path{utils::get_atomic_dex_config_folder() / wallet_custom_cfg_filename}; const fs::path wallet_cfg_path{utils::get_atomic_dex_config_folder() / wallet_cfg_file}; - const fs::path mm2_coins_file_path{atomic_dex::utils::get_current_configs_path() / "coins.json"}; + const fs::path kdf_coins_file_path{atomic_dex::utils::get_current_configs_path() / "coins.json"}; const fs::path ini_file_path = atomic_dex::utils::get_current_configs_path() / "cfg.ini"; const fs::path cfg_json_file_path = atomic_dex::utils::get_current_configs_path() / "cfg.json"; const fs::path logo_path = atomic_dex::utils::get_logo_path(); @@ -308,7 +308,7 @@ namespace atomic_dex file.write(QString::fromStdString(custom_config_json_data.dump()).toUtf8()); file.close(); } - functor_remove(std::move(mm2_coins_file_path)); + functor_remove(std::move(kdf_coins_file_path)); functor_remove(std::move(cfg_json_file_path)); functor_remove(std::move(logo_path)); functor_remove(std::move(theme_path)); @@ -342,14 +342,14 @@ namespace atomic_dex void application::tick() { this->process_one_frame(); - if (m_event_actions[events_action::need_a_full_refresh_of_mm2]) + if (m_event_actions[events_action::need_a_full_refresh_of_kdf]) { - system_manager_.create_system(system_manager_); + system_manager_.create_system(system_manager_); connect_signals(); - m_event_actions[events_action::need_a_full_refresh_of_mm2] = false; + m_event_actions[events_action::need_a_full_refresh_of_kdf] = false; } - auto& mm2 = get_mm2(); - if (mm2.is_mm2_running()) + auto& kdf = get_kdf(); + if (kdf.is_kdf_running()) { std::vector to_init; while (not m_portfolio_queue.empty()) @@ -410,13 +410,13 @@ namespace atomic_dex switch (last_action) { case action::post_process_orders_and_swaps_finished: - if (mm2.is_mm2_running()) + if (kdf.is_kdf_running()) { qobject_cast(m_manager_models.at("orders"))->refresh_or_insert(); } break; case action::post_process_orders_and_swaps_finished_reset: - if (mm2.is_mm2_running()) + if (kdf.is_kdf_running()) { qobject_cast(m_manager_models.at("orders"))->refresh_or_insert(true); } @@ -425,9 +425,9 @@ namespace atomic_dex } } - mm2_service& application::get_mm2() + kdf_service& application::get_kdf() { - return this->system_manager_.get_system(); + return this->system_manager_.get_system(); } entt::dispatcher& application::get_dispatcher() @@ -486,8 +486,8 @@ namespace atomic_dex } // get_dispatcher().sink().connect<&application::on_refresh_update_status_event>(*this); - //! MM2 system need to be created before the GUI and give the instance to the gui - system_manager_.create_system(system_manager_); + //! KDF system need to be created before the GUI and give the instance to the gui + system_manager_.create_system(system_manager_); auto& settings_page_system = system_manager_.create_system(system_manager_, m_app, this); auto& portfolio_system = system_manager_.create_system(system_manager_, this); portfolio_system.get_portfolio()->set_cfg(settings_page_system.get_cfg()); @@ -540,17 +540,17 @@ namespace atomic_dex bool application::do_i_have_enough_funds(const QString& ticker, const QString& amount) const { t_float_50 amount_f = safe_float(amount.toStdString()); - return get_mm2().do_i_have_enough_funds(ticker.toStdString(), amount_f); + return get_kdf().do_i_have_enough_funds(ticker.toStdString(), amount_f); } - const mm2_service& application::get_mm2() const + const kdf_service& application::get_kdf() const { - return this->system_manager_.get_system(); + return this->system_manager_.get_system(); } QJsonObject application::get_zhtlc_status(const QString& coin) { - QJsonObject res = nlohmann_json_object_to_qt_json_object(get_mm2().get_zhtlc_status(coin.toStdString())); + QJsonObject res = nlohmann_json_object_to_qt_json_object(get_kdf().get_zhtlc_status(coin.toStdString())); return res; } @@ -558,11 +558,11 @@ namespace atomic_dex { std::error_code ec; SPDLOG_DEBUG("{} l{}", __FUNCTION__, __LINE__); - auto res = get_mm2().get_balance_info(coin.toStdString(), ec); + auto res = get_kdf().get_balance_info(coin.toStdString(), ec); return QString::fromStdString(res); } - void application::on_mm2_initialized_event([[maybe_unused]] const mm2_initialized& evt) + void application::on_kdf_initialized_event([[maybe_unused]] const kdf_initialized& evt) { SPDLOG_DEBUG("{} l{}", __FUNCTION__, __LINE__); system_manager_.get_system().set_status("enabling_coins"); @@ -571,10 +571,10 @@ namespace atomic_dex // Function appears to be unused. void application::refresh_orders_and_swaps() { - auto& mm2 = get_mm2(); - if (mm2.is_mm2_running()) + auto& kdf = get_kdf(); + if (kdf.is_kdf_running()) { - mm2.batch_fetch_orders_and_swap(); + kdf.batch_fetch_orders_and_swap(); } } @@ -611,7 +611,7 @@ namespace atomic_dex //! Mark systems - system_manager_.mark_system(); + system_manager_.mark_system(); //system_manager_.mark_system(); //! Disconnect signals @@ -621,10 +621,10 @@ namespace atomic_dex dispatcher_.sink().disconnect<&application::on_ticker_balance_updated_event>(*this); dispatcher_.sink().disconnect<&application::on_fiat_rate_updated>(*this); dispatcher_.sink().disconnect<&application::on_coin_fully_initialized_event>(*this); - dispatcher_.sink().disconnect<&application::on_mm2_initialized_event>(*this); + dispatcher_.sink().disconnect<&application::on_kdf_initialized_event>(*this); dispatcher_.sink().disconnect<&application::on_process_orders_and_swaps_finished_event>(*this); - m_event_actions[events_action::need_a_full_refresh_of_mm2] = true; + m_event_actions[events_action::need_a_full_refresh_of_kdf] = true; //! Resets wallet name. auto& wallet_manager = this->system_manager_.get_system(); @@ -645,7 +645,7 @@ namespace atomic_dex get_dispatcher().sink().connect<&application::on_ticker_balance_updated_event>(*this); get_dispatcher().sink().connect<&application::on_fiat_rate_updated>(*this); get_dispatcher().sink().connect<&application::on_coin_fully_initialized_event>(*this); - get_dispatcher().sink().connect<&application::on_mm2_initialized_event>(*this); + get_dispatcher().sink().connect<&application::on_kdf_initialized_event>(*this); get_dispatcher().sink().connect<&application::on_process_orders_and_swaps_finished_event>(*this); // get_dispatcher().sink().connect<&application::on_process_swaps_finished_event>(*this); } @@ -664,8 +664,8 @@ namespace atomic_dex { QString result; - mm2::recover_funds_of_swap_request request{.swap_uuid = uuid.toStdString()}; - auto res = get_mm2().get_mm2_client().rpc_recover_funds(std::move(request)); + kdf::recover_funds_of_swap_request request{.swap_uuid = uuid.toStdString()}; + auto res = get_kdf().get_kdf_client().rpc_recover_funds(std::move(request)); result = QString::fromStdString(res.raw_result); return result; @@ -793,7 +793,7 @@ namespace atomic_dex bool application::is_pin_cfg_enabled() const { - return get_mm2().is_pin_cfg_enabled(); + return get_kdf().is_pin_cfg_enabled(); } } // namespace atomic_dex @@ -804,7 +804,7 @@ namespace atomic_dex application::exit_handler() { SPDLOG_DEBUG("will quit app, prevent all threading event"); - this->system_manager_.mark_system(); + this->system_manager_.mark_system(); this->process_one_frame(); m_event_actions[events_action::about_to_exit_app] = true; } diff --git a/src/app/app.hpp b/src/app/app.hpp index 6ad76aafc7..e6d26b7fd1 100644 --- a/src/app/app.hpp +++ b/src/app/app.hpp @@ -45,7 +45,7 @@ #include "atomicdex/pages/qt.wallet.page.hpp" #include "atomicdex/services/exporter/exporter.service.hpp" #include "atomicdex/services/internet/internet.checker.service.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" #include "atomicdex/services/price/defi.stats.hpp" #include "atomicdex/services/price/global.provider.hpp" #include "atomicdex/services/update/update.checker.service.hpp" @@ -83,7 +83,7 @@ namespace atomic_dex enum events_action { - need_a_full_refresh_of_mm2 = 0, + need_a_full_refresh_of_kdf = 0, about_to_exit_app = 1, size = 2 }; @@ -117,11 +117,11 @@ namespace atomic_dex void on_ticker_balance_updated_event(const ticker_balance_updated&); void on_fiat_rate_updated(const fiat_rate_updated&); void on_coin_fully_initialized_event(const coin_fully_initialized&); - void on_mm2_initialized_event(const mm2_initialized&); + void on_kdf_initialized_event(const kdf_initialized&); void on_process_orders_and_swaps_finished_event(const process_swaps_and_orders_finished&); - mm2_service& get_mm2(); - [[nodiscard]] const mm2_service& get_mm2() const; + kdf_service& get_kdf(); + [[nodiscard]] const kdf_service& get_kdf() const; entt::dispatcher& get_dispatcher(); const entt::registry& get_registry() const; entt::registry& get_registry(); diff --git a/src/app/main.prerequisites.hpp b/src/app/main.prerequisites.hpp index d3e6921ca3..acd7574bb1 100644 --- a/src/app/main.prerequisites.hpp +++ b/src/app/main.prerequisites.hpp @@ -104,7 +104,7 @@ qt_message_handler(QtMsgType type, [[maybe_unused]] const QMessageLogContext& co static void signal_handler(int signal) { - SPDLOG_ERROR("sigabort received, cleaning mm2"); + SPDLOG_ERROR("sigabort received, cleaning kdf"); atomic_dex::kill_executable(atomic_dex::g_dex_api); #if defined(linux) || defined(__APPLE__) boost::stacktrace::safe_dump_to("./backtrace.dump"); @@ -158,7 +158,7 @@ init_sodium() static void clean_previous_run() { - SPDLOG_INFO("cleaning previous mm2 instance"); + SPDLOG_INFO("cleaning previous kdf instance"); atomic_dex::kill_executable(atomic_dex::g_dex_api); } diff --git a/src/core/atomicdex/api/mm2/address_format.cpp b/src/core/atomicdex/api/kdf/address_format.cpp similarity index 94% rename from src/core/atomicdex/api/mm2/address_format.cpp rename to src/core/atomicdex/api/kdf/address_format.cpp index d4320ed7d7..07338bb037 100644 --- a/src/core/atomicdex/api/mm2/address_format.cpp +++ b/src/core/atomicdex/api/kdf/address_format.cpp @@ -18,9 +18,9 @@ #include //! Project Headers -#include "atomicdex/api/mm2/address_format.hpp" +#include "atomicdex/api/kdf/address_format.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const address_format_t& req) @@ -42,4 +42,4 @@ namespace atomic_dex::mm2 } } -} // namespace atomic_dex::mm2 \ No newline at end of file +} // namespace atomic_dex::kdf \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/address_format.hpp b/src/core/atomicdex/api/kdf/address_format.hpp similarity index 98% rename from src/core/atomicdex/api/mm2/address_format.hpp rename to src/core/atomicdex/api/kdf/address_format.hpp index 7b68961d12..894ae0b4a9 100644 --- a/src/core/atomicdex/api/mm2/address_format.hpp +++ b/src/core/atomicdex/api/kdf/address_format.hpp @@ -19,7 +19,7 @@ #include #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct address_format_t { diff --git a/src/core/atomicdex/api/mm2/balance_info.cpp b/src/core/atomicdex/api/kdf/balance_info.cpp similarity index 74% rename from src/core/atomicdex/api/mm2/balance_info.cpp rename to src/core/atomicdex/api/kdf/balance_info.cpp index 00865a30f3..d300f6a1bc 100644 --- a/src/core/atomicdex/api/mm2/balance_info.cpp +++ b/src/core/atomicdex/api/kdf/balance_info.cpp @@ -1,8 +1,8 @@ #include -#include "atomicdex/api/mm2/balance_info.hpp" +#include "atomicdex/api/kdf/balance_info.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void from_json(const nlohmann::json& j, balance_info& in) { diff --git a/src/core/atomicdex/api/mm2/balance_info.hpp b/src/core/atomicdex/api/kdf/balance_info.hpp similarity index 90% rename from src/core/atomicdex/api/mm2/balance_info.hpp rename to src/core/atomicdex/api/kdf/balance_info.hpp index f40047c368..94f8961972 100644 --- a/src/core/atomicdex/api/mm2/balance_info.hpp +++ b/src/core/atomicdex/api/kdf/balance_info.hpp @@ -4,7 +4,7 @@ #include //> nlohmann::json -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct balance_info { diff --git a/src/core/atomicdex/api/mm2/balance_infos.cpp b/src/core/atomicdex/api/kdf/balance_infos.cpp similarity index 96% rename from src/core/atomicdex/api/mm2/balance_infos.cpp rename to src/core/atomicdex/api/kdf/balance_infos.cpp index 9140372b71..57893273b6 100644 --- a/src/core/atomicdex/api/mm2/balance_infos.cpp +++ b/src/core/atomicdex/api/kdf/balance_infos.cpp @@ -20,7 +20,7 @@ // Project Headers #include "balance_infos.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void from_json(const nlohmann::json& j, balance_infos& answer) @@ -28,4 +28,4 @@ namespace atomic_dex::mm2 answer.spendable = j.at("spendable").get(); answer.unspendable = j.at("unspendable").get(); } -} // namespace atomic_dex::mm2 \ No newline at end of file +} // namespace atomic_dex::kdf \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/balance_infos.hpp b/src/core/atomicdex/api/kdf/balance_infos.hpp similarity index 98% rename from src/core/atomicdex/api/mm2/balance_infos.hpp rename to src/core/atomicdex/api/kdf/balance_infos.hpp index eece30234c..8f4265221f 100644 --- a/src/core/atomicdex/api/mm2/balance_infos.hpp +++ b/src/core/atomicdex/api/kdf/balance_infos.hpp @@ -19,7 +19,7 @@ #include #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct balance_infos { diff --git a/src/core/atomicdex/api/kdf/fraction.cpp b/src/core/atomicdex/api/kdf/fraction.cpp new file mode 100644 index 0000000000..bd66de6882 --- /dev/null +++ b/src/core/atomicdex/api/kdf/fraction.cpp @@ -0,0 +1,12 @@ +#include + +#include "atomicdex/api/kdf/fraction.hpp" + +namespace atomic_dex::kdf +{ + void from_json(const nlohmann::json& j, kdf::fraction& fraction) + { + j.at("denom").get_to(fraction.denom); + j.at("numer").get_to(fraction.numer); + } +} // namespace atomic_dex::kdf \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/fraction.fwd.hpp b/src/core/atomicdex/api/kdf/fraction.fwd.hpp similarity index 59% rename from src/core/atomicdex/api/mm2/fraction.fwd.hpp rename to src/core/atomicdex/api/kdf/fraction.fwd.hpp index 8b0b7bb20c..1fed5af188 100644 --- a/src/core/atomicdex/api/mm2/fraction.fwd.hpp +++ b/src/core/atomicdex/api/kdf/fraction.fwd.hpp @@ -1,6 +1,6 @@ #pragma once -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct fraction; } \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/fraction.hpp b/src/core/atomicdex/api/kdf/fraction.hpp similarity index 69% rename from src/core/atomicdex/api/mm2/fraction.hpp rename to src/core/atomicdex/api/kdf/fraction.hpp index c197c8a478..af015bb93e 100644 --- a/src/core/atomicdex/api/mm2/fraction.hpp +++ b/src/core/atomicdex/api/kdf/fraction.hpp @@ -5,7 +5,7 @@ #include #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct fraction { @@ -13,5 +13,5 @@ namespace atomic_dex::mm2 std::string numer; }; - ENTT_API void from_json(const nlohmann::json& j, mm2::fraction& fraction); + ENTT_API void from_json(const nlohmann::json& j, kdf::fraction& fraction); } \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/generic.error.cpp b/src/core/atomicdex/api/kdf/generic.error.cpp similarity index 76% rename from src/core/atomicdex/api/mm2/generic.error.cpp rename to src/core/atomicdex/api/kdf/generic.error.cpp index 85943adcf6..24388c3bad 100644 --- a/src/core/atomicdex/api/mm2/generic.error.cpp +++ b/src/core/atomicdex/api/kdf/generic.error.cpp @@ -1,6 +1,6 @@ -#include "atomicdex/api/mm2/generic.error.hpp" +#include "atomicdex/api/kdf/generic.error.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void from_json(const nlohmann::json& j, generic_answer_error& res) { @@ -10,4 +10,4 @@ namespace atomic_dex::mm2 j.at("error_type").get_to(res.error_type); j.at("error_data").get_to(res.error_data); } -} // namespace atomic_dex::mm2 \ No newline at end of file +} // namespace atomic_dex::kdf \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/generic.error.hpp b/src/core/atomicdex/api/kdf/generic.error.hpp similarity index 87% rename from src/core/atomicdex/api/mm2/generic.error.hpp rename to src/core/atomicdex/api/kdf/generic.error.hpp index 7be792aae5..1e03e42d2f 100644 --- a/src/core/atomicdex/api/mm2/generic.error.hpp +++ b/src/core/atomicdex/api/kdf/generic.error.hpp @@ -6,7 +6,7 @@ //! Deps #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct generic_answer_error { @@ -18,4 +18,4 @@ namespace atomic_dex::mm2 }; void from_json(const nlohmann::json& j, generic_answer_error& res); -} // namespace atomic_dex::mm2 \ No newline at end of file +} // namespace atomic_dex::kdf \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/generics.cpp b/src/core/atomicdex/api/kdf/generics.cpp similarity index 80% rename from src/core/atomicdex/api/mm2/generics.cpp rename to src/core/atomicdex/api/kdf/generics.cpp index a8a0c0ddb4..e9e03bc34a 100644 --- a/src/core/atomicdex/api/mm2/generics.cpp +++ b/src/core/atomicdex/api/kdf/generics.cpp @@ -18,19 +18,19 @@ #include //! Project Headers -#include "atomicdex/api/mm2/generics.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.buy.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.convertaddress.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.disable_coin.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.max_taker_vol.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.min_trading_vol.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.recover_funds_of_swap.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.sell.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.validateaddress.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.bestorders.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.trade_preimage.hpp" +#include "atomicdex/api/kdf/generics.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.buy.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.convertaddress.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.disable_coin.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.max_taker_vol.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.min_trading_vol.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.recover_funds_of_swap.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.sell.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.validateaddress.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.bestorders.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.trade_preimage.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { template void @@ -55,4 +55,4 @@ namespace atomic_dex::mm2 template void extract_rpc_json_answer(const nlohmann::json& j, validate_address_answer& answer); template void extract_rpc_json_answer(const nlohmann::json& j, convert_address_answer& answer); template void extract_rpc_json_answer(const nlohmann::json& j, recover_funds_of_swap_answer& answer); -} // namespace atomic_dex::mm2 \ No newline at end of file +} // namespace atomic_dex::kdf \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/generics.hpp b/src/core/atomicdex/api/kdf/generics.hpp similarity index 98% rename from src/core/atomicdex/api/mm2/generics.hpp rename to src/core/atomicdex/api/kdf/generics.hpp index 333180d538..937b8dc1eb 100644 --- a/src/core/atomicdex/api/mm2/generics.hpp +++ b/src/core/atomicdex/api/kdf/generics.hpp @@ -18,7 +18,7 @@ #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { template void diff --git a/src/core/atomicdex/api/mm2/mm2.client.cpp b/src/core/atomicdex/api/kdf/kdf.client.cpp similarity index 78% rename from src/core/atomicdex/api/mm2/mm2.client.cpp rename to src/core/atomicdex/api/kdf/kdf.client.cpp index 3be3af8d99..8fc2677871 100644 --- a/src/core/atomicdex/api/mm2/mm2.client.cpp +++ b/src/core/atomicdex/api/kdf/kdf.client.cpp @@ -18,22 +18,22 @@ #include -#include "mm2.hpp" -#include "atomicdex/api/mm2/rpc.hpp" -#include "mm2.client.hpp" +#include "kdf.hpp" +#include "atomicdex/api/kdf/rpc.hpp" +#include "kdf.client.hpp" #include "rpc.tx.history.hpp" #include "atomicdex/constants/dex.constants.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.my_tx_history.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.get_public_key.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.my_tx_history.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.orderbook.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.bestorders.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.enable_tendermint_token.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.enable_tendermint_with_assets.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.enable_erc20.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.enable_eth_with_tokens.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.enable_slp_rpc.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.my_tx_history.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.get_public_key.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.my_tx_history.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.orderbook.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.bestorders.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_token.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.enable_eth_with_tokens.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.enable_slp_rpc.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp" namespace { @@ -51,11 +51,11 @@ namespace return {FROM_STD_STR(atomic_dex::g_dex_rpc), cfg}; } - template + template web::http::http_request make_request(typename Rpc::expected_request_type data_req = {}) { web::http::http_request request; - nlohmann::json json_req = {{"method", Rpc::endpoint}, {"userpass", atomic_dex::mm2::get_rpc_password()}}; + nlohmann::json json_req = {{"method", Rpc::endpoint}, {"userpass", atomic_dex::kdf::get_rpc_password()}}; nlohmann::json json_data; nlohmann::to_json(json_data, data_req); @@ -74,7 +74,7 @@ namespace return request; } - template + template Rpc process_rpc_answer(const web::http::http_response& answer) { std::string body = TO_STD_STR(answer.extract_string(true).get()); @@ -114,10 +114,10 @@ namespace } } // namespace -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { template - RpcReturnType mm2_client::rpc_process_answer(const web::http::http_response& resp, const std::string& rpc_command) + RpcReturnType kdf_client::rpc_process_answer(const web::http::http_response& resp, const std::string& rpc_command) { std::string body = TO_STD_STR(resp.extract_string(true).get()); SPDLOG_INFO("resp code for rpc_command {} is {}", rpc_command, resp.status_code()); @@ -170,7 +170,7 @@ namespace atomic_dex::mm2 } pplx::task - mm2_client::async_rpc_batch_standalone(nlohmann::json batch_array) + kdf_client::async_rpc_batch_standalone(nlohmann::json batch_array) { web::http::http_request request; request.set_method(web::http::methods::POST); @@ -180,27 +180,27 @@ namespace atomic_dex::mm2 } template - void mm2_client::process_rpc_async(const std::function& on_rpc_processed) + void kdf_client::process_rpc_async(const std::function& on_rpc_processed) { using request_type = typename Rpc::expected_request_type; process_rpc_async(request_type{}, on_rpc_processed); } - // template void mm2_client::process_rpc_async(const std::function&); - template void mm2_client::process_rpc_async(const std::function&); - template void mm2_client::process_rpc_async(const std::function&); - template void mm2_client::process_rpc_async(const std::function&); - template void mm2_client::process_rpc_async(const std::function&); - template void mm2_client::process_rpc_async(const std::function&); - template void mm2_client::process_rpc_async(const std::function&); - template void mm2_client::process_rpc_async(const std::function&); - template void mm2_client::process_rpc_async(const std::function&); - template void mm2_client::process_rpc_async(const std::function&); - template void mm2_client::process_rpc_async(const std::function&); - template void mm2_client::process_rpc_async(const std::function&); + // template void kdf_client::process_rpc_async(const std::function&); + template void kdf_client::process_rpc_async(const std::function&); + template void kdf_client::process_rpc_async(const std::function&); + template void kdf_client::process_rpc_async(const std::function&); + template void kdf_client::process_rpc_async(const std::function&); + template void kdf_client::process_rpc_async(const std::function&); + template void kdf_client::process_rpc_async(const std::function&); + template void kdf_client::process_rpc_async(const std::function&); + template void kdf_client::process_rpc_async(const std::function&); + template void kdf_client::process_rpc_async(const std::function&); + template void kdf_client::process_rpc_async(const std::function&); + template void kdf_client::process_rpc_async(const std::function&); - template - void mm2_client::process_rpc_async(typename Rpc::expected_request_type request, const std::function& on_rpc_processed) + template + void kdf_client::process_rpc_async(typename Rpc::expected_request_type request, const std::function& on_rpc_processed) { auto http_request = make_request(request); generate_client() @@ -222,20 +222,20 @@ namespace atomic_dex::mm2 } void - mm2_client::stop() + kdf_client::stop() { m_token_source.cancel(); } template TAnswer - mm2_client::process_rpc(TRequest&& request, std::string rpc_command, bool is_v2) + kdf_client::process_rpc(TRequest&& request, std::string rpc_command, bool is_v2) { SPDLOG_DEBUG("Processing rpc call: {}", rpc_command); - nlohmann::json json_data = mm2::template_request(rpc_command, is_v2); + nlohmann::json json_data = kdf::template_request(rpc_command, is_v2); - mm2::to_json(json_data, request); + kdf::to_json(json_data, request); auto json_copy = json_data; json_copy["userpass"] = "*******"; @@ -249,24 +249,24 @@ namespace atomic_dex::mm2 } t_enable_z_coin_cancel_answer - mm2_client::rpc_enable_z_coin_cancel(t_enable_z_coin_cancel_request&& request) + kdf_client::rpc_enable_z_coin_cancel(t_enable_z_coin_cancel_request&& request) { return process_rpc(std::forward(request), "task::enable_z_coin::cancel", true); } t_disable_coin_answer - mm2_client::rpc_disable_coin(t_disable_coin_request&& request) + kdf_client::rpc_disable_coin(t_disable_coin_request&& request) { return process_rpc(std::forward(request), "disable_coin"); } t_recover_funds_of_swap_answer - mm2_client::rpc_recover_funds(t_recover_funds_of_swap_request&& request) + kdf_client::rpc_recover_funds(t_recover_funds_of_swap_request&& request) { return process_rpc( std::forward(request), "recover_funds_of_swap"); } } // namespace atomic_dex -template atomic_dex::mm2::tx_history_answer atomic_dex::mm2::mm2_client::rpc_process_answer(const web::http::http_response& resp, const std::string& rpc_command); -template atomic_dex::mm2::disable_coin_answer atomic_dex::mm2::mm2_client::rpc_process_answer(const web::http::http_response& resp, const std::string& rpc_command); +template atomic_dex::kdf::tx_history_answer atomic_dex::kdf::kdf_client::rpc_process_answer(const web::http::http_response& resp, const std::string& rpc_command); +template atomic_dex::kdf::disable_coin_answer atomic_dex::kdf::kdf_client::rpc_process_answer(const web::http::http_response& resp, const std::string& rpc_command); diff --git a/src/core/atomicdex/api/mm2/mm2.client.hpp b/src/core/atomicdex/api/kdf/kdf.client.hpp similarity index 79% rename from src/core/atomicdex/api/mm2/mm2.client.hpp rename to src/core/atomicdex/api/kdf/kdf.client.hpp index 13421d986d..1ea8a05074 100644 --- a/src/core/atomicdex/api/mm2/mm2.client.hpp +++ b/src/core/atomicdex/api/kdf/kdf.client.hpp @@ -8,20 +8,20 @@ // Project Headers #include "atomicdex/utilities/cpprestsdk.utilities.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.disable_coin.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.recover_funds_of_swap.hpp" -#include "atomicdex/api/mm2/rpc.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.cancel.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.disable_coin.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.recover_funds_of_swap.hpp" +#include "atomicdex/api/kdf/rpc.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.cancel.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { - class ENTT_API mm2_client + class ENTT_API kdf_client { pplx::cancellation_token_source m_token_source; public: - mm2_client() = default; - ~mm2_client() = default; + kdf_client() = default; + ~kdf_client() = default; //! Create the client void stop(); diff --git a/src/core/atomicdex/api/mm2/mm2.constants.hpp b/src/core/atomicdex/api/kdf/kdf.constants.hpp similarity index 100% rename from src/core/atomicdex/api/mm2/mm2.constants.hpp rename to src/core/atomicdex/api/kdf/kdf.constants.hpp diff --git a/src/core/atomicdex/api/mm2/mm2.cpp b/src/core/atomicdex/api/kdf/kdf.cpp similarity index 95% rename from src/core/atomicdex/api/mm2/mm2.cpp rename to src/core/atomicdex/api/kdf/kdf.cpp index 794fadb2c8..25a73d6b87 100644 --- a/src/core/atomicdex/api/mm2/mm2.cpp +++ b/src/core/atomicdex/api/kdf/kdf.cpp @@ -18,16 +18,16 @@ #include //! Project Headers -#include "atomicdex/api/mm2/mm2.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.convertaddress.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.min_trading_vol.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.recover_funds_of_swap.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.validateaddress.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.bestorders.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.orderbook.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.task.withdraw.status.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.trade_preimage.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.withdraw.hpp" +#include "atomicdex/api/kdf/kdf.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.convertaddress.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.min_trading_vol.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.recover_funds_of_swap.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.validateaddress.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.bestorders.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.orderbook.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.task.withdraw.status.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.trade_preimage.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp" #include "atomicdex/pages/qt.settings.page.hpp" #include "atomicdex/services/price/global.provider.hpp" #include "atomicdex/utilities/global.utilities.hpp" @@ -168,7 +168,7 @@ namespace } } // namespace -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const send_raw_transaction_request& cfg) @@ -739,23 +739,23 @@ namespace atomic_dex::mm2 return answer; } - template mm2::withdraw_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); - template mm2::withdraw_status_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); - template mm2::my_orders_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); - template mm2::trade_fee_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); - template mm2::max_taker_vol_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); - template mm2::min_volume_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); - template mm2::my_recent_swaps_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); - template mm2::active_swaps_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); - template mm2::show_priv_key_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); - template mm2::trade_preimage_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); - template mm2::validate_address_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); - template mm2::convert_address_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); - template mm2::recover_funds_of_swap_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); + template kdf::withdraw_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); + template kdf::withdraw_status_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); + template kdf::my_orders_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); + template kdf::trade_fee_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); + template kdf::max_taker_vol_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); + template kdf::min_volume_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); + template kdf::my_recent_swaps_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); + template kdf::active_swaps_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); + template kdf::show_priv_key_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); + template kdf::trade_preimage_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); + template kdf::validate_address_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); + template kdf::convert_address_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); + template kdf::recover_funds_of_swap_answer rpc_process_answer_batch(nlohmann::json& json_answer, const std::string& rpc_command); void set_system_manager(ag::ecs::system_manager& system_manager) { g_system_mgr = std::addressof(system_manager); } -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf diff --git a/src/core/atomicdex/api/mm2/mm2.error.code.cpp b/src/core/atomicdex/api/kdf/kdf.error.code.cpp similarity index 94% rename from src/core/atomicdex/api/mm2/mm2.error.code.cpp rename to src/core/atomicdex/api/kdf/kdf.error.code.cpp index f77edf559c..f556758909 100644 --- a/src/core/atomicdex/api/mm2/mm2.error.code.cpp +++ b/src/core/atomicdex/api/kdf/kdf.error.code.cpp @@ -15,11 +15,11 @@ ******************************************************************************/ //! Project Headers -#include "mm2.error.code.hpp" +#include "kdf.error.code.hpp" namespace { - class mm2_error_category_impl final : public std::error_category + class kdf_error_category_impl final : public std::error_category { public: [[nodiscard]] const char* name() const noexcept final; @@ -28,13 +28,13 @@ namespace }; const char* - mm2_error_category_impl::name() const noexcept + kdf_error_category_impl::name() const noexcept { - return "mm2"; + return "kdf"; } std::string - mm2_error_category_impl::message(int code) const + kdf_error_category_impl::message(int code) const { switch (static_cast(code)) { @@ -92,7 +92,7 @@ namespace return ""; } - const mm2_error_category_impl g_err_categ{}; + const kdf_error_category_impl g_err_categ{}; } // namespace std::error_code diff --git a/src/core/atomicdex/api/mm2/mm2.error.code.hpp b/src/core/atomicdex/api/kdf/kdf.error.code.hpp similarity index 98% rename from src/core/atomicdex/api/mm2/mm2.error.code.hpp rename to src/core/atomicdex/api/kdf/kdf.error.code.hpp index a21501285a..bfad61b77f 100644 --- a/src/core/atomicdex/api/mm2/mm2.error.code.hpp +++ b/src/core/atomicdex/api/kdf/kdf.error.code.hpp @@ -55,5 +55,5 @@ std::error_code make_error_code(dextop_error error) ; namespace atomic_dex { - using t_mm2_ec = std::error_code; + using t_kdf_ec = std::error_code; } // namespace atomic_dex diff --git a/src/core/atomicdex/api/mm2/mm2.hpp b/src/core/atomicdex/api/kdf/kdf.hpp similarity index 92% rename from src/core/atomicdex/api/mm2/mm2.hpp rename to src/core/atomicdex/api/kdf/kdf.hpp index 2a0efe3c65..e29c410d02 100644 --- a/src/core/atomicdex/api/mm2/mm2.hpp +++ b/src/core/atomicdex/api/kdf/kdf.hpp @@ -25,14 +25,14 @@ //! Project Headers #include "atomicdex/config/coins.cfg.hpp" -#include "atomicdex/api/mm2/mm2.constants.hpp" +#include "atomicdex/api/kdf/kdf.constants.hpp" #include "atomicdex/constants/qt.coins.enums.hpp" #include "atomicdex/data/dex/qt.orders.data.hpp" #include "atomicdex/utilities/cpprestsdk.utilities.hpp" namespace ag = antara::gaming; -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { inline constexpr const char* g_etherscan_proxy_endpoint = "https://etherscan-proxy.komodo.earth/"; inline std::unique_ptr g_etherscan_proxy_http_client{ @@ -79,7 +79,7 @@ namespace atomic_dex::mm2 void from_json(const nlohmann::json& j, send_raw_transaction_answer& answer); - send_raw_transaction_answer rpc_send_raw_transaction(send_raw_transaction_request&& request, std::shared_ptr mm2_client); + send_raw_transaction_answer rpc_send_raw_transaction(send_raw_transaction_request&& request, std::shared_ptr kdf_client); struct cancel_order_request { @@ -226,7 +226,7 @@ namespace atomic_dex::mm2 int rpc_result_code; }; - // kmd_rewards_info_answer rpc_kmd_rewards_info(std::shared_ptr mm2_client); + // kmd_rewards_info_answer rpc_kmd_rewards_info(std::shared_ptr kdf_client); kmd_rewards_info_answer process_kmd_rewards_answer(nlohmann::json result); template @@ -239,16 +239,16 @@ namespace atomic_dex::mm2 void set_rpc_password(std::string rpc_password) ; const std::string& get_rpc_password() ; void set_system_manager(ag::ecs::system_manager& system_manager); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_my_orders_answer = mm2::my_orders_answer; - using t_broadcast_request = mm2::send_raw_transaction_request; - using t_my_recent_swaps_answer = mm2::my_recent_swaps_answer; - using t_my_recent_swaps_request = mm2::my_recent_swaps_request; - using t_active_swaps_request = mm2::active_swaps_request; - using t_active_swaps_answer = mm2::active_swaps_answer; - using t_get_trade_fee_request = mm2::trade_fee_request; - using t_get_trade_fee_answer = mm2::trade_fee_answer; + using t_my_orders_answer = kdf::my_orders_answer; + using t_broadcast_request = kdf::send_raw_transaction_request; + using t_my_recent_swaps_answer = kdf::my_recent_swaps_answer; + using t_my_recent_swaps_request = kdf::my_recent_swaps_request; + using t_active_swaps_request = kdf::active_swaps_request; + using t_active_swaps_answer = kdf::active_swaps_answer; + using t_get_trade_fee_request = kdf::trade_fee_request; + using t_get_trade_fee_answer = kdf::trade_fee_answer; } // namespace atomic_dex diff --git a/src/core/atomicdex/api/mm2/orderbook.order.contents.cpp b/src/core/atomicdex/api/kdf/orderbook.order.contents.cpp similarity index 96% rename from src/core/atomicdex/api/mm2/orderbook.order.contents.cpp rename to src/core/atomicdex/api/kdf/orderbook.order.contents.cpp index 388b67bb24..4ab24fc89b 100644 --- a/src/core/atomicdex/api/mm2/orderbook.order.contents.cpp +++ b/src/core/atomicdex/api/kdf/orderbook.order.contents.cpp @@ -19,13 +19,13 @@ #include //! Project Headers -#include "atomicdex/api/mm2/orderbook.order.contents.hpp" +#include "atomicdex/api/kdf/orderbook.order.contents.hpp" #include "atomicdex/utilities/global.utilities.hpp" #include "atomicdex/pages/qt.trading.page.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" #include "atomicdex/services/price/orderbook.scanner.service.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void from_json(const nlohmann::json& j, order_contents& contents) @@ -89,4 +89,4 @@ namespace atomic_dex::mm2 ss << "rel_min_volume: " << rel_min_volume << " "; return ss.str(); } -} // namespace atomic_dex::mm2 \ No newline at end of file +} // namespace atomic_dex::kdf \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/orderbook.order.contents.hpp b/src/core/atomicdex/api/kdf/orderbook.order.contents.hpp similarity index 96% rename from src/core/atomicdex/api/mm2/orderbook.order.contents.hpp rename to src/core/atomicdex/api/kdf/orderbook.order.contents.hpp index b4cbc7798e..054248b827 100644 --- a/src/core/atomicdex/api/mm2/orderbook.order.contents.hpp +++ b/src/core/atomicdex/api/kdf/orderbook.order.contents.hpp @@ -21,7 +21,7 @@ //! Deps #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct order_contents { @@ -61,10 +61,10 @@ namespace atomic_dex::mm2 }; void from_json(const nlohmann::json& j, order_contents& contents); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_order_contents = mm2::order_contents; + using t_order_contents = kdf::order_contents; using t_orders_contents = std::vector; } // namespace atomic_dex diff --git a/src/core/atomicdex/api/mm2/paging_options.cpp b/src/core/atomicdex/api/kdf/paging_options.cpp similarity index 81% rename from src/core/atomicdex/api/mm2/paging_options.cpp rename to src/core/atomicdex/api/kdf/paging_options.cpp index 2d785b004c..783188e29e 100644 --- a/src/core/atomicdex/api/mm2/paging_options.cpp +++ b/src/core/atomicdex/api/kdf/paging_options.cpp @@ -3,9 +3,9 @@ #include -#include "atomicdex/api/mm2/paging_options.hpp" +#include "atomicdex/api/kdf/paging_options.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const paging_options_t& in) { diff --git a/src/core/atomicdex/api/mm2/paging_options.hpp b/src/core/atomicdex/api/kdf/paging_options.hpp similarity index 92% rename from src/core/atomicdex/api/mm2/paging_options.hpp rename to src/core/atomicdex/api/kdf/paging_options.hpp index 851ce650f7..640cfbd767 100644 --- a/src/core/atomicdex/api/mm2/paging_options.hpp +++ b/src/core/atomicdex/api/kdf/paging_options.hpp @@ -7,7 +7,7 @@ #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct paging_options_t { diff --git a/src/core/atomicdex/api/mm2/rpc.cpp b/src/core/atomicdex/api/kdf/rpc.cpp similarity index 85% rename from src/core/atomicdex/api/mm2/rpc.cpp rename to src/core/atomicdex/api/kdf/rpc.cpp index a5a2786a78..028b0d479c 100644 --- a/src/core/atomicdex/api/mm2/rpc.cpp +++ b/src/core/atomicdex/api/kdf/rpc.cpp @@ -1,8 +1,8 @@ #include -#include "atomicdex/api/mm2/rpc.hpp" +#include "atomicdex/api/kdf/rpc.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void from_json(const nlohmann::json& j, rpc_basic_error_type& in) { diff --git a/src/core/atomicdex/api/mm2/rpc.hpp b/src/core/atomicdex/api/kdf/rpc.hpp similarity index 98% rename from src/core/atomicdex/api/mm2/rpc.hpp rename to src/core/atomicdex/api/kdf/rpc.hpp index ae41949fec..db9bf77687 100644 --- a/src/core/atomicdex/api/mm2/rpc.hpp +++ b/src/core/atomicdex/api/kdf/rpc.hpp @@ -22,7 +22,7 @@ #include "../api.call.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { template concept rpc = requires(Rpc rpc) diff --git a/src/core/atomicdex/api/mm2/rpc.tx.history.cpp b/src/core/atomicdex/api/kdf/rpc.tx.history.cpp similarity index 98% rename from src/core/atomicdex/api/mm2/rpc.tx.history.cpp rename to src/core/atomicdex/api/kdf/rpc.tx.history.cpp index 246eb0750f..2d554b44f7 100644 --- a/src/core/atomicdex/api/mm2/rpc.tx.history.cpp +++ b/src/core/atomicdex/api/kdf/rpc.tx.history.cpp @@ -4,7 +4,7 @@ //! Project Headers #include "rpc.tx.history.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const tx_history_request& cfg) { @@ -105,4 +105,4 @@ namespace atomic_dex::mm2 answer.result = j.at("result").get(); } } -} // namespace atomic_dex::mm2 \ No newline at end of file +} // namespace atomic_dex::kdf \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc.tx.history.hpp b/src/core/atomicdex/api/kdf/rpc.tx.history.hpp similarity index 92% rename from src/core/atomicdex/api/mm2/rpc.tx.history.hpp rename to src/core/atomicdex/api/kdf/rpc.tx.history.hpp index a761b2d954..4f8d1cb072 100644 --- a/src/core/atomicdex/api/mm2/rpc.tx.history.hpp +++ b/src/core/atomicdex/api/kdf/rpc.tx.history.hpp @@ -5,10 +5,10 @@ #include -#include "atomicdex/api/mm2/transaction.data.hpp" -#include "atomicdex/api/mm2/paging_options.hpp" +#include "atomicdex/api/kdf/transaction.data.hpp" +#include "atomicdex/api/kdf/paging_options.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct tx_history_request { @@ -80,9 +80,9 @@ namespace atomic_dex::mm2 }; void from_json(const nlohmann::json& j, tx_history_answer& answer); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_tx_history_request = mm2::tx_history_request; + using t_tx_history_request = kdf::tx_history_request; } \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.buy.cpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.buy.cpp similarity index 95% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.buy.cpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.buy.cpp index 00f1680723..00475f3a42 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.buy.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.buy.cpp @@ -18,10 +18,10 @@ #include //! Project Headers -#include "atomicdex/api/mm2/generics.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.buy.hpp" +#include "atomicdex/api/kdf/generics.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.buy.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void from_json(const nlohmann::json& j, buy_answer_success& contents) @@ -79,4 +79,4 @@ namespace atomic_dex::mm2 j["order_type"] = request.order_type.value(); } } -} // namespace atomic_dex::mm2 \ No newline at end of file +} // namespace atomic_dex::kdf \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.buy.hpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.buy.hpp similarity index 91% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.buy.hpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.buy.hpp index 8ad547d304..e6a5083691 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.buy.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.buy.hpp @@ -24,9 +24,9 @@ #include //! Project Header -#include +#include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct buy_request { @@ -66,11 +66,11 @@ namespace atomic_dex::mm2 }; void from_json(const nlohmann::json& j, buy_answer& answer); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_buy_request = mm2::buy_request; - using t_buy_answer = mm2::buy_answer; - using t_buy_answer_success = mm2::buy_answer_success; + using t_buy_request = kdf::buy_request; + using t_buy_answer = kdf::buy_answer; + using t_buy_answer_success = kdf::buy_answer_success; } // namespace atomic_dex \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.convertaddress.cpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.convertaddress.cpp similarity index 80% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.convertaddress.cpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.convertaddress.cpp index 333a76b46c..a50afb55c1 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.convertaddress.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.convertaddress.cpp @@ -6,10 +6,10 @@ #include //! Project Headers -#include "atomicdex/api/mm2/rpc_v1/rpc.convertaddress.hpp" -#include "atomicdex/api/mm2/generics.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.convertaddress.hpp" +#include "atomicdex/api/kdf/generics.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const convert_address_request& req) @@ -30,4 +30,4 @@ namespace atomic_dex::mm2 { extract_rpc_json_answer(j, answer); } -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.convertaddress.hpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.convertaddress.hpp similarity index 80% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.convertaddress.hpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.convertaddress.hpp index 02f1553000..da05a2ed63 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.convertaddress.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.convertaddress.hpp @@ -6,7 +6,7 @@ //! Deps #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct convert_address_request { @@ -33,11 +33,11 @@ namespace atomic_dex::mm2 }; void from_json(const nlohmann::json& j, convert_address_answer& answer); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_convert_address_request = mm2::convert_address_request; - using t_convert_address_answer = mm2::convert_address_answer; - using t_convert_address_answer_success = mm2::convert_address_answer_success; + using t_convert_address_request = kdf::convert_address_request; + using t_convert_address_answer = kdf::convert_address_answer; + using t_convert_address_answer_success = kdf::convert_address_answer_success; } // namespace atomic_dex \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.disable_coin.cpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.disable_coin.cpp similarity index 77% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.disable_coin.cpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.disable_coin.cpp index 8de2611550..d3a3b123ed 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.disable_coin.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.disable_coin.cpp @@ -5,10 +5,10 @@ #include //! -#include "atomicdex/api/mm2/generics.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.disable_coin.hpp" +#include "atomicdex/api/kdf/generics.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.disable_coin.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { //! Serialization void @@ -29,4 +29,4 @@ namespace atomic_dex::mm2 { extract_rpc_json_answer(j, resp); } -} // namespace atomic_dex::mm2 \ No newline at end of file +} // namespace atomic_dex::kdf \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.disable_coin.hpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.disable_coin.hpp similarity index 81% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.disable_coin.hpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.disable_coin.hpp index 10159e9b77..8a07b47df2 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.disable_coin.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.disable_coin.hpp @@ -6,7 +6,7 @@ //! JSON FWD #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct disable_coin_request { @@ -31,10 +31,10 @@ namespace atomic_dex::mm2 }; void from_json(const nlohmann::json& j, disable_coin_answer& resp); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_disable_coin_request = mm2::disable_coin_request; - using t_disable_coin_answer = mm2::disable_coin_answer; + using t_disable_coin_request = kdf::disable_coin_request; + using t_disable_coin_answer = kdf::disable_coin_answer; } diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.electrum.cpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.electrum.cpp similarity index 96% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.electrum.cpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.electrum.cpp index f08fb1bb6f..9b6d678da0 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.electrum.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.electrum.cpp @@ -18,10 +18,10 @@ #include //! Project Deps -#include "atomicdex/api/mm2/rpc_v1/rpc.electrum.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.electrum.hpp" //! Implementation RPC [electrum] -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { //! Serialization void @@ -70,4 +70,4 @@ namespace atomic_dex::mm2 j.at("balance").get_to(cfg.balance); j.at("result").get_to(cfg.result); } -} // namespace atomic_dex::mm2 \ No newline at end of file +} // namespace atomic_dex::kdf \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.electrum.hpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.electrum.hpp similarity index 92% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.electrum.hpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.electrum.hpp index c3d545c57a..1a12c2ca42 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.electrum.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.electrum.hpp @@ -22,9 +22,9 @@ //! Project Headers #include "atomicdex/config/electrum.cfg.hpp" #include "atomicdex/constants/qt.coins.enums.hpp" -#include "atomicdex/api/mm2/address_format.hpp" +#include "atomicdex/api/kdf/address_format.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct electrum_request { @@ -53,10 +53,10 @@ namespace atomic_dex::mm2 void to_json(nlohmann::json& j, const electrum_request& cfg); void from_json(const nlohmann::json& j, electrum_answer& answer); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_electrum_request = mm2::electrum_request; - using t_electrum_answer = mm2::electrum_answer; + using t_electrum_request = kdf::electrum_request; + using t_electrum_answer = kdf::electrum_answer; } // namespace atomic_dex \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.enable.cpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.enable.cpp similarity index 94% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.enable.cpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.enable.cpp index 83ee67f33e..16ea536dc8 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.enable.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.enable.cpp @@ -18,10 +18,10 @@ #include //! Project Headers -#include "atomicdex/api/mm2/rpc_v1/rpc.enable.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.enable.hpp" //! Implementation RPC [enable] -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { //! Serialization void @@ -57,9 +57,9 @@ namespace atomic_dex::mm2 { j["gas_station_decimals"] = cfg.matic_gas_station_decimals.value(); } - if (cfg.mm2.has_value()) + if (cfg.kdf.has_value()) { - j["mm2"] = cfg.mm2.value(); + j["kdf"] = cfg.kdf.value(); } } default: @@ -84,4 +84,4 @@ namespace atomic_dex::mm2 j.at("result").get_to(cfg.result); // SPDLOG_INFO("balance for {} is {}", cfg.address, cfg.balance); } -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.enable.hpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.enable.hpp similarity index 92% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.enable.hpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.enable.hpp index 4f4bbafeb2..cfdca87eae 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.enable.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.enable.hpp @@ -23,7 +23,7 @@ //! Project Headers #include "atomicdex/constants/qt.coins.enums.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { //! Only for erc 20 struct enable_request @@ -35,7 +35,7 @@ namespace atomic_dex::mm2 const std::string swap_contract_address; std::optional fallback_swap_contract{std::nullopt}; std::optional matic_gas_station_decimals{9}; - std::optional mm2{1}; + std::optional kdf{1}; std::optional gas_station_url{std::nullopt}; std::optional matic_gas_station_url{std::nullopt}; std::optional testnet_matic_gas_station_url{std::nullopt}; @@ -55,10 +55,10 @@ namespace atomic_dex::mm2 }; void from_json(const nlohmann::json& j, const enable_answer& cfg); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_enable_request = mm2::enable_request; - using t_enable_answer = mm2::enable_answer; + using t_enable_request = kdf::enable_request; + using t_enable_answer = kdf::enable_answer; } // namespace atomic_dex diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.max_taker_vol.cpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.max_taker_vol.cpp similarity index 94% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.max_taker_vol.cpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.max_taker_vol.cpp index d9de7d5700..19fda288e7 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.max_taker_vol.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.max_taker_vol.cpp @@ -18,12 +18,12 @@ #include //! Project Headers -#include "atomicdex/api/mm2/generics.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.max_taker_vol.hpp" +#include "atomicdex/api/kdf/generics.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.max_taker_vol.hpp" #include "atomicdex/utilities/global.utilities.hpp" //! Implementation RPC [max_taker_vol] -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { //! Serialization void @@ -64,4 +64,4 @@ namespace atomic_dex::mm2 answer.result.value().coin = j.at("coin").get(); } } -} // namespace atomic_dex::mm2 \ No newline at end of file +} // namespace atomic_dex::kdf \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.max_taker_vol.hpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.max_taker_vol.hpp similarity index 89% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.max_taker_vol.hpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.max_taker_vol.hpp index 14bf04af54..ee772d4e0b 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.max_taker_vol.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.max_taker_vol.hpp @@ -23,7 +23,7 @@ //! Deps #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct max_taker_vol_request { @@ -52,11 +52,11 @@ namespace atomic_dex::mm2 }; void from_json(const nlohmann::json& j, max_taker_vol_answer& answer); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_max_taker_vol_request = mm2::max_taker_vol_request; - using t_max_taker_vol_answer = mm2::max_taker_vol_answer; - using t_max_taker_vol_answer_success = mm2::max_taker_vol_answer_success; + using t_max_taker_vol_request = kdf::max_taker_vol_request; + using t_max_taker_vol_answer = kdf::max_taker_vol_answer; + using t_max_taker_vol_answer_success = kdf::max_taker_vol_answer_success; } // namespace atomic_dex \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.min_trading_vol.cpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.min_trading_vol.cpp similarity index 79% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.min_trading_vol.cpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.min_trading_vol.cpp index c26141fc40..0b4d5aff43 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.min_trading_vol.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.min_trading_vol.cpp @@ -2,10 +2,10 @@ #include //! Project Headers -#include "atomicdex/api/mm2/generics.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.min_trading_vol.hpp" +#include "atomicdex/api/kdf/generics.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.min_trading_vol.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const min_volume_request& cfg) @@ -27,4 +27,4 @@ namespace atomic_dex::mm2 { extract_rpc_json_answer(j, answer); } -} // namespace atomic_dex::mm2 \ No newline at end of file +} // namespace atomic_dex::kdf \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.min_trading_vol.hpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.min_trading_vol.hpp similarity index 74% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.min_trading_vol.hpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.min_trading_vol.hpp index 1cb5fd8a45..3454726ff2 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.min_trading_vol.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.min_trading_vol.hpp @@ -11,9 +11,9 @@ //! Deps #include -#include "atomicdex/api/mm2/rpc_v1/rpc.min_trading_vol.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.min_trading_vol.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct min_volume_request { @@ -39,11 +39,11 @@ namespace atomic_dex::mm2 }; void from_json(const nlohmann::json& j, min_volume_answer& answer); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_min_volume_request = mm2::min_volume_request; - using t_min_volume_answer = mm2::min_volume_answer; - using t_min_volume_answer_success = mm2::min_volume_answer_success; + using t_min_volume_request = kdf::min_volume_request; + using t_min_volume_answer = kdf::min_volume_answer; + using t_min_volume_answer_success = kdf::min_volume_answer_success; } // namespace atomic_dex \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.my_balance.cpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.my_balance.cpp similarity index 93% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.my_balance.cpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.my_balance.cpp index ad79aad144..7c7574975d 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.my_balance.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.my_balance.cpp @@ -18,10 +18,10 @@ #include //! Project Headers -#include "atomicdex/api/mm2/rpc_v1/rpc.my_balance.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.my_balance.hpp" #include "atomicdex/utilities/global.utilities.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const balance_request& cfg) @@ -37,4 +37,4 @@ namespace atomic_dex::mm2 cfg.balance = atomic_dex::utils::adjust_precision(cfg.balance); j.at("coin").get_to(cfg.coin); } -} // namespace atomic_dex::mm2 \ No newline at end of file +} // namespace atomic_dex::kdf \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.my_balance.hpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.my_balance.hpp similarity index 91% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.my_balance.hpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.my_balance.hpp index a3e4db1dfb..12f17c1707 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.my_balance.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.my_balance.hpp @@ -18,7 +18,7 @@ #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct balance_request { @@ -37,10 +37,10 @@ namespace atomic_dex::mm2 void to_json(nlohmann::json& j, const balance_request& cfg); void from_json(const nlohmann::json& j, balance_answer& cfg); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_balance_request = mm2::balance_request; - using t_balance_answer = mm2::balance_answer; + using t_balance_request = kdf::balance_request; + using t_balance_answer = kdf::balance_answer; } // namespace atomic_dex \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.my_tx_history.hpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.my_tx_history.hpp similarity index 93% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.my_tx_history.hpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.my_tx_history.hpp index e59cd15d8e..a272591909 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.my_tx_history.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.my_tx_history.hpp @@ -3,9 +3,9 @@ #pragma once -#include "atomicdex/api/mm2/rpc.hpp" +#include "atomicdex/api/kdf/rpc.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct my_tx_history_v1_rpc { diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.recover_funds_of_swap.cpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.recover_funds_of_swap.cpp similarity index 91% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.recover_funds_of_swap.cpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.recover_funds_of_swap.cpp index 6ca1f0000a..490625251c 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.recover_funds_of_swap.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.recover_funds_of_swap.cpp @@ -6,9 +6,9 @@ #include //! Project Headers -#include "atomicdex/api/mm2/rpc_v1/rpc.recover_funds_of_swap.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.recover_funds_of_swap.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const recover_funds_of_swap_request& cfg) diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.recover_funds_of_swap.hpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.recover_funds_of_swap.hpp similarity index 84% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.recover_funds_of_swap.hpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.recover_funds_of_swap.hpp index d9e2daae9f..3f6f29c25f 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.recover_funds_of_swap.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.recover_funds_of_swap.hpp @@ -6,7 +6,7 @@ //! Deps #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct recover_funds_of_swap_request { @@ -34,10 +34,10 @@ namespace atomic_dex::mm2 }; void from_json(const nlohmann::json& j, recover_funds_of_swap_answer& answer); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_recover_funds_of_swap_request = mm2::recover_funds_of_swap_request; - using t_recover_funds_of_swap_answer = mm2::recover_funds_of_swap_answer; + using t_recover_funds_of_swap_request = kdf::recover_funds_of_swap_request; + using t_recover_funds_of_swap_answer = kdf::recover_funds_of_swap_answer; } // namespace atomic_dex \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.sell.cpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.sell.cpp similarity index 96% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.sell.cpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.sell.cpp index 4566ea7e48..f35302eee0 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.sell.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.sell.cpp @@ -18,10 +18,10 @@ #include //! Project Headers -#include "atomicdex/api/mm2/generics.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.sell.hpp" +#include "atomicdex/api/kdf/generics.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.sell.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const sell_request& request) @@ -90,4 +90,4 @@ namespace atomic_dex::mm2 { extract_rpc_json_answer(j, answer); } -} // namespace atomic_dex::mm2 \ No newline at end of file +} // namespace atomic_dex::kdf \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.sell.hpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.sell.hpp similarity index 91% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.sell.hpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.sell.hpp index c2a1551731..407447d11e 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.sell.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.sell.hpp @@ -24,9 +24,9 @@ #include //! Project Headers -#include "atomicdex/api/mm2/trading.order.contents.hpp" +#include "atomicdex/api/kdf/trading.order.contents.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct sell_request { @@ -66,11 +66,11 @@ namespace atomic_dex::mm2 }; void from_json(const nlohmann::json& j, sell_answer& answer); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_sell_request = mm2::sell_request; - using t_sell_answer = mm2::sell_answer; - using t_sell_answer_success = mm2::sell_answer_success; + using t_sell_request = kdf::sell_request; + using t_sell_answer = kdf::sell_answer; + using t_sell_answer_success = kdf::sell_answer_success; } // namespace atomic_dex \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.setprice.cpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.setprice.cpp similarity index 96% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.setprice.cpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.setprice.cpp index 6977cefa90..1e0e1954d5 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.setprice.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.setprice.cpp @@ -17,9 +17,9 @@ #include //! Project Headers -#include "atomicdex/api/mm2/rpc_v1/rpc.setprice.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.setprice.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const setprice_request& request) diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.setprice.hpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.setprice.hpp similarity index 95% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.setprice.hpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.setprice.hpp index f169a0002d..48e0ea4efd 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.setprice.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.setprice.hpp @@ -23,7 +23,7 @@ //! Deps #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct setprice_request { @@ -44,5 +44,5 @@ namespace atomic_dex::mm2 namespace atomic_dex { - using t_setprice_request = mm2::setprice_request; + using t_setprice_request = kdf::setprice_request; } \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.update_maker_order.cpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.update_maker_order.cpp similarity index 84% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.update_maker_order.cpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.update_maker_order.cpp index e7cae487c8..8750f7020a 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.update_maker_order.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.update_maker_order.cpp @@ -6,12 +6,12 @@ #include //! Project Headers -#include +#include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void - to_json(nlohmann::json& j, const mm2::update_maker_order_request& request) + to_json(nlohmann::json& j, const kdf::update_maker_order_request& request) { j["uuid"] = request.uuid; j["new_price"] = request.new_price; @@ -41,4 +41,4 @@ namespace atomic_dex::mm2 j["rel_nota"] = request.rel_nota.value(); } } -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.update_maker_order.hpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.update_maker_order.hpp similarity index 85% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.update_maker_order.hpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.update_maker_order.hpp index d1249a8b29..4de40143d3 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.update_maker_order.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.update_maker_order.hpp @@ -7,7 +7,7 @@ //! Deps #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct update_maker_order_request { @@ -23,9 +23,9 @@ namespace atomic_dex::mm2 }; void to_json(nlohmann::json& j, const update_maker_order_request& request); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_update_maker_order_request = mm2::update_maker_order_request; + using t_update_maker_order_request = kdf::update_maker_order_request; } \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.validateaddress.cpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.validateaddress.cpp similarity index 71% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.validateaddress.cpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.validateaddress.cpp index e30274b0df..391e213ef9 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.validateaddress.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.validateaddress.cpp @@ -1,12 +1,12 @@ #include -#include "atomicdex/api/mm2/rpc_v1/rpc.validateaddress.hpp" -#include "atomicdex/api/mm2/generics.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.validateaddress.hpp" +#include "atomicdex/api/kdf/generics.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void - to_json(nlohmann::json& j, const mm2::validate_address_request& req) + to_json(nlohmann::json& j, const kdf::validate_address_request& req) { j["coin"] = req.coin; j["address"] = req.address; @@ -26,4 +26,4 @@ namespace atomic_dex::mm2 { extract_rpc_json_answer(j, answer); } -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.validateaddress.hpp b/src/core/atomicdex/api/kdf/rpc_v1/rpc.validateaddress.hpp similarity index 80% rename from src/core/atomicdex/api/mm2/rpc_v1/rpc.validateaddress.hpp rename to src/core/atomicdex/api/kdf/rpc_v1/rpc.validateaddress.hpp index 9ca7fbc43f..41dfa5648f 100644 --- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.validateaddress.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v1/rpc.validateaddress.hpp @@ -6,7 +6,7 @@ //! Deps #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct validate_address_request { @@ -33,11 +33,11 @@ namespace atomic_dex::mm2 }; void from_json(const nlohmann::json& j, validate_address_answer& answer); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_validate_address_request = mm2::validate_address_request; - using t_validate_address_answer = mm2::validate_address_answer; - using t_validate_address_answer_success = mm2::validate_address_answer_success; + using t_validate_address_request = kdf::validate_address_request; + using t_validate_address_answer = kdf::validate_address_answer; + using t_validate_address_answer_success = kdf::validate_address_answer_success; } // namespace atomic_dex \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.bestorders.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.bestorders.cpp similarity index 94% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.bestorders.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.bestorders.cpp index ba5dd40660..d1a398b2c4 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.bestorders.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.bestorders.cpp @@ -22,11 +22,11 @@ #include //! Project Headers -#include "atomicdex/api/mm2/generics.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.bestorders.hpp" +#include "atomicdex/api/kdf/generics.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.bestorders.hpp" //! Implementation RPC [best_orders] -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const bestorders_request_rpc& req) @@ -68,4 +68,4 @@ namespace atomic_dex::mm2 } } } -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.bestorders.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.bestorders.hpp similarity index 94% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.bestorders.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.bestorders.hpp index 0c9be72572..01472bebd3 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.bestorders.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.bestorders.hpp @@ -24,10 +24,10 @@ #include //! Project Headers -#include "atomicdex/api/mm2/rpc.hpp" -#include "atomicdex/api/mm2/orderbook.order.contents.hpp" +#include "atomicdex/api/kdf/rpc.hpp" +#include "atomicdex/api/kdf/orderbook.order.contents.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct bestorders_rpc { @@ -62,4 +62,4 @@ namespace atomic_dex::mm2 void to_json(nlohmann::json& j, const bestorders_request_rpc& req); void from_json(const nlohmann::json& j, bestorders_result_rpc& answer); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_bch_with_tokens_rpc.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_bch_with_tokens_rpc.cpp similarity index 94% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_bch_with_tokens_rpc.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_bch_with_tokens_rpc.cpp index 0727b2d1af..8dda59518b 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_bch_with_tokens_rpc.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_bch_with_tokens_rpc.cpp @@ -1,9 +1,9 @@ #include -#include "atomicdex/api/mm2/address_format.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp" +#include "atomicdex/api/kdf/address_format.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const enable_bch_with_tokens_request_rpc& in) { diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp similarity index 95% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp index b9141b4933..0389029189 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp @@ -19,12 +19,12 @@ #include #include "atomicdex/config/electrum.cfg.hpp" -#include "atomicdex/api/mm2/address_format.hpp" -#include "atomicdex/api/mm2/balance_info.hpp" -#include "atomicdex/api/mm2/rpc.hpp" -#include "atomicdex/api/mm2/utxo_merge_params.hpp" +#include "atomicdex/api/kdf/address_format.hpp" +#include "atomicdex/api/kdf/balance_info.hpp" +#include "atomicdex/api/kdf/rpc.hpp" +#include "atomicdex/api/kdf/utxo_merge_params.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct enable_bch_with_tokens_rpc { diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_erc20.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.cpp similarity index 90% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_erc20.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.cpp index 4c4bf707c5..b366730238 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_erc20.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.cpp @@ -1,8 +1,8 @@ #include -#include "atomicdex/api/mm2/rpc_v2/rpc2.enable_erc20.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const enable_erc20_rpc_request& request) { diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_erc20.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.hpp similarity index 96% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_erc20.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.hpp index 953bb8f67d..26452f9593 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_erc20.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.hpp @@ -19,10 +19,10 @@ #include #include //> nlohmann::json -#include "atomicdex/api/mm2/rpc.hpp" -#include "atomicdex/api/mm2/balance_info.hpp" +#include "atomicdex/api/kdf/rpc.hpp" +#include "atomicdex/api/kdf/balance_info.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct enable_erc20_rpc { diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_eth_with_tokens.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_eth_with_tokens.cpp similarity index 95% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_eth_with_tokens.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_eth_with_tokens.cpp index 2a0bb73211..2d4845a99b 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_eth_with_tokens.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_eth_with_tokens.cpp @@ -1,8 +1,8 @@ #include -#include "atomicdex/api/mm2/rpc_v2/rpc2.enable_eth_with_tokens.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.enable_eth_with_tokens.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const enable_eth_with_tokens_request_rpc& in) { diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_eth_with_tokens.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_eth_with_tokens.hpp similarity index 97% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_eth_with_tokens.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_eth_with_tokens.hpp index 9205777d8d..3b40f17482 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_eth_with_tokens.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_eth_with_tokens.hpp @@ -18,12 +18,12 @@ #include -#include "atomicdex/api/mm2/rpc.hpp" -#include "atomicdex/api/mm2/balance_info.hpp" +#include "atomicdex/api/kdf/rpc.hpp" +#include "atomicdex/api/kdf/balance_info.hpp" #include "atomicdex/config/enable.cfg.hpp" #include "atomicdex/constants/qt.coins.enums.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct enable_eth_with_tokens_rpc { diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_slp_rpc.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_slp_rpc.cpp similarity index 96% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_slp_rpc.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_slp_rpc.cpp index 813fca85f0..9906fae3c3 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_slp_rpc.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_slp_rpc.cpp @@ -2,7 +2,7 @@ #include "rpc2.enable_slp_rpc.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const enable_slp_rpc_request& request) { diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_slp_rpc.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_slp_rpc.hpp similarity index 96% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_slp_rpc.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_slp_rpc.hpp index 6cabbe2f72..1fbe403012 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_slp_rpc.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_slp_rpc.hpp @@ -22,10 +22,10 @@ #include //> nlohmann::json -#include "atomicdex/api/mm2/rpc.hpp" -#include "atomicdex/api/mm2/balance_info.hpp" +#include "atomicdex/api/kdf/rpc.hpp" +#include "atomicdex/api/kdf/balance_info.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct enable_slp_rpc { diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_tendermint_token.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_token.cpp similarity index 96% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_tendermint_token.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_token.cpp index d20efa4132..81bafbc1b3 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_tendermint_token.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_token.cpp @@ -2,7 +2,7 @@ #include "rpc2.enable_tendermint_token.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const enable_tendermint_token_rpc_request& request) { diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_tendermint_token.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_token.hpp similarity index 96% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_tendermint_token.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_token.hpp index 86d7525f1d..9597d1a38e 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_tendermint_token.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_token.hpp @@ -21,10 +21,10 @@ #include //> nlohmann::json -#include "atomicdex/api/mm2/rpc.hpp" -#include "atomicdex/api/mm2/balance_info.hpp" +#include "atomicdex/api/kdf/rpc.hpp" +#include "atomicdex/api/kdf/balance_info.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct enable_tendermint_token_rpc { diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_tendermint_with_assets.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.cpp similarity index 98% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_tendermint_with_assets.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.cpp index b924bbe656..cc28a43f4e 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_tendermint_with_assets.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.cpp @@ -2,7 +2,7 @@ #include "rpc2.enable_tendermint_with_assets.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const enable_tendermint_with_assets_request_rpc& in) { diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_tendermint_with_assets.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.hpp similarity index 95% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_tendermint_with_assets.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.hpp index 76876d0a89..6bad7330a1 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.enable_tendermint_with_assets.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.hpp @@ -2,11 +2,11 @@ #include -#include "atomicdex/api/mm2/rpc.hpp" -#include "atomicdex/api/mm2/balance_info.hpp" +#include "atomicdex/api/kdf/rpc.hpp" +#include "atomicdex/api/kdf/balance_info.hpp" #include "atomicdex/config/electrum.cfg.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct enable_tendermint_with_assets_rpc { diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.get_public_key.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.get_public_key.cpp similarity index 94% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.get_public_key.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.get_public_key.cpp index acd53173d5..74f694a2b1 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.get_public_key.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.get_public_key.cpp @@ -16,9 +16,9 @@ #include -#include "atomicdex/api/mm2/rpc_v2/rpc2.get_public_key.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.get_public_key.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const get_public_key_rpc_request& request) { diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.get_public_key.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.get_public_key.hpp similarity index 97% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.get_public_key.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.get_public_key.hpp index 98f15bc9f2..6eefb07bad 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.get_public_key.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.get_public_key.hpp @@ -22,9 +22,9 @@ #include -#include "atomicdex/api/mm2/rpc.hpp" +#include "atomicdex/api/kdf/rpc.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct get_public_key_rpc { diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.my_tx_history.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.my_tx_history.cpp similarity index 95% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.my_tx_history.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.my_tx_history.cpp index 9b4a104837..8cebd503cf 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.my_tx_history.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.my_tx_history.cpp @@ -18,9 +18,9 @@ #include //! Project Headers -#include "atomicdex/api/mm2/rpc_v2/rpc2.my_tx_history.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.my_tx_history.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const my_tx_history_request_rpc& in) { diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.my_tx_history.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.my_tx_history.hpp similarity index 89% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.my_tx_history.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.my_tx_history.hpp index fd7089ae59..a63d85718e 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.my_tx_history.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.my_tx_history.hpp @@ -3,13 +3,13 @@ #include -#include "atomicdex/api/mm2/paging_options.hpp" -#include "atomicdex/api/mm2/transaction.data.hpp" -#include "atomicdex/api/mm2/rpc.hpp" +#include "atomicdex/api/kdf/paging_options.hpp" +#include "atomicdex/api/kdf/transaction.data.hpp" +#include "atomicdex/api/kdf/rpc.hpp" #pragma once -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct my_tx_history_v2_rpc { diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.orderbook.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.orderbook.cpp similarity index 98% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.orderbook.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.orderbook.cpp index 9831628f46..91f7795ac3 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.orderbook.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.orderbook.cpp @@ -19,10 +19,10 @@ #include //! Project Headers -#include "atomicdex/api/mm2/rpc_v2/rpc2.orderbook.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.orderbook.hpp" #include "atomicdex/utilities/global.utilities.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const orderbook_request_rpc& req) @@ -122,4 +122,4 @@ namespace atomic_dex::mm2 } } -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.orderbook.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.orderbook.hpp similarity index 96% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.orderbook.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.orderbook.hpp index 6b3a5bd3a2..d6a97f49f2 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.orderbook.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.orderbook.hpp @@ -21,10 +21,10 @@ #include //> nlohmann::json -#include "atomicdex/api/mm2/rpc.hpp" -#include "atomicdex/api/mm2/orderbook.order.contents.hpp" +#include "atomicdex/api/kdf/rpc.hpp" +#include "atomicdex/api/kdf/orderbook.order.contents.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct orderbook_rpc { diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.cancel.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.cancel.cpp similarity index 94% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.cancel.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.cancel.cpp index 36a58b96b8..5a9ff1919d 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.cancel.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.cancel.cpp @@ -18,10 +18,10 @@ #include //! Project Headers -#include "atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.cancel.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.cancel.hpp" //! Implementation 2.0 RPC [enable_z_coin_cancel] -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { //! Serialization void to_json(nlohmann::json& j, const enable_z_coin_cancel_request& request) @@ -50,4 +50,4 @@ namespace atomic_dex::mm2 } } } -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.cancel.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.cancel.hpp similarity index 89% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.cancel.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.cancel.hpp index 87bfcf4788..67781ebf64 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.cancel.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.cancel.hpp @@ -23,9 +23,9 @@ #include //! Project Headers -#include "atomicdex/api/mm2/generic.error.hpp" +#include "atomicdex/api/kdf/generic.error.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct enable_z_coin_cancel_request { @@ -54,7 +54,7 @@ namespace atomic_dex::mm2 namespace atomic_dex { - using t_enable_z_coin_cancel_request = mm2::enable_z_coin_cancel_request; - using t_enable_z_coin_cancel_answer = mm2::enable_z_coin_cancel_answer; - using t_enable_z_coin_cancel_answer_success = mm2::enable_z_coin_cancel_answer_success; + using t_enable_z_coin_cancel_request = kdf::enable_z_coin_cancel_request; + using t_enable_z_coin_cancel_answer = kdf::enable_z_coin_cancel_answer; + using t_enable_z_coin_cancel_answer_success = kdf::enable_z_coin_cancel_answer_success; } // namespace atomic_dex \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.init.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.init.cpp similarity index 95% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.init.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.init.cpp index 6a09fd06a3..b5c7cd7ebc 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.init.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.init.cpp @@ -18,10 +18,10 @@ #include //! Project Headers -#include "atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.init.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.init.hpp" //! Implementation 2.0 RPC [enable_z_coin] -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { //! Serialization void to_json(nlohmann::json& j, const enable_z_coin_request& request) @@ -44,4 +44,4 @@ namespace atomic_dex::mm2 { j.at("task_id").get_to(answer.task_id); } -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.init.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.init.hpp similarity index 93% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.init.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.init.hpp index 126e4eda94..2d3208256b 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.init.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.init.hpp @@ -26,7 +26,7 @@ #include "atomicdex/config/electrum.cfg.hpp" #include "atomicdex/constants/qt.coins.enums.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct enable_z_coin_request { @@ -50,6 +50,6 @@ namespace atomic_dex::mm2 namespace atomic_dex { - using t_enable_z_coin_request = mm2::enable_z_coin_request; - using t_enable_z_coin_answer = mm2::enable_z_coin_answer; + using t_enable_z_coin_request = kdf::enable_z_coin_request; + using t_enable_z_coin_answer = kdf::enable_z_coin_answer; } // namespace atomic_dex diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.status.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.status.cpp similarity index 96% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.status.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.status.cpp index 805939e270..a626a6102c 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.status.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.status.cpp @@ -18,10 +18,10 @@ #include //! Project Headers -#include "atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.status.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.status.hpp" //! Implementation 2.0 RPC [enable_z_coin_status] -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { //! Serialization void to_json(nlohmann::json& j, const enable_z_coin_status_request& request) @@ -77,5 +77,5 @@ namespace atomic_dex::mm2 } } } -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.status.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.status.hpp similarity index 91% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.status.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.status.hpp index 769719303c..bbd62bd386 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.status.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.status.hpp @@ -23,9 +23,9 @@ #include //! Project Headers -#include "atomicdex/api/mm2/generic.error.hpp" +#include "atomicdex/api/kdf/generic.error.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct enable_z_coin_status_request { @@ -63,7 +63,7 @@ namespace atomic_dex::mm2 namespace atomic_dex { - using t_enable_z_coin_status_request = mm2::enable_z_coin_status_request; - using t_enable_z_coin_status_answer = mm2::enable_z_coin_status_answer; - using t_enable_z_coin_status_answer_success = mm2::enable_z_coin_status_answer_success; + using t_enable_z_coin_status_request = kdf::enable_z_coin_status_request; + using t_enable_z_coin_status_answer = kdf::enable_z_coin_status_answer; + using t_enable_z_coin_status_answer_success = kdf::enable_z_coin_status_answer_success; } // namespace atomic_dex diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.withdraw.init.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.withdraw.init.cpp similarity index 94% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.withdraw.init.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.withdraw.init.cpp index 6ca0f2a456..3f1fdd8315 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.withdraw.init.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.withdraw.init.cpp @@ -18,10 +18,10 @@ #include //! Project Headers -#include "atomicdex/api/mm2/rpc_v2/rpc2.task.withdraw.init.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.task.withdraw.init.hpp" //! Implementation 2.0 RPC [withdraw_init] -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const withdraw_init_fees& request) @@ -56,4 +56,4 @@ namespace atomic_dex::mm2 { j.at("task_id").get_to(answer.task_id); } -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.withdraw.init.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.withdraw.init.hpp similarity index 91% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.withdraw.init.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.withdraw.init.hpp index 01db2db54e..7acb5b4224 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.withdraw.init.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.withdraw.init.hpp @@ -22,7 +22,7 @@ //! Deps #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct withdraw_init_fees { @@ -51,7 +51,7 @@ namespace atomic_dex::mm2 namespace atomic_dex { - using t_withdraw_init_request = mm2::withdraw_init_request; - using t_withdraw_init_fees = mm2::withdraw_init_fees; - using t_withdraw_init_answer = mm2::withdraw_init_answer; + using t_withdraw_init_request = kdf::withdraw_init_request; + using t_withdraw_init_fees = kdf::withdraw_init_fees; + using t_withdraw_init_answer = kdf::withdraw_init_answer; } // namespace atomic_dex diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.withdraw.status.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.withdraw.status.cpp similarity index 93% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.withdraw.status.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.withdraw.status.cpp index e897f25426..4d45d2bd8f 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.withdraw.status.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.withdraw.status.cpp @@ -18,10 +18,10 @@ #include //! Project Headers -#include "atomicdex/api/mm2/rpc_v2/rpc2.task.withdraw.status.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.task.withdraw.status.hpp" //! Implementation 2.0 RPC [withdraw_status] -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { //! Serialization void to_json(nlohmann::json& j, const withdraw_status_request& request) @@ -42,4 +42,4 @@ namespace atomic_dex::mm2 answer.result = j.at("result").at("details").get(); } } -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.withdraw.status.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.withdraw.status.hpp similarity index 88% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.withdraw.status.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.withdraw.status.hpp index fce20944e9..dd4ac4909f 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.task.withdraw.status.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.task.withdraw.status.hpp @@ -23,10 +23,10 @@ #include //! Our Headers -#include "atomicdex/api/mm2/generic.error.hpp" -#include "atomicdex/api/mm2/transaction.data.hpp" +#include "atomicdex/api/kdf/generic.error.hpp" +#include "atomicdex/api/kdf/transaction.data.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct withdraw_status_request { @@ -47,6 +47,6 @@ namespace atomic_dex::mm2 namespace atomic_dex { - using t_withdraw_status_request = mm2::withdraw_status_request; - using t_withdraw_status_answer = mm2::withdraw_status_answer; + using t_withdraw_status_request = kdf::withdraw_status_request; + using t_withdraw_status_answer = kdf::withdraw_status_answer; } // namespace atomic_dex diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.trade_preimage.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.trade_preimage.cpp similarity index 94% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.trade_preimage.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.trade_preimage.cpp index baccc6e830..4a11d69d98 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.trade_preimage.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.trade_preimage.cpp @@ -18,10 +18,10 @@ #include //! Project Headers -#include "atomicdex/api/mm2/generics.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.trade_preimage.hpp" +#include "atomicdex/api/kdf/generics.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.trade_preimage.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { //! Serialization void @@ -74,4 +74,4 @@ namespace atomic_dex::mm2 { extract_rpc_json_answer(j, answer); } -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.trade_preimage.fwd.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.trade_preimage.fwd.hpp similarity index 91% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.trade_preimage.fwd.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.trade_preimage.fwd.hpp index ee8f2a57f5..c427e9a921 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.trade_preimage.fwd.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.trade_preimage.fwd.hpp @@ -16,13 +16,13 @@ #pragma once -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct trade_preimage_request; struct trade_preimage_answer; -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_trade_preimage_answer = mm2::trade_preimage_answer; + using t_trade_preimage_answer = kdf::trade_preimage_answer; } \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.trade_preimage.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.trade_preimage.hpp similarity index 89% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.trade_preimage.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.trade_preimage.hpp index 9b888836b2..b292893092 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.trade_preimage.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.trade_preimage.hpp @@ -25,9 +25,9 @@ #include //! Project Headers -#include "atomicdex/api/mm2/fraction.hpp" +#include "atomicdex/api/kdf/fraction.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct trade_preimage_request { @@ -45,7 +45,7 @@ namespace atomic_dex::mm2 { std::string coin; std::string amount; - mm2::fraction amount_fraction; + kdf::fraction amount_fraction; }; ENTT_API void from_json(const nlohmann::json& j, coin_fee& fee); @@ -71,11 +71,11 @@ namespace atomic_dex::mm2 }; ENTT_API void from_json(const nlohmann::json& j, trade_preimage_answer& answer); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_trade_preimage_request = mm2::trade_preimage_request; - using t_trade_preimage_answer = mm2::trade_preimage_answer; - using t_trade_preimage_answer_success = mm2::trade_preimage_answer_success; + using t_trade_preimage_request = kdf::trade_preimage_request; + using t_trade_preimage_answer = kdf::trade_preimage_answer; + using t_trade_preimage_answer_success = kdf::trade_preimage_answer_success; } // namespace atomic_dex diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.withdraw.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.cpp similarity index 97% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.withdraw.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.cpp index 7b2a2aa937..ac0b96a040 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.withdraw.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.cpp @@ -9,7 +9,7 @@ #include "atomicdex/utilities/global.utilities.hpp" #include "rpc2.withdraw.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const withdraw_fees& cfg) @@ -69,4 +69,4 @@ namespace atomic_dex::mm2 answer.result = j.at("result").get(); } } -} // namespace atomic_dex::mm2 \ No newline at end of file +} // namespace atomic_dex::kdf \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.withdraw.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp similarity index 83% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.withdraw.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp index e59e4d6674..76b4b74bd7 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.withdraw.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp @@ -7,10 +7,10 @@ #include //! Our Headers -#include "atomicdex/api/mm2/generic.error.hpp" -#include "atomicdex/api/mm2/transaction.data.hpp" +#include "atomicdex/api/kdf/generic.error.hpp" +#include "atomicdex/api/kdf/transaction.data.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct withdraw_fees { @@ -44,11 +44,11 @@ namespace atomic_dex::mm2 }; void from_json(const nlohmann::json& j, withdraw_answer& answer); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_withdraw_request = mm2::withdraw_request; - using t_withdraw_fees = mm2::withdraw_fees; - using t_withdraw_answer = mm2::withdraw_answer; + using t_withdraw_request = kdf::withdraw_request; + using t_withdraw_fees = kdf::withdraw_fees; + using t_withdraw_answer = kdf::withdraw_answer; } // namespace atomic_dex \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.z_coin_tx_history.cpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.z_coin_tx_history.cpp similarity index 96% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.z_coin_tx_history.cpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.z_coin_tx_history.cpp index 9b5053c85f..622598fa3f 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.z_coin_tx_history.cpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.z_coin_tx_history.cpp @@ -18,10 +18,10 @@ #include //! Project Headers -#include "atomicdex/api/mm2/rpc_v2/rpc2.z_coin_tx_history.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.z_coin_tx_history.hpp" //! Implementation 2.0 RPC [z_coin_tx_history] -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { //! Serialization void to_json(nlohmann::json& j, const z_tx_history_request& request) @@ -103,4 +103,4 @@ namespace atomic_dex::mm2 answer.result = j.at("result").get(); } } -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.z_coin_tx_history.hpp b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.z_coin_tx_history.hpp similarity index 94% rename from src/core/atomicdex/api/mm2/rpc_v2/rpc2.z_coin_tx_history.hpp rename to src/core/atomicdex/api/kdf/rpc_v2/rpc2.z_coin_tx_history.hpp index 2f7c9ce8b9..bc5806a265 100644 --- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.z_coin_tx_history.hpp +++ b/src/core/atomicdex/api/kdf/rpc_v2/rpc2.z_coin_tx_history.hpp @@ -24,9 +24,9 @@ #include //! Our Headers -#include "atomicdex/api/mm2/transaction.data.hpp" +#include "atomicdex/api/kdf/transaction.data.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct z_tx_history_request { @@ -94,10 +94,10 @@ namespace atomic_dex::mm2 }; void from_json(const nlohmann::json& j, z_tx_history_answer& answer); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_z_tx_history_request = mm2::z_tx_history_request; - using t_z_tx_history_answer = mm2::z_tx_history_answer; + using t_z_tx_history_request = kdf::z_tx_history_request; + using t_z_tx_history_answer = kdf::z_tx_history_answer; } // namespace atomic_dex diff --git a/src/core/atomicdex/api/mm2/trading.order.contents.cpp b/src/core/atomicdex/api/kdf/trading.order.contents.cpp similarity index 95% rename from src/core/atomicdex/api/mm2/trading.order.contents.cpp rename to src/core/atomicdex/api/kdf/trading.order.contents.cpp index ea35f974d4..26f69f2cb5 100644 --- a/src/core/atomicdex/api/mm2/trading.order.contents.cpp +++ b/src/core/atomicdex/api/kdf/trading.order.contents.cpp @@ -18,9 +18,9 @@ #include //! Project Headers -#include +#include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void from_json(const nlohmann::json& j, trading_order_contents& contents) diff --git a/src/core/atomicdex/api/mm2/trading.order.contents.hpp b/src/core/atomicdex/api/kdf/trading.order.contents.hpp similarity index 98% rename from src/core/atomicdex/api/mm2/trading.order.contents.hpp rename to src/core/atomicdex/api/kdf/trading.order.contents.hpp index 0bba41b80d..6e4bf05804 100644 --- a/src/core/atomicdex/api/mm2/trading.order.contents.hpp +++ b/src/core/atomicdex/api/kdf/trading.order.contents.hpp @@ -22,7 +22,7 @@ //! Deps #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct trading_order_contents { diff --git a/src/core/atomicdex/api/mm2/transaction.data.cpp b/src/core/atomicdex/api/kdf/transaction.data.cpp similarity index 97% rename from src/core/atomicdex/api/mm2/transaction.data.cpp rename to src/core/atomicdex/api/kdf/transaction.data.cpp index fd140e4667..c9975f984c 100644 --- a/src/core/atomicdex/api/mm2/transaction.data.cpp +++ b/src/core/atomicdex/api/kdf/transaction.data.cpp @@ -1,9 +1,9 @@ #include -#include "atomicdex/api/mm2/transaction.data.hpp" +#include "atomicdex/api/kdf/transaction.data.hpp" #include "atomicdex/utilities/global.utilities.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void from_json(const nlohmann::json& j, fee_regular_coin& cfg) { @@ -142,4 +142,4 @@ namespace atomic_dex::mm2 std::string s = atomic_dex::utils::to_human_date(cfg.timestamp, "%e %b %Y, %H:%M"); cfg.timestamp_as_date = std::move(s); } -} // namespace atomic_dex::mm2 \ No newline at end of file +} // namespace atomic_dex::kdf \ No newline at end of file diff --git a/src/core/atomicdex/api/mm2/transaction.data.hpp b/src/core/atomicdex/api/kdf/transaction.data.hpp similarity index 98% rename from src/core/atomicdex/api/mm2/transaction.data.hpp rename to src/core/atomicdex/api/kdf/transaction.data.hpp index a39f64b9fd..f25c9e9bf2 100644 --- a/src/core/atomicdex/api/mm2/transaction.data.hpp +++ b/src/core/atomicdex/api/kdf/transaction.data.hpp @@ -6,7 +6,7 @@ //! Deps #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct fee_regular_coin { diff --git a/src/core/atomicdex/api/mm2/utxo_merge_params.cpp b/src/core/atomicdex/api/kdf/utxo_merge_params.cpp similarity index 98% rename from src/core/atomicdex/api/mm2/utxo_merge_params.cpp rename to src/core/atomicdex/api/kdf/utxo_merge_params.cpp index 2a5d29c474..5469162767 100644 --- a/src/core/atomicdex/api/mm2/utxo_merge_params.cpp +++ b/src/core/atomicdex/api/kdf/utxo_merge_params.cpp @@ -18,7 +18,7 @@ #include "utxo_merge_params.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { void to_json(nlohmann::json& j, const utxo_merge_params_t& req) { diff --git a/src/core/atomicdex/api/mm2/utxo_merge_params.hpp b/src/core/atomicdex/api/kdf/utxo_merge_params.hpp similarity index 98% rename from src/core/atomicdex/api/mm2/utxo_merge_params.hpp rename to src/core/atomicdex/api/kdf/utxo_merge_params.hpp index db30ee5008..a90ce6a1f2 100644 --- a/src/core/atomicdex/api/mm2/utxo_merge_params.hpp +++ b/src/core/atomicdex/api/kdf/utxo_merge_params.hpp @@ -18,7 +18,7 @@ #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct utxo_merge_params_t { diff --git a/src/core/atomicdex/api/mm2/fraction.cpp b/src/core/atomicdex/api/mm2/fraction.cpp deleted file mode 100644 index 0bcdc944fc..0000000000 --- a/src/core/atomicdex/api/mm2/fraction.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include - -#include "atomicdex/api/mm2/fraction.hpp" - -namespace atomic_dex::mm2 -{ - void from_json(const nlohmann::json& j, mm2::fraction& fraction) - { - j.at("denom").get_to(fraction.denom); - j.at("numer").get_to(fraction.numer); - } -} // namespace atomic_dex::mm2 \ No newline at end of file diff --git a/src/core/atomicdex/config/coins.cfg.hpp b/src/core/atomicdex/config/coins.cfg.hpp index 7fb2927ddb..319a68db7a 100644 --- a/src/core/atomicdex/config/coins.cfg.hpp +++ b/src/core/atomicdex/config/coins.cfg.hpp @@ -21,8 +21,8 @@ #include -#include "atomicdex/api/mm2/mm2.constants.hpp" -#include "atomicdex/api/mm2/utxo_merge_params.hpp" +#include "atomicdex/api/kdf/kdf.constants.hpp" +#include "atomicdex/api/kdf/utxo_merge_params.hpp" #include "atomicdex/config/electrum.cfg.hpp" #include "atomicdex/config/enable.cfg.hpp" #include "atomicdex/constants/qt.coins.enums.hpp" diff --git a/src/core/atomicdex/config/mm2.cfg.hpp b/src/core/atomicdex/config/kdf.cfg.hpp similarity index 91% rename from src/core/atomicdex/config/mm2.cfg.hpp rename to src/core/atomicdex/config/kdf.cfg.hpp index 21c7aeb62c..3fce6b7d38 100644 --- a/src/core/atomicdex/config/mm2.cfg.hpp +++ b/src/core/atomicdex/config/kdf.cfg.hpp @@ -29,7 +29,7 @@ namespace atomic_dex using nlohmann::json; using namespace std::string_literals; - struct mm2_config + struct kdf_config { std::string gui{std::string(DEX_NAME) + " "s + atomic_dex::get_version()}; int64_t netid{8762}; @@ -43,16 +43,16 @@ namespace atomic_dex std::string userhome{std::getenv("HOME")}; #endif std::string passphrase; - std::string dbdir{utils::u8string((utils::get_atomic_dex_data_folder() / "mm2" / "DB"))}; - std::string rpc_password{"atomic_dex_mm2_passphrase"}; + std::string dbdir{utils::u8string((utils::get_atomic_dex_data_folder() / "kdf" / "DB"))}; + std::string rpc_password{"atomic_dex_kdf_passphrase"}; }; - void from_json(const json& j, mm2_config& cfg); + void from_json(const json& j, kdf_config& cfg); - void to_json(json& j, const mm2_config& cfg); + void to_json(json& j, const kdf_config& cfg); inline void - from_json(const json& j, mm2_config& cfg) + from_json(const json& j, kdf_config& cfg) { cfg.gui = j.at("gui").get(); cfg.netid = j.at("netid").get(); @@ -64,7 +64,7 @@ namespace atomic_dex } inline void - to_json(json& j, const mm2_config& cfg) + to_json(json& j, const kdf_config& cfg) { j = json::object(); j["gui"] = cfg.gui; diff --git a/src/core/atomicdex/config/raw.mm2.coins.cfg.hpp b/src/core/atomicdex/config/raw.kdf.coins.cfg.hpp similarity index 89% rename from src/core/atomicdex/config/raw.mm2.coins.cfg.hpp rename to src/core/atomicdex/config/raw.kdf.coins.cfg.hpp index 503a99828c..795818efcf 100644 --- a/src/core/atomicdex/config/raw.mm2.coins.cfg.hpp +++ b/src/core/atomicdex/config/raw.kdf.coins.cfg.hpp @@ -9,10 +9,10 @@ #include //! Project -#include "atomicdex/api/mm2/mm2.constants.hpp" +#include "atomicdex/api/kdf/kdf.constants.hpp" #include "atomicdex/utilities/global.utilities.hpp" #include "atomicdex/utilities/qt.utilities.hpp" -#include "atomicdex/api/mm2/address_format.hpp" +#include "atomicdex/api/kdf/address_format.hpp" #ifndef NLOHMANN_OPT_HELPER # define NLOHMANN_OPT_HELPER @@ -80,7 +80,7 @@ namespace atomic_dex struct coin_element { - using addr_fmt = mm2::address_format_t; + using addr_fmt = kdf::address_format_t; std::string coin; std::optional name{std::nullopt}; std::optional fname{std::nullopt}; @@ -92,7 +92,7 @@ namespace atomic_dex std::optional wiftype{std::nullopt}; std::optional txfee{std::nullopt}; std::optional confpath{std::nullopt}; - std::optional mm2{std::nullopt}; + std::optional kdf{std::nullopt}; std::optional required_confirmations{std::nullopt}; std::optional asset{std::nullopt}; std::optional txversion{std::nullopt}; @@ -120,8 +120,8 @@ namespace atomic_dex namespace atomic_dex { - using t_mm2_raw_coins = std::vector; - using t_mm2_raw_coins_registry = std::unordered_map; + using t_kdf_raw_coins = std::vector; + using t_kdf_raw_coins_registry = std::unordered_map; } // namespace atomic_dex namespace atomic_dex @@ -143,7 +143,7 @@ namespace atomic_dex x.wiftype = atomic_dex::get_optional(j, "wiftype"); x.txfee = atomic_dex::get_optional(j, "txfee"); x.confpath = atomic_dex::get_optional(j, "confpath"); - x.mm2 = atomic_dex::get_optional(j, "mm2"); + x.kdf = atomic_dex::get_optional(j, "kdf"); x.required_confirmations = atomic_dex::get_optional(j, "required_confirmations"); x.asset = atomic_dex::get_optional(j, "asset"); x.txversion = atomic_dex::get_optional(j, "txversion"); @@ -151,7 +151,7 @@ namespace atomic_dex x.requires_notarization = atomic_dex::get_optional(j, "requires_notarization"); x.is_po_s = atomic_dex::get_optional(j, "isPoS"); x.segwit = atomic_dex::get_optional(j, "segwit"); - x.address_format = atomic_dex::get_optional(j, "address_format"); + x.address_format = atomic_dex::get_optional(j, "address_format"); x.estimate_fee_mode = atomic_dex::get_optional(j, "estimate_fee_mode"); x.taddr = atomic_dex::get_optional(j, "taddr"); x.decimals = atomic_dex::get_optional(j, "decimals"); @@ -189,7 +189,7 @@ namespace atomic_dex to_json_functor("wiftype", x.wiftype); to_json_functor("txfee", x.txfee); to_json_functor("confpath", x.confpath); - to_json_functor("mm2", x.mm2); + to_json_functor("kdf", x.kdf); to_json_functor("required_confirmations", x.required_confirmations); to_json_functor("asset", x.asset); to_json_functor("txversion", x.txversion); @@ -213,19 +213,19 @@ namespace atomic_dex j["protocol"] = x.protocol; } - inline t_mm2_raw_coins_registry - parse_raw_mm2_coins_file() + inline t_kdf_raw_coins_registry + parse_raw_kdf_coins_file() { - SPDLOG_INFO("parse_raw_mm2_coins_file"); - t_mm2_raw_coins_registry out; + SPDLOG_INFO("parse_raw_kdf_coins_file"); + t_kdf_raw_coins_registry out; std::filesystem::path file_path{atomic_dex::utils::get_current_configs_path() / "coins.json"}; if (not std::filesystem::exists(file_path)) { - std::filesystem::path original_mm2_coins_path{ag::core::assets_real_path() / "tools" / "mm2" / "coins"}; + std::filesystem::path original_kdf_coins_path{ag::core::assets_real_path() / "tools" / "kdf" / "coins"}; //! Copy our json to current version - LOG_PATH_CMP("Copying mm2 coins cfg: {} to {}", original_mm2_coins_path, file_path); + LOG_PATH_CMP("Copying kdf coins cfg: {} to {}", original_kdf_coins_path, file_path); - std::filesystem::copy_file(original_mm2_coins_path, file_path, std::filesystem::copy_options::overwrite_existing); + std::filesystem::copy_file(original_kdf_coins_path, file_path, std::filesystem::copy_options::overwrite_existing); } QFile file; @@ -238,16 +238,16 @@ namespace atomic_dex { nlohmann::json j = nlohmann::json::parse(val.toStdString()); // ifs >> j; - t_mm2_raw_coins coins = j; + t_kdf_raw_coins coins = j; out.reserve(coins.size()); for (auto&& coin: coins) { out[coin.coin] = coin; } LOG_PATH("successfully parsed: {}", file_path); - SPDLOG_INFO("coins size mm2: {}", coins.size()); + SPDLOG_INFO("coins size kdf: {}", coins.size()); } catch (const std::exception& error) { SPDLOG_ERROR("parse error: {}", error.what()); - LOG_PATH("cannot parse mm2 raw cfg file: {}", file_path); + LOG_PATH("cannot parse kdf raw cfg file: {}", file_path); } return out; } diff --git a/src/core/atomicdex/data/dex/orders.and.swaps.data.hpp b/src/core/atomicdex/data/dex/orders.and.swaps.data.hpp index 0cd153feb4..d3837e301a 100644 --- a/src/core/atomicdex/data/dex/orders.and.swaps.data.hpp +++ b/src/core/atomicdex/data/dex/orders.and.swaps.data.hpp @@ -16,7 +16,7 @@ namespace atomic_dex using t_filtering_infos = filtering_infos; - // todo: please change the logic of this and its usage in mm2 service and other places. + // todo: please change the logic of this and its usage in kdf service and other places. // not happy with the current implementation we can do better struct orders_and_swaps { diff --git a/src/core/atomicdex/data/dex/qt.orders.data.hpp b/src/core/atomicdex/data/dex/qt.orders.data.hpp index d5723bb8f4..c6e9ea7ac2 100644 --- a/src/core/atomicdex/data/dex/qt.orders.data.hpp +++ b/src/core/atomicdex/data/dex/qt.orders.data.hpp @@ -9,7 +9,7 @@ //! deps #include -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct order_swaps_data { @@ -89,9 +89,9 @@ namespace atomic_dex::mm2 QString max_volume; std::optional conf_settings{std::nullopt}; }; -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_order_swaps_data = mm2::order_swaps_data; + using t_order_swaps_data = kdf::order_swaps_data; } \ No newline at end of file diff --git a/src/core/atomicdex/data/wallet/tx.data.hpp b/src/core/atomicdex/data/wallet/tx.data.hpp index cc99195381..09921943a6 100644 --- a/src/core/atomicdex/data/wallet/tx.data.hpp +++ b/src/core/atomicdex/data/wallet/tx.data.hpp @@ -8,7 +8,7 @@ #include //! Project Headers -#include "atomicdex/api/mm2/mm2.error.code.hpp" +#include "atomicdex/api/kdf/kdf.error.code.hpp" namespace atomic_dex { @@ -25,7 +25,7 @@ namespace atomic_dex std::string my_balance_change; std::string total_amount; std::size_t block_height; - t_mm2_ec ec{dextop_error::success}; + t_kdf_ec ec{dextop_error::success}; bool unconfirmed{false}; std::string transaction_note{""}; }; diff --git a/src/core/atomicdex/events/events.hpp b/src/core/atomicdex/events/events.hpp index 8b468b8031..ad6da41888 100644 --- a/src/core/atomicdex/events/events.hpp +++ b/src/core/atomicdex/events/events.hpp @@ -24,11 +24,11 @@ namespace atomic_dex { - using mm2_started = entt::tag<"mm2_started"_hs>; + using kdf_started = entt::tag<"kdf_started"_hs>; using post_login = entt::tag<"post_login"_hs>; using gui_enter_trading = entt::tag<"gui_enter_trading"_hs>; using gui_leave_trading = entt::tag<"gui_leave_trading"_hs>; - using mm2_initialized = entt::tag<"mm2_running_and_enabling"_hs>; + using kdf_initialized = entt::tag<"kdf_running_and_enabling"_hs>; using default_coins_enabled = entt::tag<"default_coins_enabled"_hs>; using current_currency_changed = entt::tag<"update_orders_and_swap_values"_hs>; using force_update_providers = entt::tag<"force_update_providers"_hs>; diff --git a/src/core/atomicdex/managers/qt.wallet.manager.cpp b/src/core/atomicdex/managers/qt.wallet.manager.cpp index bb73aef9a2..9564f7a375 100644 --- a/src/core/atomicdex/managers/qt.wallet.manager.cpp +++ b/src/core/atomicdex/managers/qt.wallet.manager.cpp @@ -350,9 +350,9 @@ namespace atomic_dex } this->set_wallet_default_name(wallet_name); - this->set_status("initializing_mm2"); - auto& mm2_system = m_system_manager.get_system(); - mm2_system.spawn_mm2_instance(get_default_wallet_name().toStdString(), seed, with_pin_cfg, rpcpass); + this->set_status("initializing_kdf"); + auto& kdf_system = m_system_manager.get_system(); + kdf_system.spawn_kdf_instance(get_default_wallet_name().toStdString(), seed, with_pin_cfg, rpcpass); this->dispatcher_.trigger(); set_log_status(true); diff --git a/src/core/atomicdex/managers/qt.wallet.manager.hpp b/src/core/atomicdex/managers/qt.wallet.manager.hpp index a40b70a59c..bc1b8afe27 100644 --- a/src/core/atomicdex/managers/qt.wallet.manager.hpp +++ b/src/core/atomicdex/managers/qt.wallet.manager.hpp @@ -24,7 +24,7 @@ //! Project Headers #include "atomicdex/config/wallet.cfg.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" #include "atomicdex/utilities/security.utilities.hpp" #include "atomicdex/version/version.hpp" diff --git a/src/core/atomicdex/models/qt.orderbook.model.cpp b/src/core/atomicdex/models/qt.orderbook.model.cpp index 2aa52b3d4f..16b68c1b1b 100644 --- a/src/core/atomicdex/models/qt.orderbook.model.cpp +++ b/src/core/atomicdex/models/qt.orderbook.model.cpp @@ -247,7 +247,7 @@ namespace atomic_dex { return false; } - mm2::order_contents& order = m_model_data.at(index.row()); + kdf::order_contents& order = m_model_data.at(index.row()); switch (static_cast(role)) { case PriceRole: @@ -397,7 +397,7 @@ namespace atomic_dex void - orderbook_model::initialize_order(const mm2::order_contents& order) + orderbook_model::initialize_order(const kdf::order_contents& order) { if (m_orders_id_registry.contains(order.uuid)) { @@ -435,7 +435,7 @@ namespace atomic_dex } void - orderbook_model::update_order(const mm2::order_contents& order) + orderbook_model::update_order(const kdf::order_contents& order) { if (const auto res = this->match(index(0, 0), UUIDRole, QString::fromStdString(order.uuid)); not res.isEmpty()) { @@ -525,7 +525,7 @@ namespace atomic_dex 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); - auto refresh_functor = [this](const std::vector& contents) + auto refresh_functor = [this](const std::vector& contents) { for (auto&& order: contents) { diff --git a/src/core/atomicdex/models/qt.orderbook.model.hpp b/src/core/atomicdex/models/qt.orderbook.model.hpp index debd89eba3..9f4b00a7d1 100644 --- a/src/core/atomicdex/models/qt.orderbook.model.hpp +++ b/src/core/atomicdex/models/qt.orderbook.model.hpp @@ -27,7 +27,7 @@ #include //! Project -#include "atomicdex/api/mm2/rpc_v2/rpc2.orderbook.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.orderbook.hpp" #include "atomicdex/models/qt.orderbook.proxy.model.hpp" namespace atomic_dex @@ -102,8 +102,8 @@ namespace atomic_dex void betterOrderDetected(QVariantMap order_object); private: - void initialize_order(const mm2::order_contents& order); - void update_order(const mm2::order_contents& order); + void initialize_order(const kdf::order_contents& order); + void update_order(const kdf::order_contents& order); QVariantMap get_order_from_uuid(QString uuid); void check_for_better_order(trading_page& trading_pg, const QVariantMap& preferred_order, std::string uuid); diff --git a/src/core/atomicdex/models/qt.orders.model.cpp b/src/core/atomicdex/models/qt.orders.model.cpp index 462d8f8d8d..a350068e9c 100644 --- a/src/core/atomicdex/models/qt.orders.model.cpp +++ b/src/core/atomicdex/models/qt.orders.model.cpp @@ -19,11 +19,11 @@ #include //! Project -#include "atomicdex/api/mm2/rpc_v1/rpc.recover_funds_of_swap.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.recover_funds_of_swap.hpp" #include "atomicdex/events/qt.events.hpp" #include "atomicdex/models/qt.orders.model.hpp" #include "atomicdex/pages/qt.settings.page.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" #include "atomicdex/utilities/qt.utilities.hpp" //! Constructor @@ -307,8 +307,8 @@ namespace atomic_dex SPDLOG_INFO("Current page: {}, new page: {}", m_model_data.current_page, current_page); this->set_fetching_busy(true); this->reset_backend("set_current_page"); ///< We change page, we need to clear, but do not notify the front-end - auto& mm2 = this->m_system_manager.get_system(); - mm2.set_orders_and_swaps_pagination_infos(static_cast(current_page), m_model_data.limit, m_model_data.filtering_infos); + auto& kdf = this->m_system_manager.get_system(); + kdf.set_orders_and_swaps_pagination_infos(static_cast(current_page), m_model_data.limit, m_model_data.filtering_infos); } } @@ -328,8 +328,8 @@ namespace atomic_dex { this->set_fetching_busy(true); this->reset_backend("set_limit_nb_elements"); ///< We change page, we need to clear, but do not notify the front-end - auto& mm2 = this->m_system_manager.get_system(); - mm2.set_orders_and_swaps_pagination_infos(m_model_data.current_page, static_cast(limit), m_model_data.filtering_infos); + auto& kdf = this->m_system_manager.get_system(); + kdf.set_orders_and_swaps_pagination_infos(m_model_data.current_page, static_cast(limit), m_model_data.filtering_infos); } else { @@ -397,9 +397,9 @@ namespace atomic_dex void orders_model::on_current_currency_changed([[maybe_unused]] const current_currency_changed&) { - auto& mm2 = m_system_manager.get_system(); + auto& kdf = m_system_manager.get_system(); - mm2.batch_fetch_orders_and_swap(); + kdf.batch_fetch_orders_and_swap(); } } // namespace atomic_dex @@ -444,8 +444,8 @@ namespace atomic_dex const QString& rel_coin = data(idx, OrdersRoles::RelCoinRole).toString(); m_dispatcher.trigger( contents.order_id, prev_value.toString(), new_value.toString(), base_coin, rel_coin, new_value_d.toString()); - auto& mm2 = m_system_manager.get_system(); - mm2.process_orderbook(true); + auto& kdf = m_system_manager.get_system(); + kdf.process_orderbook(true); } update_value(OrdersRoles::MakerPaymentIdRole, contents.maker_payment_id, idx, *this); update_value(OrdersRoles::TakerPaymentIdRole, contents.taker_payment_id, idx, *this); @@ -495,10 +495,10 @@ namespace atomic_dex } endInsertRows(); emit lengthChanged(); - if (m_system_manager.has_system()) + if (m_system_manager.has_system()) { SPDLOG_DEBUG("Swaps inserted, refreshing orderbook to get new max taker vol"); - this->m_system_manager.get_system().process_orderbook(true); + this->m_system_manager.get_system().process_orderbook(true); } SPDLOG_DEBUG("{} model size: {}", kind, rowCount()); } @@ -606,7 +606,7 @@ namespace atomic_dex if (m_model_data.current_page != contents.current_page) { - SPDLOG_INFO("Page is different from mm2 contents, force change"); + SPDLOG_INFO("Page is different from kdf contents, force change"); this->set_current_page(static_cast(contents.current_page)); } } @@ -662,8 +662,8 @@ namespace atomic_dex SPDLOG_INFO("Fetching busy skipping"); return; } - const auto& mm2 = m_system_manager.get_system(); - const auto contents = mm2.get_orders_and_swaps(); + const auto& kdf = m_system_manager.get_system(); + const auto contents = kdf.get_orders_and_swaps(); //! If model is empty let's init it once if (m_model_data.orders_and_swaps.empty()) @@ -695,14 +695,14 @@ namespace atomic_dex this->set_fetching_busy(true); this->reset(); // this->reset_backend("set_filtering_infos"); ///< We change page, we need to clear, but do not notify the front-end - if (this->m_system_manager.has_system()) + if (this->m_system_manager.has_system()) { - auto& mm2 = this->m_system_manager.get_system(); - mm2.set_orders_and_swaps_pagination_infos(m_model_data.current_page, m_model_data.limit, m_model_data.filtering_infos); + auto& kdf = this->m_system_manager.get_system(); + kdf.set_orders_and_swaps_pagination_infos(m_model_data.current_page, m_model_data.limit, m_model_data.filtering_infos); } else { - SPDLOG_WARN("MM2 is not available, skipping orders and swaps pagination reset"); + SPDLOG_WARN("KDF is not available, skipping orders and swaps pagination reset"); } } else @@ -721,11 +721,11 @@ namespace atomic_dex orders_model::recover_fund(QString uuid) { this->set_recover_fund_busy(true); - auto& mm2_system = m_system_manager.get_system(); + auto& kdf_system = m_system_manager.get_system(); nlohmann::json batch = nlohmann::json::array(); - nlohmann::json json_data = mm2::template_request("recover_funds_of_swap"); - mm2::recover_funds_of_swap_request req{.swap_uuid = uuid.toStdString()}; - mm2::to_json(json_data, req); + nlohmann::json json_data = kdf::template_request("recover_funds_of_swap"); + kdf::recover_funds_of_swap_request req{.swap_uuid = uuid.toStdString()}; + kdf::to_json(json_data, req); batch.push_back(json_data); // json_data["userpass"] = "*****"; @@ -741,7 +741,7 @@ namespace atomic_dex if (resp.status_code() == web::http::status_codes::OK) { auto answers = nlohmann::json::parse(body); - auto recover_answer = mm2::rpc_process_answer_batch(answers[0], "recover_funds_of_swap"); + auto recover_answer = kdf::rpc_process_answer_batch(answers[0], "recover_funds_of_swap"); if (recover_answer.result.has_value()) { auto answer = recover_answer.result.value(); @@ -765,7 +765,7 @@ namespace atomic_dex else if (resp.status_code() == web::http::status_codes::RequestTimeout) { j_out["is_valid"] = false; - j_out["error"] = "Request to mm2 timeout - skipping"; + j_out["error"] = "Request to kdf timeout - skipping"; } else { @@ -793,6 +793,6 @@ namespace atomic_dex } }; - mm2_system.get_mm2_client().async_rpc_batch_standalone(batch).then(answer_functor).then(error_functor); + kdf_system.get_kdf_client().async_rpc_batch_standalone(batch).then(answer_functor).then(error_functor); } } // namespace atomic_dex diff --git a/src/core/atomicdex/models/qt.orders.model.hpp b/src/core/atomicdex/models/qt.orders.model.hpp index e58568d05b..9623af8157 100644 --- a/src/core/atomicdex/models/qt.orders.model.hpp +++ b/src/core/atomicdex/models/qt.orders.model.hpp @@ -32,7 +32,7 @@ #include //! Project -#include "atomicdex/api/mm2/mm2.hpp" +#include "atomicdex/api/kdf/kdf.hpp" #include "atomicdex/data/dex/orders.and.swaps.data.hpp" #include "atomicdex/events/events.hpp" #include "atomicdex/models/qt.orders.proxy.model.hpp" diff --git a/src/core/atomicdex/models/qt.portfolio.model.cpp b/src/core/atomicdex/models/qt.portfolio.model.cpp index 6c0b8bc922..f05d01f8f2 100644 --- a/src/core/atomicdex/models/qt.portfolio.model.cpp +++ b/src/core/atomicdex/models/qt.portfolio.model.cpp @@ -65,13 +65,13 @@ namespace atomic_dex continue; } SPDLOG_INFO("initialize_portfolio for ticker: {}", ticker); - const auto& mm2_system = this->m_system_manager.get_system(); + const auto& kdf_system = this->m_system_manager.get_system(); const auto& price_service = this->m_system_manager.get_system(); const auto& provider = this->m_system_manager.get_system(); - auto coin = mm2_system.get_coin_info(ticker); + auto coin = kdf_system.get_coin_info(ticker); SPDLOG_INFO("Building portfolio for ticker {}", coin.ticker); std::error_code ec; - std::string balance = mm2_system.get_balance_info(coin.ticker, ec); + std::string balance = kdf_system.get_balance_info(coin.ticker, ec); SPDLOG_INFO("balance for ticker {}: {}", coin.ticker, balance); const QString change_24h = retrieve_change_24h(provider, coin, *m_config, m_system_manager); portfolio_data data{ @@ -89,7 +89,7 @@ namespace atomic_dex .price_provider = QString::fromStdString(provider.get_price_provider(coin.ticker)), .price_last_timestamp = static_cast(provider.get_last_price_timestamp(coin.ticker)), .is_excluded = false, - .public_address = QString::fromStdString(mm2_system.address(coin.ticker, ec))}; + .public_address = QString::fromStdString(kdf_system.address(coin.ticker, ec))}; // data.percent_main_currency = percent_functor(data.main_currency_balance); data.display = QString::fromStdString(coin.gui_ticker) + " (" + data.balance + ")"; data.ticker_and_name = QString::fromStdString(coin.gui_ticker) + data.name; @@ -111,7 +111,7 @@ namespace atomic_dex { // This feels a bit heavy handed. There should be a better way to do this. // Function may be unused. - const auto& mm2_system = this->m_system_manager.get_system(); + const auto& kdf_system = this->m_system_manager.get_system(); const auto coins = this->m_system_manager.get_system().get_global_cfg()->get_enabled_coins(); for (auto&& [_, coin]: coins) @@ -127,7 +127,7 @@ namespace atomic_dex { std::error_code ec; const QModelIndex& idx = res.at(0); - auto coin_info = mm2_system.get_coin_info(ticker); + auto coin_info = kdf_system.get_coin_info(ticker); 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); @@ -138,7 +138,7 @@ namespace atomic_dex bool portfolio_model::update_currency_values() { - const auto& mm2_system = this->m_system_manager.get_system(); + const auto& kdf_system = this->m_system_manager.get_system(); const auto& price_service = this->m_system_manager.get_system(); const auto& provider = this->m_system_manager.get_system(); const auto coins = this->m_system_manager.get_system().get_global_cfg()->get_enabled_coins(); @@ -171,7 +171,7 @@ namespace atomic_dex update_value(LastPriceTimestamp, last_price_timestamp, idx, *this); QString change24_h = retrieve_change_24h(provider, coin, *m_config, m_system_manager); update_value(Change24H, change24_h, idx, *this); - const QString balance = QString::fromStdString(mm2_system.get_balance_info(coin.ticker, ec)); + const QString balance = QString::fromStdString(kdf_system.get_balance_info(coin.ticker, ec)); auto&& [prev_balance, new_balance, is_change_b] = update_value(BalanceRole, balance, idx, *this); const QString display = QString::fromStdString(coin.ticker) + " (" + balance + ")"; update_value(Display, display, idx, *this); @@ -183,7 +183,7 @@ namespace atomic_dex QJsonArray trend = nlohmann_json_array_to_qt_json_array(provider.get_ticker_historical(ticker)); update_value(Trend7D, trend, idx, *this); - auto coin_info = mm2_system.get_coin_info(ticker); + auto coin_info = kdf_system.get_coin_info(ticker); QJsonObject status = nlohmann_json_object_to_qt_json_object(coin_info.activation_status); update_value(ActivationStatus, status, idx, *this); // SPDLOG_DEBUG("updated currency values of: {}", ticker); @@ -211,7 +211,7 @@ namespace atomic_dex if (const auto res = this->match(this->index(0, 0), TickerRole, QString::fromStdString(ticker), 1, Qt::MatchFlag::MatchExactly); not res.isEmpty()) { // SPDLOG_DEBUG("Updating balance values of: {}", ticker); - const auto& mm2_system = this->m_system_manager.get_system(); + const auto& kdf_system = this->m_system_manager.get_system(); const auto* global_cfg = this->m_system_manager.get_system().get_global_cfg(); const auto coin = global_cfg->get_coin_info(ticker); const auto& price_service = this->m_system_manager.get_system(); @@ -220,7 +220,7 @@ namespace atomic_dex const std::string& currency = m_config->current_currency; const std::string& fiat = m_config->current_fiat; const QModelIndex& idx = res.at(0); - const QString balance = QString::fromStdString(mm2_system.get_balance_info(ticker, ec)); + const QString balance = QString::fromStdString(kdf_system.get_balance_info(ticker, ec)); auto&& [prev_balance, new_balance, is_change_b] = update_value(BalanceRole, balance, idx, *this); const QString main_currency_balance_value = QString::fromStdString(price_service.get_price_in_fiat(currency, ticker, ec)); auto&& [_1, _2, is_change_mc] = update_value(MainCurrencyBalanceRole, main_currency_balance_value, idx, *this); @@ -242,10 +242,10 @@ namespace atomic_dex } QJsonArray trend = nlohmann_json_array_to_qt_json_array(provider.get_ticker_historical(ticker)); update_value(Trend7D, trend, idx, *this); - auto coin_info = mm2_system.get_coin_info(ticker); + auto coin_info = kdf_system.get_coin_info(ticker); QJsonObject status = nlohmann_json_object_to_qt_json_object(coin_info.activation_status); update_value(ActivationStatus, status, idx, *this); - if (ticker == mm2_system.get_current_ticker() && (is_change_b || is_change_mc || is_change_mcpfo)) + if (ticker == kdf_system.get_current_ticker() && (is_change_b || is_change_mc || is_change_mcpfo)) { m_system_manager.get_system().refresh_ticker_infos(); } diff --git a/src/core/atomicdex/models/qt.portfolio.model.hpp b/src/core/atomicdex/models/qt.portfolio.model.hpp index c832c737f7..f92c6bff27 100644 --- a/src/core/atomicdex/models/qt.portfolio.model.hpp +++ b/src/core/atomicdex/models/qt.portfolio.model.hpp @@ -32,7 +32,7 @@ #include "atomicdex/data/wallet/qt.portfolio.data.hpp" #include "atomicdex/events/events.hpp" #include "atomicdex/models/qt.portfolio.proxy.filter.model.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" namespace atomic_dex { diff --git a/src/core/atomicdex/models/transactions_model.cpp b/src/core/atomicdex/models/transactions_model.cpp index 9ee44684e7..7476bd914c 100644 --- a/src/core/atomicdex/models/transactions_model.cpp +++ b/src/core/atomicdex/models/transactions_model.cpp @@ -137,8 +137,8 @@ namespace atomic_dex { const auto& currency = this->m_system_manager.get_system().get_cfg().current_currency; const auto& price_service = this->m_system_manager.get_system(); - const auto& mm2_system = this->m_system_manager.get_system(); - return QString::fromStdString(price_service.get_price_as_currency_from_tx(currency, mm2_system.get_current_ticker(), item)); + const auto& kdf_system = this->m_system_manager.get_system(); + return QString::fromStdString(price_service.get_price_as_currency_from_tx(currency, kdf_system.get_current_ticker(), item)); } case TxHashRole: return QString::fromStdString(item.tx_hash); @@ -148,8 +148,8 @@ namespace atomic_dex { const auto& currency = this->m_system_manager.get_system().get_cfg().current_currency; const auto& price_service = this->m_system_manager.get_system(); - const auto& mm2_system = this->m_system_manager.get_system(); - const auto& fee_ticker = mm2_system.get_coin_info(mm2_system.get_current_ticker()).fees_ticker; + const auto& kdf_system = this->m_system_manager.get_system(); + const auto& fee_ticker = kdf_system.get_coin_info(kdf_system.get_current_ticker()).fees_ticker; return QString::fromStdString(price_service.get_price_as_currency_from_amount(currency, fee_ticker, item.fees)); } case FromRole: diff --git a/src/core/atomicdex/models/transactions_model.hpp b/src/core/atomicdex/models/transactions_model.hpp index 7e40de0728..9c444508ab 100644 --- a/src/core/atomicdex/models/transactions_model.hpp +++ b/src/core/atomicdex/models/transactions_model.hpp @@ -20,7 +20,7 @@ #include #include "transactions_proxy_model.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" namespace atomic_dex { diff --git a/src/core/atomicdex/pages/qt.portfolio.page.cpp b/src/core/atomicdex/pages/qt.portfolio.page.cpp index 6969e28ff1..d958da5861 100644 --- a/src/core/atomicdex/pages/qt.portfolio.page.cpp +++ b/src/core/atomicdex/pages/qt.portfolio.page.cpp @@ -169,7 +169,7 @@ namespace atomic_dex m_current_chart_category = category; QSettings& settings = entity_registry_.ctx(); settings.setValue("WalletChartsCategory", qint32(m_current_chart_category)); - if (m_system_manager.get_system().is_mm2_running() && m_system_manager.has_system()) + 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.settings.page.cpp b/src/core/atomicdex/pages/qt.settings.page.cpp index e8a74389bb..c285890326 100644 --- a/src/core/atomicdex/pages/qt.settings.page.cpp +++ b/src/core/atomicdex/pages/qt.settings.page.cpp @@ -26,7 +26,7 @@ // Project Headers #include "atomicdex/constants/dex.constants.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.get_public_key.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.get_public_key.hpp" #include "atomicdex/config/enable.cfg.hpp" #include "atomicdex/events/events.hpp" #include "atomicdex/managers/qt.wallet.manager.hpp" @@ -34,7 +34,7 @@ #include "atomicdex/pages/qt.portfolio.page.hpp" #include "atomicdex/pages/qt.settings.page.hpp" #include "atomicdex/pages/qt.wallet.page.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" #include "atomicdex/services/price/coingecko/coingecko.wallet.charts.hpp" #include "atomicdex/services/price/global.provider.hpp" #include "atomicdex/utilities/global.utilities.hpp" @@ -217,9 +217,9 @@ namespace atomic_dex if (m_config.spamfilter_enabled != is_enabled) { - auto& mm2 = m_system_manager.get_system(); + auto& kdf = m_system_manager.get_system(); auto& wallet_pg = m_system_manager.get_system(); - QString ticker = QString::fromStdString(mm2.get_current_ticker()); + QString ticker = QString::fromStdString(kdf.get_current_ticker()); change_spamfilter_status(m_config, is_enabled); emit onSpamFilterEnabledChanged(); wallet_pg.set_current_ticker(ticker, true); @@ -453,12 +453,12 @@ namespace atomic_dex bool settings_page::is_this_ticker_present_in_raw_cfg(const QString& ticker) const { - return m_system_manager.get_system().is_this_ticker_present_in_raw_cfg(ticker.toStdString()); + return m_system_manager.get_system().is_this_ticker_present_in_raw_cfg(ticker.toStdString()); } bool settings_page::is_this_ticker_present_in_normal_cfg(const QString& ticker) const { - return m_system_manager.get_system().is_this_ticker_present_in_normal_cfg(ticker.toStdString()); + return m_system_manager.get_system().is_this_ticker_present_in_normal_cfg(ticker.toStdString()); } QString settings_page::get_custom_coins_icons_path() const @@ -477,7 +477,7 @@ namespace atomic_dex { std::string body = TO_STD_STR(resp.extract_string(true).get()); nlohmann::json out = nlohmann::json::object(); - out["mm2_cfg"] = nlohmann::json::object(); + out["kdf_cfg"] = nlohmann::json::object(); out["adex_cfg"] = nlohmann::json::object(); if (resp.status_code() == 200) { @@ -487,32 +487,32 @@ namespace atomic_dex out["ticker"] = ticker; out["name"] = name_lowercase; copy_icon(icon_filepath, get_custom_coins_icons_path(), atomic_dex::utils::retrieve_main_ticker(ticker)); - const auto& mm2 = this->m_system_manager.get_system(); - nlohmann::json qtum_cfg = mm2.get_raw_mm2_ticker_cfg("QTUM"); + const auto& kdf = this->m_system_manager.get_system(); + nlohmann::json qtum_cfg = kdf.get_raw_kdf_ticker_cfg("QTUM"); if (not is_this_ticker_present_in_raw_cfg(QString::fromStdString(ticker))) { - out["mm2_cfg"]["protocol"] = nlohmann::json::object(); - out["mm2_cfg"]["protocol"]["type"] = "QRC20"; - out["mm2_cfg"]["protocol"]["protocol_data"] = nlohmann::json::object(); - out["mm2_cfg"]["protocol"]["protocol_data"]["platform"] = "QTUM"; + out["kdf_cfg"]["protocol"] = nlohmann::json::object(); + out["kdf_cfg"]["protocol"]["type"] = "QRC20"; + out["kdf_cfg"]["protocol"]["protocol_data"] = nlohmann::json::object(); + out["kdf_cfg"]["protocol"]["protocol_data"]["platform"] = "QTUM"; std::string out_address = "0x" + contract_address.toStdString(); - out["mm2_cfg"]["protocol"]["protocol_data"]["contract_address"] = out_address; - out["mm2_cfg"]["coin"] = ticker; - // out["mm2_cfg"]["gui_coin"] = ticker; - out["mm2_cfg"]["mm2"] = 1; + out["kdf_cfg"]["protocol"]["protocol_data"]["contract_address"] = out_address; + out["kdf_cfg"]["coin"] = ticker; + // out["kdf_cfg"]["gui_coin"] = ticker; + out["kdf_cfg"]["kdf"] = 1; if (body_json.at("qrc20").contains("decimals")) { - out["mm2_cfg"]["decimals"] = body_json.at("qrc20").at("decimals").get(); + out["kdf_cfg"]["decimals"] = body_json.at("qrc20").at("decimals").get(); } - out["mm2_cfg"]["txfee"] = qtum_cfg["txfee"]; - out["mm2_cfg"]["pubtype"] = qtum_cfg["pubtype"]; - out["mm2_cfg"]["p2shtype"] = qtum_cfg["p2shtype"]; - out["mm2_cfg"]["wiftype"] = qtum_cfg["wiftype"]; - out["mm2_cfg"]["name"] = qtum_cfg["name"]; - out["mm2_cfg"]["rpcport"] = qtum_cfg["rpcport"]; - out["mm2_cfg"]["segwit"] = qtum_cfg["segwit"]; - out["mm2_cfg"]["required_confirmations"] = 3; - out["mm2_cfg"]["fname"] = name_lowercase; + out["kdf_cfg"]["txfee"] = qtum_cfg["txfee"]; + out["kdf_cfg"]["pubtype"] = qtum_cfg["pubtype"]; + out["kdf_cfg"]["p2shtype"] = qtum_cfg["p2shtype"]; + out["kdf_cfg"]["wiftype"] = qtum_cfg["wiftype"]; + out["kdf_cfg"]["name"] = qtum_cfg["name"]; + out["kdf_cfg"]["rpcport"] = qtum_cfg["rpcport"]; + out["kdf_cfg"]["segwit"] = qtum_cfg["segwit"]; + out["kdf_cfg"]["required_confirmations"] = 3; + out["kdf_cfg"]["fname"] = name_lowercase; } if (not is_this_ticker_present_in_normal_cfg(QString::fromStdString(ticker))) { @@ -527,17 +527,17 @@ namespace atomic_dex out["adex_cfg"][ticker]["active"] = true; out["adex_cfg"][ticker]["currently_enabled"] = false; out["adex_cfg"][ticker]["is_custom_coin"] = true; - if (not out.at("mm2_cfg").empty()) + if (not out.at("kdf_cfg").empty()) { - SPDLOG_INFO("mm2_cfg found, backup from new cfg"); - out["adex_cfg"][ticker]["mm2_backup"] = out["mm2_cfg"]; + SPDLOG_INFO("kdf_cfg found, backup from new cfg"); + out["adex_cfg"][ticker]["kdf_backup"] = out["kdf_cfg"]; } else { - if (mm2.is_this_ticker_present_in_raw_cfg(ticker)) + if (kdf.is_this_ticker_present_in_raw_cfg(ticker)) { - SPDLOG_INFO("mm2_cfg not found backup {} cfg from current cfg", ticker); - out["adex_cfg"][ticker]["mm2_backup"] = mm2.get_raw_mm2_ticker_cfg(ticker); + SPDLOG_INFO("kdf_cfg not found backup {} cfg from current cfg", ticker); + out["adex_cfg"][ticker]["kdf_backup"] = kdf.get_raw_kdf_ticker_cfg(ticker); } } } @@ -551,7 +551,7 @@ namespace atomic_dex this->set_custom_token_data(nlohmann_json_object_to_qt_json_object(out)); this->set_fetching_custom_token_data_busy(false); }; - mm2::async_process_rpc_get(mm2::g_qtum_proxy_http_client, "qrc_infos", url).then(answer_functor).then(&handle_exception_pplx_task); + kdf::async_process_rpc_get(kdf::g_qtum_proxy_http_client, "qrc_infos", url).then(answer_functor).then(&handle_exception_pplx_task); } void settings_page::process_token_add(const QString& contract_address, const QString& coingecko_id, const QString& icon_filepath, CoinType coin_type) @@ -565,17 +565,17 @@ namespace atomic_dex { // case CoinTypeGadget::QRC20: // return std::make_tuple( - // &mm2::g_qtum_proxy_http_client, "/contract/"s + contract_address.toStdString(), "QRC20"s, "QTUM"s, "QRC-20"s, "QTUM"s, "QRC20"s); + // &kdf::g_qtum_proxy_http_client, "/contract/"s + contract_address.toStdString(), "QRC20"s, "QTUM"s, "QRC-20"s, "QTUM"s, "QRC20"s); case CoinTypeGadget::ERC20: return std::make_tuple( - &mm2::g_etherscan_proxy_http_client, "/api/v1/token_infos/erc20/"s + contract_address.toStdString(), "ERC20"s, "ETH"s, "ERC-20"s, + &kdf::g_etherscan_proxy_http_client, "/api/v1/token_infos/erc20/"s + contract_address.toStdString(), "ERC20"s, "ETH"s, "ERC-20"s, "ETH"s, "ERC20"s); case CoinTypeGadget::BEP20: return std::make_tuple( - &mm2::g_etherscan_proxy_http_client, "/api/v1/token_infos/bep20/"s + contract_address.toStdString(), "BEP20"s, "BNB"s, "BEP-20"s, + &kdf::g_etherscan_proxy_http_client, "/api/v1/token_infos/bep20/"s + contract_address.toStdString(), "BEP20"s, "BNB"s, "BEP-20"s, "BNB"s, "ERC20"s); default: - return std::make_tuple(&mm2::g_etherscan_proxy_http_client, ""s, ""s, ""s, ""s, ""s, ""s); + return std::make_tuple(&kdf::g_etherscan_proxy_http_client, ""s, ""s, ""s, ""s, ""s, ""s); } }; auto&& [endpoint, url, type, platform, adex_platform, parent_chain, parent_type] = retrieve_functor_url(); @@ -586,17 +586,17 @@ namespace atomic_dex //! Extract answer std::string body = TO_STD_STR(resp.extract_string(true).get()); nlohmann::json out = nlohmann::json::object(); - out["mm2_cfg"] = nlohmann::json::object(); + out["kdf_cfg"] = nlohmann::json::object(); out["adex_cfg"] = nlohmann::json::object(); - const auto& mm2 = this->m_system_manager.get_system(); + const auto& kdf = this->m_system_manager.get_system(); if (resp.status_code() == 200) { - nlohmann::json raw_parent_cfg = mm2.get_raw_mm2_ticker_cfg(parent_chain); + nlohmann::json raw_parent_cfg = kdf.get_raw_kdf_ticker_cfg(parent_chain); nlohmann::json body_json = nlohmann::json::parse(body).at("result")[0]; const auto ticker = body_json.at("symbol").get() + "-" + type; const auto name_lowercase = body_json.at("tokenName").get(); - const auto& coin_info = mm2.get_coin_info(parent_chain); + const auto& coin_info = kdf.get_coin_info(parent_chain); std::string token_contract_address = contract_address.toStdString(); boost::algorithm::to_lower(token_contract_address); utils::to_eth_checksum(token_contract_address); @@ -606,22 +606,22 @@ namespace atomic_dex copy_icon(icon_filepath, get_custom_coins_icons_path(), atomic_dex::utils::retrieve_main_ticker(ticker)); if (not is_this_ticker_present_in_raw_cfg(QString::fromStdString(ticker))) { - out["mm2_cfg"]["protocol"] = nlohmann::json::object(); - out["mm2_cfg"]["protocol"]["type"] = parent_type; - out["mm2_cfg"]["protocol"]["protocol_data"] = nlohmann::json::object(); - out["mm2_cfg"]["protocol"]["protocol_data"]["platform"] = platform; - out["mm2_cfg"]["protocol"]["protocol_data"]["contract_address"] = token_contract_address; - out["mm2_cfg"]["rpcport"] = raw_parent_cfg.at("rpcport"); - out["mm2_cfg"]["coin"] = ticker; - out["mm2_cfg"]["mm2"] = 1; - out["mm2_cfg"]["decimals"] = std::stoi(body_json.at("divisor").get()); - out["mm2_cfg"]["avg_blocktime"] = raw_parent_cfg.at("avg_blocktime"); - out["mm2_cfg"]["required_confirmations"] = raw_parent_cfg.at("required_confirmations"); + out["kdf_cfg"]["protocol"] = nlohmann::json::object(); + out["kdf_cfg"]["protocol"]["type"] = parent_type; + out["kdf_cfg"]["protocol"]["protocol_data"] = nlohmann::json::object(); + out["kdf_cfg"]["protocol"]["protocol_data"]["platform"] = platform; + out["kdf_cfg"]["protocol"]["protocol_data"]["contract_address"] = token_contract_address; + out["kdf_cfg"]["rpcport"] = raw_parent_cfg.at("rpcport"); + out["kdf_cfg"]["coin"] = ticker; + out["kdf_cfg"]["kdf"] = 1; + out["kdf_cfg"]["decimals"] = std::stoi(body_json.at("divisor").get()); + out["kdf_cfg"]["avg_blocktime"] = raw_parent_cfg.at("avg_blocktime"); + out["kdf_cfg"]["required_confirmations"] = raw_parent_cfg.at("required_confirmations"); if (raw_parent_cfg.contains("chain_id")) { - out["mm2_cfg"]["chain_id"] = raw_parent_cfg.at("chain_id"); + out["kdf_cfg"]["chain_id"] = raw_parent_cfg.at("chain_id"); } - out["mm2_cfg"]["name"] = name_lowercase; + out["kdf_cfg"]["name"] = name_lowercase; } if (not is_this_ticker_present_in_normal_cfg(QString::fromStdString(ticker))) { @@ -663,7 +663,7 @@ namespace atomic_dex out["adex_cfg"][ticker]["fname"] = name_lowercase; out["adex_cfg"][ticker]["is_testnet"] = false; out["adex_cfg"][ticker]["currently_enabled"] = false; - out["adex_cfg"][ticker]["mm2"] = 1; + out["adex_cfg"][ticker]["kdf"] = 1; out["adex_cfg"][ticker]["name"] = name_lowercase; out["adex_cfg"][ticker]["nodes"] = coin_info.urls.value_or(std::vector()); out["adex_cfg"][ticker]["parent_coin"] = parent_chain; @@ -688,21 +688,21 @@ namespace atomic_dex this->set_custom_token_data(nlohmann_json_object_to_qt_json_object(out)); this->set_fetching_custom_token_data_busy(false); }; - mm2::async_process_rpc_get(*endpoint, "token_infos", url).then(answer_functor).then(&handle_exception_pplx_task); + kdf::async_process_rpc_get(*endpoint, "token_infos", url).then(answer_functor).then(&handle_exception_pplx_task); } void settings_page::submit() { SPDLOG_DEBUG("submit whole cfg"); nlohmann::json out = m_custom_token_data.get(); - this->m_system_manager.get_system().add_new_coin(out.at("adex_cfg"), out.at("mm2_cfg")); + this->m_system_manager.get_system().add_new_coin(out.at("adex_cfg"), out.at("kdf_cfg")); this->set_custom_token_data(QJsonObject{{}}); } void settings_page::remove_custom_coin(const QString& ticker) { SPDLOG_DEBUG("remove ticker: {}", ticker.toStdString()); - this->m_system_manager.get_system().remove_custom_coin(ticker.toStdString()); + this->m_system_manager.get_system().remove_custom_coin(ticker.toStdString()); } void settings_page::set_qml_engine(QQmlApplicationEngine* engine) @@ -743,12 +743,12 @@ namespace atomic_dex const auto coins = cfg_mdl->get_enabled_coins(); for (auto&& [coin, coin_cfg]: coins) { - mm2::show_priv_key_request req{.coin = coin}; - nlohmann::json req_json = mm2::template_request("show_priv_key"); + kdf::show_priv_key_request req{.coin = coin}; + nlohmann::json req_json = kdf::template_request("show_priv_key"); to_json(req_json, req); batch.push_back(req_json); } - auto& mm2_system = m_system_manager.get_system(); + auto& kdf_system = m_system_manager.get_system(); const auto answer_functor = [this](web::http::http_response resp) { std::string body = TO_STD_STR(resp.extract_string(true).get()); @@ -759,7 +759,7 @@ namespace atomic_dex SPDLOG_WARN("Priv keys fetched, those are sensitive data."); for (auto&& answer: answers) { - auto show_priv_key_answer = mm2::rpc_process_answer_batch(answer, "show_priv_key"); + auto show_priv_key_answer = kdf::rpc_process_answer_batch(answer, "show_priv_key"); auto* portfolio_mdl = this->m_system_manager.get_system().get_portfolio(); const auto idx = portfolio_mdl->match( portfolio_mdl->index(0, 0), portfolio_model::TickerRole, QString::fromStdString(show_priv_key_answer.coin), 1, @@ -768,16 +768,16 @@ namespace atomic_dex { update_value(portfolio_model::PrivKey, QString::fromStdString(show_priv_key_answer.priv_key), idx.at(0), *portfolio_mdl); std::error_code ec; - QString public_address = QString::fromStdString(m_system_manager.get_system().address(show_priv_key_answer.coin, ec)); + QString public_address = QString::fromStdString(m_system_manager.get_system().address(show_priv_key_answer.coin, ec)); update_value(portfolio_model::Address, public_address, idx.at(0), *portfolio_mdl); } } } this->set_fetching_priv_key_busy(false); }; - mm2_system.get_mm2_client().async_rpc_batch_standalone(batch).then(answer_functor); + kdf_system.get_kdf_client().async_rpc_batch_standalone(batch).then(answer_functor); } - return {QString::fromStdString(seed), QString::fromStdString(mm2::get_rpc_password())}; + return {QString::fromStdString(seed), QString::fromStdString(kdf::get_rpc_password())}; } QString settings_page::get_version() @@ -790,9 +790,9 @@ namespace atomic_dex return QString::fromStdString(utils::get_atomic_dex_logs_folder().string()); } - QString settings_page::get_mm2_version() + QString settings_page::get_kdf_version() { - return QString::fromStdString(mm2::rpc_version()); + return QString::fromStdString(kdf::rpc_version()); } QString settings_page::get_rpcport() @@ -802,7 +802,7 @@ namespace atomic_dex QString settings_page::get_peerid() { - return QString::fromStdString(mm2::peer_id()); + return QString::fromStdString(kdf::peer_id()); } QString settings_page::get_export_folder() @@ -812,7 +812,7 @@ namespace atomic_dex void settings_page::fetchPublicKey() { - auto& mm2_system = m_system_manager.get_system(); + auto& kdf_system = m_system_manager.get_system(); auto get_pub_key_rpc_callback = [this](auto pub_key_rpc) { if (pub_key_rpc.error) @@ -827,6 +827,6 @@ namespace atomic_dex fetching_public_key = true; emit fetchingPublicKeyChanged(); - mm2_system.get_mm2_client().process_rpc_async(get_pub_key_rpc_callback); + kdf_system.get_kdf_client().process_rpc_async(get_pub_key_rpc_callback); } } // namespace atomic_dex diff --git a/src/core/atomicdex/pages/qt.settings.page.hpp b/src/core/atomicdex/pages/qt.settings.page.hpp index fa37ddd804..9fc117a99e 100644 --- a/src/core/atomicdex/pages/qt.settings.page.hpp +++ b/src/core/atomicdex/pages/qt.settings.page.hpp @@ -127,7 +127,7 @@ namespace atomic_dex Q_INVOKABLE void process_qrc_20_token_add(const QString& contract_address, const QString& coingecko_id, const QString& icon_filepath); Q_INVOKABLE void submit(); Q_INVOKABLE QStringList retrieve_seed(const QString& wallet_name, const QString& password); - Q_INVOKABLE static QString get_mm2_version(); + Q_INVOKABLE static QString get_kdf_version(); Q_INVOKABLE static QString get_peerid(); Q_INVOKABLE static QString get_rpcport(); Q_INVOKABLE static QString get_log_folder(); diff --git a/src/core/atomicdex/pages/qt.trading.page.cpp b/src/core/atomicdex/pages/qt.trading.page.cpp index 4ee89c213f..9becdbea25 100644 --- a/src/core/atomicdex/pages/qt.trading.page.cpp +++ b/src/core/atomicdex/pages/qt.trading.page.cpp @@ -19,15 +19,15 @@ #include //! Project Headers -#include "atomicdex/api/mm2/rpc_v1/rpc.buy.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.sell.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.setprice.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.trade_preimage.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.buy.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.sell.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.setprice.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.trade_preimage.hpp" #include "atomicdex/pages/qt.portfolio.page.hpp" #include "atomicdex/pages/qt.settings.page.hpp" #include "atomicdex/pages/qt.trading.page.hpp" -#include "atomicdex/services/mm2/auto.update.maker.order.service.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/services/kdf/auto.update.maker.order.service.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" #include "atomicdex/services/price/defi.stats.hpp" #include "atomicdex/services/price/global.provider.hpp" #include "atomicdex/utilities/qt.utilities.hpp" @@ -68,10 +68,10 @@ namespace atomic_dex namespace atomic_dex { QVariant - trading_page::get_raw_mm2_coin_cfg(const QString& ticker) const + trading_page::get_raw_kdf_coin_cfg(const QString& ticker) const { QVariant out; - nlohmann::json j = m_system_manager.get_system().get_raw_mm2_ticker_cfg(ticker.toStdString()); + nlohmann::json j = m_system_manager.get_system().get_raw_kdf_ticker_cfg(ticker.toStdString()); out = nlohmann_json_object_to_qt_json_object(j); return out; } @@ -83,7 +83,7 @@ namespace atomic_dex { return; } - if (bool is_wallet_only = m_system_manager.get_system().get_coin_info(base.toStdString()).wallet_only; is_wallet_only) + if (bool is_wallet_only = m_system_manager.get_system().get_coin_info(base.toStdString()).wallet_only; is_wallet_only) { // SPDLOG_WARN("{} is wallet only - skipping", base.toStdString()); return; @@ -104,7 +104,7 @@ namespace atomic_dex this->clear_forms("set_current_orderbook"); } - emit mm2MinTradeVolChanged(); + emit kdfMinTradeVolChanged(); dispatcher_.trigger(base.toStdString(), rel.toStdString()); } @@ -125,7 +125,7 @@ namespace atomic_dex { SPDLOG_DEBUG("Enter DEX"); dispatcher_.trigger(); - if (this->m_system_manager.has_system() && m_system_manager.get_system().is_orderbook_thread_active()) + if (this->m_system_manager.has_system() && m_system_manager.get_system().is_orderbook_thread_active()) { this->m_system_manager.get_system().force_update(); } @@ -144,7 +144,7 @@ namespace atomic_dex this->set_buy_sell_rpc_busy(true); this->set_buy_sell_last_rpc_data(QJsonObject{{}}); - auto& mm2_system = m_system_manager.get_system(); + auto& kdf_system = m_system_manager.get_system(); const auto* market_selector = get_market_pairs_mdl(); const auto& base = market_selector->get_left_selected_coin(); const auto& rel = market_selector->get_right_selected_coin(); @@ -163,8 +163,8 @@ namespace atomic_dex }; nlohmann::json batch; - nlohmann::json setprice_request = mm2::template_request("setprice"); - mm2::to_json(setprice_request, req); + nlohmann::json setprice_request = kdf::template_request("setprice"); + kdf::to_json(setprice_request, req); batch.push_back(setprice_request); setprice_request["userpass"] = "*******"; @@ -180,9 +180,9 @@ namespace atomic_dex auto answers = nlohmann::json::parse(body); nlohmann::json answer = answers[0]; this->set_buy_sell_last_rpc_data(nlohmann_json_object_to_qt_json_object(answer)); - auto& cur_mm2_system = m_system_manager.get_system(); + auto& cur_kdf_system = m_system_manager.get_system(); SPDLOG_DEBUG("order successfully placed, refreshing orders and swap"); - cur_mm2_system.batch_fetch_orders_and_swap(); + cur_kdf_system.batch_fetch_orders_and_swap(); } else { @@ -201,7 +201,7 @@ namespace atomic_dex }; //! Async call - mm2_system.get_mm2_client() + kdf_system.get_kdf_client() .async_rpc_batch_standalone(batch) .then(answer_functor) .then( @@ -228,7 +228,7 @@ namespace atomic_dex this->set_buy_sell_rpc_busy(true); this->set_buy_sell_last_rpc_data(QJsonObject{{}}); - auto& mm2_system = m_system_manager.get_system(); + auto& kdf_system = m_system_manager.get_system(); const auto* market_selector = get_market_pairs_mdl(); const auto& base = market_selector->get_left_selected_coin(); const auto& rel = market_selector->get_right_selected_coin(); @@ -307,8 +307,8 @@ namespace atomic_dex } nlohmann::json batch; - nlohmann::json buy_request = mm2::template_request("buy"); - mm2::to_json(buy_request, req); + nlohmann::json buy_request = kdf::template_request("buy"); + kdf::to_json(buy_request, req); batch.push_back(buy_request); buy_request["userpass"] = "*******"; @@ -324,9 +324,9 @@ namespace atomic_dex auto answers = nlohmann::json::parse(body); nlohmann::json answer = answers[0]; this->set_buy_sell_last_rpc_data(nlohmann_json_object_to_qt_json_object(answer)); - auto& cur_mm2_system = m_system_manager.get_system(); + auto& cur_kdf_system = m_system_manager.get_system(); SPDLOG_DEBUG("order successfully placed, refreshing orders and swap"); - cur_mm2_system.batch_fetch_orders_and_swap(); + cur_kdf_system.batch_fetch_orders_and_swap(); } else { @@ -345,7 +345,7 @@ namespace atomic_dex }; //! Async call - mm2_system.get_mm2_client() + kdf_system.get_kdf_client() .async_rpc_batch_standalone(batch) .then(answer_functor) .then( @@ -372,7 +372,7 @@ namespace atomic_dex this->set_buy_sell_rpc_busy(true); this->set_buy_sell_last_rpc_data(QJsonObject{{}}); - auto& mm2_system = m_system_manager.get_system(); + auto& kdf_system = m_system_manager.get_system(); const auto* market_selector = get_market_pairs_mdl(); const auto& base = market_selector->get_left_selected_coin(); const auto& rel = market_selector->get_right_selected_coin(); @@ -475,8 +475,8 @@ namespace atomic_dex } nlohmann::json batch; - nlohmann::json sell_request = mm2::template_request("sell"); - mm2::to_json(sell_request, req); + nlohmann::json sell_request = kdf::template_request("sell"); + kdf::to_json(sell_request, req); batch.push_back(sell_request); sell_request["userpass"] = "******"; @@ -493,9 +493,9 @@ namespace atomic_dex auto answers = nlohmann::json::parse(body); nlohmann::json answer = answers[0]; this->set_buy_sell_last_rpc_data(nlohmann_json_object_to_qt_json_object(answer)); - auto& cur_mm2_system = m_system_manager.get_system(); + auto& cur_kdf_system = m_system_manager.get_system(); // SPDLOG_DEBUG("order successfully placed, refreshing orders and swap"); - cur_mm2_system.batch_fetch_orders_and_swap(); + cur_kdf_system.batch_fetch_orders_and_swap(); } else { @@ -513,7 +513,7 @@ namespace atomic_dex }; //! Async call - mm2_system.get_mm2_client() + kdf_system.get_kdf_client() .async_rpc_batch_standalone(batch) .then(answer_functor) .then( @@ -589,17 +589,17 @@ namespace atomic_dex { return; } - const auto& mm2_system = m_system_manager.get_system(); + const auto& kdf_system = m_system_manager.get_system(); trading_actions last_action; this->m_actions_queue.pop(last_action); - if (mm2_system.is_mm2_running()) + if (kdf_system.is_kdf_running()) { switch (last_action) { case trading_actions::post_process_orderbook_finished: { std::error_code ec; - mm2::orderbook_result_rpc result = mm2_system.get_orderbook(ec); + kdf::orderbook_result_rpc result = kdf_system.get_orderbook(ec); if (!ec) { @@ -805,9 +805,9 @@ namespace atomic_dex void trading_page::clear_forms(QString from) { - if (!this->m_system_manager.has_system()) + if (!this->m_system_manager.has_system()) { - SPDLOG_WARN("MM2 service not available, required to clear forms - skipping"); + SPDLOG_WARN("KDF service not available, required to clear forms - skipping"); return; } // SPDLOG_DEBUG("clearing forms : {}", from.toStdString()); @@ -1305,14 +1305,14 @@ namespace atomic_dex void trading_page::determine_fees() { - if (!this->m_system_manager.has_system()) + if (!this->m_system_manager.has_system()) { - SPDLOG_WARN("MM2 Service not available, cannot determine fees - skipping"); + SPDLOG_WARN("KDF Service not available, cannot determine fees - skipping"); return; } const auto* market_pair = get_market_pairs_mdl(); using namespace std::string_literals; - auto& mm2 = this->m_system_manager.get_system(); + auto& kdf = this->m_system_manager.get_system(); // TODO: there is a race condition that sometimes results in base == rel after switching base/rel tickers const auto base = market_pair->get_left_selected_coin().toStdString(); const auto rel = market_pair->get_right_selected_coin().toStdString(); @@ -1342,14 +1342,14 @@ namespace atomic_dex }; nlohmann::json batch; - nlohmann::json preimage_request = mm2::template_request("trade_preimage", true); - mm2::to_json(preimage_request, req); + nlohmann::json preimage_request = kdf::template_request("trade_preimage", true); + kdf::to_json(preimage_request, req); batch.push_back(preimage_request); preimage_request["userpass"] = "******"; // SPDLOG_DEBUG("trade_preimage request: {}", preimage_request.dump(4)); this->set_preimage_busy(true); - auto answer_functor = [this, &mm2](web::http::http_response resp) + auto answer_functor = [this, &kdf](web::http::http_response resp) { std::string body = TO_STD_STR(resp.extract_string(true).get()); // SPDLOG_INFO("[determine_fees] trade_preimage answer received: {}", body); @@ -1357,7 +1357,7 @@ namespace atomic_dex { auto answers = nlohmann::json::parse(body); nlohmann::json answer = answers[0]; - auto trade_preimage_answer = mm2::rpc_process_answer_batch(answer, "trade_preimage"); + auto trade_preimage_answer = kdf::rpc_process_answer_batch(answer, "trade_preimage"); if (trade_preimage_answer.error.has_value()) { auto error_answer = trade_preimage_answer.error.value(); @@ -1389,7 +1389,7 @@ namespace atomic_dex for (auto&& cur: success_answer.total_fees) { - if (!mm2.do_i_have_enough_funds(cur.at("coin").get(), safe_float(cur.at("required_balance").get()))) + if (!kdf.do_i_have_enough_funds(cur.at("coin").get(), safe_float(cur.at("required_balance").get()))) { fees["error_fees"] = atomic_dex::nlohmann_json_object_to_qt_json_object(cur); break; @@ -1402,14 +1402,14 @@ namespace atomic_dex } this->set_preimage_busy(false); }; - mm2.get_mm2_client().async_rpc_batch_standalone(batch).then(answer_functor).then(&handle_exception_pplx_task); + kdf.get_kdf_client().async_rpc_batch_standalone(batch).then(answer_functor).then(&handle_exception_pplx_task); } void trading_page::determine_error_cases() { // SPDLOG_DEBUG("determine_error_cases"); - if (!m_system_manager.has_system()) + if (!m_system_manager.has_system()) return; TradingError current_trading_error = TradingError::None; @@ -1421,42 +1421,42 @@ namespace atomic_dex const auto& rel_min_taker_vol = get_orderbook_wrapper()->get_rel_min_taker_vol().toStdString(); const auto regular_min_taker_vol = m_market_mode == MarketMode::Sell ? get_min_trade_vol().toStdString() : rel_min_taker_vol; const auto& cur_min_taker_vol = get_min_trade_vol().toStdString(); - const auto& mm2 = m_system_manager.get_system(); - const auto left_cfg = mm2.get_coin_info(left); - const auto right_cfg = mm2.get_coin_info(right); + const auto& kdf = m_system_manager.get_system(); + const auto left_cfg = kdf.get_coin_info(left); + const auto right_cfg = kdf.get_coin_info(right); const bool has_preferred_order = m_preferred_order.has_value(); const bool is_selected_min_max = has_preferred_order && m_preferred_order->at("base_min_volume").get() == m_preferred_order->at("base_max_volume").get(); if (left_cfg.has_parent_fees_ticker && left_cfg.ticker != "QTUM") { - const auto left_fee_cfg = mm2.get_coin_info(left_cfg.fees_ticker); + const auto left_fee_cfg = kdf.get_coin_info(left_cfg.fees_ticker); if (!left_fee_cfg.currently_enabled) { current_trading_error = TradingError::LeftParentChainNotEnabled; } - else if (mm2.get_balance_info_f(left_fee_cfg.ticker) <= 0) + else if (kdf.get_balance_info_f(left_fee_cfg.ticker) <= 0) { current_trading_error = TradingError::LeftParentChainNotEnoughBalance; } } else if (right_cfg.has_parent_fees_ticker && right_cfg.ticker != "QTUM") { - const auto right_fee_cfg = mm2.get_coin_info(right_cfg.fees_ticker); + const auto right_fee_cfg = kdf.get_coin_info(right_cfg.fees_ticker); if (!right_fee_cfg.currently_enabled) { current_trading_error = TradingError::RightParentChainNotEnabled; } - else if (mm2.get_balance_info_f(right_fee_cfg.ticker) <= 0) + else if (kdf.get_balance_info_f(right_fee_cfg.ticker) <= 0) { current_trading_error = TradingError::RightParentChainNotEnoughBalance; } } - else if (!mm2.is_zhtlc_coin_ready(left)) + else if (!kdf.is_zhtlc_coin_ready(left)) { current_trading_error = TradingError::LeftZhtlcChainNotEnabled; } - else if (!mm2.is_zhtlc_coin_ready(right)) + else if (!kdf.is_zhtlc_coin_ready(right)) { current_trading_error = TradingError::RightZhtlcChainNotEnabled; } @@ -1620,12 +1620,12 @@ namespace atomic_dex trading_page::generate_fees_error(QVariantMap fees) const { TradingError last_trading_error = TradingError::None; - const auto& mm2 = m_system_manager.get_system(); + const auto& kdf = m_system_manager.get_system(); if (fees.contains("error_fees")) { auto&& cur_obj = fees.value("error_fees").toJsonObject(); - if (!mm2.do_i_have_enough_funds(cur_obj["coin"].toString().toStdString(), safe_float(cur_obj["required_balance"].toString().toStdString()))) + if (!kdf.do_i_have_enough_funds(cur_obj["coin"].toString().toStdString(), safe_float(cur_obj["required_balance"].toString().toStdString()))) { last_trading_error = TradingError::TotalFeesNotEnoughFunds; } diff --git a/src/core/atomicdex/pages/qt.trading.page.hpp b/src/core/atomicdex/pages/qt.trading.page.hpp index 4aaa14dedf..f750f82004 100644 --- a/src/core/atomicdex/pages/qt.trading.page.hpp +++ b/src/core/atomicdex/pages/qt.trading.page.hpp @@ -155,7 +155,7 @@ namespace atomic_dex //! Public QML API Q_INVOKABLE void on_gui_enter_dex(); Q_INVOKABLE void on_gui_leave_dex(); - Q_INVOKABLE QVariant get_raw_mm2_coin_cfg(const QString& ticker) const; + Q_INVOKABLE QVariant get_raw_kdf_coin_cfg(const QString& ticker) const; Q_INVOKABLE void clear_forms(QString from); //! Trading business @@ -255,7 +255,7 @@ namespace atomic_dex void invalidCexPriceChanged(); void priceReversedChanged(); void skipTakerChanged(); - void mm2MinTradeVolChanged(); + void kdfMinTradeVolChanged(); void minTradeVolChanged(); void selectedOrderStatusChanged(); void preferredOrderChangeFinished(); diff --git a/src/core/atomicdex/pages/qt.wallet.page.cpp b/src/core/atomicdex/pages/qt.wallet.page.cpp index 74056aa5e2..97fe857710 100644 --- a/src/core/atomicdex/pages/qt.wallet.page.cpp +++ b/src/core/atomicdex/pages/qt.wallet.page.cpp @@ -11,13 +11,13 @@ //! Project Headers #include "atomicdex/api/faucet/faucet.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.convertaddress.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.electrum.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.validateaddress.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.withdraw.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.task.withdraw.init.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.task.withdraw.status.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.convertaddress.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.electrum.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.validateaddress.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.withdraw.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.task.withdraw.init.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.task.withdraw.status.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" #include "atomicdex/services/price/global.provider.hpp" #include "atomicdex/services/price/komodo_prices/komodo.prices.provider.hpp" #include "atomicdex/utilities/qt.utilities.hpp" @@ -60,14 +60,14 @@ namespace atomic_dex wallet_page::check_send_availability() { // SPDLOG_DEBUG("check_send_availability"); - auto& mm2 = m_system_manager.get_system(); + auto& kdf = m_system_manager.get_system(); auto global_coins_cfg = m_system_manager.get_system().get_global_cfg(); - auto ticker_info = global_coins_cfg->get_coin_info(mm2.get_current_ticker()); + auto ticker_info = global_coins_cfg->get_coin_info(kdf.get_current_ticker()); m_send_available = true; m_send_availability_state = ""; m_current_ticker_fees_coin_enabled = true; - if (not mm2.get_balance_info_f(ticker_info.ticker) > 0) + if (not kdf.get_balance_info_f(ticker_info.ticker) > 0) { m_send_available = false; m_send_availability_state = tr("You do not have enough funds."); @@ -84,7 +84,7 @@ namespace atomic_dex tr("%1 is not activated: click on the button to enable it or enable it manually").arg(QString::fromStdString(parent_ticker_info.ticker)); m_current_ticker_fees_coin_enabled = false; } - else if (not mm2.get_balance_info_f(parent_ticker_info.ticker) > 0) + else if (not kdf.get_balance_info_f(parent_ticker_info.ticker) > 0) { m_send_available = false; m_send_availability_state = tr("You need to have %1 to pay the gas for %2 transactions.") @@ -104,20 +104,20 @@ namespace atomic_dex { QString wallet_page::get_current_ticker() const { - const auto& mm2_system = m_system_manager.get_system(); - return QString::fromStdString(mm2_system.get_current_ticker()); + const auto& kdf_system = m_system_manager.get_system(); + return QString::fromStdString(kdf_system.get_current_ticker()); } void wallet_page::set_current_ticker(const QString& ticker, bool force) { - auto& mm2_system = m_system_manager.get_system(); - auto coin_info = mm2_system.get_coin_info(ticker.toStdString()); - if (mm2_system.set_current_ticker(ticker.toStdString()) || force) + auto& kdf_system = m_system_manager.get_system(); + auto coin_info = kdf_system.get_coin_info(ticker.toStdString()); + if (kdf_system.set_current_ticker(ticker.toStdString()) || force) { SPDLOG_INFO("new ticker: {}", ticker.toStdString()); m_transactions_mdl->reset(); this->set_tx_fetching_busy(true); - mm2_system.fetch_infos_thread(true, true); + kdf_system.fetch_infos_thread(true, true); emit currentTickerChanged(); refresh_ticker_infos(); check_send_availability(); @@ -273,17 +273,17 @@ namespace atomic_dex {"qrcode_address", ""}, {"segwit_supported", false}}; std::error_code ec; - auto& mm2_system = m_system_manager.get_system(); - if (mm2_system.is_mm2_running()) + auto& kdf_system = m_system_manager.get_system(); + if (kdf_system.is_kdf_running()) { - // SPDLOG_DEBUG("get_ticker_infos for {} wallet page", mm2_system.get_current_ticker()); + // SPDLOG_DEBUG("get_ticker_infos for {} wallet page", kdf_system.get_current_ticker()); auto& price_service = m_system_manager.get_system(); const auto& settings_system = m_system_manager.get_system(); const auto& provider = m_system_manager.get_system(); - const auto& ticker = mm2_system.get_current_ticker(); - const auto& coin_info = mm2_system.get_coin_info(ticker); + const auto& ticker = kdf_system.get_current_ticker(); + const auto& coin_info = kdf_system.get_coin_info(ticker); const auto& config = settings_system.get_cfg(); - obj["balance"] = QString::fromStdString(mm2_system.get_balance_info(ticker, ec)); + obj["balance"] = QString::fromStdString(kdf_system.get_balance_info(ticker, ec)); obj["name"] = QString::fromStdString(coin_info.name); obj["type"] = QString::fromStdString(coin_info.type); obj["segwit_supported"] = coin_info.segwit; @@ -294,7 +294,7 @@ namespace atomic_dex obj["explorer_url"] = QString::fromStdString(coin_info.explorer_url); obj["current_currency_ticker_price"] = QString::fromStdString(price_service.get_rate_conversion(config.current_currency, ticker, true)); obj["change_24h"] = retrieve_change_24h(provider, coin_info, config, m_system_manager); - const auto& tx_state = mm2_system.get_tx_state(ec); + const auto& tx_state = kdf_system.get_tx_state(ec); obj["tx_state"] = QString::fromStdString(tx_state.state); obj["fiat_amount"] = QString::fromStdString(price_service.get_price_in_fiat(config.current_currency, ticker, ec)); obj["activation_status"] = nlohmann_json_object_to_qt_json_object(coin_info.activation_status); @@ -307,7 +307,7 @@ namespace atomic_dex obj["is_vote_coin"] = coin_info.is_vote_coin; std::error_code ec; - if (!mm2_system.is_zhtlc_coin_ready(coin_info.ticker)) + if (!kdf_system.is_zhtlc_coin_ready(coin_info.ticker)) { obj["address"] = "activating"; obj["qrcode_address"] = ""; @@ -315,8 +315,8 @@ namespace atomic_dex } else { - obj["address"] = QString::fromStdString(mm2_system.address(ticker, ec)); - qrcodegen::QrCode qr0 = qrcodegen::QrCode::encodeText(mm2_system.address(ticker, ec).c_str(), qrcodegen::QrCode::Ecc::MEDIUM); + obj["address"] = QString::fromStdString(kdf_system.address(ticker, ec)); + qrcodegen::QrCode qr0 = qrcodegen::QrCode::encodeText(kdf_system.address(ticker, ec).c_str(), qrcodegen::QrCode::Ecc::MEDIUM); std::string svg = qr0.toSvgString(2); obj["qrcode_address"] = QString::fromStdString("data:image/svg+xml;base64,") + QString::fromStdString(svg).toLocal8Bit().toBase64(); } @@ -513,9 +513,9 @@ namespace atomic_dex //! Preparation this->set_send_busy(true); nlohmann::json batch = nlohmann::json::array(); - auto& mm2_system = m_system_manager.get_system(); - const auto& ticker = mm2_system.get_current_ticker(); - auto coin_info = mm2_system.get_coin_info(ticker); + auto& kdf_system = m_system_manager.get_system(); + const auto& ticker = kdf_system.get_current_ticker(); + auto coin_info = kdf_system.get_coin_info(ticker); if (coin_info.is_zhtlc_family) { @@ -530,9 +530,9 @@ namespace atomic_dex .amount = json_fees.at("fees_amount").get() }; } - nlohmann::json json_data = mm2::template_request("task::withdraw::init", true); + nlohmann::json json_data = kdf::template_request("task::withdraw::init", true); - mm2::to_json(json_data, withdraw_init_req); + kdf::to_json(json_data, withdraw_init_req); batch.push_back(json_data); std::string amount_std = amount.toStdString(); @@ -540,7 +540,7 @@ namespace atomic_dex if (max) { std::error_code ec; - amount_std = mm2_system.get_balance_info(ticker, ec); + amount_std = kdf_system.get_balance_info(ticker, ec); } auto answer_functor = [this, coin_info, ticker, amount_std](web::http::http_response resp) @@ -548,7 +548,7 @@ namespace atomic_dex const auto& settings_system = m_system_manager.get_system(); const auto& global_price_system = m_system_manager.get_system(); const auto& current_fiat = settings_system.get_current_fiat().toStdString(); - auto answers = mm2::basic_batch_answer(resp); + auto answers = kdf::basic_batch_answer(resp); if (answers[0].contains("result")) { @@ -558,7 +558,7 @@ namespace atomic_dex { SPDLOG_DEBUG("Task ID: {}", task_id); using namespace std::chrono_literals; - auto& mm2_system = m_system_manager.get_system(); + auto& kdf_system = m_system_manager.get_system(); static std::size_t z_nb_try = 1; static std::size_t loop_limit = 600; nlohmann::json z_error = nlohmann::json::array(); @@ -566,14 +566,14 @@ namespace atomic_dex QString z_status; t_withdraw_status_request z_request{.task_id = task_id}; - nlohmann::json j = mm2::template_request("task::withdraw::status", true); - mm2::to_json(j, z_request); + nlohmann::json j = kdf::template_request("task::withdraw::status", true); + kdf::to_json(j, z_request); z_batch_array.push_back(j); do { - pplx::task z_resp_task = mm2_system.get_mm2_client().async_rpc_batch_standalone(z_batch_array); + pplx::task z_resp_task = kdf_system.get_kdf_client().async_rpc_batch_standalone(z_batch_array); web::http::http_response z_resp = z_resp_task.get(); - auto z_answers = mm2::basic_batch_answer(z_resp); + auto z_answers = kdf::basic_batch_answer(z_resp); z_error = z_answers; z_status = QString::fromStdString(z_answers[0].at("result").at("status").get()); @@ -609,7 +609,7 @@ namespace atomic_dex } else { - auto withdraw_answer = mm2::rpc_process_answer_batch(z_error[0], "task::withdraw::status"); + auto withdraw_answer = kdf::rpc_process_answer_batch(z_error[0], "task::withdraw::status"); nlohmann::json j_out = nlohmann::json::object(); j_out["withdraw_answer"] = z_error[0]["result"]["details"]; j_out.at("withdraw_answer")["date"] = withdraw_answer.result.value().timestamp_as_date; @@ -683,7 +683,7 @@ namespace atomic_dex }; //! Process - mm2_system.get_mm2_client().async_rpc_batch_standalone(batch).then(answer_functor).then(error_functor); + kdf_system.get_kdf_client().async_rpc_batch_standalone(batch).then(answer_functor).then(error_functor); } else @@ -733,8 +733,8 @@ namespace atomic_dex .gas_limit = 150000}; } - nlohmann::json json_data = mm2::template_request("withdraw", true); - mm2::to_json(json_data, withdraw_req); + nlohmann::json json_data = kdf::template_request("withdraw", true); + kdf::to_json(json_data, withdraw_req); batch.push_back(json_data); @@ -742,7 +742,7 @@ namespace atomic_dex if (max) { std::error_code ec; - amount_std = mm2_system.get_balance_info(ticker, ec); + amount_std = kdf_system.get_balance_info(ticker, ec); } //! Answer @@ -756,7 +756,7 @@ namespace atomic_dex if (resp.status_code() == 200 && body.find("error") == std::string::npos) { auto answers = nlohmann::json::parse(body); - auto withdraw_answer = mm2::rpc_process_answer_batch(answers[0], "withdraw"); + auto withdraw_answer = kdf::rpc_process_answer_batch(answers[0], "withdraw"); nlohmann::json j_out = nlohmann::json::object(); j_out["withdraw_answer"] = answers[0]["result"]; j_out.at("withdraw_answer")["date"] = withdraw_answer.result.value().timestamp_as_date; @@ -819,7 +819,7 @@ namespace atomic_dex }; //! Process - mm2_system.get_mm2_client().async_rpc_batch_standalone(batch).then(answer_functor).then(error_functor); + kdf_system.get_kdf_client().async_rpc_batch_standalone(batch).then(answer_functor).then(error_functor); } } @@ -855,12 +855,12 @@ namespace atomic_dex emit auth_succeededChanged(); this->set_rpc_broadcast_data(""); this->set_broadcast_busy(true); - auto& mm2_system = m_system_manager.get_system(); - const auto& ticker = mm2_system.get_current_ticker(); + auto& kdf_system = m_system_manager.get_system(); + const auto& ticker = kdf_system.get_current_ticker(); nlohmann::json batch = nlohmann::json::array(); t_broadcast_request broadcast_request{.tx_hex = tx_hex.toStdString(), .coin = ticker}; - nlohmann::json json_data = mm2::template_request("send_raw_transaction"); - mm2::to_json(json_data, broadcast_request); + nlohmann::json json_data = kdf::template_request("send_raw_transaction"); + kdf::to_json(json_data, broadcast_request); batch.push_back(json_data); //! Answer @@ -869,22 +869,22 @@ namespace atomic_dex std::string body = TO_STD_STR(resp.extract_string(true).get()); if (resp.status_code() == 200) { - auto& mm2_system = m_system_manager.get_system(); - const auto& ticker = mm2_system.get_current_ticker(); + auto& kdf_system = m_system_manager.get_system(); + const auto& ticker = kdf_system.get_current_ticker(); auto answers = nlohmann::json::parse(body); // SPDLOG_INFO("broadcast answer: {}", answers.dump(4)); if (answers[0].contains("tx_hash")) { this->set_rpc_broadcast_data(QString::fromStdString(answers[0].at("tx_hash").get())); - if (mm2_system.is_pin_cfg_enabled() && (not is_claiming && is_max)) + if (kdf_system.is_pin_cfg_enabled() && (not is_claiming && is_max)) { - mm2_system.reset_fake_balance_to_zero(ticker); + kdf_system.reset_fake_balance_to_zero(ticker); } - else if (mm2_system.is_pin_cfg_enabled() && (not is_claiming && not is_max)) + else if (kdf_system.is_pin_cfg_enabled() && (not is_claiming && not is_max)) { - mm2_system.decrease_fake_balance(ticker, amount.toStdString()); + kdf_system.decrease_fake_balance(ticker, amount.toStdString()); } - mm2_system.fetch_infos_thread(); + kdf_system.fetch_infos_thread(); } else { @@ -912,7 +912,7 @@ namespace atomic_dex } }; - mm2_system.get_mm2_client().async_rpc_batch_standalone(batch).then(answer_functor).then(error_functor); + kdf_system.get_kdf_client().async_rpc_batch_standalone(batch).then(answer_functor).then(error_functor); } void @@ -920,13 +920,13 @@ namespace atomic_dex { this->set_claiming_is_busy(true); nlohmann::json batch = nlohmann::json::array(); - auto& mm2_system = m_system_manager.get_system(); + auto& kdf_system = m_system_manager.get_system(); std::error_code ec; - t_withdraw_request withdraw_req{.coin = "KMD", .to = mm2_system.address("KMD", ec), .amount = "0", .max = true}; - nlohmann::json json_data = mm2::template_request("withdraw", true); - mm2::to_json(json_data, withdraw_req); + t_withdraw_request withdraw_req{.coin = "KMD", .to = kdf_system.address("KMD", ec), .amount = "0", .max = true}; + nlohmann::json json_data = kdf::template_request("withdraw", true); + kdf::to_json(json_data, withdraw_req); batch.push_back(json_data); - json_data = mm2::template_request("kmd_rewards_info"); + json_data = kdf::template_request("kmd_rewards_info"); batch.push_back(json_data); auto answer_functor = [this](web::http::http_response resp) @@ -936,11 +936,11 @@ namespace atomic_dex if (resp.status_code() == static_cast(antara::app::http_code::ok) && body.find("error") == std::string::npos) { auto answers = nlohmann::json::parse(body); - auto withdraw_answer = mm2::rpc_process_answer_batch(answers[0], "withdraw"); + auto withdraw_answer = kdf::rpc_process_answer_batch(answers[0], "withdraw"); nlohmann::json j_out = nlohmann::json::object(); j_out["withdraw_answer"] = answers[0]["result"]; j_out.at("withdraw_answer")["date"] = withdraw_answer.result.value().timestamp_as_date; - auto kmd_rewards_answer = mm2::process_kmd_rewards_answer(answers[1]); + auto kmd_rewards_answer = kdf::process_kmd_rewards_answer(answers[1]); j_out["kmd_rewards_info"] = kmd_rewards_answer.result; this->set_rpc_claiming_data(nlohmann_json_object_to_qt_json_object(j_out)); } @@ -967,17 +967,17 @@ namespace atomic_dex } }; - mm2_system.get_mm2_client().async_rpc_batch_standalone(batch).then(answer_functor).then(error_functor); + kdf_system.get_kdf_client().async_rpc_batch_standalone(batch).then(answer_functor).then(error_functor); } void wallet_page ::claim_faucet() { - const auto& mm2_system = m_system_manager.get_system(); - const auto& ticker = mm2_system.get_current_ticker(); - const auto& coin_info = mm2_system.get_coin_info(ticker); + const auto& kdf_system = m_system_manager.get_system(); + const auto& ticker = kdf_system.get_current_ticker(); + const auto& coin_info = kdf_system.get_coin_info(ticker); std::error_code ec; - faucet::api::claim_request claim_request{.coin_name = coin_info.ticker, .wallet_address = mm2_system.address(ticker, ec)}; + faucet::api::claim_request claim_request{.coin_name = coin_info.ticker, .wallet_address = kdf_system.address(ticker, ec)}; this->set_claiming_faucet_is_busy(true); faucet::api::claim(claim_request) @@ -1011,7 +1011,7 @@ namespace atomic_dex { std::error_code ec; const auto& settings = m_system_manager.get_system(); - t_transactions transactions = m_system_manager.get_system().get_tx_history(ec); + t_transactions transactions = m_system_manager.get_system().get_tx_history(ec); t_transactions to_init; if (settings.is_spamfilter_enabled()) { @@ -1056,10 +1056,10 @@ namespace atomic_dex void wallet_page::validate_address(QString address) { - auto& mm2_system = m_system_manager.get_system(); - if (mm2_system.is_mm2_running()) + auto& kdf_system = m_system_manager.get_system(); + if (kdf_system.is_kdf_running()) { - const auto& ticker = mm2_system.get_current_ticker(); + const auto& ticker = kdf_system.get_current_ticker(); validate_address(address, QString::fromStdString(ticker)); } } @@ -1068,15 +1068,15 @@ namespace atomic_dex wallet_page::validate_address(QString address, QString ticker) { // SPDLOG_INFO("validate_address: {} - ticker: {}", address.toStdString(), ticker.toStdString()); - auto& mm2_system = m_system_manager.get_system(); - if (mm2_system.is_mm2_running()) + auto& kdf_system = m_system_manager.get_system(); + if (kdf_system.is_kdf_running()) { std::error_code ec; t_validate_address_request req{.coin = ticker.toStdString(), .address = address.toStdString()}; this->set_validate_address_busy(true); nlohmann::json batch = nlohmann::json::array(); - nlohmann::json json_data = mm2::template_request("validateaddress"); - mm2::to_json(json_data, req); + nlohmann::json json_data = kdf::template_request("validateaddress"); + kdf::to_json(json_data, req); batch.push_back(json_data); auto answer_functor = [this, ticker](web::http::http_response resp) { @@ -1087,7 +1087,7 @@ namespace atomic_dex if (resp.status_code() == static_cast(antara::app::http_code::ok)) { auto answers = nlohmann::json::parse(body); - auto validate_answer = mm2::rpc_process_answer_batch(answers[0], "validateaddress"); + auto validate_answer = kdf::rpc_process_answer_batch(answers[0], "validateaddress"); if (validate_answer.result.has_value()) { auto res = validate_answer.result.value(); @@ -1096,7 +1096,7 @@ namespace atomic_dex } else { - if (!m_system_manager.get_system().is_zhtlc_coin_ready(ticker.toStdString())) + if (!m_system_manager.get_system().is_zhtlc_coin_ready(ticker.toStdString())) { j_out["reason"] = "Validation error: Coin not fully enabled"; } @@ -1116,17 +1116,17 @@ namespace atomic_dex this->set_validate_address_data(nlohmann_json_object_to_qt_json_object(j_out)); this->set_validate_address_busy(false); }; - mm2_system.get_mm2_client().async_rpc_batch_standalone(batch).then(answer_functor).then(&handle_exception_pplx_task); + kdf_system.get_kdf_client().async_rpc_batch_standalone(batch).then(answer_functor).then(&handle_exception_pplx_task); } } void wallet_page::convert_address(QString from, QVariant to_address_format) { - auto& mm2_system = m_system_manager.get_system(); - if (mm2_system.is_mm2_running()) + auto& kdf_system = m_system_manager.get_system(); + if (kdf_system.is_kdf_running()) { - const auto& ticker = mm2_system.get_current_ticker(); + const auto& ticker = kdf_system.get_current_ticker(); convert_address(from, QString::fromStdString(ticker), to_address_format); } } @@ -1134,16 +1134,16 @@ namespace atomic_dex void wallet_page::convert_address(QString from, QString ticker, QVariant to_address_format) { - auto& mm2_system = m_system_manager.get_system(); - if (mm2_system.is_mm2_running()) + auto& kdf_system = m_system_manager.get_system(); + if (kdf_system.is_kdf_running()) { QVariantMap out = to_address_format.value(); auto address_fmt = nlohmann::json::parse(QJsonDocument::fromVariant(out).toJson().toStdString()); t_convert_address_request req{.coin = ticker.toStdString(), .from = from.toStdString(), .to_address_format = address_fmt}; this->set_convert_address_busy(true); nlohmann::json batch = nlohmann::json::array(); - nlohmann::json json_data = mm2::template_request("convertaddress"); - mm2::to_json(json_data, req); + nlohmann::json json_data = kdf::template_request("convertaddress"); + kdf::to_json(json_data, req); batch.push_back(json_data); auto answer_functor = [this](web::http::http_response resp) { @@ -1152,7 +1152,7 @@ namespace atomic_dex if (resp.status_code() == static_cast(antara::app::http_code::ok)) { auto answers = nlohmann::json::parse(body); - auto convert_answer = mm2::rpc_process_answer_batch(answers[0], "convertaddress"); + auto convert_answer = kdf::rpc_process_answer_batch(answers[0], "convertaddress"); if (convert_answer.result.has_value()) { auto res = QString::fromStdString(convert_answer.result.value().address); @@ -1161,7 +1161,7 @@ namespace atomic_dex } this->set_convert_address_busy(false); }; - mm2_system.get_mm2_client().async_rpc_batch_standalone(batch).then(answer_functor).then(&handle_exception_pplx_task); + kdf_system.get_kdf_client().async_rpc_batch_standalone(batch).then(answer_functor).then(&handle_exception_pplx_task); } } diff --git a/src/core/atomicdex/pages/widgets/dex/qt.orderbook.cpp b/src/core/atomicdex/pages/widgets/dex/qt.orderbook.cpp index 4b702b2116..1eaf9ed854 100644 --- a/src/core/atomicdex/pages/widgets/dex/qt.orderbook.cpp +++ b/src/core/atomicdex/pages/widgets/dex/qt.orderbook.cpp @@ -17,7 +17,7 @@ //! Project headers #include "qt.orderbook.hpp" #include "atomicdex/pages/qt.trading.page.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" #include "atomicdex/services/price/orderbook.scanner.service.hpp" namespace @@ -79,7 +79,7 @@ namespace atomic_dex } void - qt_orderbook_wrapper::refresh_orderbook_model_data(mm2::orderbook_result_rpc answer) + qt_orderbook_wrapper::refresh_orderbook_model_data(kdf::orderbook_result_rpc answer) { // SPDLOG_INFO("[qt_orderbook_wrapper::refresh_orderbook_model_data] bids/asks size: {}/{}", answer.bids.size(), answer.asks.size()); this->m_asks->refresh_orderbook_model_data(answer.asks); @@ -103,7 +103,7 @@ namespace atomic_dex } void - qt_orderbook_wrapper::reset_orderbook(mm2::orderbook_result_rpc answer) + qt_orderbook_wrapper::reset_orderbook(kdf::orderbook_result_rpc answer) { this->m_asks->reset_orderbook(answer.asks); this->m_bids->reset_orderbook(answer.bids); @@ -142,7 +142,7 @@ namespace atomic_dex void atomic_dex::qt_orderbook_wrapper::set_both_taker_vol() { - auto&& [base, rel] = m_system_manager.get_system().get_taker_vol(); + auto&& [base, rel] = m_system_manager.get_system().get_taker_vol(); this->m_base_max_taker_vol = QJsonObject{ {"denom", QString::fromStdString(base.denom)}, {"numer", QString::fromStdString(base.numer)}, @@ -156,7 +156,7 @@ namespace atomic_dex {"coin", QString::fromStdString(rel.coin)}}; emit relMaxTakerVolChanged(); - auto&& [min_base, min_rel] = m_system_manager.get_system().get_min_vol(); + auto&& [min_base, min_rel] = m_system_manager.get_system().get_min_vol(); this->m_base_min_taker_vol = QString::fromStdString(min_base.min_trading_vol); emit baseMinTakerVolChanged(); this->m_rel_min_taker_vol = QString::fromStdString(min_rel.min_trading_vol); @@ -264,7 +264,7 @@ namespace atomic_dex // if (trading_pg.) if (price_f <= 0) { - //! Price is not set yet in the UI in this particular case return the min volume calculated by mm2 + //! Price is not set yet in the UI in this particular case return the min volume calculated by kdf return cur_taker_vol; } diff --git a/src/core/atomicdex/pages/widgets/dex/qt.orderbook.hpp b/src/core/atomicdex/pages/widgets/dex/qt.orderbook.hpp index 21cd4ae3bb..44ff5b9c38 100644 --- a/src/core/atomicdex/pages/widgets/dex/qt.orderbook.hpp +++ b/src/core/atomicdex/pages/widgets/dex/qt.orderbook.hpp @@ -47,8 +47,8 @@ namespace atomic_dex public: void adjust_min_vol(); - void refresh_orderbook_model_data(mm2::orderbook_result_rpc answer); - void reset_orderbook(mm2::orderbook_result_rpc answer); + void refresh_orderbook_model_data(kdf::orderbook_result_rpc answer); + void reset_orderbook(kdf::orderbook_result_rpc answer); void clear_orderbook(); [[nodiscard]] orderbook_model* get_asks() const; [[nodiscard]] orderbook_model* get_bids() const; diff --git a/src/core/atomicdex/pages/widgets/dex/qt.orders.widget.cpp b/src/core/atomicdex/pages/widgets/dex/qt.orders.widget.cpp index 3ff8cd10cd..598bb21815 100644 --- a/src/core/atomicdex/pages/widgets/dex/qt.orders.widget.cpp +++ b/src/core/atomicdex/pages/widgets/dex/qt.orders.widget.cpp @@ -20,8 +20,8 @@ //! Project Headers #include "../../qt.settings.page.hpp" #include "../../qt.trading.page.hpp" -#include "atomicdex/api/mm2/mm2.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/api/kdf/kdf.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" #include "atomicdex/services/price/global.provider.hpp" #include "qt.orders.widget.hpp" @@ -42,30 +42,30 @@ namespace atomic_dex qt_orders_widget::common_cancel_all_orders(bool by_coin, const QString& ticker) { nlohmann::json batch = nlohmann::json::array(); - nlohmann::json cancel_request = mm2::template_request("cancel_all_orders"); + nlohmann::json cancel_request = kdf::template_request("cancel_all_orders"); if (by_coin && not ticker.isEmpty()) { - mm2::cancel_data cd; + kdf::cancel_data cd; cd.ticker = ticker.toStdString(); - mm2::cancel_all_orders_request req{{"Coin", cd}}; - mm2::to_json(cancel_request, req); + kdf::cancel_all_orders_request req{{"Coin", cd}}; + kdf::to_json(cancel_request, req); } else { - mm2::cancel_data cd; + kdf::cancel_data cd; cd.ticker = ticker.toStdString(); - mm2::cancel_all_orders_request req_all; - mm2::to_json(cancel_request, req_all); + kdf::cancel_all_orders_request req_all; + kdf::to_json(cancel_request, req_all); } batch.push_back(cancel_request); - auto& mm2_system = m_system_mgr.get_system(); - mm2_system.get_mm2_client() + auto& kdf_system = m_system_mgr.get_system(); + kdf_system.get_kdf_client() .async_rpc_batch_standalone(batch) .then([this]([[maybe_unused]] web::http::http_response resp) { - auto& mm2_system = m_system_mgr.get_system(); - mm2_system.batch_fetch_orders_and_swap(); - mm2_system.process_orderbook(false); + auto& kdf_system = m_system_mgr.get_system(); + kdf_system.batch_fetch_orders_and_swap(); + kdf_system.process_orderbook(false); }) .then(&handle_exception_pplx_task); } @@ -81,20 +81,20 @@ namespace atomic_dex nlohmann::json batch = nlohmann::json::array(); for (auto&& order_id: orders_id) { - mm2::cancel_all_orders_request req; - nlohmann::json cancel_request = mm2::template_request("cancel_order"); - mm2::cancel_order_request cancel_req{order_id.toStdString()}; + kdf::cancel_all_orders_request req; + nlohmann::json cancel_request = kdf::template_request("cancel_order"); + kdf::cancel_order_request cancel_req{order_id.toStdString()}; to_json(cancel_request, cancel_req); batch.push_back(cancel_request); } - auto& mm2_system = m_system_mgr.get_system(); - mm2_system.get_mm2_client() + auto& kdf_system = m_system_mgr.get_system(); + kdf_system.get_kdf_client() .async_rpc_batch_standalone(batch) .then([this]([[maybe_unused]] web::http::http_response resp) { - auto& mm2_system = m_system_mgr.get_system(); - mm2_system.batch_fetch_orders_and_swap(); - mm2_system.process_orderbook(false); + auto& kdf_system = m_system_mgr.get_system(); + kdf_system.batch_fetch_orders_and_swap(); + kdf_system.process_orderbook(false); }) .then(&handle_exception_pplx_task); } diff --git a/src/core/atomicdex/services/exporter/exporter.service.cpp b/src/core/atomicdex/services/exporter/exporter.service.cpp index 604d7a8287..d248cf361b 100644 --- a/src/core/atomicdex/services/exporter/exporter.service.cpp +++ b/src/core/atomicdex/services/exporter/exporter.service.cpp @@ -24,9 +24,9 @@ #include //! Project -#include "atomicdex/api/mm2/mm2.hpp" +#include "atomicdex/api/kdf/kdf.hpp" #include "atomicdex/services/exporter/exporter.service.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" #include "atomicdex/utilities/qt.utilities.hpp" //! Constructor @@ -66,9 +66,9 @@ namespace atomic_dex LOG_PATH("new csv path is: {}", csv_path); } nlohmann::json batch = nlohmann::json::array(); - nlohmann::json my_recent_swaps = mm2::template_request("my_recent_swaps"); - auto& mm2 = m_system_manager.get_system(); - const auto swaps_data = mm2.get_orders_and_swaps(); + nlohmann::json my_recent_swaps = kdf::template_request("my_recent_swaps"); + auto& kdf = m_system_manager.get_system(); + const auto swaps_data = kdf.get_orders_and_swaps(); t_my_recent_swaps_request request{ .limit = swaps_data.total_finished_swaps, .page_number = 1, @@ -81,8 +81,8 @@ namespace atomic_dex // SPDLOG_INFO("my_recent_swaps req: {}", my_recent_swaps.dump(4)); auto answer_functor = [csv_path](web::http::http_response resp) { - auto answers = mm2::basic_batch_answer(resp); - const auto swap_answer = mm2::rpc_process_answer_batch(answers[0], "my_recent_swaps"); + auto answers = kdf::basic_batch_answer(resp); + const auto swap_answer = kdf::rpc_process_answer_batch(answers[0], "my_recent_swaps"); if (swap_answer.result.has_value()) { const auto result = swap_answer.result.value(); @@ -123,6 +123,6 @@ namespace atomic_dex } }; - mm2.get_mm2_client().async_rpc_batch_standalone(batch).then(answer_functor).then(&handle_exception_pplx_task); + kdf.get_kdf_client().async_rpc_batch_standalone(batch).then(answer_functor).then(&handle_exception_pplx_task); } } // namespace atomic_dex \ No newline at end of file diff --git a/src/core/atomicdex/services/internet/internet.checker.service.cpp b/src/core/atomicdex/services/internet/internet.checker.service.cpp index e194dbe2ce..72c51e835e 100644 --- a/src/core/atomicdex/services/internet/internet.checker.service.cpp +++ b/src/core/atomicdex/services/internet/internet.checker.service.cpp @@ -19,7 +19,7 @@ //! Our project #include "atomicdex/services/internet/internet.checker.service.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" #include "atomicdex/utilities/cpprestsdk.utilities.hpp" #include "atomicdex/utilities/qt.utilities.hpp" @@ -32,7 +32,7 @@ namespace return cfg; }()}; - std::atomic_bool g_mm2_default_coins_ready{false}; + std::atomic_bool g_kdf_default_coins_ready{false}; pplx::task async_check_retrieve(t_http_client_ptr& client, const std::string& uri) @@ -163,35 +163,35 @@ namespace atomic_dex void internet_service_checker::fetch_internet_connection() { - // TODO: This is only checking mm2 connection, not connection to the internet. - if (this->m_system_manager.has_system() && g_mm2_default_coins_ready) + // TODO: This is only checking kdf connection, not connection to the internet. + if (this->m_system_manager.has_system() && g_kdf_default_coins_ready) { - auto& mm2 = this->m_system_manager.get_system(); - if (mm2.is_mm2_running()) + auto& kdf = this->m_system_manager.get_system(); + if (kdf.is_kdf_running()) { - SPDLOG_INFO("mm2 is alive, checking if we are able to fetch mm2 version"); + SPDLOG_INFO("kdf is alive, checking if we are able to fetch kdf version"); nlohmann::json batch = nlohmann::json::array(); - nlohmann::json current_request = mm2::template_request("version"); + nlohmann::json current_request = kdf::template_request("version"); // SPDLOG_DEBUG("version request {}", current_request.dump(4)); batch.push_back(current_request); - auto async_answer = mm2.get_mm2_client().async_rpc_batch_standalone(batch); - generic_treat_answer(async_answer, TO_STD_STR(atomic_dex::g_dex_rpc), &internet_service_checker::is_mm2_endpoint_alive); + auto async_answer = kdf.get_kdf_client().async_rpc_batch_standalone(batch); + generic_treat_answer(async_answer, TO_STD_STR(atomic_dex::g_dex_rpc), &internet_service_checker::is_kdf_endpoint_alive); } else { - SPDLOG_WARN("mm2 not running skipping internet connectivity with it"); + SPDLOG_WARN("kdf not running skipping internet connectivity with it"); } } else { - SPDLOG_WARN("mm2 system not available skipping internet connectivity with it"); + SPDLOG_WARN("kdf system not available skipping internet connectivity with it"); } } void internet_service_checker::on_default_coins_enabled([[maybe_unused]] const default_coins_enabled& evt) { - SPDLOG_INFO("Default coins are enabled, we can now check internet with mm2 too"); - g_mm2_default_coins_ready = true; + SPDLOG_INFO("Default coins are enabled, we can now check internet with kdf too"); + g_kdf_default_coins_ready = true; } } // namespace atomic_dex diff --git a/src/core/atomicdex/services/internet/internet.checker.service.hpp b/src/core/atomicdex/services/internet/internet.checker.service.hpp index 553a2fcd95..417ac6897d 100644 --- a/src/core/atomicdex/services/internet/internet.checker.service.hpp +++ b/src/core/atomicdex/services/internet/internet.checker.service.hpp @@ -45,7 +45,7 @@ namespace atomic_dex double m_timer; std::atomic_bool is_internet_reacheable{true}; std::atomic_bool is_paprika_provider_alive{true}; - std::atomic_bool is_mm2_endpoint_alive{true}; + std::atomic_bool is_kdf_endpoint_alive{true}; std::atomic_bool is_our_private_endpoint_reacheable{true}; //! Private functions diff --git a/src/core/atomicdex/services/mm2/auto.update.maker.order.service.cpp b/src/core/atomicdex/services/kdf/auto.update.maker.order.service.cpp similarity index 88% rename from src/core/atomicdex/services/mm2/auto.update.maker.order.service.cpp rename to src/core/atomicdex/services/kdf/auto.update.maker.order.service.cpp index 754b01dfe1..ac1861c9d7 100644 --- a/src/core/atomicdex/services/mm2/auto.update.maker.order.service.cpp +++ b/src/core/atomicdex/services/kdf/auto.update.maker.order.service.cpp @@ -18,9 +18,9 @@ #include // Project Headers -#include "atomicdex/api/mm2/rpc_v1/rpc.update_maker_order.hpp" -#include "atomicdex/services/mm2/auto.update.maker.order.service.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.update_maker_order.hpp" +#include "atomicdex/services/kdf/auto.update.maker.order.service.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" #include "atomicdex/services/price/global.provider.hpp" //! Constructor @@ -61,11 +61,11 @@ namespace atomic_dex void auto_update_maker_order_service::update_order(const t_order_swaps_data& data) { - const auto& mm2 = this->m_system_manager.get_system(); + const auto& kdf = this->m_system_manager.get_system(); const auto base_coin = data.base_coin.toStdString(); const auto rel_coin = data.rel_coin.toStdString(); - const auto base_coin_info = mm2.get_coin_info(base_coin); - const auto rel_coin_info = mm2.get_coin_info(rel_coin); + const auto base_coin_info = kdf.get_coin_info(base_coin); + const auto rel_coin_info = kdf.get_coin_info(rel_coin); QSettings& settings = entity_registry_.ctx(); const auto category_settings = data.base_coin + "_" + data.rel_coin; const QString target_settings = "Disabled"; @@ -81,7 +81,7 @@ namespace atomic_dex nlohmann::json batch = nlohmann::json::array(); std::string new_price = get_new_price_from_order(data, spread); nlohmann::json conf_settings = data.conf_settings.value_or(nlohmann::json()); - nlohmann::json update_maker_order_json = mm2::template_request("update_maker_order"); + nlohmann::json update_maker_order_json = kdf::template_request("update_maker_order"); t_float_50 volume = safe_float(data.base_amount.toStdString()); t_float_50 min_volume = volume * min_volume_percent; t_update_maker_order_request request{ @@ -96,12 +96,12 @@ namespace atomic_dex request.base_confs = conf_settings.at("base_confs").get(); request.rel_confs = conf_settings.at("rel_confs").get(); } - mm2::to_json(update_maker_order_json, request); + kdf::to_json(update_maker_order_json, request); batch.push_back(update_maker_order_json); update_maker_order_json["userpass"] = ""; SPDLOG_INFO("request: {}", update_maker_order_json.dump(1)); - auto& mm2 = this->m_system_manager.get_system(); - mm2.get_mm2_client() + auto& kdf = this->m_system_manager.get_system(); + kdf.get_kdf_client() .async_rpc_batch_standalone(batch) .then( []([[maybe_unused]] web::http::http_response resp) @@ -120,8 +120,8 @@ namespace atomic_dex auto_update_maker_order_service::internal_update() { SPDLOG_DEBUG("update maker orders"); - const auto& mm2 = this->m_system_manager.get_system(); - orders_and_swaps data = mm2.get_orders_and_swaps(); + const auto& kdf = this->m_system_manager.get_system(); + orders_and_swaps data = kdf.get_orders_and_swaps(); auto cur = data.orders_and_swaps.begin(); auto end = data.orders_and_swaps.begin() + data.nb_orders; for (; cur != end && cur != data.orders_and_swaps.end(); ++cur) @@ -139,21 +139,21 @@ namespace atomic_dex { try { - if (this->m_system_manager.has_system()) + if (this->m_system_manager.has_system()) { - const auto& mm2 = this->m_system_manager.get_system(); - if (mm2.is_mm2_running()) + const auto& kdf = this->m_system_manager.get_system(); + if (kdf.is_kdf_running()) { this->internal_update(); } else { - SPDLOG_WARN("MM2 service is not running yet - skipping"); + SPDLOG_WARN("KDF service is not running yet - skipping"); } } else { - SPDLOG_WARN("MM2 service not created yet - skipping"); + SPDLOG_WARN("KDF service not created yet - skipping"); } } catch (const std::exception& error) diff --git a/src/core/atomicdex/services/mm2/auto.update.maker.order.service.hpp b/src/core/atomicdex/services/kdf/auto.update.maker.order.service.hpp similarity index 100% rename from src/core/atomicdex/services/mm2/auto.update.maker.order.service.hpp rename to src/core/atomicdex/services/kdf/auto.update.maker.order.service.hpp diff --git a/src/core/atomicdex/services/mm2/mm2.service.cpp b/src/core/atomicdex/services/kdf/kdf.service.cpp similarity index 89% rename from src/core/atomicdex/services/mm2/mm2.service.cpp rename to src/core/atomicdex/services/kdf/kdf.service.cpp index aac8b30293..741a21fdea 100644 --- a/src/core/atomicdex/services/mm2/mm2.service.cpp +++ b/src/core/atomicdex/services/kdf/kdf.service.cpp @@ -27,21 +27,21 @@ #include #include -#include "atomicdex/api/mm2/utxo_merge_params.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.electrum.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.enable.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.min_trading_vol.hpp" -#include "atomicdex/api/mm2/rpc.tx.history.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.z_coin_tx_history.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.init.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.task.enable_z_coin.status.hpp" -#include "atomicdex/config/mm2.cfg.hpp" +#include "atomicdex/api/kdf/utxo_merge_params.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.electrum.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.enable.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.min_trading_vol.hpp" +#include "atomicdex/api/kdf/rpc.tx.history.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.z_coin_tx_history.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.init.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.task.enable_z_coin.status.hpp" +#include "atomicdex/config/kdf.cfg.hpp" #include "atomicdex/config/coins.cfg.hpp" #include "atomicdex/constants/dex.constants.hpp" #include "atomicdex/managers/qt.wallet.manager.hpp" #include "atomicdex/pages/qt.settings.page.hpp" #include "atomicdex/services/internet/internet.checker.service.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" #include "atomicdex/utilities/qt.utilities.hpp" #include "atomicdex/utilities/kill.hpp" @@ -195,7 +195,7 @@ namespace namespace atomic_dex { - std::vector mm2_service::retrieve_coins_informations() + std::vector kdf_service::retrieve_coins_informations() { std::vector cfg; SPDLOG_DEBUG("retrieve_coins_informations"); @@ -264,21 +264,21 @@ namespace atomic_dex return cfg; } - mm2_service::mm2_service(entt::registry& registry, ag::ecs::system_manager& system_manager) : system(registry), m_system_manager(system_manager) + kdf_service::kdf_service(entt::registry& registry, ag::ecs::system_manager& system_manager) : system(registry), m_system_manager(system_manager) { m_orderbook_clock = std::chrono::high_resolution_clock::now(); m_info_clock = std::chrono::high_resolution_clock::now(); - dispatcher_.sink().connect<&mm2_service::on_gui_enter_trading>(*this); - dispatcher_.sink().connect<&mm2_service::on_gui_leave_trading>(*this); - dispatcher_.sink().connect<&mm2_service::on_refresh_orderbook_model_data>(*this); - SPDLOG_INFO("mm2_service created"); + dispatcher_.sink().connect<&kdf_service::on_gui_enter_trading>(*this); + dispatcher_.sink().connect<&kdf_service::on_gui_leave_trading>(*this); + dispatcher_.sink().connect<&kdf_service::on_refresh_orderbook_model_data>(*this); + SPDLOG_INFO("kdf_service created"); } - void mm2_service::update() + void kdf_service::update() { using namespace std::chrono_literals; - if (not m_mm2_running) + if (not m_kdf_running) { return; } @@ -339,38 +339,38 @@ namespace atomic_dex } } - mm2_service::~mm2_service() + kdf_service::~kdf_service() { - SPDLOG_INFO("destroying mm2 service..."); - dispatcher_.sink().disconnect<&mm2_service::on_gui_enter_trading>(*this); - dispatcher_.sink().disconnect<&mm2_service::on_gui_leave_trading>(*this); - dispatcher_.sink().disconnect<&mm2_service::on_refresh_orderbook_model_data>(*this); - SPDLOG_INFO("mm2 signals successfully disconnected"); - bool mm2_stopped = false; - if (m_mm2_running) + SPDLOG_INFO("destroying kdf service..."); + dispatcher_.sink().disconnect<&kdf_service::on_gui_enter_trading>(*this); + dispatcher_.sink().disconnect<&kdf_service::on_gui_leave_trading>(*this); + dispatcher_.sink().disconnect<&kdf_service::on_refresh_orderbook_model_data>(*this); + SPDLOG_INFO("kdf signals successfully disconnected"); + bool kdf_stopped = false; + if (m_kdf_running) { - SPDLOG_INFO("preparing mm2 stop batch request"); - nlohmann::json stop_request = mm2::template_request("stop"); + SPDLOG_INFO("preparing kdf stop batch request"); + nlohmann::json stop_request = kdf::template_request("stop"); nlohmann::json batch = nlohmann::json::array(); batch.push_back(stop_request); - SPDLOG_INFO("processing mm2 stop batch request"); - pplx::task resp_task = m_mm2_client.async_rpc_batch_standalone(batch); + SPDLOG_INFO("processing kdf stop batch request"); + pplx::task resp_task = m_kdf_client.async_rpc_batch_standalone(batch); web::http::http_response resp = resp_task.get(); - SPDLOG_INFO("mm2 stop batch answer received"); - auto answers = mm2::basic_batch_answer(resp); + SPDLOG_INFO("kdf stop batch answer received"); + auto answers = kdf::basic_batch_answer(resp); if (answers[0].contains("result")) { - mm2_stopped = answers[0].at("result").get() == "success"; - SPDLOG_INFO("mm2 successfully stopped with rpc stop"); + kdf_stopped = answers[0].at("result").get() == "success"; + SPDLOG_INFO("kdf successfully stopped with rpc stop"); } } - m_mm2_running = false; + m_kdf_running = false; // m_token_source.cancel(); - m_mm2_client.stop(); + m_kdf_client.stop(); - if (!mm2_stopped) + if (!kdf_stopped) { - SPDLOG_INFO("mm2 didn't stop yet with rpc stop, stopping process manually"); + SPDLOG_INFO("kdf didn't stop yet with rpc stop, stopping process manually"); #if defined(_WIN32) || defined(WIN32) atomic_dex::kill_executable(atomic_dex::g_dex_api); #else @@ -379,30 +379,30 @@ namespace atomic_dex {reproc::stop::kill, reproc::milliseconds(5000)}, {reproc::stop::wait, reproc::milliseconds(2000)}};*/ - /*const auto ec = m_mm2_instance.stop(stop_actions).second; + /*const auto ec = m_kdf_instance.stop(stop_actions).second; if (ec) { - SPDLOG_ERROR("error when stopping mm2 by process: {}", ec.message()); + SPDLOG_ERROR("error when stopping kdf by process: {}", ec.message()); // std::cerr << "error: " << ec.message() << std::endl; }*/ #endif } - if (m_mm2_init_thread.joinable()) + if (m_kdf_init_thread.joinable()) { - m_mm2_init_thread.join(); - SPDLOG_INFO("mm2 init thread destroyed"); + m_kdf_init_thread.join(); + SPDLOG_INFO("kdf init thread destroyed"); } - SPDLOG_INFO("mm2 service fully destroyed"); + SPDLOG_INFO("kdf service fully destroyed"); } - const std::atomic_bool& mm2_service::is_mm2_running() const + const std::atomic_bool& kdf_service::is_kdf_running() const { - return m_mm2_running; + return m_kdf_running; } - t_coins mm2_service::get_enabled_coins() const + t_coins kdf_service::get_enabled_coins() const { t_coins destination; @@ -418,7 +418,7 @@ namespace atomic_dex return destination; } - t_coins mm2_service::get_active_coins() const + t_coins kdf_service::get_active_coins() const { t_coins destination; @@ -434,26 +434,26 @@ namespace atomic_dex return destination; } - void mm2_service::enable_z_coin_cancel(const std::int8_t task_id) + void kdf_service::enable_z_coin_cancel(const std::int8_t task_id) { t_enable_z_coin_cancel_request request{.task_id = task_id}; - auto answer = m_mm2_client.rpc_enable_z_coin_cancel(std::move(request)); - // SPDLOG_DEBUG("mm2_service::enable_z_coin_cancel: [task_id {}] result: {}", task_id, answer.raw_result); + auto answer = m_kdf_client.rpc_enable_z_coin_cancel(std::move(request)); + // SPDLOG_DEBUG("kdf_service::enable_z_coin_cancel: [task_id {}] result: {}", task_id, answer.raw_result); } - bool mm2_service::disable_coin(const std::string& ticker, std::error_code& ec) + bool kdf_service::disable_coin(const std::string& ticker, std::error_code& ec) { coin_config_t coin_info = get_coin_info(ticker); if (not coin_info.currently_enabled) { - // SPDLOG_DEBUG("[mm2_service::disable_coin]: {} not currently_enabled", ticker); + // SPDLOG_DEBUG("[kdf_service::disable_coin]: {} not currently_enabled", ticker); return true; } t_disable_coin_request request{.coin = ticker}; - auto answer = m_mm2_client.rpc_disable_coin(std::move(request)); - // SPDLOG_DEBUG("mm2_service::disable_coin: {} result: {}", ticker, answer.raw_result); + auto answer = m_kdf_client.rpc_disable_coin(std::move(request)); + // SPDLOG_DEBUG("kdf_service::disable_coin: {} result: {}", ticker, answer.raw_result); if (answer.error.has_value()) { @@ -484,7 +484,7 @@ namespace atomic_dex return true; } - bool mm2_service::enable_default_coins() + bool kdf_service::enable_default_coins() { std::atomic result{1}; auto coins = get_active_coins(); @@ -494,17 +494,17 @@ namespace atomic_dex return result.load() == 1; } - void mm2_service::enable_coin(const std::string& ticker) + void kdf_service::enable_coin(const std::string& ticker) { enable_coin(get_coin_info(ticker)); } - void mm2_service::enable_coin(const coin_config_t& coin_config) + void kdf_service::enable_coin(const coin_config_t& coin_config) { enable_coins(t_coins{coin_config}); } - void mm2_service::enable_coins(const std::vector& tickers) + void kdf_service::enable_coins(const std::vector& tickers) { t_coins coins{}; @@ -516,7 +516,7 @@ namespace atomic_dex enable_coins(coins); } - void mm2_service::enable_coins(const t_coins& coins) + void kdf_service::enable_coins(const t_coins& coins) { t_coins enabled_coins = get_enabled_coins(); for (const auto& coin : coins) @@ -532,7 +532,7 @@ namespace atomic_dex m_activation_clock = std::chrono::high_resolution_clock::now() - std::chrono::duration_cast(std::chrono::seconds(13)); } - void mm2_service::activate_coins(const t_coins& coins) + void kdf_service::activate_coins(const t_coins& coins) { t_coins other_coins; t_coins erc_family_coins; @@ -656,24 +656,24 @@ namespace atomic_dex } } - void mm2_service::update_coin_active(const std::vector& tickers, bool status) + void kdf_service::update_coin_active(const std::vector& tickers, bool status) { update_coin_status(this->m_current_wallet_name, tickers, status, m_coins_informations, m_coin_cfg_mutex); } - void mm2_service::enable_erc_family_coin(const coin_config_t& coin_cfg) + void kdf_service::enable_erc_family_coin(const coin_config_t& coin_cfg) { enable_erc_family_coins(t_coins{coin_cfg}); } - void mm2_service::enable_erc_family_coins(const t_coins& coins) + void kdf_service::enable_erc_family_coins(const t_coins& coins) { nlohmann::json batch_array = nlohmann::json::array(); auto callback = [this, coins](const web::http::http_response& resp) { try { - auto answers = mm2::basic_batch_answer(resp); + auto answers = kdf::basic_batch_answer(resp); if (answers.count("error") == 0) { @@ -755,35 +755,35 @@ namespace atomic_dex } if (coin_config.is_custom_coin) { - request.mm2 = 1; + request.kdf = 1; } else if (coin_config.wallet_only) { - request.mm2 = 0; + request.kdf = 0; } - nlohmann::json j = mm2::template_request("enable"); - mm2::to_json(j, request); + nlohmann::json j = kdf::template_request("enable"); + kdf::to_json(j, request); batch_array.push_back(j); } - m_mm2_client.async_rpc_batch_standalone(batch_array) + m_kdf_client.async_rpc_batch_standalone(batch_array) .then(callback) .then([this, batch_array](pplx::task previous_task) { this->handle_exception_pplx_task(previous_task, "enable_common_coins", batch_array); }); } - void mm2_service::enable_utxo_qrc20_coin(coin_config_t coin_config) + void kdf_service::enable_utxo_qrc20_coin(coin_config_t coin_config) { enable_utxo_qrc20_coins(t_coins{std::move(coin_config)}); } - void mm2_service::enable_utxo_qrc20_coins(const t_coins& coins) + void kdf_service::enable_utxo_qrc20_coins(const t_coins& coins) { auto batch_array = nlohmann::json::array(); auto callback = [this, coins](const web::http::http_response& resp) { try { - auto answers = mm2::basic_batch_answer(resp); + auto answers = kdf::basic_batch_answer(resp); if (answers.count("error") == 0) { @@ -848,7 +848,7 @@ namespace atomic_dex for (const auto& coin_config : coins) { - nlohmann::json j = mm2::template_request("electrum"); + nlohmann::json j = kdf::template_request("electrum"); t_electrum_request request { .coin_name = coin_config.ticker, @@ -859,10 +859,10 @@ namespace atomic_dex }; if (coin_config.merge_utxos.value_or(false)) { - mm2::utxo_merge_params_t merge_params{.merge_at = 250, .check_every = 300, .max_merge_at_once = 125}; + kdf::utxo_merge_params_t merge_params{.merge_at = 250, .check_every = 300, .max_merge_at_once = 125}; nlohmann::json json_merge_params; - mm2::to_json(json_merge_params, merge_params); + kdf::to_json(json_merge_params, merge_params); request.merge_params = json_merge_params; } if (coin_config.swap_contract_address.value_or("") != "") @@ -873,21 +873,21 @@ namespace atomic_dex { request.fallback_swap_contract = coin_config.fallback_swap_contract; } - mm2::to_json(j, request); + kdf::to_json(j, request); batch_array.push_back(j); } - m_mm2_client.async_rpc_batch_standalone(batch_array) + m_kdf_client.async_rpc_batch_standalone(batch_array) .then(callback) .then([this, batch_array](pplx::task previous_task) { this->handle_exception_pplx_task(previous_task, "enable_qrc_family_coins", batch_array); }); } - void mm2_service::enable_erc20_coin(coin_config_t coin_config, std::string parent_ticker) + void kdf_service::enable_erc20_coin(coin_config_t coin_config, std::string parent_ticker) { enable_erc20_coins(t_coins{std::move(coin_config)}, parent_ticker); } - void mm2_service::enable_erc20_coins(const t_coins& coins, const std::string parent_ticker) + void kdf_service::enable_erc20_coins(const t_coins& coins, const std::string parent_ticker) { auto callback = [this](RpcRequest rpc) { @@ -901,7 +901,7 @@ namespace atomic_dex std::unique_lock lock(m_coin_cfg_mutex); m_coins_informations[rpc.request.ticker].currently_enabled = true; dispatcher_.trigger(coin_fully_initialized{.tickers = {rpc.request.ticker}}); - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { SPDLOG_ERROR("{} {}: ", rpc.request.ticker, rpc.error->error_type); @@ -935,7 +935,7 @@ namespace atomic_dex std::unique_lock lock(m_coin_cfg_mutex); m_coins_informations[rpc.request.ticker].currently_enabled = true; SPDLOG_DEBUG("marking {} as active", rpc.request.ticker); - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { for (const auto& erc20_address_info : rpc.result->erc20_addresses_infos) { @@ -976,18 +976,18 @@ namespace atomic_dex for (const auto& token_config : coins) { // SPDLOG_DEBUG("Processing {} token: {}", parent_ticker, token_config.ticker); - mm2::enable_erc20_rpc rpc{.request={.ticker = token_config.ticker}}; + kdf::enable_erc20_rpc rpc{.request={.ticker = token_config.ticker}}; if (token_config.ticker == parent_ticker_info.ticker) { continue; } - m_mm2_client.process_rpc_async(rpc.request, callback); + m_kdf_client.process_rpc_async(rpc.request, callback); } } else { - mm2::enable_eth_with_tokens_rpc rpc; + kdf::enable_eth_with_tokens_rpc rpc; rpc.request.ticker = parent_ticker_info.ticker; rpc.request.nodes = parent_ticker_info.urls.value_or(std::vector{}); rpc.request.swap_contract_address = parent_ticker_info.swap_contract_address.value_or(""); @@ -1003,17 +1003,17 @@ namespace atomic_dex } rpc.request.erc20_tokens_requests.push_back({.ticker = coin_config.ticker}); } - m_mm2_client.process_rpc_async(rpc.request, callback); + m_kdf_client.process_rpc_async(rpc.request, callback); } - SPDLOG_DEBUG("mm2_service::enable_erc20_coins done for {}", parent_ticker); + SPDLOG_DEBUG("kdf_service::enable_erc20_coins done for {}", parent_ticker); } - void mm2_service::enable_tendermint_coin(coin_config_t coin_config, std::string parent_ticker) + void kdf_service::enable_tendermint_coin(coin_config_t coin_config, std::string parent_ticker) { enable_tendermint_coins(t_coins{std::move(coin_config)}, parent_ticker); } - void mm2_service::enable_tendermint_coins(const t_coins& coins, const std::string parent_ticker) + void kdf_service::enable_tendermint_coins(const t_coins& coins, const std::string parent_ticker) { auto callback = [this](RpcRequest rpc) { @@ -1027,7 +1027,7 @@ namespace atomic_dex std::unique_lock lock(m_coin_cfg_mutex); m_coins_informations[rpc.request.ticker].currently_enabled = true; dispatcher_.trigger(coin_fully_initialized{.tickers = {rpc.request.ticker}}); - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { for (const auto& tendermint_coin_info : rpc.request.tokens_params) { @@ -1053,7 +1053,7 @@ namespace atomic_dex fetch_single_balance(get_coin_info(rpc.request.ticker)); std::unique_lock lock(m_coin_cfg_mutex); m_coins_informations[rpc.request.ticker].currently_enabled = true; - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { for (const auto& tendermint_token_addresses_info : rpc.result->tendermint_token_balances_infos) { @@ -1081,18 +1081,18 @@ namespace atomic_dex { for (const auto& coin_config : coins) { - mm2::enable_tendermint_token_rpc rpc{.request={.ticker = coin_config.ticker}}; + kdf::enable_tendermint_token_rpc rpc{.request={.ticker = coin_config.ticker}}; if (coin_config.ticker == parent_ticker_info.ticker) { continue; } - m_mm2_client.process_rpc_async(rpc.request, callback); + m_kdf_client.process_rpc_async(rpc.request, callback); } } else { - mm2::enable_tendermint_with_assets_rpc rpc; + 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{}); @@ -1104,14 +1104,14 @@ namespace atomic_dex } rpc.request.tokens_params.push_back({.ticker = coin_config.ticker}); } - m_mm2_client.process_rpc_async(rpc.request, callback); + m_kdf_client.process_rpc_async(rpc.request, callback); } } - void mm2_service::process_balance_answer(const mm2::enable_erc20_rpc& rpc) + void kdf_service::process_balance_answer(const kdf::enable_erc20_rpc& rpc) { const auto& answer = rpc.result.value(); - mm2::balance_answer balance_answer; + kdf::balance_answer balance_answer; balance_answer.address = answer.balances.begin()->first; SPDLOG_DEBUG("balance_answer.address: {}", balance_answer.address); @@ -1126,12 +1126,12 @@ namespace atomic_dex SPDLOG_DEBUG("balance_answer for {} complete", rpc.request.ticker); } - void mm2_service::process_balance_answer(const mm2::enable_eth_with_tokens_rpc& rpc) + void kdf_service::process_balance_answer(const kdf::enable_eth_with_tokens_rpc& rpc) { - SPDLOG_DEBUG("mm2_service::process_balance_answer(const mm2::enable_eth_with_tokens_rpc& rpc"); + SPDLOG_DEBUG("kdf_service::process_balance_answer(const kdf::enable_eth_with_tokens_rpc& rpc"); const auto& answer = rpc.result.value(); { - mm2::balance_answer balance_answer; + kdf::balance_answer balance_answer; balance_answer.coin = rpc.request.ticker; SPDLOG_DEBUG("balance_answer.coin: {}", balance_answer.coin); balance_answer.balance = answer.eth_addresses_infos.begin()->second.balances.spendable; @@ -1153,7 +1153,7 @@ namespace atomic_dex for (auto [address, data] : answer.erc20_addresses_infos) { SPDLOG_DEBUG("for (auto [address, data] : answer.erc20_addresses_infos) address [{}]", address); - mm2::balance_answer balance_answer; + kdf::balance_answer balance_answer; balance_answer.address = address; if (data.balances.empty()) { @@ -1172,10 +1172,10 @@ namespace atomic_dex SPDLOG_DEBUG("process_balance_answer for enable_eth_with_tokens_rpc complete"); } - void mm2_service::process_balance_answer(const mm2::enable_tendermint_token_rpc& rpc) + void kdf_service::process_balance_answer(const kdf::enable_tendermint_token_rpc& rpc) { const auto& answer = rpc.result.value(); - mm2::balance_answer balance_answer; + kdf::balance_answer balance_answer; balance_answer.address = answer.balances.begin()->first; balance_answer.balance = answer.balances.begin()->second.spendable; @@ -1187,11 +1187,11 @@ namespace atomic_dex } } - void mm2_service::process_balance_answer(const mm2::enable_tendermint_with_assets_rpc& rpc) + void kdf_service::process_balance_answer(const kdf::enable_tendermint_with_assets_rpc& rpc) { const auto& answer = rpc.result.value(); { - mm2::balance_answer balance_answer; + kdf::balance_answer balance_answer; balance_answer.coin = rpc.request.ticker; balance_answer.balance = answer.tendermint_balances_infos.balances.spendable; @@ -1207,7 +1207,7 @@ namespace atomic_dex } for (auto [ticker, data] : answer.tendermint_token_balances_infos) { - mm2::balance_answer balance_answer; + kdf::balance_answer balance_answer; balance_answer.coin = ticker; balance_answer.address = answer.address; @@ -1220,12 +1220,12 @@ namespace atomic_dex } } - void mm2_service::enable_slp_coin(coin_config_t coin_config) + void kdf_service::enable_slp_coin(coin_config_t coin_config) { enable_slp_coins(t_coins{std::move(coin_config)}); } - void mm2_service::enable_slp_coins(const t_coins& coins) + void kdf_service::enable_slp_coins(const t_coins& coins) { constexpr auto bch_ticker = "BCH"; auto callback = [this](RpcRequest rpc) @@ -1239,7 +1239,7 @@ namespace atomic_dex std::unique_lock lock(m_coin_cfg_mutex); m_coins_informations[rpc.request.ticker].currently_enabled = true; dispatcher_.trigger(coin_fully_initialized{.tickers = {rpc.request.ticker}}); - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { for (const auto& slp_coin_info : rpc.request.slp_tokens_requests) { @@ -1265,7 +1265,7 @@ namespace atomic_dex fetch_single_balance(get_coin_info(rpc.request.ticker)); std::unique_lock lock(m_coin_cfg_mutex); m_coins_informations[rpc.request.ticker].currently_enabled = true; - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { for (const auto& slp_address_info : rpc.result->slp_addresses_infos) { @@ -1297,18 +1297,18 @@ namespace atomic_dex { for (const auto& coin_config : coins) { - mm2::enable_slp_rpc rpc{.request={.ticker = coin_config.ticker}}; + kdf::enable_slp_rpc rpc{.request={.ticker = coin_config.ticker}}; if (coin_config.ticker == bch_info.ticker) { continue; } - m_mm2_client.process_rpc_async(rpc.request, callback); + m_kdf_client.process_rpc_async(rpc.request, callback); } } else { - mm2::enable_bch_with_tokens_rpc rpc; + kdf::enable_bch_with_tokens_rpc rpc; rpc.request.ticker = bch_info.ticker; rpc.request.allow_slp_unsafe_conf = bch_info.allow_slp_unsafe_conf.has_value() && bch_info.allow_slp_unsafe_conf.value(); @@ -1322,17 +1322,17 @@ namespace atomic_dex } rpc.request.slp_tokens_requests.push_back({.ticker = coin_config.ticker}); } - m_mm2_client.process_rpc_async(rpc.request, callback); + m_kdf_client.process_rpc_async(rpc.request, callback); } } - void mm2_service::enable_slp_testnet_coin(coin_config_t coin_config) + void kdf_service::enable_slp_testnet_coin(coin_config_t coin_config) { enable_slp_testnet_coins(t_coins{std::move(coin_config)}); } - void mm2_service::enable_slp_testnet_coins(const t_coins& coins) + void kdf_service::enable_slp_testnet_coins(const t_coins& coins) { constexpr auto bch_ticker = "tBCH"; auto callback = [this](RpcRequest rpc) @@ -1346,7 +1346,7 @@ namespace atomic_dex std::unique_lock lock(m_coin_cfg_mutex); m_coins_informations[rpc.request.ticker].currently_enabled = true; dispatcher_.trigger(coin_fully_initialized{.tickers = {rpc.request.ticker}}); - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { for (const auto& slp_coin_info : rpc.request.slp_tokens_requests) { @@ -1372,7 +1372,7 @@ namespace atomic_dex fetch_single_balance(get_coin_info(rpc.request.ticker)); std::unique_lock lock(m_coin_cfg_mutex); m_coins_informations[rpc.request.ticker].currently_enabled = true; - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { for (const auto& slp_address_info : rpc.result->slp_addresses_infos) { @@ -1404,18 +1404,18 @@ namespace atomic_dex { for (const auto& coin_config : coins) { - mm2::enable_slp_rpc rpc{.request={.ticker = coin_config.ticker}}; + kdf::enable_slp_rpc rpc{.request={.ticker = coin_config.ticker}}; if (coin_config.ticker == bch_info.ticker) { continue; } - m_mm2_client.process_rpc_async(rpc.request, callback); + m_kdf_client.process_rpc_async(rpc.request, callback); } } else { - mm2::enable_bch_with_tokens_rpc rpc; + kdf::enable_bch_with_tokens_rpc rpc; rpc.request.ticker = bch_info.ticker; rpc.request.allow_slp_unsafe_conf = bch_info.allow_slp_unsafe_conf.has_value() && bch_info.allow_slp_unsafe_conf.value(); @@ -1429,14 +1429,14 @@ namespace atomic_dex } rpc.request.slp_tokens_requests.push_back({.ticker = coin_config.ticker}); } - m_mm2_client.process_rpc_async(rpc.request, callback); + m_kdf_client.process_rpc_async(rpc.request, callback); } } - void mm2_service::process_balance_answer(const mm2::enable_slp_rpc& rpc) + void kdf_service::process_balance_answer(const kdf::enable_slp_rpc& rpc) { const auto& answer = rpc.result.value(); - mm2::balance_answer balance_answer; + kdf::balance_answer balance_answer; balance_answer.address = answer.balances.begin()->first; balance_answer.balance = answer.balances.begin()->second.spendable; @@ -1448,11 +1448,11 @@ namespace atomic_dex } } - void mm2_service::process_balance_answer(const mm2::enable_bch_with_tokens_rpc& rpc) + void kdf_service::process_balance_answer(const kdf::enable_bch_with_tokens_rpc& rpc) { const auto& answer = rpc.result.value(); { - mm2::balance_answer balance_answer; + kdf::balance_answer balance_answer; balance_answer.coin = rpc.request.ticker; balance_answer.balance = answer.bch_addresses_infos.begin()->second.balances.spendable; @@ -1469,7 +1469,7 @@ namespace atomic_dex continue; } - mm2::balance_answer balance_answer; + kdf::balance_answer balance_answer; balance_answer.coin = data.balances.begin()->first; balance_answer.address = address; @@ -1483,7 +1483,7 @@ namespace atomic_dex } void - mm2_service::disable_multiple_coins(const std::vector& tickers) + kdf_service::disable_multiple_coins(const std::vector& tickers) { for (const auto& ticker: tickers) { @@ -1499,19 +1499,19 @@ namespace atomic_dex } auto - mm2_service::batch_balance_and_tx(bool is_a_reset, std::vector tickers, bool is_during_enabling, bool only_tx) + kdf_service::batch_balance_and_tx(bool is_a_reset, std::vector tickers, bool is_during_enabling, bool only_tx) { (void)tickers; (void)is_during_enabling; auto&& [batch_array, tickers_idx, tokens_to_fetch] = prepare_batch_balance_and_tx(only_tx); - SPDLOG_DEBUG("mm2_service::batch_balance_and_tx"); - return m_mm2_client.async_rpc_batch_standalone(batch_array) + SPDLOG_DEBUG("kdf_service::batch_balance_and_tx"); + return m_kdf_client.async_rpc_batch_standalone(batch_array) .then( [this, tokens_to_fetch = tokens_to_fetch, is_a_reset, tickers, batch_array = batch_array](web::http::http_response resp) { try { - auto answers = mm2::basic_batch_answer(resp); + auto answers = kdf::basic_batch_answer(resp); if (not answers.contains("error")) { for (auto i = 0ul; i < answers.size(); i++) @@ -1563,9 +1563,9 @@ namespace atomic_dex } std::tuple, std::vector> - mm2_service::prepare_batch_balance_and_tx(bool only_tx) const + kdf_service::prepare_batch_balance_and_tx(bool only_tx) const { - SPDLOG_DEBUG("mm2_service::prepare_batch_balance_and_tx"); + SPDLOG_DEBUG("kdf_service::prepare_batch_balance_and_tx"); const auto& enabled_coins = get_enabled_coins(); nlohmann::json batch_array = nlohmann::json::array(); std::vector tickers_idx; @@ -1600,8 +1600,8 @@ namespace atomic_dex } } t_tx_history_request request{.coin = ticker, .limit = limit}; - nlohmann::json j = mm2::template_request(method, requires_v2); - mm2::to_json(j, request); + nlohmann::json j = kdf::template_request(method, requires_v2); + kdf::to_json(j, request); batch_array.push_back(j); } @@ -1630,8 +1630,8 @@ namespace atomic_dex } SPDLOG_WARN("Getting balance for {} ", coin.ticker); t_balance_request balance_request{.coin = coin.ticker}; - nlohmann::json j = mm2::template_request("my_balance"); - mm2::to_json(j, balance_request); + nlohmann::json j = kdf::template_request("my_balance"); + kdf::to_json(j, balance_request); batch_array.push_back(j); tickers_idx.push_back(coin.ticker); } @@ -1640,7 +1640,7 @@ namespace atomic_dex } std::pair - mm2_service::process_batch_enable_answer(const json& answer) + kdf_service::process_batch_enable_answer(const json& answer) { std::string error = answer.dump(4); std::string data = answer.dump(); @@ -1673,7 +1673,7 @@ namespace atomic_dex return {false, error}; } - void mm2_service::enable_zhtlc(const t_coins& coins) + void kdf_service::enable_zhtlc(const t_coins& coins) { auto request_functor = [this](coin_config_t coin_info) -> std::pair> { @@ -1699,8 +1699,8 @@ namespace atomic_dex request.sync_height = sync_height; } - nlohmann::json j = mm2::template_request("task::enable_z_coin::init", true); - mm2::to_json(j, request); + nlohmann::json j = kdf::template_request("task::enable_z_coin::init", true); + kdf::to_json(j, request); nlohmann::json batch = nlohmann::json::array(); batch.push_back(j); // SPDLOG_INFO("ZHTLC request: {}", batch.dump(4)); @@ -1710,13 +1710,13 @@ namespace atomic_dex auto answer_functor = [this](nlohmann::json batch, std::vector tickers) { - m_mm2_client.async_rpc_batch_standalone(batch) + m_kdf_client.async_rpc_batch_standalone(batch) .then( [this, tickers](web::http::http_response resp) mutable { try { - auto answers = mm2::basic_batch_answer(resp); + auto answers = kdf::basic_batch_answer(resp); auto& settings_system = m_system_manager.get_system(); if (answers.count("error") == 0) @@ -1763,16 +1763,16 @@ namespace atomic_dex // SPDLOG_INFO("{} enable_z_coin Task ID: {}", tickers[idx], task_id); - nlohmann::json j = mm2::template_request("task::enable_z_coin::status", true); - mm2::to_json(j, z_request); + nlohmann::json j = kdf::template_request("task::enable_z_coin::status", true); + kdf::to_json(j, z_request); z_batch_array.push_back(j); std::string last_event = "none"; std::string event = "none"; do { - pplx::task z_resp_task = m_mm2_client.async_rpc_batch_standalone(z_batch_array); + pplx::task z_resp_task = m_kdf_client.async_rpc_batch_standalone(z_batch_array); web::http::http_response z_resp = z_resp_task.get(); - auto z_answers = mm2::basic_batch_answer(z_resp); + auto z_answers = kdf::basic_batch_answer(z_resp); z_error = z_answers; std::string status = z_answers[0].at("result").at("status").get(); @@ -1950,7 +1950,7 @@ namespace atomic_dex } } - nlohmann::json mm2_service::get_zhtlc_status(const std::string coin) const + nlohmann::json kdf_service::get_zhtlc_status(const std::string coin) const { const auto coin_info = get_coin_info(coin); if (coin_info.is_zhtlc_family) @@ -1960,7 +1960,7 @@ namespace atomic_dex return {}; } - bool mm2_service::is_zhtlc_coin_ready(const std::string coin) const + bool kdf_service::is_zhtlc_coin_ready(const std::string coin) const { const auto coin_info = get_coin_info(coin); if (coin_info.is_zhtlc_family) @@ -1987,7 +1987,7 @@ namespace atomic_dex return true; } - coin_config_t mm2_service::get_coin_info(const std::string& ticker) const + coin_config_t kdf_service::get_coin_info(const std::string& ticker) const { std::shared_lock lock(m_coin_cfg_mutex); if (m_coins_informations.find(ticker) == m_coins_informations.cend()) @@ -1997,18 +1997,18 @@ namespace atomic_dex return m_coins_informations.at(ticker); } - bool mm2_service::is_coin_enabled(const std::string& ticker) const + bool kdf_service::is_coin_enabled(const std::string& ticker) const { return m_coins_informations[ticker].currently_enabled; } - bool mm2_service::has_coin(const std::string& ticker) const + bool kdf_service::has_coin(const std::string& ticker) const { return m_coins_informations.contains(ticker); } // [smk] Only called by trading_page::process_action() - mm2::orderbook_result_rpc mm2_service::get_orderbook(t_mm2_ec& ec) const + kdf::orderbook_result_rpc kdf_service::get_orderbook(t_kdf_ec& ec) const { auto&& [base, rel] = this->m_synchronized_ticker_pair.get(); const std::string pair = base + "/" + rel; @@ -2032,19 +2032,19 @@ namespace atomic_dex nlohmann::json generate_req(std::string request_name, auto request, bool is_v2=false) { - nlohmann::json current_request = mm2::template_request(std::move(request_name), is_v2); - mm2::to_json(current_request, request); + nlohmann::json current_request = kdf::template_request(std::move(request_name), is_v2); + kdf::to_json(current_request, request); return current_request; } - void mm2_service::process_orderbook(bool is_a_reset) + void kdf_service::process_orderbook(bool is_a_reset) { prepare_orderbook(is_a_reset); } - void mm2_service::prepare_orderbook(bool is_a_reset) + void kdf_service::prepare_orderbook(bool is_a_reset) { auto callback = [this, is_a_reset](RpcRequest rpc) { @@ -2059,8 +2059,8 @@ namespace atomic_dex { nlohmann::json batch = nlohmann::json::array(); auto&& [base, rel] = m_synchronized_ticker_pair.get(); - batch.push_back(generate_req("max_taker_vol", mm2::max_taker_vol_request{.coin = base})); - batch.push_back(generate_req("max_taker_vol", mm2::max_taker_vol_request{.coin = rel})); + batch.push_back(generate_req("max_taker_vol", kdf::max_taker_vol_request{.coin = base})); + batch.push_back(generate_req("max_taker_vol", kdf::max_taker_vol_request{.coin = rel})); batch.push_back(generate_req("min_trading_vol", t_min_volume_request{.coin = base})); batch.push_back(generate_req("min_trading_vol", t_min_volume_request{.coin = rel})); process_orderbook_extras(batch, is_a_reset); @@ -2078,11 +2078,11 @@ namespace atomic_dex if (rel.empty() || base.empty() || base_ticker == rel_ticker) SPDLOG_ERROR("Invalid ticker pair while requesting orderbook: {} {}", base, rel); - mm2::orderbook_rpc rpc{.request={.base = base, .rel = rel}}; - m_mm2_client.process_rpc_async(rpc.request, callback); + kdf::orderbook_rpc rpc{.request={.base = base, .rel = rel}}; + m_kdf_client.process_rpc_async(rpc.request, callback); } - void mm2_service::process_orderbook_extras(nlohmann::json batch, bool is_a_reset) + void kdf_service::process_orderbook_extras(nlohmann::json batch, bool is_a_reset) { if (batch.empty()) { @@ -2092,7 +2092,7 @@ namespace atomic_dex auto answer_functor = [this, is_a_reset](web::http::http_response resp) { - auto answer = mm2::basic_batch_answer(resp); + auto answer = kdf::basic_batch_answer(resp); if (answer.is_array()) { if (answer.size() < 1) @@ -2110,7 +2110,7 @@ namespace atomic_dex } auto&& [base, rel] = m_synchronized_ticker_pair.get(); - auto base_max_taker_vol_answer = mm2::rpc_process_answer_batch(answer[0], "max_taker_vol"); + auto base_max_taker_vol_answer = kdf::rpc_process_answer_batch(answer[0], "max_taker_vol"); if (base_max_taker_vol_answer.rpc_result_code == 200) { if (base == base_max_taker_vol_answer.result->coin) @@ -2119,7 +2119,7 @@ namespace atomic_dex } } - auto rel_max_taker_vol_answer = mm2::rpc_process_answer_batch(answer[1], "max_taker_vol"); + auto rel_max_taker_vol_answer = kdf::rpc_process_answer_batch(answer[1], "max_taker_vol"); if (rel_max_taker_vol_answer.rpc_result_code == 200) { if (rel == rel_max_taker_vol_answer.result->coin) @@ -2128,14 +2128,14 @@ namespace atomic_dex } } - auto base_min_taker_vol_answer = mm2::rpc_process_answer_batch(answer[2], "min_trading_vol"); + auto base_min_taker_vol_answer = kdf::rpc_process_answer_batch(answer[2], "min_trading_vol"); if (base_min_taker_vol_answer.rpc_result_code == 200) { m_synchronized_min_taker_vol->first = base_min_taker_vol_answer.result.value(); } - auto rel_min_taker_vol_answer = mm2::rpc_process_answer_batch(answer[3], "min_trading_vol"); + auto rel_min_taker_vol_answer = kdf::rpc_process_answer_batch(answer[3], "min_trading_vol"); if (rel_min_taker_vol_answer.rpc_result_code == 200) { m_synchronized_min_taker_vol->second = rel_min_taker_vol_answer.result.value(); @@ -2143,12 +2143,12 @@ namespace atomic_dex } } }; - m_mm2_client.async_rpc_batch_standalone(batch) + m_kdf_client.async_rpc_batch_standalone(batch) .then(answer_functor) .then([this, batch](pplx::task previous_task) { this->handle_exception_pplx_task(previous_task, "process_orderbook_extras", batch); }); } - void mm2_service::fetch_current_orderbook_thread(bool is_a_reset) + void kdf_service::fetch_current_orderbook_thread(bool is_a_reset) { //! If thread is not active ex: we are not on the trading page anymore, we continue sleeping. if (!m_orderbook_thread_active) @@ -2158,7 +2158,7 @@ namespace atomic_dex process_orderbook(is_a_reset); } - void mm2_service::fetch_single_balance(const coin_config_t& cfg_infos) + void kdf_service::fetch_single_balance(const coin_config_t& cfg_infos) { nlohmann::json batch_array = nlohmann::json::array(); if (is_pin_cfg_enabled()) @@ -2172,16 +2172,16 @@ namespace atomic_dex } t_balance_request balance_request{.coin = cfg_infos.ticker}; - // SPDLOG_DEBUG("Getting balance from mm2 for {} ", cfg_infos.ticker); - nlohmann::json j = mm2::template_request("my_balance"); - mm2::to_json(j, balance_request); + // SPDLOG_DEBUG("Getting balance from kdf for {} ", cfg_infos.ticker); + nlohmann::json j = kdf::template_request("my_balance"); + kdf::to_json(j, balance_request); batch_array.push_back(j); auto answer_functor = [this](web::http::http_response resp) { try { - auto answers = mm2::basic_batch_answer(resp); + auto answers = kdf::basic_batch_answer(resp); if (!answers.contains("error") && !answers[0].contains("error")) { this->process_balance_answer(answers[0]); @@ -2195,11 +2195,11 @@ namespace atomic_dex auto error_functor = [this, batch = batch_array](pplx::task previous_task) { this->handle_exception_pplx_task(previous_task, "fetch_single_balance", batch); }; - m_mm2_client.async_rpc_batch_standalone(batch_array).then(answer_functor).then(error_functor); + m_kdf_client.async_rpc_batch_standalone(batch_array).then(answer_functor).then(error_functor); } void - mm2_service::fetch_infos_thread(bool is_a_refresh, bool only_tx) + kdf_service::fetch_infos_thread(bool is_a_refresh, bool only_tx) { if (only_tx) { @@ -2214,7 +2214,7 @@ namespace atomic_dex } } - void mm2_service::spawn_mm2_instance(std::string wallet_name, std::string passphrase, bool with_pin_cfg, std::string rpcpass) + void kdf_service::spawn_kdf_instance(std::string wallet_name, std::string passphrase, bool with_pin_cfg, std::string rpcpass) { this->m_balance_factor = utils::determine_balance_factor(with_pin_cfg); SPDLOG_DEBUG("balance factor is: {}", m_balance_factor); @@ -2223,73 +2223,73 @@ namespace atomic_dex this->dispatcher_.trigger(this->retrieve_coins_informations()); this->dispatcher_.trigger(); this->dispatcher_.trigger(); - mm2_config cfg{ + kdf_config cfg{ .passphrase = std::move(passphrase), .rpc_password = std::move(rpcpass) == "" ? std::move(atomic_dex::gen_random_password()) : std::move(rpcpass) }; - mm2::set_system_manager(m_system_manager); - mm2::set_rpc_password(cfg.rpc_password); + kdf::set_system_manager(m_system_manager); + kdf::set_rpc_password(cfg.rpc_password); json json_cfg; - const auto tools_path = ag::core::assets_real_path() / "tools/mm2/"; + const auto tools_path = ag::core::assets_real_path() / "tools/kdf/"; nlohmann::to_json(json_cfg, cfg); - std::filesystem::path mm2_cfg_path = (std::filesystem::temp_directory_path() / "MM2.json"); + std::filesystem::path kdf_cfg_path = (std::filesystem::temp_directory_path() / "KDF.json"); QFile ofs; - ofs.setFileName(std_path_to_qstring(mm2_cfg_path)); + ofs.setFileName(std_path_to_qstring(kdf_cfg_path)); ofs.open(QIODevice::WriteOnly | QIODevice::Text); ofs.write(QString::fromStdString(json_cfg.dump()).toUtf8()); ofs.close(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); - env.insert("MM_CONF_PATH", std_path_to_qstring(mm2_cfg_path)); - env.insert("MM_LOG", std_path_to_qstring(utils::get_mm2_atomic_dex_current_log_file())); + env.insert("MM_CONF_PATH", std_path_to_qstring(kdf_cfg_path)); + env.insert("MM_LOG", std_path_to_qstring(utils::get_kdf_atomic_dex_current_log_file())); env.insert("MM_COINS_PATH", std_path_to_qstring((utils::get_current_configs_path() / "coins.json"))); - QProcess mm2_instance; - mm2_instance.setProgram(std_path_to_qstring((tools_path / atomic_dex::g_dex_api))); - mm2_instance.setWorkingDirectory(std_path_to_qstring(tools_path)); - mm2_instance.setProcessEnvironment(env); - bool started = mm2_instance.startDetached(); + QProcess kdf_instance; + kdf_instance.setProgram(std_path_to_qstring((tools_path / atomic_dex::g_dex_api))); + kdf_instance.setWorkingDirectory(std_path_to_qstring(tools_path)); + kdf_instance.setProcessEnvironment(env); + bool started = kdf_instance.startDetached(); if (!started) { - SPDLOG_ERROR("Couldn't start mm2"); + SPDLOG_ERROR("Couldn't start kdf"); std::exit(EXIT_FAILURE); } - m_mm2_init_thread = std::thread( - [this, mm2_cfg_path]() + m_kdf_init_thread = std::thread( + [this, kdf_cfg_path]() { // std::this_thread:: using namespace std::chrono_literals; - auto check_mm2_alive = []() { return mm2::rpc_version() != "error occured during rpc_version"; }; + auto check_kdf_alive = []() { return kdf::rpc_version() != "error occured during rpc_version"; }; static std::size_t nb_try = 0; - while (not check_mm2_alive()) + while (not check_kdf_alive()) { nb_try += 1; if (nb_try == 30) { - SPDLOG_ERROR("MM2 not started correctly"); - //! TODO: emit mm2_failed_initialization - std::filesystem::remove(mm2_cfg_path); + SPDLOG_ERROR("KDF not started correctly"); + //! TODO: emit kdf_failed_initialization + std::filesystem::remove(kdf_cfg_path); return; } std::this_thread::sleep_for(1s); } - // m_mm2_client.connect_client(); - std::filesystem::remove(mm2_cfg_path); - SPDLOG_INFO("mm2 is initialized"); - dispatcher_.trigger(); + // m_kdf_client.connect_client(); + std::filesystem::remove(kdf_cfg_path); + SPDLOG_INFO("kdf is initialized"); + dispatcher_.trigger(); enable_default_coins(); - m_mm2_running = true; - dispatcher_.trigger(); + m_kdf_running = true; + dispatcher_.trigger(); }); } std::pair - mm2_service::get_tx(t_mm2_ec& ec) const + kdf_service::get_tx(t_kdf_ec& ec) const { const auto& ticker = get_current_ticker(); // SPDLOG_DEBUG("asking history of ticker: {}", ticker); @@ -2305,19 +2305,19 @@ namespace atomic_dex } t_tx_state - mm2_service::get_tx_state(t_mm2_ec& ec) const + kdf_service::get_tx_state(t_kdf_ec& ec) const { return get_tx(ec).second; } t_transactions - mm2_service::get_tx_history(t_mm2_ec& ec) const + kdf_service::get_tx_history(t_kdf_ec& ec) const { return get_tx(ec).first; } t_float_50 - mm2_service::get_balance_info_f(const std::string& ticker) const + kdf_service::get_balance_info_f(const std::string& ticker) const { std::error_code ec; std::string balance_str = get_balance_info(ticker, ec); @@ -2327,7 +2327,7 @@ namespace atomic_dex } std::string - mm2_service::get_balance_info(const std::string& ticker, t_mm2_ec& ec) const + kdf_service::get_balance_info(const std::string& ticker, t_kdf_ec& ec) const { // This happens quite often std::shared_lock lock(m_balance_mutex); ///! read @@ -2360,10 +2360,10 @@ namespace atomic_dex } void - mm2_service::batch_fetch_orders_and_swap(bool after_manual_reset) + kdf_service::batch_fetch_orders_and_swap(bool after_manual_reset) { nlohmann::json batch = nlohmann::json::array(); - nlohmann::json my_orders_request = mm2::template_request("my_orders"); + nlohmann::json my_orders_request = kdf::template_request("my_orders"); batch.push_back(my_orders_request); // SPDLOG_DEBUG("my_orders_request {}", my_orders_request.dump(4)); @@ -2384,7 +2384,7 @@ namespace atomic_dex } //! First time fetch or current page - nlohmann::json my_swaps = mm2::template_request("my_recent_swaps"); + nlohmann::json my_swaps = kdf::template_request("my_recent_swaps"); t_my_recent_swaps_request request{ .limit = limit, .page_number = current_page, @@ -2398,7 +2398,7 @@ namespace atomic_dex // SPDLOG_INFO("my_swaps req: {}", my_swaps.dump(4)); //! Active swaps - nlohmann::json active_swaps = mm2::template_request("active_swaps"); + nlohmann::json active_swaps = kdf::template_request("active_swaps"); t_active_swaps_request active_swaps_request{.statuses = true}; to_json(active_swaps, active_swaps_request); batch.push_back(active_swaps); @@ -2410,12 +2410,12 @@ namespace atomic_dex //! Parsing Resp orders_and_swaps result; - auto answers = mm2::basic_batch_answer(resp); + auto answers = kdf::basic_batch_answer(resp); //! Extract - const auto orders_answers = mm2::rpc_process_answer_batch(answers[0], "my_orders"); - const auto swap_answer = mm2::rpc_process_answer_batch(answers[1], "my_recent_swaps"); - const auto active_swaps_answer = mm2::rpc_process_answer_batch(answers[2], "active_swaps"); + const auto orders_answers = kdf::rpc_process_answer_batch(answers[0], "my_orders"); + const auto swap_answer = kdf::rpc_process_answer_batch(answers[1], "my_recent_swaps"); + const auto active_swaps_answer = kdf::rpc_process_answer_batch(answers[2], "active_swaps"); result.orders_and_swaps.reserve(orders_answers.orders.size() + limit); result.nb_orders = orders_answers.orders.size(); @@ -2471,12 +2471,12 @@ namespace atomic_dex }; // SPDLOG_INFO("batch request:{}", batch.dump(4)); - m_mm2_client.async_rpc_batch_standalone(batch) + m_kdf_client.async_rpc_batch_standalone(batch) .then(answer_functor) .then([this, batch](pplx::task previous_task) { this->handle_exception_pplx_task(previous_task, "batch_fetch_orders_and_swap", batch); }); } - void mm2_service::process_tx_tokenscan(const std::string& ticker, [[maybe_unused]] bool is_a_refresh) + void kdf_service::process_tx_tokenscan(const std::string& ticker, [[maybe_unused]] bool is_a_refresh) { SPDLOG_DEBUG("Process transactions of ticker: {}", ticker); std::error_code ec; @@ -2492,7 +2492,7 @@ namespace atomic_dex } else { - const std::string contract_address = get_raw_mm2_ticker_cfg(ticker).at("protocol").at("protocol_data").at("contract_address"); + const std::string contract_address = get_raw_kdf_ticker_cfg(ticker).at("protocol").at("protocol_data").at("contract_address"); out = "/api/v2/" + token_url + "/" + contract_address + "/" + address; } return out; @@ -2550,11 +2550,11 @@ namespace atomic_dex }; std::string url = retrieve_api_functor(ticker, address(ticker, ec)); SPDLOG_INFO("url scan: {}", url); - mm2::async_process_rpc_get(mm2::g_etherscan_proxy_http_client, "tx_history", url) + kdf::async_process_rpc_get(kdf::g_etherscan_proxy_http_client, "tx_history", url) .then( [this, ticker](const web::http::http_response& resp) { - auto answer = m_mm2_client.rpc_process_answer(resp, "tx_history"); + auto answer = m_kdf_client.rpc_process_answer(resp, "tx_history"); if (answer.rpc_result_code != 200) { @@ -2628,19 +2628,19 @@ namespace atomic_dex } void - mm2_service::update_sync_ticker_pair(std::string base, std::string rel) + kdf_service::update_sync_ticker_pair(std::string base, std::string rel) { // SPDLOG_DEBUG("update_sync_ticker_pair: [{} / {}]", base, rel); this->m_synchronized_ticker_pair = std::make_pair(base, rel); } void - mm2_service::on_refresh_orderbook_model_data(const refresh_orderbook_model_data& evt) + kdf_service::on_refresh_orderbook_model_data(const refresh_orderbook_model_data& evt) { // SPDLOG_DEBUG("refreshing orderbook pair: [{} / {}]", evt.base, evt.rel); this->m_synchronized_ticker_pair = std::make_pair(evt.base, evt.rel); - if (this->m_mm2_running) + if (this->m_kdf_running) { // SPDLOG_DEBUG("process_orderbook(true)"); process_orderbook(true); @@ -2648,7 +2648,7 @@ namespace atomic_dex } void - mm2_service::on_gui_enter_trading([[maybe_unused]] const gui_enter_trading& evt) + kdf_service::on_gui_enter_trading([[maybe_unused]] const gui_enter_trading& evt) { SPDLOG_DEBUG("{} l{} f[{}]", __FUNCTION__, __LINE__, std::filesystem::path(__FILE__).filename().string()); @@ -2656,14 +2656,14 @@ namespace atomic_dex } void - mm2_service::on_gui_leave_trading([[maybe_unused]] const gui_leave_trading& evt) + kdf_service::on_gui_leave_trading([[maybe_unused]] const gui_leave_trading& evt) { SPDLOG_DEBUG("{} l{} f[{}]", __FUNCTION__, __LINE__, std::filesystem::path(__FILE__).filename().string()); m_orderbook_thread_active = false; } bool - mm2_service::do_i_have_enough_funds(const std::string& ticker, const t_float_50& amount) const + kdf_service::do_i_have_enough_funds(const std::string& ticker, const t_float_50& amount) const { SPDLOG_DEBUG("do_i_have_enough_funds for {}: [{}]", ticker, amount.str(8, std::ios_base::fixed)); t_float_50 funds = get_balance_info_f(ticker); @@ -2671,7 +2671,7 @@ namespace atomic_dex } std::string - mm2_service::address(const std::string& ticker, t_mm2_ec& ec) const + kdf_service::address(const std::string& ticker, t_kdf_ec& ec) const { std::shared_lock lock(m_balance_mutex); auto it = m_balance_informations.find(ticker); @@ -2687,19 +2687,19 @@ namespace atomic_dex } bool - mm2_service::is_orderbook_thread_active() const + kdf_service::is_orderbook_thread_active() const { return this->m_orderbook_thread_active.load(); } nlohmann::json - mm2_service::get_raw_mm2_ticker_cfg(const std::string& ticker) const + kdf_service::get_raw_kdf_ticker_cfg(const std::string& ticker) const { nlohmann::json out; std::shared_lock lock(m_raw_coin_cfg_mutex); - const auto it = m_mm2_raw_coins_cfg.find(ticker); - if (it != m_mm2_raw_coins_cfg.end()) + const auto it = m_kdf_raw_coins_cfg.find(ticker); + if (it != m_kdf_raw_coins_cfg.end()) { atomic_dex::coin_element element = it->second; to_json(out, element); @@ -2708,26 +2708,26 @@ namespace atomic_dex return nlohmann::json::object(); } - mm2_service::t_pair_max_vol - mm2_service::get_taker_vol() const + kdf_service::t_pair_max_vol + kdf_service::get_taker_vol() const { return m_synchronized_max_taker_vol.get(); } - mm2_service::t_pair_min_vol - mm2_service::get_min_vol() const + kdf_service::t_pair_min_vol + kdf_service::get_min_vol() const { return m_synchronized_min_taker_vol.get(); } bool - mm2_service::is_pin_cfg_enabled() const + kdf_service::is_pin_cfg_enabled() const { return m_balance_factor != 1.0; } void - mm2_service::reset_fake_balance_to_zero(const std::string& ticker) + kdf_service::reset_fake_balance_to_zero(const std::string& ticker) { { std::unique_lock lock(m_balance_mutex); @@ -2737,7 +2737,7 @@ namespace atomic_dex } void - mm2_service::decrease_fake_balance(const std::string& ticker, const std::string& amount) + kdf_service::decrease_fake_balance(const std::string& ticker, const std::string& amount) { SPDLOG_DEBUG("decrease_fake_balance for {}: [{}]", ticker, amount); t_float_50 balance = get_balance_info_f(ticker); @@ -2760,10 +2760,10 @@ namespace atomic_dex } void - mm2_service::process_tx_answer(const nlohmann::json& answer_json, std::string ticker) + kdf_service::process_tx_answer(const nlohmann::json& answer_json, std::string ticker) { - mm2::tx_history_answer answer; - mm2::from_json(answer_json, answer); + kdf::tx_history_answer answer; + kdf::from_json(answer_json, answer); t_tx_state state; state.state = answer.result.value().sync_status.state; state.current_block = answer.result.value().current_block; @@ -2837,13 +2837,13 @@ namespace atomic_dex void - mm2_service::process_balance_answer(const nlohmann::json& answer) + kdf_service::process_balance_answer(const nlohmann::json& answer) { try { t_balance_answer answer_r; - mm2::from_json(answer, answer_r); + kdf::from_json(answer, answer_r); if (is_pin_cfg_enabled()) { std::shared_lock lock(m_balance_mutex); @@ -2868,19 +2868,19 @@ namespace atomic_dex } } - mm2::mm2_client& mm2_service::get_mm2_client() + kdf::kdf_client& kdf_service::get_kdf_client() { - return m_mm2_client; + return m_kdf_client; } std::string - mm2_service::get_current_ticker() const + kdf_service::get_current_ticker() const { return m_current_ticker.get(); } bool - mm2_service::set_current_ticker(const std::string& ticker) + kdf_service::set_current_ticker(const std::string& ticker) { if (ticker != get_current_ticker()) { @@ -2891,7 +2891,7 @@ namespace atomic_dex } void - mm2_service::add_new_coin(const nlohmann::json& coin_cfg_json, const nlohmann::json& raw_coin_cfg_json) + kdf_service::add_new_coin(const nlohmann::json& coin_cfg_json, const nlohmann::json& raw_coin_cfg_json) { //! Normal cfg part SPDLOG_DEBUG("[{}], [{}]", coin_cfg_json.dump(4), raw_coin_cfg_json.dump(4)); @@ -2918,7 +2918,7 @@ namespace atomic_dex if (not raw_coin_cfg_json.empty() && not is_this_ticker_present_in_raw_cfg(raw_coin_cfg_json.at("coin").get())) { const fs::path coins_json_path{atomic_dex::utils::get_current_configs_path() / "coins.json"}; - SPDLOG_DEBUG("Adding entry : {} to mm2 coins file {}", raw_coin_cfg_json.dump(4), coins_json_path.string()); + SPDLOG_DEBUG("Adding entry : {} to kdf coins file {}", raw_coin_cfg_json.dump(4), coins_json_path.string()); QFile ifs; ifs.setFileName(std_path_to_qstring(coins_json_path)); ifs.open(QIODevice::ReadOnly | QIODevice::Text); @@ -2941,21 +2941,21 @@ namespace atomic_dex } bool - mm2_service::is_this_ticker_present_in_raw_cfg(const std::string& ticker) const + kdf_service::is_this_ticker_present_in_raw_cfg(const std::string& ticker) const { std::shared_lock lock(m_raw_coin_cfg_mutex); - return m_mm2_raw_coins_cfg.find(ticker) != m_mm2_raw_coins_cfg.end(); + return m_kdf_raw_coins_cfg.find(ticker) != m_kdf_raw_coins_cfg.end(); } bool - mm2_service::is_this_ticker_present_in_normal_cfg(const std::string& ticker) const + kdf_service::is_this_ticker_present_in_normal_cfg(const std::string& ticker) const { std::shared_lock lock(m_coin_cfg_mutex); return m_coins_informations.find(ticker) != m_coins_informations.end(); } void - mm2_service::remove_custom_coin(const std::string& ticker) + kdf_service::remove_custom_coin(const std::string& ticker) { //! Coin need to be disabled to be removed assert(not get_coin_info(ticker).currently_enabled); @@ -2986,7 +2986,7 @@ namespace atomic_dex if (is_this_ticker_present_in_raw_cfg(ticker)) { - SPDLOG_DEBUG("remove it from mm2 cfg: {}", ticker); + SPDLOG_DEBUG("remove it from kdf cfg: {}", ticker); fs::path coins_json_path{atomic_dex::utils::get_current_configs_path() / "coins.json"}; QFile ifs; ifs.setFileName(std_path_to_qstring(coins_json_path)); @@ -3013,7 +3013,7 @@ namespace atomic_dex } std::vector - mm2_service::get_electrum_server_from_token(const std::string& ticker) + kdf_service::get_electrum_server_from_token(const std::string& ticker) { std::vector servers; const coin_config_t cfg = this->get_coin_info(ticker); @@ -3034,13 +3034,13 @@ namespace atomic_dex } orders_and_swaps - mm2_service::get_orders_and_swaps() const + kdf_service::get_orders_and_swaps() const { return m_orders_and_swaps.get(); } void - mm2_service::set_orders_and_swaps_pagination_infos(std::size_t current_page, std::size_t limit, t_filtering_infos filter_infos) + kdf_service::set_orders_and_swaps_pagination_infos(std::size_t current_page, std::size_t limit, t_filtering_infos filter_infos) { { m_orders_and_swaps = orders_and_swaps{.current_page = current_page, .limit = limit, .filtering_infos = std::move(filter_infos)}; @@ -3049,7 +3049,7 @@ namespace atomic_dex } void - mm2_service::handle_exception_pplx_task(pplx::task previous_task, const std::string& from, nlohmann::json request) + kdf_service::handle_exception_pplx_task(pplx::task previous_task, const std::string& from, nlohmann::json request) { try { diff --git a/src/core/atomicdex/services/mm2/mm2.service.hpp b/src/core/atomicdex/services/kdf/kdf.service.hpp similarity index 80% rename from src/core/atomicdex/services/mm2/mm2.service.hpp rename to src/core/atomicdex/services/kdf/kdf.service.hpp index acec7b3cd3..131d54226a 100644 --- a/src/core/atomicdex/services/mm2/mm2.service.hpp +++ b/src/core/atomicdex/services/kdf/kdf.service.hpp @@ -27,21 +27,21 @@ #include #include -#include "atomicdex/api/mm2/mm2.client.hpp" -#include "atomicdex/api/mm2/mm2.constants.hpp" -#include "atomicdex/api/mm2/mm2.error.code.hpp" -#include "atomicdex/api/mm2/mm2.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.min_trading_vol.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.max_taker_vol.hpp" -#include "atomicdex/api/mm2/rpc_v1/rpc.my_balance.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.orderbook.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.enable_slp_rpc.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.enable_tendermint_with_assets.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.enable_tendermint_token.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.enable_erc20.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.enable_eth_with_tokens.hpp" -#include "atomicdex/config/raw.mm2.coins.cfg.hpp" +#include "atomicdex/api/kdf/kdf.client.hpp" +#include "atomicdex/api/kdf/kdf.constants.hpp" +#include "atomicdex/api/kdf/kdf.error.code.hpp" +#include "atomicdex/api/kdf/kdf.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.min_trading_vol.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.max_taker_vol.hpp" +#include "atomicdex/api/kdf/rpc_v1/rpc.my_balance.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.orderbook.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.enable_slp_rpc.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_with_assets.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.enable_tendermint_token.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.enable_erc20.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.enable_eth_with_tokens.hpp" +#include "atomicdex/config/raw.kdf.coins.cfg.hpp" #include "atomicdex/constants/dex.constants.hpp" #include "atomicdex/data/dex/orders.and.swaps.data.hpp" #include "atomicdex/data/wallet/tx.data.hpp" @@ -60,17 +60,17 @@ namespace atomic_dex using t_coins_registry = std::unordered_map; using t_coins = std::vector; - class ENTT_API mm2_service final : public ag::ecs::pre_update_system + class ENTT_API kdf_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_kdf_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_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; @@ -79,7 +79,7 @@ namespace atomic_dex ag::ecs::system_manager& m_system_manager; - mm2::mm2_client m_mm2_client; + kdf::kdf_client m_kdf_client; //! Current ticker t_synchronized_ticker m_current_ticker{g_primary_dex_coin}; @@ -90,14 +90,14 @@ namespace atomic_dex 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; - t_mm2_time_point m_activation_clock; + t_kdf_time_point m_orderbook_clock; + t_kdf_time_point m_info_clock; + t_kdf_time_point m_activation_clock; //! Atomicity / Threads - std::atomic_bool m_mm2_running{false}; + std::atomic_bool m_kdf_running{false}; std::atomic_bool m_orderbook_thread_active{false}; // Only active when in trading view (pro and simple) - std::thread m_mm2_init_thread; + std::thread m_kdf_init_thread; //! Current wallet name std::string m_current_wallet_name; @@ -112,9 +112,9 @@ namespace atomic_dex 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{mm2::orderbook_result_rpc{}}; + t_orderbook m_orderbook{kdf::orderbook_result_rpc{}}; 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()}; + t_kdf_raw_coins_registry m_kdf_raw_coins_cfg{parse_raw_kdf_coins_file()}; t_coins m_activation_queue; //! Balance factor @@ -134,7 +134,7 @@ namespace atomic_dex //! std::pair process_batch_enable_answer(const nlohmann::json& answer); - [[nodiscard]] std::pair get_tx(t_mm2_ec& ec) const; + [[nodiscard]] std::pair get_tx(t_kdf_ec& ec) const; std::vector get_electrum_server_from_token(const std::string& ticker); std::vector retrieve_coins_informations(); @@ -142,16 +142,16 @@ namespace atomic_dex public: //! Constructor - explicit mm2_service(entt::registry& registry, ag::ecs::system_manager& system_manager); + explicit kdf_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; + kdf_service(const kdf_service& other) = delete; + kdf_service(const kdf_service&& other) = delete; + kdf_service& operator=(const kdf_service& other) = delete; + kdf_service& operator=(const kdf_service&& other) = delete; //! Destructor - ~mm2_service() final; + ~kdf_service() final; //! Events void on_refresh_orderbook_model_data(const refresh_orderbook_model_data& evt); @@ -160,8 +160,8 @@ namespace atomic_dex void on_gui_leave_trading(const gui_leave_trading& evt); - //! Spawn mm2 instance with given seed - void spawn_mm2_instance(std::string wallet_name, std::string passphrase, bool with_pin_cfg = false, std::string rpcpassword = ""); + //! Spawn kdf instance with given seed + void spawn_kdf_instance(std::string wallet_name, std::string passphrase, bool with_pin_cfg = false, std::string rpcpassword = ""); //! Refresh the current info (internally call process_balance and process_tx) void fetch_infos_thread(bool is_a_fresh = true, bool only_tx = false); @@ -190,15 +190,15 @@ namespace atomic_dex 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. - void process_balance_answer(const mm2::enable_tendermint_with_assets_rpc& rpc); - void process_balance_answer(const mm2::enable_tendermint_token_rpc& rpc); - void process_balance_answer(const mm2::enable_eth_with_tokens_rpc& rpc); - void process_balance_answer(const mm2::enable_erc20_rpc& rpc); + void process_balance_answer(const kdf::enable_bch_with_tokens_rpc& rpc); // Called after enabling SLP coins along tBCH/BCH. + void process_balance_answer(const kdf::enable_slp_rpc& rpc); // Called after enabling an SLP coin. + void process_balance_answer(const kdf::enable_tendermint_with_assets_rpc& rpc); + void process_balance_answer(const kdf::enable_tendermint_token_rpc& rpc); + void process_balance_answer(const kdf::enable_eth_with_tokens_rpc& rpc); + void process_balance_answer(const kdf::enable_erc20_rpc& rpc); public: - //! Add a new coin in the coin_info cfg add_new_coin(normal_cfg, mm2_cfg) + //! Add a new coin in the coin_info cfg add_new_coin(normal_cfg, kdf_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); void update_sync_ticker_pair(std::string base, std::string rel); @@ -221,13 +221,13 @@ namespace atomic_dex void update() final; //! Retrieve public address of the given ticker - std::string address(const std::string& ticker, t_mm2_ec& ec) const; + std::string address(const std::string& ticker, t_kdf_ec& ec) const; - //! Is MM2 Process correctly running ? - [[nodiscard]] const std::atomic_bool& is_mm2_running() const; + //! Is KDF Process correctly running ? + [[nodiscard]] const std::atomic_bool& is_kdf_running() const; //! Retrieve my balance for a given ticker as a string. - [[nodiscard]] std::string get_balance_info(const std::string& ticker, t_mm2_ec& ec) const; + [[nodiscard]] std::string get_balance_info(const std::string& ticker, t_kdf_ec& ec) const; //! Refresh the current orderbook (internally call process_orderbook) void fetch_current_orderbook_thread(bool is_a_reset = false); @@ -235,10 +235,10 @@ namespace atomic_dex void process_orderbook(bool is_a_reset = false); //! Last 50 transactions maximum - [[nodiscard]] t_transactions get_tx_history(t_mm2_ec& ec) const; + [[nodiscard]] t_transactions get_tx_history(t_kdf_ec& ec) const; //! Last 50 transactions maximum - [[nodiscard]] t_tx_state get_tx_state(t_mm2_ec& ec) const; + [[nodiscard]] t_tx_state get_tx_state(t_kdf_ec& ec) const; //! Get coins that are currently enabled [[nodiscard]] t_coins get_enabled_coins() const; @@ -256,7 +256,7 @@ namespace atomic_dex [[nodiscard]] bool has_coin(const std::string& ticker) const; //! Get Current orderbook - [[nodiscard]] mm2::orderbook_result_rpc get_orderbook(t_mm2_ec& ec) const; + [[nodiscard]] kdf::orderbook_result_rpc get_orderbook(t_kdf_ec& ec) const; //! Get Swaps [[nodiscard]] orders_and_swaps get_orders_and_swaps() const; @@ -269,7 +269,7 @@ namespace atomic_dex [[nodiscard]] bool is_orderbook_thread_active() const; - [[nodiscard]] nlohmann::json get_raw_mm2_ticker_cfg(const std::string& ticker) const; + [[nodiscard]] nlohmann::json get_raw_kdf_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; @@ -281,7 +281,7 @@ namespace atomic_dex void batch_fetch_orders_and_swap(bool after_manual_reset = false); //! Async API - mm2::mm2_client& get_mm2_client(); + kdf::kdf_client& get_kdf_client(); //! Wallet api [[nodiscard]] std::string get_current_ticker() const; @@ -295,4 +295,4 @@ namespace atomic_dex }; } // namespace atomic_dex -REFL_AUTO(type(atomic_dex::mm2_service)) +REFL_AUTO(type(atomic_dex::kdf_service)) diff --git a/src/core/atomicdex/services/mm2/mm2_events.hpp b/src/core/atomicdex/services/kdf/kdf_events.hpp similarity index 81% rename from src/core/atomicdex/services/mm2/mm2_events.hpp rename to src/core/atomicdex/services/kdf/kdf_events.hpp index b5b24fa784..92174b4860 100644 --- a/src/core/atomicdex/services/mm2/mm2_events.hpp +++ b/src/core/atomicdex/services/kdf/kdf_events.hpp @@ -5,9 +5,9 @@ #include -#include "atomicdex/api/mm2/transaction.data.hpp" +#include "atomicdex/api/kdf/transaction.data.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct transactions_fetched_event { diff --git a/src/core/atomicdex/services/price/coingecko/coingecko.provider.cpp b/src/core/atomicdex/services/price/coingecko/coingecko.provider.cpp index f5414da671..cd6977dbd7 100644 --- a/src/core/atomicdex/services/price/coingecko/coingecko.provider.cpp +++ b/src/core/atomicdex/services/price/coingecko/coingecko.provider.cpp @@ -14,7 +14,7 @@ namespace atomic_dex { SPDLOG_INFO("coingecko_provider created"); this->disable(); - dispatcher_.sink().connect<&coingecko_provider::on_mm2_started>(*this); + dispatcher_.sink().connect<&coingecko_provider::on_kdf_started>(*this); dispatcher_.sink().connect<&coingecko_provider::on_coin_enabled>(*this); dispatcher_.sink().connect<&coingecko_provider::on_coin_disabled>(*this); } @@ -22,7 +22,7 @@ namespace atomic_dex coingecko_provider::~coingecko_provider() { SPDLOG_INFO("coingecko_provider destroyed"); - dispatcher_.sink().disconnect<&coingecko_provider::on_mm2_started>(*this); + dispatcher_.sink().disconnect<&coingecko_provider::on_kdf_started>(*this); dispatcher_.sink().disconnect<&coingecko_provider::on_coin_enabled>(*this); dispatcher_.sink().disconnect<&coingecko_provider::on_coin_disabled>(*this); } @@ -41,9 +41,9 @@ namespace atomic_dex namespace atomic_dex { void - coingecko_provider::on_mm2_started([[maybe_unused]] const mm2_started& evt) + coingecko_provider::on_kdf_started([[maybe_unused]] const kdf_started& evt) { - SPDLOG_INFO("on_mm2_started"); + SPDLOG_INFO("on_kdf_started"); update_ticker_and_provider(); } @@ -75,7 +75,7 @@ namespace atomic_dex coingecko_provider::update_ticker_and_provider() { SPDLOG_INFO("update_ticker_and_provider"); - if (m_system_manager.has_system() && m_system_manager.get_system().is_mm2_running()) + if (m_system_manager.has_system() && m_system_manager.get_system().is_kdf_running()) { const auto coins = this->m_system_manager.get_system().get_global_cfg()->get_model_data(); auto&& [ids, registry] = coingecko::api::from_enabled_coins(coins); @@ -83,7 +83,7 @@ namespace atomic_dex } else { - SPDLOG_WARN("mm2 not running - skipping update_ticker_and_provider"); + SPDLOG_WARN("kdf not running - skipping update_ticker_and_provider"); } } diff --git a/src/core/atomicdex/services/price/coingecko/coingecko.provider.hpp b/src/core/atomicdex/services/price/coingecko/coingecko.provider.hpp index 28473a8d21..5958e9b2fe 100644 --- a/src/core/atomicdex/services/price/coingecko/coingecko.provider.hpp +++ b/src/core/atomicdex/services/price/coingecko/coingecko.provider.hpp @@ -37,8 +37,8 @@ namespace atomic_dex void update_ticker_and_provider(); - //! Event that occur when the mm2 process is launched correctly. - void on_mm2_started(const mm2_started& evt) ; + //! Event that occur when the kdf process is launched correctly. + void on_kdf_started(const kdf_started& evt) ; //! Event that occur when a coin is correctly enabled. void on_coin_enabled(const coin_enabled& evt) ; diff --git a/src/core/atomicdex/services/price/coingecko/coingecko.wallet.charts.cpp b/src/core/atomicdex/services/price/coingecko/coingecko.wallet.charts.cpp index 65ffbcbfe8..c0475ff9ff 100644 --- a/src/core/atomicdex/services/price/coingecko/coingecko.wallet.charts.cpp +++ b/src/core/atomicdex/services/price/coingecko/coingecko.wallet.charts.cpp @@ -60,7 +60,7 @@ namespace atomic_dex auto chart_registry = this->m_chart_data_registry.get(); nlohmann::json out = nlohmann::json::array(); const auto& data = chart_registry.begin()->second; - const auto& mm2 = m_system_manager.get_system(); + const auto& kdf = m_system_manager.get_system(); t_float_50 first_total = 0; for (std::size_t idx = 0; idx < data.size(); idx++) { @@ -77,7 +77,7 @@ namespace atomic_dex to_skip = true; continue; } - t_float_50 cur_total = (t_float_50(value[idx][1].get()) * mm2.get_balance_info_f(key)) * rate; + t_float_50 cur_total = (t_float_50(value[idx][1].get()) * kdf.get_balance_info_f(key)) * rate; total += cur_total; } if (to_skip) @@ -210,7 +210,7 @@ namespace atomic_dex const auto coins = this->m_system_manager.get_system().get_global_cfg()->get_enabled_coins(); auto* portfolio_model = this->m_system_manager.get_system().get_portfolio(); auto final_task = m_taskflow.emplace([this]() { this->generate_fiat_chart(); }).name("Post task"); - auto active_coins = m_system_manager.get_system().get_active_coins().size(); + auto active_coins = m_system_manager.get_system().get_active_coins().size(); SPDLOG_INFO("active_coins: {} coins_size: {}", active_coins, coins.size()); if (active_coins == coins.size()) diff --git a/src/core/atomicdex/services/price/defi.stats.hpp b/src/core/atomicdex/services/price/defi.stats.hpp index de626da1df..885af0357e 100644 --- a/src/core/atomicdex/services/price/defi.stats.hpp +++ b/src/core/atomicdex/services/price/defi.stats.hpp @@ -20,9 +20,9 @@ #include #include #include "atomicdex/config/app.cfg.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" -namespace atomic_dex::mm2 +namespace atomic_dex::kdf { struct defi_stats_volumes_answer { @@ -30,12 +30,12 @@ namespace atomic_dex::mm2 int status_code; }; void from_json(const nlohmann::json& j, defi_stats_volumes_answer& answer); -} // namespace atomic_dex::mm2 +} // namespace atomic_dex::kdf namespace atomic_dex { - using t_defi_stats_volumes_answer = mm2::defi_stats_volumes_answer; + using t_defi_stats_volumes_answer = kdf::defi_stats_volumes_answer; } // namespace atomic_dex namespace atomic_dex diff --git a/src/core/atomicdex/services/price/global.provider.cpp b/src/core/atomicdex/services/price/global.provider.cpp index 74aefc3d1a..8648436e05 100644 --- a/src/core/atomicdex/services/price/global.provider.cpp +++ b/src/core/atomicdex/services/price/global.provider.cpp @@ -220,8 +220,8 @@ namespace atomic_dex std::string global_price_service::get_price_in_fiat_all(const std::string& fiat, std::error_code& ec) const { - auto& mm2_instance = m_system_manager.get_system(); - t_coins coins = mm2_instance.get_enabled_coins(); + auto& kdf_instance = m_system_manager.get_system(); + t_coins coins = kdf_instance.get_enabled_coins(); try { t_float_50 final_price_f = 0; @@ -271,9 +271,9 @@ namespace atomic_dex return "0.00"; } - auto& mm2_instance = m_system_manager.get_system(); + auto& kdf_instance = m_system_manager.get_system(); - const auto ticker_infos = mm2_instance.get_coin_info(ticker); + const auto ticker_infos = kdf_instance.get_coin_info(ticker); const auto current_price = get_rate_conversion(currency, ticker); if (current_price == "0.00") @@ -298,7 +298,7 @@ namespace atomic_dex // SPDLOG_INFO("get_price_in_fiat [{}] [{}]", fiat, ticker); try { - auto& mm2_instance = m_system_manager.get_system(); + auto& kdf_instance = m_system_manager.get_system(); if (m_supported_fiat_registry.count(fiat) == 0u) { @@ -314,7 +314,7 @@ namespace atomic_dex } std::error_code t_ec; - const auto amount = mm2_instance.get_balance_info(ticker, t_ec); // from registry + const auto amount = kdf_instance.get_balance_info(ticker, t_ec); // from registry if (t_ec) { @@ -397,11 +397,11 @@ namespace atomic_dex [this](web::http::http_response resp) { this->m_other_fiats_rates = process_fetch_fiat_answer(resp); - const auto& mm2 = this->m_system_manager.get_system(); - const bool with_update = mm2.is_mm2_running(); + const auto& kdf = this->m_system_manager.get_system(); + const bool with_update = kdf.is_kdf_running(); bool already_send = false; - const auto first_id = mm2.get_coin_info(g_primary_dex_coin).coinpaprika_id; - const auto second_id = mm2.get_coin_info(g_second_primary_dex_coin).coinpaprika_id; + const auto first_id = kdf.get_coin_info(g_primary_dex_coin).coinpaprika_id; + const auto second_id = kdf.get_coin_info(g_second_primary_dex_coin).coinpaprika_id; if (!first_id.empty()) { @@ -417,7 +417,7 @@ namespace atomic_dex if (g_primary_dex_coin != coin && g_second_primary_dex_coin != coin) { refresh_other_coins_rates( - mm2.get_coin_info(coin).coinpaprika_id, + kdf.get_coin_info(coin).coinpaprika_id, coin, !already_send, 0 diff --git a/src/core/atomicdex/services/price/global.provider.hpp b/src/core/atomicdex/services/price/global.provider.hpp index e4234e7fbe..515c08ef22 100644 --- a/src/core/atomicdex/services/price/global.provider.hpp +++ b/src/core/atomicdex/services/price/global.provider.hpp @@ -20,7 +20,7 @@ #include #include "atomicdex/config/app.cfg.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" namespace atomic_dex { diff --git a/src/core/atomicdex/services/price/orderbook.scanner.service.cpp b/src/core/atomicdex/services/price/orderbook.scanner.service.cpp index ed6b2dcfcd..6479066abf 100644 --- a/src/core/atomicdex/services/price/orderbook.scanner.service.cpp +++ b/src/core/atomicdex/services/price/orderbook.scanner.service.cpp @@ -16,9 +16,9 @@ #include //! Project Headers -#include "atomicdex/api/mm2/rpc_v2/rpc2.bestorders.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.bestorders.hpp" #include "atomicdex/pages/qt.trading.page.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" #include "atomicdex/services/price/orderbook.scanner.service.hpp" //! Constructor @@ -46,10 +46,10 @@ namespace atomic_dex } // SPDLOG_INFO("process_best_orders processing"); - if (m_system_manager.has_system()) + if (m_system_manager.has_system()) { - auto& mm2_system = m_system_manager.get_system(); - if (mm2_system.is_mm2_running() && mm2_system.is_orderbook_thread_active()) + auto& kdf_system = m_system_manager.get_system(); + if (kdf_system.is_kdf_running() && kdf_system.is_orderbook_thread_active()) { // SPDLOG_INFO("process_best_orders"); using namespace std::string_literals; @@ -84,17 +84,17 @@ namespace atomic_dex this->m_bestorders_busy = true; emit trading_pg.get_orderbook_wrapper()->bestOrdersBusyChanged(); - mm2::bestorders_rpc rpc{.request={.coin = std::move(coin), .volume = std::move(volume), .action = std::move(action)}}; - mm2_system.get_mm2_client().process_rpc_async(rpc.request, callback); + kdf::bestorders_rpc rpc{.request={.coin = std::move(coin), .volume = std::move(volume), .action = std::move(action)}}; + kdf_system.get_kdf_client().process_rpc_async(rpc.request, callback); } else { - SPDLOG_WARN("MM2 Service not launched yet - skipping process_best_orders"); + SPDLOG_WARN("KDF Service not launched yet - skipping process_best_orders"); } } else { - SPDLOG_WARN("MM2 Service not created yet - skipping process_best_orders"); + SPDLOG_WARN("KDF Service not created yet - skipping process_best_orders"); } } } // namespace atomic_dex diff --git a/src/core/atomicdex/services/price/orderbook.scanner.service.hpp b/src/core/atomicdex/services/price/orderbook.scanner.service.hpp index 9a7896c68f..63c9b89dea 100644 --- a/src/core/atomicdex/services/price/orderbook.scanner.service.hpp +++ b/src/core/atomicdex/services/price/orderbook.scanner.service.hpp @@ -22,8 +22,8 @@ #include //! Project Headers -#include "atomicdex/api/mm2/mm2.client.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.bestorders.hpp" +#include "atomicdex/api/kdf/kdf.client.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.bestorders.hpp" //! Namespace declaration namespace atomic_dex @@ -33,7 +33,7 @@ namespace atomic_dex { //! Private typedefs using t_update_time_point = std::chrono::high_resolution_clock::time_point; - using t_best_orders_synchronized = boost::synchronized_value; + using t_best_orders_synchronized = boost::synchronized_value; //! Private member fields ag::ecs::system_manager& m_system_manager; diff --git a/src/core/atomicdex/utilities/global.utilities.cpp b/src/core/atomicdex/utilities/global.utilities.cpp index e045d9e469..d311c84537 100644 --- a/src/core/atomicdex/utilities/global.utilities.cpp +++ b/src/core/atomicdex/utilities/global.utilities.cpp @@ -154,14 +154,14 @@ namespace atomic_dex::utils } std::filesystem::path - get_mm2_atomic_dex_current_log_file() + get_kdf_atomic_dex_current_log_file() { using namespace std::chrono; using namespace date; static auto timestamp = duration_cast(system_clock::now().time_since_epoch()).count(); static date::sys_seconds tp{seconds{timestamp}}; static std::string s = date::format("%Y-%m-%d-%H-%M-%S", tp); - static const std::filesystem::path log_path = get_atomic_dex_logs_folder() / (s + ".mm2.log"); + static const std::filesystem::path log_path = get_atomic_dex_logs_folder() / (s + ".kdf.log"); return log_path; } @@ -220,9 +220,9 @@ namespace atomic_dex::utils std::filesystem::path get_current_configs_path() { - const auto fs_raw_mm2_shared_folder = get_atomic_dex_data_folder() / get_raw_version() / "configs"; - create_if_doesnt_exist(fs_raw_mm2_shared_folder); - return fs_raw_mm2_shared_folder; + const auto fs_raw_kdf_shared_folder = get_atomic_dex_data_folder() / get_raw_version() / "configs"; + create_if_doesnt_exist(fs_raw_kdf_shared_folder); + return fs_raw_kdf_shared_folder; } std::string diff --git a/src/core/atomicdex/utilities/global.utilities.hpp b/src/core/atomicdex/utilities/global.utilities.hpp index 64137e613c..9bd4eb3393 100644 --- a/src/core/atomicdex/utilities/global.utilities.hpp +++ b/src/core/atomicdex/utilities/global.utilities.hpp @@ -77,7 +77,7 @@ namespace atomic_dex::utils ENTT_API std::filesystem::path get_current_configs_path(); - std::filesystem::path get_mm2_atomic_dex_current_log_file(); + std::filesystem::path get_kdf_atomic_dex_current_log_file(); std::filesystem::path get_atomic_dex_config_folder(); diff --git a/src/core/atomicdex/utilities/security.utilities.cpp b/src/core/atomicdex/utilities/security.utilities.cpp index 0fdcb101bd..2685d2717b 100644 --- a/src/core/atomicdex/utilities/security.utilities.cpp +++ b/src/core/atomicdex/utilities/security.utilities.cpp @@ -31,7 +31,7 @@ #include //! Project Headers -#include "atomicdex/api/mm2/mm2.error.code.hpp" +#include "atomicdex/api/kdf/kdf.error.code.hpp" #include "atomicdex/utilities/qt.utilities.hpp" #include "atomicdex/utilities/security.utilities.hpp" diff --git a/src/tests/api/mm2/enable_bch_with_tokens_rpc_tests.cpp b/src/tests/api/kdf/enable_bch_with_tokens_rpc_tests.cpp similarity index 97% rename from src/tests/api/mm2/enable_bch_with_tokens_rpc_tests.cpp rename to src/tests/api/kdf/enable_bch_with_tokens_rpc_tests.cpp index c8d6c738b0..d020a0de50 100644 --- a/src/tests/api/mm2/enable_bch_with_tokens_rpc_tests.cpp +++ b/src/tests/api/kdf/enable_bch_with_tokens_rpc_tests.cpp @@ -1,10 +1,10 @@ #include -#include "atomicdex/api/mm2/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.enable_bch_with_tokens_rpc.hpp" TEST_CASE("enable_bch_with_tokens_request_rpc serialization") { - using namespace atomic_dex::mm2; + using namespace atomic_dex::kdf; nlohmann::json result; enable_bch_with_tokens_request_rpc data @@ -49,7 +49,7 @@ TEST_CASE("enable_bch_with_tokens_request_rpc serialization") TEST_CASE("enable_bch_with_tokens_result_rpc deserialization") { - using namespace atomic_dex::mm2; + using namespace atomic_dex::kdf; enable_bch_with_tokens_result_rpc result; nlohmann::json json = nlohmann::json::parse(R"( diff --git a/src/tests/api/mm2/mm2.api.address_format.tests.cpp b/src/tests/api/kdf/kdf.api.address_format.tests.cpp similarity index 90% rename from src/tests/api/mm2/mm2.api.address_format.tests.cpp rename to src/tests/api/kdf/kdf.api.address_format.tests.cpp index 7b43419bb9..65ec78bb03 100644 --- a/src/tests/api/mm2/mm2.api.address_format.tests.cpp +++ b/src/tests/api/kdf/kdf.api.address_format.tests.cpp @@ -18,9 +18,9 @@ #include "doctest/doctest.h" #include -#include "atomicdex/api/mm2/address_format.hpp" +#include "atomicdex/api/kdf/address_format.hpp" -TEST_CASE("mm2::address_format serialisation") +TEST_CASE("kdf::address_format serialisation") { const nlohmann::json expected_json = R"( { @@ -28,7 +28,7 @@ TEST_CASE("mm2::address_format serialisation") "network":"bchtest" } )"_json; - atomic_dex::mm2::address_format_t req{.format = "cashaddress", .network = "bchtest"}; + atomic_dex::kdf::address_format_t req{.format = "cashaddress", .network = "bchtest"}; nlohmann::json j; to_json(j, req); diff --git a/src/tests/api/mm2/mm2.api.balance_infos.tests.cpp b/src/tests/api/kdf/kdf.api.balance_infos.tests.cpp similarity index 88% rename from src/tests/api/mm2/mm2.api.balance_infos.tests.cpp rename to src/tests/api/kdf/kdf.api.balance_infos.tests.cpp index 9b80fab15a..56762a9684 100644 --- a/src/tests/api/mm2/mm2.api.balance_infos.tests.cpp +++ b/src/tests/api/kdf/kdf.api.balance_infos.tests.cpp @@ -18,9 +18,9 @@ #include "doctest/doctest.h" #include -#include "atomicdex/api/mm2/balance_infos.hpp" +#include "atomicdex/api/kdf/balance_infos.hpp" -TEST_CASE("mm2::balance_infos deserialization") +TEST_CASE("kdf::balance_infos deserialization") { const nlohmann::json json = R"( { @@ -29,8 +29,8 @@ TEST_CASE("mm2::balance_infos deserialization") "unspendable":"0.00001" } })"_json; - atomic_dex::mm2::balance_infos infos; - atomic_dex::mm2::from_json(json.at("balances"), infos); + atomic_dex::kdf::balance_infos infos; + atomic_dex::kdf::from_json(json.at("balances"), infos); CHECK_EQ(infos.spendable, "0.11398301"); CHECK_EQ(infos.unspendable, "0.00001"); } \ No newline at end of file diff --git a/src/tests/api/mm2/mm2.api.utxo_merge_params.tests.cpp b/src/tests/api/kdf/kdf.api.utxo_merge_params.tests.cpp similarity index 88% rename from src/tests/api/mm2/mm2.api.utxo_merge_params.tests.cpp rename to src/tests/api/kdf/kdf.api.utxo_merge_params.tests.cpp index de8d38ccda..77538e2ca5 100644 --- a/src/tests/api/mm2/mm2.api.utxo_merge_params.tests.cpp +++ b/src/tests/api/kdf/kdf.api.utxo_merge_params.tests.cpp @@ -18,9 +18,9 @@ #include "doctest/doctest.h" #include -#include "atomicdex/api/mm2/utxo_merge_params.hpp" +#include "atomicdex/api/kdf/utxo_merge_params.hpp" -TEST_CASE("mm2::utxo_merge_params serialisation") +TEST_CASE("kdf::utxo_merge_params serialisation") { const nlohmann::json expected_json = R"( { @@ -29,8 +29,8 @@ TEST_CASE("mm2::utxo_merge_params serialisation") "max_merge_at_once":25 } )"_json; - atomic_dex::mm2::utxo_merge_params_t request{.merge_at = 50, .check_every = 10, .max_merge_at_once = 25}; + atomic_dex::kdf::utxo_merge_params_t request{.merge_at = 50, .check_every = 10, .max_merge_at_once = 25}; nlohmann::json j; - atomic_dex::mm2::to_json(j, request); + atomic_dex::kdf::to_json(j, request); CHECK_EQ(j, expected_json); } \ No newline at end of file diff --git a/src/tests/api/mm2/mm2.fraction.tests.cpp b/src/tests/api/kdf/kdf.fraction.tests.cpp similarity index 73% rename from src/tests/api/mm2/mm2.fraction.tests.cpp rename to src/tests/api/kdf/kdf.fraction.tests.cpp index 148edf607e..3d90c4eebd 100644 --- a/src/tests/api/mm2/mm2.fraction.tests.cpp +++ b/src/tests/api/kdf/kdf.fraction.tests.cpp @@ -12,9 +12,9 @@ #include //! Project Headers -#include "atomicdex/api/mm2/fraction.hpp" +#include "atomicdex/api/kdf/fraction.hpp" -TEST_CASE("atomic_dex::mm2::fraction deserialisation") +TEST_CASE("atomic_dex::kdf::fraction deserialisation") { nlohmann::json fraction_json = R"( { @@ -22,8 +22,8 @@ TEST_CASE("atomic_dex::mm2::fraction deserialisation") "numer": "333" } )"_json; - atomic_dex::mm2::fraction fraction; - atomic_dex::mm2::from_json(fraction_json, fraction); + atomic_dex::kdf::fraction fraction; + atomic_dex::kdf::from_json(fraction_json, fraction); CHECK_EQ(fraction.numer, "333"); CHECK_EQ(fraction.denom, "777"); diff --git a/src/tests/api/mm2/mm2.rpc2.trade_preimage.tests.cpp b/src/tests/api/kdf/kdf.rpc2.trade_preimage.tests.cpp similarity index 92% rename from src/tests/api/mm2/mm2.rpc2.trade_preimage.tests.cpp rename to src/tests/api/kdf/kdf.rpc2.trade_preimage.tests.cpp index ee920f3e43..345eb0ebdf 100644 --- a/src/tests/api/mm2/mm2.rpc2.trade_preimage.tests.cpp +++ b/src/tests/api/kdf/kdf.rpc2.trade_preimage.tests.cpp @@ -15,8 +15,8 @@ #include "../../atomic.dex.tests.hpp" //! Project Headers -#include "atomicdex/api/mm2/mm2.hpp" -#include "atomicdex/api/mm2/rpc_v2/rpc2.trade_preimage.hpp" +#include "atomicdex/api/kdf/kdf.hpp" +#include "atomicdex/api/kdf/rpc_v2/rpc2.trade_preimage.hpp" //! Constants namespace @@ -234,37 +234,37 @@ namespace })"_json; } // namespace -TEST_CASE("atomic_dex::mm2::preimage_request serialisation") +TEST_CASE("atomic_dex::kdf::preimage_request serialisation") { atomic_dex::t_trade_preimage_request request{.base_coin = "KMD", .rel_coin = "BTC", .swap_method = "buy", .volume = "10"}; nlohmann::json j; - atomic_dex::mm2::to_json(j, request); + atomic_dex::kdf::to_json(j, request); CHECK_EQ(j, g_preimage_request_buy_kmd_btc); } -TEST_CASE("atomic_dex::mm2::coin_fee deserialization") +TEST_CASE("atomic_dex::kdf::coin_fee deserialization") { - atomic_dex::mm2::coin_fee answer; - atomic_dex::mm2::from_json(g_coin_fee_answer, answer); + atomic_dex::kdf::coin_fee answer; + atomic_dex::kdf::from_json(g_coin_fee_answer, answer); CHECK_EQ("0.00042049", answer.amount); CHECK_EQ("BTC", answer.coin); CHECK_EQ("100000000", answer.amount_fraction.denom); } -TEST_CASE("atomic_dex::mm2::preimage_answer_success deserialization from buy") +TEST_CASE("atomic_dex::kdf::preimage_answer_success deserialization from buy") { - atomic_dex::mm2::trade_preimage_answer_success answer; - atomic_dex::mm2::from_json(g_preimage_answer_success_buy, answer); + atomic_dex::kdf::trade_preimage_answer_success answer; + atomic_dex::kdf::from_json(g_preimage_answer_success_buy, answer); CHECK(answer.taker_fee.has_value()); CHECK(answer.fee_to_send_taker_fee.has_value()); } -TEST_SUITE("atomic_dex::mm2::preimage_answer deserialization test suites") +TEST_SUITE("atomic_dex::kdf::preimage_answer deserialization test suites") { TEST_CASE("setprice BTC/DOC") { atomic_dex::t_trade_preimage_answer answer; - atomic_dex::mm2::from_json(g_preimage_answer_setprice, answer); + atomic_dex::kdf::from_json(g_preimage_answer_setprice, answer); CHECK(answer.result.has_value()); CHECK_FALSE(answer.error.has_value()); CHECK_FALSE(answer.result.value().fee_to_send_taker_fee.has_value()); @@ -273,7 +273,7 @@ TEST_SUITE("atomic_dex::mm2::preimage_answer deserialization test suites") TEST_CASE("buy BTC/DOC") { atomic_dex::t_trade_preimage_answer answer; - atomic_dex::mm2::from_json(g_preimage_answer_buy, answer); + atomic_dex::kdf::from_json(g_preimage_answer_buy, answer); CHECK(answer.result.has_value()); CHECK_FALSE(answer.error.has_value()); CHECK(answer.result.value().fee_to_send_taker_fee.has_value()); @@ -282,7 +282,7 @@ TEST_SUITE("atomic_dex::mm2::preimage_answer deserialization test suites") TEST_CASE("sell max BTC/DOC") { atomic_dex::t_trade_preimage_answer answer; - atomic_dex::mm2::from_json(g_preimage_answer_sell_max, answer); + atomic_dex::kdf::from_json(g_preimage_answer_sell_max, answer); CHECK(answer.result.has_value()); CHECK_FALSE(answer.error.has_value()); CHECK(answer.result.value().fee_to_send_taker_fee.has_value()); @@ -291,7 +291,7 @@ TEST_SUITE("atomic_dex::mm2::preimage_answer deserialization test suites") TEST_CASE("setprice ERC20 BAT/DOC") { atomic_dex::t_trade_preimage_answer answer; - atomic_dex::mm2::from_json(g_preimage_answer_setprice_erc, answer); + atomic_dex::kdf::from_json(g_preimage_answer_setprice_erc, answer); CHECK(answer.result.has_value()); CHECK_FALSE(answer.error.has_value()); CHECK_FALSE(answer.result.value().fee_to_send_taker_fee.has_value()); @@ -320,10 +320,10 @@ TEST_SUITE("atomic_dex::mm2::preimage_answer deserialization test suites") #include "atomicdex/tests/atomic.dex.tests.hpp" //! Project Headers - #include "atomicdex/api/mm2/mm2.hpp" - #include "atomicdex/api/mm2/rpc_v2/rpc2.trade_preimage.hpp" ///< replace this one by your current rpc file + #include "atomicdex/api/kdf/kdf.hpp" + #include "atomicdex/api/kdf/rpc_v2/rpc2.trade_preimage.hpp" ///< replace this one by your current rpc file */ -SCENARIO("atomic_dex::mm2::preimage scenario") +SCENARIO("atomic_dex::kdf::preimage scenario") { /** * Checking that the test context is valid @@ -335,15 +335,15 @@ SCENARIO("atomic_dex::mm2::preimage scenario") CHECK(batch.is_array()); //! Prepare request template - nlohmann::json request_json = atomic_dex::mm2::template_request("trade_preimage", true); + nlohmann::json request_json = atomic_dex::kdf::template_request("trade_preimage", true); - //! Retrieve mm2 service - auto& mm2 = g_context->system_manager().get_system(); + //! Retrieve kdf service + auto& kdf = g_context->system_manager().get_system(); //! Generic resp functor that will be used in every tests - auto generic_resp_process = [&mm2, &batch]() { + auto generic_resp_process = [&kdf, &batch]() { //! Process the actual request - const auto resp = mm2.get_mm2_client().async_rpc_batch_standalone(batch).get(); + const auto resp = kdf.get_kdf_client().async_rpc_batch_standalone(batch).get(); //! Retrieve the body std::string body = TO_STD_STR(resp.extract_string(true).get()); @@ -368,7 +368,7 @@ SCENARIO("atomic_dex::mm2::preimage scenario") CHECK(batch.empty()); //! Give the concrete C++ type - here it's atomic_dex::t_trade_preimage_answer - return atomic_dex::mm2::rpc_process_answer_batch(answers[0], "trade_preimage"); + return atomic_dex::kdf::rpc_process_answer_batch(answers[0], "trade_preimage"); }; //! A test with DOC/MARTY @@ -378,7 +378,7 @@ SCENARIO("atomic_dex::mm2::preimage scenario") atomic_dex::t_trade_preimage_request request{.base_coin = "DOC", .rel_coin = "MARTY", .swap_method = "buy", .volume = "1", .price = "1"}; //! Transform request into json - atomic_dex::mm2::to_json(request_json, request); + atomic_dex::kdf::to_json(request_json, request); //! Add it to the batch request batch.push_back(request_json); @@ -406,7 +406,7 @@ SCENARIO("atomic_dex::mm2::preimage scenario") GIVEN("Preparing a wrong request DOC/NONEXISTENT coin") { atomic_dex::t_trade_preimage_request request{.base_coin = "DOC", .rel_coin = "NONEXISTENT", .swap_method = "buy", .volume = "1"}; - atomic_dex::mm2::to_json(request_json, request); + atomic_dex::kdf::to_json(request_json, request); batch.push_back(request_json); auto copy_request = request_json; copy_request["userpass"] = ""; diff --git a/src/tests/atomic.dex.provider.cex.prices.tests.cpp b/src/tests/atomic.dex.provider.cex.prices.tests.cpp index 3f2772cd94..f8a519c7a8 100644 --- a/src/tests/atomic.dex.provider.cex.prices.tests.cpp +++ b/src/tests/atomic.dex.provider.cex.prices.tests.cpp @@ -28,8 +28,8 @@ TEST_CASE("atomic dex cex prices provider constructor") //entt::registry registry; //ag::ecs::system_manager mgr{registry}; //registry.set(); - //atomic_dex::mm2 mm2(registry, mgr); - //atomic_dex::ohlc_provider provider(registry, mm2); + //atomic_dex::kdf kdf(registry, mgr); + //atomic_dex::ohlc_provider provider(registry, kdf); } /*SCENARIO("atomic dex cex price service functionnality") @@ -41,12 +41,12 @@ TEST_CASE("atomic dex cex prices provider constructor") entt::registry registry; registry.set(); antara::gaming::ecs::system_manager system_manager_{registry}; - auto& mm2_s = system_manager_.create_system(); - auto& cex_system = system_manager_.create_system(mm2_s); + auto& kdf_s = system_manager_.create_system(); + auto& cex_system = system_manager_.create_system(kdf_s); - THEN("I start mm2") + THEN("I start kdf") { - registry.ctx().trigger(); + registry.ctx().trigger(); AND_WHEN("i set the current orderbook pair to a valid supported pair (kmd-btc)") { diff --git a/src/tests/atomic.dex.tests.hpp b/src/tests/atomic.dex.tests.hpp index 09fe13824f..c7e8600eac 100644 --- a/src/tests/atomic.dex.tests.hpp +++ b/src/tests/atomic.dex.tests.hpp @@ -23,7 +23,7 @@ #include "atomicdex/events/events.hpp" #include "atomicdex/managers/qt.wallet.manager.hpp" #include "atomicdex/pages/qt.portfolio.page.hpp" -#include "atomicdex/services/mm2/mm2.service.hpp" +#include "atomicdex/services/kdf/kdf.service.hpp" struct tests_context : public antara::gaming::world::app { @@ -53,8 +53,8 @@ struct tests_context : public antara::gaming::world::app { #if !defined(WIN32) && !defined(_WIN32) this->dispatcher_.sink().connect<&tests_context::on_coin_initialized>(*this); - //! Creates mm2 service. - auto& mm2 = system_manager_.create_system(system_manager_); + //! Creates kdf service. + auto& kdf = system_manager_.create_system(system_manager_); //! Creates special wallet for the unit tests then logs to it. auto& wallet_manager = system_manager_.create_system(system_manager_); @@ -92,15 +92,15 @@ struct tests_context : public antara::gaming::world::app } wallet_manager.login(test_password != nullptr ? test_password : "fakepasswordtemporary", "komodo-wallet_tests"); - //! Waits for mm2 to be initialized before running tests - while (!mm2.is_mm2_running() && !m_test_context_ready) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); } - const auto& enabled_coins = mm2.get_enabled_coins(); + //! Waits for kdf to be initialized before running tests + while (!kdf.is_kdf_running() && !m_test_context_ready) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); } + const auto& enabled_coins = kdf.get_enabled_coins(); bool found = std::any_of(enabled_coins.begin(), enabled_coins.end(), [](const auto& item) -> bool { return item.ticker == "tBTC-TEST" || item.ticker == "tQTUM"; }); if (!found) { SPDLOG_INFO("Extra coins not enabled yet, enabling now"); - mm2.enable_coins(m_extra_coins); + kdf.enable_coins(m_extra_coins); } while (!m_extra_coins_ready) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); } //! At this point BTC/KMD are enabled but we need ERC20 and QRC20 too / change login behaviour ? diff --git a/src/tests/config/coins.cfg.tests.cpp b/src/tests/config/coins.cfg.tests.cpp index 14f47460d0..82493f1437 100644 --- a/src/tests/config/coins.cfg.tests.cpp +++ b/src/tests/config/coins.cfg.tests.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include #include constexpr const char* g_komodolive_endpoint = "http://95.216.160.96:8080/api/v1"; @@ -21,7 +21,7 @@ t_http_client_ptr g_komodolive_client{std::make_unique(FROM_S TEST_CASE("generate all coinpaprika possibilities") { #if defined(__APPLE__) - const auto resp = atomic_dex::mm2::async_process_rpc_get(g_komodolive_client, "tickers", "/ticker").get(); + const auto resp = atomic_dex::kdf::async_process_rpc_get(g_komodolive_client, "tickers", "/ticker").get(); std::string body = TO_STD_STR(resp.extract_string(true).get()); nlohmann::json j_metrics = nlohmann::json::parse(body); nlohmann::json metrics = nlohmann::json::object(); From e0ddba782dfbfe7de82fabb01761eed61feae198 Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 12 Aug 2024 15:53:55 +0800 Subject: [PATCH 03/23] update version to 0.8.0 --- .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/constants/dex.constants.hpp | 12 +----------- src/core/atomicdex/version/version.hpp | 8 ++++---- vcpkg.json | 2 +- 8 files changed, 11 insertions(+), 21 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 623343db29..c83aeedff8 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.7.2] + - Komodo Wallet Desktop Version: [e.g. 0.8.0] - Build branch: [e.g. master/dev] diff --git a/.github/workflows/atomicdex-desktop-cd.yml b/.github/workflows/atomicdex-desktop-cd.yml index f5050b8e31..18d8bc396b 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.7.2" + DEX_VERSION: "0.8.0" DEX_WEBSITE: "https://atomicdex.io/" jobs: diff --git a/.github/workflows/atomicdex-desktop-ci.yml b/.github/workflows/atomicdex-desktop-ci.yml index 45c8fa9ec1..6446916b4a 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.7.2" + DEX_VERSION: "0.8.0" 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 35f69d82e0..9f3c1ca020 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.7.2) +project(${DEX_PROJECT_NAME} LANGUAGES CXX VERSION 0.8.0) 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 e15cabe5e2..b799e8dbfd 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.7.2") +set(DEX_VERSION "0.8.0") 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/constants/dex.constants.hpp b/src/core/atomicdex/constants/dex.constants.hpp index 99ed0c8c23..e9a8cc18bf 100644 --- a/src/core/atomicdex/constants/dex.constants.hpp +++ b/src/core/atomicdex/constants/dex.constants.hpp @@ -11,8 +11,7 @@ namespace atomic_dex g_primary_dex_coin, g_second_primary_dex_coin, "BTC-segwit", - "DGB-segwit", - "VOTE2024", + "DGB-segwit" }; inline const std::vector g_faucet_coins{ "DOC", @@ -21,12 +20,7 @@ namespace atomic_dex "IRISTEST", }; inline const std::vector g_vote_coins{ - "KIP0002", - "KIP0003", - "KIP0004", - "VOTE2024", }; - inline const std::vector g_wallet_only_coins{ "ARRR-BEP20", "RBTC", @@ -34,10 +28,6 @@ namespace atomic_dex "PAXG-ERC20", "USDT-ERC20", "XPM", - "KIP0002", - "KIP0003", - "KIP0004", - "VOTE2024", "ATOM" }; } diff --git a/src/core/atomicdex/version/version.hpp b/src/core/atomicdex/version/version.hpp index 55dd6fcdd0..921a490787 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.7.2-beta"; + return "0.8.0-beta"; } constexpr int get_num_version() noexcept { - return 72; + return 80; } constexpr const char* get_raw_version() { - return "0.7.2"; + return "0.8.0"; } constexpr const char* get_precedent_raw_version() { - return "0.7.1"; + return "0.7.2"; } } // namespace atomic_dex diff --git a/vcpkg.json b/vcpkg.json index 6d6777bd47..d53535cd46 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,6 @@ { "name": "komodo-wallet-desktop", - "version-string": "0.7.2", + "version-string": "0.8.0", "dependencies": [ "entt", "boost-multiprecision", From fb1f352332605d2598275d87a460f4c0fa69b5e0 Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 12 Aug 2024 17:02:45 +0800 Subject: [PATCH 04/23] limit decimals on large numbers --- atomic_defi_design/Dex/Constants/General.qml | 9 +++++++++ .../Dex/Exchange/Trade/OrderBook/ListDelegate.qml | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/atomic_defi_design/Dex/Constants/General.qml b/atomic_defi_design/Dex/Constants/General.qml index 8f626296f7..7cfea9c828 100644 --- a/atomic_defi_design/Dex/Constants/General.qml +++ b/atomic_defi_design/Dex/Constants/General.qml @@ -434,6 +434,15 @@ QtObject { return feetype + " " + amount + " " + ticker + " (" + fiat_text + ")" } + function reducedBignum(text, decimals=8, max_length=12) { + let val = new BigNumber(text).toFixed(decimals) + if (val.length > max_length) + { + return val.substring(0, max_length) + "..." + } + return val + } + function getSimpleFromPlaceholder(selectedTicker, selectedOrder, sell_ticker_balance) { if (sell_ticker_balance == 0) { diff --git a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml index 03819d17fe..25eca66c04 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml @@ -185,7 +185,7 @@ Item Layout.fillHeight: true Layout.minimumWidth: 90 Layout.alignment: Qt.AlignVCenter - text: { new BigNumber(price).toFixed(8) } + text: General.reducedBignum(price) font.family: DexTypo.fontFamily font.pixelSize: 12 color: isAsk ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor @@ -200,7 +200,7 @@ Item Layout.fillHeight: true Layout.minimumWidth: 90 Layout.alignment: Qt.AlignVCenter - text: { new BigNumber(base_max_volume).toFixed(6) } + text: General.reducedBignum(base_max_volume) font.family: DexTypo.fontFamily font.pixelSize: 12 horizontalAlignment: Text.AlignRight @@ -219,7 +219,7 @@ Item Layout.alignment: Qt.AlignVCenter font.family: DexTypo.fontFamily font.pixelSize: 12 - text: { new BigNumber(total).toFixed(6) } + text: General.reducedBignum(total) horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter wrapMode: Text.NoWrap From 182582b86485eadac45e12069fe2585341af5542 Mon Sep 17 00:00:00 2001 From: smk762 Date: Sat, 17 Aug 2024 22:49:18 +0800 Subject: [PATCH 05/23] Fix pro view order form overflow --- atomic_defi_design/Dex/Components/DexTextField.qml | 2 ++ .../Dex/Exchange/ProView/PlaceOrderForm/OrderForm.qml | 6 ++++-- atomic_defi_design/Dex/Wallet/SendResult.qml | 2 +- atomic_defi_design/Dex/Wallet/TransactionDetailsModal.qml | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/atomic_defi_design/Dex/Components/DexTextField.qml b/atomic_defi_design/Dex/Components/DexTextField.qml index 1764675b85..1aafddd2e2 100644 --- a/atomic_defi_design/Dex/Components/DexTextField.qml +++ b/atomic_defi_design/Dex/Components/DexTextField.qml @@ -10,6 +10,8 @@ TextField property alias left_text: left_text.text_value property alias right_text: right_text.text_value + property alias left_fontsize: left_text.font.pixelSize + property alias right_fontsize: right_text.font.pixelSize property alias radius: background.radius property color backgroundColor: Dex.CurrentTheme.textFieldBackgroundColor property color backgroundColorActive: Dex.CurrentTheme.textFieldActiveBackgroundColor diff --git a/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/OrderForm.qml b/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/OrderForm.qml index 1cc7440e66..c8f99ff257 100644 --- a/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/OrderForm.qml +++ b/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/OrderForm.qml @@ -103,7 +103,8 @@ ColumnLayout id: input_price left_text: qsTr("Price") - right_text: right_ticker + right_text: General.coinWithoutSuffix(right_ticker) + right_fontsize: 10 enabled: !(API.app.trading_pg.preferred_order.price !== undefined) color: enabled ? Dex.CurrentTheme.foregroundColor : Dex.CurrentTheme.foregroundColor2 text: backend_price ? backend_price : General.formatDouble(API.app.trading_pg.cex_price) @@ -167,7 +168,8 @@ ColumnLayout height: 36 radius: 18 left_text: sell_mode ? qsTr("Send") : qsTr("Receive") - right_text: left_ticker + right_text: General.coinWithoutSuffix(left_ticker) + right_fontsize: 10 placeholderText: "0" text: API.app.trading_pg.volume onTextChanged: { diff --git a/atomic_defi_design/Dex/Wallet/SendResult.qml b/atomic_defi_design/Dex/Wallet/SendResult.qml index 8ac93c37a5..c7db8ebd8f 100644 --- a/atomic_defi_design/Dex/Wallet/SendResult.qml +++ b/atomic_defi_design/Dex/Wallet/SendResult.qml @@ -16,7 +16,7 @@ MultipageModalContent property string custom_amount property alias tx_hash: tx_hash.text_value - titleText: qsTr("Transaction Complete!") + titleText: qsTr("Transaction Broadcast!") // Transaction Hash TitleText diff --git a/atomic_defi_design/Dex/Wallet/TransactionDetailsModal.qml b/atomic_defi_design/Dex/Wallet/TransactionDetailsModal.qml index ab69b7cba4..35bad4fb0d 100644 --- a/atomic_defi_design/Dex/Wallet/TransactionDetailsModal.qml +++ b/atomic_defi_design/Dex/Wallet/TransactionDetailsModal.qml @@ -124,7 +124,7 @@ MultipageModal TextEditWithTitle { title: qsTr("Date") - text: !details ? "" : details.timestamp === 0 ? qsTr("Unconfirmed"): details.date + text: !details ? "" : details.timestamp === 0 ? qsTr("Awaiting confirmation"): details.timestamp label.font.pixelSize: 13 } From 3ed4128468e2515d8c81ceb24e7354a09ad1b234 Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 19 Aug 2024 14:04:23 +0800 Subject: [PATCH 06/23] extend privacy mode redaction to more areas --- .../Dex/Components/DexLabel.qml | 5 +- .../Dex/Components/PairItemBadge.qml | 35 ++++++------ atomic_defi_design/Dex/Constants/General.qml | 29 ++++++---- .../Dex/Exchange/ProView/DexComboBoxLine.qml | 4 +- .../ProView/PlaceOrderForm/OrderForm.qml | 8 +-- .../ProView/TradingInfo/OrderLine.qml | 46 ++++++++-------- .../ProView/TradingInfo/OrdersPage.qml | 3 +- .../Dex/Exchange/Trade/SimpleView/List.qml | 33 +++++++----- .../Trade/SimpleView/SubCoinSelector.qml | 2 + .../Dex/Exchange/Trade/SimpleView/Trade.qml | 54 ++++++++++--------- 10 files changed, 122 insertions(+), 97 deletions(-) diff --git a/atomic_defi_design/Dex/Components/DexLabel.qml b/atomic_defi_design/Dex/Components/DexLabel.qml index ef6694978d..77d8bc4d00 100644 --- a/atomic_defi_design/Dex/Components/DexLabel.qml +++ b/atomic_defi_design/Dex/Components/DexLabel.qml @@ -20,13 +20,10 @@ Text } } + text: privacy && Dex.General.privacy_mode ? Dex.General.privacy_text : text_value font: monospace ? Dex.DexTypo.monoSmall : Dex.DexTypo.body2 - color: enabled ? Dex.CurrentTheme.foregroundColor : Dex.CurrentTheme.textDisabledColor - - text: privacy && Dex.General.privacy_mode ? Dex.General.privacy_text : text_value wrapMode: Text.WordWrap - onLinkActivated: Qt.openUrlExternally(link) linkColor: color } diff --git a/atomic_defi_design/Dex/Components/PairItemBadge.qml b/atomic_defi_design/Dex/Components/PairItemBadge.qml index ceeaa3c0b0..5ceab63666 100644 --- a/atomic_defi_design/Dex/Components/PairItemBadge.qml +++ b/atomic_defi_design/Dex/Components/PairItemBadge.qml @@ -30,7 +30,8 @@ DexRectangle Layout.leftMargin: 10 Layout.rightMargin: 20 - Dex.Text{ + DexLabel + { anchors.bottom: parent.top anchors.bottomMargin: 5 anchors.horizontalCenter: parent.horizontalCenter @@ -46,6 +47,7 @@ DexRectangle Layout.leftMargin: 20 Layout.rightMargin: 20 + // Coin Icon Dex.Image { id: icon @@ -58,49 +60,46 @@ DexRectangle Layout.topMargin: 0 Layout.bottomMargin: 0 } + + // ColumnLayout { spacing: 2 Layout.alignment: Qt.AlignVCenter - Dex.Text + DexLabel { Layout.preferredWidth: parent.width - 15 - text_value: `${ticker}   ${fullname}` - font.pixelSize: Style.textSizeSmall3 + font: Dex.DexTypo.body2 elide: Text.ElideRight wrapMode: Text.NoWrap } - Dex.Text + DexLabel { id: middle_line - property string coin_value: amount - text: coin_value + text_value: coin_value Layout.fillWidth: true elide: Text.ElideRight - color: Dex.CurrentTheme.foregroundColor - font: DexTypo.body2 wrapMode: Label.NoWrap - ToolTip.text: coin_value - Component.onCompleted: font.pixelSize = 11.5 + font: DexTypo.body3 + ToolTip.text: text_value + privacy: true } - Dex.Text + DexLabel { id: bottom_line - property string fiat_value: General.getFiatText(amount, ticker) - text: fiat_value + text_value: fiat_value Layout.fillWidth: true elide: Text.ElideRight - color: Dex.CurrentTheme.foregroundColor - font: DexTypo.body2 + font: DexTypo.body3 wrapMode: Label.NoWrap - ToolTip.text: fiat_value - Component.onCompleted: font.pixelSize = 11.5 + ToolTip.text: text_value + privacy: true } } } diff --git a/atomic_defi_design/Dex/Constants/General.qml b/atomic_defi_design/Dex/Constants/General.qml index 8f626296f7..251c19456d 100644 --- a/atomic_defi_design/Dex/Constants/General.qml +++ b/atomic_defi_design/Dex/Constants/General.qml @@ -419,6 +419,14 @@ QtObject { } function getFeesDetail(fees) { + if (privacy_mode) { + return [ + {"label": privacy_text}, + {"label": privacy_text}, + {"label": privacy_text}, + {"label": privacy_text} + ] + } return [ {"label": qsTr("Taker tx fee: "), "fee": fees.base_transaction_fees, "ticker": fees.base_transaction_fees_ticker}, {"label": qsTr("Dex tx fee: "), "fee": fees.fee_to_send_taker_fee, "ticker": fees.fee_to_send_taker_fee_ticker}, @@ -435,6 +443,10 @@ QtObject { } function getSimpleFromPlaceholder(selectedTicker, selectedOrder, sell_ticker_balance) { + if (privacy_mode) + { + return "0" + } if (sell_ticker_balance == 0) { return qsTr("%1 balance is zero").arg(selectedTicker) @@ -489,6 +501,7 @@ QtObject { } function getTxExplorerURL(ticker, txid, add_0x=true) { + if (privacy_mode) return '' if(txid !== '') { const coin_info = API.app.portfolio_pg.global_cfg_mdl.get_coin_info(ticker) const txid_prefix = (add_0x && coin_info.is_erc_family) ? '0x' : '' @@ -497,6 +510,7 @@ QtObject { } function getAddressExplorerURL(ticker, address) { + if (privacy_mode) return '' if(address !== '') { const coin_info = API.app.portfolio_pg.global_cfg_mdl.get_coin_info(ticker) return coin_info.explorer_url + addressTxUri(coin_info) + address @@ -505,12 +519,14 @@ QtObject { } function viewTxAtExplorer(ticker, txid, add_0x=true) { + if (privacy_mode) return '' if(txid !== '') { Qt.openUrlExternally(getTxExplorerURL(ticker, txid, add_0x)) } } function viewAddressAtExplorer(ticker, address) { + if (privacy_mode) return '' if(address !== '') { Qt.openUrlExternally(getAddressExplorerURL(ticker, address)) } @@ -555,6 +571,7 @@ QtObject { } function convertUsd(v) { + if (privacy_mode) return '' let rate = API.app.get_rate_conversion("USD", API.app.settings_pg.current_currency) let value = parseFloat(v) / parseFloat(rate) @@ -566,6 +583,7 @@ QtObject { } function formatFiat(received, amount, fiat, precision=2) { + if (privacy_mode) return '' if (precision == 2 && fiat == "BTC") { precision = 8 } @@ -575,6 +593,7 @@ QtObject { } function formatPercent(value, show_prefix=true) { + if (privacy_mode) return '' let prefix = '' if(value > 0) prefix = '+ ' else if(value < 0) { @@ -619,6 +638,7 @@ QtObject { } function formatCrypto(received, amount, ticker, fiat_amount, fiat, precision, trail_zeros) { + if (privacy_mode) return '' return diffPrefix(received) + ticker + " " + formatDouble(amount, precision, trail_zeros) + (fiat_amount ? " (" + formatFiat("", fiat_amount, fiat) + ")" : "") } @@ -777,15 +797,10 @@ QtObject { } function feeText(trade_info, base_ticker, has_info_icon=true, has_limited_space=false) { - - if(!trade_info || !trade_info.trading_fee) return "" - const tx_fee = txFeeText(trade_info, base_ticker, has_info_icon, has_limited_space) const trading_fee = tradingFeeText(trade_info, base_ticker, has_info_icon) const minimum_amount = minimumtradingFeeText(trade_info, base_ticker, has_info_icon) - - return tx_fee + "\n" + trading_fee +"
"+minimum_amount } @@ -804,13 +819,9 @@ QtObject { } function txFeeText(trade_info, base_ticker, has_info_icon=true, has_limited_space=false) { - if(!trade_info || !trade_info.trading_fee) return "" - const has_parent_coin_fees = hasParentCoinFees(trade_info) - var info = qsTr('%1 Transaction Fee'.arg(trade_info.base_transaction_fees_ticker))+': '+ trade_info.base_transaction_fees + " (%1)".arg(getFiatText(trade_info.base_transaction_fees, trade_info.base_transaction_fees_ticker, has_info_icon)) - if (has_parent_coin_fees) { info = info+"
"+qsTr('%1 Transaction Fee'.arg(trade_info.rel_transaction_fees_ticker))+': '+ trade_info.rel_transaction_fees + " (%1)".arg(getFiatText(trade_info.rel_transaction_fees, trade_info.rel_transaction_fees_ticker, has_info_icon)) } diff --git a/atomic_defi_design/Dex/Exchange/ProView/DexComboBoxLine.qml b/atomic_defi_design/Dex/Exchange/ProView/DexComboBoxLine.qml index 0d8269efb9..1c8f41a332 100644 --- a/atomic_defi_design/Dex/Exchange/ProView/DexComboBoxLine.qml +++ b/atomic_defi_design/Dex/Exchange/ProView/DexComboBoxLine.qml @@ -88,8 +88,9 @@ RowLayout { id: middle_line - property string coin_value: !details ? "" : details.balance + property string coin_value: !details ? "" : Dex.General.privacy_mode ? Dex.General.privacy_text : details.balance text: coin_value + privacy: true Layout.fillWidth: true elide: Text.ElideRight color: Dex.CurrentTheme.foregroundColor @@ -112,6 +113,7 @@ RowLayout font: DexTypo.body2 wrapMode: Label.NoWrap ToolTip.text: fiat_value + privacy: true Component.onCompleted: font.pixelSize = 11 } } diff --git a/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/OrderForm.qml b/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/OrderForm.qml index 1cc7440e66..5ad87b5310 100644 --- a/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/OrderForm.qml +++ b/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/OrderForm.qml @@ -174,6 +174,7 @@ ColumnLayout setVolume(text) reset_fees_state() } + enabled: !General.privacy_mode } OrderFormSubfield @@ -204,9 +205,9 @@ ColumnLayout left_label: "25%" middle_label: "50%" right_label: qsTr("Max") - left_tooltip_text: qsTr("Swap 25% of your tradable balance.") - middle_tooltip_text: qsTr("Swap 50% of your tradable balance.") - right_tooltip_text: qsTr("Swap 100% of your tradable balance.") + left_tooltip_text: General.privacy_mode ? qsTr("Diasble privacy mode to trade") : qsTr("Swap 25% of your tradable balance.") + middle_tooltip_text: General.privacy_mode ? qsTr("Diasble privacy mode to trade") : qsTr("Swap 50% of your tradable balance.") + right_tooltip_text: General.privacy_mode ? qsTr("Diasble privacy mode to trade") : qsTr("Swap 100% of your tradable balance.") } } @@ -419,6 +420,7 @@ ColumnLayout radius: 16 text: API.app.trading_pg.maker_mode ? qsTr("CREATE MAKER SWAP") : qsTr("START TAKER SWAP") font.weight: Font.Medium + enabled: !General.privacy_mode } } } \ No newline at end of file diff --git a/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderLine.qml b/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderLine.qml index 87d5456f62..91eb121226 100644 --- a/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderLine.qml +++ b/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderLine.qml @@ -49,7 +49,7 @@ FloatingBackground Layout.preferredWidth: 24 Layout.alignment: Qt.AlignCenter - DefaultText + DexLabel { id: statusText anchors.centerIn: parent @@ -86,34 +86,34 @@ FloatingBackground clip: true - DefaultText + DexLabel { id: baseAmountLabel anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter font.pixelSize: 12 - text: + text_value: { - if (!details) return + if (!details) return BigNumber.config({ DECIMAL_PLACES: 6 }) return new BigNumber(details.base_amount).toString(10) } - privacy: is_placed_order + privacy: true elide: Text.ElideRight maximumLineCount: 1 } - DefaultText + DexLabel { anchors.left: baseAmountLabel.right anchors.leftMargin: 3 anchors.verticalCenter: parent.verticalCenter font.pixelSize: 12 - text: !details ? "" : "(%1 %2)".arg(details.base_amount_current_currency).arg(API.app.settings_pg.current_fiat_sign) - privacy: is_placed_order + text_value: !details ? "" : "(%1 %2)".arg(details.base_amount_current_currency).arg(API.app.settings_pg.current_fiat_sign) + privacy: true elide: Text.ElideRight maximumLineCount: 1 } @@ -128,14 +128,14 @@ FloatingBackground iconSize: 18 } - DefaultText + DexLabel { anchors.right: relAmountInCurrCurrency.left anchors.rightMargin: 3 anchors.verticalCenter: parent.verticalCenter font.pixelSize: 12 - text: + text_value: { if (!details) return @@ -143,12 +143,12 @@ FloatingBackground return new BigNumber(details.rel_amount).toString(10) } - privacy: is_placed_order + privacy: true elide: Text.ElideRight maximumLineCount: 1 } - DefaultText + DexLabel { id: relAmountInCurrCurrency @@ -156,8 +156,8 @@ FloatingBackground anchors.verticalCenter: parent.verticalCenter font.pixelSize: 12 - text: !details ? "" : "(%1 %2)".arg(details.rel_amount_current_currency).arg(API.app.settings_pg.current_fiat_sign) - privacy: is_placed_order + text_value: !details ? "" : "(%1 %2)".arg(details.rel_amount_current_currency).arg(API.app.settings_pg.current_fiat_sign) + privacy: true elide: Text.ElideRight maximumLineCount: 1 } @@ -181,7 +181,7 @@ FloatingBackground source: General.coinIcon(!details ? atomic_app_primary_coin : details.base_coin ?? atomic_app_primary_coin) } - DefaultText + DexLabel { anchors.left: baseIcon.right anchors.leftMargin: 2 @@ -189,13 +189,13 @@ FloatingBackground font.weight: Font.Bold font.pixelSize: 12 - text: !details ? "" : details.base_coin - privacy: is_placed_order + text_value: !details ? "" : details.base_coin + privacy: true elide: Text.ElideRight maximumLineCount: 1 } - DefaultText + DexLabel { visible: clickable @@ -209,7 +209,7 @@ FloatingBackground color: Dex.CurrentTheme.foregroundColor2 } - DefaultText + DexLabel { anchors.right: relCoin.left anchors.rightMargin: 2 @@ -217,8 +217,8 @@ FloatingBackground font.weight: Font.Bold font.pixelSize: 12 - text: !details ? "" : details.rel_coin - privacy: is_placed_order + text_value: !details ? "" : details.rel_coin + privacy: true elide: Text.ElideRight maximumLineCount: 1 } @@ -244,7 +244,7 @@ FloatingBackground Layout.preferredWidth: 24 Layout.alignment: Qt.AlignCenter - DefaultText + DexLabel { anchors.centerIn: parent @@ -255,7 +255,7 @@ FloatingBackground DefaultTooltip { - contentItem: DefaultText + contentItem: DexLabel { text_value: qsTr("Funds are recoverable") font.pixelSize: Style.textSizeSmall4 diff --git a/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrdersPage.qml b/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrdersPage.qml index 3629b41dae..ab0e0968f7 100644 --- a/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrdersPage.qml +++ b/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrdersPage.qml @@ -132,6 +132,7 @@ Item { radius: 7 label.font: DexTypo.body2 text: qsTr("Export CSV") + enabled: list_model.length > 0 && ! General.privacy_mode onClicked: { export_csv_dialog.folder = General.os_file_prefix + API.app.settings_pg.get_export_folder() @@ -142,10 +143,10 @@ Item { DefaultButton { visible: !root.is_history && list_model.length > 0 - enabled: list_model.length > 0 Layout.preferredHeight: 29 radius: 7 label.font: DexTypo.body2 + enabled: list_model.length > 0 && ! General.privacy_mode text: qsTr("Cancel All") iconSource: Qaterial.Icons.close onClicked: API.app.trading_pg.orders.cancel_order(list_model_proxy.get_filtered_ids()) diff --git a/atomic_defi_design/Dex/Exchange/Trade/SimpleView/List.qml b/atomic_defi_design/Dex/Exchange/Trade/SimpleView/List.qml index c9ea3a02df..e48f670aad 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/SimpleView/List.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/SimpleView/List.qml @@ -27,8 +27,6 @@ DexListView delegate: ClipRRect { property var details: model - readonly property bool is_placed_order: !details ? false : - details.order_id !== '' property bool expanded: order_list_view.currentIndex === index @@ -78,7 +76,7 @@ DexListView height: width anchors.centerIn: parent running: !isSwapDone(details.order_status) && Qt.platform.os != "osx" - DefaultText + DexLabel { anchors.centerIn: parent font.pixelSize: getStatusFontSize(details.order_status) @@ -105,13 +103,13 @@ DexListView anchors.verticalCenter: parent.verticalCenter } - DefaultText + DexLabel { id: base_amount text_value: !details ? "" : General.formatCrypto("", details.base_amount, details.base_coin).replace(" ","
") font: rel_amount.font - privacy: is_placed_order + privacy: true anchors.verticalCenter: parent.verticalCenter } } @@ -150,7 +148,7 @@ DexListView height: width anchors.verticalCenter: parent.verticalCenter } - DefaultText + DexLabel { id: rel_amount text_value: !details ? "" : @@ -162,7 +160,7 @@ DexListView weight: Font.Normal }) anchors.verticalCenter: parent.verticalCenter - privacy: is_placed_order + privacy: true } } @@ -196,6 +194,7 @@ DexListView verticalAlignment: Label.AlignVCenter text: !details ? "" : General.formatCrypto("", details.base_amount, details.base_coin) + privacy: true } DexLabel { @@ -205,6 +204,7 @@ DexListView horizontalAlignment: Text.AlignRight text: !details ? "" : General.formatCrypto("", details.rel_amount, details.rel_coin) + privacy: true } } @@ -215,20 +215,22 @@ DexListView anchors.horizontalCenter: parent.horizontalCenter height: 20 opacity: .6 - DefaultText + DexLabel { Layout.fillWidth: true - Layout.fillHeight: true + Layout.fillHeight: true verticalAlignment: Label.AlignVCenter - text: "%1 %2".arg(API.app.settings_pg.current_currency).arg(details.base_amount_current_currency) + text_value: "%1 %2".arg(API.app.settings_pg.current_currency).arg(details.base_amount_current_currency) + privacy: true } - DefaultText + DexLabel { Layout.fillWidth: true Layout.fillHeight: true verticalAlignment: Label.AlignVCenter horizontalAlignment: Text.AlignRight - text: "%1 %2".arg(API.app.settings_pg.current_currency).arg(details.rel_amount_current_currency) + text_value: "%1 %2".arg(API.app.settings_pg.current_currency).arg(details.rel_amount_current_currency) + privacy: true } } @@ -244,7 +246,8 @@ DexListView Layout.fillWidth: true Layout.fillHeight: true verticalAlignment: Label.AlignVCenter - text: !details ? "" : details.date?? "" + text_value: !details ? "" : details.date?? "" + privacy: true } Item { @@ -269,6 +272,7 @@ DexListView anchors.verticalCenter: parent.verticalCenter text: "Refund " color: Qaterial.Colors.amber + privacy: true } } MouseArea @@ -283,9 +287,10 @@ DexListView contentItem: ColumnLayout { - DefaultText { + DexLabel { text_value: qsTr("Funds are recoverable") font.pixelSize: Constants.Style.textSizeSmall4 + privacy: true } } } diff --git a/atomic_defi_design/Dex/Exchange/Trade/SimpleView/SubCoinSelector.qml b/atomic_defi_design/Dex/Exchange/Trade/SimpleView/SubCoinSelector.qml index bf1938c322..852291ca5f 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/SimpleView/SubCoinSelector.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/SimpleView/SubCoinSelector.qml @@ -174,6 +174,7 @@ DexListView text_value: model.balance.replace(" ","") font.pixelSize: 14 wrapMode: Text.NoWrap + privacy: true } DexLabel @@ -184,6 +185,7 @@ DexListView text_value: "%1".arg(General.getFiatText(model.balance, model.ticker, false)) font.pixelSize: 14 wrapMode: Text.NoWrap + privacy: true } } } diff --git a/atomic_defi_design/Dex/Exchange/Trade/SimpleView/Trade.qml b/atomic_defi_design/Dex/Exchange/Trade/SimpleView/Trade.qml index 6a92ed7e0e..0eccd7fdbb 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/SimpleView/Trade.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/SimpleView/Trade.qml @@ -160,7 +160,7 @@ ClipRRect // Trade Card opacity: .85 } - DefaultText // Description + DexLabel // Description { anchors.topMargin: 10 font.pixelSize: Constants.Style.textSizeSmall4 @@ -231,7 +231,7 @@ ClipRRect // Trade Card radius: 20 visible: !coinSelectorSimplified.visible && has_coins_with_balance - DefaultText // From Text + DexLabel // From Text { id: _fromTitle anchors.top: parent.top @@ -242,7 +242,7 @@ ClipRRect // Trade Card font.pixelSize: Constants.Style.textSizeSmall4 } - Text // Tradable Balance + DexLabel // Tradable Balance { readonly property int _maxWidth: 140 @@ -252,10 +252,11 @@ ClipRRect // Trade Card anchors.verticalCenter: _fromTitle.verticalCenter anchors.right: parent.right anchors.rightMargin: 17 - text: qsTr("%1").arg(max_trade_volume) // This is slow to appear + text_value: qsTr("%1").arg(max_trade_volume) // This is slow to appear font.pixelSize: Constants.Style.textSizeSmall2 elide: Text.ElideRight color: DexTheme.foregroundColorLightColor1 + privacy: true DefaultImage { @@ -282,6 +283,10 @@ ClipRRect // Trade Card visible: parent.containsMouse text: { + if (General.privacy_mode) + { + return qsTr("Balance: ") + qsTr("****") + } let balance = Constants.API.app.portfolio_pg.portfolio_mdl.coin_balance(selectedTicker); return qsTr("Balance: ") + Constants.API.app.portfolio_pg.portfolio_mdl.coin_balance(selectedTicker) + ' (' + parent.parent.text + ' tradable)' } @@ -300,7 +305,7 @@ ClipRRect // Trade Card AmountField // Amount { id: _fromValue - enabled: sell_ticker_balance == 0 ? false : waiting_for_sell_coin_info ? false : true + enabled: sell_ticker_balance == 0 ? false : waiting_for_sell_coin_info ? false : General.privacy_mode ? false : true anchors.bottom: parent.bottom anchors.bottomMargin: 19 anchors.left: parent.left @@ -329,7 +334,7 @@ ClipRRect // Trade Card Component.onCompleted: text = "" } - Text // Amount In Fiat + DexLabel // Amount In Fiat { enabled: _fromValue.text visible: enabled @@ -340,7 +345,8 @@ ClipRRect // Trade Card font.pixelSize: Constants.Style.textSizeSmall1 color: DexTheme.foregroundColor opacity: .9 - text: enabled ? Constants.General.getFiatText(_fromValue.text, selectedTicker) : "" + text_value: enabled ? Constants.General.getFiatText(_fromValue.text, selectedTicker) : "" + privacy: true } Rectangle // Select ticker button @@ -387,7 +393,7 @@ ClipRRect // Trade Card source: Constants.General.coinIcon(selectedTicker) } - DefaultText + DexLabel { id: _selectedTickerText @@ -403,7 +409,7 @@ ClipRRect // Trade Card wrapMode: Text.NoWrap - DefaultText + DexLabel { id: _selectedTickerTypeText @@ -432,16 +438,13 @@ ClipRRect // Trade Card ClickableText // MAX Button { id: _maxClickableLabel - anchors.right: _selectTickerBut.left anchors.rightMargin: 10 anchors.verticalCenter: _selectTickerBut.verticalCenter - visible: selectedTicker !== "" - text: qsTr("MAX") color: Dex.CurrentTheme.foregroundColor2 - + enabled: !General.privacy_mode onClicked: _fromValue.text = max_trade_volume } @@ -464,7 +467,7 @@ ClipRRect // Trade Card && !coinSelectorSimplified.visible && has_coins_with_balance - DefaultText + DexLabel { anchors.fill: parent anchors.leftMargin: 17 @@ -487,7 +490,7 @@ ClipRRect // Trade Card background: Rectangle { color: swap_from_card.color} } - DefaultText // Amount In Fiat + DexLabel // Amount In Fiat { enabled: parseFloat(_toValue.text) > 0 && _toValue.text != "" anchors.top: _toValue.bottom @@ -533,7 +536,7 @@ ClipRRect // Trade Card } // When no order is currently selected. - DefaultText + DexLabel { id: _bestOrderNoTickerText @@ -567,7 +570,7 @@ ClipRRect // Trade Card } // Ticker (When a best order is currently selected) - DefaultText + DexLabel { id: _bestOrderTickerText @@ -584,7 +587,7 @@ ClipRRect // Trade Card font.pixelSize: Constants.Style.textSizeSmall2 wrapMode: Text.NoWrap - DefaultText + DexLabel { id: _bestOrderTickerTypeText @@ -623,14 +626,14 @@ ClipRRect // Trade Card && !coinSelectorSimplified.visible && has_coins_with_balance - DefaultText + DexLabel { Layout.rightMargin: 120 font.pixelSize: Constants.Style.textSizeSmall3 text: qsTr("Price") } - DefaultText + DexLabel { Layout.alignment: Qt.AlignRight font.pixelSize: Constants.Style.textSizeSmall3 @@ -714,7 +717,10 @@ ClipRRect // Trade Card function getAlert() { - console.log("_fromValue.text: " + _fromValue.text) + if (Constants.General.privacy_mode) + { + return qsTr("Disable privacy mode to trade.") + } var right_ticker = Constants.API.app.trading_pg.market_pairs_mdl.right_selected_coin var base_ticker = Constants.API.app.trading_pg.market_pairs_mdl.base_selected_coin var rel_ticker = Constants.API.app.trading_pg.market_pairs_mdl.rel_selected_coin @@ -932,7 +938,7 @@ ClipRRect // Trade Card anchors.fill: parent } - DefaultText + DexLabel { anchors.centerIn: parent text: qsTr("Calculating fee estimate... ") @@ -959,7 +965,7 @@ ClipRRect // Trade Card Component.onCompleted: _feesCard.height += 10 Component.onDestruction: _feesCard.height -= 10 - DefaultText + DexLabel { Layout.alignment: Qt.AlignLeft Layout.leftMargin: 10 @@ -967,7 +973,7 @@ ClipRRect // Trade Card font.pixelSize: Constants.Style.textSizeSmall3 } - DefaultText + DexLabel { Layout.alignment: Qt.AlignRight Layout.rightMargin: 10 From cc205b14c7896c66a500a32ca910161ab5e56159 Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 19 Aug 2024 14:09:59 +0800 Subject: [PATCH 07/23] text -> text_value --- .../Dex/Exchange/ProView/DexComboBoxLine.qml | 7 +++---- .../Exchange/ProView/TradingInfo/OrderModal.qml | 16 ++++++++-------- .../Dex/Exchange/Trade/SimpleView/List.qml | 6 ++---- .../Dex/Wallet/TransactionDetailsModal.qml | 4 ++-- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/atomic_defi_design/Dex/Exchange/ProView/DexComboBoxLine.qml b/atomic_defi_design/Dex/Exchange/ProView/DexComboBoxLine.qml index 1c8f41a332..0e83f5af8d 100644 --- a/atomic_defi_design/Dex/Exchange/ProView/DexComboBoxLine.qml +++ b/atomic_defi_design/Dex/Exchange/ProView/DexComboBoxLine.qml @@ -87,9 +87,8 @@ RowLayout Dex.Text { id: middle_line - - property string coin_value: !details ? "" : Dex.General.privacy_mode ? Dex.General.privacy_text : details.balance - text: coin_value + property string coin_value: !details ? "" : details.balance + text_value: coin_value privacy: true Layout.fillWidth: true elide: Text.ElideRight @@ -106,7 +105,7 @@ RowLayout property string fiat_value: !details ? "" : General.formatFiat("", details.main_currency_balance, API.app.settings_pg.current_currency) - text: fiat_value + text_value: fiat_value Layout.fillWidth: true elide: Text.ElideRight color: Dex.CurrentTheme.foregroundColor diff --git a/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderModal.qml b/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderModal.qml index df4d38f8a7..43de518cc4 100644 --- a/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderModal.qml +++ b/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderModal.qml @@ -165,9 +165,9 @@ MultipageModal { Layout.fillWidth: true title: qsTr("Swap ID") - text: !details ? "" : details.order_id + text_value: !details ? "" : details.order_id label.font.pixelSize: 13 - visible: text !== '' + visible: text_value !== '' copy: true privacy: true onCopyNotificationTitle: qsTr("Swap ID") @@ -178,11 +178,11 @@ MultipageModal { Layout.fillWidth: true title: !details ? "" : details.is_maker ? qsTr("Maker Payment Sent Transaction ID") : qsTr("Maker Payment Spent Transaction ID") - text: !details ? "" : details.maker_payment_id + text_value: !details ? "" : details.maker_payment_id label.font.pixelSize: 12 - visible: text !== '' + visible: text_value !== '' copy: true - linkURL: text !== '' ? General.getTxExplorerURL(details.is_maker ? details.base_coin : details.rel_coin, details.maker_payment_id) : '' + linkURL: text_value !== '' ? General.getTxExplorerURL(details.is_maker ? details.base_coin : details.rel_coin, details.maker_payment_id) : '' privacy: true onCopyNotificationTitle: qsTr("Maker Payment TXID") } @@ -192,13 +192,13 @@ MultipageModal { Layout.fillWidth: true title: !details ? "" : details.is_maker ? qsTr("Taker Payment Spent Transaction ID") : qsTr("Taker Payment Sent Transaction ID") - text: !details ? "" : details.taker_payment_id + text_value: !details ? "" : details.taker_payment_id label.font.pixelSize: 12 - visible: text !== '' + visible: text_value !== '' copy: true privacy: true onCopyNotificationTitle: qsTr("Taker Payment TXID") - linkURL: text !== '' ? General.getTxExplorerURL(details.is_maker ? details.rel_coin : details.base_coin, details.taker_payment_id) : '' + linkURL: text_value !== '' ? General.getTxExplorerURL(details.is_maker ? details.rel_coin : details.base_coin, details.taker_payment_id) : '' } // Error ID diff --git a/atomic_defi_design/Dex/Exchange/Trade/SimpleView/List.qml b/atomic_defi_design/Dex/Exchange/Trade/SimpleView/List.qml index e48f670aad..c900b3ca17 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/SimpleView/List.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/SimpleView/List.qml @@ -192,7 +192,7 @@ DexListView Layout.fillWidth: true Layout.fillHeight: true verticalAlignment: Label.AlignVCenter - text: !details ? "" : + text_value: !details ? "" : General.formatCrypto("", details.base_amount, details.base_coin) privacy: true } @@ -202,7 +202,7 @@ DexListView Layout.fillHeight: true verticalAlignment: Label.AlignVCenter horizontalAlignment: Text.AlignRight - text: !details ? "" : + text_value: !details ? "" : General.formatCrypto("", details.rel_amount, details.rel_coin) privacy: true } @@ -272,7 +272,6 @@ DexListView anchors.verticalCenter: parent.verticalCenter text: "Refund " color: Qaterial.Colors.amber - privacy: true } } MouseArea @@ -290,7 +289,6 @@ DexListView DexLabel { text_value: qsTr("Funds are recoverable") font.pixelSize: Constants.Style.textSizeSmall4 - privacy: true } } } diff --git a/atomic_defi_design/Dex/Wallet/TransactionDetailsModal.qml b/atomic_defi_design/Dex/Wallet/TransactionDetailsModal.qml index ab69b7cba4..fe2e75c2f7 100644 --- a/atomic_defi_design/Dex/Wallet/TransactionDetailsModal.qml +++ b/atomic_defi_design/Dex/Wallet/TransactionDetailsModal.qml @@ -80,7 +80,7 @@ MultipageModal TextEditWithTitle { title: qsTr("Amount") - text: !details ? "" : General.formatCrypto(!details.am_i_sender, details.amount, api_wallet_page.ticker, details.amount_fiat, API.app.settings_pg.current_currency) + text_value: !details ? "" : General.formatCrypto(!details.am_i_sender, details.amount, api_wallet_page.ticker, details.amount_fiat, API.app.settings_pg.current_currency) value_color: !details ? "white" : details.am_i_sender ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor privacy: true label.font.pixelSize: 13 @@ -90,7 +90,7 @@ MultipageModal TextEditWithTitle { title: qsTr("Fees") - text: !details ? "" : General.formatCrypto(parseFloat(details.fees) < 0, Math.abs(parseFloat(details.fees)), current_ticker_infos.fee_ticker, details.fees_amount_fiat, API.app.settings_pg.current_currency) + text_value: !details ? "" : General.formatCrypto(parseFloat(details.fees) < 0, Math.abs(parseFloat(details.fees)), current_ticker_infos.fee_ticker, details.fees_amount_fiat, API.app.settings_pg.current_currency) value_color: !details ? "white" : parseFloat(details.fees) > 0 ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor privacy: true label.font.pixelSize: 13 From 1b415db4adfceae939fc5399b43519910fa17b90 Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 19 Aug 2024 16:08:03 +0800 Subject: [PATCH 08/23] disable orderbooks in privacy mode --- .../Exchange/ProView/TradingInfo/OrderModal.qml | 16 ++++++++-------- .../Exchange/Trade/OrderBook/ListDelegate.qml | 5 +++++ .../Dex/Wallet/TransactionDetailsModal.qml | 4 ++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderModal.qml b/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderModal.qml index 43de518cc4..df4d38f8a7 100644 --- a/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderModal.qml +++ b/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderModal.qml @@ -165,9 +165,9 @@ MultipageModal { Layout.fillWidth: true title: qsTr("Swap ID") - text_value: !details ? "" : details.order_id + text: !details ? "" : details.order_id label.font.pixelSize: 13 - visible: text_value !== '' + visible: text !== '' copy: true privacy: true onCopyNotificationTitle: qsTr("Swap ID") @@ -178,11 +178,11 @@ MultipageModal { Layout.fillWidth: true title: !details ? "" : details.is_maker ? qsTr("Maker Payment Sent Transaction ID") : qsTr("Maker Payment Spent Transaction ID") - text_value: !details ? "" : details.maker_payment_id + text: !details ? "" : details.maker_payment_id label.font.pixelSize: 12 - visible: text_value !== '' + visible: text !== '' copy: true - linkURL: text_value !== '' ? General.getTxExplorerURL(details.is_maker ? details.base_coin : details.rel_coin, details.maker_payment_id) : '' + linkURL: text !== '' ? General.getTxExplorerURL(details.is_maker ? details.base_coin : details.rel_coin, details.maker_payment_id) : '' privacy: true onCopyNotificationTitle: qsTr("Maker Payment TXID") } @@ -192,13 +192,13 @@ MultipageModal { Layout.fillWidth: true title: !details ? "" : details.is_maker ? qsTr("Taker Payment Spent Transaction ID") : qsTr("Taker Payment Sent Transaction ID") - text_value: !details ? "" : details.taker_payment_id + text: !details ? "" : details.taker_payment_id label.font.pixelSize: 12 - visible: text_value !== '' + visible: text !== '' copy: true privacy: true onCopyNotificationTitle: qsTr("Taker Payment TXID") - linkURL: text_value !== '' ? General.getTxExplorerURL(details.is_maker ? details.rel_coin : details.base_coin, details.taker_payment_id) : '' + linkURL: text !== '' ? General.getTxExplorerURL(details.is_maker ? details.rel_coin : details.base_coin, details.taker_payment_id) : '' } // Error ID diff --git a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml index 03819d17fe..8667ff4694 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml @@ -45,6 +45,10 @@ Item { if (mouse_area.containsMouse) { + if (General.privacy_mode) + { + return qsTr("Orderbook is disabled in privacy mode") + } if (API.app.trading_pg.maker_mode) { return qsTr("Orderbook is disabled while creating maker orders") @@ -109,6 +113,7 @@ Item // Populate form with selected order onClicked: { + if (General.privacy_mode) return if (is_mine) return if (API.app.trading_pg.maker_mode) return diff --git a/atomic_defi_design/Dex/Wallet/TransactionDetailsModal.qml b/atomic_defi_design/Dex/Wallet/TransactionDetailsModal.qml index fe2e75c2f7..ab69b7cba4 100644 --- a/atomic_defi_design/Dex/Wallet/TransactionDetailsModal.qml +++ b/atomic_defi_design/Dex/Wallet/TransactionDetailsModal.qml @@ -80,7 +80,7 @@ MultipageModal TextEditWithTitle { title: qsTr("Amount") - text_value: !details ? "" : General.formatCrypto(!details.am_i_sender, details.amount, api_wallet_page.ticker, details.amount_fiat, API.app.settings_pg.current_currency) + text: !details ? "" : General.formatCrypto(!details.am_i_sender, details.amount, api_wallet_page.ticker, details.amount_fiat, API.app.settings_pg.current_currency) value_color: !details ? "white" : details.am_i_sender ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor privacy: true label.font.pixelSize: 13 @@ -90,7 +90,7 @@ MultipageModal TextEditWithTitle { title: qsTr("Fees") - text_value: !details ? "" : General.formatCrypto(parseFloat(details.fees) < 0, Math.abs(parseFloat(details.fees)), current_ticker_infos.fee_ticker, details.fees_amount_fiat, API.app.settings_pg.current_currency) + text: !details ? "" : General.formatCrypto(parseFloat(details.fees) < 0, Math.abs(parseFloat(details.fees)), current_ticker_infos.fee_ticker, details.fees_amount_fiat, API.app.settings_pg.current_currency) value_color: !details ? "white" : parseFloat(details.fees) > 0 ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor privacy: true label.font.pixelSize: 13 From 1b146a4ddeff5a15269fadc91c787e23ee2dd706 Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 19 Aug 2024 16:43:54 +0800 Subject: [PATCH 09/23] rename kdf DB path to retain prior history --- src/core/atomicdex/services/kdf/kdf.service.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/core/atomicdex/services/kdf/kdf.service.cpp b/src/core/atomicdex/services/kdf/kdf.service.cpp index 741a21fdea..6c7e654afb 100644 --- a/src/core/atomicdex/services/kdf/kdf.service.cpp +++ b/src/core/atomicdex/services/kdf/kdf.service.cpp @@ -2227,6 +2227,17 @@ namespace atomic_dex .passphrase = std::move(passphrase), .rpc_password = std::move(rpcpass) == "" ? std::move(atomic_dex::gen_random_password()) : std::move(rpcpass) }; + + auto dbdir = std::filesystem::path(cfg.dbdir); + auto old_dbdir = std::filesystem::path(utils::get_atomic_dex_data_folder() / "mm2" / "DB"); + if (not std::filesystem::exists(dbdir)) + { + if (std::filesystem::exists(old_dbdir)) + { + std::filesystem::rename(old_dbdir, dbdir); + } + } + kdf::set_system_manager(m_system_manager); kdf::set_rpc_password(cfg.rpc_password); json json_cfg; From a3db7f3eaaa229ac307f6a27c1b59b076b5c5b25 Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 19 Aug 2024 18:30:29 +0800 Subject: [PATCH 10/23] fix nim build error --- .github/workflows/atomicdex-desktop-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/atomicdex-desktop-ci.yml b/.github/workflows/atomicdex-desktop-ci.yml index 45c8fa9ec1..8263413217 100644 --- a/.github/workflows/atomicdex-desktop-ci.yml +++ b/.github/workflows/atomicdex-desktop-ci.yml @@ -160,6 +160,7 @@ jobs: echo "CHOOSENIM_CHOOSE_VERSION=1.6.2" >> $GITHUB_ENV export CHOOSENIM_CHOOSE_VERSION=1.6.2 curl https://nim-lang.org/choosenim/init.sh > choosenim.sh + sed -i.bak 's|https://github.com/nim-lang/choosenim/releases/download/|https://github.com/dom96/choosenim/releases/download/|g' choosenim.sh chmod +x choosenim.sh ./choosenim.sh -y export PATH=/home/runner/.nimble/bin:$PATH @@ -171,6 +172,7 @@ jobs: echo "CHOOSENIM_CHOOSE_VERSION=1.6.2" >> $GITHUB_ENV export CHOOSENIM_CHOOSE_VERSION=1.6.2 curl https://nim-lang.org/choosenim/init.sh > choosenim.sh + sed -i.bak 's|https://github.com/nim-lang/choosenim/releases/download/|https://github.com/dom96/choosenim/releases/download/|g' choosenim.sh chmod +x choosenim.sh ./choosenim.sh -y export PATH=/Users/runner/.nimble/bin:$PATH From 179b578d0fea38babd5a112b414e5a3e38b16170 Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 20 Aug 2024 02:33:01 +0800 Subject: [PATCH 11/23] use parent folder --- src/core/atomicdex/services/kdf/kdf.service.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/atomicdex/services/kdf/kdf.service.cpp b/src/core/atomicdex/services/kdf/kdf.service.cpp index 6c7e654afb..71469bd2e3 100644 --- a/src/core/atomicdex/services/kdf/kdf.service.cpp +++ b/src/core/atomicdex/services/kdf/kdf.service.cpp @@ -2228,13 +2228,13 @@ namespace atomic_dex .rpc_password = std::move(rpcpass) == "" ? std::move(atomic_dex::gen_random_password()) : std::move(rpcpass) }; - auto dbdir = std::filesystem::path(cfg.dbdir); - auto old_dbdir = std::filesystem::path(utils::get_atomic_dex_data_folder() / "mm2" / "DB"); - if (not std::filesystem::exists(dbdir)) + auto dbdir_parent = std::filesystem::path(utils::get_atomic_dex_data_folder() / "kdf"); + auto old_dbdir_parent = std::filesystem::path(utils::get_atomic_dex_data_folder() / "mm2"); + if (not std::filesystem::exists(dbdir_parent)) { - if (std::filesystem::exists(old_dbdir)) + if (std::filesystem::exists(old_dbdir_parent)) { - std::filesystem::rename(old_dbdir, dbdir); + std::filesystem::rename(old_dbdir_parent, dbdir_parent); } } From f72e91d98e931765905c95d1fb021ff0acf7249d Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 20 Aug 2024 02:34:36 +0800 Subject: [PATCH 12/23] use parent folders --- src/core/atomicdex/services/kdf/kdf.service.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/atomicdex/services/kdf/kdf.service.cpp b/src/core/atomicdex/services/kdf/kdf.service.cpp index 6c7e654afb..71469bd2e3 100644 --- a/src/core/atomicdex/services/kdf/kdf.service.cpp +++ b/src/core/atomicdex/services/kdf/kdf.service.cpp @@ -2228,13 +2228,13 @@ namespace atomic_dex .rpc_password = std::move(rpcpass) == "" ? std::move(atomic_dex::gen_random_password()) : std::move(rpcpass) }; - auto dbdir = std::filesystem::path(cfg.dbdir); - auto old_dbdir = std::filesystem::path(utils::get_atomic_dex_data_folder() / "mm2" / "DB"); - if (not std::filesystem::exists(dbdir)) + auto dbdir_parent = std::filesystem::path(utils::get_atomic_dex_data_folder() / "kdf"); + auto old_dbdir_parent = std::filesystem::path(utils::get_atomic_dex_data_folder() / "mm2"); + if (not std::filesystem::exists(dbdir_parent)) { - if (std::filesystem::exists(old_dbdir)) + if (std::filesystem::exists(old_dbdir_parent)) { - std::filesystem::rename(old_dbdir, dbdir); + std::filesystem::rename(old_dbdir_parent, dbdir_parent); } } From d999356e78922fb0ccd830c1d6a81dd836d462d2 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 22 Aug 2024 01:14:41 +0800 Subject: [PATCH 13/23] add timesync service --- .../sync/timesync.checker.service.cpp | 116 ++++++++++++++++++ .../sync/timesync.checker.service.hpp | 60 +++++++++ 2 files changed, 176 insertions(+) create mode 100644 src/core/atomicdex/services/sync/timesync.checker.service.cpp create mode 100644 src/core/atomicdex/services/sync/timesync.checker.service.hpp diff --git a/src/core/atomicdex/services/sync/timesync.checker.service.cpp b/src/core/atomicdex/services/sync/timesync.checker.service.cpp new file mode 100644 index 0000000000..b74efa0927 --- /dev/null +++ b/src/core/atomicdex/services/sync/timesync.checker.service.cpp @@ -0,0 +1,116 @@ +/****************************************************************************** + * Copyright © 2013-2024 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. * + * * + ******************************************************************************/ + +#include +#include "atomicdex/services/sync/timesync.checker.service.hpp" +#include "atomicdex/utilities/cpprestsdk.utilities.hpp" + +namespace +{ + constexpr const char* g_timesync_endpoint = "https://worldtimeapi.org"; + web::http::client::http_client_config g_timesync_cfg{[]() + { + web::http::client::http_client_config cfg; + cfg.set_validate_certificates(false); + cfg.set_timeout(std::chrono::seconds(5)); + return cfg; + }()}; + t_http_client_ptr g_timesync_client = std::make_unique(FROM_STD_STR(g_timesync_endpoint), g_timesync_cfg); + pplx::cancellation_token_source g_synctoken_source; + + pplx::task + async_fetch_timesync() + { + web::http::http_request req; + req.set_method(web::http::methods::GET); + req.set_request_uri(FROM_STD_STR("api/timezone/UTC")); + SPDLOG_INFO("req: {}", TO_STD_STR(req.to_string())); + return g_timesync_client->request(req, g_synctoken_source.get_token()); + } + + bool get_timesync_info_rpc(web::http::http_response resp_http) + { + using namespace std::string_literals; + nlohmann::json resp; + bool sync_ok = false; + std::string resp_str = TO_STD_STR(resp_http.extract_string(true).get()); + if (resp_http.status_code() != 200) + { + SPDLOG_ERROR("Cannot reach the endpoint [{}]: {}", g_timesync_endpoint); + } + else + { + resp = nlohmann::json::parse(resp_str); + int8_t epoch_ts = resp["unixtime"]; + int8_t current_ts = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + int8_t ts_diff = epoch_ts - current_ts; + if (abs(ts_diff) < 60) + { + sync_ok = true; + } + SPDLOG_WARN("TIME SYNC STATUS [{}]", sync_ok); + } + return sync_ok; + } +} // namespace + + +namespace atomic_dex +{ + timesync_checker_service::timesync_checker_service(entt::registry& registry, QObject* parent) : QObject(parent), system(registry) + { + m_timesync_clock = std::chrono::high_resolution_clock::now(); + fetch_timesync_info(); + } + + void timesync_checker_service::update() + { + using namespace std::chrono_literals; + + const auto now = std::chrono::high_resolution_clock::now(); + const auto s = std::chrono::duration_cast(now - m_timesync_clock); + if (s >= 1min) + { + fetch_timesync_info(); + m_timesync_clock = std::chrono::high_resolution_clock::now(); + } + } + + void timesync_checker_service::fetch_timesync_info() + { + if (is_timesync_fetching) + return; + is_timesync_fetching = true; + emit isTimesyncFetchingChanged(); + async_fetch_timesync() + .then([this](web::http::http_response resp) { + + this->m_timesync_info = get_timesync_info_rpc(resp); + is_timesync_fetching = false; + emit isTimesyncFetchingChanged(); + emit timesyncInfoChanged(); + }) + .then(&handle_exception_pplx_task); + } + + bool timesync_checker_service::get_timesync_info() const + { + return *m_timesync_info; + } + +} // namespace atomic_dex + + diff --git a/src/core/atomicdex/services/sync/timesync.checker.service.hpp b/src/core/atomicdex/services/sync/timesync.checker.service.hpp new file mode 100644 index 0000000000..e3ccb86eea --- /dev/null +++ b/src/core/atomicdex/services/sync/timesync.checker.service.hpp @@ -0,0 +1,60 @@ +/****************************************************************************** + * Copyright © 2013-2024 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 + +#include +#include + +#include +#include + +#include + +namespace atomic_dex +{ + class timesync_checker_service final : public QObject, public ag::ecs::pre_update_system + { + Q_OBJECT + + Q_PROPERTY(QVariant timesyncInfo READ get_timesync_info NOTIFY timesyncInfoChanged) + Q_PROPERTY(bool isTimesyncFetching READ get_is_timesync_fetching NOTIFY isTimesyncFetchingChanged) + + using t_timesync_time_point = std::chrono::high_resolution_clock::time_point; + using t_bool_synchronized = boost::synchronized_value; + + t_bool_synchronized m_timesync_info; + t_timesync_time_point m_timesync_clock; + t_bool_synchronized is_timesync_fetching; + + void fetch_timesync_info(); + + public: + explicit timesync_checker_service(entt::registry& registry, QObject* parent = nullptr); + ~timesync_checker_service() final = default; + + void update() final; + + [[nodiscard]] bool get_timesync_info() const; + [[nodiscard]] bool get_is_timesync_fetching() const noexcept { return *is_timesync_fetching; } + + signals: + void timesyncInfoChanged(); + void isTimesyncFetchingChanged(); + }; +} // namespace atomic_dex + +REFL_AUTO(type(atomic_dex::timesync_checker_service)) From c20f43adbdd8488ebd5e4d934b478b1be5683873 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 22 Aug 2024 01:15:07 +0800 Subject: [PATCH 14/23] include timesync service --- src/app/app.cpp | 15 ++++++++++++++- src/app/app.hpp | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/app/app.cpp b/src/app/app.cpp index 8036d57e47..f2bf63ef11 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -44,6 +44,7 @@ #include "atomicdex/services/price/komodo_prices/komodo.prices.provider.hpp" #include "atomicdex/services/price/coingecko/coingecko.wallet.charts.hpp" #include "atomicdex/services/price/orderbook.scanner.service.hpp" +#include "atomicdex/services/sync/timesync.checker.service.hpp" namespace { @@ -498,6 +499,7 @@ namespace atomic_dex system_manager_.create_system(system_manager_); system_manager_.create_system(); system_manager_.create_system(); + system_manager_.create_system(); system_manager_.create_system(system_manager_); system_manager_.create_system(system_manager_); system_manager_.create_system( @@ -910,7 +912,18 @@ namespace atomic_dex } } // namespace atomic_dex -//! update checker +//! time sync checker +namespace atomic_dex +{ + timesync_checker_service* application::get_timesync_checker_service() const + { + auto ptr = const_cast(std::addressof(system_manager_.get_system())); + assert(ptr != nullptr); + return ptr; + } +} // namespace atomic_dex + +//! zcash_params checker namespace atomic_dex { zcash_params_service* application::get_zcash_params_service() const diff --git a/src/app/app.hpp b/src/app/app.hpp index e6d26b7fd1..6e1e93a9fe 100644 --- a/src/app/app.hpp +++ b/src/app/app.hpp @@ -50,6 +50,7 @@ #include "atomicdex/services/price/global.provider.hpp" #include "atomicdex/services/update/update.checker.service.hpp" #include "atomicdex/services/update/zcash.params.service.hpp" +#include "atomicdex/services/sync/timesync.checker.service.hpp" #include "atomicdex/utilities/qt.utilities.hpp" namespace ag = antara::gaming; @@ -75,6 +76,7 @@ namespace atomic_dex Q_PROPERTY(settings_page* settings_pg READ get_settings_page NOTIFY settingsPageChanged) Q_PROPERTY(qt_wallet_manager* wallet_mgr READ get_wallet_mgr NOTIFY walletMgrChanged) Q_PROPERTY(update_checker_service* updateCheckerService READ get_update_checker_service NOTIFY updateCheckerServiceChanged) + Q_PROPERTY(timesync_checker_service* timesyncCheckerService READ get_timesync_checker_service NOTIFY timesyncCheckerServiceChanged) Q_PROPERTY(zcash_params_service* zcash_params READ get_zcash_params_service NOTIFY zcashParamsServiceChanged) //! Private function @@ -135,6 +137,7 @@ namespace atomic_dex qt_wallet_manager* get_wallet_mgr() const; internet_service_checker* get_internet_checker() const; update_checker_service* get_update_checker_service() const; + timesync_checker_service* get_timesync_checker_service() const; [[nodiscard]] zcash_params_service* get_zcash_params_service() const; exporter_service* get_exporter_service() const; @@ -180,6 +183,7 @@ namespace atomic_dex void walletPageChanged(); void ordersChanged(); void updateCheckerServiceChanged(); + void timesyncCheckerServiceChanged(); void zcashParamsServiceChanged(); void tradingPageChanged(); void settingsPageChanged(); From 90b1d025b9a045db9f391fb446b2b80dd13e2560 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 22 Aug 2024 21:03:09 +0800 Subject: [PATCH 15/23] add tooltip and default to portoflio when dex disabled --- .../Dex/Exchange/Trade/FeeIcon.qml | 4 +-- atomic_defi_design/Dex/Sidebar/Center.qml | 24 ++++++++++++- .../Dex/Sidebar/FigurativeLine.qml | 11 ++++++ .../sync/timesync.checker.service.cpp | 34 ++++++++++--------- .../sync/timesync.checker.service.hpp | 4 +-- 5 files changed, 56 insertions(+), 21 deletions(-) diff --git a/atomic_defi_design/Dex/Exchange/Trade/FeeIcon.qml b/atomic_defi_design/Dex/Exchange/Trade/FeeIcon.qml index a5f65a9ba9..883e5e13d1 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/FeeIcon.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/FeeIcon.qml @@ -24,12 +24,12 @@ DefaultText { visible: mouse_area.containsMouse contentItem: ColumnLayout { - DefaultText { + DexLabel { id: tx_fee_text text_value: General.txFeeText(trade_info, base, false) font.pixelSize: Style.textSizeSmall4 } - DefaultText { + DexLabel { text_value: General.tradingFeeText(trade_info, base, false) font.pixelSize: tx_fee_text.font.pixelSize } diff --git a/atomic_defi_design/Dex/Sidebar/Center.qml b/atomic_defi_design/Dex/Sidebar/Center.qml index 89ab94df97..a3e2586d90 100644 --- a/atomic_defi_design/Dex/Sidebar/Center.qml +++ b/atomic_defi_design/Dex/Sidebar/Center.qml @@ -15,6 +15,25 @@ MouseArea height: lineHeight * 5 hoverEnabled: true + Connections + { + target: API.app.timesyncCheckerService + + function onTimesyncInfoChanged() + { + if (!API.app.timesyncCheckerService.timesyncInfo) + { + _dexLine.timesyncInfo = false + if (currentLineType === Main.LineType.DEX) currentLineType = Main.LineType.Portfolio + root.lineSelected(Main.LineType.Portfolio); + } + else + { + _dexLine.timesyncInfo = true + } + } + } + Connections { target: parent.parent @@ -84,12 +103,15 @@ MouseArea FigurativeLine { id: _dexLine + property var timesyncInfo: API.app.timesyncCheckerService.timesyncInfo Layout.fillWidth: true type: Main.LineType.DEX + label.color: timesyncInfo ? Dex.CurrentTheme.foregroundColor : Dex.CurrentTheme.textDisabledColor label.text: qsTr("DEX") // isExpanded ? qsTr("DEX") : "" icon.source: General.image_path + "menu-exchange-white.svg" - onClicked: lineSelected(type) + onClicked: timesyncInfo ? lineSelected(type) : null + disabled_tt_text: timesyncInfo ? "" : qsTr("DEX is disabled due to system clock synchronization issues. Please check your device time settings.") } FigurativeLine diff --git a/atomic_defi_design/Dex/Sidebar/FigurativeLine.qml b/atomic_defi_design/Dex/Sidebar/FigurativeLine.qml index 540ca6e11b..a747a36e7f 100644 --- a/atomic_defi_design/Dex/Sidebar/FigurativeLine.qml +++ b/atomic_defi_design/Dex/Sidebar/FigurativeLine.qml @@ -1,12 +1,14 @@ import QtQuick 2.12 import "../Components" +import "../Constants" import Dex.Themes 1.0 as Dex // FigurativeLine acts the same as Line but contains a figurative icon on the left of its label Line { property alias icon: _icon + property string disabled_tt_text: "" DefaultImage { @@ -26,4 +28,13 @@ Line currentLineType === type && type != Main.LineType.Support ? Dex.CurrentTheme.sidebarLineTextSelected : Dex.CurrentTheme.foregroundColor } + + DexTooltip + { + visible: mouseArea.containsMouse && disabled_tt_text + delay: 500 + timeout: 5000 + text: disabled_tt_text + font.pixelSize: Style.textSizeSmall4 + } } diff --git a/src/core/atomicdex/services/sync/timesync.checker.service.cpp b/src/core/atomicdex/services/sync/timesync.checker.service.cpp index b74efa0927..2909368a4e 100644 --- a/src/core/atomicdex/services/sync/timesync.checker.service.cpp +++ b/src/core/atomicdex/services/sync/timesync.checker.service.cpp @@ -37,7 +37,6 @@ namespace web::http::http_request req; req.set_method(web::http::methods::GET); req.set_request_uri(FROM_STD_STR("api/timezone/UTC")); - SPDLOG_INFO("req: {}", TO_STD_STR(req.to_string())); return g_timesync_client->request(req, g_synctoken_source.get_token()); } @@ -54,14 +53,13 @@ namespace else { resp = nlohmann::json::parse(resp_str); - int8_t epoch_ts = resp["unixtime"]; - int8_t current_ts = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); - int8_t ts_diff = epoch_ts - current_ts; + int64_t epoch_ts = resp["unixtime"]; + int64_t current_ts = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + int64_t ts_diff = epoch_ts - current_ts; if (abs(ts_diff) < 60) { sync_ok = true; } - SPDLOG_WARN("TIME SYNC STATUS [{}]", sync_ok); } return sync_ok; } @@ -73,42 +71,46 @@ namespace atomic_dex timesync_checker_service::timesync_checker_service(entt::registry& registry, QObject* parent) : QObject(parent), system(registry) { m_timesync_clock = std::chrono::high_resolution_clock::now(); - fetch_timesync_info(); + m_timesync_status = true; + fetch_timesync_status(); } void timesync_checker_service::update() { using namespace std::chrono_literals; - const auto now = std::chrono::high_resolution_clock::now(); - const auto s = std::chrono::duration_cast(now - m_timesync_clock); - if (s >= 1min) + int64_t m_timesync_clock_ts = std::chrono::duration_cast(m_timesync_clock.time_since_epoch()).count(); + int64_t now_ts = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + int64_t ts_diff = now_ts - m_timesync_clock_ts; + if (abs(ts_diff) >= 60) { - fetch_timesync_info(); + fetch_timesync_status(); m_timesync_clock = std::chrono::high_resolution_clock::now(); } } - void timesync_checker_service::fetch_timesync_info() + void timesync_checker_service::fetch_timesync_status() { if (is_timesync_fetching) + { return; + } is_timesync_fetching = true; emit isTimesyncFetchingChanged(); async_fetch_timesync() .then([this](web::http::http_response resp) { - - this->m_timesync_info = get_timesync_info_rpc(resp); - is_timesync_fetching = false; - emit isTimesyncFetchingChanged(); + this->m_timesync_status = get_timesync_info_rpc(resp); emit timesyncInfoChanged(); }) .then(&handle_exception_pplx_task); + is_timesync_fetching = false; + emit isTimesyncFetchingChanged(); + } bool timesync_checker_service::get_timesync_info() const { - return *m_timesync_info; + return *m_timesync_status; } } // namespace atomic_dex diff --git a/src/core/atomicdex/services/sync/timesync.checker.service.hpp b/src/core/atomicdex/services/sync/timesync.checker.service.hpp index e3ccb86eea..54b3f73bf5 100644 --- a/src/core/atomicdex/services/sync/timesync.checker.service.hpp +++ b/src/core/atomicdex/services/sync/timesync.checker.service.hpp @@ -36,11 +36,11 @@ namespace atomic_dex using t_timesync_time_point = std::chrono::high_resolution_clock::time_point; using t_bool_synchronized = boost::synchronized_value; - t_bool_synchronized m_timesync_info; + t_bool_synchronized m_timesync_status; t_timesync_time_point m_timesync_clock; t_bool_synchronized is_timesync_fetching; - void fetch_timesync_info(); + void fetch_timesync_status(); public: explicit timesync_checker_service(entt::registry& registry, QObject* parent = nullptr); From f21317a0ab84e4fc16b0d04bf1139815901cd66b Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 22 Aug 2024 22:23:50 +0800 Subject: [PATCH 16/23] revert nim sed workaround --- .github/workflows/atomicdex-desktop-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/atomicdex-desktop-ci.yml b/.github/workflows/atomicdex-desktop-ci.yml index 29d2968258..6446916b4a 100644 --- a/.github/workflows/atomicdex-desktop-ci.yml +++ b/.github/workflows/atomicdex-desktop-ci.yml @@ -160,7 +160,6 @@ jobs: echo "CHOOSENIM_CHOOSE_VERSION=1.6.2" >> $GITHUB_ENV export CHOOSENIM_CHOOSE_VERSION=1.6.2 curl https://nim-lang.org/choosenim/init.sh > choosenim.sh - sed -i.bak 's|https://github.com/nim-lang/choosenim/releases/download/|https://github.com/dom96/choosenim/releases/download/|g' choosenim.sh chmod +x choosenim.sh ./choosenim.sh -y export PATH=/home/runner/.nimble/bin:$PATH @@ -172,7 +171,6 @@ jobs: echo "CHOOSENIM_CHOOSE_VERSION=1.6.2" >> $GITHUB_ENV export CHOOSENIM_CHOOSE_VERSION=1.6.2 curl https://nim-lang.org/choosenim/init.sh > choosenim.sh - sed -i.bak 's|https://github.com/nim-lang/choosenim/releases/download/|https://github.com/dom96/choosenim/releases/download/|g' choosenim.sh chmod +x choosenim.sh ./choosenim.sh -y export PATH=/Users/runner/.nimble/bin:$PATH From 08ffc35865fb5657e6408450e8e78639a174411f Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 22 Aug 2024 22:46:12 +0800 Subject: [PATCH 17/23] use static script pinned to nim 0.8.4 --- .github/workflows/atomicdex-desktop-ci.yml | 8 +- ci_tools_atomic_dex/ci_scripts/choosenim.sh | 196 ++++++++++++++++++++ 2 files changed, 198 insertions(+), 6 deletions(-) create mode 100755 ci_tools_atomic_dex/ci_scripts/choosenim.sh diff --git a/.github/workflows/atomicdex-desktop-ci.yml b/.github/workflows/atomicdex-desktop-ci.yml index 6446916b4a..87af63785f 100644 --- a/.github/workflows/atomicdex-desktop-ci.yml +++ b/.github/workflows/atomicdex-desktop-ci.yml @@ -159,9 +159,7 @@ jobs: export SHELL=/bin/bash echo "CHOOSENIM_CHOOSE_VERSION=1.6.2" >> $GITHUB_ENV export CHOOSENIM_CHOOSE_VERSION=1.6.2 - curl https://nim-lang.org/choosenim/init.sh > choosenim.sh - chmod +x choosenim.sh - ./choosenim.sh -y + ./ci_tools_atomic_dex/ci_scripts/choosenim.sh -y export PATH=/home/runner/.nimble/bin:$PATH chmod +x /home/runner/.choosenim/toolchains/nim-1.6.2/bin/* @@ -170,9 +168,7 @@ jobs: run: | echo "CHOOSENIM_CHOOSE_VERSION=1.6.2" >> $GITHUB_ENV export CHOOSENIM_CHOOSE_VERSION=1.6.2 - curl https://nim-lang.org/choosenim/init.sh > choosenim.sh - chmod +x choosenim.sh - ./choosenim.sh -y + ./ci_tools_atomic_dex/ci_scripts/choosenim.sh -y export PATH=/Users/runner/.nimble/bin:$PATH chmod +x /Users/runner/.choosenim/toolchains/nim-1.6.2/bin/* diff --git a/ci_tools_atomic_dex/ci_scripts/choosenim.sh b/ci_tools_atomic_dex/ci_scripts/choosenim.sh new file mode 100755 index 0000000000..b255b48ab1 --- /dev/null +++ b/ci_tools_atomic_dex/ci_scripts/choosenim.sh @@ -0,0 +1,196 @@ +#!/bin/sh +# Copyright 2017 Dominik Picheta and Nim developers. +# +# Licensed under the BSD-3-Clause license. +# +# This script performs some platform detection, downloads the latest version +# of choosenim and initiates its installation. + +set -u +set -e + + +url_prefix="https://github.com/dom96/choosenim/releases/download/" + +temp_prefix="${TMPDIR:-/tmp}" + +CHOOSE_VERSION="${CHOOSENIM_CHOOSE_VERSION:-stable}" + +need_tty=yes +debug="" + +has_curl() { + command -v curl >/dev/null 2>&1 +} + +has_wget() { + command -v wget >/dev/null 2>&1 +} + +install() { + get_platform || return 1 + local platform=$RET_VAL + local stable_version=0.8.4 + local filename="choosenim-$stable_version"_"$platform" + local url="$url_prefix"v"$stable_version/$filename" + local ext="" + + case $platform in + *macosx_amd64* | *linux_amd64* ) + ;; + *windows_amd64* ) + # Download ZIP for Windows + local ext=".exe" + local filename="$filename$ext" + local url="$url$ext" + ;; + * ) + say_err "Sorry, your platform ($platform) is not supported by choosenim." + say_err "You will need to install Nim using an alternative method." + say_err "See the following link for more info: https://nim-lang.org/install.html" + exit 1 + ;; + esac + + say "Downloading $filename" + if has_curl; then + curl -sSfL "$url" -o "$temp_prefix/$filename" + elif has_wget; then + wget -qO "$temp_prefix/$filename" "$url" + fi + chmod +x "$temp_prefix/$filename" + + if [ "$need_tty" = "yes" ]; then + # The installer is going to want to ask for confirmation by + # reading stdin. This script was piped into `sh` though and + # doesn't have stdin to pass to its children. Instead we're going + # to explicitly connect /dev/tty to the installer's stdin. + if [ ! -t 1 ]; then + err "Unable to run interactively. Run with -y to accept defaults." + fi + + # Install Nim from desired channel. + "$temp_prefix/$filename" $CHOOSE_VERSION --firstInstall ${debug} < /dev/tty + else + "$temp_prefix/$filename" $CHOOSE_VERSION --firstInstall -y ${debug} + fi + + # Copy choosenim binary to Nimble bin. + local nimbleBinDir=`"$temp_prefix/$filename" --getNimbleBin` + cp "$temp_prefix/$filename" "$nimbleBinDir/choosenim$ext" + say "ChooseNim installed in $nimbleBinDir" + say "You must now ensure that the Nimble bin dir is in your PATH." + if [ "$platform" != "windows_amd64" ]; then + say "Place the following line in the ~/.profile or ~/.bashrc file." + say " export PATH=$nimbleBinDir:\$PATH" + case "${SHELL:=sh}" in + *fish*) + say "Running fish shell?" + say "set -ga fish_user_paths $nimbleBinDir" + ;; + esac + fi +} + +get_platform() { + # Get OS/CPU info and store in a `myos` and `mycpu` variable. + local ucpu=`uname -m` + local uos=`uname` + local ucpu=`echo $ucpu | tr "[:upper:]" "[:lower:]"` + local uos=`echo $uos | tr "[:upper:]" "[:lower:]"` + + case $uos in + *linux* ) + local myos="linux" + ;; + *dragonfly* ) + local myos="freebsd" + ;; + *freebsd* ) + local myos="freebsd" + ;; + *openbsd* ) + local myos="openbsd" + ;; + *netbsd* ) + local myos="netbsd" + ;; + *darwin* ) + local myos="macosx" + if [ "$HOSTTYPE" = "x86_64" ] ; then + local ucpu="amd64" + fi + if [ "$HOSTTYPE" = "arm64" ] ; then + # TODO: We don't have arm binaries for choosenim so far, rely on Rosetta. + local ucpu="amd64" + fi + ;; + *aix* ) + local myos="aix" + ;; + *solaris* | *sun* ) + local myos="solaris" + ;; + *haiku* ) + if has_curl; then + stable_version=`curl -sSfL https://nim-lang.org/choosenim/stable` + elif has_wget; then + stable_version=`wget -qO - https://nim-lang.org/choosenim/stable` + fi + err "unknown operating system: $uos" + ;; + esac + + case $ucpu in + *i386* | *i486* | *i586* | *i686* | *bepc* | *i86pc* ) + local mycpu="i386" ;; + *amd*64* | *x86-64* | *x86_64* ) + local mycpu="amd64" ;; + *sparc*|*sun* ) + local mycpu="sparc" + if [ "$(isainfo -b)" = "64" ]; then + local mycpu="sparc64" + fi + ;; + *ppc64* ) + local mycpu="powerpc64" ;; + *power*|*ppc* ) + local mycpu="powerpc" ;; + *mips* ) + local mycpu="mips" ;; + *arm*|*armv6l* ) + local mycpu="arm" ;; + *aarch64* ) + local mycpu="arm64" ;; + *) + err "unknown processor: $ucpu" + ;; + esac + + RET_VAL="$myos"_"$mycpu" +} + +say() { + echo "choosenim-init: $1" +} + +say_err() { + say "Error: $1" >&2 +} + +err() { + say_err "$1" + exit 1 +} + + +# check if we have to use /dev/tty to prompt the user +while getopts "dy" opt; do + case "$opt" in + y) need_tty=no + ;; + d) debug="--debug" + esac +done + +install From 45effc175db4c285ea21aa1591b90a1c8c9e525a Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 22 Aug 2024 23:42:54 +0800 Subject: [PATCH 18/23] update binaries url --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f3c1ca020..6fe4e988fd 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/main/kdf_35e9239-mac-x86-64.zip) + URL https://github.com/KomodoPlatform/komodo-defi-framework/releases/download/v2.1.0-beta/mm2-35e923949-Darwin-Release.zip) elseif (UNIX AND NOT APPLE) FetchContent_Declare(kdf - URL https://sdk.devbuilds.komodo.earth/main/kdf_35e9239-linux-x86-64.zip) + URL https://github.com/KomodoPlatform/komodo-defi-framework/releases/download/v2.1.0-beta/mm2-35e923949-Linux-Release.zip) else () FetchContent_Declare(kdf - URL https://sdk.devbuilds.komodo.earth/main/kdf_35e9239-win-x86-64.zip) + URL https://github.com/KomodoPlatform/komodo-defi-framework/releases/download/v2.1.0-beta/mm2-35e923949-Win64.zip) endif () #FetchContent_Declare(qmaterial URL https://github.com/KomodoPlatform/Qaterial/archive/last-clang-working-2.zip) From 8ea79d5316f422dfd06910dbd40f5e61bb20c3c1 Mon Sep 17 00:00:00 2001 From: smk762 Date: Fri, 23 Aug 2024 00:17:08 +0800 Subject: [PATCH 19/23] handle binary name change --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fe4e988fd..49fa003f6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,12 +89,12 @@ FetchContent_MakeAvailable(kdf jl777-coins qmaterial) if (UNIX) configure_file(${jl777-coins_SOURCE_DIR}/utils/coins_config_tcp.json ${CMAKE_CURRENT_SOURCE_DIR}/assets/config/${PROJECT_VERSION}-coins.json COPYONLY) configure_file(${jl777-coins_SOURCE_DIR}/coins ${CMAKE_CURRENT_SOURCE_DIR}/assets/tools/kdf/coins COPYONLY) - configure_file(${kdf_SOURCE_DIR}/kdf ${CMAKE_CURRENT_SOURCE_DIR}/assets/tools/kdf/${DEX_API} COPYONLY) + configure_file(${kdf_SOURCE_DIR}/mm2 ${CMAKE_CURRENT_SOURCE_DIR}/assets/tools/kdf/${DEX_API} COPYONLY) file(COPY ${jl777-coins_SOURCE_DIR}/icons/ DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/atomic_defi_design/assets/images/coins/) else () configure_file(${jl777-coins_SOURCE_DIR}/utils/coins_config_tcp.json ${CMAKE_BINARY_DIR}/bin/assets/config/${PROJECT_VERSION}-coins.json COPYONLY) configure_file(${jl777-coins_SOURCE_DIR}/coins ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/coins COPYONLY) - configure_file(${kdf_SOURCE_DIR}/kdf.exe ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/${DEX_API}.exe COPYONLY) + configure_file(${kdf_SOURCE_DIR}/mm2.exe ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/${DEX_API}.exe COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ci_tools_atomic_dex/windows_misc/msvcp140.dll ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/msvcp140.dll COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ci_tools_atomic_dex/windows_misc/vcruntime140.dll ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/vcruntime140.dll COPYONLY) endif () From 5583759d42375f2c73dee3a7bcb3c1d15f25861e Mon Sep 17 00:00:00 2001 From: smk762 Date: Fri, 23 Aug 2024 00:17:59 +0800 Subject: [PATCH 20/23] handle binary name change --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fe4e988fd..49fa003f6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,12 +89,12 @@ FetchContent_MakeAvailable(kdf jl777-coins qmaterial) if (UNIX) configure_file(${jl777-coins_SOURCE_DIR}/utils/coins_config_tcp.json ${CMAKE_CURRENT_SOURCE_DIR}/assets/config/${PROJECT_VERSION}-coins.json COPYONLY) configure_file(${jl777-coins_SOURCE_DIR}/coins ${CMAKE_CURRENT_SOURCE_DIR}/assets/tools/kdf/coins COPYONLY) - configure_file(${kdf_SOURCE_DIR}/kdf ${CMAKE_CURRENT_SOURCE_DIR}/assets/tools/kdf/${DEX_API} COPYONLY) + configure_file(${kdf_SOURCE_DIR}/mm2 ${CMAKE_CURRENT_SOURCE_DIR}/assets/tools/kdf/${DEX_API} COPYONLY) file(COPY ${jl777-coins_SOURCE_DIR}/icons/ DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/atomic_defi_design/assets/images/coins/) else () configure_file(${jl777-coins_SOURCE_DIR}/utils/coins_config_tcp.json ${CMAKE_BINARY_DIR}/bin/assets/config/${PROJECT_VERSION}-coins.json COPYONLY) configure_file(${jl777-coins_SOURCE_DIR}/coins ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/coins COPYONLY) - configure_file(${kdf_SOURCE_DIR}/kdf.exe ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/${DEX_API}.exe COPYONLY) + configure_file(${kdf_SOURCE_DIR}/mm2.exe ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/${DEX_API}.exe COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ci_tools_atomic_dex/windows_misc/msvcp140.dll ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/msvcp140.dll COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ci_tools_atomic_dex/windows_misc/vcruntime140.dll ${CMAKE_BINARY_DIR}/bin/assets/tools/kdf/vcruntime140.dll COPYONLY) endif () From f9e8dada71e78ce0431b40f43d27d781a0dc13ce Mon Sep 17 00:00:00 2001 From: smk762 Date: Fri, 23 Aug 2024 12:23:35 +0800 Subject: [PATCH 21/23] rm dots, 6dp for middle and right cols --- atomic_defi_design/Dex/Constants/General.qml | 2 +- .../Exchange/Trade/OrderBook/ListDelegate.qml | 28 +++++++++---------- .../Dex/Exchange/Trade/OrderBook/Vertical.qml | 4 +-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/atomic_defi_design/Dex/Constants/General.qml b/atomic_defi_design/Dex/Constants/General.qml index d54a8dbd7d..34c89b8fcf 100644 --- a/atomic_defi_design/Dex/Constants/General.qml +++ b/atomic_defi_design/Dex/Constants/General.qml @@ -446,7 +446,7 @@ QtObject { let val = new BigNumber(text).toFixed(decimals) if (val.length > max_length) { - return val.substring(0, max_length) + "..." + return val.substring(0, max_length) } return val } diff --git a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml index b812cb792f..43b16d0c7b 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml @@ -21,11 +21,11 @@ Item DefaultTooltip { visible: mouse_area.containsMouse && (tooltip_text.text_value != "") - width: 300 + width: 340 contentItem: RowLayout { - width: 290 + width: 330 Qaterial.ColorIcon { @@ -175,12 +175,12 @@ Item // Dot on the left side of the row to indicate own order Rectangle { - Layout.leftMargin: 6 + Layout.leftMargin: 4 Layout.alignment: Qt.AlignVCenter opacity: is_mine ? 1 : 0 - width: 6 - height: 6 - radius: 3 + width: 4 + height: 4 + radius: 2 color: isAsk ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor } @@ -188,9 +188,9 @@ Item Dex.ElidableText { Layout.fillHeight: true - Layout.minimumWidth: 90 + Layout.minimumWidth: 100 Layout.alignment: Qt.AlignVCenter - text: General.reducedBignum(price) + text: General.reducedBignum(price, 8) font.family: DexTypo.fontFamily font.pixelSize: 12 color: isAsk ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor @@ -203,9 +203,9 @@ Item Dex.ElidableText { Layout.fillHeight: true - Layout.minimumWidth: 90 + Layout.minimumWidth: 100 Layout.alignment: Qt.AlignVCenter - text: General.reducedBignum(base_max_volume) + text: General.reducedBignum(base_max_volume, 6) font.family: DexTypo.fontFamily font.pixelSize: 12 horizontalAlignment: Text.AlignRight @@ -219,12 +219,12 @@ Item { id: total_text Layout.fillHeight: true - Layout.minimumWidth: 90 + Layout.minimumWidth: 100 Layout.fillWidth: true Layout.alignment: Qt.AlignVCenter font.family: DexTypo.fontFamily font.pixelSize: 12 - text: General.reducedBignum(total) + text: General.reducedBignum(total, 6) horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter wrapMode: Text.NoWrap @@ -236,7 +236,7 @@ Item { id: cancel_flat_btn Layout.fillHeight: true - width: 30 + width: 20 Layout.alignment: Qt.AlignVCenter MouseArea @@ -261,7 +261,7 @@ Item Qaterial.ColorIcon { anchors.centerIn: parent - iconSize: 16 + iconSize: 14 color: Dex.CurrentTheme.warningColor source: Qaterial.Icons.close visible: is_mine diff --git a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/Vertical.qml b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/Vertical.qml index a32347e739..0c8918e6fc 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/Vertical.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/Vertical.qml @@ -16,8 +16,8 @@ Widget readonly property string pair_volume_24hr: API.app.trading_pg.pair_volume_24hr readonly property string pair: atomic_qt_utilities.retrieve_main_ticker(left_ticker) + "/" + atomic_qt_utilities.retrieve_main_ticker(right_ticker) - margins: 10 - spacing: 10 + margins: 8 + spacing: 8 collapsable: false Header From 76f603696a87f4874abd30d5a6fc858b97ea549c Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 27 Aug 2024 17:21:28 +0800 Subject: [PATCH 22/23] fix missing icons and overflow --- atomic_defi_design/Dex/Constants/General.qml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/atomic_defi_design/Dex/Constants/General.qml b/atomic_defi_design/Dex/Constants/General.qml index 251c19456d..970f167445 100644 --- a/atomic_defi_design/Dex/Constants/General.qml +++ b/atomic_defi_design/Dex/Constants/General.qml @@ -25,6 +25,14 @@ QtObject { function coinIcon(ticker) { + if (ticker.toLowerCase() == "smart chain") + { + return coin_icons_path + "smart_chain.png" + } + if (ticker.toLowerCase() == "avx") + { + return coin_icons_path + "avax.png" + } if (ticker === "" || ticker === "All" || ticker===undefined) { return "" @@ -449,7 +457,7 @@ QtObject { } if (sell_ticker_balance == 0) { - return qsTr("%1 balance is zero").arg(selectedTicker) + return qsTr("Balance is zero!") } if (!isZhtlcReady(selectedTicker)) { From 6dc721218da1028e413c3250e226aa1a7e3e77af Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 27 Aug 2024 18:14:46 +0800 Subject: [PATCH 23/23] check sync every 5 mins, default to ok. --- .../sync/timesync.checker.service.cpp | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/core/atomicdex/services/sync/timesync.checker.service.cpp b/src/core/atomicdex/services/sync/timesync.checker.service.cpp index 2909368a4e..8d539c84e8 100644 --- a/src/core/atomicdex/services/sync/timesync.checker.service.cpp +++ b/src/core/atomicdex/services/sync/timesync.checker.service.cpp @@ -44,11 +44,11 @@ namespace { using namespace std::string_literals; nlohmann::json resp; - bool sync_ok = false; + bool sync_ok = true; std::string resp_str = TO_STD_STR(resp_http.extract_string(true).get()); if (resp_http.status_code() != 200) { - SPDLOG_ERROR("Cannot reach the endpoint [{}]: {}", g_timesync_endpoint); + SPDLOG_ERROR("Cannot reach the endpoint [{}]: {}", g_timesync_endpoint, resp_str); } else { @@ -56,9 +56,10 @@ namespace int64_t epoch_ts = resp["unixtime"]; int64_t current_ts = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); int64_t ts_diff = epoch_ts - current_ts; - if (abs(ts_diff) < 60) + if (abs(ts_diff) > 60) { - sync_ok = true; + SPDLOG_WARN("Time sync failed! Actual: {}, System: {}, Diff: {}", epoch_ts, current_ts, ts_diff); + sync_ok = false; } } return sync_ok; @@ -82,7 +83,7 @@ namespace atomic_dex int64_t m_timesync_clock_ts = std::chrono::duration_cast(m_timesync_clock.time_since_epoch()).count(); int64_t now_ts = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); int64_t ts_diff = now_ts - m_timesync_clock_ts; - if (abs(ts_diff) >= 60) + if (abs(ts_diff) > 300) { fetch_timesync_status(); m_timesync_clock = std::chrono::high_resolution_clock::now(); @@ -91,21 +92,28 @@ namespace atomic_dex void timesync_checker_service::fetch_timesync_status() { + SPDLOG_INFO("Checking system time is in sync..."); if (is_timesync_fetching) { + SPDLOG_WARN("Already checking timesync, returning"); return; } is_timesync_fetching = true; emit isTimesyncFetchingChanged(); async_fetch_timesync() .then([this](web::http::http_response resp) { - this->m_timesync_status = get_timesync_info_rpc(resp); - emit timesyncInfoChanged(); + bool is_timesync_ok = get_timesync_info_rpc(resp); + SPDLOG_INFO("System time is in sync: {}", is_timesync_ok); + + if (is_timesync_ok != *m_timesync_status) + { + this->m_timesync_status = is_timesync_ok; + emit timesyncInfoChanged(); + } }) .then(&handle_exception_pplx_task); is_timesync_fetching = false; emit isTimesyncFetchingChanged(); - } bool timesync_checker_service::get_timesync_info() const @@ -115,4 +123,5 @@ namespace atomic_dex } // namespace atomic_dex +