Skip to content

Commit fa1821f

Browse files
authored
Merge pull request #2420 from KomodoPlatform/add/order-info
Add/order info
2 parents 2bb35a2 + b52849a commit fa1821f

File tree

11 files changed

+69
-4
lines changed

11 files changed

+69
-4
lines changed

atomic_defi_design/Dex/Components/PairItemBadge.qml

+10
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,21 @@ DexRectangle
2424
property int padding: 0
2525
property alias middle_text: middle_line.text_value
2626
property alias bottom_text: bottom_line.text_value
27+
property bool is_left: false
2728
Layout.fillHeight: true
2829
Layout.fillWidth: true
2930
Layout.leftMargin: 10
3031
Layout.rightMargin: 20
3132

33+
Dex.Text{
34+
anchors.bottom: parent.top
35+
anchors.bottomMargin: 5
36+
anchors.horizontalCenter: parent.horizontalCenter
37+
text: is_left ? "Outgoing" : "Incoming"
38+
font: Dex.DexTypo.italic12
39+
color: Dex.CurrentTheme.foregroundColor2
40+
}
41+
3242
RowLayout
3343
{
3444
anchors.fill: parent

atomic_defi_design/Dex/Constants/DexTypo.qml

+7
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ QtObject {
154154
family: "Courier",
155155
weight: Font.Normal
156156
})
157+
property font italic12: Qt.font({
158+
pixelSize: 12 * fontDensity,
159+
letterSpacing: 0.2,
160+
family: fontFamily,
161+
weight: Font.Normal,
162+
italic: true
163+
})
157164
property font inputFieldFont: Qt.font({
158165
pixelSize: (16 * DexTypo.fontDensity) * (Screen.pixelDensity / 160),
159166
letterSpacing: 0.5,

atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderModal.qml

+21
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ MultipageModal
6666

6767
PairItemBadge
6868
{
69+
is_left: true
6970
ticker: details ? details.base_coin : ""
7071
fullname: details ? General.coinName(details.base_coin) : ""
7172
amount: details ? details.base_amount : ""
@@ -119,6 +120,26 @@ MultipageModal
119120
label.font.pixelSize: 13
120121
}
121122

123+
// Min Vol
124+
TextEditWithTitle
125+
{
126+
Layout.fillWidth: true
127+
title: qsTr("Min Volume")
128+
text: details ? details.min_volume + " " + details.base_coin : ""
129+
label.font.pixelSize: 13
130+
visible: General.exists(details) && details.min_volume != ""
131+
}
132+
133+
// Max Vol
134+
TextEditWithTitle
135+
{
136+
Layout.fillWidth: true
137+
title: qsTr("Max Volume")
138+
text: details ? details.max_volume + " " + details.base_coin : ""
139+
label.font.pixelSize: 13
140+
visible: General.exists(details) && details.max_volume != ""
141+
}
142+
122143
// Refund state
123144
TextEditWithTitle
124145
{

src/core/atomicdex/api/mm2/mm2.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ namespace atomic_dex::mm2
293293
.is_swap = false,
294294
.is_cancellable = value.at("cancellable").get<bool>(),
295295
.is_recoverable = false,
296-
.min_volume = is_maker ? QString::fromStdString(value.at("min_base_vol").get<std::string>()) : std::optional<QString>(std::nullopt),
296+
.min_volume = is_maker ? QString::fromStdString(value.at("min_base_vol").get<std::string>()) : "",
297+
.max_volume = is_maker ? QString::fromStdString(value.at("max_base_vol").get<std::string>()) : "",
297298
.conf_settings = conf_settings};
298299
if (action.empty() && contents.order_type == "maker")
299300
{

src/core/atomicdex/api/mm2/rpc_v2/rpc2.orderbook.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ namespace atomic_dex::mm2
4040
if (j.contains("result"))
4141
{
4242
// Not sure how why where it is being returned in this format
43-
SPDLOG_DEBUG("orderbook_result_rpc: result");
4443
j.at("result").at("rel").get_to(resp.rel);
4544
j.at("result").at("num_asks").get_to(resp.numasks);
4645
j.at("result").at("num_bids").get_to(resp.numbids);
@@ -52,7 +51,6 @@ namespace atomic_dex::mm2
5251
}
5352
else
5453
{
55-
SPDLOG_DEBUG("orderbook_result_rpc: base");
5654
j.at("base").get_to(resp.base);
5755
j.at("rel").get_to(resp.rel);
5856
j.at("num_asks").get_to(resp.numasks);

src/core/atomicdex/data/dex/qt.orders.data.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ namespace atomic_dex::mm2
8585
bool is_swap_active{false};
8686

8787
//! Only available for maker order
88-
std::optional<QString> min_volume{std::nullopt};
88+
QString min_volume;
89+
QString max_volume;
8990
std::optional<nlohmann::json> conf_settings{std::nullopt};
9091
};
9192
} // namespace atomic_dex::mm2

src/core/atomicdex/models/qt.orders.model.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ namespace atomic_dex
8282
case RelCoinAmountCurrentCurrencyRole:
8383
item.rel_amount_fiat = value.toString();
8484
break;
85+
case MinVolumeRole:
86+
item.min_volume = value.toString();
87+
break;
88+
case MaxVolumeRole:
89+
item.max_volume = value.toString();
90+
break;
8591
case OrderTypeRole:
8692
item.order_type = value.toString();
8793
break;
@@ -166,6 +172,10 @@ namespace atomic_dex
166172
return item.rel_amount;
167173
case RelCoinAmountCurrentCurrencyRole:
168174
return item.rel_amount_fiat;
175+
case MinVolumeRole:
176+
return item.min_volume;
177+
case MaxVolumeRole:
178+
return item.max_volume;
169179
case OrderTypeRole:
170180
return item.order_type;
171181
case HumanDateRole:
@@ -233,6 +243,8 @@ namespace atomic_dex
233243
{BaseCoinAmountCurrentCurrencyRole, "base_amount_current_currency"},
234244
{RelCoinAmountRole, "rel_amount"},
235245
{RelCoinAmountCurrentCurrencyRole, "rel_amount_current_currency"},
246+
{MinVolumeRole, "min_volume"},
247+
{MaxVolumeRole, "max_volume"},
236248
{OrderTypeRole, "type"},
237249
{IsMakerRole, "is_maker"},
238250
{HumanDateRole, "date"},

src/core/atomicdex/models/qt.orders.model.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ namespace atomic_dex
6363
RelCoinAmountRole,
6464
RelCoinAmountCurrentCurrencyRole,
6565
OrderTypeRole,
66+
MinVolumeRole,
67+
MaxVolumeRole,
6668
IsMakerRole,
6769
HumanDateRole,
6870
UnixTimestampRole,

src/core/atomicdex/models/qt.orders.proxy.model.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ namespace atomic_dex
5555
break;
5656
case orders_model::RelCoinAmountCurrentCurrencyRole:
5757
break;
58+
case orders_model::MinVolumeRole:
59+
break;
60+
case orders_model::MaxVolumeRole:
61+
break;
5862
case orders_model::OrderTypeRole:
5963
break;
6064
case orders_model::IsMakerRole:

src/core/atomicdex/services/price/global.provider.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,11 @@ namespace atomic_dex
263263
{
264264
try
265265
{
266+
if (amount == "" || ticker == "" || currency == "")
267+
{
268+
return "0.00";
269+
}
270+
266271
auto& mm2_instance = m_system_manager.get_system<mm2_service>();
267272

268273
const auto ticker_infos = mm2_instance.get_coin_info(ticker);

src/core/atomicdex/utilities/safe.float.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ safe_float(const std::string& from)
1919
{
2020
try
2121
{
22+
if (from.empty())
23+
{
24+
return t_float_50(0);
25+
}
2226
t_float_50 out(boost::algorithm::replace_all_copy(from, ",", "."));
2327
return out;
2428
}

0 commit comments

Comments
 (0)