@orderly.network/portfolio 2.10.0 → 2.10.1

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.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import React12, { createContext, useMemo, useId, useContext, useState, useCallback, useRef, createElement, useEffect } from 'react';
2
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
- import { useLocalStorage, useAccount, useIndexPricesStream, useCollateral, usePrivateQuery, useStatisticsDaily, useBalanceTopic, useAssetsHistory, useFeeState, useMediaQuery, useAccountInfo, useGetClaimed, DistributionId, TWType, useCurEpochEstimate, useAllBrokers, noCacheConfig, useEpochInfo, useConfig, useGetEnv, useMutation, useOrderlyContext, useDebouncedCallback, useWalletConnector, useAppStore, parseJSON, usePositionStream, useChains, useLeverage, useMaxWithdrawal, useTransferHistory, useChainInfo, useSymbolsInfo, useFundingFeeHistory, useSubAccountQuery, useApiKeyManager, useDistributionHistory, useVaultsHistory } from '@orderly.network/hooks';
2
+ import { useLocalStorage, useAccount, useIndexPricesStream, useCollateral, usePrivateQuery, useStatisticsDaily, useBalanceTopic, useAssetsHistory, useFeeState, useMediaQuery, useAccountInfo, useWalletConnector, usePositionStream, useLeverage, useMaxWithdrawal, useGetClaimed, DistributionId, TWType, useCurEpochEstimate, useAllBrokers, noCacheConfig, useEpochInfo, useConfig, useGetEnv, useMutation, useOrderlyContext, useDebouncedCallback, useAppStore, parseJSON, useChains, useTransferHistory, useChainInfo, useSymbolsInfo, useFundingFeeHistory, useSubAccountQuery, useApiKeyManager, useDistributionHistory, useVaultsHistory } from '@orderly.network/hooks';
4
3
  import { useAppContext, useDataTap, useCanTrade } from '@orderly.network/react-app';
5
4
  import { AccountStatusEnum, ChainNamespace, EMPTY_LIST, AssetHistoryStatusEnum, AssetHistorySideEnum } from '@orderly.network/types';
6
- import { registerSimpleSheet, registerSimpleDialog, Tabs, TabPanel, Flex, Text, modal, useModal, SimpleDialog, DataTable, SimpleSheet, TokenIcon, Divider, toast, useScreen, CardTitle, Select, Box, Tooltip, cn, Statistic, CopyIcon, Grid, formatAddress, DataFilter, InfoCircleIcon, Button, EmptyDataState, EyeIcon, ArrowRightShortIcon, ArrowDownSquareFillIcon, ArrowLeftRightIcon, ArrowUpSquareFillIcon, CalendarMinusIcon, AffiliateIcon, ChevronRightIcon, TraderMobileIcon, SettingFillIcon, Card, Switch, ChainIcon, Either, gradientTextVariants, EyeCloseIcon, capitalizeFirstLetter, usePagination, ListView, Badge, ArrowDownShortIcon, ScrollIndicator, PlusIcon, FeeTierIcon, ServerFillIcon, ArrowLeftRightSquareFill, VaultsIcon } from '@orderly.network/ui';
5
+ import { registerSimpleSheet, registerSimpleDialog, Tabs, TabPanel, Flex, Text, modal, useModal, SimpleDialog, DataTable, SimpleSheet, TokenIcon, Divider, toast, useScreen, CardTitle, Select, Box, cn, Statistic, CopyIcon, Grid, formatAddress, DataFilter, Tooltip, InfoCircleIcon, Button, EmptyDataState, Card, Either, gradientTextVariants, EyeIcon, EyeCloseIcon, ArrowDownSquareFillIcon, ArrowLeftRightIcon, ArrowUpSquareFillIcon, ArrowRightShortIcon, CalendarMinusIcon, AffiliateIcon, ChevronRightIcon, TraderMobileIcon, SettingFillIcon, Switch, ChainIcon, capitalizeFirstLetter, usePagination, ListView, Badge, ArrowDownShortIcon, ScrollIndicator, PlusIcon, FeeTierIcon, ServerFillIcon, ArrowLeftRightSquareFill, VaultsIcon } from '@orderly.network/ui';
7
6
  import { LeverageWidgetWithDialogId } from '@orderly.network/ui-leverage';
