@kodiak-finance/orderly-portfolio 2.8.26-beta.2 → 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 +75 -66
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -66
- package/dist/index.mjs.map +1 -1
- package/package.json +18 -18
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,
|
|
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 {
|
|
5091
|
+
const {
|
|
5092
|
+
baseRate,
|
|
5093
|
+
baseRwaRate,
|
|
5094
|
+
effectiveRate,
|
|
5095
|
+
effectiveRwaRate,
|
|
5096
|
+
size = "base"
|
|
5097
|
+
} = props;
|
|
5109
5098
|
const { isMobile } = orderlyUi.useScreen();
|
|
5110
|
-
|
|
5111
|
-
|
|
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:
|
|
5121
|
-
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text.gradient, { color: "brand", size, children:
|
|
5122
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text.gradient, { color: "brand", size, children:
|
|
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:
|
|
5127
|
-
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "2xs", intensity: 80, children:
|
|
5128
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "2xs", intensity: 54, children:
|
|
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;
|
|
@@ -5378,13 +5391,7 @@ var init_feeTierHeader = __esm({
|
|
|
5378
5391
|
{
|
|
5379
5392
|
label: t("portfolio.feeTier.header.refCode"),
|
|
5380
5393
|
interactive: false,
|
|
5381
|
-
value: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5382
|
-
RefCodeValue,
|
|
5383
|
-
{
|
|
5384
|
-
code: refCode,
|
|
5385
|
-
discountRate: refereeRebate
|
|
5386
|
-
}
|
|
5387
|
-
)
|
|
5394
|
+
value: /* @__PURE__ */ jsxRuntime.jsx(RefCodeValue, { code: refCode, discountRate: refereeRebate })
|
|
5388
5395
|
},
|
|
5389
5396
|
{
|
|
5390
5397
|
label: t("portfolio.feeTier.header.takerFeeRate"),
|
|
@@ -5392,9 +5399,10 @@ var init_feeTierHeader = __esm({
|
|
|
5392
5399
|
value: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5393
5400
|
FeeRateValue,
|
|
5394
5401
|
{
|
|
5395
|
-
baseRate:
|
|
5396
|
-
|
|
5397
|
-
|
|
5402
|
+
baseRate: vipTierBaseFeeRates?.takerFeeRate,
|
|
5403
|
+
baseRwaRate: vipTierBaseFeeRates?.rwaTakerFeeRate,
|
|
5404
|
+
effectiveRate: isEffectiveFee ? others.effectiveTakerFee : others.takerFee,
|
|
5405
|
+
effectiveRwaRate: isEffectiveFee ? others.rwaEffectiveTakerFee : others.rwaTakerFee,
|
|
5398
5406
|
size: isMobile ? "xs" : "base"
|
|
5399
5407
|
}
|
|
5400
5408
|
)
|
|
@@ -5405,9 +5413,10 @@ var init_feeTierHeader = __esm({
|
|
|
5405
5413
|
value: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5406
5414
|
FeeRateValue,
|
|
5407
5415
|
{
|
|
5408
|
-
baseRate:
|
|
5409
|
-
|
|
5410
|
-
|
|
5416
|
+
baseRate: vipTierBaseFeeRates?.makerFeeRate,
|
|
5417
|
+
baseRwaRate: vipTierBaseFeeRates?.rwaMakerFeeRate,
|
|
5418
|
+
effectiveRate: isEffectiveFee ? others.effectiveMakerFee : others.makerFee,
|
|
5419
|
+
effectiveRwaRate: isEffectiveFee ? others.rwaEffectiveMakerFee : others.rwaMakerFee,
|
|
5411
5420
|
size: isMobile ? "xs" : "base"
|
|
5412
5421
|
}
|
|
5413
5422
|
)
|
|
@@ -8108,6 +8117,7 @@ var formatDiscountRate2 = (rate) => {
|
|
|
8108
8117
|
var VipTierTable = (props) => {
|
|
8109
8118
|
const { tiers, currentTier, baseFeeRates } = props;
|
|
8110
8119
|
const { t } = orderlyI18n.useTranslation();
|
|
8120
|
+
const { isMobile } = orderlyUi.useScreen();
|
|
8111
8121
|
if (!tiers.length)
|
|
8112
8122
|
return null;
|
|
8113
8123
|
const formatFeeRate = (rate) => {
|
|
@@ -8159,20 +8169,24 @@ var VipTierTable = (props) => {
|
|
|
8159
8169
|
dataIndex: "discountRate",
|
|
8160
8170
|
align: "center",
|
|
8161
8171
|
render: (value) => formatDiscountRate2(value) || "--"
|
|
8162
|
-
},
|
|
8163
|
-
{
|
|
8164
|
-
title: t("portfolio.feeTier.column.maker"),
|
|
8165
|
-
dataIndex: "makerFeeRate",
|
|
8166
|
-
align: "center",
|
|
8167
|
-
render: (_value, row) => formatFeeRate(row.effectiveFeeRates?.makerFeeRate)
|
|
8168
|
-
},
|
|
8169
|
-
{
|
|
8170
|
-
title: t("portfolio.feeTier.column.taker"),
|
|
8171
|
-
dataIndex: "takerFeeRate",
|
|
8172
|
-
align: "center",
|
|
8173
|
-
render: (_value, row) => formatFeeRate(row.effectiveFeeRates?.takerFeeRate)
|
|
8174
8172
|
}
|
|
8175
8173
|
];
|
|
8174
|
+
if (!isMobile) {
|
|
8175
|
+
columns.push(
|
|
8176
|
+
{
|
|
8177
|
+
title: t("portfolio.feeTier.column.maker"),
|
|
8178
|
+
dataIndex: "makerFeeRate",
|
|
8179
|
+
align: "center",
|
|
8180
|
+
render: (_value, row) => formatFeeRate(row.effectiveFeeRates?.makerFeeRate)
|
|
8181
|
+
},
|
|
8182
|
+
{
|
|
8183
|
+
title: t("portfolio.feeTier.column.taker"),
|
|
8184
|
+
dataIndex: "takerFeeRate",
|
|
8185
|
+
align: "center",
|
|
8186
|
+
render: (_value, row) => formatFeeRate(row.effectiveFeeRates?.takerFeeRate)
|
|
8187
|
+
}
|
|
8188
|
+
);
|
|
8189
|
+
}
|
|
8176
8190
|
const baseRow = {
|
|
8177
8191
|
tier: 0,
|
|
8178
8192
|
name: t("portfolio.feeTier.vip.base"),
|
|
@@ -8287,19 +8301,9 @@ var FeeTierTable = (props) => {
|
|
|
8287
8301
|
};
|
|
8288
8302
|
var CardTitle3 = () => {
|
|
8289
8303
|
const { t } = orderlyI18n.useTranslation();
|
|
8290
|
-
const { isMobile } = orderlyUi.useScreen();
|
|
8291
|
-
if (isMobile) {
|
|
8292
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { itemAlign: "center", justify: "center", gap: 2, children: [
|
|
8293
|
-
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", intensity: 54, children: t("portfolio.feeTier.updatedDailyBy") }),
|
|
8294
|
-
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", intensity: 80, children: "~2:15 UTC" })
|
|
8295
|
-
] });
|
|
8296
|
-
}
|
|
8297
8304
|
return /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { itemAlign: "center", justify: "between", children: [
|
|
8298
8305
|
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "lg", children: t("portfolio.feeTier") }),
|
|
8299
|
-
/* @__PURE__ */ jsxRuntime.
|
|
8300
|
-
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", intensity: 54, children: t("portfolio.feeTier.updatedDailyBy") }),
|
|
8301
|
-
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", intensity: 80, children: "~2:15 UTC" })
|
|
8302
|
-
] })
|
|
8306
|
+
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Flex, { itemAlign: "center", justify: "center", gap: 1 })
|
|
8303
8307
|
] });
|
|
8304
8308
|
};
|
|
8305
8309
|
var FeeTier = (props) => {
|
|
@@ -8338,6 +8342,7 @@ var FeeTier = (props) => {
|
|
|
8338
8342
|
headerDataAdapter,
|
|
8339
8343
|
vipTier,
|
|
8340
8344
|
vipTierEnabled,
|
|
8345
|
+
vipTierBaseFeeRates,
|
|
8341
8346
|
vipTierDocsUrl,
|
|
8342
8347
|
vipTierStakeUrl
|
|
8343
8348
|
}
|
|
@@ -8603,8 +8608,12 @@ function normalizeEffectiveFeeRates(value) {
|
|
|
8603
8608
|
return {
|
|
8604
8609
|
makerFeeRate: toNumber(rates.makerFeeRate ?? rates.maker_fee_rate),
|
|
8605
8610
|
takerFeeRate: toNumber(rates.takerFeeRate ?? rates.taker_fee_rate),
|
|
8606
|
-
rwaMakerFeeRate: toNumber(
|
|
8607
|
-
|
|
8611
|
+
rwaMakerFeeRate: toNumber(
|
|
8612
|
+
rates.rwaMakerFeeRate ?? rates.rwa_maker_fee_rate
|
|
8613
|
+
),
|
|
8614
|
+
rwaTakerFeeRate: toNumber(
|
|
8615
|
+
rates.rwaTakerFeeRate ?? rates.rwa_taker_fee_rate
|
|
8616
|
+
)
|
|
8608
8617
|
};
|
|
8609
8618
|
}
|
|
8610
8619
|
var buildVipTierUrl = (endpoint, address) => {
|