@orderly.network/trading 2.8.5 → 2.8.6
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 +153 -71
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +154 -72
- package/dist/index.mjs.map +1 -1
- package/package.json +21 -21
package/dist/index.mjs
CHANGED
|
@@ -3,10 +3,10 @@ import React11, { forwardRef, useMemo, createContext, useContext, useState, useC
|
|
|
3
3
|
import { useDataTap, useAppContext } from '@orderly.network/react-app';
|
|
4
4
|
import { AccountStatusEnum, ChainNamespace, AlgoOrderRootType, OrderStatus, OrderSide, AssetHistoryStatusEnum, AssetHistorySideEnum, TradingviewFullscreenKey, OrderEntrySortKeys, EMPTY_LIST } from '@orderly.network/types';
|
|
5
5
|
import { TabType, DesktopOrderListWidget, MobileOrderListWidget } from '@orderly.network/ui-orders';
|
|
6
|
-
import { installExtension, ExtensionPositionEnum, cn, Button, formatAddress, registerSimpleDialog, registerSimpleSheet, modal, useModal, Flex, toast as toast$1, Text, ArrowRightShortIcon, Box, ListView, Grid, ArrowDownShortIcon, gradientTextVariants, EyeIcon, EyeCloseIcon, Divider, ChevronDownIcon, useScreen, Tooltip, Tabs, TabPanel, CloseIcon, DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuContent, Statistic, RefreshIcon, ArrowLeftRightIcon, ArrowUpShortIcon, InfoCircleIcon, ExtensionSlot, NewsFillIcon, SimpleSheet, SimpleDialog, ChainIcon, Checkbox, SettingFillIcon, ExclamationFillIcon, Spinner, Select, Popover, CaretUpIcon, CaretDownIcon, Picker, TooltipRoot, TooltipTrigger, TooltipContent as TooltipContent$1, TooltipArrow, parseNumber } from '@orderly.network/ui';
|
|
7
6
|
import { useTranslation, i18n, Trans } from '@orderly.network/i18n';
|
|
7
|
+
import { installExtension, ExtensionPositionEnum, cn, Button, formatAddress, registerSimpleDialog, registerSimpleSheet, modal, useModal, Flex, toast as toast$1, Text, ArrowRightShortIcon, Box, ListView, Grid, ArrowDownShortIcon, gradientTextVariants, EyeIcon, EyeCloseIcon, Divider, ChevronDownIcon, useScreen, Tooltip, Tabs, TabPanel, CloseIcon, DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuContent, Statistic, RefreshIcon, ArrowLeftRightIcon, ArrowUpShortIcon, InfoCircleIcon, ExtensionSlot, NewsFillIcon, SimpleSheet, SimpleDialog, ChainIcon, ExclamationFillIcon, Switch, Checkbox, Sheet, SheetTrigger, SheetContent, SettingFillIcon, Spinner, Select, Popover, CaretUpIcon, CaretDownIcon, Picker, TooltipRoot, TooltipTrigger, TooltipContent as TooltipContent$1, TooltipArrow, parseNumber } from '@orderly.network/ui';
|
|
8
8
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
|
-
import { PositionHistoryWidget, LiquidationWidget, PositionsWidget, CloseAllPositionsWidget, MobileLiquidationWidget, MobilePositionsWidget, MobilePositionHistoryWidget } from '@orderly.network/ui-positions';
|
|
9
|
+
import { PositionHistoryWidget, LiquidationWidget, PositionsWidget, CloseAllPositionsWidget, MobileLiquidationWidget, MobilePositionsWidget, MobilePositionHistoryWidget, useReversePositionEnabled } from '@orderly.network/ui-positions';
|
|
10
10
|
import { isTestnet, Decimal, commifyOptional, removeTrailingZeros, formatSymbol, optimizeSymbolDisplay, getPrecisionByNumber } from '@orderly.network/utils';
|
|
11
11
|
import { AssetsModule } from '@orderly.network/portfolio';
|
|
12
12
|
import { AuthGuard } from '@orderly.network/ui-connector';
|
|
@@ -179,6 +179,113 @@ var init_setting_ui = __esm({
|
|
|
179
179
|
Setting = (props) => {
|
|
180
180
|
const [open, setOpen] = useState(false);
|
|
181
181
|
const { t } = useTranslation();
|
|
182
|
+
const { isMobile } = useScreen();
|
|
183
|
+
const SettingsContent = useMemo(() => {
|
|
184
|
+
return () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
185
|
+
/* @__PURE__ */ jsxs("div", { className: "oui-flex oui-flex-col oui-text-sm", children: [
|
|
186
|
+
/* @__PURE__ */ jsx(
|
|
187
|
+
Flex,
|
|
188
|
+
{
|
|
189
|
+
itemAlign: "center",
|
|
190
|
+
justify: isMobile ? "center" : "start",
|
|
191
|
+
className: "oui-w-full",
|
|
192
|
+
children: /* @__PURE__ */ jsx(Text, { className: "oui-text-base oui-pb-3", children: t("trading.portfolioSettings") })
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
196
|
+
/* @__PURE__ */ jsx(Text, { className: "oui-pb-3 oui-text-base-contrast-54 oui-mt-2", children: t("trading.portfolioSettings.decimalPrecision") }),
|
|
197
|
+
/* @__PURE__ */ jsx(
|
|
198
|
+
DecimalPrecisionCheckbox,
|
|
199
|
+
{
|
|
200
|
+
value: props.pnlNotionalDecimalPrecision,
|
|
201
|
+
onValueChange: (e) => {
|
|
202
|
+
props.setPnlNotionalDecimalPrecision(e);
|
|
203
|
+
setOpen(false);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
),
|
|
207
|
+
/* @__PURE__ */ jsx(Divider, { className: "oui-my-3" }),
|
|
208
|
+
/* @__PURE__ */ jsx(Text, { className: "oui-pb-3 oui-text-base-contrast-54 oui-mt-2", children: t("trading.portfolioSettings.unrealPnlPriceBasis") }),
|
|
209
|
+
/* @__PURE__ */ jsx(
|
|
210
|
+
UnPnlPriceBasisCheckBox,
|
|
211
|
+
{
|
|
212
|
+
value: props.unPnlPriceBasis,
|
|
213
|
+
onValueChange: (e) => {
|
|
214
|
+
props.setUnPnlPriceBasic(e);
|
|
215
|
+
setOpen(false);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
)
|
|
219
|
+
] }),
|
|
220
|
+
/* @__PURE__ */ jsx(Divider, { className: "oui-my-3" }),
|
|
221
|
+
/* @__PURE__ */ jsxs(Flex, { itemAlign: "center", gap: 1, justify: "between", children: [
|
|
222
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 1, itemAlign: "center", children: [
|
|
223
|
+
/* @__PURE__ */ jsx(Text, { size: "sm", intensity: 54, children: t("trading.portfolioSettings.reversePosition") }),
|
|
224
|
+
isMobile ? /* @__PURE__ */ jsx(
|
|
225
|
+
ExclamationFillIcon,
|
|
226
|
+
{
|
|
227
|
+
size: 14,
|
|
228
|
+
className: "oui-text-base-contrast-54 hover:oui-text-base-contrast-80 oui-cursor-pointer",
|
|
229
|
+
onClick: () => {
|
|
230
|
+
modal.alert({
|
|
231
|
+
title: t("common.tips"),
|
|
232
|
+
message: t(
|
|
233
|
+
"trading.portfolioSettings.reversePosition.tooltip"
|
|
234
|
+
)
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
) : /* @__PURE__ */ jsx(
|
|
239
|
+
Tooltip,
|
|
240
|
+
{
|
|
241
|
+
content: t("trading.portfolioSettings.reversePosition.tooltip"),
|
|
242
|
+
className: "oui-max-w-[300px]",
|
|
243
|
+
children: /* @__PURE__ */ jsx(
|
|
244
|
+
ExclamationFillIcon,
|
|
245
|
+
{
|
|
246
|
+
size: 14,
|
|
247
|
+
className: "oui-text-base-contrast-54 hover:oui-text-base-contrast-80 oui-cursor-pointer"
|
|
248
|
+
}
|
|
249
|
+
)
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
] }),
|
|
253
|
+
/* @__PURE__ */ jsx(
|
|
254
|
+
Switch,
|
|
255
|
+
{
|
|
256
|
+
checked: props.reversePosition,
|
|
257
|
+
onCheckedChange: (checked) => {
|
|
258
|
+
props.setReversePosition(checked);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
)
|
|
262
|
+
] })
|
|
263
|
+
] });
|
|
264
|
+
}, [
|
|
265
|
+
t,
|
|
266
|
+
isMobile,
|
|
267
|
+
props.pnlNotionalDecimalPrecision,
|
|
268
|
+
props.unPnlPriceBasis,
|
|
269
|
+
props.reversePosition
|
|
270
|
+
]);
|
|
271
|
+
const triggerButton = /* @__PURE__ */ jsx(
|
|
272
|
+
Button,
|
|
273
|
+
{
|
|
274
|
+
size: "xs",
|
|
275
|
+
type: "button",
|
|
276
|
+
variant: "contained",
|
|
277
|
+
className: "oui-bg-transparent hover:oui-bg-transparent",
|
|
278
|
+
children: /* @__PURE__ */ jsx(
|
|
279
|
+
SettingFillIcon,
|
|
280
|
+
{
|
|
281
|
+
size: 16,
|
|
282
|
+
color: "white",
|
|
283
|
+
opacity: 1,
|
|
284
|
+
className: "oui-text-white/[.36] hover:oui-text-white/80"
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
}
|
|
288
|
+
);
|
|
182
289
|
return /* @__PURE__ */ jsxs(Flex, { gap: 0, children: [
|
|
183
290
|
/* @__PURE__ */ jsxs(Flex, { gap: 1, children: [
|
|
184
291
|
/* @__PURE__ */ jsx(
|
|
@@ -201,58 +308,26 @@ var init_setting_ui = __esm({
|
|
|
201
308
|
}
|
|
202
309
|
)
|
|
203
310
|
] }),
|
|
204
|
-
/* @__PURE__ */ jsxs(
|
|
205
|
-
/* @__PURE__ */ jsx(
|
|
206
|
-
|
|
311
|
+
isMobile ? /* @__PURE__ */ jsxs(Sheet, { open, onOpenChange: setOpen, children: [
|
|
312
|
+
/* @__PURE__ */ jsx(SheetTrigger, { asChild: true, children: triggerButton }),
|
|
313
|
+
/* @__PURE__ */ jsx(SheetContent, { side: "bottom", className: "oui-px-5 oui-pt-3", children: /* @__PURE__ */ jsx(
|
|
314
|
+
"div",
|
|
207
315
|
{
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
children: /* @__PURE__ */ jsx(
|
|
213
|
-
SettingFillIcon,
|
|
214
|
-
{
|
|
215
|
-
size: 16,
|
|
216
|
-
color: "white",
|
|
217
|
-
opacity: 1,
|
|
218
|
-
className: "oui-text-white/[.36] hover:oui-text-white/80"
|
|
219
|
-
}
|
|
220
|
-
)
|
|
316
|
+
style: {
|
|
317
|
+
paddingBottom: `max(32px, calc(12px + env(safe-area-inset-bottom)))`
|
|
318
|
+
},
|
|
319
|
+
children: /* @__PURE__ */ jsx(SettingsContent, {})
|
|
221
320
|
}
|
|
222
|
-
) })
|
|
321
|
+
) })
|
|
322
|
+
] }) : /* @__PURE__ */ jsxs(DropdownMenuRoot, { open, onOpenChange: setOpen, children: [
|
|
323
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: triggerButton }),
|
|
223
324
|
/* @__PURE__ */ jsx(
|
|
224
325
|
DropdownMenuContent,
|
|
225
326
|
{
|
|
226
327
|
className: "oui-px-5 oui-py-3 oui-w-[360px]",
|
|
227
328
|
alignOffset: 2,
|
|
228
329
|
align: "end",
|
|
229
|
-
children: /* @__PURE__ */
|
|
230
|
-
/* @__PURE__ */ jsx(Text, { className: "oui-text-base oui-pb-3", children: t("trading.portfolioSettings") }),
|
|
231
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
232
|
-
/* @__PURE__ */ jsx(Text, { className: "oui-pb-3 oui-text-base-contrast-54 oui-mt-2", children: t("trading.portfolioSettings.decimalPrecision") }),
|
|
233
|
-
/* @__PURE__ */ jsx(
|
|
234
|
-
DecimalPrecisionCheckbox,
|
|
235
|
-
{
|
|
236
|
-
value: props.pnlNotionalDecimalPrecision,
|
|
237
|
-
onValueChange: (e) => {
|
|
238
|
-
props.setPnlNotionalDecimalPrecision(e);
|
|
239
|
-
setOpen(false);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
),
|
|
243
|
-
/* @__PURE__ */ jsx(Divider, { className: "oui-my-3" }),
|
|
244
|
-
/* @__PURE__ */ jsx(Text, { className: "oui-pb-3 oui-text-base-contrast-54 oui-mt-2", children: t("trading.portfolioSettings.unrealPnlPriceBasis") }),
|
|
245
|
-
/* @__PURE__ */ jsx(
|
|
246
|
-
UnPnlPriceBasisCheckBox,
|
|
247
|
-
{
|
|
248
|
-
value: props.unPnlPriceBasis,
|
|
249
|
-
onValueChange: (e) => {
|
|
250
|
-
props.setUnPnlPriceBasic(e);
|
|
251
|
-
setOpen(false);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
)
|
|
255
|
-
] })
|
|
330
|
+
children: /* @__PURE__ */ jsx(SettingsContent, {})
|
|
256
331
|
}
|
|
257
332
|
)
|
|
258
333
|
] })
|
|
@@ -378,14 +453,15 @@ var init_setting_ui = __esm({
|
|
|
378
453
|
};
|
|
379
454
|
}
|
|
380
455
|
});
|
|
381
|
-
|
|
382
|
-
// src/components/desktop/dataList/setting/setting.script.tsx
|
|
383
456
|
var useSettingScript;
|
|
384
457
|
var init_setting_script = __esm({
|
|
385
458
|
"src/components/desktop/dataList/setting/setting.script.tsx"() {
|
|
386
459
|
useSettingScript = (props) => {
|
|
460
|
+
const { isEnabled, setEnabled } = useReversePositionEnabled();
|
|
387
461
|
return {
|
|
388
|
-
...props
|
|
462
|
+
...props,
|
|
463
|
+
reversePosition: isEnabled,
|
|
464
|
+
setReversePosition: setEnabled
|
|
389
465
|
};
|
|
390
466
|
};
|
|
391
467
|
}
|
|
@@ -417,6 +493,7 @@ var init_setting = __esm({
|
|
|
417
493
|
var PositionHeader, MobileLayout, DesktopLayout, UnrealPnL, Notional;
|
|
418
494
|
var init_positionHeader_ui = __esm({
|
|
419
495
|
"src/components/base/positionHeader/positionHeader.ui.tsx"() {
|
|
496
|
+
init_setting();
|
|
420
497
|
PositionHeader = (props) => {
|
|
421
498
|
const { isMobile } = useScreen();
|
|
422
499
|
return isMobile ? /* @__PURE__ */ jsx(MobileLayout, { ...props }) : /* @__PURE__ */ jsx(DesktopLayout, { ...props });
|
|
@@ -463,27 +540,19 @@ var init_positionHeader_ui = __esm({
|
|
|
463
540
|
justify: "between",
|
|
464
541
|
width: "100%",
|
|
465
542
|
children: [
|
|
466
|
-
/* @__PURE__ */
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
}
|
|
477
|
-
),
|
|
478
|
-
/* @__PURE__ */ jsx(
|
|
479
|
-
"label",
|
|
480
|
-
{
|
|
481
|
-
className: "oui-cursor-pointer oui-text-2xs oui-text-base-contrast-54 oui-ml-1",
|
|
482
|
-
htmlFor: "oui-checkbox-hideOtherSymbols",
|
|
483
|
-
children: t("trading.hideOtherSymbols")
|
|
543
|
+
/* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(
|
|
544
|
+
SettingWidget,
|
|
545
|
+
{
|
|
546
|
+
pnlNotionalDecimalPrecision: props.pnlNotionalDecimalPrecision,
|
|
547
|
+
setPnlNotionalDecimalPrecision: props.setPnlNotionalDecimalPrecision,
|
|
548
|
+
unPnlPriceBasis: props.unPnlPriceBasis,
|
|
549
|
+
setUnPnlPriceBasic: props.setUnPnlPriceBasic,
|
|
550
|
+
hideOtherSymbols: !props.showAllSymbol,
|
|
551
|
+
setHideOtherSymbols: (value) => {
|
|
552
|
+
props.setShowAllSymbol(!value);
|
|
484
553
|
}
|
|
485
|
-
|
|
486
|
-
|
|
554
|
+
}
|
|
555
|
+
) }),
|
|
487
556
|
/* @__PURE__ */ jsx(CloseAllPositionsWidget, { symbol: props.symbol })
|
|
488
557
|
]
|
|
489
558
|
}
|
|
@@ -560,7 +629,13 @@ var init_positionHeader_script = __esm({
|
|
|
560
629
|
"src/components/base/positionHeader/positionHeader.script.tsx"() {
|
|
561
630
|
init_hooks();
|
|
562
631
|
usePositionHeaderScript = (inputs) => {
|
|
563
|
-
const {
|
|
632
|
+
const {
|
|
633
|
+
pnlNotionalDecimalPrecision,
|
|
634
|
+
setPnlNotionalDecimalPrecision,
|
|
635
|
+
unPnlPriceBasis,
|
|
636
|
+
setUnPnlPriceBasic,
|
|
637
|
+
symbol
|
|
638
|
+
} = inputs;
|
|
564
639
|
const calcMode = unPnlPriceBasis;
|
|
565
640
|
const [data] = usePositionStream(symbol, {
|
|
566
641
|
calcMode
|
|
@@ -577,7 +652,10 @@ var init_positionHeader_script = __esm({
|
|
|
577
652
|
notional,
|
|
578
653
|
showAllSymbol,
|
|
579
654
|
setShowAllSymbol,
|
|
580
|
-
symbol
|
|
655
|
+
symbol,
|
|
656
|
+
setPnlNotionalDecimalPrecision,
|
|
657
|
+
unPnlPriceBasis,
|
|
658
|
+
setUnPnlPriceBasic
|
|
581
659
|
};
|
|
582
660
|
};
|
|
583
661
|
}
|
|
@@ -625,8 +703,10 @@ var init_dataList_ui = __esm({
|
|
|
625
703
|
/* @__PURE__ */ jsx(React11.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
|
|
626
704
|
LazyPositionHeaderWidget,
|
|
627
705
|
{
|
|
706
|
+
setPnlNotionalDecimalPrecision: props.setPnlNotionalDecimalPrecision,
|
|
628
707
|
pnlNotionalDecimalPrecision: props.pnlNotionalDecimalPrecision,
|
|
629
708
|
symbol: !!props.showAllSymbol ? void 0 : props.symbol,
|
|
709
|
+
setUnPnlPriceBasic: props.setUnPnlPriceBasic,
|
|
630
710
|
unPnlPriceBasis: props.unPnlPriceBasis
|
|
631
711
|
}
|
|
632
712
|
) }),
|
|
@@ -5173,8 +5253,10 @@ var init_dataList_ui2 = __esm({
|
|
|
5173
5253
|
LazyPositionHeaderWidget2,
|
|
5174
5254
|
{
|
|
5175
5255
|
pnlNotionalDecimalPrecision: props.pnlNotionalDecimalPrecision,
|
|
5256
|
+
setPnlNotionalDecimalPrecision: props.setPnlNotionalDecimalPrecision,
|
|
5176
5257
|
symbol: props.showAllSymbol ? void 0 : props.symbol,
|
|
5177
|
-
unPnlPriceBasis: props.unPnlPriceBasis
|
|
5258
|
+
unPnlPriceBasis: props.unPnlPriceBasis,
|
|
5259
|
+
setUnPnlPriceBasic: props.setUnPnlPriceBasic
|
|
5178
5260
|
}
|
|
5179
5261
|
) }),
|
|
5180
5262
|
/* @__PURE__ */ jsx(React11.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
|