@orderly.network/trading 2.11.3-rc.0 → 2.12.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 CHANGED
@@ -2798,14 +2798,21 @@ var init_markPrice_desktop = __esm({
2798
2798
  if (bids.length === 0 && asks.length === 0) {
2799
2799
  return 0;
2800
2800
  }
2801
- const bid1 = Number.isNaN(bids[0][0]) ? 0 : bids[0][0];
2802
- const index = asks.reverse().findIndex((item) => !Number.isNaN(item[0]));
2803
- let ask1 = 0;
2801
+ const bidRaw = bids[0]?.[0];
2802
+ const bid1 = bidRaw === void 0 || Number.isNaN(bidRaw) ? new utils.Decimal(0) : new utils.Decimal(bidRaw);
2803
+ const asksReversed = [...asks].reverse();
2804
+ const index = asksReversed.findIndex((item) => !Number.isNaN(item[0]));
2805
+ let ask1 = new utils.Decimal(0);
2804
2806
  if (index !== -1) {
2805
- ask1 = Number.isNaN(asks[index][0]) ? 0 : asks[index][0];
2807
+ const askRaw = asksReversed[index][0];
2808
+ ask1 = Number.isNaN(askRaw) ? new utils.Decimal(0) : new utils.Decimal(askRaw);
2806
2809
  }
2807
- const dValue = new utils.Decimal(ask1).sub(bid1).div(new utils.Decimal(ask1).add(bid1).div(2));
2808
- return Math.ceil(dValue.toNumber() * 1e6 + 0.1) / 1e4;
2810
+ const mid = ask1.add(bid1).div(2);
2811
+ if (mid.isZero()) {
2812
+ return 0;
2813
+ }
2814
+ const dValue = ask1.sub(bid1).div(mid);
2815
+ return dValue.mul(1e6).add(0.1).toDecimalPlaces(0, utils.Decimal.ROUND_CEIL).div(1e4).toNumber();
2809
2816
  }, [asks, bids]);
2810
2817
  return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
2811
2818
  ui.Tooltip,
@@ -8313,9 +8320,18 @@ var DesktopLayout4 = (props) => {
8313
8320
  dataListMinHeight
8314
8321
  } = props;
8315
8322
  const { showCountdown, closeCountdown } = useShowRwaCountdown(props.symbol);
8323
+ const { brokerName } = hooks.useBadgeBySymbol(props.symbol);
8316
8324
  const symbolInfoBarHeight2 = React12.useMemo(() => {
8317
- return showCountdown ? 104 : 56;
8318
- }, [showCountdown]);
8325
+ let height = 56;
8326
+ if (brokerName) {
8327
+ height += 46;
8328
+ height += 8;
8329
+ }
8330
+ if (showCountdown) {
8331
+ height += 48;
8332
+ }
8333
+ return height;
8334
+ }, [showCountdown, brokerName]);
8319
8335
  const { isRwa, open } = hooks.useGetRwaSymbolOpenStatus(props.symbol);
8320
8336
  React12.useEffect(() => {
8321
8337
  if (isRwa && !open) {
@@ -8452,9 +8468,6 @@ var DesktopLayout4 = (props) => {
8452
8468
  ui.Box,
8453
8469
  {
8454
8470
  className: "oui-trading-symbolInfoBar-container",
8455
- intensity: 900,
8456
- r: "2xl",
8457
- px: 3,
8458
8471
  width: "100%",
8459
8472
  style: {
8460
8473
  minHeight: symbolInfoBarHeight2,
@@ -9115,6 +9128,12 @@ var MaybeEqual = () => {
9115
9128
  var MobileLayout4 = (props) => {
9116
9129
  const { t } = i18n.useTranslation();
9117
9130
  const { isRwa, open, closeTimeInterval } = hooks.useGetRwaSymbolInfo(props.symbol);
9131
+ const { brokerId, brokerName, brokerNameRaw, displayName } = hooks.useBadgeBySymbol(
9132
+ props.symbol
9133
+ );
9134
+ const isCommunityListed = Boolean(brokerId ?? brokerName);
9135
+ const baseFromSymbol = props.symbol?.split("_")[1] ?? props.symbol ?? "";
9136
+ const symbolWithBroker = brokerName != null ? `${baseFromSymbol}-${brokerNameRaw}` : displayName ?? props.symbol ?? "";
9118
9137
  React12.useEffect(() => {
9119
9138
  if (isRwa && !open) {
9120
9139
  showRwaOutsideMarketHoursNotify();
@@ -9208,7 +9227,17 @@ var MobileLayout4 = (props) => {
9208
9227
  )
9209
9228
  }
9210
9229
  );
9211
- const topBar = /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { intensity: 900, className: "oui-rounded-xl", mx: 1, px: 3, py: 2, children: [
9230
+ const topBar = /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { children: [
9231
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { mx: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
9232
+ markets.SymbolInfoBarRiskNotice,
9233
+ {
9234
+ visible: isCommunityListed,
9235
+ symbolWithBroker,
9236
+ brokerName: brokerNameRaw ?? brokerName ?? "",
9237
+ autoHeight: true,
9238
+ className: "oui-my-1"
9239
+ }
9240
+ ) }),
9212
9241
  symbolInfoBar,
9213
9242
  /* @__PURE__ */ jsxRuntime.jsx(
9214
9243
  ui.SimpleSheet,
@@ -9216,7 +9245,7 @@ var MobileLayout4 = (props) => {
9216
9245
  open: props.openMarketsSheet,
9217
9246
  onOpenChange: props.onOpenMarketsSheetChange,
9218
9247
  classNames: {
9219
- body: "oui-h-full oui-pb-0",
9248
+ body: "oui-h-full oui-pb-0 ",
9220
9249
  content: "!oui-w-[372px] !oui-max-w-[372px] !oui-p-0"
9221
9250
  },
9222
9251
  contentProps: { side: "left", closeable: false },
@@ -9250,6 +9279,7 @@ var MobileLayout4 = (props) => {
9250
9279
  };
9251
9280
  var Trading = (props) => {
9252
9281
  const { isMobile } = ui.useScreen();
9282
+ const { t } = i18n.useTranslation();
9253
9283
  if (isMobile) {
9254
9284
  return /* @__PURE__ */ jsxRuntime.jsx(MobileLayout4, { ...props });
9255
9285
  }