@orderly.network/portfolio 2.8.14 → 2.9.0-alpha.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.d.mts CHANGED
@@ -55,6 +55,7 @@ declare const useAssetScript: () => {
55
55
  readonly connect: (options?: any) => Promise<_orderly_network_hooks.WalletState[]>;
56
56
  readonly portfolioValue: number | null;
57
57
  readonly freeCollateral: number;
58
+ readonly maxWithdrawAmount: number;
58
59
  readonly unrealPnL: number;
59
60
  readonly unrealROI: number;
60
61
  readonly currentLeverage: number;
package/dist/index.d.ts CHANGED
@@ -55,6 +55,7 @@ declare const useAssetScript: () => {
55
55
  readonly connect: (options?: any) => Promise<_orderly_network_hooks.WalletState[]>;
56
56
  readonly portfolioValue: number | null;
57
57
  readonly freeCollateral: number;
58
+ readonly maxWithdrawAmount: number;
58
59
  readonly unrealPnL: number;
59
60
  readonly unrealROI: number;
60
61
  readonly currentLeverage: number;
package/dist/index.js CHANGED
@@ -84,7 +84,7 @@ var init_assets_script = __esm({
84
84
  }, [handleDomId]);
85
85
  const onWithdraw = React12.useCallback(() => {
86
86
  ui.modal.show(handleDomId, { activeTab: "withdraw" });
87
- }, []);
87
+ }, [handleDomId]);
88
88
  const onTransfer = React12.useCallback(() => {
89
89
  if (isMobile) {
90
90
  ui.modal.show(uiTransfer.TransferSheetId);
@@ -92,11 +92,13 @@ var init_assets_script = __esm({
92
92
  ui.modal.show(uiTransfer.TransferDialogId);
93
93
  }
94
94
  }, [isMobile]);
95
+ const maxWithdrawAmount = hooks.useMaxWithdrawal("USDC");
95
96
  return {
96
97
  canTrade,
97
98
  connect,
98
99
  portfolioValue: totalValue,
99
100
  freeCollateral,
101
+ maxWithdrawAmount,
100
102
  unrealPnL: data.aggregated.total_unreal_pnl,
101
103
  unrealROI: data.totalUnrealizedROI,
102
104
  currentLeverage: curLeverage,
@@ -222,6 +224,7 @@ var init_assets_ui = __esm({
222
224
  unrealROI: props.unrealROI,
223
225
  unrealPnL: props.unrealPnL,
224
226
  freeCollateral: props.freeCollateral,
227
+ maxWithdrawAmount: props.maxWithdrawAmount,
225
228
  currentLeverage: props.currentLeverage,
226
229
  onLeverageEdit: props.onLeverageEdit,
227
230
  visible: props.visible
@@ -239,6 +242,7 @@ var init_assets_ui = __esm({
239
242
  };
240
243
  AssetStatistic = (props) => {
241
244
  const { t } = i18n.useTranslation();
245
+ const maxWithdrawAmountText = props.maxWithdrawAmount === void 0 || props.maxWithdrawAmount === null ? "--" : props.maxWithdrawAmount.toString();
242
246
  return /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { cols: 2, className: "oui-h-12", children: [
243
247
  /* @__PURE__ */ jsxRuntime.jsx(ui.Statistic, { label: t("common.unrealizedPnl"), children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { children: [
244
248
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -268,7 +272,25 @@ var init_assets_ui = __esm({
268
272
  /* @__PURE__ */ jsxRuntime.jsx(
269
273
  ui.Statistic,
270
274
  {
271
- label: t("portfolio.overview.availableWithdraw"),
275
+ label: /* @__PURE__ */ jsxRuntime.jsx(
276
+ ui.Tooltip,
277
+ {
278
+ content: t("transfer.withdraw.available.tooltip", {
279
+ amount: maxWithdrawAmountText
280
+ }),
281
+ className: "oui-max-w-[274px]",
282
+ delayDuration: 300,
283
+ children: /* @__PURE__ */ jsxRuntime.jsx(
284
+ ui.Text,
285
+ {
286
+ size: "xs",
287
+ intensity: 36,
288
+ className: "oui-cursor-pointer oui-border-b oui-border-dashed oui-border-line-12",
289
+ children: t("portfolio.overview.availableWithdraw")
290
+ }
291
+ )
292
+ }
293
+ ),
272
294
  align: "right",
273
295
  valueProps: { size: "lg", visible: props.visible },
274
296
  children: props.freeCollateral