diff --git a/.github/workflows/atomicdex-desktop-ci.yml b/.github/workflows/atomicdex-desktop-ci.yml
index 8cdaa94d9..5891f093e 100644
--- a/.github/workflows/atomicdex-desktop-ci.yml
+++ b/.github/workflows/atomicdex-desktop-ci.yml
@@ -8,6 +8,7 @@ on:
- master
schedule:
- cron: '0 0 * * 1'
+ workflow_dispatch:
env:
DEX_API: "mm2_kmd"
diff --git a/.github/workflows/sync_mirror.yml b/.github/workflows/sync_mirror.yml
deleted file mode 100644
index 57010e03d..000000000
--- a/.github/workflows/sync_mirror.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-name: GitlabSync
-
-on:
- push:
- branches:
- - 'none'
- pull_request:
- branches:
- - none
- delete:
- branches:
- - '*'
-
-jobs:
- sync:
- runs-on: ubuntu-latest
- name: Git Repo Sync
- steps:
- - uses: actions/checkout@v2
- with:
- fetch-depth: 0
- - uses: wangchucheng/git-repo-sync@v0.1.0
- with:
- target-url: ${{ secrets.GITLAB_URL }}
- target-username: ${{ secrets.GITLAB_USERNAME }}
- target-token: ${{ secrets.GITLAB_TOKEN }}
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
deleted file mode 100644
index 1c2554105..000000000
--- a/.gitlab-ci.yml
+++ /dev/null
@@ -1,112 +0,0 @@
-image: smk762/qt-ci:latest
-
-stages:
- - build
- - upload_linux_zip
- - upload_linux_tar
- - upload_linux_appimage
- - test
-
-variables:
- GIT_SUBMODULE_STRATEGY: recursive
- DOCKER_DRIVER: overlay2
- PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
- VCPKG_DEFAULT_BINARY_CACHE: "$CI_PROJECT_DIR/.cache/vcpkg"
- QT_VERSION: "5.15.2"
- CMAKE_VERSION: "3.20.5"
-
-cache:
- - key: $CI_COMMIT_REF_SLUG
- paths:
- - komodo-wallet-linux-${CI_COMMIT_SHA::9}.zip
- - komodo-wallet-linux-${CI_COMMIT_SHA::9}.tar.zst
- - komodo-wallet-${CI_COMMIT_SHA::9}-x86_64.AppImage
- - key: $CI_PROJECT_NAME
- paths:
- - "$CI_PROJECT_DIR/.cache/vcpkg"
-
-
-linux:build:
- stage: build
- before_script:
- - cd $CI_PROJECT_DIR
- - mkdir -p .cache/pip
- - mkdir -p .cache/vcpkg
-
- script:
- # Job Variables
- - echo $CI_COMMIT_REF_SLUG
- - echo $CI_COMMIT_AUTHOR
- - echo $CI_COMMIT_BRANCH
- - echo $CI_COMMIT_SHA
- - echo $CI_COMMIT_SHORT_SHA
- - echo $CI_PROJECT_PATH
- - echo $CI_PROJECT_NAME
- - echo $QT_VERSION
- - echo $CMAKE_VERSION
-
- # Job Path/Env variables
- - export DEBIAN_FRONTEND=noninteractive
- - export QT_INSTALL_CMAKE_PATH=/opt/Qt/$QT_VERSION/gcc_64/lib/cmake
- - export QT_ROOT=/opt/Qt/$QT_VERSION
- - export Qt5_DIR=/opt/Qt/$QT_VERSION/gcc_64/lib/cmake/Qt5
- - export PATH=/opt/Qt/$QT_VERSION/gcc_64/bin:$PATH
- - export PATH=${PATH}:/cmake-$CMAKE_VERSION-linux-x86_64/bin;
- - export APPIMAGE_EXTRACT_AND_RUN=1
-
- # Update tar
- - export FORCE_UNSAFE_CONFIGURE=1
- - wget https://ftp.wayne.edu/gnu/tar/tar-1.34.tar.gz && tar -xvf tar-1.34.tar.gz
- - cd tar-1.34 && ./configure && make && make install
- - cp src/tar $(which tar)
-
- # Bootstrap Vcpkg
- - cd $CI_PROJECT_DIR; ./ci_tools_atomic_dex/vcpkg-repo/bootstrap-vcpkg.sh
-
- # NINJA
- - cd $CI_PROJECT_DIR
- - rm -rf build_ninja || echo "no build_ninja folder to rm"
- - mkdir build_ninja && cd $_
- - cmake -DCMAKE_BUILD_TYPE=Release -GNinja ../
- - ninja install
- - ninja komodo-wallet
- - cd $CI_PROJECT_DIR
- - cp $CI_PROJECT_DIR/bundled/linux/komodo-wallet-linux-${CI_COMMIT_SHA::9}.zip .
- - cp $CI_PROJECT_DIR/bundled/linux/komodo-wallet-linux-${CI_COMMIT_SHA::9}.tar.zst .
- - cp $CI_PROJECT_DIR/bundled/linux/komodo-wallet-${CI_COMMIT_SHA::9}-x86_64.AppImage .
-
-AtomicDex-linux-zip:
- stage: upload_linux_zip
- allow_failure: true
- script:
- - echo "Uploading AppImage..."
- artifacts:
- name: "AtomicDex-linux-${CI_COMMIT_SHA::9}.zip"
- paths:
- - $CI_PROJECT_DIR/komodo-wallet-linux-${CI_COMMIT_SHA::9}.zip
- when: always
- expire_in: 3 days
-
-AtomicDex-linux-AppImage:
- stage: upload_linux_appimage
- allow_failure: true
- script:
- - echo "Uploading AppImage..."
- artifacts:
- name: "AtomicDex-linux-${CI_COMMIT_SHA::9}-AppImage"
- paths:
- - $CI_PROJECT_DIR/komodo-wallet-${CI_COMMIT_SHA::9}-x86_64.AppImage
- when: always
- expire_in: 3 days
-
-AtomicDex-linux-tar:
- stage: upload_linux_tar
- allow_failure: true
- script:
- - echo "Uploading tar..."
- artifacts:
- name: "AtomicDex-linux-${CI_COMMIT_SHA::9}.tar.zst"
- paths:
- - $CI_PROJECT_DIR/komodo-wallet-linux-${CI_COMMIT_SHA::9}.tar.zst
- when: always
- expire_in: 3 days
diff --git a/atomic_defi_design/Dex/Components/DexGradientAppButton.qml b/atomic_defi_design/Dex/Components/DexGradientAppButton.qml
index 5624512c1..b4485f7c9 100644
--- a/atomic_defi_design/Dex/Components/DexGradientAppButton.qml
+++ b/atomic_defi_design/Dex/Components/DexGradientAppButton.qml
@@ -22,7 +22,6 @@ DexRectangle
property bool text_left_align: false
- property int minWidth: 90
property real textScale: 1
diff --git a/atomic_defi_design/Dex/Components/PairItemBadge.qml b/atomic_defi_design/Dex/Components/PairItemBadge.qml
index 4fec7de38..ceeaa3c0b 100644
--- a/atomic_defi_design/Dex/Components/PairItemBadge.qml
+++ b/atomic_defi_design/Dex/Components/PairItemBadge.qml
@@ -24,11 +24,21 @@ DexRectangle
property int padding: 0
property alias middle_text: middle_line.text_value
property alias bottom_text: bottom_line.text_value
+ property bool is_left: false
Layout.fillHeight: true
Layout.fillWidth: true
Layout.leftMargin: 10
Layout.rightMargin: 20
+ Dex.Text{
+ anchors.bottom: parent.top
+ anchors.bottomMargin: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: is_left ? "Outgoing" : "Incoming"
+ font: Dex.DexTypo.italic12
+ color: Dex.CurrentTheme.foregroundColor2
+ }
+
RowLayout
{
anchors.fill: parent
diff --git a/atomic_defi_design/Dex/Constants/DexTypo.qml b/atomic_defi_design/Dex/Constants/DexTypo.qml
index 8df64967c..1207047e8 100644
--- a/atomic_defi_design/Dex/Constants/DexTypo.qml
+++ b/atomic_defi_design/Dex/Constants/DexTypo.qml
@@ -154,6 +154,13 @@ QtObject {
family: "Courier",
weight: Font.Normal
})
+ property font italic12: Qt.font({
+ pixelSize: 12 * fontDensity,
+ letterSpacing: 0.2,
+ family: fontFamily,
+ weight: Font.Normal,
+ italic: true
+ })
property font inputFieldFont: Qt.font({
pixelSize: (16 * DexTypo.fontDensity) * (Screen.pixelDensity / 160),
letterSpacing: 0.5,
diff --git a/atomic_defi_design/Dex/Constants/General.qml b/atomic_defi_design/Dex/Constants/General.qml
index d57eeb99d..6defe9de9 100644
--- a/atomic_defi_design/Dex/Constants/General.qml
+++ b/atomic_defi_design/Dex/Constants/General.qml
@@ -88,6 +88,11 @@ QtObject {
return API.app.portfolio_pg.global_cfg_mdl.get_coin_info(ticker).is_faucet_coin
}
+ function isVoteCoin(ticker)
+ {
+ return API.app.portfolio_pg.global_cfg_mdl.get_coin_info(ticker).is_vote_coin
+ }
+
function isCoinWithMemo(ticker)
{
return API.app.portfolio_pg.global_cfg_mdl.get_coin_info(ticker).has_memos
diff --git a/atomic_defi_design/Dex/Exchange/ProView/Chart.qml b/atomic_defi_design/Dex/Exchange/ProView/Chart.qml
index 30fc49a4c..69480206f 100644
--- a/atomic_defi_design/Dex/Exchange/ProView/Chart.qml
+++ b/atomic_defi_design/Dex/Exchange/ProView/Chart.qml
@@ -70,6 +70,7 @@ Item
transform: scale(${Math.min(scale_x, scale_y)});
transform-origin: top left;
}
+ a { pointer-events: none; }
@@ -226,6 +227,16 @@ Item
}
}
+ MouseArea {
+ id: chart_mousearea
+ anchors.fill: webEngineViewPlaceHolder
+ onClicked: {
+ if (webEngineView.visible) {
+ Qt.openUrlExternally("https://www.livecoinwatch.com")
+ }
+ }
+ }
+
Connections
{
target: app
diff --git a/atomic_defi_design/Dex/Exchange/ProView/DexComboBoxLine.qml b/atomic_defi_design/Dex/Exchange/ProView/DexComboBoxLine.qml
index 7c3404f43..0d8269efb 100644
--- a/atomic_defi_design/Dex/Exchange/ProView/DexComboBoxLine.qml
+++ b/atomic_defi_design/Dex/Exchange/ProView/DexComboBoxLine.qml
@@ -78,7 +78,7 @@ RowLayout
Layout.preferredWidth: parent.width - 15
text_value: !details ? "" :
- `${details.ticker} ${details.name}`
+ `${details.ticker}
${details.name}`
font.pixelSize: Style.textSizeSmall3
elide: Text.ElideRight
wrapMode: Text.NoWrap
@@ -96,7 +96,7 @@ RowLayout
font: DexTypo.body2
wrapMode: Label.NoWrap
ToolTip.text: coin_value
- Component.onCompleted: font.pixelSize = 11.5
+ Component.onCompleted: font.pixelSize = 11
}
Dex.Text
@@ -112,7 +112,7 @@ RowLayout
font: DexTypo.body2
wrapMode: Label.NoWrap
ToolTip.text: fiat_value
- Component.onCompleted: font.pixelSize = 11.5
+ Component.onCompleted: font.pixelSize = 11
}
}
}
diff --git a/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/Main.qml b/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/Main.qml
index ca94aec96..f89056a9e 100644
--- a/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/Main.qml
+++ b/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/Main.qml
@@ -11,20 +11,29 @@ import Dex.Components 1.0 as Dex
import AtomicDEX.MarketMode 1.0
import AtomicDEX.TradingError 1.0
-Widget
+ColumnLayout
{
- title: qsTr("Place Order")
+ Layout.preferredWidth: 305
+ Layout.fillHeight: true
+ property alias currentIndex: orderformTabView.currentIndex
property int loop_count: 0
property bool show_waiting_for_trade_preimage: false;
property var fees: API.app.trading_pg.fees
property var preimage_rpc_busy: API.app.trading_pg.preimage_rpc_busy
- property string protocolIcon: General.platformIcon(General.coinPlatform(left_ticker))
property var trade_preimage_error: fees.hasOwnProperty('error') ? fees["error"].split("] ").slice(-1) : ""
readonly property bool trade_preimage_ready: fees.hasOwnProperty('base_transaction_fees_ticker')
- readonly property bool can_submit_trade: last_trading_error === TradingError.None
+ property int takerOrderform_idx: 0
+ property int makerOrderform_idx: 1
- margins: 10
- collapsable: false
+ function reset_fees_state()
+ {
+ show_waiting_for_trade_preimage = false;
+ check_trade_preimage.stop()
+ loop_count = 0
+ API.app.trading_pg.reset_fees()
+ takerForm.dexErrors.text_value = ""
+ makerForm.dexErrors.text_value = ""
+ }
Connections {
target: API.app.trading_pg
@@ -59,257 +68,135 @@ Widget
}
}
- function reset_fees_state()
+ Timer
{
- show_waiting_for_trade_preimage = false;
- check_trade_preimage.stop()
- loop_count = 0
- API.app.trading_pg.reset_fees()
- errors.text_value = ""
+ id: check_trade_preimage
+ interval: 500;
+ running: false;
+ repeat: true;
+ triggeredOnStart: true;
+ onTriggered: {
+ loop_count++;
+ console.log("Getting fees info... " + loop_count + "/50")
+ if (trade_preimage_ready)
+ {
+ show_waiting_for_trade_preimage = false
+ loop_count = 0
+ stop()
+ confirm_trade_modal.open()
+ }
+ else if (trade_preimage_error != "")
+ {
+ loop_count = 0
+ takerForm.dexErrors.text_value = trade_preimage_error.toString()
+ makerForm.dexErrors.text_value = trade_preimage_error.toString()
+ show_waiting_for_trade_preimage = false
+ stop()
+ }
+ else if (loop_count > 50)
+ {
+ loop_count = 0
+ show_waiting_for_trade_preimage = false
+ trade_preimage_error = "Trade preimage timed out, try again."
+ stop()
+ }
+ }
}
- // Market mode selector
- RowLayout
+ Qaterial.LatoTabBar
{
- Layout.topMargin: 5
- Layout.bottomMargin: 2
- Layout.alignment: Qt.AlignHCenter
- Layout.preferredWidth: parent.width
- height: 32
+ id: orderformTabView
- MarketModeSelector
+ background: null
+ Layout.leftMargin: 6
+
+ Qaterial.LatoTabButton
{
- Layout.alignment: Qt.AlignLeft
- Layout.preferredWidth: (parent.width / 100) * 46
- Layout.preferredHeight: 32
- marketMode: MarketMode.Buy
- ticker: atomic_qt_utilities.retrieve_main_ticker(left_ticker)
+ text: qsTr("Taker Order")
+ font.pixelSize: 14
+ textColor: checked ? Dex.CurrentTheme.foregroundColor : Dex.CurrentTheme.foregroundColor2
+ textSecondaryColor: Dex.CurrentTheme.foregroundColor2
+ indicatorColor: Dex.CurrentTheme.foregroundColor
}
-
- Item { Layout.fillWidth: true }
-
- MarketModeSelector
+ Qaterial.LatoTabButton
{
- Layout.alignment: Qt.AlignRight
- Layout.preferredWidth: (parent.width / 100) * 46
- Layout.preferredHeight: 32
- ticker: atomic_qt_utilities.retrieve_main_ticker(left_ticker)
+ text: qsTr("Maker Order")
+ font.pixelSize: 14
+ textColor: checked ? Dex.CurrentTheme.foregroundColor : Dex.CurrentTheme.foregroundColor2
+ textSecondaryColor: Dex.CurrentTheme.foregroundColor2
+ indicatorColor: Dex.CurrentTheme.foregroundColor
}
}
- // Protocol text for platform tokens
- Item
+ Rectangle
{
- height: 32
- Layout.alignment: Qt.AlignHCenter
- Layout.preferredWidth: parent.width
- visible: protocolIcon != ""
+ Layout.fillHeight: true
+ color: Dex.CurrentTheme.floatingBackgroundColor
+ radius: 10
+ Layout.preferredWidth: 305
- ColumnLayout
+ Qaterial.SwipeView
{
- spacing: 2
+ id: orderformSwipeView
+ clip: true
+ interactive: false
+ currentIndex: orderformTabView.currentIndex
anchors.fill: parent
- anchors.centerIn: parent
- Dex.Text
+ onCurrentIndexChanged:
{
- id: protocolTitle
- Layout.preferredWidth: parent.width
- text_value: "Protocol:"
- font.pixelSize: Style.textSizeSmall1
- horizontalAlignment: Text.AlignHCenter
- color: Style.colorText2
+ API.app.trading_pg.maker_mode = currentIndex === makerOrderform_idx ? true : false
+ orderformSwipeView.currentItem.update()
+ API.app.trading_pg.reset_order()
+ reset_fees_state()
}
- RowLayout
+ Item
{
- id: protocol
- Layout.alignment: Qt.AlignHCenter
-
- DefaultImage
- {
- id: protocolImg
- source: protocolIcon
- Layout.preferredHeight: 16
- Layout.preferredWidth: Layout.preferredHeight
- }
+ id: takerOrderform
- DexLabel
+ OrderForm
{
- id: protocolText
- text_value: General.getProtocolText(left_ticker)
- wrapMode: DexLabel.NoWrap
- font.pixelSize: Style.textSizeSmall1
- color: Style.colorText2
+ id: takerForm
+ width: parent.width
+ height: 330
+ Layout.alignment: Qt.AlignHCenter
+ swap_btn.enabled: last_trading_error === TradingError.None && !show_waiting_for_trade_preimage && takerForm.dexErrors.text_value == ""
+ swap_btn.onClicked:
+ {
+ console.log("Getting fees info...")
+ API.app.trading_pg.determine_fees()
+ show_waiting_for_trade_preimage = true
+ check_trade_preimage.start()
+ }
+ swap_btn_spinner.visible: show_waiting_for_trade_preimage
}
}
- }
- }
-
- // Order selected indicator
- Item
- {
- Layout.alignment: Qt.AlignHCenter
- Layout.preferredWidth: parent.width
- height: 32
-
- RowLayout
- {
- id: orderSelection
- visible: API.app.trading_pg.preferred_order.price !== undefined
- anchors.fill: parent
- anchors.verticalCenter: parent.verticalCenter
- DefaultText
+ Item
{
- Layout.leftMargin: 15
- color: Dex.CurrentTheme.warningColor
- text: qsTr("Order Selected")
- }
-
- Item { Layout.fillWidth: true }
+ id: makerOrderform
- Qaterial.FlatButton
- {
- Layout.preferredHeight: parent.height
- Layout.preferredWidth: 30
- Layout.rightMargin: 5
- foregroundColor: Dex.CurrentTheme.warningColor
- onClicked: {
- API.app.trading_pg.reset_order()
- reset_fees_state()
- }
-
- Qaterial.ColorIcon
+ OrderForm
{
- anchors.centerIn: parent
- iconSize: 16
- color: Dex.CurrentTheme.warningColor
- source: Qaterial.Icons.close
+ id: makerForm
+ width: parent.width
+ height: 330
+ Layout.alignment: Qt.AlignHCenter
+ swap_btn.enabled: last_trading_error === TradingError.None && !show_waiting_for_trade_preimage && makerForm.dexErrors.text_value == ""
+ swap_btn.onClicked:
+ {
+ console.log("Getting fees info...")
+ console.log("API.app.trading_pg.market_mode")
+ console.log(API.app.trading_pg.market_mode)
+ // TODO: Apply reduced fees on maker orders
+ API.app.trading_pg.determine_fees()
+ show_waiting_for_trade_preimage = true;
+ check_trade_preimage.start()
+ }
+ swap_btn_spinner.visible: show_waiting_for_trade_preimage
}
}
}
-
- Rectangle
- {
- visible: API.app.trading_pg.preferred_order.price !== undefined
- anchors.fill: parent
- radius: 8
- color: 'transparent'
- border.color: Dex.CurrentTheme.warningColor
- }
- }
-
- OrderForm
- {
- id: formBase
- width: parent.width
- height: 330
- Layout.alignment: Qt.AlignHCenter
- }
-
- Item { Layout.fillHeight: true }
-
- // Error messages
- Item
- {
- height: 55
- Layout.preferredWidth: parent.width
-
- // Show errors
- Dex.Text
- {
- id: errors
- visible: errors.text_value !== ""
- anchors.fill: parent
- anchors.centerIn: parent
- horizontalAlignment: Text.AlignHCenter
- font.pixelSize: Style.textSizeSmall4
- color: Dex.CurrentTheme.warningColor
- text_value: General.getTradingError(
- last_trading_error,
- curr_fee_info,
- base_ticker,
- rel_ticker, left_ticker, right_ticker)
- elide: Text.ElideRight
- }
- }
-
- TotalView
- {
- height: 70
- Layout.preferredWidth: parent.width
- Layout.alignment: Qt.AlignHCenter
- }
-
- DexGradientAppButton
- {
- id: swap_btn
- height: 32
- Layout.preferredWidth: parent.width - 30
- Layout.alignment: Qt.AlignHCenter
-
- radius: 16
- text: qsTr("START SWAP")
- font.weight: Font.Medium
- enabled: can_submit_trade && !show_waiting_for_trade_preimage && errors.text_value == ""
- onClicked:
- {
- console.log("Getting fees info...")
- API.app.trading_pg.determine_fees()
- show_waiting_for_trade_preimage = true;
- check_trade_preimage.start()
- }
-
- Item
- {
- visible: show_waiting_for_trade_preimage
- height: parent.height - 10
- width: parent.width - 10
- anchors.fill: parent
- anchors.centerIn: parent
-
- DefaultBusyIndicator
- {
- id: preimage_BusyIndicator
- anchors.fill: parent
- anchors.centerIn: parent
- indicatorSize: 32
- indicatorDotSize: 5
- }
- }
- }
-
- Timer {
- id: check_trade_preimage
- interval: 500;
- running: false;
- repeat: true;
- triggeredOnStart: true;
- onTriggered: {
- loop_count++;
- console.log("Getting fees info... " + loop_count + "/50")
- if (trade_preimage_ready)
- {
- show_waiting_for_trade_preimage = false
- loop_count = 0
- stop()
- confirm_trade_modal.open()
- }
- else if (trade_preimage_error != "")
- {
- loop_count = 0
- errors.text_value = trade_preimage_error.toString()
- show_waiting_for_trade_preimage = false
- stop()
- }
- else if (loop_count > 50)
- {
- loop_count = 0
- show_waiting_for_trade_preimage = false
- trade_preimage_error = "Trade preimage timed out, try again."
- stop()
- }
- }
}
-}
+}
\ No newline at end of file
diff --git a/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/MarketModeSelector.qml b/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/MarketModeSelector.qml
index b4ffbdbf1..799e0b8a1 100644
--- a/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/MarketModeSelector.qml
+++ b/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/MarketModeSelector.qml
@@ -1,4 +1,5 @@
import QtQuick 2.12
+import QtQuick.Layouts 1.15
import App 1.0
import Dex.Themes 1.0 as Dex
@@ -9,9 +10,10 @@ Rectangle
{
property int marketMode: Dex.MarketMode.Sell
property string ticker: ""
+ property string protocolIcon: General.platformIcon(General.coinPlatform(left_ticker))
radius: 18
- opacity: marketMode != API.app.trading_pg.market_mode ? 0.1 : 1
+ opacity: marketMode != API.app.trading_pg.market_mode ? 0.25: 1
gradient: Gradient
{
@@ -32,15 +34,28 @@ Rectangle
position: 1
}
}
-
- DefaultText
+ RowLayout
{
anchors.centerIn: parent
- color: API.app.trading_pg.market_mode == marketMode ? Dex.CurrentTheme.gradientButtonTextEnabledColor : Dex.CurrentTheme.foregroundColor
- text:
+ spacing: 8
+
+ DefaultText
+ {
+ color: API.app.trading_pg.market_mode == marketMode ? Dex.CurrentTheme.gradientButtonTextEnabledColor : Dex.CurrentTheme.foregroundColor
+ text:
+ {
+ if (marketMode == Dex.MarketMode.Sell) qsTr("Sell %1", "TICKER").arg(ticker)
+ else qsTr("Buy %1", "TICKER").arg(ticker)
+ }
+ }
+
+ DefaultImage
{
- if (marketMode == Dex.MarketMode.Sell) qsTr("Sell %1", "TICKER").arg(ticker)
- else qsTr("Buy %1", "TICKER").arg(ticker)
+ id: protocolImg
+ visible: protocolIcon != ""
+ source: protocolIcon
+ Layout.preferredHeight: protocolIcon != "" ? 16 : 0
+ Layout.preferredWidth: Layout.preferredHeight
}
}
diff --git a/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/OrderForm.qml b/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/OrderForm.qml
index 3e508ca18..1cc7440e6 100644
--- a/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/OrderForm.qml
+++ b/atomic_defi_design/Dex/Exchange/ProView/PlaceOrderForm/OrderForm.qml
@@ -2,14 +2,21 @@ import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import QtGraphicalEffects 1.0
-
+import Qaterial 1.0 as Qaterial
import "../../../Components"
+import "../../../Constants"
import App 1.0
import Dex.Themes 1.0 as Dex
+import Dex.Components 1.0 as Dex
+import AtomicDEX.TradingError 1.0
+import AtomicDEX.MarketMode 1.0 as Dex
ColumnLayout
{
id: root
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.fill: parent
+ anchors.margins: 20
spacing: 8
function focusVolumeField()
@@ -20,6 +27,9 @@ ColumnLayout
readonly property string total_amount: API.app.trading_pg.total_amount
readonly property int input_height: 65
readonly property int subfield_margin: 5
+ property alias swap_btn: swap_btn
+ property alias swap_btn_spinner: swap_btn_spinner
+ property alias dexErrors: dexErrors
// Will move to backend: Minimum Fee
@@ -52,6 +62,37 @@ ColumnLayout
function onBackend_volumeChanged() { input_volume.text = exchange_trade.backend_volume; }
}
+ // Market mode selector
+ RowLayout
+ {
+ Layout.topMargin: 2
+ Layout.bottomMargin: 2
+ Layout.alignment: Qt.AlignHCenter
+ Layout.preferredWidth: parent.width
+ height: 28
+ visible: !API.app.trading_pg.maker_mode
+
+ MarketModeSelector
+ {
+ Layout.alignment: Qt.AlignLeft
+ Layout.preferredWidth: 125
+ Layout.preferredHeight: 28
+ marketMode: Dex.MarketMode.Buy
+ ticker: atomic_qt_utilities.retrieve_main_ticker(left_ticker)
+ }
+
+ Item { Layout.fillWidth: true }
+
+ MarketModeSelector
+ {
+ marketMode: Dex.MarketMode.Sell
+ Layout.alignment: Qt.AlignRight
+ Layout.preferredWidth: 125
+ Layout.preferredHeight: 28
+ ticker: atomic_qt_utilities.retrieve_main_ticker(left_ticker)
+ }
+ }
+
Item
{
Layout.preferredWidth: parent.width
@@ -263,4 +304,121 @@ ColumnLayout
font.pixelSize: 13
}
}
+
+
+ Item { Layout.fillHeight: true }
+
+ // Error messages
+ // TODO: Move to toasts
+ Item
+ {
+ height: 55
+ Layout.preferredWidth: parent.width
+
+ // Show errors
+ Dex.Text
+ {
+ id: dexErrors
+ visible: dexErrors.text_value !== ""
+ anchors.fill: parent
+ anchors.centerIn: parent
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: Style.textSizeSmall4
+ color: Dex.CurrentTheme.warningColor
+ text_value: General.getTradingError(
+ last_trading_error,
+ curr_fee_info,
+ base_ticker,
+ rel_ticker, left_ticker, right_ticker)
+ elide: Text.ElideRight
+ }
+ }
+
+ Item { Layout.fillHeight: true }
+
+ // Order selected indicator
+ Item
+ {
+ Layout.alignment: Qt.AlignHCenter
+ Layout.preferredWidth: parent.width - 16
+ height: 28
+
+ RowLayout
+ {
+ id: orderSelection
+ visible: API.app.trading_pg.preferred_order.price !== undefined
+ anchors.fill: parent
+ anchors.verticalCenter: parent.verticalCenter
+
+ DefaultText
+ {
+ Layout.leftMargin: 15
+ color: Dex.CurrentTheme.warningColor
+ text: qsTr("Order Selected")
+ }
+
+ Item { Layout.fillWidth: true }
+
+ Qaterial.FlatButton
+ {
+ Layout.preferredHeight: parent.height
+ Layout.preferredWidth: 30
+ Layout.rightMargin: 5
+ foregroundColor: Dex.CurrentTheme.warningColor
+ onClicked: {
+ API.app.trading_pg.reset_order()
+ reset_fees_state()
+ }
+
+ Qaterial.ColorIcon
+ {
+ anchors.centerIn: parent
+ iconSize: 16
+ color: Dex.CurrentTheme.warningColor
+ source: Qaterial.Icons.close
+ }
+ }
+ }
+
+ Rectangle
+ {
+ visible: API.app.trading_pg.preferred_order.price !== undefined
+ anchors.fill: parent
+ radius: 8
+ color: 'transparent'
+ border.color: Dex.CurrentTheme.warningColor
+ }
+ }
+
+
+ TotalView
+ {
+ height: 70
+ Layout.preferredWidth: parent.width
+ Layout.alignment: Qt.AlignHCenter
+ }
+
+ DefaultBusyIndicator
+ {
+ id: swap_btn_spinner
+ Layout.alignment: Qt.AlignHCenter
+ indicatorSize: 28
+ indicatorDotSize: 4
+ }
+ Item
+ {
+ Layout.alignment: Qt.AlignHCenter
+ Layout.preferredWidth: parent.width - 16
+ height: 28
+
+ DexGradientAppButton
+ {
+ id: swap_btn
+ height: 32
+ anchors.fill: parent
+ radius: 16
+ text: API.app.trading_pg.maker_mode ? qsTr("CREATE MAKER SWAP") : qsTr("START TAKER SWAP")
+ font.weight: Font.Medium
+ }
+ }
}
\ No newline at end of file
diff --git a/atomic_defi_design/Dex/Exchange/ProView/SearchableTickerSelector.qml b/atomic_defi_design/Dex/Exchange/ProView/SearchableTickerSelector.qml
index 6bda8f68f..68b621ef0 100644
--- a/atomic_defi_design/Dex/Exchange/ProView/SearchableTickerSelector.qml
+++ b/atomic_defi_design/Dex/Exchange/ProView/SearchableTickerSelector.qml
@@ -18,13 +18,13 @@ Dex.ComboBoxWithSearchBar
property string ticker
property bool index_changed: false
- height: 70
+ height: 85
enabled: !block_everything
textRole: "ticker"
valueRole: "ticker"
- popupMaxHeight: Math.min(model.rowCount() * 70 + 70, 600)
+ popupMaxHeight: Math.min(model.rowCount() * 85 + 85, 600)
popupForceMaxHeight: true
searchBar.visible: true
@@ -34,7 +34,7 @@ Dex.ComboBoxWithSearchBar
{
id: _delegate
width: control.width
- height: visible ? 70 : 0
+ height: visible ? 85 : 0
highlighted: control.highlightedIndex === index
contentItem: DexComboBoxLine { details: model }
@@ -52,7 +52,7 @@ Dex.ComboBoxWithSearchBar
property int update_count: 0
property var prev_details
- padding: 10
+ padding: 8
function forceUpdateDetails()
{
diff --git a/atomic_defi_design/Dex/Exchange/ProView/TickerSelectors.qml b/atomic_defi_design/Dex/Exchange/ProView/TickerSelectors.qml
index 6c52fed10..8b317cecb 100644
--- a/atomic_defi_design/Dex/Exchange/ProView/TickerSelectors.qml
+++ b/atomic_defi_design/Dex/Exchange/ProView/TickerSelectors.qml
@@ -6,9 +6,12 @@ import "../../Components"
import "../../Constants"
// Ticker selectors.
-Row
+RowLayout
{
id: selectors
+ Layout.topMargin: 8
+ Layout.bottomMargin: 2
+ Layout.alignment: Qt.AlignHCenter
function renewIndex()
{
@@ -21,9 +24,8 @@ Row
SearchableTickerSelector
{
id: selectorLeft
-
- width: 210
- height: parent.height
+ Layout.preferredWidth: 195
+ Layout.preferredHeight: 85
left_side: true
model: API.app.trading_pg.market_pairs_mdl.left_selection_box
@@ -38,10 +40,12 @@ Row
}
}
+ Item { Layout.fillWidth: true }
+
SwapIcon
{
- width: 25
- anchors.verticalCenter: parent.verticalCenter
+ Layout.preferredHeight: 25
+ Layout.alignment: Qt.AlignVCenter
top_arrow_ticker: selectorLeft.ticker
bottom_arrow_ticker: selectorRight.ticker
hovered: swap_button.containsMouse
@@ -59,13 +63,13 @@ Row
}
}
+ Item { Layout.fillWidth: true }
+
SearchableTickerSelector
{
id: selectorRight
-
- width: 210
- height: parent.height
-
+ Layout.preferredWidth: 195
+ Layout.preferredHeight: 85
left_side: false
model: API.app.trading_pg.market_pairs_mdl.right_selection_box
ticker: right_ticker
diff --git a/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/Main.qml b/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/Main.qml
index 062063bfb..3246d7b55 100644
--- a/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/Main.qml
+++ b/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/Main.qml
@@ -5,22 +5,19 @@ import QtQuick.Controls 2.15
import Qaterial 1.0 as Qaterial
import Dex.Themes 1.0 as Dex
+import Dex.Components 1.0 as Dex
+import AtomicDEX.MarketMode 1.0
import "../../../Constants"
import "../../../Components"
import "../../Trade"
import "../../ProView"
-Widget
+ColumnLayout
{
- width: 450
+ Layout.preferredWidth: 450
+ Layout.fillHeight: true
property alias currentIndex: tabView.currentIndex
- title: qsTr("Trading Information")
-
- background: null
- margins: 0
-
-
Qaterial.LatoTabBar
{
id: tabView
@@ -76,7 +73,19 @@ Widget
{
Layout.fillHeight: true
Layout.fillWidth: true
- spacing: 10
+ Layout.topMargin: 8
+ spacing: 8
+
+ // Ticker selectors.
+ TickerSelectors
+ {
+ id: selectors
+ Layout.preferredWidth: 435
+ Layout.preferredHeight: 85
+ Layout.leftMargin: 8
+ Layout.rightMargin: 8
+ }
+
// Chart
Chart
{
@@ -97,6 +106,7 @@ Widget
Layout.rightMargin: 5
Layout.fillWidth: true
Layout.fillHeight: true
+ width: 435
}
}
diff --git a/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderModal.qml b/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderModal.qml
index 2c0f7854c..df4d38f8a 100644
--- a/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderModal.qml
+++ b/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderModal.qml
@@ -66,6 +66,7 @@ MultipageModal
PairItemBadge
{
+ is_left: true
ticker: details ? details.base_coin : ""
fullname: details ? General.coinName(details.base_coin) : ""
amount: details ? details.base_amount : ""
@@ -119,6 +120,26 @@ MultipageModal
label.font.pixelSize: 13
}
+ // Min Vol
+ TextEditWithTitle
+ {
+ Layout.fillWidth: true
+ title: qsTr("Min Volume")
+ text: details ? details.min_volume + " " + details.base_coin : ""
+ label.font.pixelSize: 13
+ visible: General.exists(details) && details.min_volume != ""
+ }
+
+ // Max Vol
+ TextEditWithTitle
+ {
+ Layout.fillWidth: true
+ title: qsTr("Max Volume")
+ text: details ? details.max_volume + " " + details.base_coin : ""
+ label.font.pixelSize: 13
+ visible: General.exists(details) && details.max_volume != ""
+ }
+
// Refund state
TextEditWithTitle
{
diff --git a/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/PriceLine.qml b/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/PriceLine.qml
index cab141ecf..4eb305bef 100644
--- a/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/PriceLine.qml
+++ b/atomic_defi_design/Dex/Exchange/ProView/TradingInfo/PriceLine.qml
@@ -66,17 +66,6 @@ ColumnLayout
visible: price_entered && !invalid_cex_price
Layout.alignment: Qt.AlignCenter
- DefaultText
- {
- id: price_diff_text
- Layout.topMargin: 10
- Layout.bottomMargin: Layout.topMargin
- Layout.alignment: Qt.AlignHCenter
- color: parseFloat(cexPriceDiff) <= 0 ? Dex.CurrentTheme.okColor : Dex.CurrentTheme.warningColor
- text_value: (parseFloat(cexPriceDiff) > 0 ? qsTr("Expensive") : qsTr("Expedient")) + ": " + qsTr("%1 compared to CEX", "PRICE_DIFF%").arg("" + General.formatPercent(General.limitDigits(cexPriceDiff)) + "")
- font.pixelSize: fontSize
- }
-
RowLayout
{
Layout.alignment: Qt.AlignHCenter
@@ -103,6 +92,15 @@ ColumnLayout
}
}
+ DefaultText
+ {
+ id: price_diff_text
+ anchors.horizontalCenter: parent.horizontalCenter
+ color: parseFloat(cexPriceDiff) <= 0 ? Dex.CurrentTheme.okColor : Dex.CurrentTheme.warningColor
+ text_value: (parseFloat(cexPriceDiff) > 0 ? qsTr("Expensive") : qsTr("Expedient")) + ": " + qsTr("%1 compared to CEX", "PRICE_DIFF%").arg("" + General.formatPercent(General.limitDigits(cexPriceDiff)) + "")
+ font.pixelSize: fontSizeBigger
+ }
+
DefaultText
{
text_value: General.formatPercent(-lineScale)
diff --git a/atomic_defi_design/Dex/Exchange/Trade/BestOrder/List.qml b/atomic_defi_design/Dex/Exchange/Trade/BestOrder/List.qml
index 85a7be4eb..552ee7bbf 100644
--- a/atomic_defi_design/Dex/Exchange/Trade/BestOrder/List.qml
+++ b/atomic_defi_design/Dex/Exchange/Trade/BestOrder/List.qml
@@ -14,9 +14,11 @@ import Dex.Components 1.0 as Dex
Widget
{
id: _control
- title: qsTr("Best Orders")
+ title: qsTr("Best Orders for %1").arg(left_ticker)
+
margins: 10
spacing: 10
+ collapsable: false
Header
{
diff --git a/atomic_defi_design/Dex/Exchange/Trade/BestOrder/ListDelegate.qml b/atomic_defi_design/Dex/Exchange/Trade/BestOrder/ListDelegate.qml
index e5893f2e3..be08030d7 100644
--- a/atomic_defi_design/Dex/Exchange/Trade/BestOrder/ListDelegate.qml
+++ b/atomic_defi_design/Dex/Exchange/Trade/BestOrder/ListDelegate.qml
@@ -14,8 +14,7 @@ import AtomicDEX.MarketMode 1.0
Item
{
id: _control
-
- property bool coinEnable: API.app.portfolio_pg.global_cfg_mdl.get_coin_info(coin).is_enabled
+ property bool _isCoinEnabled: API.app.portfolio_pg.global_cfg_mdl.get_coin_info(coin).is_enabled
property bool isAsk
AnimatedRectangle
@@ -46,7 +45,7 @@ Item
height: 24
anchors.verticalCenter: parent.verticalCenter
source: General.coinIcon(coin)
- opacity: !_control.coinEnable? .1 : 1
+ opacity: !_control._isCoinEnabled? .1 : 1
}
Dex.Text
@@ -137,7 +136,7 @@ Item
{
if (API.app.enable_coins([coin]) === true)
{
- _control.coinEnable = true;
+ _control._isCoinEnabled = true;
_tooltip.close();
}
else {
@@ -170,15 +169,22 @@ Item
else
{
placeOrderForm.visible = General.flipFalse(placeOrderForm.visible)
- if (API.app.trading_pg.market_mode == MarketMode.Buy)
+ if (!API.app.trading_pg.maker_mode)
{
- app.pairChanged(coin, rel_ticker)
+ if (API.app.trading_pg.market_mode == MarketMode.Buy)
+ {
+ app.pairChanged(coin, rel_ticker)
+ }
+ else
+ {
+ app.pairChanged(base_ticker, coin)
+ }
+ API.app.trading_pg.orderbook.select_best_order(uuid)
}
else
{
- app.pairChanged(base_ticker, coin)
+ setPair(false, coin)
}
- API.app.trading_pg.orderbook.select_best_order(uuid)
}
}
}
diff --git a/atomic_defi_design/Dex/Exchange/Trade/ConfirmTradeModal.qml b/atomic_defi_design/Dex/Exchange/Trade/ConfirmTradeModal.qml
index 4054ef660..8056ecbef 100644
--- a/atomic_defi_design/Dex/Exchange/Trade/ConfirmTradeModal.qml
+++ b/atomic_defi_design/Dex/Exchange/Trade/ConfirmTradeModal.qml
@@ -17,8 +17,9 @@ MultipageModal
id: root
readonly property var fees: API.app.trading_pg.fees
width: 720
- horizontalPadding: 20
- verticalPadding: 20
+ height: window.height - 80
+ horizontalPadding: 10
+ verticalPadding: 10
closePolicy: Popup.NoAutoClose
MultipageModalContent
@@ -28,7 +29,7 @@ MultipageModal
titleAlignment: Qt.AlignHCenter
titleTopMargin: 0
topMarginAfterTitle: 10
- flickMax: window.height - 480
+ flickMax: window.height - 385
header: [
RowLayout
@@ -43,6 +44,7 @@ MultipageModal
PairItemBadge
{
ticker: base_ticker
+ is_left: true
fullname: General.coinName(base_ticker)
amount: base_amount
Layout.fillHeight: true
@@ -75,59 +77,6 @@ MultipageModal
{
id: price_line
Layout.fillWidth: true
- },
-
- ColumnLayout
- {
- id: warnings_text
- Layout.fillWidth: true
- Layout.alignment: Qt.AlignHCenter
-
- // Large margin warning
- FloatingBackground
- {
- Layout.alignment: Qt.AlignCenter
- width: childrenRect.width
- height: childrenRect.height
- color: Style.colorRed2
- visible: Math.abs(parseFloat(API.app.trading_pg.cex_price_diff)) >= 50
-
- RowLayout
- {
- Layout.fillWidth: true
-
- Item { width: 3 }
-
- DefaultCheckBox
- {
- id: allow_bad_trade
- Layout.alignment: Qt.AlignCenter
- textColor: Style.colorWhite0
- visible: Math.abs(parseFloat(API.app.trading_pg.cex_price_diff)) >= 50
- spacing: 2
- boxWidth: 16
- boxHeight: 16
- boxRadius: 8
- label.wrapMode: Label.NoWrap
- text: qsTr("Trade price is more than 50% different to CEX! Confirm?")
- font: DexTypo.caption
- }
- }
- }
-
- DefaultText
- {
- Layout.alignment: Qt.AlignHCenter
- text_value: qsTr("This swap request can not be undone and is a final event!")
- }
-
- DefaultText
- {
- id: warnings_tx_time_text
- Layout.alignment: Qt.AlignHCenter
- text_value: qsTr("This transaction can take up to 60 mins - DO NOT close this application!")
- font.pixelSize: Style.textSizeSmall4
- }
}
]
@@ -138,9 +87,9 @@ MultipageModal
readonly property var default_config: API.app.trading_pg.get_raw_mm2_coin_cfg(rel_ticker)
readonly property bool is_dpow_configurable: config_section.default_config.requires_notarization || false
- width: dex_pair_badges.width - 20
+ width: dex_pair_badges.width - 40
Layout.alignment: Qt.AlignCenter
- Layout.topMargin: 8
+ Layout.topMargin: 4
spacing: 5
@@ -239,7 +188,39 @@ MultipageModal
}
}
- // Custom config checkbox
+ // Large margin warning
+ FloatingBackground
+ {
+ Layout.alignment: Qt.AlignCenter
+ width: childrenRect.width
+ height: childrenRect.height
+ color: Style.colorRed2
+ visible: Math.abs(parseFloat(API.app.trading_pg.cex_price_diff)) >= 50
+
+ RowLayout
+ {
+ Layout.fillWidth: true
+
+ Item { width: 3 }
+
+ DefaultCheckBox
+ {
+ id: allow_bad_trade
+ Layout.alignment: Qt.AlignCenter
+ textColor: Style.colorWhite0
+ visible: Math.abs(parseFloat(API.app.trading_pg.cex_price_diff)) >= 50
+ spacing: 2
+ boxWidth: 16
+ boxHeight: 16
+ boxRadius: 8
+ label.wrapMode: Label.NoWrap
+ text: qsTr("Trade price is more than 50% different to CEX! Confirm?")
+ font: DexTypo.caption
+ }
+ }
+ }
+
+ // Custom config section
Item
{
Layout.alignment: Qt.AlignCenter
@@ -251,9 +232,30 @@ MultipageModal
{
id: use_custom
anchors.horizontalCenter: parent.horizontalCenter
-
spacing: 5
+ DefaultCheckBox
+ {
+ id: _cancelPreviousCheckbox
+ visible: API.app.trading_pg.maker_mode
+ boxWidth: 20
+ boxHeight: 20
+ checked: true
+ height: 40
+ text: qsTr("Cancel all existing orders for %1/%2?").arg(base_ticker).arg(rel_ticker)
+ }
+
+ DefaultCheckBox
+ {
+ id: _goodUntilCanceledCheckbox
+ visible: !API.app.trading_pg.maker_mode
+ boxWidth: 20
+ boxHeight: 20
+ checked: true
+ height: 40
+ text: qsTr("Good until cancelled (order will remain on orderbook until filled or cancelled)")
+ }
+
DefaultCheckBox
{
id: enable_custom_config
@@ -261,7 +263,7 @@ MultipageModal
spacing: 2
boxWidth: 20
boxHeight: 20
- height: 50
+ height: 40
label.wrapMode: Label.NoWrap
text: qsTr("Use custom protection settings for incoming %1 transactions", "TICKER").arg(rel_ticker)
@@ -390,6 +392,31 @@ MultipageModal
}
}
+ ColumnLayout
+ {
+ id: warnings_text
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignHCenter
+
+
+ DefaultText
+ {
+ Layout.alignment: Qt.AlignHCenter
+ text_value: qsTr("This swap request can not be undone and is a final event!")
+ font: DexTypo.italic12
+ color: Dex.CurrentTheme.foregroundColor2
+ }
+
+ DefaultText
+ {
+ id: warnings_tx_time_text
+ Layout.alignment: Qt.AlignHCenter
+ text_value: qsTr("This transaction can take up to 60 mins - DO NOT close this application!")
+ font: DexTypo.italic12
+ color: Dex.CurrentTheme.foregroundColor2
+ }
+ }
+
Item
{
visible: buy_sell_rpc_busy
@@ -437,7 +464,9 @@ MultipageModal
trade({ enable_custom_config: enable_custom_config.checked,
is_dpow_configurable: config_section.is_dpow_configurable,
enable_dpow_confs: enable_dpow_confs.checked,
- required_confirmation_count: required_confirmation_count.value, },
+ required_confirmation_count: required_confirmation_count.value,
+ cancel_previous: _cancelPreviousCheckbox.checked,
+ good_until_canceled: _goodUntilCanceledCheckbox.checked},
config_section.default_config)
API.app.trading_pg.reset_fees()
}
diff --git a/atomic_defi_design/Dex/Exchange/Trade/Market.qml b/atomic_defi_design/Dex/Exchange/Trade/Market.qml
new file mode 100644
index 000000000..3c6af075e
--- /dev/null
+++ b/atomic_defi_design/Dex/Exchange/Trade/Market.qml
@@ -0,0 +1,85 @@
+import QtQuick 2.15
+import QtQuick.Layouts 1.15
+import QtQuick.Controls 2.15
+
+import Qaterial 1.0 as Qaterial
+
+import Dex.Themes 1.0 as Dex
+import "../../Components"
+import "../../Constants"
+
+// OrderBook / Component import
+import "OrderBook/" as OrderBook
+
+// Best Order
+import "BestOrder/" as BestOrder
+
+
+ColumnLayout
+{
+ Layout.minimumWidth: 350
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.alignment: Qt.AlignTop
+ property alias currentIndex: marketTabView.currentIndex
+
+ Qaterial.LatoTabBar
+ {
+ id: marketTabView
+ property int orderbook: 0
+ property int best_orders: 1
+
+ background: null
+ Layout.leftMargin: 6
+
+ Qaterial.LatoTabButton
+ {
+ text: qsTr("Orderbook")
+ font.pixelSize: 14
+ textColor: checked ? Dex.CurrentTheme.foregroundColor : Dex.CurrentTheme.foregroundColor2
+ textSecondaryColor: Dex.CurrentTheme.foregroundColor2
+ indicatorColor: Dex.CurrentTheme.foregroundColor
+ }
+ Qaterial.LatoTabButton
+ {
+ text: qsTr("Best Orders")
+ font.pixelSize: 14
+ textColor: checked ? Dex.CurrentTheme.foregroundColor : Dex.CurrentTheme.foregroundColor2
+ textSecondaryColor: Dex.CurrentTheme.foregroundColor2
+ indicatorColor: Dex.CurrentTheme.foregroundColor
+ }
+ }
+
+ Rectangle
+ {
+ Layout.fillHeight: true
+ color: Dex.CurrentTheme.floatingBackgroundColor
+ radius: 10
+ Layout.preferredWidth: 350
+
+ Qaterial.SwipeView
+ {
+ id: marketSwipeView
+ clip: true
+ interactive: false
+ currentIndex: marketTabView.currentIndex
+ anchors.fill: parent
+
+ onCurrentIndexChanged:
+ {
+ marketSwipeView.currentItem.update();
+ }
+
+ OrderBook.Vertical
+ {
+ id: orderBook
+ }
+
+ // Best Orders
+ BestOrder.List
+ {
+ id: bestOrders
+ }
+ }
+ }
+}
diff --git a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/List.qml b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/List.qml
index 23e54d660..16b15f0d9 100644
--- a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/List.qml
+++ b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/List.qml
@@ -25,6 +25,7 @@ Item
clip: true
reuseItems: true
spacing: 8
+ opacity: API.app.trading_pg.maker_mode ? 0.6 : 1
onContentHeightChanged:
{
diff --git a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml
index 5ce557fc6..03819d17f 100644
--- a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml
+++ b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/ListDelegate.qml
@@ -35,6 +35,7 @@ Item
color: Qaterial.Colors.amber
}
+ // Insufficient funds tooltip
DexLabel
{
id: tooltip_text
@@ -44,6 +45,10 @@ Item
{
if (mouse_area.containsMouse)
{
+ if (API.app.trading_pg.maker_mode)
+ {
+ return qsTr("Orderbook is disabled while creating maker orders")
+ }
let relMaxTakerVol = parseFloat(API.app.trading_pg.orderbook.rel_max_taker_vol.decimal);
let baseMaxTakerVol = parseFloat(API.app.trading_pg.orderbook.base_max_taker_vol.decimal);
@@ -101,9 +106,11 @@ Item
anchors.fill: parent
hoverEnabled: true
+ // Populate form with selected order
onClicked:
{
if (is_mine) return
+ if (API.app.trading_pg.maker_mode) return
if (enough_funds_to_pay_min_volume )
{
@@ -119,6 +126,7 @@ Item
}
}
+ // Highlight row on mouseover
AnimatedRectangle
{
visible: mouse_area.containsMouse
@@ -128,16 +136,6 @@ Item
opacity: 0.1
}
- Rectangle
- {
- anchors.verticalCenter: parent.verticalCenter
- width: 6
- height: 6
- radius: width / 2
- visible: is_mine
- color: isAsk ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor
- }
-
// Progress bar
Rectangle
{
@@ -161,98 +159,111 @@ Item
}
}
- Row
+ // Price, Qty & Total text values
+ RowLayout
{
id: row
anchors.fill: parent
- anchors.horizontalCenter: parent.horizontalCenter
onWidthChanged: progress.width = ((depth * 100) * (width + 40)) / 100
- spacing: 0
+ spacing: 3
+
+ // Dot on the left side of the row to indicate own order
+ Rectangle
+ {
+ Layout.leftMargin: 6
+ Layout.alignment: Qt.AlignVCenter
+ opacity: is_mine ? 1 : 0
+ width: 6
+ height: 6
+ radius: 3
+ color: isAsk ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor
+ }
+ // Price
Dex.ElidableText
{
- anchors.verticalCenter: parent.verticalCenter
- width: parent.width * 0.31
+ Layout.fillHeight: true
+ Layout.minimumWidth: 90
+ Layout.alignment: Qt.AlignVCenter
text: { new BigNumber(price).toFixed(8) }
font.family: DexTypo.fontFamily
font.pixelSize: 12
color: isAsk ? Dex.CurrentTheme.warningColor : Dex.CurrentTheme.okColor
horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
wrapMode: Text.NoWrap
}
- Item { width: parent.width * 0.01 }
-
// Quantity
Dex.ElidableText
{
- anchors.verticalCenter: parent.verticalCenter
- width: parent.width * 0.37
+ Layout.fillHeight: true
+ Layout.minimumWidth: 90
+ Layout.alignment: Qt.AlignVCenter
text: { new BigNumber(base_max_volume).toFixed(6) }
font.family: DexTypo.fontFamily
font.pixelSize: 12
horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
onTextChanged: depth_bar.width = ((depth * 100) * (mouse_area.width + 40)) / 100
wrapMode: Text.NoWrap
}
- Item { width: parent.width * 0.01 }
-
// Total
Dex.ElidableText
{
- anchors.verticalCenter: parent.verticalCenter
- width: parent.width * 0.30
- rightPadding: (is_mine) && (mouse_area.containsMouse || cancel_button.containsMouse) ? 30 : 0
+ id: total_text
+ Layout.fillHeight: true
+ Layout.minimumWidth: 90
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignVCenter
font.family: DexTypo.fontFamily
font.pixelSize: 12
text: { new BigNumber(total).toFixed(6) }
horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
wrapMode: Text.NoWrap
-
- Behavior on rightPadding { NumberAnimation { duration: 150 } }
}
- }
- }
-
- Qaterial.ColorIcon
- {
- id: cancel_button_text
- property bool requested_cancel: false
-
- visible: is_mine && !requested_cancel
- anchors.verticalCenter: parent.verticalCenter
- anchors.verticalCenterOffset: 1
- anchors.right: parent.right
- anchors.rightMargin: mouse_area.containsMouse || cancel_button.containsMouse ? 12 : 6
- Behavior on iconSize
- {
- NumberAnimation
+ // Cancel button
+ Item
{
- duration: 200
- }
- }
-
- iconSize: mouse_area.containsMouse || cancel_button.containsMouse? 16 : 0
+ id: cancel_flat_btn
+ Layout.fillHeight: true
+ width: 30
+ Layout.alignment: Qt.AlignVCenter
- color: cancel_button.containsMouse ?
- Qaterial.Colors.red : mouse_area.containsMouse ?
- DexTheme.foregroundColor: Qaterial.Colors.red
+ MouseArea
+ {
+ id: cancel_mouse_area
+ anchors.fill: parent
+ cursorShape: Qt.PointingHandCursor
+ hoverEnabled: true
+ }
- DefaultMouseArea
- {
- id: cancel_button
- anchors.fill: parent
- hoverEnabled: true
+ Qaterial.FlatButton
+ {
+ id: cancel_button_orderbook
+ anchors.centerIn: parent
+ anchors.fill: parent
+ opacity: is_mine ? 1 : 0
- onClicked:
- {
- if (!is_mine) return
+ onClicked: {
+ if (uuid) cancelOrder(uuid);
+ }
- cancel_button_text.requested_cancel = true
- cancelOrder(uuid)
+ Qaterial.ColorIcon
+ {
+ anchors.centerIn: parent
+ iconSize: 16
+ color: Dex.CurrentTheme.warningColor
+ source: Qaterial.Icons.close
+ visible: is_mine
+ scale: is_mine && mouse_area.containsMouse ? 1 : 0
+ Behavior on scale { NumberAnimation { duration: 150 } }
+ }
+ }
}
}
}
diff --git a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/Vertical.qml b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/Vertical.qml
index b73167e10..74d07bcaf 100644
--- a/atomic_defi_design/Dex/Exchange/Trade/OrderBook/Vertical.qml
+++ b/atomic_defi_design/Dex/Exchange/Trade/OrderBook/Vertical.qml
@@ -11,12 +11,14 @@ import Dex.Themes 1.0 as Dex
Widget
{
- title: qsTr("Order Book")
+ title: qsTr("%1 Orderbook").arg(left_ticker + "/" + right_ticker)
+ readonly property string pair_trades_24hr: API.app.trading_pg.pair_trades_24hr
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: 8
- spacing: 2
+ margins: 10
+ spacing: 10
+ collapsable: false
Header
{
@@ -61,7 +63,7 @@ Widget
Layout.bottomMargin: 2
Layout.alignment: Qt.AlignHCenter
color: Dex.CurrentTheme.foregroundColor2
- text_value: pair + qsTr(" traded 24hrs: %1").arg("" + General.convertUsd(pair_volume_24hr) + "")
+ text_value: pair + qsTr(" 24hrs | %1 | %2 trades").arg(General.convertUsd(pair_volume_24hr)).arg(pair_trades_24hr)
font.pixelSize: Style.textSizeSmall1
}
}
diff --git a/atomic_defi_design/Dex/Exchange/Trade/PriceLineSimplified.qml b/atomic_defi_design/Dex/Exchange/Trade/PriceLineSimplified.qml
index abbc8c812..4eb4d92c1 100644
--- a/atomic_defi_design/Dex/Exchange/Trade/PriceLineSimplified.qml
+++ b/atomic_defi_design/Dex/Exchange/Trade/PriceLineSimplified.qml
@@ -22,7 +22,7 @@ ColumnLayout
readonly property int fontSizeBigger: Style.textSizeSmall2
readonly property int lineScale: General.getComparisonScale(cexPriceDiff)
- spacing: 35
+ spacing: 24
RowLayout
{
@@ -126,10 +126,22 @@ ColumnLayout
{
text_value: General.formatPercent(lineScale)
font.pixelSize: fontSize
+ anchors.left: parent.left
anchors.top: parent.top
anchors.topMargin: -15
}
+ DefaultText
+ {
+ id: price_diff_text
+ anchors.top: parent.top
+ anchors.topMargin: -15
+ anchors.horizontalCenter: parent.horizontalCenter
+ color: parseFloat(cexPriceDiff) <= 0 ? Dex.CurrentTheme.okColor : Dex.CurrentTheme.warningColor
+ text_value: (parseFloat(cexPriceDiff) > 0 ? qsTr("Expensive") : qsTr("Expedient")) + ": " + qsTr("%1 compared to CEX", "PRICE_DIFF%").arg("" + General.formatPercent(General.limitDigits(cexPriceDiff)) + "")
+ font.pixelSize: fontSizeBigger
+ }
+
DefaultText
{
text_value: General.formatPercent(-lineScale)
@@ -141,14 +153,5 @@ ColumnLayout
}
}
- DefaultText
- {
- id: price_diff_text
- Layout.topMargin: 10
- Layout.alignment: Qt.AlignHCenter
- color: parseFloat(cexPriceDiff) <= 0 ? Dex.CurrentTheme.okColor : Dex.CurrentTheme.warningColor
- text_value: (parseFloat(cexPriceDiff) > 0 ? qsTr("Expensive") : qsTr("Expedient")) + ": " + qsTr("%1 compared to CEX", "PRICE_DIFF%").arg("" + General.formatPercent(General.limitDigits(cexPriceDiff)) + "")
- font.pixelSize: fontSize
- }
}
}
diff --git a/atomic_defi_design/Dex/Exchange/Trade/ProView.qml b/atomic_defi_design/Dex/Exchange/Trade/ProView.qml
index 0483903ff..6ebe7a1f6 100644
--- a/atomic_defi_design/Dex/Exchange/Trade/ProView.qml
+++ b/atomic_defi_design/Dex/Exchange/Trade/ProView.qml
@@ -40,10 +40,8 @@ RowLayout
{
id: form
- property alias tickerSelectors: selectors
property alias trInfo: tradingInfo
- property alias orderBook: orderBook
- property alias bestOrders: bestOrders
+ property alias marketsOrderBook: marketsOrderBook
property alias placeOrderForm: placeOrderForm
function selectOrder(
@@ -109,72 +107,25 @@ RowLayout
}
}
- ColumnLayout
+ // Trading Informations
+ TradingInfo.Main
{
+ id: tradingInfo
Layout.alignment: Qt.AlignTop
-
- Layout.minimumWidth: selectors.visible || tradingInfo.visible ? 450 : -1
- Layout.maximumWidth: (!orderBook.visible && !bestOrders.visible) || (!placeOrderForm.visible) ? -1 : 450
- Layout.fillWidth: true
-
+ Layout.minimumWidth: tradingInfo.visible ? 450 : -1
+ Layout.maximumWidth: (!marketsOrderBook.visible) || (!placeOrderForm.visible) ? -1 : 450
Layout.fillHeight: true
-
- spacing: 10
-
- // Ticker selectors.
- TickerSelectors
- {
- id: selectors
-
- Layout.fillWidth: true
- Layout.preferredHeight: 70
- }
-
- // Trading Informations
- TradingInfo.Main
- {
- id: tradingInfo
-
- Layout.fillWidth: true
- Layout.fillHeight: true
-
- resizable: false
- }
}
- WidgetContainer
+ // Best Orders & Order Book
+ Market
{
- property real _orderBookHeightRatio: 0.65
- property real _bestOrdersHeightRatio: 0.35
-
- Layout.minimumWidth: orderBook.visible || bestOrders.visible ? 350 : -1
+ id: marketsOrderBook
+ Layout.maximumWidth: 350
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignTop
spacing: 4
-
- onHeightChanged:
- {
- orderBook.height = getHeight(_orderBookHeightRatio);
- bestOrders.height = getHeight(_bestOrdersHeightRatio);
- }
-
- OrderBook.Vertical
- {
- id: orderBook
-
- width: parent.width
- minHeight: 320
- }
-
- // Best Orders
- BestOrder.List
- {
- id: bestOrders
-
- width: parent.width
- minHeight: 140
- }
}
// Place order form.
@@ -186,13 +137,11 @@ RowLayout
Layout.maximumWidth: 305
Layout.fillWidth: true
Layout.fillHeight: true
-
- resizable: false
}
ModalLoader
{
id: confirm_trade_modal
- sourceComponent: ConfirmTradeModal {}
+ sourceComponent: ConfirmTradeModal { }
}
}
diff --git a/atomic_defi_design/Dex/Exchange/Trade/SimpleView/OrderRemovedModal.qml b/atomic_defi_design/Dex/Exchange/Trade/SimpleView/OrderRemovedModal.qml
index dc49f96c3..4d5c8fe01 100644
--- a/atomic_defi_design/Dex/Exchange/Trade/SimpleView/OrderRemovedModal.qml
+++ b/atomic_defi_design/Dex/Exchange/Trade/SimpleView/OrderRemovedModal.qml
@@ -17,7 +17,7 @@ MultipageModal
Layout.fillWidth: true
wrapMode: Text.WordWrap
- text: qsTr("The selected order does not exist anymore, it might have been matched or canceled, and no order with a better price is available.\nPlease select a new order.")
+ text: qsTr("The selected order does not exist anymore, it might have been matched or cancelled, and no order with a better price is available.\nPlease select a new order.")
}
footer:
diff --git a/atomic_defi_design/Dex/Exchange/Trade/Trade.qml b/atomic_defi_design/Dex/Exchange/Trade/Trade.qml
index 192305018..aba6f1c6b 100644
--- a/atomic_defi_design/Dex/Exchange/Trade/Trade.qml
+++ b/atomic_defi_design/Dex/Exchange/Trade/Trade.qml
@@ -48,27 +48,32 @@ Item
readonly property bool price_is_empty: parseFloat(non_null_price) <= 0
readonly property string backend_price: API.app.trading_pg.price
+ readonly property int last_trading_error: API.app.trading_pg.last_trading_error
+ readonly property string max_volume: API.app.trading_pg.max_volume
+ readonly property string backend_volume: API.app.trading_pg.volume
+ property bool sell_mode: API.app.trading_pg.market_mode.toString() === "Sell"
+ readonly property string base_amount: API.app.trading_pg.base_amount
+ readonly property string rel_amount: API.app.trading_pg.rel_amount
+
function setPrice(v) {
API.app.trading_pg.price = v
API.app.trading_pg.determine_error_cases()
}
- readonly property int last_trading_error: API.app.trading_pg.last_trading_error
- readonly property string max_volume: API.app.trading_pg.max_volume
- readonly property string backend_volume: API.app.trading_pg.volume
+
function setVolume(v) {
API.app.trading_pg.volume = v
API.app.trading_pg.determine_error_cases()
}
+
+ function setMakerMode(v) {
+ API.app.trading_pg.maker_mode = v
+ }
- property bool sell_mode: API.app.trading_pg.market_mode.toString(
- ) === "Sell"
function setMarketMode(v) {
API.app.trading_pg.market_mode = v
}
- readonly property string base_amount: API.app.trading_pg.base_amount
- readonly property string rel_amount: API.app.trading_pg.rel_amount
-
+
Timer
{
id: swap_cooldown
@@ -144,9 +149,20 @@ Item
}
if (sell_mode)
- API.app.trading_pg.place_sell_order(nota, confs)
+ {
+ if (API.app.trading_pg.maker_mode)
+ {
+ API.app.trading_pg.place_setprice_order(nota, confs, options.cancel_previous)
+ }
+ else
+ {
+ API.app.trading_pg.place_sell_order(nota, confs, options.good_until_canceled)
+ }
+ }
else
- API.app.trading_pg.place_buy_order(nota, confs)
+ {
+ API.app.trading_pg.place_buy_order(nota, confs, options.good_until_canceled)
+ }
orderPlaced()
}
@@ -170,10 +186,8 @@ Item
width: parent.width
height: parent.height * 0.06
- proViewTickerSelectors: proView.tickerSelectors
proViewTrInfo: proView.trInfo
- proViewOrderBook: proView.orderBook
- proViewBestOrders: proView.bestOrders
+ proViewMarketsOrderBook: proView.marketsOrderBook
proViewPlaceOrderForm: proView.placeOrderForm
}
diff --git a/atomic_defi_design/Dex/Exchange/Trade/Trading/TradeViewHeader.qml b/atomic_defi_design/Dex/Exchange/Trade/Trading/TradeViewHeader.qml
index 8cc01d06d..f92fc2313 100644
--- a/atomic_defi_design/Dex/Exchange/Trade/Trading/TradeViewHeader.qml
+++ b/atomic_defi_design/Dex/Exchange/Trade/Trading/TradeViewHeader.qml
@@ -19,10 +19,8 @@ import "../../../Constants"
Item
{
// property var proViewChart
- property var proViewTickerSelectors
property var proViewTrInfo
- property var proViewOrderBook
- property var proViewBestOrders
+ property var proViewMarketsOrderBook
property var proViewPlaceOrderForm
Item
@@ -35,8 +33,8 @@ Item
{
id: cursorRect
width: _simpleLabel.width + 28
- height: _simpleLabel.height + 14
- radius: 16
+ height: _simpleLabel.height + 8
+ radius: 8
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: API.app.trading_pg.current_trading_mode == TradingMode.Simple ? _simpleLabel.horizontalCenter : _proLabel.horizontalCenter
color: Dex.CurrentTheme.tabSelectedColor
@@ -91,11 +89,12 @@ Item
outlined: false
highlighted: false
+ padding: 6
foregroundColor: Dex.CurrentTheme.foregroundColor
icon.source: Qaterial.Icons.cog
text: qsTr("Pro View Settings")
- font: DexTypo.subtitle1
+ font: DexTypo.subtitle2
onClicked:
{
@@ -111,35 +110,27 @@ Item
contentItem: Item
{
implicitWidth: 200
- implicitHeight: 240
+ implicitHeight: 200
Column
{
anchors.fill: parent
- padding: 10
+ padding: 8
spacing: 8
DefaultText { text: qsTr("Display Settings"); font: DexTypo.body2 }
HorizontalLine { width: parent.width - 20; anchors.horizontalCenter: parent.horizontalCenter; opacity: .4 }
- CheckEye { text: qsTr("Ticker Selectors"); target: proViewTickerSelectors }
-
- HorizontalLine { width: parent.width - 20; anchors.horizontalCenter: parent.horizontalCenter; opacity: .4 }
-
CheckEye { text: qsTr("Trading Information"); target: proViewTrInfo }
HorizontalLine { width: parent.width - 20; anchors.horizontalCenter: parent.horizontalCenter; opacity: .4 }
- CheckEye { text: qsTr("Order Book"); target: proViewOrderBook }
-
- HorizontalLine { width: parent.width - 20; anchors.horizontalCenter: parent.horizontalCenter; opacity: .4 }
-
- CheckEye { text: qsTr("Best Orders"); target: proViewBestOrders }
+ CheckEye { text: qsTr("Order Book"); target: proViewMarketsOrderBook }
HorizontalLine { width: parent.width - 20; anchors.horizontalCenter: parent.horizontalCenter; opacity: .4 }
- CheckEye { text: qsTr("Place Order"); target: proViewPlaceOrderForm }
+ CheckEye { text: qsTr("Order Form"); target: proViewPlaceOrderForm }
}
}
}
diff --git a/atomic_defi_design/Dex/Wallet/Main.qml b/atomic_defi_design/Dex/Wallet/Main.qml
index 3b77efd95..a6dd531cd 100644
--- a/atomic_defi_design/Dex/Wallet/Main.qml
+++ b/atomic_defi_design/Dex/Wallet/Main.qml
@@ -657,6 +657,50 @@ Item
}
}
+ // Proposals Button
+ Item
+ {
+ Layout.preferredWidth: 165
+ Layout.preferredHeight: 40
+ visible: current_ticker_infos.is_vote_coin
+
+ DefaultButton
+ {
+ enabled: activation_pct == 100
+ anchors.fill: parent
+ radius: 18
+ label.text: qsTr("Vote Info")
+ label.font.pixelSize: 16
+ content.anchors.left: content.parent.left
+ content.anchors.leftMargin: enabled ? 23 : 48
+ content.anchors.rightMargin: 23
+
+ onClicked: Qt.openUrlExternally("https://vote.komodoplatform.com/")
+
+ Row
+ {
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ anchors.rightMargin: 23
+
+ Qaterial.Icon
+ {
+ icon: Qaterial.Icons.vote
+ size: 24
+ anchors.verticalCenter: parent.verticalCenter
+ color: "#2c87b9"
+ }
+ }
+ }
+
+ // Faucet button error icon
+ DefaultAlertIcon
+ {
+ visible: activation_pct != 100
+ tooltipText: api_wallet_page.ticker + qsTr(" Activation: " + activation_pct + "%")
+ }
+ }
+
Component.onCompleted: api_wallet_page.claimingFaucetRpcDataChanged.connect(onClaimFaucetRpcResultChanged)
Component.onDestruction: api_wallet_page.claimingFaucetRpcDataChanged.disconnect(onClaimFaucetRpcResultChanged)
function onClaimFaucetRpcResultChanged() { claimFaucetResultModal.open() }
diff --git a/atomic_defi_design/assets/languages/atomic_defi_de.ts b/atomic_defi_design/assets/languages/atomic_defi_de.ts
index 034820097..dd48b9027 100644
--- a/atomic_defi_design/assets/languages/atomic_defi_de.ts
+++ b/atomic_defi_design/assets/languages/atomic_defi_de.ts
@@ -516,17 +516,17 @@ Beispiel: Kennwort = 1234 Suffix=56 Eingabe beim Login=123456
Chart
-
-
- Laden von Marktdaten
+
+
+
-
+
-
+
@@ -1412,7 +1412,7 @@ Beispiel: Kennwort = 1234 Suffix=56 Eingabe beim Login=123456
General
-
+
@@ -1420,7 +1420,7 @@ Beispiel: Kennwort = 1234 Suffix=56 Eingabe beim Login=123456
-
+
day
@@ -1429,7 +1429,7 @@ Beispiel: Kennwort = 1234 Suffix=56 Eingabe beim Login=123456
-
+
hours
@@ -1438,7 +1438,7 @@ Beispiel: Kennwort = 1234 Suffix=56 Eingabe beim Login=123456
-
+
minutes
@@ -1447,7 +1447,7 @@ Beispiel: Kennwort = 1234 Suffix=56 Eingabe beim Login=123456
-
+
seconds
@@ -1456,7 +1456,7 @@ Beispiel: Kennwort = 1234 Suffix=56 Eingabe beim Login=123456
-
+
milliseconds
@@ -1465,117 +1465,117 @@ Beispiel: Kennwort = 1234 Suffix=56 Eingabe beim Login=123456
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
Mindesthandelsbetrag
-
+
WALLETNAME
-
-
+
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
@@ -1782,7 +1782,7 @@ Try again or select 'Allow custom seed' to continue.
-
+
Für diese Order ist ein Mindestbetrag von %1 %2 erforderlich. <br>Ihr Guthaben reicht nicht aus.<br> %3
@@ -1940,70 +1940,70 @@ They will be removed from the orderbook until you log in again.
Faucet
-
-
-
+
+
+
+
+
+
+
+
Öffentlicher Schlüssel
-
+
In die Zwischenablage kopiert
-
+
-
-
- Laden von Marktdaten
-
-
-
+
Für diesen Ticker liegen noch keine Chartdaten vor
-
+
Transaktionen werden abgerufen...
-
+
-
+
-
-
+
+
-
-
- Handelsinformationen
+
+
+
-
+
Chart
-
+
Order
-
+
Historie
@@ -2025,7 +2025,7 @@ They will be removed from the orderbook until you log in again.
-
+
Adressbuch
@@ -2050,26 +2050,44 @@ They will be removed from the orderbook until you log in again.
Schlagworte
-
+
+
+
+
+
+
Bearbeiten
-
+
Löschen
-
+
Adresse in die Zwischenablage kopiert
-
+
Dieser Kontakt hat keine registrierte Adresse.
+
+ Market
+
+
+
+
+
+
+
+
+ Die günstigsten Order
+
+
MarketModeSelector
@@ -2946,12 +2964,12 @@ Bitte wählen Sie eine neue Order aus.
ProView
-
+
Die Order konnte nicht platziert werden
-
+
Order platziert
@@ -3570,6 +3588,11 @@ Bitte wählen Sie eine neue Order aus.
In die Zwischenablage kopiert
+
+
+
+
+
@@ -3643,6 +3666,17 @@ Bitte wählen Sie eine neue Order aus.
MM2 Version in die Zwischenablage kopiert.
+
+
+
+
+
+
+
+
+
+
+
@@ -3655,27 +3689,22 @@ Bitte wählen Sie eine neue Order aus.
-
+
Qt Version
-
+
Qt Version
-
+
Qt Version in die Zwischenablage kopiert.
-
-
- Update suchen
-
-
-
+
Abmelden
@@ -4254,37 +4283,32 @@ There is a toggle in settings where you can turn on/off the display of these tra
TradeViewHeader
-
+
Pro-Ansicht Einstellungen
-
+
Bildschirmeinstellungen
-
+
Ticker Selektoren
-
+
Handelsinformationen
-
-
- Orderbuch
-
-
-
-
- Beste Order
+
+
+
-
+
Order platzieren
@@ -4445,8 +4469,8 @@ There is a toggle in settings where you can turn on/off the display of these tra
Orderbuch
-
-
+
+
@@ -4563,7 +4587,7 @@ This might take a few minutes...
atomic_dex::settings_page
-
+
@@ -4586,47 +4610,47 @@ This might take a few minutes...
Sie benötigen %1, um das Benzin für %2 Transaktionen zu bezahlen.
-
+
Überprüfung der Prüfsumme für %1 fehlgeschlagen.
-
+
Ungültige Prüfsumme für %1. Klicken Sie auf die Schaltfläche, um die Adresse in Groß-/Kleinschreibung umzuwandeln.
-
+
Legacy-Adresse für %1 verwendet. Klicken Sie auf die Schaltfläche, um sie in eine Cashadresse umzuwandeln.
-
+
%1 Adresse muss 0x vorangestellt werden
-
+
Länge der %1 Adresse ist ungültig, bitte verwenden Sie eine gültige Adresse.
-
+
%1 Adresse ist ungültig.
-
+
Ungültige Prüfsumme.
-
+
%1 Adresse hat ungültige Vorsilben.
-
+
Backend Fehler: %1
diff --git a/atomic_defi_design/assets/languages/atomic_defi_en.ts b/atomic_defi_design/assets/languages/atomic_defi_en.ts
index 7b6367813..2ce0fd7f4 100644
--- a/atomic_defi_design/assets/languages/atomic_defi_en.ts
+++ b/atomic_defi_design/assets/languages/atomic_defi_en.ts
@@ -515,17 +515,17 @@
Chart
-
-
+
+
-
+
-
+
@@ -1411,7 +1411,7 @@
General
-
+
@@ -1419,7 +1419,7 @@
-
+
day
@@ -1428,7 +1428,7 @@
-
+
hours
@@ -1437,7 +1437,7 @@
-
+
minutes
@@ -1446,7 +1446,7 @@
-
+
seconds
@@ -1455,7 +1455,7 @@
-
+
milliseconds
@@ -1464,117 +1464,117 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
WALLETNAME
-
-
+
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
@@ -1781,7 +1781,7 @@ Try again or select 'Allow custom seed' to continue.
-
+
@@ -1939,70 +1939,70 @@ They will be removed from the orderbook until you log in again.
-
-
-
-
+
+
-
-
+
+
+
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
@@ -2024,7 +2024,7 @@ They will be removed from the orderbook until you log in again.
-
+
@@ -2049,26 +2049,44 @@ They will be removed from the orderbook until you log in again.
-
+
+
+
+
+
+
-
+
-
+
-
+
+
+ Market
+
+
+
+
+
+
+
+
+
+
+
MarketModeSelector
@@ -2944,12 +2962,12 @@ Please select a new order.
ProView
-
+
-
+
@@ -3641,6 +3659,17 @@ Please select a new order.
+
+
+
+
+
+
+
+
+
+
+
@@ -3653,27 +3682,27 @@ Please select a new order.
-
+
-
+
-
+
-
-
+
+
-
+
@@ -4244,37 +4273,32 @@ There is a toggle in settings where you can turn on/off the display of these tra
TradeViewHeader
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
+
+
-
+
@@ -4435,8 +4459,8 @@ There is a toggle in settings where you can turn on/off the display of these tra
-
-
+
+
@@ -4553,7 +4577,7 @@ This might take a few minutes...
atomic_dex::settings_page
-
+
@@ -4576,47 +4600,47 @@ This might take a few minutes...
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/atomic_defi_design/assets/languages/atomic_defi_es.ts b/atomic_defi_design/assets/languages/atomic_defi_es.ts
index ece7e6033..d87b5995c 100644
--- a/atomic_defi_design/assets/languages/atomic_defi_es.ts
+++ b/atomic_defi_design/assets/languages/atomic_defi_es.ts
@@ -515,17 +515,17 @@
Chart
-
-
- Cargando datos de mercado
+
+
+
-
+
-
+
@@ -1411,7 +1411,7 @@
General
-
+
@@ -1419,7 +1419,7 @@
-
+
day
@@ -1428,7 +1428,7 @@
-
+
hours
@@ -1437,7 +1437,7 @@
-
+
minutes
@@ -1446,7 +1446,7 @@
-
+
seconds
@@ -1455,7 +1455,7 @@
-
+
milliseconds
@@ -1464,117 +1464,117 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
Cantidad Mínima de Intercambio
-
+
WALLETNAME
-
-
+
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
@@ -1782,7 +1782,7 @@ Vuelva a intentarlo o seleccione 'Permitir semilla personalizada' pers
-
+
Este pedido requiere una cantidad mínima de %1 %2 <br>No tiene fondos suficientes.<br> %3
@@ -1942,70 +1942,70 @@ Se eliminarán del libro de pedidos hasta que vuelva a iniciar sesión.Grifo
-
-
-
+
+
+
+
+
+
+
+
Clave Pública
-
+
Copiada en el Portapapeles
-
+
-
-
- Cargando datos de mercado
-
-
-
+
No hay datos de gráficos para este ticker aún
-
+
Obteniendo transacciones...
-
+
-
+
Por favor espera %1 es %2
-
-
- % activado...
+
+
+
-
-
- Información de Intercambios
+
+
+ % activado...
-
+
Gráfico
-
+
Pedidos
-
+
Historial
@@ -2027,7 +2027,7 @@ Se eliminarán del libro de pedidos hasta que vuelva a iniciar sesión.
-
+
Libreta de direcciones
@@ -2052,26 +2052,44 @@ Se eliminarán del libro de pedidos hasta que vuelva a iniciar sesión.Etiquetas
-
+
+
+
+
+
+
Editar
-
+
Eliminar
-
+
dirección copiada al portapapeles
-
+
Este contacto no tiene ninguna dirección registrada.
+
+ Market
+
+
+
+
+
+
+
+
+ Mejores Ordenes
+
+
MarketModeSelector
@@ -2948,12 +2966,12 @@ Seleccione un nuevo pedido.
ProView
-
+
Error al realizar el pedido
-
+
Realizó el pedido El
@@ -3645,6 +3663,17 @@ Seleccione un nuevo pedido.
Versión MM2 copiada al portapapeles.
+
+
+
+
+
+
+
+
+
+
+
@@ -3657,27 +3686,27 @@ Seleccione un nuevo pedido.
-
+
Versión Qt
-
+
Versión Qt
-
+
Versión de Qt copiada al portapapeles.
-
-
- Buscar Actualizacion
+
+
+
-
+
Cerrar sesión
@@ -4256,37 +4285,32 @@ There is a toggle in settings where you can turn on/off the display of these tra
TradeViewHeader
-
+
Vista de Configuración Pro
-
+
Configuracion de Vista
-
+
Selectores
-
+
Información de Intercambios
-
-
- Libro de Ordenes
-
-
-
-
- Mejores Ordenes
+
+
+
-
+
Realizar pedido
@@ -4447,8 +4471,8 @@ There is a toggle in settings where you can turn on/off the display of these tra
Libro de Ordenes
-
-
+
+
@@ -4566,7 +4590,7 @@ Esto puede tardar unos minutos...
atomic_dex::settings_page
-
+
Se ha producido un error.
@@ -4589,47 +4613,47 @@ Esto puede tardar unos minutos...
Necesita tener %1 para pagar la gasolina de %2 transacciones.
-
+
La verificación de la suma de comprobación falló para %1.
-
+
Suma de comprobación no válida para %1. Haga clic en el botón para convertir a dirección de mayúsculas y minúsculas.
-
+
Dirección heredada utilizada para %1. Haga clic en el botón para convertir a una dirección de efectivo.
-
+
La dirección %1 debe tener el prefijo 0x
-
+
La longitud de la dirección %1 no es válida, utilice una dirección válida.
-
+
La dirección %1 no es válida.
-
+
Suma de comprobación no válida.
-
+
La dirección %1 tiene prefijos no válidos.
-
+
Error de backend: %1
diff --git a/atomic_defi_design/assets/languages/atomic_defi_fr.ts b/atomic_defi_design/assets/languages/atomic_defi_fr.ts
index 2fd93a2b5..d1ce97688 100644
--- a/atomic_defi_design/assets/languages/atomic_defi_fr.ts
+++ b/atomic_defi_design/assets/languages/atomic_defi_fr.ts
@@ -515,17 +515,17 @@
Chart
-
-
- Chargement des données de marché
+
+
+
-
+
-
+
@@ -1411,7 +1411,7 @@
General
-
+
@@ -1419,7 +1419,7 @@
-
+
day
@@ -1428,7 +1428,7 @@
-
+
hours
@@ -1437,7 +1437,7 @@
-
+
minutes
@@ -1446,7 +1446,7 @@
-
+
seconds
@@ -1455,7 +1455,7 @@
-
+
milliseconds
@@ -1464,117 +1464,117 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
Montant de trading minimum
-
+
WALLETNAME
-
-
+
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
@@ -1781,7 +1781,7 @@ Try again or select 'Allow custom seed' to continue.
-
+
Cette commande nécessite un montant minimum de %1 %2 <br>Vous n'avez pas assez de fonds.<br> %3
@@ -1939,70 +1939,70 @@ They will be removed from the orderbook until you log in again.
Robinet
-
-
-
+
+
+
+
+
+
+
+
-
+
Copier dans le presse-papier
-
+
-
-
- Chargement des données de marché
-
-
-
+
Il n'y a pas encore de données graphiques pour ce ticker
-
+
-
+
-
+
-
-
+
+
-
-
- Informations de Trading
+
+
+
-
+
Chart
-
+
Ordres
-
+
Historique
@@ -2024,7 +2024,7 @@ They will be removed from the orderbook until you log in again.
-
+
Carnet d'adresses
@@ -2049,26 +2049,44 @@ They will be removed from the orderbook until you log in again.
Tags
-
+
+
+
+
+
+
Éditer
-
+
Supprimez
-
+
-
+
+
+ Market
+
+
+
+
+
+
+
+
+ Meilleurs offres
+
+
MarketModeSelector
@@ -2944,12 +2962,12 @@ Please select a new order.
ProView
-
+
Échec lors du placement de l'ordre
-
+
L'ordre a été placé avec succès
@@ -3570,6 +3588,11 @@ Please select a new order.
copié dans le presse-papier
+
+
+
+
+
@@ -3615,6 +3638,17 @@ Please select a new order.
MM2 Version copiée dans le presse-papiers.
+
+
+
+
+
+
+
+
+
+
+
@@ -3627,27 +3661,22 @@ Please select a new order.
-
+
Version de Qt
-
+
Qt Version
-
+
Version Qt copiée dans le presse-papiers.
-
-
- Rechercher une mise à jour
-
-
-
+
Se déconnecter
@@ -4244,37 +4273,32 @@ There is a toggle in settings where you can turn on/off the display of these tra
TradeViewHeader
-
+
-
+
-
+
-
+
Informations de Trading
-
-
- Carnet d'ordres
-
-
-
-
- Meilleurs offres
+
+
+
-
+
Placer l'ordre
@@ -4435,8 +4459,8 @@ There is a toggle in settings where you can turn on/off the display of these tra
Carnet d'ordres
-
-
+
+
@@ -4553,7 +4577,7 @@ This might take a few minutes...
atomic_dex::settings_page
-
+
@@ -4576,47 +4600,47 @@ This might take a few minutes...
Vous devez avoir %1 activée pour payer les frais de transactions de %2.
-
+
Échec de la vérification du checksum de contrôle pour %1.
-
+
-
+
-
+
L'adresse %1 doit être précédée de 0x
-
+
La longueur de l'adresse %1 n'est pas valide, veuillez utiliser une adresse valide.
-
+
L'adresse %1 n'est pas valide.
-
+
Somme de contrôle invalide.
-
+
L'adresse %1 a des préfixes non valides.
-
+
Erreur de backend : %1
diff --git a/atomic_defi_design/assets/languages/atomic_defi_ru.ts b/atomic_defi_design/assets/languages/atomic_defi_ru.ts
index a8d02cf8e..661ad8449 100644
--- a/atomic_defi_design/assets/languages/atomic_defi_ru.ts
+++ b/atomic_defi_design/assets/languages/atomic_defi_ru.ts
@@ -515,17 +515,17 @@
Chart
-
-
- Загрузка рыночных данных
+
+
+
-
+
-
+
@@ -1411,7 +1411,7 @@
General
-
+
@@ -1420,7 +1420,7 @@
-
+
day
@@ -1430,7 +1430,7 @@
-
+
hours
@@ -1440,7 +1440,7 @@
-
+
minutes
@@ -1450,7 +1450,7 @@
-
+
seconds
@@ -1460,7 +1460,7 @@
-
+
milliseconds
@@ -1470,117 +1470,117 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
Минимальный торговый объем
-
+
WALLETNAME
-
-
+
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
@@ -1787,7 +1787,7 @@ Try again or select 'Allow custom seed' to continue.
-
+
@@ -1945,70 +1945,70 @@ They will be removed from the orderbook until you log in again.
Фаусет
-
-
-
+
+
+
+
+
+
+
+
-
+
Скопировано в буфер обмена
-
+
-
-
- Загрузка рыночных данных
-
-
-
+
Для данного актива пока еще нет графиков данных
-
+
-
+
-
+
-
-
+
+
-
-
- Торговая информация
+
+
+
-
+
График
-
+
Ордеры
-
+
История
@@ -2030,7 +2030,7 @@ They will be removed from the orderbook until you log in again.
-
+
Адресная книга
@@ -2055,26 +2055,44 @@ They will be removed from the orderbook until you log in again.
Теги
-
+
+
+
+
+
+
Редактировать
-
+
Удалить
-
+
-
+
+
+ Market
+
+
+
+
+
+
+
+
+ Лучшие ордеры
+
+
MarketModeSelector
@@ -2950,12 +2968,12 @@ Please select a new order.
ProView
-
+
Не удалось разместить ордер
-
+
Ордер размещен
@@ -3576,6 +3594,11 @@ Please select a new order.
скопировано в буфер
+
+
+
+
+
@@ -3621,6 +3644,17 @@ Please select a new order.
Версия MM2 скопирована в буфер обмена.
+
+
+
+
+
+
+
+
+
+
+
@@ -3633,27 +3667,22 @@ Please select a new order.
-
+
Версия Qt
-
+
Версия Qt
-
+
Версия Qt скопирована в буфер обмена.
-
-
- Проверить на обновления
-
-
-
+
Выход
@@ -4250,37 +4279,32 @@ There is a toggle in settings where you can turn on/off the display of these tra
TradeViewHeader
-
+
-
+
-
+
-
+
Торговая информация
-
-
- Ордербук
-
-
-
-
- Лучшие ордеры
+
+
+
-
+
Разместить ордер
@@ -4441,8 +4465,8 @@ There is a toggle in settings where you can turn on/off the display of these tra
Ордербук
-
-
+
+
@@ -4559,7 +4583,7 @@ This might take a few minutes...
atomic_dex::settings_page
-
+
@@ -4582,47 +4606,47 @@ This might take a few minutes...
Вам нужен %1 для оплаты газа за %2 транзакции.
-
+
Checksum верфикация неуспешна для %1.
-
+
-
+
-
+
%1 адрес должен начинаться с 0x
-
+
%1 длина адреса не валидна, пожалуйста используйте валидный адрес.
-
+
некорректный адрес %1.
-
+
Неверная чек-сумма.
-
+
у адреса %1 неверный префикс.
-
+
Ошибка бэкенда: %1
diff --git a/atomic_defi_design/assets/languages/atomic_defi_tr.ts b/atomic_defi_design/assets/languages/atomic_defi_tr.ts
index 49f3e80d6..ecda9ba8e 100644
--- a/atomic_defi_design/assets/languages/atomic_defi_tr.ts
+++ b/atomic_defi_design/assets/languages/atomic_defi_tr.ts
@@ -515,17 +515,17 @@
Chart
-
-
- Piyasa bilgisi yükleniyor
+
+
+
-
+
-
+
@@ -1411,14 +1411,14 @@
General
-
+
-
+
day
@@ -1426,7 +1426,7 @@
-
+
hours
@@ -1434,7 +1434,7 @@
-
+
minutes
@@ -1442,7 +1442,7 @@
-
+
seconds
@@ -1450,7 +1450,7 @@
-
+
milliseconds
@@ -1458,117 +1458,117 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
Minimum Takas Tutarı
-
+
WALLETNAME
-
-
+
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
@@ -1775,7 +1775,7 @@ Try again or select 'Allow custom seed' to continue.
-
+
@@ -1933,70 +1933,70 @@ They will be removed from the orderbook until you log in again.
Musluk
-
-
-
+
+
+
+
+
+
+
+
-
+
Panoya Kopyalandı
-
+
-
-
- Piyasa bilgisi yükleniyor
-
-
-
+
Henüz bu hisse senedi için grafik verisi yok
-
+
-
+
-
+
-
-
+
+
-
-
- Al Sat Bilgisi
+
+
+
-
+
Grafik
-
+
Emirler
-
+
Tarihçe
@@ -2018,7 +2018,7 @@ They will be removed from the orderbook until you log in again.
-
+
Adres Defteri
@@ -2043,26 +2043,44 @@ They will be removed from the orderbook until you log in again.
Etiketler
-
+
+
+
+
+
+
Düzenle
-
+
Sil
-
+
-
+
+
+ Market
+
+
+
+
+
+
+
+
+ En İyi Emirler
+
+
MarketModeSelector
@@ -2938,12 +2956,12 @@ Please select a new order.
ProView
-
+
Emir başarısız oldu
-
+
Emir başarılı
@@ -3564,6 +3582,11 @@ Please select a new order.
+
+
+
+
+
@@ -3609,6 +3632,17 @@ Please select a new order.
+
+
+
+
+
+
+
+
+
+
+
@@ -3621,27 +3655,22 @@ Please select a new order.
-
+
Qt sürümü
-
+
-
+
-
-
- Güncelleme Ara
-
-
-
+
Çıkış
@@ -4238,37 +4267,32 @@ There is a toggle in settings where you can turn on/off the display of these tra
TradeViewHeader
-
+
-
+
-
+
-
+
Al Sat Bilgisi
-
-
- Emir Defteri
-
-
-
-
- En İyi Emirler
+
+
+
-
+
Emir Ver
@@ -4429,8 +4453,8 @@ There is a toggle in settings where you can turn on/off the display of these tra
Emir Defteri
-
-
+
+
@@ -4547,7 +4571,7 @@ This might take a few minutes...
atomic_dex::settings_page
-
+
@@ -4570,47 +4594,47 @@ This might take a few minutes...
%2 işlemi için gaz ödemek üzere %1'e sahip olmanız gerekir.
-
+
%1 için sağlama toplamı doğrulaması başarısız oldu.
-
+
-
+
-
+
%1 adresinin önüne 0x konulmalı
-
+
%1 adres uzunluğu geçersiz, lütfen geçerli bir adres kullanın.
-
+
-
+
-
+
-
+
diff --git a/src/app/app.cpp b/src/app/app.cpp
index 54cfc55fb..a3a8fdf0c 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -43,7 +43,6 @@
#include "atomicdex/services/mm2/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/coinpaprika/coinpaprika.provider.hpp"
#include "atomicdex/services/price/orderbook.scanner.service.hpp"
namespace
@@ -346,9 +345,6 @@ namespace atomic_dex
if (m_event_actions[events_action::need_a_full_refresh_of_mm2])
{
system_manager_.create_system(system_manager_);
-
- // 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;
}
@@ -500,8 +496,6 @@ namespace atomic_dex
system_manager_.create_system(system_manager_, settings_page_system.get_cfg());
system_manager_.create_system(system_manager_);
system_manager_.create_system(system_manager_);
- //system_manager_.create_system(system_manager_);
- //system_manager_.create_system(system_manager_);
system_manager_.create_system();
system_manager_.create_system();
system_manager_.create_system(system_manager_);
diff --git a/src/core/atomicdex/api/coinpaprika/coinpaprika.cpp b/src/core/atomicdex/api/coinpaprika/coinpaprika.cpp
deleted file mode 100644
index 0287e1330..000000000
--- a/src/core/atomicdex/api/coinpaprika/coinpaprika.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/******************************************************************************
- * 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. *
- * *
- ******************************************************************************/
-
-//! Deps
-#include
-#include
-
-//! Project Headers
-#include "atomicdex/api/coinpaprika/coinpaprika.hpp"
-#include "atomicdex/utilities/global.utilities.hpp"
-
-//! Private
-#include "atomicdex/utilities/nlohmann.json.sax.private.cpp"
-
-namespace
-{
- //! Constants
- constexpr const char* g_coinpaprika_endpoint = "https://api.coinpaprika.com/v1/";
- web::http::client::http_client_config g_paprika_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_coinpaprika_client = std::make_unique(FROM_STD_STR(g_coinpaprika_endpoint), g_paprika_cfg);
-} // namespace
-
-namespace atomic_dex
-{
- namespace coinpaprika::api
- {
- void
- to_json(nlohmann::json& j, const price_converter_request& evt)
- {
- j["base_currency_id"] = evt.base_currency_id;
- j["quote_currency_id"] = evt.quote_currency_id;
- j["amount"] = 1;
- }
-
- void
- from_json(const nlohmann::json& j, price_converter_answer& evt)
- {
- // utils::details::my_json_sax sx;
- // nlohmann::json::sax_parse(j.dump(), &sx);
-
- evt.base_currency_id = j.at("base_currency_id").get();
- evt.base_currency_name = j.at("base_currency_name").get();
- evt.base_price_last_updated = j.at("base_price_last_updated").get();
- evt.quote_currency_id = j.at("quote_currency_id").get();
- evt.quote_currency_name = j.at("quote_currency_name").get();
- evt.quote_price_last_updated = j.at("quote_price_last_updated").get();
- evt.amount = j.at("amount").get();
- evt.price = std::to_string(j.at("price").get());
-
- std::replace(evt.price.begin(), evt.price.end(), ',', '.');
- }
-
- void
- from_json(const nlohmann::json& j, ticker_info_answer& evt)
- {
- evt.answer = j.at("quotes");
- }
-
- void
- from_json(const nlohmann::json& j, ticker_historical_answer& evt)
- {
- evt.answer = j;
- }
-
- pplx::task
- async_price_converter(const price_converter_request& request)
- {
- using namespace std::string_literals;
- web::http::http_request req;
- req.set_method(web::http::methods::GET);
- auto&& [base_id, quote_id] = request;
- const auto url = "/price-converter?base_currency_id="s + base_id + ""e_currency_id="s + quote_id + "&amount=1"s;
- req.set_request_uri(FROM_STD_STR(url));
- return g_coinpaprika_client->request(req);
- }
-
- pplx::task
- async_ticker_info(const ticker_infos_request& request)
- {
- using ranges::views::ints;
- using ranges::views::zip;
- using namespace std::string_literals;
- web::http::http_request req;
- req.set_method(web::http::methods::GET);
- auto&& [ticker_id, quotes] = request;
- auto url = "/tickers/"s + ticker_id + "?quotes="s;
- for (auto&& [cur_quote, idx]: zip(quotes, ints(0u, ranges::unreachable)))
- {
- url.append(cur_quote);
-
- //! Append only if not last element, idx start at 0, if idx + 1 == quotes.size(), we are on the last elemnt, we don't append.
- if (idx < quotes.size() - 1)
- {
- url.append(",");
- }
- }
- SPDLOG_INFO("url: {}", TO_STD_STR(g_coinpaprika_client->base_uri().to_string()) + url);
- req.set_request_uri(FROM_STD_STR(url));
- return g_coinpaprika_client->request(req);
- }
-
- pplx::task
- async_ticker_historical(const ticker_historical_request& request)
- {
- using namespace std::string_literals;
- web::http::http_request req;
- req.set_method(web::http::methods::GET);
- auto&& [ticker_id, timestamp, interval] = request;
- const auto url = "/tickers/"s + ticker_id + "/historical?start="s + std::to_string(timestamp) + "&interval="s + interval;
- SPDLOG_INFO("url: {}", url);
- req.set_request_uri(FROM_STD_STR(url));
- return g_coinpaprika_client->request(req);
- }
- } // namespace coinpaprika::api
-} // namespace atomic_dex
diff --git a/src/core/atomicdex/api/coinpaprika/coinpaprika.hpp b/src/core/atomicdex/api/coinpaprika/coinpaprika.hpp
deleted file mode 100644
index 3650d3f73..000000000
--- a/src/core/atomicdex/api/coinpaprika/coinpaprika.hpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/******************************************************************************
- * 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
-
-//! Deps
-#include
-#include
-#include
-
-//! Project Headers
-#include "atomicdex/utilities/cpprestsdk.utilities.hpp"
-
-namespace
-{
- constexpr const std::size_t g_nb_hours_in_a_week{168};
-}
-
-namespace atomic_dex
-{
- namespace coinpaprika::api
- {
- struct ticker_historical_request
- {
- std::string ticker_currency_id;
- std::size_t timestamp{static_cast(
- std::chrono::duration_cast((std::chrono::system_clock::now() - std::chrono::hours(g_nb_hours_in_a_week)).time_since_epoch()).count())};
- std::string interval{"1d"};
- };
-
- struct ticker_historical_answer
- {
- nlohmann::json answer{nlohmann::json::array()};
- int rpc_result_code;
- std::string raw_result;
- };
-
- struct ticker_infos_request
- {
- std::string ticker_currency_id;
- std::vector ticker_quotes;
- };
-
- struct ticker_info_answer
- {
- nlohmann::json answer;
- int rpc_result_code;
- std::string raw_result;
- };
-
- struct price_converter_request
- {
- std::string base_currency_id;
- std::string quote_currency_id;
- };
-
- struct price_converter_answer
- {
- std::string base_currency_id;
- std::string base_currency_name;
- std::string base_price_last_updated;
- std::string quote_currency_id;
- std::string quote_currency_name;
- std::string quote_price_last_updated;
- std::size_t amount;
- std::string price{"0.00"}; ///< we need trick here
- int rpc_result_code;
- std::string raw_result;
- };
-
- void to_json(nlohmann::json& j, const price_converter_request& evt);
-
- void from_json(const nlohmann::json& j, price_converter_answer& evt);
-
- void from_json(const nlohmann::json& j, ticker_info_answer& evt);
-
- void from_json(const nlohmann::json& j, ticker_historical_answer& evt);
-
- pplx::task async_price_converter(const price_converter_request& request);
- pplx::task async_ticker_info(const ticker_infos_request& request);
- pplx::task async_ticker_historical(const ticker_historical_request& request);
-
- template
- TAnswer static inline process_generic_resp(web::http::http_response resp)
- {
- TAnswer answer;
- std::string body = TO_STD_STR(resp.extract_string(true).get());
- if (resp.status_code() == static_cast(antara::app::http_code::bad_request))
- {
- SPDLOG_WARN("rpc answer code is 400 (Bad Parameters), body: {}", body);
- answer.rpc_result_code = resp.status_code();
- answer.raw_result = body;
- return answer;
- }
- if (resp.status_code() == static_cast(antara::app::http_code::too_many_requests))
- {
- SPDLOG_WARN("rpc answer code is 429 (Too Many requests), body: {}", body);
- answer.rpc_result_code = resp.status_code();
- answer.raw_result = body;
- return answer;
- }
- try
- {
- const auto json_answer = nlohmann::json::parse(body);
- from_json(json_answer, answer);
- answer.rpc_result_code = resp.status_code();
- answer.raw_result = body;
- }
- catch (const std::exception& error)
- {
- SPDLOG_ERROR("exception caught: error[{}], body: {}", error.what(), body);
- answer.rpc_result_code = -1;
- answer.raw_result = error.what();
- }
- return answer;
- }
- } // namespace coinpaprika::api
-
-
- using t_price_converter_answer = coinpaprika::api::price_converter_answer;
- using t_price_converter_request = coinpaprika::api::price_converter_request;
- using t_ticker_info_answer = coinpaprika::api::ticker_info_answer;
- using t_ticker_infos_request = coinpaprika::api::ticker_infos_request;
- using t_ticker_historical_answer = coinpaprika::api::ticker_historical_answer;
- using t_ticker_historical_request = coinpaprika::api::ticker_historical_request;
-} // namespace atomic_dex
diff --git a/src/core/atomicdex/api/mm2/mm2.cpp b/src/core/atomicdex/api/mm2/mm2.cpp
index 097146417..794fadb2c 100644
--- a/src/core/atomicdex/api/mm2/mm2.cpp
+++ b/src/core/atomicdex/api/mm2/mm2.cpp
@@ -293,7 +293,8 @@ namespace atomic_dex::mm2
.is_swap = false,
.is_cancellable = value.at("cancellable").get(),
.is_recoverable = false,
- .min_volume = is_maker ? QString::fromStdString(value.at("min_base_vol").get()) : std::optional(std::nullopt),
+ .min_volume = is_maker ? QString::fromStdString(value.at("min_base_vol").get()) : "",
+ .max_volume = is_maker ? QString::fromStdString(value.at("max_base_vol").get()) : "",
.conf_settings = conf_settings};
if (action.empty() && contents.order_type == "maker")
{
diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.buy.cpp b/src/core/atomicdex/api/mm2/rpc_v1/rpc.buy.cpp
index 06778770c..00f168072 100644
--- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.buy.cpp
+++ b/src/core/atomicdex/api/mm2/rpc_v1/rpc.buy.cpp
@@ -15,7 +15,6 @@
******************************************************************************/
//! Deps
-#include
#include
//! Project Headers
@@ -75,5 +74,9 @@ namespace atomic_dex::mm2
{
SPDLOG_INFO("The order is not picked from orderbook we create it from volume = {}, price = {}", j.at("volume").dump(4), request.price);
}
+ if (request.order_type.has_value())
+ {
+ j["order_type"] = request.order_type.value();
+ }
}
} // namespace atomic_dex::mm2
\ No newline at end of file
diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.buy.hpp b/src/core/atomicdex/api/mm2/rpc_v1/rpc.buy.hpp
index 5e31e108e..8ad547d30 100644
--- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.buy.hpp
+++ b/src/core/atomicdex/api/mm2/rpc_v1/rpc.buy.hpp
@@ -21,7 +21,7 @@
#include
//! Deps
-#include
+#include
//! Project Header
#include
@@ -43,7 +43,9 @@ namespace atomic_dex::mm2
bool selected_order_use_input_volume{false};
std::optional base_nota{std::nullopt};
std::optional base_confs{std::nullopt};
+ // bool is_max;
std::optional min_volume{std::nullopt};
+ std::optional order_type;
};
void to_json(nlohmann::json& j, const buy_request& request);
diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.sell.cpp b/src/core/atomicdex/api/mm2/rpc_v1/rpc.sell.cpp
index 6779feb36..4566ea7e4 100644
--- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.sell.cpp
+++ b/src/core/atomicdex/api/mm2/rpc_v1/rpc.sell.cpp
@@ -15,7 +15,6 @@
******************************************************************************/
//! Deps
-#include
#include
//! Project Headers
diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.setprice.cpp b/src/core/atomicdex/api/mm2/rpc_v1/rpc.setprice.cpp
index a9d0816d7..6977cefa9 100644
--- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.setprice.cpp
+++ b/src/core/atomicdex/api/mm2/rpc_v1/rpc.setprice.cpp
@@ -28,8 +28,10 @@ namespace atomic_dex::mm2
j["price"] = request.price;
j["rel"] = request.rel;
j["volume"] = request.volume;
- j["cancel_previous"] = request.cancel_previous;
- j["max"] = request.max;
+ if (request.cancel_previous.has_value())
+ {
+ j["cancel_previous"] = request.cancel_previous.value();
+ }
if (request.base_nota.has_value())
{
j["base_nota"] = request.base_nota.value();
diff --git a/src/core/atomicdex/api/mm2/rpc_v1/rpc.setprice.hpp b/src/core/atomicdex/api/mm2/rpc_v1/rpc.setprice.hpp
index 8eb234e27..f169a0002 100644
--- a/src/core/atomicdex/api/mm2/rpc_v1/rpc.setprice.hpp
+++ b/src/core/atomicdex/api/mm2/rpc_v1/rpc.setprice.hpp
@@ -31,8 +31,7 @@ namespace atomic_dex::mm2
std::string rel;
std::string price;
std::string volume;
- bool max{false};
- bool cancel_previous{false};
+ std::optional cancel_previous{false};
std::optional base_nota;
std::optional base_confs;
std::optional rel_nota;
diff --git a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.orderbook.cpp b/src/core/atomicdex/api/mm2/rpc_v2/rpc2.orderbook.cpp
index f80fa1ec5..9831628f4 100644
--- a/src/core/atomicdex/api/mm2/rpc_v2/rpc2.orderbook.cpp
+++ b/src/core/atomicdex/api/mm2/rpc_v2/rpc2.orderbook.cpp
@@ -40,7 +40,6 @@ namespace atomic_dex::mm2
if (j.contains("result"))
{
// Not sure how why where it is being returned in this format
- SPDLOG_DEBUG("orderbook_result_rpc: result");
j.at("result").at("rel").get_to(resp.rel);
j.at("result").at("num_asks").get_to(resp.numasks);
j.at("result").at("num_bids").get_to(resp.numbids);
@@ -52,7 +51,6 @@ namespace atomic_dex::mm2
}
else
{
- SPDLOG_DEBUG("orderbook_result_rpc: base");
j.at("base").get_to(resp.base);
j.at("rel").get_to(resp.rel);
j.at("num_asks").get_to(resp.numasks);
diff --git a/src/core/atomicdex/config/app.cfg.cpp b/src/core/atomicdex/config/app.cfg.cpp
index 78ec9fda0..770b7be2e 100644
--- a/src/core/atomicdex/config/app.cfg.cpp
+++ b/src/core/atomicdex/config/app.cfg.cpp
@@ -165,7 +165,7 @@ namespace atomic_dex
//! If it's fiat, i set the first element of the possible currencies to the new currency (the new fiat here) and i also set the current fiat
if (is_this_currency_a_fiat(config, new_currency))
{
- SPDLOG_INFO("{} is fiat, setting it as current fiat and possible currencies", new_currency);
+ // SPDLOG_INFO("{} is fiat, setting it as current fiat and possible currencies", new_currency);
config.current_fiat = new_currency;
config.current_fiat_sign = config.current_currency_sign;
config.possible_currencies[0] = new_currency;
@@ -173,11 +173,11 @@ namespace atomic_dex
if (std::count(config.recommended_fiat.begin(), config.recommended_fiat.end(), new_currency))
{
- SPDLOG_INFO("{} is already in recommended fiats", new_currency);
+ // SPDLOG_INFO("{} is already in recommended fiats", new_currency);
update_recommended_fiat = false;
}
if (update_recommended_fiat) {
- SPDLOG_INFO("Adding {} to recommended fiats", new_currency);
+ // SPDLOG_INFO("Adding {} to recommended fiats", new_currency);
config.recommended_fiat.pop_back();
config.recommended_fiat.insert(config.recommended_fiat.begin(), new_currency);
}
diff --git a/src/core/atomicdex/config/coins.cfg.cpp b/src/core/atomicdex/config/coins.cfg.cpp
index 1f846b537..9f0d9c806 100644
--- a/src/core/atomicdex/config/coins.cfg.cpp
+++ b/src/core/atomicdex/config/coins.cfg.cpp
@@ -149,6 +149,11 @@ namespace atomic_dex
{
return std::any_of(g_faucet_coins.begin(), g_faucet_coins.end(), [ticker](std::string x) { return ticker == x; });
}
+ bool
+ is_vote_coin(std::string ticker)
+ {
+ return std::any_of(g_vote_coins.begin(), g_vote_coins.end(), [ticker](std::string x) { return ticker == x; });
+ }
void
from_json(const nlohmann::json& j, coin_config_t& cfg)
@@ -172,6 +177,7 @@ namespace atomic_dex
cfg.wallet_only = is_wallet_only(cfg.ticker) ? is_wallet_only(cfg.ticker) : j.contains("wallet_only") ? j.at("wallet_only").get() : false;
cfg.default_coin = is_default_coin(cfg.ticker);
cfg.is_faucet_coin = is_faucet_coin(cfg.ticker);
+ cfg.is_vote_coin = is_vote_coin(cfg.ticker);
cfg.checkpoint_height = 0;
cfg.checkpoint_blocktime = 0;
using namespace std::chrono;
@@ -286,21 +292,21 @@ namespace atomic_dex
{
case CoinType::QRC20:
cfg.has_parent_fees_ticker = true;
- cfg.fees_ticker = cfg.is_testnet.value() ? "tQTUM" : "QTUM";
+ cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "tQTUM" : "QTUM";
break;
case CoinType::ERC20:
cfg.has_parent_fees_ticker = true;
- cfg.fees_ticker = cfg.is_testnet.value() ? "ETHR" : "ETH";
+ cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "ETHR" : "ETH";
cfg.is_erc_family = true;
break;
case CoinType::BEP20:
cfg.has_parent_fees_ticker = true;
- cfg.fees_ticker = cfg.is_testnet.value() ? "BNBT" : "BNB";
+ cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "BNBT" : "BNB";
cfg.is_erc_family = true;
break;
case CoinType::PLG20:
cfg.has_parent_fees_ticker = true;
- cfg.fees_ticker = cfg.is_testnet.value() ? "MATICTEST" : "MATIC";
+ cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "MATICTEST" : "MATIC";
cfg.is_erc_family = true;
break;
case CoinType::Optimism:
@@ -320,62 +326,62 @@ namespace atomic_dex
break;
case CoinType::AVX20:
cfg.has_parent_fees_ticker = true;
- cfg.fees_ticker = cfg.is_testnet.value() ? "AVAXT" : "AVAX";
+ cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "AVAXT" : "AVAX";
cfg.is_erc_family = true;
break;
case CoinType::FTM20:
cfg.has_parent_fees_ticker = true;
- cfg.fees_ticker = cfg.is_testnet.value() ? "FTMT" : "FTM";
+ cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "FTMT" : "FTM";
cfg.is_erc_family = true;
break;
case CoinType::HRC20:
cfg.has_parent_fees_ticker = true;
- cfg.fees_ticker = cfg.is_testnet.value() ? "ONET" : "ONE";
+ cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "ONET" : "ONE";
cfg.is_erc_family = true;
break;
case CoinType::Ubiq:
cfg.has_parent_fees_ticker = true;
- cfg.fees_ticker = cfg.is_testnet.value() ? "UBQT" : "UBQ";
+ cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "UBQT" : "UBQ";
cfg.is_erc_family = true;
break;
case CoinType::KRC20:
cfg.has_parent_fees_ticker = true;
- cfg.fees_ticker = cfg.is_testnet.value() ? "KCST" : "KCS";
+ cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "KCST" : "KCS";
cfg.is_erc_family = true;
break;
case CoinType::Moonriver:
cfg.has_parent_fees_ticker = true;
- cfg.fees_ticker = cfg.is_testnet.value() ? "MOVRT" : "MOVR";
+ cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "MOVRT" : "MOVR";
cfg.is_erc_family = true;
break;
case CoinType::Moonbeam:
cfg.has_parent_fees_ticker = true;
- cfg.fees_ticker = cfg.is_testnet.value() ? "GLMRT" : "GLMR";
+ cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "GLMRT" : "GLMR";
cfg.is_erc_family = true;
break;
case CoinType::HecoChain:
cfg.has_parent_fees_ticker = true;
- cfg.fees_ticker = cfg.is_testnet.value() ? "HTT" : "HT";
+ cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "HTT" : "HT";
cfg.is_erc_family = true;
break;
case CoinType::SmartBCH:
cfg.has_parent_fees_ticker = true;
- cfg.fees_ticker = cfg.is_testnet.value() ? "SBCHT" : "SBCH";
+ cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "SBCHT" : "SBCH";
cfg.is_erc_family = true;
break;
case CoinType::EthereumClassic:
cfg.has_parent_fees_ticker = true;
- cfg.fees_ticker = cfg.is_testnet.value() ? "ETCT" : "ETC";
+ cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "ETCT" : "ETC";
cfg.is_erc_family = true;
break;
case CoinType::RSK:
cfg.has_parent_fees_ticker = true;
- cfg.fees_ticker = cfg.is_testnet.value() ? "RBTCT" : "RBTC";
+ cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "RBTCT" : "RBTC";
cfg.is_erc_family = true;
break;
case CoinType::SLP:
cfg.has_parent_fees_ticker = true;
- cfg.fees_ticker = cfg.is_testnet.value() ? "tBCH" : "BCH";
+ cfg.fees_ticker = cfg.is_testnet.value_or(false) ? "tBCH" : "BCH";
break;
case CoinType::TENDERMINT:
cfg.has_parent_fees_ticker = true;
diff --git a/src/core/atomicdex/config/coins.cfg.hpp b/src/core/atomicdex/config/coins.cfg.hpp
index 457b432e8..7fb2927dd 100644
--- a/src/core/atomicdex/config/coins.cfg.hpp
+++ b/src/core/atomicdex/config/coins.cfg.hpp
@@ -67,6 +67,7 @@ namespace atomic_dex
bool has_memos{false};
bool is_custom_coin{false};
bool is_faucet_coin{false};
+ bool is_vote_coin{false};
bool currently_enabled{false};
bool has_parent_fees_ticker{false}; ///< True if parent fees is different from current ticker eg: ERC20 tokens
bool is_erc_family{false};
@@ -102,5 +103,6 @@ namespace atomic_dex
bool is_wallet_only(std::string ticker);
bool is_default_coin(std::string ticker);
bool is_faucet_coin(std::string ticker);
+ bool is_vote_coin(std::string ticker);
} // namespace atomic_dex
\ No newline at end of file
diff --git a/src/core/atomicdex/constants/dex.constants.hpp b/src/core/atomicdex/constants/dex.constants.hpp
index 350793b46..7cda6d181 100644
--- a/src/core/atomicdex/constants/dex.constants.hpp
+++ b/src/core/atomicdex/constants/dex.constants.hpp
@@ -17,7 +17,15 @@ namespace atomic_dex
"DOC",
"MARTY",
"ZOMBIE",
+ "IRISTEST",
};
+ inline const std::vector g_vote_coins{
+ "KIP0002",
+ "KIP0003",
+ "KIP0004",
+ "VOTE2024",
+ };
+
inline const std::vector g_wallet_only_coins{
"ARRR-BEP20",
"RBTC",
@@ -25,7 +33,10 @@ namespace atomic_dex
"PAXG-ERC20",
"USDT-ERC20",
"XPM",
- "VOTE2023",
+ "KIP0002",
+ "KIP0003",
+ "KIP0004",
+ "VOTE2024",
"ATOM"
};
}
diff --git a/src/core/atomicdex/data/dex/qt.orders.data.hpp b/src/core/atomicdex/data/dex/qt.orders.data.hpp
index 27f0859ed..d5723bb8f 100644
--- a/src/core/atomicdex/data/dex/qt.orders.data.hpp
+++ b/src/core/atomicdex/data/dex/qt.orders.data.hpp
@@ -85,7 +85,8 @@ namespace atomic_dex::mm2
bool is_swap_active{false};
//! Only available for maker order
- std::optional min_volume{std::nullopt};
+ QString min_volume;
+ QString max_volume;
std::optional conf_settings{std::nullopt};
};
} // namespace atomic_dex::mm2
diff --git a/src/core/atomicdex/models/qt.orderbook.model.hpp b/src/core/atomicdex/models/qt.orderbook.model.hpp
index 2ec3b7ef8..debd89eba 100644
--- a/src/core/atomicdex/models/qt.orderbook.model.hpp
+++ b/src/core/atomicdex/models/qt.orderbook.model.hpp
@@ -53,30 +53,30 @@ namespace atomic_dex
PriceRole = Qt::UserRole + 1, // 257
CoinRole,
TotalRole,
- UUIDRole,
+ UUIDRole, // 260
IsMineRole,
PriceDenomRole,
PriceNumerRole,
PercentDepthRole,
- MinVolumeRole,
+ MinVolumeRole, // 265
EnoughFundsToPayMinVolume,
CEXRatesRole,
SendRole,
PriceFiatRole,
- HaveCEXIDRole,
+ HaveCEXIDRole, // 270
BaseMinVolumeRole,
BaseMinVolumeDenomRole,
BaseMinVolumeNumerRole,
BaseMaxVolumeRole,
- BaseMaxVolumeDenomRole,
+ BaseMaxVolumeDenomRole, // 275
BaseMaxVolumeNumerRole,
RelMinVolumeRole,
RelMinVolumeDenomRole,
RelMinVolumeNumerRole,
- RelMaxVolumeRole,
+ RelMaxVolumeRole, // 280
RelMaxVolumeDenomRole,
RelMaxVolumeNumerRole,
- NameAndTicker
+ NameAndTicker // 283
};
orderbook_model(kind orderbook_kind, ag::ecs::system_manager& system_mgr, QObject* parent = nullptr);
diff --git a/src/core/atomicdex/models/qt.orderbook.proxy.model.cpp b/src/core/atomicdex/models/qt.orderbook.proxy.model.cpp
index 28b47ab51..6117bf3eb 100644
--- a/src/core/atomicdex/models/qt.orderbook.proxy.model.cpp
+++ b/src/core/atomicdex/models/qt.orderbook.proxy.model.cpp
@@ -155,23 +155,34 @@ namespace atomic_dex
case orderbook_model::kind::bids:
break;
case orderbook_model::kind::best_orders:
- t_float_50 rates = safe_float(this->sourceModel()->data(idx, orderbook_model::CEXRatesRole).toString().toStdString());
- t_float_50 fiat_price = safe_float(this->sourceModel()->data(idx, orderbook_model::PriceFiatRole).toString().toStdString());
- std::string ticker = this->sourceModel()->data(idx, orderbook_model::CoinRole).toString().toStdString();
- const auto& provider = this->m_system_mgr.get_system();
- const auto coin_info = this->m_system_mgr.get_system().get_global_cfg()->get_coin_info(ticker);
t_float_50 limit("10000");
+ t_float_50 rates = safe_float(this->sourceModel()->data(idx, orderbook_model::CEXRatesRole).toString().toStdString());
+ t_float_50 fiat_price = safe_float(this->sourceModel()->data(idx, orderbook_model::PriceFiatRole).toString().toStdString());
bool is_cex_id_available = this->sourceModel()->data(idx, orderbook_model::HaveCEXIDRole).toBool();
- const auto volume = provider.get_total_volume(utils::retrieve_main_ticker(ticker));
+ const auto& provider = this->m_system_mgr.get_system();
+ std::string ticker = this->sourceModel()->data(idx, orderbook_model::CoinRole).toString().toStdString();
+ const auto coin_info = this->m_system_mgr.get_system().get_global_cfg()->get_coin_info(ticker);
+ const auto volume = provider.get_total_volume(utils::retrieve_main_ticker(ticker));
+ std::string left_ticker = this->m_system_mgr.get_system().get_market_pairs_mdl()->get_left_selected_coin().toStdString();
+ const auto left_coin_info = this->m_system_mgr.get_system().get_global_cfg()->get_coin_info(left_ticker);
+
if (coin_info.ticker.empty() || coin_info.wallet_only) //< this means it's not present in our cfg - skipping
{
return false;
}
+ if (left_coin_info.is_testnet.value_or(false))
+ {
+ if (coin_info.is_testnet.value_or(false))
+ {
+ return true;
+ }
+ return false;
+ }
if (is_cex_id_available && (rates > 100 || fiat_price <= 0 || ((safe_float(volume) < limit) && coin_info.coin_type != CoinType::SmartChain)))
{
return false;
}
- break;
+ return true;
}
}
diff --git a/src/core/atomicdex/models/qt.orders.model.cpp b/src/core/atomicdex/models/qt.orders.model.cpp
index 72ba1c644..462d8f8d8 100644
--- a/src/core/atomicdex/models/qt.orders.model.cpp
+++ b/src/core/atomicdex/models/qt.orders.model.cpp
@@ -82,6 +82,12 @@ namespace atomic_dex
case RelCoinAmountCurrentCurrencyRole:
item.rel_amount_fiat = value.toString();
break;
+ case MinVolumeRole:
+ item.min_volume = value.toString();
+ break;
+ case MaxVolumeRole:
+ item.max_volume = value.toString();
+ break;
case OrderTypeRole:
item.order_type = value.toString();
break;
@@ -166,6 +172,10 @@ namespace atomic_dex
return item.rel_amount;
case RelCoinAmountCurrentCurrencyRole:
return item.rel_amount_fiat;
+ case MinVolumeRole:
+ return item.min_volume;
+ case MaxVolumeRole:
+ return item.max_volume;
case OrderTypeRole:
return item.order_type;
case HumanDateRole:
@@ -233,6 +243,8 @@ namespace atomic_dex
{BaseCoinAmountCurrentCurrencyRole, "base_amount_current_currency"},
{RelCoinAmountRole, "rel_amount"},
{RelCoinAmountCurrentCurrencyRole, "rel_amount_current_currency"},
+ {MinVolumeRole, "min_volume"},
+ {MaxVolumeRole, "max_volume"},
{OrderTypeRole, "type"},
{IsMakerRole, "is_maker"},
{HumanDateRole, "date"},
diff --git a/src/core/atomicdex/models/qt.orders.model.hpp b/src/core/atomicdex/models/qt.orders.model.hpp
index bb00288a2..e58568d05 100644
--- a/src/core/atomicdex/models/qt.orders.model.hpp
+++ b/src/core/atomicdex/models/qt.orders.model.hpp
@@ -63,6 +63,8 @@ namespace atomic_dex
RelCoinAmountRole,
RelCoinAmountCurrentCurrencyRole,
OrderTypeRole,
+ MinVolumeRole,
+ MaxVolumeRole,
IsMakerRole,
HumanDateRole,
UnixTimestampRole,
diff --git a/src/core/atomicdex/models/qt.orders.proxy.model.cpp b/src/core/atomicdex/models/qt.orders.proxy.model.cpp
index f66ce759b..bd6ec7163 100644
--- a/src/core/atomicdex/models/qt.orders.proxy.model.cpp
+++ b/src/core/atomicdex/models/qt.orders.proxy.model.cpp
@@ -55,6 +55,10 @@ namespace atomic_dex
break;
case orders_model::RelCoinAmountCurrentCurrencyRole:
break;
+ case orders_model::MinVolumeRole:
+ break;
+ case orders_model::MaxVolumeRole:
+ break;
case orders_model::OrderTypeRole:
break;
case orders_model::IsMakerRole:
diff --git a/src/core/atomicdex/pages/qt.trading.page.cpp b/src/core/atomicdex/pages/qt.trading.page.cpp
index e07380663..4ee89c213 100644
--- a/src/core/atomicdex/pages/qt.trading.page.cpp
+++ b/src/core/atomicdex/pages/qt.trading.page.cpp
@@ -21,6 +21,7 @@
//! 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/pages/qt.portfolio.page.hpp"
#include "atomicdex/pages/qt.settings.page.hpp"
@@ -138,7 +139,91 @@ namespace atomic_dex
}
void
- trading_page::place_buy_order(const QString& base_nota, const QString& base_confs)
+ trading_page::place_setprice_order(const QString& base_nota, const QString& base_confs, const QString& cancel_previous)
+ {
+ this->set_buy_sell_rpc_busy(true);
+ this->set_buy_sell_last_rpc_data(QJsonObject{{}});
+
+ auto& mm2_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();
+ t_float_50 rel_min_trade = safe_float(get_orderbook_wrapper()->get_rel_min_taker_vol().toStdString());
+ t_float_50 rel_min_volume_f = safe_float(get_min_trade_vol().toStdString());
+
+ t_setprice_request req{
+ .base = base.toStdString(),
+ .rel = rel.toStdString(),
+ .price = m_price.toStdString(),
+ .volume = m_volume.toStdString(),
+ .cancel_previous = cancel_previous == "true",
+ .base_nota = base_nota.isEmpty() ? std::optional{std::nullopt} : boost::lexical_cast(base_nota.toStdString()),
+ .base_confs = base_confs.isEmpty() ? std::optional{std::nullopt} : base_confs.toUInt(),
+ .min_volume = (rel_min_volume_f <= rel_min_trade) ? std::optional{std::nullopt} : get_min_trade_vol().toStdString()
+ };
+
+ nlohmann::json batch;
+ nlohmann::json setprice_request = mm2::template_request("setprice");
+ mm2::to_json(setprice_request, req);
+ batch.push_back(setprice_request);
+ setprice_request["userpass"] = "*******";
+
+ //! Answer
+ SPDLOG_DEBUG("setprice_request is : {}", setprice_request.dump(4));
+ auto answer_functor = [this](const web::http::http_response& resp)
+ {
+ std::string body = TO_STD_STR(resp.extract_string(true).get());
+ if (resp.status_code() == web::http::status_codes::OK)
+ {
+ if (body.find("error") == std::string::npos)
+ {
+ 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();
+ SPDLOG_DEBUG("order successfully placed, refreshing orders and swap");
+ cur_mm2_system.batch_fetch_orders_and_swap();
+ }
+ else
+ {
+ auto error_json = QJsonObject({{"error_code", -1}, {"error_message", QString::fromStdString(body)}});
+ SPDLOG_ERROR("error place_setprice_order: {}", body);
+ this->set_buy_sell_last_rpc_data(error_json);
+ }
+ }
+ else
+ {
+ auto error_json = QJsonObject({{"error_code", resp.status_code()}, {"error_message", QString::fromStdString(body)}});
+ this->set_buy_sell_last_rpc_data(error_json);
+ }
+ this->set_buy_sell_rpc_busy(false);
+ this->clear_forms("place_setprice_order");
+ };
+
+ //! Async call
+ mm2_system.get_mm2_client()
+ .async_rpc_batch_standalone(batch)
+ .then(answer_functor)
+ .then(
+ [this]([[maybe_unused]] pplx::task previous_task)
+ {
+ try
+ {
+ previous_task.wait();
+ }
+ catch (const std::exception& e)
+ {
+ SPDLOG_ERROR("pplx task error: {}", e.what());
+ auto error_json = QJsonObject({{"error_code", web::http::status_codes::InternalError}, {"error_message", e.what()}});
+ this->set_buy_sell_last_rpc_data(error_json);
+ this->set_buy_sell_rpc_busy(false);
+ this->clear_forms("place_setprice_order");
+ }
+ });
+ }
+
+ void
+ trading_page::place_buy_order(const QString& base_nota, const QString& base_confs, const QString& good_until_canceled)
{
this->set_buy_sell_rpc_busy(true);
this->set_buy_sell_last_rpc_data(QJsonObject{{}});
@@ -178,6 +263,19 @@ namespace atomic_dex
.base_confs = base_confs.isEmpty() ? std::optional{std::nullopt} : base_confs.toUInt(),
.min_volume = (rel_min_volume_f <= rel_min_trade) ? std::optional{std::nullopt} : get_min_trade_vol().toStdString()};
+ if (good_until_canceled == "true")
+ {
+ SPDLOG_DEBUG("Good until cancelled order");
+ req.order_type = nlohmann::json::object();
+ req.order_type.value()["type"] = "GoodTillCancelled";
+ }
+ else
+ {
+ SPDLOG_DEBUG("Fill or kill order");
+ req.order_type = nlohmann::json::object();
+ req.order_type.value()["type"] = "FillOrKill";
+ }
+
if (is_selected_min_max || is_selected_order)
{
req.min_volume = std::optional{std::nullopt};
@@ -269,7 +367,7 @@ namespace atomic_dex
}
void
- trading_page::place_sell_order(const QString& rel_nota, const QString& rel_confs)
+ trading_page::place_sell_order(const QString& rel_nota, const QString& rel_confs, const QString& good_until_canceled)
{
this->set_buy_sell_rpc_busy(true);
this->set_buy_sell_last_rpc_data(QJsonObject{{}});
@@ -312,6 +410,18 @@ namespace atomic_dex
req.order_type.value()["type"] = "FillOrKill";
req.min_volume = std::optional{std::nullopt};
}
+ else if (good_until_canceled == "true")
+ {
+ SPDLOG_DEBUG("Good until cancelled order");
+ req.order_type = nlohmann::json::object();
+ req.order_type.value()["type"] = "GoodTillCancelled";
+ }
+ else
+ {
+ SPDLOG_DEBUG("Fill or kill order");
+ req.order_type = nlohmann::json::object();
+ req.order_type.value()["type"] = "FillOrKill";
+ }
if (is_selected_min_max)
{
@@ -602,6 +712,23 @@ namespace atomic_dex
//! Properties related to trading
namespace atomic_dex
{
+ bool
+ trading_page::get_maker_mode() const
+ {
+ return m_maker_mode;
+ }
+
+ void
+ trading_page::set_maker_mode(bool market_mode)
+ {
+ if (this->m_maker_mode != market_mode)
+ {
+ this->m_maker_mode = market_mode;
+ emit makerModeChanged();
+ this->set_market_mode(MarketMode::Sell);
+ }
+ }
+
MarketMode
trading_page::get_market_mode() const
{
@@ -708,6 +835,7 @@ namespace atomic_dex
this->m_preferred_order = std::nullopt;
this->m_fees = QVariantMap();
this->m_cex_price = "0";
+ this->m_pair_trades_24hr = "0";
this->m_pair_volume_24hr = "0";
this->m_post_clear_forms = true;
this->set_selected_order_status(SelectedOrderStatus::None);
@@ -1394,15 +1522,24 @@ namespace atomic_dex
const auto* market_selector = get_market_pairs_mdl();
const auto& base = utils::retrieve_main_ticker(market_selector->get_left_selected_coin().toStdString(), true);
const auto& rel = utils::retrieve_main_ticker(market_selector->get_right_selected_coin().toStdString(), true);
+ QString trades = QString::fromStdString(defi_stats_service.get_trades_24h(base, rel));
QString vol = QString::fromStdString(defi_stats_service.get_volume_24h_usd(base, rel));
if (vol != m_pair_volume_24hr)
{
+ m_pair_trades_24hr = trades;
+ emit pairTrades24hrChanged();
m_pair_volume_24hr = vol;
emit pairVolume24hrChanged();
}
}
+ QString
+ trading_page::get_pair_trades_24hr() const
+ {
+ return m_pair_trades_24hr;
+ }
+
QString
trading_page::get_pair_volume_24hr() const
{
diff --git a/src/core/atomicdex/pages/qt.trading.page.hpp b/src/core/atomicdex/pages/qt.trading.page.hpp
index af97e4686..4aaa14ded 100644
--- a/src/core/atomicdex/pages/qt.trading.page.hpp
+++ b/src/core/atomicdex/pages/qt.trading.page.hpp
@@ -46,6 +46,7 @@ namespace atomic_dex
// Trading logic Q properties
Q_PROPERTY(MarketMode market_mode READ get_market_mode WRITE set_market_mode NOTIFY marketModeChanged)
+ Q_PROPERTY(bool maker_mode READ get_maker_mode WRITE set_maker_mode NOTIFY makerModeChanged)
Q_PROPERTY(TradingError last_trading_error READ get_trading_error WRITE set_trading_error NOTIFY tradingErrorChanged)
Q_PROPERTY(TradingMode current_trading_mode READ get_current_trading_mode WRITE set_current_trading_mode NOTIFY tradingModeChanged)
Q_PROPERTY(QString price READ get_price WRITE set_price NOTIFY priceChanged)
@@ -59,6 +60,7 @@ namespace atomic_dex
Q_PROPERTY(SelectedOrderStatus selected_order_status READ get_selected_order_status WRITE set_selected_order_status NOTIFY selectedOrderStatusChanged)
Q_PROPERTY(QString price_reversed READ get_price_reversed NOTIFY priceReversedChanged)
Q_PROPERTY(QString pair_volume_24hr READ get_pair_volume_24hr NOTIFY pairVolume24hrChanged)
+ Q_PROPERTY(QString pair_trades_24hr READ get_pair_trades_24hr NOTIFY pairTrades24hrChanged)
Q_PROPERTY(QString cex_price READ get_cex_price NOTIFY cexPriceChanged)
Q_PROPERTY(QString cex_price_reversed READ get_cex_price_reversed NOTIFY cexPriceReversedChanged)
Q_PROPERTY(QString cex_price_diff READ get_cex_price_diff NOTIFY cexPriceDiffChanged)
@@ -106,6 +108,7 @@ namespace atomic_dex
//! Trading Logic
MarketMode m_market_mode{MarketModeGadget::Sell};
+ bool m_maker_mode{false};
TradingError m_last_trading_error{TradingErrorGadget::None};
TradingMode m_current_trading_mode{TradingModeGadget::Pro};
SelectedOrderStatus m_selected_order_status{SelectedOrderGadget::None};
@@ -115,6 +118,7 @@ namespace atomic_dex
QString m_total_amount{"0.00777"};
QString m_cex_price{"0"};
QString m_pair_volume_24hr{"0"};
+ QString m_pair_trades_24hr{"0"};
QString m_minimal_trading_amount{"0.0001"};
std::optional m_preferred_order;
boost::synchronized_value m_fees;
@@ -159,8 +163,9 @@ namespace atomic_dex
Q_INVOKABLE bool set_pair(bool is_left_side, const QString& changed_ticker);
Q_INVOKABLE void set_current_orderbook(const QString& base, const QString& rel); ///< market_selector (called and selecting another coin)
- Q_INVOKABLE void place_buy_order(const QString& base_nota = "", const QString& base_confs = "");
- Q_INVOKABLE void place_sell_order(const QString& rel_nota = "", const QString& rel_confs = "");
+ Q_INVOKABLE void place_buy_order(const QString& base_nota = "", const QString& base_confs = "", const QString& good_until_canceled = "");
+ Q_INVOKABLE void place_sell_order(const QString& rel_nota = "", const QString& rel_confs = "", const QString& good_until_canceled = "");
+ Q_INVOKABLE void place_setprice_order(const QString& rel_nota = "", const QString& rel_confs = "", const QString& cancel_previous = "");
Q_INVOKABLE void reset_order();
@@ -176,6 +181,8 @@ namespace atomic_dex
void set_buy_sell_rpc_busy(bool status);
//! Trading Logic
+ [[nodiscard]] bool get_maker_mode() const;
+ void set_maker_mode(bool market_mode);
[[nodiscard]] MarketMode get_market_mode() const;
void set_market_mode(MarketMode market_mode);
[[nodiscard]] TradingError get_trading_error() const;
@@ -197,6 +204,7 @@ namespace atomic_dex
void set_total_amount(QString total_amount);
[[nodiscard]] QString get_base_amount() const;
[[nodiscard]] QString get_rel_amount() const;
+ [[nodiscard]] QString get_pair_trades_24hr() const;
[[nodiscard]] QString get_pair_volume_24hr() const;
[[nodiscard]] QString get_cex_price() const;
[[nodiscard]] QString get_cex_price_reversed() const;
@@ -229,6 +237,7 @@ namespace atomic_dex
//! Trading logic
void priceChanged();
void volumeChanged();
+ void makerModeChanged();
void marketModeChanged();
void maxVolumeChanged();
void tradingErrorChanged();
@@ -238,6 +247,7 @@ namespace atomic_dex
void baseAmountChanged();
void relAmountChanged();
void feesChanged();
+ void pairTrades24hrChanged();
void pairVolume24hrChanged();
void cexPriceChanged();
void cexPriceReversedChanged();
diff --git a/src/core/atomicdex/pages/qt.wallet.page.cpp b/src/core/atomicdex/pages/qt.wallet.page.cpp
index 7613bc8dc..14b383dae 100644
--- a/src/core/atomicdex/pages/qt.wallet.page.cpp
+++ b/src/core/atomicdex/pages/qt.wallet.page.cpp
@@ -269,6 +269,7 @@ namespace atomic_dex
{"transactions_left", 0},
{"current_block", 1},
{"is_faucet_coin", false},
+ {"is_vote_coin", false},
{"qrcode_address", ""},
{"segwit_supported", false}};
std::error_code ec;
@@ -303,6 +304,7 @@ namespace atomic_dex
obj["transactions_left"] = static_cast(tx_state.transactions_left);
obj["current_block"] = static_cast(tx_state.current_block);
obj["is_faucet_coin"] = coin_info.is_faucet_coin;
+ obj["is_vote_coin"] = coin_info.is_vote_coin;
std::error_code ec;
if (!mm2_system.is_zhtlc_coin_ready(coin_info.ticker))
diff --git a/src/core/atomicdex/pages/widgets/dex/qt.orderbook.cpp b/src/core/atomicdex/pages/widgets/dex/qt.orderbook.cpp
index 29a50e8ad..4b702b211 100644
--- a/src/core/atomicdex/pages/widgets/dex/qt.orderbook.cpp
+++ b/src/core/atomicdex/pages/widgets/dex/qt.orderbook.cpp
@@ -81,7 +81,7 @@ namespace atomic_dex
void
qt_orderbook_wrapper::refresh_orderbook_model_data(mm2::orderbook_result_rpc answer)
{
- SPDLOG_INFO("[qt_orderbook_wrapper::refresh_orderbook_model_data] bids/asks size: {}/{}", answer.bids.size(), answer.asks.size());
+ // 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);
this->m_bids->refresh_orderbook_model_data(answer.bids);
const auto data = this->m_system_manager.get_system().get_bestorders_data();
@@ -91,12 +91,12 @@ namespace atomic_dex
}
else if (m_best_orders->rowCount() == 0)
{
- SPDLOG_INFO("[qt_orderbook_wrapper::refresh_orderbook_model_data] : reset_best_orders");
+ // SPDLOG_INFO("[qt_orderbook_wrapper::refresh_orderbook_model_data] : reset_best_orders");
m_best_orders->reset_orderbook(data, true);
}
else
{
- SPDLOG_INFO("[qt_orderbook_wrapper::refresh_orderbook_model_data] : refresh_best_orders");
+ // SPDLOG_INFO("[qt_orderbook_wrapper::refresh_orderbook_model_data] : refresh_best_orders");
m_best_orders->refresh_orderbook_model_data(data, true);
}
this->set_both_taker_vol();
diff --git a/src/core/atomicdex/services/internet/internet.checker.service.cpp b/src/core/atomicdex/services/internet/internet.checker.service.cpp
index 9afafd488..e194dbe2c 100644
--- a/src/core/atomicdex/services/internet/internet.checker.service.cpp
+++ b/src/core/atomicdex/services/internet/internet.checker.service.cpp
@@ -32,7 +32,6 @@ namespace
return cfg;
}()};
- t_http_client_ptr g_paprika_proxy_http_client{std::make_unique(FROM_STD_STR("https://api.coinpaprika.com"), g_cfg)};
std::atomic_bool g_mm2_default_coins_ready{false};
pplx::task
@@ -164,7 +163,7 @@ namespace atomic_dex
void
internet_service_checker::fetch_internet_connection()
{
- //query_internet(g_paprika_proxy_http_client, "/v1/coins/btc-bitcoin", &internet_service_checker::is_paprika_provider_alive);
+ // TODO: This is only checking mm2 connection, not connection to the internet.
if (this->m_system_manager.has_system() && g_mm2_default_coins_ready)
{
auto& mm2 = this->m_system_manager.get_system();
diff --git a/src/core/atomicdex/services/mm2/mm2.service.cpp b/src/core/atomicdex/services/mm2/mm2.service.cpp
index cccedaed7..aac8b3029 100644
--- a/src/core/atomicdex/services/mm2/mm2.service.cpp
+++ b/src/core/atomicdex/services/mm2/mm2.service.cpp
@@ -3019,7 +3019,7 @@ namespace atomic_dex
const coin_config_t cfg = this->get_coin_info(ticker);
if (cfg.coin_type == CoinType::QRC20)
{
- if (cfg.is_testnet.value())
+ if (cfg.is_testnet.value_or(false))
{
SPDLOG_INFO("{} is from testnet picking tQTUM electrum", ticker);
servers = std::move(get_coin_info("tQTUM").electrum_urls.value());
diff --git a/src/core/atomicdex/services/price/coinpaprika/coinpaprika.provider.cpp b/src/core/atomicdex/services/price/coinpaprika/coinpaprika.provider.cpp
deleted file mode 100644
index 971988787..000000000
--- a/src/core/atomicdex/services/price/coinpaprika/coinpaprika.provider.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
-/******************************************************************************
- * 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. *
- * *
- ******************************************************************************/
-
-// Deps Headers
-#include
-
-// Project Headers
-#include "atomicdex/pages/qt.portfolio.page.hpp"
-#include "atomicdex/services/price/coinpaprika/coinpaprika.provider.hpp"
-
-namespace
-{
- //! Using namespace
- using namespace std::chrono_literals;
- using namespace atomic_dex::coinpaprika::api;
-
- //! Constants
- constexpr std::uint16_t g_pending_init_tasks_limit = 3;
-} // namespace
-
-//! Constructor/Destructor
-namespace atomic_dex
-{
- coinpaprika_provider::coinpaprika_provider(entt::registry& registry, ag::ecs::system_manager& system_manager) :
- system(registry), m_system_manager(system_manager)
- {
- SPDLOG_INFO("coinpaprika_provider created");
- disable();
- dispatcher_.sink().connect<&coinpaprika_provider::on_mm2_started>(*this);
- dispatcher_.sink().connect<&coinpaprika_provider::on_coin_enabled>(*this);
- dispatcher_.sink().connect<&coinpaprika_provider::on_coin_disabled>(*this);
- }
-
- coinpaprika_provider::~coinpaprika_provider()
- {
- SPDLOG_INFO("coinpaprika_provider destroyed");
- dispatcher_.sink().disconnect<&coinpaprika_provider::on_mm2_started>(*this);
- dispatcher_.sink().disconnect<&coinpaprika_provider::on_coin_enabled>(*this);
- dispatcher_.sink().disconnect<&coinpaprika_provider::on_coin_disabled>(*this);
- }
-} // namespace atomic_dex
-
-//! Private Generics
-namespace atomic_dex
-{
- template
- TAnswer
- coinpaprika_provider::get_infos(const std::string& ticker, const TRegistry& registry, TLockable& mutex) const
- {
- std::shared_lock lock(mutex);
- const auto it = registry.find(ticker);
- return it != registry.cend() ? it->second : TAnswer{};
- }
-} // namespace atomic_dex
-
-//! RPC Generics
-namespace atomic_dex
-{
- void
- coinpaprika_provider::verify_idx(t_ref_count_idx idx, uint16_t target_size, const std::vector& tickers)
- {
- if (idx != nullptr)
- {
- const auto cur = idx->fetch_add(1) + 1;
- // SPDLOG_DEBUG("cur: {}, target size: {}, remaining before adding in the model: {}", cur, target_size, target_size - cur);
- if (cur == target_size)
- {
- if (not tickers.empty())
- {
- dispatcher_.trigger(tickers);
- }
- else
- {
- this->dispatcher_.trigger("");
- }
- }
- }
- }
-
- template
- void
- coinpaprika_provider::generic_post_verification(std::shared_mutex& mtx, TContainer& container, std::string&& ticker, TAnswer&& answer, Args... args)
- {
- {
- std::unique_lock lock(mtx);
- container.insert_or_assign(std::move(ticker), std::forward(answer));
- }
- verify_idx(std::move(args)...);
- }
-
- template
- void
- coinpaprika_provider::generic_rpc_paprika_process(
- const TRequest& request, std::string ticker, std::shared_mutex& mtx, std::unordered_map& container, TExecutorFunctor&& functor,
- Args... args)
- {
- const auto answer_functor = [this, &mtx, &container, functor = std::forward(functor), request, ticker = std::move(ticker),
- ... args = std::move(args)](web::http::http_response resp) mutable {
- const auto answer = process_generic_resp(resp);
- if (answer.rpc_result_code == static_cast(antara::app::http_code::too_many_requests))
- {
- std::this_thread::sleep_for(1s);
- generic_rpc_paprika_process(request, std::move(ticker), mtx, container, std::forward(functor), std::move(args)...);
- }
- else
- {
- generic_post_verification(mtx, container, std::move(ticker), std::move(answer), std::move(args)...);
- }
- };
-
- functor(request).then(answer_functor).then(&handle_exception_pplx_task);
- }
-} // namespace atomic_dex
-
-//! RPC call
-namespace atomic_dex
-{
- template
- void
- coinpaprika_provider::process_provider(const coin_config_t& current_coin, Args... args)
- {
- const price_converter_request request{.base_currency_id = current_coin.coinpaprika_id, .quote_currency_id = "usd-us-dollars"};
- generic_rpc_paprika_process(
- request, current_coin.ticker, m_provider_mutex, m_usd_rate_providers,
- [](auto&& request) { return async_price_converter(std::forward(request)); }, std::move(args)...);
- }
-
- template
- void
- coinpaprika_provider::process_ticker_infos(const coin_config_t& current_coin, Args... args)
- {
- const ticker_infos_request request{.ticker_currency_id = current_coin.coinpaprika_id, .ticker_quotes = {"USD", "EUR", "BTC"}};
- generic_rpc_paprika_process(
- request, current_coin.ticker, m_ticker_infos_mutex, m_ticker_infos_registry,
- [](auto&& request) { return async_ticker_info(std::forward(request)); }, std::move(args)...);
- }
-
- template
- void
- coinpaprika_provider::process_ticker_historical(const coin_config_t& current_coin, Args... args)
- {
- const ticker_historical_request request{.ticker_currency_id = current_coin.coinpaprika_id, .interval = "2h"};
- generic_rpc_paprika_process(
- request, current_coin.ticker, m_ticker_historical_mutex, m_ticker_historical_registry,
- [](auto&& request) { return async_ticker_historical(std::forward(request)); }, std::move(args)...);
- }
-} // namespace atomic_dex
-
-//! System Override
-namespace atomic_dex
-{
- void
- coinpaprika_provider::update()
- {
- }
-} // namespace atomic_dex
-
-//! Events
-namespace atomic_dex
-{
- void
- coinpaprika_provider::on_mm2_started([[maybe_unused]] const mm2_started& evt)
- {
- update_ticker_and_provider();
- }
-
- void
- coinpaprika_provider::on_coin_enabled(const coin_enabled& evt)
- {
- SPDLOG_INFO("{} enabled, retrieve coinpaprika infos", fmt::format("{}", fmt::join(evt.tickers, ", ")));
- auto idx{std::make_shared(0)};
- const auto target_size = evt.tickers.size() * g_pending_init_tasks_limit;
- const auto* global_cfg_system = m_system_manager.get_system().get_global_cfg();
- for (auto&& ticker: evt.tickers)
- {
- const auto config = global_cfg_system->get_coin_info(ticker);
- if (config.coinpaprika_id != "test-coin")
- {
- process_provider(config, idx, target_size, evt.tickers);
- process_ticker_infos(config, idx, target_size, evt.tickers);
- process_ticker_historical(config, idx, target_size, evt.tickers);
- }
- else
- {
- const std::uint16_t cur = idx->fetch_add(g_pending_init_tasks_limit) + g_pending_init_tasks_limit; ///< Manually skip the above 3 operations
- if (cur == target_size)
- {
- this->dispatcher_.trigger(evt.tickers);
- }
- }
- }
- }
-
- void
- coinpaprika_provider::on_coin_disabled(const coin_disabled& evt)
- {
- SPDLOG_INFO("{} disabled, removing from paprika provider", evt.ticker);
- std::unique_lock lock(m_provider_mutex);
- m_usd_rate_providers.erase(evt.ticker);
- }
-} // namespace atomic_dex
-
-//! Public member functions
-namespace atomic_dex
-{
- void
- coinpaprika_provider::update_ticker_and_provider()
- {
- const auto coins = this->m_system_manager.get_system().get_global_cfg()->get_enabled_coins();
- auto idx{std::make_shared(0)};
- const auto target_size = coins.size();
- for (auto&& [_, current_coin]: coins)
- {
- if (current_coin.coinpaprika_id == "test-coin")
- {
- const std::uint16_t cur = idx->fetch_add(1) + 1;
- if (cur == target_size)
- {
- dispatcher_.trigger("");
- }
- continue;
- }
- process_ticker_infos(current_coin);
- process_ticker_historical(current_coin);
- process_provider(current_coin, idx, target_size, std::vector{});
- }
- }
-
- std::string
- coinpaprika_provider::get_rate_conversion(const std::string& ticker) const
- {
- return get_infos(ticker, m_usd_rate_providers, m_provider_mutex).price;
- }
-
- t_ticker_info_answer
- coinpaprika_provider::get_ticker_infos(const std::string& ticker) const
- {
- return get_infos(ticker, m_ticker_infos_registry, m_ticker_infos_mutex);
- }
-
- t_ticker_historical_answer
- coinpaprika_provider::get_ticker_historical(const std::string& ticker) const
- {
- return get_infos(ticker, m_ticker_historical_registry, m_ticker_historical_mutex);
- }
-} // namespace atomic_dex
\ No newline at end of file
diff --git a/src/core/atomicdex/services/price/coinpaprika/coinpaprika.provider.hpp b/src/core/atomicdex/services/price/coinpaprika/coinpaprika.provider.hpp
deleted file mode 100644
index 01352719e..000000000
--- a/src/core/atomicdex/services/price/coinpaprika/coinpaprika.provider.hpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/******************************************************************************
- * 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
-
-//! STD
-#include
-
-//! Deps
-#include
-
-//! Project Headers
-#include "atomicdex/api/coinpaprika/coinpaprika.hpp"
-#include "atomicdex/events/events.hpp"
-
-namespace atomic_dex
-{
- namespace ag = antara::gaming;
-
- class coinpaprika_provider final : public ag::ecs::pre_update_system
- {
- //! Typedefs
- using t_ref_count_idx = std::shared_ptr;
- using t_providers_registry = std::unordered_map;
- using t_ticker_infos_registry = std::unordered_map;
- using t_ticker_historical_registry = std::unordered_map;
-
- //! Private fields
-
- //! ag::system_manager
- ag::ecs::system_manager& m_system_manager;
-
- //! Containers
- t_providers_registry m_usd_rate_providers{}; ///< USD Rate Providers
- t_ticker_infos_registry m_ticker_infos_registry{}; ///< Ticker info registry, key is the ticker
- t_ticker_historical_registry m_ticker_historical_registry{}; ///< Ticker historical registry, key is the ticker
-
- //! Mutexes
- mutable std::shared_mutex m_ticker_historical_mutex;
- mutable std::shared_mutex m_ticker_infos_mutex;
- mutable std::shared_mutex m_provider_mutex;
-
- //! Private member functions
- void verify_idx(t_ref_count_idx idx = nullptr, uint16_t target_size = 0, const std::vector& tickers = {});
-
- //! Private templated member functions
- template
- TAnswer get_infos(const std::string& ticker, const TRegistry& registry, TLockable& mutex) const ;
-
- template
- void generic_post_verification(std::shared_mutex& mtx, TContainer& container, std::string&& ticker, TAnswer&& answer, Args... args);
-
- template
- void generic_rpc_paprika_process(
- const TRequest& request, std::string ticker, std::shared_mutex& mtx, std::unordered_map& container,
- TExecutorFunctor&& functor, Args... args);
-
- //! Private RPC Call
- template
- void process_provider(const coin_config_t& current_coin, Args... args);
- template
- void process_ticker_infos(const coin_config_t& current_coin, Args... args);
- template
- void process_ticker_historical(const coin_config_t& current_coin, Args... args);
-
- public:
- //! Deleted operation
- coinpaprika_provider(coinpaprika_provider& other) = delete;
- coinpaprika_provider(coinpaprika_provider&& other) = delete;
- coinpaprika_provider& operator=(coinpaprika_provider& other) = delete;
- coinpaprika_provider& operator=(coinpaprika_provider&& other) = delete;
-
- //! Constructor
- coinpaprika_provider(entt::registry& registry, ag::ecs::system_manager& system_manager) ;
-
- //! Destructor
- ~coinpaprika_provider() final;
-
- ///< Public API
-
- //! Update all the data of the provider in an async way
- void update_ticker_and_provider();
-
- //! Get the rate conversion for the given fiat.
- [[nodiscard]] std::string get_rate_conversion(const std::string& ticker) const ;
-
- //! Get the ticker informations.
- [[nodiscard]] t_ticker_info_answer get_ticker_infos(const std::string& ticker) const ;
-
- //! Get the ticker informations.
- [[nodiscard]] t_ticker_historical_answer get_ticker_historical(const std::string& ticker) const ;
-
- ///< Events
-
- //! Event that occur when the mm2 process is launched correctly.
- void on_mm2_started(const mm2_started& evt) ;
-
- //! Event that occur when a coin is correctly enabled.
- void on_coin_enabled(const coin_enabled& evt) ;
-
- //! Event that occur when a coin is correctly disabled.
- void on_coin_disabled(const coin_disabled& evt) ;
-
- //! Override ag::system functions
- void update() final;
- };
-} // namespace atomic_dex
-
-REFL_AUTO(type(atomic_dex::coinpaprika_provider))
\ No newline at end of file
diff --git a/src/core/atomicdex/services/price/defi.stats.cpp b/src/core/atomicdex/services/price/defi.stats.cpp
index 22bbd98d4..e14d40283 100644
--- a/src/core/atomicdex/services/price/defi.stats.cpp
+++ b/src/core/atomicdex/services/price/defi.stats.cpp
@@ -17,7 +17,6 @@
//! Project Headers
#include "atomicdex/services/price/defi.stats.hpp"
#include "atomicdex/services/price/komodo_prices/komodo.prices.provider.hpp"
-#include "atomicdex/api/coinpaprika/coinpaprika.hpp"
#include "atomicdex/pages/qt.settings.page.hpp"
#include "atomicdex/services/price/global.provider.hpp"
@@ -49,17 +48,17 @@ namespace
pplx::cancellation_token_source d_token_source;
pplx::task
- async_fetch_defi_ticker_stats()
+ async_fetch_defi_stats_volumes()
{
web::http::http_request req;
req.set_method(web::http::methods::GET);
- req.set_request_uri(FROM_STD_STR("api/v3/tickers/summary"));
+ req.set_request_uri(FROM_STD_STR("api/v3/pairs/volumes_24hr"));
SPDLOG_INFO("defi_stats req: {}", TO_STD_STR(req.to_string()));
return g_defi_stats_client->request(req, d_token_source.get_token());
}
nlohmann::json
- process_fetch_defi_ticker_stats_answer(web::http::http_response resp)
+ process_fetch_defi_stats_volumes_answer(web::http::http_response resp)
{
std::string body = TO_STD_STR(resp.extract_string(true).get());
if (resp.status_code() == 200)
@@ -119,11 +118,11 @@ namespace atomic_dex
this->process_update();
};
};
- async_fetch_defi_ticker_stats()
+ async_fetch_defi_stats_volumes()
.then(
[this](web::http::http_response resp)
{
- this->m_defi_ticker_stats = process_fetch_defi_ticker_stats_answer(resp);
+ this->m_defi_stats_volumes = process_fetch_defi_stats_volumes_answer(resp);
nb_try = 0;
})
.then(error_functor);
@@ -136,33 +135,140 @@ namespace atomic_dex
auto ticker = base + "_" + quote;
auto ticker_reversed = quote + "_" + base;
SPDLOG_INFO("Getting 24hr volume data for {}", ticker);
+
+ // Check if base/quote are the same
if (base == quote)
{
SPDLOG_INFO("Base/quote must be different, no volume data for {}", ticker);
return volume_24h_usd;
}
- auto defi_ticker_stats = m_defi_ticker_stats.get();
- // SPDLOG_INFO("Volume data: {}", defi_ticker_stats.dump(4));
+ // Check if defi_stats_volumes is valid
+ auto defi_stats_volumes = m_defi_stats_volumes.get();
+ if (!defi_stats_volumes.is_object())
+ {
+ SPDLOG_WARN("Invalid defi stats volumes data.");
+ return volume_24h_usd;
+ }
- if (defi_ticker_stats.contains("data"))
+ // Check if volumes key exists
+ if (!defi_stats_volumes.contains("volumes"))
+ {
+ SPDLOG_WARN("No volumes data available.");
+ return volume_24h_usd;
+ }
+
+ // Extract ticker trade_volume_usd safely
+ if (defi_stats_volumes.at("volumes").contains(ticker))
{
- SPDLOG_INFO("Combined volume usd: {}", defi_ticker_stats["combined_volume_usd"]);
- if (defi_ticker_stats.at("data").contains(ticker))
+ auto volume_node = defi_stats_volumes["volumes"][ticker]["ALL"]["trade_volume_usd"];
+ if (volume_node.is_number())
{
- volume_24h_usd = defi_ticker_stats.at("data").at(ticker).at("volume_usd_24hr").get();
+ volume_24h_usd = std::to_string(volume_node.get());
SPDLOG_INFO("{} volume usd: {}", ticker, volume_24h_usd);
}
- else if (defi_ticker_stats.at("data").contains(ticker_reversed))
+ else if (volume_node.is_null())
+ {
+ SPDLOG_WARN("Volume value is null for {}", ticker);
+ }
+ else
+ {
+ SPDLOG_WARN("Volume value is not a number for {}: {}", ticker, volume_node.type_name());
+ }
+ }
+ else if (defi_stats_volumes["volumes"].contains(ticker_reversed))
+ {
+ auto volume_node = defi_stats_volumes["volumes"][ticker_reversed]["ALL"]["trade_volume_usd"];
+ if (volume_node.is_number())
{
- volume_24h_usd = defi_ticker_stats.at("data").at(ticker_reversed).at("volume_usd_24hr").get();
+ volume_24h_usd = std::to_string(volume_node.get());
SPDLOG_INFO("{} volume usd: {}", ticker_reversed, volume_24h_usd);
}
+ else if (volume_node.is_null())
+ {
+ SPDLOG_WARN("Volume value is null for {}", ticker);
+ }
+ else
+ {
+ SPDLOG_WARN("Volume value is not a number for {}: {}", ticker, volume_node.type_name());
+ }
}
else
{
- SPDLOG_WARN("Empty 24hr volume data for {}", defi_ticker_stats.dump(4));
+ SPDLOG_WARN("No volume data available for {}", ticker);
}
return volume_24h_usd;
}
+
+ std::string
+ global_defi_stats_service::get_trades_24h(const std::string& base, const std::string& quote) const
+ {
+ std::string trades_24h = "0";
+ auto ticker = base + "_" + quote;
+ auto ticker_reversed = quote + "_" + base;
+ SPDLOG_INFO("Getting 24hr trade data for {}", ticker);
+
+ // Check if base/quote are the same
+ if (base == quote)
+ {
+ SPDLOG_INFO("Base/quote must be different, no volume data for {}", ticker);
+ return trades_24h;
+ }
+
+ // Check if defi_stats_volumes is valid
+ auto defi_stats_volumes = m_defi_stats_volumes.get();
+ if (!defi_stats_volumes.is_object())
+ {
+ SPDLOG_WARN("Invalid defi stats volumes data.");
+ return trades_24h;
+ }
+
+ // Check if volumes key exists
+ if (!defi_stats_volumes.contains("volumes"))
+ {
+ SPDLOG_WARN("No volumes data available.");
+ return trades_24h;
+ }
+
+ // Extract ticker trade_volume_usd safely
+ if (defi_stats_volumes.at("volumes").contains(ticker))
+ {
+ auto trades_node = defi_stats_volumes["volumes"][ticker]["ALL"]["trades_24hr"];
+ if (trades_node.is_number())
+ {
+ trades_24h = std::to_string(trades_node.get());
+ SPDLOG_INFO("{} trades_24h: {}", ticker, trades_24h);
+ }
+ else if (trades_node.is_null())
+ {
+ SPDLOG_WARN("Trades value is null for {}", ticker);
+ }
+ else
+ {
+ SPDLOG_WARN("Trades value is not a number for {}: {}", ticker, trades_node.type_name());
+ }
+ }
+ else if (defi_stats_volumes["volumes"].contains(ticker_reversed))
+ {
+ auto trades_node = defi_stats_volumes["volumes"][ticker_reversed]["ALL"]["trades_24hr"];
+ if (trades_node.is_number())
+ {
+ trades_24h = std::to_string(trades_node.get());
+ SPDLOG_INFO("{} trades_24h: {}", ticker_reversed, trades_24h);
+ }
+ else if (trades_node.is_null())
+ {
+ SPDLOG_WARN("Trades value is null for {}", ticker);
+ }
+ else
+ {
+ SPDLOG_WARN("Trades value is not a number for {}: {}", ticker, trades_node.type_name());
+ }
+ }
+ else
+ {
+ SPDLOG_WARN("No trades data available for {}", ticker);
+ }
+ return trades_24h;
+ }
} // namespace atomic_dex
diff --git a/src/core/atomicdex/services/price/defi.stats.hpp b/src/core/atomicdex/services/price/defi.stats.hpp
index 61941aec4..de626da1d 100644
--- a/src/core/atomicdex/services/price/defi.stats.hpp
+++ b/src/core/atomicdex/services/price/defi.stats.hpp
@@ -24,18 +24,18 @@
namespace atomic_dex::mm2
{
- struct defi_ticker_stats_answer
+ struct defi_stats_volumes_answer
{
nlohmann::json result;
int status_code;
};
- void from_json(const nlohmann::json& j, defi_ticker_stats_answer& answer);
+ void from_json(const nlohmann::json& j, defi_stats_volumes_answer& answer);
} // namespace atomic_dex::mm2
namespace atomic_dex
{
- using t_defi_ticker_stats_answer = mm2::defi_ticker_stats_answer;
+ using t_defi_stats_volumes_answer = mm2::defi_stats_volumes_answer;
} // namespace atomic_dex
namespace atomic_dex
@@ -49,7 +49,7 @@ namespace atomic_dex
//! Private member fields
ag::ecs::system_manager& m_system_manager;
- t_json_synchronized m_defi_ticker_stats;
+ t_json_synchronized m_defi_stats_volumes;
t_defi_stats_time_point m_update_clock;
//! private functions
@@ -67,6 +67,7 @@ namespace atomic_dex
//! Public API
void process_defi_stats();
+ std::string get_trades_24h(const std::string& base, const std::string& quote) const;
std::string get_volume_24h_usd(const std::string& base, const std::string& quote) const;
diff --git a/src/core/atomicdex/services/price/global.provider.cpp b/src/core/atomicdex/services/price/global.provider.cpp
index 1da473e6a..d9d84a085 100644
--- a/src/core/atomicdex/services/price/global.provider.cpp
+++ b/src/core/atomicdex/services/price/global.provider.cpp
@@ -16,7 +16,6 @@
//! Project Headers
#include "atomicdex/services/price/global.provider.hpp"
-#include "atomicdex/api/coinpaprika/coinpaprika.hpp"
#include "atomicdex/pages/qt.settings.page.hpp"
#include "atomicdex/services/price/komodo_prices/komodo.prices.provider.hpp"
@@ -100,63 +99,15 @@ namespace atomic_dex
global_price_service::refresh_other_coins_rates(
const std::string& quote_id, const std::string& ticker, bool with_update_providers, std::atomic_uint16_t nb_try)
{
- nb_try += 1;
+ // nb_try += 1;
+ // TODO: Paprika price conversion removed, needs to be replaced
+ nb_try = 10;
SPDLOG_INFO("refresh_other_coins_rates - try {}", nb_try.load());
if (nb_try == 10)
{
SPDLOG_WARN("refresh other coins rates max try reached, skipping");
return;
}
- using namespace std::chrono_literals;
- coinpaprika::api::price_converter_request request{.base_currency_id = "usd-us-dollars", .quote_currency_id = quote_id};
- auto error_functor = [this, quote_id, ticker, with_update_providers, nb_try_load = nb_try.load()](pplx::task previous_task)
- {
- try
- {
- previous_task.wait();
- }
- catch (const std::exception& e)
- {
- SPDLOG_ERROR("pplx task error from refresh_other_coins_rates: {} - nb_try {}", e.what(), nb_try_load);
- using namespace std::chrono_literals;
- std::this_thread::sleep_for(1s);
- this->refresh_other_coins_rates(quote_id, ticker, with_update_providers, nb_try_load);
- };
- };
- coinpaprika::api::async_price_converter(request)
- .then(
- [this, quote_id, ticker, with_update_providers, nb_try_cap = nb_try.load()](web::http::http_response resp)
- {
- auto answer = coinpaprika::api::process_generic_resp(resp);
- if (answer.rpc_result_code == static_cast(antara::app::http_code::too_many_requests))
- {
- std::this_thread::sleep_for(1s);
- SPDLOG_WARN("too many request - retrying");
- this->refresh_other_coins_rates(quote_id, ticker, with_update_providers, nb_try_cap);
- }
- else
- {
- SPDLOG_INFO("Successfully get the coinpaprika::api::async_price_converter answer after {} try", nb_try_cap);
- if (answer.raw_result.find("error") == std::string::npos)
- {
- if (not answer.price.empty())
- {
- std::unique_lock lock(m_coin_rate_mutex);
- this->m_coin_rate_providers[ticker] = answer.price;
- }
- }
- else
- {
- std::unique_lock lock(m_coin_rate_mutex);
- this->m_coin_rate_providers[ticker] = "0.00";
- }
- }
- if (with_update_providers)
- {
- //this->m_system_manager.get_system().update_ticker_and_provider();
- }
- })
- .then(error_functor);
}
global_price_service::global_price_service(entt::registry& registry, ag::ecs::system_manager& system_manager, atomic_dex::cfg& cfg) :
@@ -312,6 +263,11 @@ namespace atomic_dex
{
try
{
+ if (amount == "" || ticker == "" || currency == "")
+ {
+ return "0.00";
+ }
+
auto& mm2_instance = m_system_manager.get_system();
const auto ticker_infos = mm2_instance.get_coin_info(ticker);
diff --git a/src/core/atomicdex/services/price/orderbook.scanner.service.cpp b/src/core/atomicdex/services/price/orderbook.scanner.service.cpp
index 823ec2870..ed6b2dcfc 100644
--- a/src/core/atomicdex/services/price/orderbook.scanner.service.cpp
+++ b/src/core/atomicdex/services/price/orderbook.scanner.service.cpp
@@ -63,9 +63,9 @@ namespace atomic_dex
nlohmann::json batch = nlohmann::json::array();
if (rpc.error)
{
- SPDLOG_ERROR("error: bad answer json for process_best_orders: {}", rpc.error->error);
+ // SPDLOG_DEBUG("error: bad answer json for process_best_orders: {}", rpc.error->error);
this->m_bestorders_busy = false;
- SPDLOG_ERROR("Triggering [process_orderbook_finished]: true");
+ // SPDLOG_DEBUG("Triggering [process_orderbook_finished]: true");
this->dispatcher_.trigger(true);
}
else
@@ -75,7 +75,7 @@ namespace atomic_dex
this->m_best_orders_infos = rpc.result.value();
}
this->m_bestorders_busy = false;
- SPDLOG_ERROR("Triggering [process_orderbook_finished]: false");
+ // SPDLOG_DEBUG("Triggering [process_orderbook_finished]: false");
this->dispatcher_.trigger(false);
emit trading_pg.get_orderbook_wrapper()->bestOrdersBusyChanged();
}
diff --git a/src/core/atomicdex/utilities/safe.float.cpp b/src/core/atomicdex/utilities/safe.float.cpp
index 62dea4f09..05d924d73 100644
--- a/src/core/atomicdex/utilities/safe.float.cpp
+++ b/src/core/atomicdex/utilities/safe.float.cpp
@@ -19,12 +19,16 @@ safe_float(const std::string& from)
{
try
{
+ if (from.empty())
+ {
+ return t_float_50(0);
+ }
t_float_50 out(boost::algorithm::replace_all_copy(from, ",", "."));
return out;
}
catch (const std::exception& error)
{
- SPDLOG_ERROR("exception caught when creating a floating point number: {}", error.what());
+ SPDLOG_ERROR("exception caught when creating a floating point number from {}: {}", from, error.what());
//#if defined(linux) || defined(__APPLE__)
// SPDLOG_ERROR("stacktrace: {}", boost::stacktrace::to_string(boost::stacktrace::stacktrace()));
//#endif