@orderly.network/ui-order-entry 2.8.12 → 2.8.13-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +68 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +69 -43
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +13 -13
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React3, { useId, forwardRef, useState, useImperativeHandle, useEffect, memo, createContext, useMemo, useRef, useCallback, useContext } from 'react';
|
|
2
|
-
import { useLocalStorage, utils, usePositionStream, useEventEmitter, useDebouncedCallback, useFeeState, useRwaSymbolsInfoStore, useOrderlyContext, useMemoizedFn, ERROR_MSG_CODES, useOrderEntry, useMarginRatio, useComputedLTV, useTpslPriceChecker, useHoldingStream, useAppStore, useIndexPricesStream, useTrack, useQuery, useSymbolLeverage, useBoolean } from '@orderly.network/hooks';
|
|
2
|
+
import { useLocalStorage, utils, usePositionStream, useEventEmitter, useDebouncedCallback, useFeeState, useRwaSymbolsInfoStore, useOrderlyContext, useMemoizedFn, ERROR_MSG_CODES, useOrderEntry, useMarginRatio, useComputedLTV, useTpslPriceChecker, useHoldingStream, useAppStore, useIndexPricesStream, useGetEstLiqPrice, useTrack, useQuery, useSymbolLeverage, useBoolean } from '@orderly.network/hooks';
|
|
3
3
|
import { useTranslation, i18n } from '@orderly.network/i18n';
|
|
4
4
|
import { useOrderEntryFormErrorMsg, useCanTrade } from '@orderly.network/react-app';
|
|
5
5
|
import { EMPTY_LIST, DistributionType, TrailingCallbackType, OrderSide, OrderType, PositionType, BBOOrderType, OrderLevel, TrackerEventName } from '@orderly.network/types';
|
|
@@ -54,14 +54,21 @@ var AdditionalInfo = (props) => {
|
|
|
54
54
|
}
|
|
55
55
|
),
|
|
56
56
|
/* @__PURE__ */ jsx(
|
|
57
|
-
|
|
57
|
+
Tooltip,
|
|
58
58
|
{
|
|
59
|
-
|
|
60
|
-
className:
|
|
61
|
-
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
content: t("orderEntry.orderType.postOnly.tooltip"),
|
|
60
|
+
className: "oui-max-w-[280px] oui-text-2xs oui-text-base-contrast-80",
|
|
61
|
+
children: /* @__PURE__ */ jsx(
|
|
62
|
+
"label",
|
|
63
|
+
{
|
|
64
|
+
htmlFor: "toggle_order_post_only",
|
|
65
|
+
className: cn(
|
|
66
|
+
"oui-ml-1 oui-text-2xs peer-data-[disabled]:oui-text-base-contrast-20",
|
|
67
|
+
"oui-cursor-pointer oui-whitespace-nowrap oui-break-normal oui-border-b oui-border-dashed oui-border-line-12"
|
|
68
|
+
),
|
|
69
|
+
children: t("orderEntry.orderType.postOnly")
|
|
70
|
+
}
|
|
71
|
+
)
|
|
65
72
|
}
|
|
66
73
|
)
|
|
67
74
|
] }),
|
|
@@ -80,14 +87,21 @@ var AdditionalInfo = (props) => {
|
|
|
80
87
|
}
|
|
81
88
|
),
|
|
82
89
|
/* @__PURE__ */ jsx(
|
|
83
|
-
|
|
90
|
+
Tooltip,
|
|
84
91
|
{
|
|
85
|
-
|
|
86
|
-
className:
|
|
87
|
-
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
content: t("orderEntry.orderType.ioc.tooltip"),
|
|
93
|
+
className: "oui-max-w-[280px] oui-text-2xs oui-text-base-contrast-80",
|
|
94
|
+
children: /* @__PURE__ */ jsx(
|
|
95
|
+
"label",
|
|
96
|
+
{
|
|
97
|
+
htmlFor: "toggle_order_iov",
|
|
98
|
+
className: cn(
|
|
99
|
+
"oui-ml-1 oui-text-2xs peer-data-[disabled]:oui-text-base-contrast-20",
|
|
100
|
+
"oui-cursor-pointer oui-whitespace-nowrap oui-break-normal oui-border-b oui-border-dashed oui-border-line-12"
|
|
101
|
+
),
|
|
102
|
+
children: t("orderEntry.orderType.ioc")
|
|
103
|
+
}
|
|
104
|
+
)
|
|
91
105
|
}
|
|
92
106
|
)
|
|
93
107
|
] }),
|
|
@@ -106,14 +120,21 @@ var AdditionalInfo = (props) => {
|
|
|
106
120
|
}
|
|
107
121
|
),
|
|
108
122
|
/* @__PURE__ */ jsx(
|
|
109
|
-
|
|
123
|
+
Tooltip,
|
|
110
124
|
{
|
|
111
|
-
|
|
112
|
-
className:
|
|
113
|
-
|
|
114
|
-
"
|
|
115
|
-
|
|
116
|
-
|
|
125
|
+
content: t("orderEntry.orderType.fok.tooltip"),
|
|
126
|
+
className: "oui-max-w-[280px] oui-text-2xs oui-text-base-contrast-80",
|
|
127
|
+
children: /* @__PURE__ */ jsx(
|
|
128
|
+
"label",
|
|
129
|
+
{
|
|
130
|
+
htmlFor: "toggle_order_fok",
|
|
131
|
+
className: cn(
|
|
132
|
+
"oui-ml-1 oui-text-2xs peer-data-[disabled]:oui-text-base-contrast-20",
|
|
133
|
+
"oui-cursor-pointer oui-whitespace-nowrap oui-break-normal oui-border-b oui-border-dashed oui-border-line-12"
|
|
134
|
+
),
|
|
135
|
+
children: t("orderEntry.orderType.fok")
|
|
136
|
+
}
|
|
137
|
+
)
|
|
117
138
|
}
|
|
118
139
|
)
|
|
119
140
|
] })
|
|
@@ -157,11 +178,18 @@ var AdditionalInfo = (props) => {
|
|
|
157
178
|
}
|
|
158
179
|
),
|
|
159
180
|
/* @__PURE__ */ jsx(
|
|
160
|
-
|
|
181
|
+
Tooltip,
|
|
161
182
|
{
|
|
162
|
-
|
|
163
|
-
className: "oui-
|
|
164
|
-
children:
|
|
183
|
+
content: t("orderEntry.hidden.tooltip"),
|
|
184
|
+
className: "oui-max-w-[280px] oui-text-2xs oui-text-base-contrast-80",
|
|
185
|
+
children: /* @__PURE__ */ jsx(
|
|
186
|
+
"label",
|
|
187
|
+
{
|
|
188
|
+
htmlFor: "toggle_order_hidden",
|
|
189
|
+
className: "oui-ml-1 oui-cursor-pointer oui-border-b oui-border-dashed oui-border-line-12 oui-text-2xs",
|
|
190
|
+
children: t("orderEntry.hidden")
|
|
191
|
+
}
|
|
192
|
+
)
|
|
165
193
|
}
|
|
166
194
|
)
|
|
167
195
|
] })
|
|
@@ -874,6 +902,11 @@ function AssetInfo(props) {
|
|
|
874
902
|
const { canTrade, disableFeatures, orderType, symbol } = props;
|
|
875
903
|
const { t } = useTranslation();
|
|
876
904
|
const { isMobile } = useScreen();
|
|
905
|
+
const displayEstLiqPrice = useGetEstLiqPrice({
|
|
906
|
+
estLiqPrice: props.estLiqPrice,
|
|
907
|
+
symbol,
|
|
908
|
+
side: props.side
|
|
909
|
+
});
|
|
877
910
|
return /* @__PURE__ */ jsxs("div", { className: "oui-space-y-[2px] xl:oui-space-y-1", children: [
|
|
878
911
|
/* @__PURE__ */ jsxs(Flex, { justify: "between", children: [
|
|
879
912
|
isMobile ? /* @__PURE__ */ jsx(Text, { size: "2xs", children: t("orderEntry.estLiqPrice") }) : /* @__PURE__ */ jsx(
|
|
@@ -910,7 +943,7 @@ function AssetInfo(props) {
|
|
|
910
943
|
dp: props.dp,
|
|
911
944
|
className: "oui-text-base-contrast-80",
|
|
912
945
|
unitClassName: "oui-ml-1 oui-text-base-contrast-36",
|
|
913
|
-
children: canTrade ?
|
|
946
|
+
children: canTrade ? displayEstLiqPrice ?? "--" : "--"
|
|
914
947
|
}
|
|
915
948
|
)
|
|
916
949
|
] }),
|
|
@@ -4161,11 +4194,8 @@ var OrderEntry = (props) => {
|
|
|
4161
4194
|
const soundAlertId = useId();
|
|
4162
4195
|
const { getErrorMsg } = useOrderEntryFormErrorMsg(validated ? errors : null);
|
|
4163
4196
|
const buttonLabel = useMemo(() => {
|
|
4164
|
-
if (isMobile && freeCollateral <= 0) {
|
|
4165
|
-
return t("common.deposit");
|
|
4166
|
-
}
|
|
4167
4197
|
return side === OrderSide.BUY ? t("orderEntry.buyLong") : t("orderEntry.sellShort");
|
|
4168
|
-
}, [side, t, isMobile
|
|
4198
|
+
}, [side, t, isMobile]);
|
|
4169
4199
|
useEffect(() => {
|
|
4170
4200
|
if (validated) {
|
|
4171
4201
|
setErrorMsgVisible(true);
|
|
@@ -4437,17 +4467,9 @@ var OrderEntry = (props) => {
|
|
|
4437
4467
|
id: "order-entry-submit-button",
|
|
4438
4468
|
"data-type": OrderSide.BUY,
|
|
4439
4469
|
className: cn(
|
|
4440
|
-
|
|
4470
|
+
side === OrderSide.BUY ? "orderly-order-entry-submit-button-buy oui-bg-success-darken hover:oui-bg-success-darken/80 active:oui-bg-success-darken/80" : "orderly-order-entry-submit-button-sell oui-bg-danger-darken hover:oui-bg-danger-darken/80 active:oui-bg-danger-darken/80"
|
|
4441
4471
|
),
|
|
4442
|
-
onClick:
|
|
4443
|
-
if (isMobile && freeCollateral <= 0) {
|
|
4444
|
-
modal.show("DepositAndWithdrawWithSheetId", {
|
|
4445
|
-
activeTab: "deposit"
|
|
4446
|
-
});
|
|
4447
|
-
} else {
|
|
4448
|
-
validateSubmit();
|
|
4449
|
-
}
|
|
4450
|
-
},
|
|
4472
|
+
onClick: validateSubmit,
|
|
4451
4473
|
loading: props.isMutating,
|
|
4452
4474
|
disabled: !props.canTrade,
|
|
4453
4475
|
children: buttonLabel
|
|
@@ -4459,6 +4481,7 @@ var OrderEntry = (props) => {
|
|
|
4459
4481
|
canTrade: props.canTrade,
|
|
4460
4482
|
quote: symbolInfo.quote,
|
|
4461
4483
|
estLiqPrice: props.estLiqPrice,
|
|
4484
|
+
estLiqPriceDistance: props.estLiqPriceDistance,
|
|
4462
4485
|
estLeverage: props.estLeverage,
|
|
4463
4486
|
currentLeverage: props.currentLeverage,
|
|
4464
4487
|
slippage,
|
|
@@ -4467,7 +4490,8 @@ var OrderEntry = (props) => {
|
|
|
4467
4490
|
estSlippage: props.estSlippage,
|
|
4468
4491
|
orderType: formattedOrder.order_type,
|
|
4469
4492
|
disableFeatures,
|
|
4470
|
-
symbol: props.symbol
|
|
4493
|
+
symbol: props.symbol,
|
|
4494
|
+
side
|
|
4471
4495
|
}
|
|
4472
4496
|
),
|
|
4473
4497
|
/* @__PURE__ */ jsx(Divider, { className: "oui-w-full" }),
|
|
@@ -4954,7 +4978,9 @@ var useOrderEntryScript = (inputs) => {
|
|
|
4954
4978
|
const slPriceError = useTpslPriceChecker({
|
|
4955
4979
|
slPrice: formattedOrder.sl_trigger_price,
|
|
4956
4980
|
liqPrice: state.estLiqPrice,
|
|
4957
|
-
side: formattedOrder.side
|
|
4981
|
+
side: formattedOrder.side,
|
|
4982
|
+
currentPosition: state.currentPosition,
|
|
4983
|
+
orderQuantity: Number(formattedOrder.order_quantity)
|
|
4958
4984
|
});
|
|
4959
4985
|
useEffect(() => {
|
|
4960
4986
|
if (formattedOrder.reduce_only) {
|