@deframe-sdk/components 0.1.65 → 0.1.67
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 +22 -21
- package/dist/index.d.ts +22 -21
- package/dist/index.js +122 -82
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +122 -82
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +63 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2198,6 +2198,7 @@ interface EarnDesktopLabels {
|
|
|
2198
2198
|
columnApy?: string;
|
|
2199
2199
|
columnProfit?: string;
|
|
2200
2200
|
columnInvested?: string;
|
|
2201
|
+
columnTotalValue?: string;
|
|
2201
2202
|
totalInvestedLabel?: string;
|
|
2202
2203
|
totalInvestedDescription?: string;
|
|
2203
2204
|
accumulatedEarningsLabel?: string;
|
|
@@ -2238,6 +2239,23 @@ interface EarnDesktopViewProps {
|
|
|
2238
2239
|
*/
|
|
2239
2240
|
declare const EarnDesktopView: React__default.FC<EarnDesktopViewProps>;
|
|
2240
2241
|
|
|
2242
|
+
interface EarnHistoryAsset {
|
|
2243
|
+
token?: {
|
|
2244
|
+
symbol?: string;
|
|
2245
|
+
};
|
|
2246
|
+
amountInUSD?: string | null;
|
|
2247
|
+
amountHumanized?: string;
|
|
2248
|
+
}
|
|
2249
|
+
interface EarnHistoryItem {
|
|
2250
|
+
id: string;
|
|
2251
|
+
type: string;
|
|
2252
|
+
createdAt: string;
|
|
2253
|
+
amounts?: {
|
|
2254
|
+
assetIn?: EarnHistoryAsset | null;
|
|
2255
|
+
assetOut?: EarnHistoryAsset | null;
|
|
2256
|
+
};
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2241
2259
|
interface EarnCategoryDefinition {
|
|
2242
2260
|
id: string;
|
|
2243
2261
|
imageUrl: string;
|
|
@@ -2256,6 +2274,10 @@ interface EarnSpotPosition {
|
|
|
2256
2274
|
underlyingBalanceUSD: number;
|
|
2257
2275
|
apy: number;
|
|
2258
2276
|
profitInUSD: number;
|
|
2277
|
+
/** Pre-formatted invested amount in global currency — computed by the consumer (SDK). */
|
|
2278
|
+
investedFormatted: string;
|
|
2279
|
+
/** Pre-formatted total value in global currency — computed by the consumer (SDK). */
|
|
2280
|
+
totalValueFormatted?: string;
|
|
2259
2281
|
}
|
|
2260
2282
|
interface EarnPosition {
|
|
2261
2283
|
strategy: EarnStrategyInfo;
|
|
@@ -2276,27 +2298,6 @@ interface EarnStrategy {
|
|
|
2276
2298
|
apy: number;
|
|
2277
2299
|
apyFormatted: string;
|
|
2278
2300
|
}
|
|
2279
|
-
interface EarnHistoryItem {
|
|
2280
|
-
id: string;
|
|
2281
|
-
type: string;
|
|
2282
|
-
createdAt: string;
|
|
2283
|
-
amounts?: {
|
|
2284
|
-
assetIn?: {
|
|
2285
|
-
token?: {
|
|
2286
|
-
symbol?: string;
|
|
2287
|
-
};
|
|
2288
|
-
amountInUSD?: string | null;
|
|
2289
|
-
amountHumanized?: string;
|
|
2290
|
-
} | null;
|
|
2291
|
-
assetOut?: {
|
|
2292
|
-
token?: {
|
|
2293
|
-
symbol?: string;
|
|
2294
|
-
};
|
|
2295
|
-
amountInUSD?: string | null;
|
|
2296
|
-
amountHumanized?: string;
|
|
2297
|
-
} | null;
|
|
2298
|
-
};
|
|
2299
|
-
}
|
|
2300
2301
|
interface EarnDesktopViewSimpleProps extends Partial<EarnDesktopViewProps> {
|
|
2301
2302
|
/** Positions data — mirrors WalletPositionsResponse */
|
|
2302
2303
|
positions?: EarnPositionsData;
|
package/dist/index.d.ts
CHANGED
|
@@ -2198,6 +2198,7 @@ interface EarnDesktopLabels {
|
|
|
2198
2198
|
columnApy?: string;
|
|
2199
2199
|
columnProfit?: string;
|
|
2200
2200
|
columnInvested?: string;
|
|
2201
|
+
columnTotalValue?: string;
|
|
2201
2202
|
totalInvestedLabel?: string;
|
|
2202
2203
|
totalInvestedDescription?: string;
|
|
2203
2204
|
accumulatedEarningsLabel?: string;
|
|
@@ -2238,6 +2239,23 @@ interface EarnDesktopViewProps {
|
|
|
2238
2239
|
*/
|
|
2239
2240
|
declare const EarnDesktopView: React__default.FC<EarnDesktopViewProps>;
|
|
2240
2241
|
|
|
2242
|
+
interface EarnHistoryAsset {
|
|
2243
|
+
token?: {
|
|
2244
|
+
symbol?: string;
|
|
2245
|
+
};
|
|
2246
|
+
amountInUSD?: string | null;
|
|
2247
|
+
amountHumanized?: string;
|
|
2248
|
+
}
|
|
2249
|
+
interface EarnHistoryItem {
|
|
2250
|
+
id: string;
|
|
2251
|
+
type: string;
|
|
2252
|
+
createdAt: string;
|
|
2253
|
+
amounts?: {
|
|
2254
|
+
assetIn?: EarnHistoryAsset | null;
|
|
2255
|
+
assetOut?: EarnHistoryAsset | null;
|
|
2256
|
+
};
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2241
2259
|
interface EarnCategoryDefinition {
|
|
2242
2260
|
id: string;
|
|
2243
2261
|
imageUrl: string;
|
|
@@ -2256,6 +2274,10 @@ interface EarnSpotPosition {
|
|
|
2256
2274
|
underlyingBalanceUSD: number;
|
|
2257
2275
|
apy: number;
|
|
2258
2276
|
profitInUSD: number;
|
|
2277
|
+
/** Pre-formatted invested amount in global currency — computed by the consumer (SDK). */
|
|
2278
|
+
investedFormatted: string;
|
|
2279
|
+
/** Pre-formatted total value in global currency — computed by the consumer (SDK). */
|
|
2280
|
+
totalValueFormatted?: string;
|
|
2259
2281
|
}
|
|
2260
2282
|
interface EarnPosition {
|
|
2261
2283
|
strategy: EarnStrategyInfo;
|
|
@@ -2276,27 +2298,6 @@ interface EarnStrategy {
|
|
|
2276
2298
|
apy: number;
|
|
2277
2299
|
apyFormatted: string;
|
|
2278
2300
|
}
|
|
2279
|
-
interface EarnHistoryItem {
|
|
2280
|
-
id: string;
|
|
2281
|
-
type: string;
|
|
2282
|
-
createdAt: string;
|
|
2283
|
-
amounts?: {
|
|
2284
|
-
assetIn?: {
|
|
2285
|
-
token?: {
|
|
2286
|
-
symbol?: string;
|
|
2287
|
-
};
|
|
2288
|
-
amountInUSD?: string | null;
|
|
2289
|
-
amountHumanized?: string;
|
|
2290
|
-
} | null;
|
|
2291
|
-
assetOut?: {
|
|
2292
|
-
token?: {
|
|
2293
|
-
symbol?: string;
|
|
2294
|
-
};
|
|
2295
|
-
amountInUSD?: string | null;
|
|
2296
|
-
amountHumanized?: string;
|
|
2297
|
-
} | null;
|
|
2298
|
-
};
|
|
2299
|
-
}
|
|
2300
2301
|
interface EarnDesktopViewSimpleProps extends Partial<EarnDesktopViewProps> {
|
|
2301
2302
|
/** Positions data — mirrors WalletPositionsResponse */
|
|
2302
2303
|
positions?: EarnPositionsData;
|
package/dist/index.js
CHANGED
|
@@ -10943,7 +10943,7 @@ var ImageBannerCard = ({
|
|
|
10943
10943
|
"aria-label": alt,
|
|
10944
10944
|
onClick,
|
|
10945
10945
|
className: tailwindMerge.twMerge(
|
|
10946
|
-
"relative w-full overflow-hidden text-left",
|
|
10946
|
+
"group relative w-full overflow-hidden text-left",
|
|
10947
10947
|
"rounded-[var(--deframe-widget-size-radius-md)]",
|
|
10948
10948
|
"border",
|
|
10949
10949
|
"transition-[transform,opacity] duration-150",
|
|
@@ -10957,44 +10957,54 @@ var ImageBannerCard = ({
|
|
|
10957
10957
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10958
10958
|
"div",
|
|
10959
10959
|
{
|
|
10960
|
-
className: "
|
|
10960
|
+
className: "relative z-[2] flex flex-col justify-center",
|
|
10961
10961
|
style: { flex: imageUrl ? "0 0 55%" : "1 1 auto" },
|
|
10962
10962
|
children: [
|
|
10963
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10964
|
-
"
|
|
10963
|
+
imageUrl && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10964
|
+
"div",
|
|
10965
10965
|
{
|
|
10966
|
-
"
|
|
10967
|
-
className: "
|
|
10968
|
-
style: {
|
|
10969
|
-
children: alt
|
|
10966
|
+
"aria-hidden": "true",
|
|
10967
|
+
className: "absolute inset-y-0 left-full pointer-events-none transition-[width] duration-500 ease-out w-[33%]",
|
|
10968
|
+
style: { background: "linear-gradient(to right, #080a0e, transparent)" }
|
|
10970
10969
|
}
|
|
10971
10970
|
),
|
|
10972
|
-
|
|
10971
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-[var(--deframe-widget-size-gap-xs)] px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-xl)] transition-transform duration-500 ease-out origin-left group-hover:scale-[1.04]", children: [
|
|
10973
10972
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10974
10973
|
"span",
|
|
10975
10974
|
{
|
|
10976
|
-
|
|
10977
|
-
|
|
10978
|
-
|
|
10975
|
+
"data-test-id": "image-banner-card-name",
|
|
10976
|
+
className: "text-[length:var(--deframe-widget-font-size-xs)] [font-weight:var(--deframe-widget-font-weight-medium)] font-[var(--deframe-widget-font-family)] uppercase tracking-[0.08em]",
|
|
10977
|
+
style: { color: `color-mix(in srgb, ${colorToken} 80%, var(--deframe-widget-color-text-secondary))` },
|
|
10978
|
+
children: alt
|
|
10979
10979
|
}
|
|
10980
10980
|
),
|
|
10981
|
-
/* @__PURE__ */ jsxRuntime.
|
|
10981
|
+
apyFormatted && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-test-id": "image-banner-card-apy", className: "flex items-baseline gap-[4px]", children: [
|
|
10982
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10983
|
+
"span",
|
|
10984
|
+
{
|
|
10985
|
+
className: "text-[38px] [font-weight:var(--deframe-widget-font-weight-bold)] font-[var(--deframe-widget-font-family)] leading-[1]",
|
|
10986
|
+
style: { color: colorToken },
|
|
10987
|
+
children: apyFormatted
|
|
10988
|
+
}
|
|
10989
|
+
),
|
|
10990
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10991
|
+
"span",
|
|
10992
|
+
{
|
|
10993
|
+
className: "text-[length:var(--deframe-widget-font-size-xs)] [font-weight:var(--deframe-widget-font-weight-semibold)] font-[var(--deframe-widget-font-family)] uppercase tracking-[0.1em]",
|
|
10994
|
+
style: { color: `color-mix(in srgb, ${colorToken} 60%, transparent)` },
|
|
10995
|
+
children: "APY"
|
|
10996
|
+
}
|
|
10997
|
+
)
|
|
10998
|
+
] }),
|
|
10999
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10982
11000
|
"span",
|
|
10983
11001
|
{
|
|
10984
|
-
|
|
10985
|
-
|
|
10986
|
-
children:
|
|
11002
|
+
"data-test-id": "image-banner-card-description",
|
|
11003
|
+
className: "text-[length:var(--deframe-widget-font-size-xs)] leading-[var(--deframe-widget-font-leading-sm)] text-[color:var(--deframe-widget-color-text-tertiary)] font-[var(--deframe-widget-font-family)]",
|
|
11004
|
+
children: description
|
|
10987
11005
|
}
|
|
10988
11006
|
)
|
|
10989
|
-
] })
|
|
10990
|
-
description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10991
|
-
"span",
|
|
10992
|
-
{
|
|
10993
|
-
"data-test-id": "image-banner-card-description",
|
|
10994
|
-
className: "text-[length:var(--deframe-widget-font-size-xs)] leading-[var(--deframe-widget-font-leading-sm)] text-[color:var(--deframe-widget-color-text-tertiary)] font-[var(--deframe-widget-font-family)]",
|
|
10995
|
-
children: description
|
|
10996
|
-
}
|
|
10997
|
-
)
|
|
11007
|
+
] })
|
|
10998
11008
|
]
|
|
10999
11009
|
}
|
|
11000
11010
|
),
|
|
@@ -11003,7 +11013,7 @@ var ImageBannerCard = ({
|
|
|
11003
11013
|
{
|
|
11004
11014
|
"data-test-id": "image-banner-card-image-wrapper",
|
|
11005
11015
|
className: "relative flex-1 overflow-hidden",
|
|
11006
|
-
style: { minHeight: 160 },
|
|
11016
|
+
style: { background: "linear-gradient(to left, #080a0e, transparent)", minHeight: 160 },
|
|
11007
11017
|
children: [
|
|
11008
11018
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11009
11019
|
"img",
|
|
@@ -11012,16 +11022,14 @@ var ImageBannerCard = ({
|
|
|
11012
11022
|
src: imageUrl,
|
|
11013
11023
|
alt: "",
|
|
11014
11024
|
"aria-hidden": "true",
|
|
11015
|
-
className: "absolute inset-0 w-full h-full object-cover object-center"
|
|
11025
|
+
className: "absolute inset-0 w-full h-full object-cover object-center transition-transform duration-500 ease-out origin-right group-hover:scale-110"
|
|
11016
11026
|
}
|
|
11017
11027
|
),
|
|
11018
11028
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11019
11029
|
"div",
|
|
11020
11030
|
{
|
|
11021
|
-
|
|
11022
|
-
|
|
11023
|
-
background: "linear-gradient(to right, #080a0e 0%, transparent 40%)"
|
|
11024
|
-
}
|
|
11031
|
+
"aria-hidden": "true",
|
|
11032
|
+
className: "absolute inset-y-0 left-0 z-[1] pointer-events-none transition-[width,transform] duration-500 ease-out w-[40%] group-hover:w-[80%] group-hover:-translate-x-3"
|
|
11025
11033
|
}
|
|
11026
11034
|
)
|
|
11027
11035
|
]
|
|
@@ -11031,7 +11039,7 @@ var ImageBannerCard = ({
|
|
|
11031
11039
|
}
|
|
11032
11040
|
);
|
|
11033
11041
|
};
|
|
11034
|
-
var GRID_COLS = "grid grid-cols-[
|
|
11042
|
+
var GRID_COLS = "grid grid-cols-[1fr_100px_100px_100px_100px] gap-x-[var(--deframe-widget-size-gap-md)]";
|
|
11035
11043
|
var HISTORY_COLORS = {
|
|
11036
11044
|
deposit: "var(--deframe-widget-color-state-info)",
|
|
11037
11045
|
withdraw: "var(--deframe-widget-color-text-secondary)",
|
|
@@ -11044,6 +11052,7 @@ var EarnHubStrategyCard = ({
|
|
|
11044
11052
|
investedFormatted,
|
|
11045
11053
|
earningsFormatted,
|
|
11046
11054
|
profitFormatted,
|
|
11055
|
+
totalValueFormatted,
|
|
11047
11056
|
isLoading,
|
|
11048
11057
|
onInvestClick,
|
|
11049
11058
|
onWithdrawClick,
|
|
@@ -11064,7 +11073,7 @@ var EarnHubStrategyCard = ({
|
|
|
11064
11073
|
{
|
|
11065
11074
|
"data-slot": "earn-hub-strategy-card",
|
|
11066
11075
|
"data-test-id": "earn-hub-strategy-card",
|
|
11067
|
-
className: "border-t border-[color:var(--deframe-widget-color-border-secondary)] list-none",
|
|
11076
|
+
className: "border-t border-[color:var(--deframe-widget-color-border-secondary)] list-none overflow-hidden",
|
|
11068
11077
|
children: [
|
|
11069
11078
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
11070
11079
|
"div",
|
|
@@ -11073,14 +11082,14 @@ var EarnHubStrategyCard = ({
|
|
|
11073
11082
|
onClick: () => setExpanded((v) => !v),
|
|
11074
11083
|
className: tailwindMerge.twMerge(
|
|
11075
11084
|
GRID_COLS,
|
|
11076
|
-
"items-center cursor-pointer",
|
|
11085
|
+
"group items-center cursor-pointer",
|
|
11077
11086
|
"px-[var(--deframe-widget-size-padding-x-md)] py-[13px]",
|
|
11078
11087
|
"transition-colors duration-150",
|
|
11079
11088
|
"hover:bg-[color:color-mix(in_srgb,var(--deframe-widget-color-bg-tertiary)_60%,transparent)]"
|
|
11080
11089
|
),
|
|
11081
11090
|
children: [
|
|
11082
11091
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-[var(--deframe-widget-size-gap-sm)] min-w-0", children: [
|
|
11083
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-[36px] h-[36px] rounded-full bg-[var(--deframe-widget-color-bg-tertiary)] flex items-center justify-center overflow-hidden shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx("img", { alt: assetName, src: logoUrl, referrerPolicy: "no-referrer", className: "w-full h-full object-contain" }) }),
|
|
11092
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-[36px] h-[36px] rounded-full bg-[var(--deframe-widget-color-bg-tertiary)] flex items-center justify-center overflow-hidden shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx("img", { alt: assetName, src: logoUrl, referrerPolicy: "no-referrer", className: "w-full h-full object-contain transition-transform duration-500 ease-out group-hover:scale-110" }) }),
|
|
11084
11093
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-0", children: [
|
|
11085
11094
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-sm)] [font-weight:var(--deframe-widget-font-weight-semibold)] text-[color:var(--deframe-widget-color-text-primary)] leading-[var(--deframe-widget-font-leading-sm)] font-[var(--deframe-widget-font-family)] truncate", children: assetName }),
|
|
11086
11095
|
network && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-xs)] text-[color:var(--deframe-widget-color-text-secondary)] leading-[var(--deframe-widget-font-leading-xs)]", children: network })
|
|
@@ -11095,11 +11104,9 @@ var EarnHubStrategyCard = ({
|
|
|
11095
11104
|
}
|
|
11096
11105
|
) }),
|
|
11097
11106
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { variant: "rect", width: 50, height: 16 }) : profitFormatted ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-sm)] [font-weight:var(--deframe-widget-font-weight-semibold)] text-[color:var(--deframe-widget-color-text-primary)] font-[var(--deframe-widget-font-family)] leading-none", children: profitFormatted }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-xs)] text-[color:var(--deframe-widget-color-text-tertiary)]", children: "\u2014" }) }),
|
|
11107
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { variant: "rect", width: 60, height: 16 }) : investedFormatted ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-sm)] [font-weight:var(--deframe-widget-font-weight-semibold)] text-[color:var(--deframe-widget-color-text-primary)] leading-[var(--deframe-widget-font-leading-sm)] font-[var(--deframe-widget-font-family)]", children: investedFormatted }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-xs)] text-[color:var(--deframe-widget-color-text-tertiary)]", children: "\u2014" }) }),
|
|
11098
11108
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-[var(--deframe-widget-size-gap-xs)]", children: [
|
|
11099
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11100
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-sm)] [font-weight:var(--deframe-widget-font-weight-semibold)] text-[color:var(--deframe-widget-color-text-primary)] leading-[var(--deframe-widget-font-leading-sm)] font-[var(--deframe-widget-font-family)]", children: investedFormatted }),
|
|
11101
|
-
(labels == null ? void 0 : labels.investedLabel) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-xs)] text-[color:var(--deframe-widget-color-text-secondary)] leading-[var(--deframe-widget-font-leading-xs)]", children: labels.investedLabel })
|
|
11102
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-xs)] text-[color:var(--deframe-widget-color-text-tertiary)]", children: "\u2014" }) }),
|
|
11109
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { variant: "rect", width: 60, height: 16 }) : totalValueFormatted ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-sm)] [font-weight:var(--deframe-widget-font-weight-semibold)] text-[color:var(--deframe-widget-color-text-primary)] leading-[var(--deframe-widget-font-leading-sm)] font-[var(--deframe-widget-font-family)]", children: totalValueFormatted }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-xs)] text-[color:var(--deframe-widget-color-text-tertiary)]", children: "\u2014" }),
|
|
11103
11110
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11104
11111
|
"svg",
|
|
11105
11112
|
{
|
|
@@ -11253,6 +11260,60 @@ function formatHistoryAssetAmount(input) {
|
|
|
11253
11260
|
}
|
|
11254
11261
|
return "";
|
|
11255
11262
|
}
|
|
11263
|
+
|
|
11264
|
+
// src/utils/formatEarnPositions.ts
|
|
11265
|
+
function formatEarnPositions(positions, { currency, locale, formatCurrency }) {
|
|
11266
|
+
return __spreadProps(__spreadValues({}, positions), {
|
|
11267
|
+
positions: positions.positions.map((p) => {
|
|
11268
|
+
var _a, _b;
|
|
11269
|
+
const symbol = p.strategy.assetName.toUpperCase();
|
|
11270
|
+
const isBrlPegged = currency === "BRL" && BRL_PEGGED_SYMBOLS.has(symbol);
|
|
11271
|
+
const principalHumanized = parseFloat((_b = (_a = p.spotPosition.principal) == null ? void 0 : _a.humanized) != null ? _b : "0");
|
|
11272
|
+
const principalUSD = p.spotPosition.underlyingBalanceUSD - p.spotPosition.profitInUSD;
|
|
11273
|
+
const investedFormatted = isBrlPegged && p.spotPosition.principal ? formatHistoryAssetAmount({ amountHumanized: p.spotPosition.principal.humanized, symbol, currency, locale, formatCurrency }) : formatCurrency(principalUSD);
|
|
11274
|
+
const totalBrla = isBrlPegged && principalHumanized > 0 && principalUSD > 0 ? p.spotPosition.underlyingBalanceUSD * principalHumanized / principalUSD : null;
|
|
11275
|
+
const totalValueFormatted = totalBrla !== null ? formatHistoryAssetAmount({ amountHumanized: String(totalBrla), symbol, currency, locale, formatCurrency }) : formatCurrency(p.spotPosition.underlyingBalanceUSD);
|
|
11276
|
+
return __spreadProps(__spreadValues({}, p), { spotPosition: __spreadProps(__spreadValues({}, p.spotPosition), { investedFormatted, totalValueFormatted }) });
|
|
11277
|
+
})
|
|
11278
|
+
});
|
|
11279
|
+
}
|
|
11280
|
+
|
|
11281
|
+
// src/utils/buildEarnHistoryByAsset.ts
|
|
11282
|
+
function buildEarnHistoryByAsset(items, { currency, locale, formatCurrency, onHistoryDetail }) {
|
|
11283
|
+
var _a, _b, _c, _d, _e;
|
|
11284
|
+
const map = {};
|
|
11285
|
+
for (const item of items) {
|
|
11286
|
+
const isDeposit = item.type.includes("DEPOSIT");
|
|
11287
|
+
const primaryAsset = isDeposit ? (_a = item.amounts) == null ? void 0 : _a.assetIn : (_b = item.amounts) == null ? void 0 : _b.assetOut;
|
|
11288
|
+
const symbol = (_e = (_d = (_c = primaryAsset == null ? void 0 : primaryAsset.token) == null ? void 0 : _c.symbol) == null ? void 0 : _d.toUpperCase()) != null ? _e : "";
|
|
11289
|
+
if (!symbol || !primaryAsset) continue;
|
|
11290
|
+
const amount = formatHistoryAssetAmount({
|
|
11291
|
+
amountHumanized: primaryAsset.amountHumanized,
|
|
11292
|
+
amountInUSD: primaryAsset.amountInUSD,
|
|
11293
|
+
symbol,
|
|
11294
|
+
currency,
|
|
11295
|
+
locale,
|
|
11296
|
+
formatCurrency
|
|
11297
|
+
});
|
|
11298
|
+
const date = new Date(item.createdAt).toLocaleString(locale, {
|
|
11299
|
+
day: "2-digit",
|
|
11300
|
+
month: "2-digit",
|
|
11301
|
+
year: "numeric",
|
|
11302
|
+
hour: "2-digit",
|
|
11303
|
+
minute: "2-digit"
|
|
11304
|
+
});
|
|
11305
|
+
const entry = {
|
|
11306
|
+
id: item.id,
|
|
11307
|
+
date,
|
|
11308
|
+
type: isDeposit ? "deposit" : "withdraw",
|
|
11309
|
+
amount,
|
|
11310
|
+
onClick: () => onHistoryDetail(item.id, isDeposit)
|
|
11311
|
+
};
|
|
11312
|
+
if (!map[symbol]) map[symbol] = [];
|
|
11313
|
+
map[symbol].push(entry);
|
|
11314
|
+
}
|
|
11315
|
+
return map;
|
|
11316
|
+
}
|
|
11256
11317
|
var EARN_CATEGORY_DEFINITIONS = [
|
|
11257
11318
|
{
|
|
11258
11319
|
id: "dolar",
|
|
@@ -11320,7 +11381,7 @@ var columnHeaderClasses = [
|
|
|
11320
11381
|
"text-[color:var(--deframe-widget-color-text-tertiary)]",
|
|
11321
11382
|
"leading-[var(--deframe-widget-font-leading-xs)]"
|
|
11322
11383
|
].join(" ");
|
|
11323
|
-
var GRID_COLS2 = "grid grid-cols-[
|
|
11384
|
+
var GRID_COLS2 = "grid grid-cols-[1fr_100px_100px_100px_100px] gap-x-[var(--deframe-widget-size-gap-md)]";
|
|
11324
11385
|
var BANNER_COLORS = [
|
|
11325
11386
|
"var(--deframe-widget-color-brand-primary)",
|
|
11326
11387
|
"var(--deframe-widget-color-brand-secondary)"
|
|
@@ -11373,41 +11434,6 @@ var EarnDesktopViewSimple = ({
|
|
|
11373
11434
|
};
|
|
11374
11435
|
});
|
|
11375
11436
|
}, [categories, strategies, labels == null ? void 0 : labels.stablecoinsBannerDescription, labels == null ? void 0 : labels.realsBannerDescription]);
|
|
11376
|
-
const historyByAsset = React6__namespace.default.useMemo(() => {
|
|
11377
|
-
var _a, _b, _c, _d, _e;
|
|
11378
|
-
const map = /* @__PURE__ */ new Map();
|
|
11379
|
-
for (const item of historyItems) {
|
|
11380
|
-
const isDeposit = item.type.includes("DEPOSIT");
|
|
11381
|
-
const primaryAsset = isDeposit ? (_a = item.amounts) == null ? void 0 : _a.assetIn : (_b = item.amounts) == null ? void 0 : _b.assetOut;
|
|
11382
|
-
const symbol = (_e = primaryAsset && "token" in primaryAsset ? (_d = (_c = primaryAsset.token) == null ? void 0 : _c.symbol) == null ? void 0 : _d.toUpperCase() : null) != null ? _e : "";
|
|
11383
|
-
if (!symbol) continue;
|
|
11384
|
-
const amount = formatHistoryAssetAmount({
|
|
11385
|
-
amountHumanized: primaryAsset && "amountHumanized" in primaryAsset ? primaryAsset.amountHumanized : void 0,
|
|
11386
|
-
amountInUSD: primaryAsset && "amountInUSD" in primaryAsset ? primaryAsset.amountInUSD : void 0,
|
|
11387
|
-
symbol,
|
|
11388
|
-
currency,
|
|
11389
|
-
locale,
|
|
11390
|
-
formatCurrency
|
|
11391
|
-
});
|
|
11392
|
-
const date = new Date(item.createdAt).toLocaleString(locale, {
|
|
11393
|
-
day: "2-digit",
|
|
11394
|
-
month: "2-digit",
|
|
11395
|
-
year: "numeric",
|
|
11396
|
-
hour: "2-digit",
|
|
11397
|
-
minute: "2-digit"
|
|
11398
|
-
});
|
|
11399
|
-
const entry = {
|
|
11400
|
-
id: item.id,
|
|
11401
|
-
date,
|
|
11402
|
-
type: isDeposit ? "deposit" : "withdraw",
|
|
11403
|
-
amount,
|
|
11404
|
-
onClick: onHistoryDetail ? () => onHistoryDetail(item.id, isDeposit) : void 0
|
|
11405
|
-
};
|
|
11406
|
-
if (!map.has(symbol)) map.set(symbol, []);
|
|
11407
|
-
map.get(symbol).push(entry);
|
|
11408
|
-
}
|
|
11409
|
-
return map;
|
|
11410
|
-
}, [historyItems, locale, formatCurrency, currency, onHistoryDetail]);
|
|
11411
11437
|
const cardLabels = React6__namespace.default.useMemo(() => ({
|
|
11412
11438
|
investLabel: labels == null ? void 0 : labels.investLabel,
|
|
11413
11439
|
withdrawLabel: labels == null ? void 0 : labels.cardWithdrawLabel,
|
|
@@ -11417,18 +11443,32 @@ var EarnDesktopViewSimple = ({
|
|
|
11417
11443
|
historyWithdrawnLabel: labels == null ? void 0 : labels.cardHistoryWithdrawnLabel,
|
|
11418
11444
|
historyInterestReceivedLabel: labels == null ? void 0 : labels.cardHistoryInterestReceivedLabel
|
|
11419
11445
|
}), [labels == null ? void 0 : labels.investLabel, labels == null ? void 0 : labels.cardWithdrawLabel, labels == null ? void 0 : labels.cardInvestedLabel, labels == null ? void 0 : labels.cardHistoryTitle, labels == null ? void 0 : labels.cardHistoryDepositedLabel, labels == null ? void 0 : labels.cardHistoryWithdrawnLabel, labels == null ? void 0 : labels.cardHistoryInterestReceivedLabel]);
|
|
11446
|
+
const formattedPositions = React6.useMemo(
|
|
11447
|
+
() => formatEarnPositions(positions, { currency, locale, formatCurrency }),
|
|
11448
|
+
[positions, currency, locale, formatCurrency]
|
|
11449
|
+
);
|
|
11450
|
+
const historyByAsset = React6.useMemo(
|
|
11451
|
+
() => buildEarnHistoryByAsset(historyItems, {
|
|
11452
|
+
currency,
|
|
11453
|
+
locale,
|
|
11454
|
+
formatCurrency,
|
|
11455
|
+
onHistoryDetail: (id, isDeposit) => onHistoryDetail == null ? void 0 : onHistoryDetail(id, isDeposit)
|
|
11456
|
+
}),
|
|
11457
|
+
[historyItems, currency, locale, formatCurrency, onHistoryDetail]
|
|
11458
|
+
);
|
|
11420
11459
|
const strategyRows = React6__namespace.default.useMemo(() => {
|
|
11421
|
-
return
|
|
11422
|
-
var _a;
|
|
11460
|
+
return formattedPositions.positions.filter((p) => p.spotPosition.underlyingBalanceUSD > 0.01).map((p) => {
|
|
11461
|
+
var _a, _b;
|
|
11423
11462
|
return {
|
|
11424
11463
|
logoUrl: p.strategy.logourl,
|
|
11425
11464
|
assetName: p.strategy.assetName,
|
|
11426
11465
|
network: p.strategy.network,
|
|
11427
|
-
investedFormatted:
|
|
11466
|
+
investedFormatted: p.spotPosition.investedFormatted,
|
|
11428
11467
|
earningsFormatted: `${(p.spotPosition.apy * 100).toFixed(2)}%`,
|
|
11429
11468
|
profitFormatted: formatCurrency(p.spotPosition.profitInUSD),
|
|
11469
|
+
totalValueFormatted: (_a = p.spotPosition.totalValueFormatted) != null ? _a : formatCurrency(p.spotPosition.underlyingBalanceUSD),
|
|
11430
11470
|
isLoading: false,
|
|
11431
|
-
history: (
|
|
11471
|
+
history: (_b = historyByAsset[p.strategy.assetName.toUpperCase()]) != null ? _b : [],
|
|
11432
11472
|
onInvestClick: onDeposit ? () => onDeposit(p.strategy.id) : () => {
|
|
11433
11473
|
},
|
|
11434
11474
|
onWithdrawClick: onWithdraw ? () => onWithdraw(p.strategy.id) : () => {
|
|
@@ -11438,7 +11478,7 @@ var EarnDesktopViewSimple = ({
|
|
|
11438
11478
|
labels: cardLabels
|
|
11439
11479
|
};
|
|
11440
11480
|
});
|
|
11441
|
-
}, [
|
|
11481
|
+
}, [formattedPositions.positions, formatCurrency, historyByAsset, onDeposit, onWithdraw, onDetails, cardLabels]);
|
|
11442
11482
|
if (isLoading) {
|
|
11443
11483
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-test-id": "earn-hub-view-simple-loading", className: tailwindMerge.twMerge(wrapperBaseClasses2, className), children: [
|
|
11444
11484
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 gap-[var(--deframe-widget-size-gap-sm)]", children: [0, 1].map((i) => /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { variant: "rect", width: "100%", height: 100 }, i)) }),
|
|
@@ -11585,13 +11625,13 @@ var EarnDesktopViewSimple = ({
|
|
|
11585
11625
|
"px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-sm)]",
|
|
11586
11626
|
"border-t border-[color:var(--deframe-widget-color-border-secondary)]"
|
|
11587
11627
|
),
|
|
11588
|
-
children: [labels == null ? void 0 : labels.columnStrategy, labels == null ? void 0 : labels.columnApy, labels == null ? void 0 : labels.columnProfit, labels == null ? void 0 : labels.columnInvested].map((label, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11628
|
+
children: [labels == null ? void 0 : labels.columnStrategy, labels == null ? void 0 : labels.columnApy, labels == null ? void 0 : labels.columnProfit, labels == null ? void 0 : labels.columnInvested, labels == null ? void 0 : labels.columnTotalValue].map((label, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11589
11629
|
"span",
|
|
11590
11630
|
{
|
|
11591
11631
|
className: tailwindMerge.twMerge(
|
|
11592
11632
|
columnHeaderClasses,
|
|
11593
11633
|
(i === 1 || i === 2) && "text-center",
|
|
11594
|
-
i === 3 && "text-right"
|
|
11634
|
+
(i === 3 || i === 4) && "text-right"
|
|
11595
11635
|
),
|
|
11596
11636
|
children: label
|
|
11597
11637
|
},
|