@kodiak-finance/orderly-portfolio 2.8.26 → 2.8.27

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
@@ -4952,7 +4952,7 @@ __export(feeTierHeader_exports, {
4952
4952
  FeeTierHeader: () => FeeTierHeader,
4953
4953
  MobileHeaderItem: () => MobileHeaderItem
4954
4954
  });
4955
- var isEffective, formatDiscountRate, parsePercent, getDiscountedPercent, getVipTierLabel, formatStakedValue, openLink, VipTierValue, RefCodeValue, FeeRateValue, EffectiveFeeDialog, MobileHeaderItem, DesktopHeaderItem, FeeTierHeader;
4955
+ var isEffective, formatDiscountRate, getVipTierLabel, formatStakedValue, openLink, VipTierValue, RefCodeValue, FeeRateValue, EffectiveFeeDialog, MobileHeaderItem, DesktopHeaderItem, FeeTierHeader;
4956
4956
  var init_feeTierHeader = __esm({
4957
4957
  "src/pages/feeTier/feeTierHeader.tsx"() {
4958
4958
  init_context();
@@ -4964,23 +4964,6 @@ var init_feeTierHeader = __esm({
4964
4964
  const normalized = rate <= 1 ? new orderlyUtils.Decimal(rate).mul(100) : new orderlyUtils.Decimal(rate);
4965
4965
  return `${normalized.toFixed(0)}%`;
4966
4966
  };
4967
- parsePercent = (value) => {
4968
- if (!value || value === "--")
4969
- return null;
4970
- const match = value.match(/-?\d+(?:\.\d+)?/);
4971
- if (!match)
4972
- return null;
4973
- return new orderlyUtils.Decimal(match[0]);
4974
- };
4975
- getDiscountedPercent = (value, discountRate) => {
4976
- if (!discountRate || discountRate <= 0)
4977
- return null;
4978
- const base = parsePercent(value);
4979
- if (!base)
4980
- return null;
4981
- const discounted = base.mul(new orderlyUtils.Decimal(1).minus(discountRate));
4982
- return `${discounted.toFixed(3)}%`;
4983
- };
4984
4967
  getVipTierLabel = (vipTier) => {
4985
4968
  return vipTier?.name || vipTier?.tier || "--";
4986
4969
  };
@@ -5105,10 +5088,40 @@ var init_feeTierHeader = __esm({
5105
5088
  ] }) });
5106
5089
  };
5107
5090
  FeeRateValue = (props) => {
5108
- const { baseRate, rwaRate, discountRate, size = "base" } = props;
5091
+ const {
5092
+ baseRate,
5093
+ baseRwaRate,
5094
+ effectiveRate,
5095
+ effectiveRwaRate,
5096
+ size = "base"
5097
+ } = props;
5109
5098
  const { isMobile } = orderlyUi.useScreen();
5110
- const discounted = getDiscountedPercent(baseRate, discountRate);
5111
- const rwaDiscounted = getDiscountedPercent(rwaRate, discountRate);
5099
+ let discounted = false;
5100
+ let rwaDiscounted = false;
5101
+ const normalizeRate = (value) => {
5102
+ if (!value || value === "-" || value === "--")
5103
+ return null;
5104
+ const match = value.match(/-?\d+(?:\.\d+)?/);
5105
+ if (!match)
5106
+ return null;
5107
+ const raw = new orderlyUtils.Decimal(match[0]);
5108
+ if (value.includes("%")) {
5109
+ return { fraction: raw.div(100), display: value };
5110
+ }
5111
+ return { fraction: raw, display: `${raw.mul(100).toNumber()}%` };
5112
+ };
5113
+ const effectiveRateValue = normalizeRate(effectiveRate);
5114
+ const baseRateValue = normalizeRate(baseRate);
5115
+ if (effectiveRateValue && baseRateValue) {
5116
+ discounted = effectiveRateValue.fraction.lt(baseRateValue.fraction);
5117
+ }
5118
+ const effectiveRwaRateValue = normalizeRate(effectiveRwaRate);
5119
+ const baseRwaRateValue = normalizeRate(baseRwaRate);
5120
+ if (effectiveRwaRateValue && baseRwaRateValue) {
5121
+ rwaDiscounted = effectiveRwaRateValue.fraction.lt(
5122
+ baseRwaRateValue.fraction
5123
+ );
5124
+ }
5112
5125
  return /* @__PURE__ */ jsxRuntime.jsxs(
5113
5126
  orderlyUi.Flex,
5114
5127
  {
@@ -5117,15 +5130,15 @@ var init_feeTierHeader = __esm({
5117
5130
  itemAlign: isMobile ? "end" : "start",
5118
5131
  children: [
5119
5132
  /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Flex, { itemAlign: "center", gap: 2, children: discounted ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5120
- /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size, intensity: 54, className: "oui-line-through", children: baseRate || "--" }),
5121
- /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text.gradient, { color: "brand", size, children: discounted })
5122
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text.gradient, { color: "brand", size, children: baseRate || "--" }) }),
5133
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size, intensity: 54, className: "oui-line-through", children: baseRateValue?.display ?? "--" }),
5134
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text.gradient, { color: "brand", size, children: effectiveRate })
5135
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text.gradient, { color: "brand", size, children: effectiveRate || "--" }) }),
5123
5136
  /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { itemAlign: "center", gap: 1, children: [
5124
5137
  /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "2xs", intensity: 54, children: "RWA:" }),
