@orderly.network/ui-orders 2.10.2 → 2.11.0-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.js +25 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -11
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React2, { forwardRef, useMemo, useEffect, useRef, useImperativeHandle, useCallback, useState, createContext, memo, useContext } from 'react';
|
|
2
2
|
import { useSymbolsInfo, useOrderStream, useLocalStorage, utils, useThrottledCallback, useMutation, useSWRConfig, useAccount, unstable_serialize, useMemoizedFn, getMinNotional, findTPSLFromOrder, findTPSLOrderPriceFromOrder, useMaxQty, useConfig, useTpslPriceChecker, useOrderEntity, useReferralInfo, useLeverageBySymbol } from '@orderly.network/hooks';
|
|
3
3
|
import { useTranslation, Trans, i18n } from '@orderly.network/i18n';
|
|
4
|
-
import { OrderStatus, AlgoOrderRootType, AlgoOrderType, OrderSide, OrderType, EMPTY_LIST } from '@orderly.network/types';
|
|
4
|
+
import { OrderStatus, AlgoOrderRootType, AlgoOrderType, OrderSide, OrderType, MarginMode, EMPTY_LIST } from '@orderly.network/types';
|
|
5
5
|
import { formatSymbol, Decimal, commify, commifyOptional, getTrailingStopPrice, formatNum } from '@orderly.network/utils';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
import { usePagination, modal, Text, Button, ThrottledButton, CloseIcon, cn, Flex, Input, inputFormatter, Slider, DataFilter, TableFeatures, Grid, Picker, ListView, Tabs, TabPanel, Badge, Tooltip, EditIcon, toast as toast$1, Popover, PopoverRoot, PopoverTrigger, PopoverContent, Divider, ShareIcon, CheckIcon, Statistic, SimpleDialog, useModal, Checkbox } from '@orderly.network/ui';
|
|
@@ -283,7 +283,7 @@ var init_shareButton_script = __esm({
|
|
|
283
283
|
const refCode = useMemo(() => {
|
|
284
284
|
return getFirstRefCode()?.code;
|
|
285
285
|
}, [getFirstRefCode]);
|
|
286
|
-
const leverage = useLeverageBySymbol(order.symbol);
|
|
286
|
+
const leverage = useLeverageBySymbol(order.symbol, order.margin_mode);
|
|
287
287
|
const showModal = () => {
|
|
288
288
|
modal.show(props.modalId, {
|
|
289
289
|
pnl: {
|
|
@@ -821,6 +821,9 @@ var init_activedPriceCell = __esm({
|
|
|
821
821
|
algo_order_id: order.algo_order_id,
|
|
822
822
|
activated_price: value
|
|
823
823
|
};
|
|
824
|
+
if (order.margin_mode !== void 0) {
|
|
825
|
+
data.margin_mode = order.margin_mode;
|
|
826
|
+
}
|
|
824
827
|
editAlgoOrder(order.algo_order_id.toString(), data).then((result) => {
|
|
825
828
|
closePopover();
|
|
826
829
|
setValue(value);
|
|
@@ -959,6 +962,9 @@ var init_priceCell = __esm({
|
|
|
959
962
|
if (order.client_order_id) {
|
|
960
963
|
data.client_order_id = order.client_order_id;
|
|
961
964
|
}
|
|
965
|
+
if (order.margin_mode !== void 0) {
|
|
966
|
+
data.margin_mode = order.margin_mode;
|
|
967
|
+
}
|
|
962
968
|
if (isAlgoOrder) {
|
|
963
969
|
order_id = order.algo_order_id;
|
|
964
970
|
data = {
|
|
@@ -1387,6 +1393,9 @@ var init_quantityCell = __esm({
|
|
|
1387
1393
|
if (order?.tag !== void 0) {
|
|
1388
1394
|
params["order_tag"] = order.tag;
|
|
1389
1395
|
}
|
|
1396
|
+
if (order.margin_mode !== void 0) {
|
|
1397
|
+
params.margin_mode = order.margin_mode;
|
|
1398
|
+
}
|
|
1390
1399
|
let future;
|
|
1391
1400
|
if ("algo_type" in order && order.algo_type === AlgoOrderRootType.TP_SL) {
|
|
1392
1401
|
future = onUpdateTPSLOrder(order, params);
|
|
@@ -1552,7 +1561,10 @@ var init_quantityCell = __esm({
|
|
|
1552
1561
|
confirmOpen,
|
|
1553
1562
|
order
|
|
1554
1563
|
} = props;
|
|
1555
|
-
const maxBuyQty = useMaxQty(symbol, order.side,
|
|
1564
|
+
const maxBuyQty = useMaxQty(symbol, order.side, {
|
|
1565
|
+
reduceOnly: order.reduce_only,
|
|
1566
|
+
marginMode: order.margin_mode ?? MarginMode.CROSS
|
|
1567
|
+
});
|
|
1556
1568
|
const maxQty = useMemo(() => {
|
|
1557
1569
|
if (reduce_only) {
|
|
1558
1570
|
return Math.abs(positionQty ?? 0);
|
|
@@ -1787,6 +1799,9 @@ var init_trailingCallbackCell = __esm({
|
|
|
1787
1799
|
callback_value: isCallbackValue ? value : void 0,
|
|
1788
1800
|
callback_rate: isCallbackRate ? `${Number(value) / 100}` : void 0
|
|
1789
1801
|
};
|
|
1802
|
+
if (order.margin_mode !== void 0) {
|
|
1803
|
+
data.margin_mode = order.margin_mode;
|
|
1804
|
+
}
|
|
1790
1805
|
editAlgoOrder(order.algo_order_id.toString(), data).then((result) => {
|
|
1791
1806
|
closePopover();
|
|
1792
1807
|
setValue(value);
|
|
@@ -1903,6 +1918,9 @@ var init_triggerPriceCell = __esm({
|
|
|
1903
1918
|
trigger_price: value,
|
|
1904
1919
|
algo_order_id: order.algo_order_id
|
|
1905
1920
|
};
|
|
1921
|
+
if (order.margin_mode !== void 0) {
|
|
1922
|
+
data.margin_mode = order.margin_mode;
|
|
1923
|
+
}
|
|
1906
1924
|
editAlgoOrder(`${order.algo_order_id}`, data).then((result) => {
|
|
1907
1925
|
closePopover();
|
|
1908
1926
|
setValue(value);
|
|
@@ -4703,6 +4721,7 @@ var init_useEditOrderEntry = __esm({
|
|
|
4703
4721
|
side: order.side,
|
|
4704
4722
|
reduce_only: order.reduce_only,
|
|
4705
4723
|
order_type: orderType,
|
|
4724
|
+
margin_mode: order.margin_mode,
|
|
4706
4725
|
// TODO: trailing stop order edit price twice, order.price will be 0
|
|
4707
4726
|
order_price: order.price || void 0,
|
|
4708
4727
|
order_quantity: order.quantity,
|
|
@@ -4763,7 +4782,10 @@ var init_useEditOrderEntry = __esm({
|
|
|
4763
4782
|
});
|
|
4764
4783
|
function useEditOrderMaxQty(order, positionQty) {
|
|
4765
4784
|
const { reduce_only } = order;
|
|
4766
|
-
const maxQty = useMaxQty(order.symbol, order.side,
|
|
4785
|
+
const maxQty = useMaxQty(order.symbol, order.side, {
|
|
4786
|
+
reduceOnly: reduce_only,
|
|
4787
|
+
marginMode: order.margin_mode ?? MarginMode.CROSS
|
|
4788
|
+
});
|
|
4767
4789
|
return useMemo(() => {
|
|
4768
4790
|
if (reduce_only) {
|
|
4769
4791
|
return Math.abs(positionQty ?? 0);
|