8
- import { DepositStatusWidget, TransferDialogId, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, TransferSheetId } from '@orderly.network/ui-transfer';
7
+ import { DepositAndWithdrawWithSheetId, DepositAndWithdrawWithDialogId, TransferSheetId, TransferDialogId, DepositStatusWidget } from '@orderly.network/ui-transfer';
9
8
  import { i18n, useTranslation, Trans } from '@orderly.network/i18n';
10
- import { AuthGuardTooltip, AuthGuard, AuthGuardDataTable, AuthGuardEmpty } from '@orderly.network/ui-connector';
9
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
10
+ import { AuthGuard, AuthGuardTooltip, AuthGuardDataTable, AuthGuardEmpty } from '@orderly.network/ui-connector';
11
11
  import { Decimal, zero, numberToHumanStyle, commifyOptional, subtractDaysFromCurrentDate, capitalizeString } from '@orderly.network/utils';
12
12
  import { subDays, format, getYear, getMonth, getDate, set, differenceInDays, setHours } from 'date-fns';
13
13
  import { produce } from 'immer';
@@ -28,30 +28,6 @@ var __export = (target, all) => {
28
28
  for (var name in all)
29
29
  __defProp(target, name, { get: all[name], enumerable: true });
30
30
  };
31
- var LayoutContext, useLayoutContext, LayoutProvider;
32
- var init_context = __esm({
33
- "src/layout/context.tsx"() {
34
- LayoutContext = createContext({
35
- sideOpen: true
36
- });
37
- useLayoutContext = () => {
38
- return useContext(LayoutContext);
39
- };
40
- LayoutProvider = (props) => {
41
- const { routerAdapter, children } = props;
42
- const [sideOpen, setSideOpen] = useState(true);
43
- const memoizedValue = useMemo(
44
- () => ({
45
- sideOpen,
46
- onSideOpenChange: setSideOpen,
47
- routerAdapter
48
- }),
49
- [sideOpen, setSideOpen, routerAdapter]
50
- );
51
- return /* @__PURE__ */ jsx(LayoutContext.Provider, { value: memoizedValue, children });
52
- };
53
- }
54
- });
55
31
  var useAssetScript;