5125
5138
  rwaDiscounted ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5126
- /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "2xs", intensity: 54, className: "oui-line-through", children: rwaRate || "--" }),
5127
- /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "2xs", intensity: 80, children: rwaDiscounted })
5128
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "2xs", intensity: 54, children: rwaRate || "--" })
5139
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "2xs", intensity: 54, className: "oui-line-through", children: baseRwaRateValue?.display ?? "--" }),
5140
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "2xs", intensity: 80, children: effectiveRwaRate })
5141
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "2xs", intensity: 54, children: effectiveRwaRate || "--" })
5129
5142
  ] })
5130
5143
  ]
5131
5144
  }
@@ -5326,6 +5339,7 @@ var init_feeTierHeader = __esm({
5326
5339
  headerDataAdapter,
5327
5340
  vipTier,
5328
5341
  vipTierEnabled,
5342
+ vipTierBaseFeeRates,
5329
5343
  vipTierDocsUrl,
5330
5344
  vipTierStakeUrl
5331
5345
  } = props;
@@ -5333,7 +5347,6 @@ var init_feeTierHeader = __esm({
5333
5347
  const { refereeRebate, refererCode, ...others } = orderlyHooks.useFeeState();
5334
5348
  const refCode = refererCode || "--";
5335
5349
  const isEffectiveFee = isEffective(refereeRebate);
5336
- const discountRate = vipTier?.discountRate;
5337
5350
  const { routerAdapter: mobileRouterAdapter } = useLayoutContext();
5338
5351
  const { routerAdapter: desktopRouterAdapter } = orderlyUiScaffold.useScaffoldContext();
5339
5352
  const routerAdapter = desktopRouterAdapter ?? mobileRouterAdapter;
@@ -5386,9 +5399,10 @@ var init_feeTierHeader = __esm({
5386
5399
  value: /* @__PURE__ */ jsxRuntime.jsx(
5387
5400
  FeeRateValue,
5388
5401
  {
5389
- baseRate: isEffectiveFee ? others.effectiveTakerFee : others.takerFee,
5390
- rwaRate: isEffectiveFee ? others.rwaEffectiveTakerFee : others.rwaTakerFee,
5391
- discountRate,
5402
+ baseRate: vipTierBaseFeeRates?.takerFeeRate,
5403
+ baseRwaRate: vipTierBaseFeeRates?.rwaTakerFeeRate,
5404
+ effectiveRate: isEffectiveFee ? others.effectiveTakerFee : others.takerFee,
5405
+ effectiveRwaRate: isEffectiveFee ? others.rwaEffectiveTakerFee : others.rwaTakerFee,
5392
5406
  size: isMobile ? "xs" : "base"
5393
5407
  }
5394
5408
  )
@@ -5399,9 +5413,10 @@ var init_feeTierHeader = __esm({
5399
5413
  value: /* @__PURE__ */ jsxRuntime.jsx(
5400
5414
  FeeRateValue,
5401
5415
  {
5402
- baseRate: isEffectiveFee ? others.effectiveMakerFee : others.makerFee,
5403
- rwaRate: isEffectiveFee ? others.rwaEffectiveMakerFee : others.rwaMakerFee,
5404
- discountRate,
5416
+ baseRate: vipTierBaseFeeRates?.makerFeeRate,
5417
+ baseRwaRate: vipTierBaseFeeRates?.rwaMakerFeeRate,
5418
+ effectiveRate: isEffectiveFee ? others.effectiveMakerFee : others.makerFee,
5419
+ effectiveRwaRate: isEffectiveFee ? others.rwaEffectiveMakerFee : others.rwaMakerFee,
5405
5420
  size: isMobile ? "xs" : "base"
5406
5421
  }
5407
5422
  )
@@ -8286,19 +8301,9 @@ var FeeTierTable = (props) => {
8286
8301
  };
8287
8302
  var CardTitle3 = () => {
8288
8303
  const { t } = orderlyI18n.useTranslation();
8289
- const { isMobile } = orderlyUi.useScreen();
8290
- if (isMobile) {
8291
- return /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { itemAlign: "center", justify: "center", gap: 2, children: [
8292
- /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", intensity: 54, children: t("portfolio.feeTier.updatedDailyBy") }),
8293
- /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", intensity: 80, children: "~2:15 UTC" })
8294
- ] });
8295
- }
8296
8304
  return /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { itemAlign: "center", justify: "between", children: [
8297
8305
  /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "lg", children: t("portfolio.feeTier") }),
8298
- /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { itemAlign: "center", justify: "center", gap: 1, children: [
8299
- /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", intensity: 54, children: t("portfolio.feeTier.updatedDailyBy") }),
8300
- /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", intensity: 80, children: "~2:15 UTC" })
8301
- ] })
8306
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Flex, { itemAlign: "center", justify: "center", gap: 1 })
8302
8307
  ] });
8303
8308
  };
8304
8309
  var FeeTier = (props) => {
@@ -8337,6 +8342,7 @@ var FeeTier = (props) => {
8337
8342
  headerDataAdapter,
8338
8343
  vipTier,
8339
8344
  vipTierEnabled,
8345
+ vipTierBaseFeeRates,
8340
8346
  vipTierDocsUrl,
8341
8347
  vipTierStakeUrl
8342
8348
  }