56
32
  var init_assets_script = __esm({
57
33
  "src/pages/overview/assets/assets.script.ts"() {
@@ -4822,41 +4798,12 @@ __export(feeTierHeader_exports, {
4822
4798
  FeeTierHeader: () => FeeTierHeader,
4823
4799
  MobileHeaderItem: () => MobileHeaderItem
4824
4800
  });
4825
- var isEffective, EffectiveFeeDialog, MobileHeaderItem, DesktopHeaderItem, FeeTierHeader;
4801
+ var MobileHeaderItem, DesktopHeaderItem, FeeTierHeader;
4826
4802
  var init_feeTierHeader = __esm({
4827
4803
  "src/pages/feeTier/feeTierHeader.tsx"() {
4828
- init_context();
4829
4804
  init_icons();
4830
- isEffective = (val) => typeof val !== "undefined" && val !== null;
4831
- EffectiveFeeDialog = (props) => {
4832
- const { routerAdapter } = props;
4833
- const { t } = useTranslation();
4834
- const { hide } = useModal();
4835
- return /* @__PURE__ */ jsxs(Text, { size: "2xs", className: "oui-whitespace-normal oui-break-words", children: [
4836
- t("portfolio.feeTier.effectiveFee.tooltip"),
4837
- " ",
4838
- /* @__PURE__ */ jsx(
4839
- "a",
4840
- {
4841
- href: "/rewards/affiliate",
4842
- onClick: (e) => {
4843
- e.preventDefault();
4844
- routerAdapter?.onRouteChange({
4845
- href: "/rewards/affiliate",
4846
- name: t("portfolio.feeTier.effectiveFee.tooltipLink")
4847
- });
4848
- hide();
4849
- },
4850
- className: "oui-cursor-pointer oui-border-none oui-bg-transparent oui-p-0 oui-text-2xs oui-underline hover:oui-text-base-contrast-80",
4851
- children: t("portfolio.feeTier.effectiveFee.tooltipLink")
4852
- }
4853
- )
4854
- ] });
4855
- };
4856
4805
  MobileHeaderItem = (props) => {
4857
4806
  const { label, value, interactive } = props;
4858
- const { t } = useTranslation();
4859
- const { routerAdapter } = useLayoutContext();
4860
4807
  return /* @__PURE__ */ jsxs(Flex, { justify: "between", itemAlign: "center", width: "100%", children: [
4861
4808
  /* @__PURE__ */ jsx(
4862
4809
  Text,
@@ -4871,42 +4818,12 @@ var init_feeTierHeader = __esm({
4871
4818
  ),
4872
4819
  /* @__PURE__ */ jsxs(Flex, { className: "oui-gap-1.5", itemAlign: "center", justify: "between", children: [
4873
4820
  /* @__PURE__ */ jsx(Text, { size: "xs", intensity: 80, className: "oui-leading-[24px]", children: value }),
4874
- interactive && /* @__PURE__ */ jsxs(
4875
- Flex,
4876
- {
4877
- gap: 1,
4878
- justify: "center",
4879
- itemAlign: "center",
4880
- className: "oui-cursor-pointer oui-rounded oui-bg-gradient-to-r oui-from-[rgb(var(--oui-gradient-brand-start)_/_0.12)] oui-to-[rgb(var(--oui-gradient-brand-end)_/_0.12)] oui-px-1",
4881
- onClick: () => {
4882
- modal.dialog({
4883
- size: "sm",
4884
- title: t("common.tips"),
4885
- content: /* @__PURE__ */ jsx(EffectiveFeeDialog, { routerAdapter })
4886
- });
4887
- },
4888
- children: [
4889
- /* @__PURE__ */ jsx(EffectiveFee, {}),
4890
- /* @__PURE__ */ jsx(
4891
- Text.gradient,
4892
- {
4893
- className: "oui-select-none",
4894
- color: "brand",
4895
- size: "3xs",
4896
- weight: "regular",
4897
- children: t("common.effectiveFee")
4898
- }
4899
- )
4900
- ]
4901
- }
4902
- )
4821
+ interactive && /* @__PURE__ */ jsx(EffectiveFee, {})
4903
4822
  ] })
4904
4823
  ] });
4905
4824
  };
4906
4825
  DesktopHeaderItem = (props) => {
4907
4826
  const { label, value, interactive } = props;
4908
- const { t } = useTranslation();
4909
- const { routerAdapter } = useScaffoldContext();
4910
4827
  return /* @__PURE__ */ jsxs(
4911
4828
  Box,
4912
4829
  {
@@ -4931,60 +4848,7 @@ var init_feeTierHeader = __esm({
4931
4848
  children: label
4932
4849
  }
4933
4850
  ),
4934
- interactive && /* @__PURE__ */ jsx(
4935
- Tooltip,
4936
- {
4937
- content: /* @__PURE__ */ jsxs(
4938
- Text,
4939
- {
4940
- size: "2xs",
4941
- className: "oui-whitespace-normal oui-break-words",
4942
- children: [
4943
- t("portfolio.feeTier.effectiveFee.tooltip"),
4944
- " ",
4945
- /* @__PURE__ */ jsx(
4946
- "a",
4947
- {
4948
- href: "/rewards/affiliate",
4949
- onClick: (e) => {
4950
- e.preventDefault();
4951
- routerAdapter?.onRouteChange({
4952
- href: "/rewards/affiliate",
4953
- name: t("portfolio.feeTier.effectiveFee.tooltipLink")
4954
- });
4955
- },
4956
- className: "oui-cursor-pointer oui-border-none oui-bg-transparent oui-p-0 oui-text-2xs oui-underline hover:oui-text-base-contrast-80",
4957
- children: t("portfolio.feeTier.effectiveFee.tooltipLink")
4958
- }
4959
- )
4960
- ]
4961
- }
4962
- ),
4963
- className: "oui-p-1.5 oui-text-base-contrast-54",
4964
- children: /* @__PURE__ */ jsxs(
4965
- Flex,
4966
- {
4967
- gap: 1,
4968
- justify: "center",
4969
- itemAlign: "center",
4970
- className: "oui-cursor-pointer oui-rounded oui-bg-gradient-to-r oui-from-[rgb(var(--oui-gradient-brand-start)_/_0.12)] oui-to-[rgb(var(--oui-gradient-brand-end)_/_0.12)] oui-px-1",
4971
- children: [
4972
- /* @__PURE__ */ jsx(EffectiveFee, {}),
4973
- /* @__PURE__ */ jsx(
4974
- Text.gradient,
4975
- {
4976
- className: "oui-select-none",
4977
- color: "brand",
4978
- size: "xs",
4979
- weight: "regular",
4980
- children: t("common.effectiveFee")
4981
- }
4982
- )
4983
- ]
4984
- }
4985
- )
4986
- }
4987
- )
4851
+ interactive && /* @__PURE__ */ jsx(EffectiveFee, {})
4988
4852
  ] }),
4989
4853
  /* @__PURE__ */ jsx(Flex, { className: "oui-mt-1 oui-w-full", children: /* @__PURE__ */ jsx(Text, { size: "base", intensity: 80, className: "oui-leading-[24px]", children: value }) })
4990
4854
  ]
@@ -4995,83 +4859,88 @@ var init_feeTierHeader = __esm({
4995
4859
  const { t } = useTranslation();
4996
4860
  const { tier, vol, headerDataAdapter } = props;
4997
4861
  const { isMobile } = useScreen();
4998
- const { refereeRebate, ...others } = useFeeState();
4999
- const isEffectiveFee = isEffective(refereeRebate);
5000
- const items = [
5001
- {
5002
- label: t("portfolio.feeTier.header.yourTier"),
5003
- interactive: false,
5004
- value: /* @__PURE__ */ jsx(
5005
- Text.gradient,
5006
- {
5007
- color: "brand",
5008
- angle: 270,
5009
- size: isMobile ? "xs" : "base",
5010
- children: tier || "--"
5011
- }
5012
- )
5013
- },
5014
- {
5015
- label: `${t("portfolio.feeTier.header.30dVolume")} (USDC)`,
5016
- interactive: false,
5017
- value: /* @__PURE__ */ jsx(
5018
- Text.numeral,
5019
- {
5020
- rule: "price",
5021
- dp: 2,
5022
- rm: Decimal.ROUND_DOWN,
5023
- size: isMobile ? "xs" : "base",
5024
- children: vol !== void 0 && vol !== null ? `${vol}` : "-"
5025
- }
5026
- )
5027
- },
5028
- {
5029
- label: t("portfolio.feeTier.header.takerFeeRate"),
5030
- interactive: isEffectiveFee,
5031
- value: /* @__PURE__ */ jsxs(
5032
- Text.gradient,
5033
- {
5034
- color: "brand",
5035
- angle: 270,
5036
- size: isMobile ? "xs" : "base",
5037
- children: [
5038
- isEffectiveFee ? others.effectiveTakerFee || "--" : others.takerFee || "--",
5039
- " ",
5040
- "(RWA:",
5041
- " ",
5042
- (isEffectiveFee ? others.rwaEffectiveTakerFee : others.rwaTakerFee) || "--",
5043
- ")"
5044
- ]
5045
- }
5046
- )
5047
- },
5048
- {
5049
- label: t("portfolio.feeTier.header.makerFeeRate"),
5050
- interactive: isEffectiveFee,
5051
- value: /* @__PURE__ */ jsxs(
5052
- Text.gradient,
5053
- {
5054
- color: "brand",
5055
- angle: 270,
5056
- size: isMobile ? "xs" : "base",
5057
- children: [
5058
- isEffectiveFee ? others.effectiveMakerFee || "--" : others.makerFee || "--",
5059
- " ",
5060
- "(RWA:",
5061
- " ",
5062
- (isEffectiveFee ? others.rwaEffectiveMakerFee : others.rwaMakerFee) || "--",
5063
- ")"
5064
- ]
5065
- }
5066
- )
5067
- }
5068
- ];
4862
+ const { takerFee, makerFee, rwaTakerFee, rwaMakerFee } = useFeeState();
5069
4863
  const mergedData = useMemo(() => {
4864
+ const baseItems = [
4865
+ {
4866
+ label: t("portfolio.feeTier.header.yourTier"),
4867
+ interactive: false,
4868
+ value: /* @__PURE__ */ jsx(
4869
+ Text.gradient,
4870
+ {
4871
+ color: "brand",
4872
+ angle: 270,
4873
+ size: isMobile ? "xs" : "base",
4874
+ children: tier || "--"
4875
+ }
4876
+ )
4877
+ },
4878
+ {
4879
+ label: `${t("portfolio.feeTier.header.30dVolume")} (USDC)`,
4880
+ interactive: false,
4881
+ value: /* @__PURE__ */ jsx(
4882
+ Text.numeral,
4883
+ {
4884
+ rule: "price",
4885
+ dp: 2,
4886
+ rm: Decimal.ROUND_DOWN,
4887
+ size: isMobile ? "xs" : "base",
4888
+ children: vol !== void 0 && vol !== null ? `${vol}` : "-"
4889
+ }
4890
+ )
4891
+ },
4892
+ {
4893
+ label: t("portfolio.feeTier.header.takerFeeRate"),
4894
+ interactive: false,
4895
+ value: /* @__PURE__ */ jsxs(
4896
+ Text.gradient,
4897
+ {
4898
+ color: "brand",
4899
+ angle: 270,
4900
+ size: isMobile ? "xs" : "base",
4901
+ children: [
4902
+ takerFee || "--",
4903
+ " (RWA: ",
4904
+ rwaTakerFee || "--",
4905
+ ")"
4906
+ ]
4907
+ }
4908
+ )
4909
+ },
4910
+ {
4911
+ label: t("portfolio.feeTier.header.makerFeeRate"),
4912
+ interactive: false,
4913
+ value: /* @__PURE__ */ jsxs(
4914
+ Text.gradient,
4915
+ {
4916
+ color: "brand",
4917
+ angle: 270,
4918
+ size: isMobile ? "xs" : "base",
4919
+ children: [
4920
+ makerFee || "--",
4921
+ " (RWA: ",
4922
+ rwaMakerFee || "--",
4923
+ ")"
4924
+ ]
4925
+ }
4926
+ )
4927
+ }
4928
+ ];
5070
4929
  if (typeof headerDataAdapter === "function") {
5071
- return headerDataAdapter(items);
4930
+ return headerDataAdapter(baseItems);
5072
4931
  }
5073
- return items;
5074
- }, [headerDataAdapter, items]);
4932
+ return baseItems;
4933
+ }, [
4934
+ headerDataAdapter,
4935
+ isMobile,
4936
+ makerFee,
4937
+ rwaMakerFee,
4938
+ rwaTakerFee,
4939
+ t,
4940
+ takerFee,
4941
+ tier,
4942
+ vol
4943
+ ]);
5075
4944
  if (!Array.isArray(mergedData)) {
5076
4945
  return null;
5077
4946
  }
@@ -6403,9 +6272,25 @@ var LeftSidebar = (props) => {
6403
6272
  }
6404
6273
  );
6405
6274
  };
6406
-
6407
- // src/layout/layout.ui.mobile.tsx
6408
- init_context();
6275
+ var LayoutContext = createContext({
6276
+ sideOpen: true
6277
+ });
6278
+ var useLayoutContext = () => {
6279
+ return useContext(LayoutContext);
6280
+ };
6281
+ var LayoutProvider = (props) => {
6282
+ const { routerAdapter, children } = props;
6283
+ const [sideOpen, setSideOpen] = useState(true);
6284
+ const memoizedValue = useMemo(
6285
+ () => ({
6286
+ sideOpen,
6287
+ onSideOpenChange: setSideOpen,
6288
+ routerAdapter
6289
+ }),
6290
+ [sideOpen, setSideOpen, routerAdapter]
6291
+ );
6292
+ return /* @__PURE__ */ jsx(LayoutContext.Provider, { value: memoizedValue, children });
6293
+ };
6409
6294
  var PortfolioLayoutMobile = (props) => {
6410
6295
  return /* @__PURE__ */ jsx(LayoutProvider, { ...props, children: /* @__PURE__ */ jsxs(
6411
6296
  Flex,
@@ -6764,9 +6649,6 @@ registerSimpleDialog(PerformanceMobileDialogId, PerformanceMobileWidget, {
6764
6649
  // src/pages/overview/index.tsx
6765
6650
  init_funding();
6766
6651
  init_distribution();
6767
-
6768
- // src/pages/overview/mobile/mobile.widget.tsx
6769
- init_context();
6770
6652
  init_assets();
6771
6653
 
6772
6654
  // src/pages/overview/portfolioChartsMobile/portfolioChartsMobile.widget.tsx