@gearbox-protocol/ui-kit 4.0.0-next.16 → 4.0.0-next.18
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/cjs/components/base/index.cjs +1 -1
- package/dist/cjs/components/base/info-list/info-list.cjs +1 -1
- package/dist/cjs/components/base/position-assets/constants.cjs +1 -0
- package/dist/cjs/components/base/position-assets/index.cjs +1 -0
- package/dist/cjs/components/base/position-assets/position-assets.cjs +1 -0
- package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/base/values/scalars.cjs +1 -1
- package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
- package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
- package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
- package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/utils/index.cjs +1 -1
- package/dist/cjs/utils/strategy-apy.cjs +1 -1
- package/dist/esm/components/base/index.js +112 -108
- package/dist/esm/components/base/info-list/info-list.js +7 -6
- package/dist/esm/components/base/position-assets/constants.js +8 -0
- package/dist/esm/components/base/position-assets/index.js +6 -0
- package/dist/esm/components/base/position-assets/position-assets.js +73 -0
- package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +121 -116
- package/dist/esm/components/base/values/scalars.js +52 -33
- package/dist/esm/components/checkbox/checkbox-labeled.js +1 -1
- package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +1 -1
- package/dist/esm/components/compound-apy/compound-apy.js +2 -2
- package/dist/esm/components/index.js +662 -658
- package/dist/esm/components/with-copy/with-copy.js +1 -1
- package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +20 -21
- package/dist/esm/index.js +851 -848
- package/dist/esm/utils/index.js +29 -30
- package/dist/esm/utils/strategy-apy.js +41 -31
- package/dist/types/components/base/index.d.ts +1 -0
- package/dist/types/components/base/position-assets/constants.d.ts +5 -0
- package/dist/types/components/base/position-assets/index.d.ts +2 -0
- package/dist/types/components/base/position-assets/position-assets.d.ts +49 -0
- package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts +7 -13
- package/dist/types/components/base/values/scalars.d.ts +4 -0
- package/dist/types/components/compound-apy/compound-apy.d.ts +2 -2
- package/dist/types/components/yield-breakdown-tooltip/yield-breakdown-tooltip.d.ts +3 -3
- package/dist/types/utils/strategy-apy.d.ts +21 -18
- package/package.json +2 -2
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as i, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { Stack as d } from "../stack/stack.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import "@gearbox-protocol/sdk";
|
|
5
|
+
import "clsx";
|
|
6
|
+
import "tailwind-merge";
|
|
7
|
+
import "sonner";
|
|
8
|
+
import "@gearbox-protocol/sdk/common-utils";
|
|
9
|
+
import "luxon";
|
|
10
|
+
import "../../../utils/z-index.js";
|
|
11
|
+
import "../../points-icon/points-icon.js";
|
|
12
|
+
import { TokenBigint as c } from "../values/scalars.js";
|
|
13
|
+
import "../../badge/badge.js";
|
|
14
|
+
import "../../badge/chip.js";
|
|
15
|
+
import "react-intl";
|
|
16
|
+
import { TokenSymbol as f } from "../../token-symbol/token-symbol.js";
|
|
17
|
+
import { Typography as u } from "../../typography/typography.js";
|
|
18
|
+
import { PositionAssetsTest as m } from "./constants.js";
|
|
19
|
+
const k = 1;
|
|
20
|
+
function _({
|
|
21
|
+
assets: r,
|
|
22
|
+
against: e,
|
|
23
|
+
empty: s,
|
|
24
|
+
testId: n
|
|
25
|
+
}) {
|
|
26
|
+
const t = h(r, e);
|
|
27
|
+
return /* @__PURE__ */ i(d, { gap: "sm", align: "end", "data-testid": n ?? m.root, children: t.length === 0 ? s !== void 0 && /* @__PURE__ */ i(
|
|
28
|
+
u,
|
|
29
|
+
{
|
|
30
|
+
variant: "caption",
|
|
31
|
+
color: "secondary",
|
|
32
|
+
as: "div",
|
|
33
|
+
"data-testid": m.empty,
|
|
34
|
+
children: s
|
|
35
|
+
}
|
|
36
|
+
) : t.map((o) => /* @__PURE__ */ p(
|
|
37
|
+
"span",
|
|
38
|
+
{
|
|
39
|
+
className: "flex items-center gap-2",
|
|
40
|
+
"data-testid": m.row,
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ i(f, { size: 20, token: o.token }),
|
|
43
|
+
/* @__PURE__ */ i(c, { data: o.value, token: o.token })
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
o.token.address
|
|
47
|
+
)) });
|
|
48
|
+
}
|
|
49
|
+
function h(r, e) {
|
|
50
|
+
const s = /* @__PURE__ */ new Map(), n = (t, o) => {
|
|
51
|
+
const l = t.token.address.toLowerCase(), a = s.get(l);
|
|
52
|
+
s.set(l, {
|
|
53
|
+
token: a?.token ?? t.token,
|
|
54
|
+
// a token the other side alone holds is a zero here, not a gap
|
|
55
|
+
value: o ? t.value : a?.value ?? 0n,
|
|
56
|
+
worth: v(a?.worth, t.valueUsd)
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
for (const t of r ?? []) n(t, !0);
|
|
60
|
+
for (const t of e ?? []) n(t, !1);
|
|
61
|
+
return [...s.values()].filter((t) => t.worth === null || t.worth >= k).sort(
|
|
62
|
+
(t, o) => (o.worth ?? 0) - (t.worth ?? 0) || // a tie has to break the same way on both sides, or the rows drift
|
|
63
|
+
t.token.address.localeCompare(o.token.address)
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
function v(r, e) {
|
|
67
|
+
return r === void 0 ? e : r === null || e === null ? null : Math.max(r, e);
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
_ as PositionAssets,
|
|
71
|
+
m as PositionAssetsTest,
|
|
72
|
+
h as visibleAssets
|
|
73
|
+
};
|
|
@@ -1,194 +1,199 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { PointsIcon as
|
|
3
|
-
import { TokenIcon as
|
|
4
|
-
import { FormattedMessageTyped as
|
|
1
|
+
import { jsxs as i, jsx as t, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import { PointsIcon as I } from "../../points-icon/points-icon.js";
|
|
3
|
+
import { TokenIcon as P } from "../../token-icon/token-icon.js";
|
|
4
|
+
import { FormattedMessageTyped as p } from "../../typed-intl/index.js";
|
|
5
5
|
import "react";
|
|
6
|
-
import { positiveTokenRewardsOf as
|
|
6
|
+
import { positiveTokenRewardsOf as M, pointProgramsOf as L, totalApyOf as T } from "../../../utils/apy-breakdown.js";
|
|
7
7
|
import "@gearbox-protocol/sdk";
|
|
8
|
-
import { bpsToPercent as
|
|
9
|
-
import { cn as
|
|
8
|
+
import { bpsToPercent as $ } from "../../../utils/bps.js";
|
|
9
|
+
import { cn as h } from "../../../utils/cn.js";
|
|
10
10
|
import "sonner";
|
|
11
|
-
import { formatLeverage as
|
|
12
|
-
import { formatCompactPercent as
|
|
13
|
-
import { strategyApyPartsAtLeverage as
|
|
11
|
+
import { formatLeverage as a } from "../../../utils/format-leverage.js";
|
|
12
|
+
import { formatCompactPercent as F } from "../../../utils/format-money.js";
|
|
13
|
+
import { strategyApyPartsAtLeverage as j } from "../../../utils/strategy-apy.js";
|
|
14
14
|
import "@gearbox-protocol/sdk/common-utils";
|
|
15
15
|
import "luxon";
|
|
16
16
|
import "../../../utils/z-index.js";
|
|
17
|
-
import { StrategyApyBreakdownCardTest as
|
|
18
|
-
const
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
if (Math.abs(
|
|
22
|
-
const
|
|
23
|
-
return
|
|
17
|
+
import { StrategyApyBreakdownCardTest as w } from "./constants.js";
|
|
18
|
+
const u = "—";
|
|
19
|
+
function s(e) {
|
|
20
|
+
const n = $(e);
|
|
21
|
+
if (Math.abs(n) >= 1e3) {
|
|
22
|
+
const d = F(Math.abs(n));
|
|
23
|
+
return n < 0 ? `−${d}` : d;
|
|
24
24
|
}
|
|
25
|
-
const m = Math.abs(
|
|
26
|
-
return
|
|
25
|
+
const m = Math.abs(n).toFixed(2);
|
|
26
|
+
return n < 0 ? `−${m}%` : `${m}%`;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function S(e) {
|
|
29
29
|
return e == null || e <= 0 ? "bg-muted text-muted-foreground" : "bg-success/20 text-success";
|
|
30
30
|
}
|
|
31
31
|
function g({
|
|
32
32
|
base: e,
|
|
33
|
-
leverage:
|
|
33
|
+
leverage: n
|
|
34
34
|
}) {
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
|
|
35
|
+
return /* @__PURE__ */ t(
|
|
36
|
+
p,
|
|
37
37
|
{
|
|
38
38
|
messageId: "components.strategyApyBreakdownCard.formula",
|
|
39
|
-
values: { base: e, leverage:
|
|
39
|
+
values: { base: e, leverage: n }
|
|
40
40
|
}
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function te({
|
|
44
44
|
data: e,
|
|
45
|
-
leverage:
|
|
45
|
+
leverage: n
|
|
46
46
|
}) {
|
|
47
|
-
const
|
|
48
|
-
leverage:
|
|
49
|
-
maxLeverage: e.maxLeverage,
|
|
47
|
+
const o = n ?? (e.maxLeverage != null && e.maxLeverage > 0 ? e.maxLeverage : void 0), m = o != null ? a(o) : u, d = e.collateralApy ? M(e.collateralApy) : [], k = e.collateralApy ? L(e.collateralApy) : [], r = o != null ? j({
|
|
48
|
+
leverage: o,
|
|
50
49
|
borrowApy: e.borrowApy,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
)
|
|
55
|
-
|
|
50
|
+
quotaRate: e.quotaRate,
|
|
51
|
+
liquidationThreshold: e.liquidationThreshold,
|
|
52
|
+
quotaMode: e.quotaMode
|
|
53
|
+
}) : void 0, f = e.collateralApy?.organicApy, y = f != null && o != null ? f * o : void 0, v = d.map(
|
|
54
|
+
(l) => l.supplyApr != null && o != null ? l.supplyApr * o : void 0
|
|
55
|
+
), N = e.borrowApy != null && r != null ? -r.borrowCost : void 0, x = e.quotaRate != null && e.quotaRate !== 0, q = x && r != null ? r.quotaRate : void 0, R = x && r != null ? -r.quotaCost : void 0, C = y != null && r != null && v.every((l) => l != null) ? y + v.reduce((l, c) => l + (c ?? 0), 0) - r.totalCost : void 0, A = e.netApy != null ? T(e.netApy) : C;
|
|
56
|
+
return /* @__PURE__ */ i(
|
|
56
57
|
"div",
|
|
57
58
|
{
|
|
58
59
|
className: "flex w-full min-w-0 flex-col gap-4 rounded-xl border border-border bg-card p-4",
|
|
59
|
-
"data-testid":
|
|
60
|
+
"data-testid": w.root,
|
|
60
61
|
children: [
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
|
|
62
|
+
/* @__PURE__ */ i("div", { className: "flex h-6 items-center justify-between gap-3", children: [
|
|
63
|
+
/* @__PURE__ */ t("span", { className: "text-base font-semibold leading-4 text-foreground", children: /* @__PURE__ */ t(
|
|
64
|
+
p,
|
|
64
65
|
{
|
|
65
66
|
messageId: "components.strategyApyBreakdownCard.titleAtLeverage",
|
|
66
67
|
values: { leverage: m }
|
|
67
68
|
}
|
|
68
69
|
) }),
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ t(
|
|
70
71
|
"span",
|
|
71
72
|
{
|
|
72
|
-
className:
|
|
73
|
+
className: h(
|
|
73
74
|
"rounded-md px-2 py-0.5 text-sm font-semibold tabular-nums",
|
|
74
|
-
|
|
75
|
+
S(A)
|
|
75
76
|
),
|
|
76
|
-
"data-testid":
|
|
77
|
-
children: A == null ?
|
|
77
|
+
"data-testid": w.net,
|
|
78
|
+
children: A == null ? u : s(A)
|
|
78
79
|
}
|
|
79
80
|
)
|
|
80
81
|
] }),
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
|
|
82
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col gap-3", children: [
|
|
83
|
+
/* @__PURE__ */ t(
|
|
84
|
+
b,
|
|
84
85
|
{
|
|
85
|
-
label: /* @__PURE__ */
|
|
86
|
-
value:
|
|
87
|
-
subtext:
|
|
86
|
+
label: /* @__PURE__ */ t(p, { messageId: "components.strategyApyBreakdownCard.collateralApy" }),
|
|
87
|
+
value: y == null ? u : s(y),
|
|
88
|
+
subtext: f != null && o != null ? /* @__PURE__ */ t(
|
|
88
89
|
g,
|
|
89
90
|
{
|
|
90
|
-
base:
|
|
91
|
-
leverage:
|
|
91
|
+
base: s(f),
|
|
92
|
+
leverage: a(o)
|
|
92
93
|
}
|
|
93
94
|
) : void 0
|
|
94
95
|
}
|
|
95
96
|
),
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
d.map((l, c) => /* @__PURE__ */ t(
|
|
98
|
+
b,
|
|
98
99
|
{
|
|
99
|
-
label: /* @__PURE__ */
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
|
|
100
|
+
label: /* @__PURE__ */ i("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
101
|
+
/* @__PURE__ */ t("span", { children: /* @__PURE__ */ t(
|
|
102
|
+
p,
|
|
102
103
|
{
|
|
103
104
|
messageId: "components.apyParts.extraAPY",
|
|
104
|
-
values: { symbol:
|
|
105
|
+
values: { symbol: l.token.symbol }
|
|
105
106
|
}
|
|
106
107
|
) }),
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
|
|
108
|
+
/* @__PURE__ */ t(
|
|
109
|
+
P,
|
|
109
110
|
{
|
|
110
|
-
token:
|
|
111
|
-
symbol:
|
|
111
|
+
token: l.token,
|
|
112
|
+
symbol: l.token.symbol,
|
|
112
113
|
size: 16,
|
|
113
114
|
className: "shrink-0"
|
|
114
115
|
}
|
|
115
116
|
)
|
|
116
117
|
] }),
|
|
117
|
-
value:
|
|
118
|
-
subtext:
|
|
118
|
+
value: v[c] == null ? u : s(v[c]),
|
|
119
|
+
subtext: l.supplyApr != null && o != null ? /* @__PURE__ */ t(
|
|
119
120
|
g,
|
|
120
121
|
{
|
|
121
|
-
base:
|
|
122
|
-
leverage:
|
|
122
|
+
base: s(l.supplyApr),
|
|
123
|
+
leverage: a(o)
|
|
123
124
|
}
|
|
124
125
|
) : void 0
|
|
125
126
|
},
|
|
126
|
-
`incentive-${
|
|
127
|
+
`incentive-${l.token.address}-${l.supplyApr ?? 0}`
|
|
127
128
|
)),
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
|
|
129
|
+
/* @__PURE__ */ t(
|
|
130
|
+
b,
|
|
130
131
|
{
|
|
131
132
|
muted: !0,
|
|
132
|
-
label: /* @__PURE__ */
|
|
133
|
-
value: N == null ?
|
|
134
|
-
subtext: e.borrowApy != null &&
|
|
133
|
+
label: /* @__PURE__ */ t(p, { messageId: "components.strategyApyBreakdownCard.borrowRate" }),
|
|
134
|
+
value: N == null ? u : s(N),
|
|
135
|
+
subtext: e.borrowApy != null && r != null ? /* @__PURE__ */ t(
|
|
135
136
|
g,
|
|
136
137
|
{
|
|
137
|
-
base:
|
|
138
|
-
leverage:
|
|
138
|
+
base: s(-e.borrowApy),
|
|
139
|
+
leverage: a(r.debtMultiplier)
|
|
139
140
|
}
|
|
140
141
|
) : void 0
|
|
141
142
|
}
|
|
142
143
|
),
|
|
143
|
-
x ? /* @__PURE__ */
|
|
144
|
-
|
|
144
|
+
x ? /* @__PURE__ */ t(
|
|
145
|
+
b,
|
|
145
146
|
{
|
|
146
147
|
muted: !0,
|
|
147
|
-
label: /* @__PURE__ */
|
|
148
|
-
value:
|
|
149
|
-
subtext:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
148
|
+
label: /* @__PURE__ */ t(p, { messageId: "components.strategyApyBreakdownCard.quotaRate" }),
|
|
149
|
+
value: R == null ? u : s(R),
|
|
150
|
+
subtext: q != null && r != null ? (
|
|
151
|
+
// The quota is charged on the LT-weighted position, so this
|
|
152
|
+
// multiplier is not the leverage the row above uses.
|
|
153
|
+
/* @__PURE__ */ t(
|
|
154
|
+
g,
|
|
155
|
+
{
|
|
156
|
+
base: s(-q),
|
|
157
|
+
leverage: a(r.quotaMultiplier)
|
|
158
|
+
}
|
|
159
|
+
)
|
|
155
160
|
) : void 0
|
|
156
161
|
}
|
|
157
162
|
) : null,
|
|
158
|
-
k.length > 0 ? /* @__PURE__ */
|
|
159
|
-
/* @__PURE__ */
|
|
160
|
-
k.map((
|
|
161
|
-
const c =
|
|
162
|
-
return /* @__PURE__ */
|
|
163
|
-
|
|
163
|
+
k.length > 0 ? /* @__PURE__ */ i(B, { children: [
|
|
164
|
+
/* @__PURE__ */ t("div", { className: "h-px w-full bg-divider" }),
|
|
165
|
+
k.map((l) => {
|
|
166
|
+
const c = l.multiplier != null && o != null ? l.multiplier * o : void 0;
|
|
167
|
+
return /* @__PURE__ */ t(
|
|
168
|
+
b,
|
|
164
169
|
{
|
|
165
|
-
label: /* @__PURE__ */
|
|
166
|
-
/* @__PURE__ */
|
|
167
|
-
|
|
170
|
+
label: /* @__PURE__ */ i("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
171
|
+
/* @__PURE__ */ t("span", { children: /* @__PURE__ */ t(
|
|
172
|
+
p,
|
|
168
173
|
{
|
|
169
174
|
messageId: "components.yieldBreakdown.programPoints",
|
|
170
|
-
values: { name:
|
|
175
|
+
values: { name: l.name }
|
|
171
176
|
}
|
|
172
177
|
) }),
|
|
173
|
-
/* @__PURE__ */
|
|
174
|
-
|
|
178
|
+
/* @__PURE__ */ t(
|
|
179
|
+
I,
|
|
175
180
|
{
|
|
176
|
-
reward: { name:
|
|
181
|
+
reward: { name: l.name, type: l.id },
|
|
177
182
|
size: 16,
|
|
178
183
|
className: "shrink-0"
|
|
179
184
|
}
|
|
180
185
|
)
|
|
181
186
|
] }),
|
|
182
|
-
value: c != null ? `${
|
|
183
|
-
subtext:
|
|
187
|
+
value: c != null ? `${a(c)}×` : u,
|
|
188
|
+
subtext: l.multiplier != null && o != null ? /* @__PURE__ */ t(
|
|
184
189
|
g,
|
|
185
190
|
{
|
|
186
|
-
base:
|
|
187
|
-
leverage:
|
|
191
|
+
base: a(l.multiplier),
|
|
192
|
+
leverage: a(o)
|
|
188
193
|
}
|
|
189
194
|
) : void 0
|
|
190
195
|
},
|
|
191
|
-
|
|
196
|
+
l.id
|
|
192
197
|
);
|
|
193
198
|
})
|
|
194
199
|
] }) : null
|
|
@@ -197,38 +202,38 @@ function oe({
|
|
|
197
202
|
}
|
|
198
203
|
);
|
|
199
204
|
}
|
|
200
|
-
function
|
|
205
|
+
function b({
|
|
201
206
|
label: e,
|
|
202
|
-
value:
|
|
203
|
-
subtext:
|
|
207
|
+
value: n,
|
|
208
|
+
subtext: o,
|
|
204
209
|
muted: m = !1
|
|
205
210
|
}) {
|
|
206
|
-
const
|
|
207
|
-
return /* @__PURE__ */
|
|
211
|
+
const d = m ? "text-muted-foreground" : "text-foreground";
|
|
212
|
+
return /* @__PURE__ */ i(
|
|
208
213
|
"div",
|
|
209
214
|
{
|
|
210
215
|
className: "flex items-start justify-between gap-3",
|
|
211
|
-
"data-testid":
|
|
216
|
+
"data-testid": w.row,
|
|
212
217
|
children: [
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
-
/* @__PURE__ */
|
|
215
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ t("span", { className: h("min-w-0 text-sm font-semibold leading-5", d), children: e }),
|
|
219
|
+
/* @__PURE__ */ i("span", { className: "flex shrink-0 flex-col items-end", children: [
|
|
220
|
+
/* @__PURE__ */ t(
|
|
216
221
|
"span",
|
|
217
222
|
{
|
|
218
|
-
className:
|
|
223
|
+
className: h(
|
|
219
224
|
"text-sm font-semibold leading-5 tabular-nums",
|
|
220
|
-
|
|
225
|
+
n === u || m ? "text-muted-foreground" : "text-foreground"
|
|
221
226
|
),
|
|
222
|
-
children:
|
|
227
|
+
children: n
|
|
223
228
|
}
|
|
224
229
|
),
|
|
225
|
-
|
|
230
|
+
o != null ? /* @__PURE__ */ t("span", { className: "text-xs leading-4 text-muted-foreground", children: o }) : null
|
|
226
231
|
] })
|
|
227
232
|
]
|
|
228
233
|
}
|
|
229
234
|
);
|
|
230
235
|
}
|
|
231
236
|
export {
|
|
232
|
-
|
|
233
|
-
|
|
237
|
+
te as StrategyApyBreakdownCard,
|
|
238
|
+
w as StrategyApyBreakdownCardTest
|
|
234
239
|
};
|
|
@@ -1,63 +1,82 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as r, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { formatUnits as m } from "viem";
|
|
3
|
+
import { CompoundAPY as p } from "../../compound-apy/compound-apy.js";
|
|
4
|
+
import { SimpleTooltip as u } from "../../tooltip/simple-tooltip.js";
|
|
5
|
+
import "../../tooltip/tooltip.js";
|
|
3
6
|
import "react";
|
|
4
7
|
import "@gearbox-protocol/sdk";
|
|
5
8
|
import { cn as a } from "../../../utils/cn.js";
|
|
6
9
|
import "sonner";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
10
|
+
import { formatAssetAmount as c } from "../../../utils/format-asset-amount.js";
|
|
11
|
+
import { formatLeverage as d } from "../../../utils/format-leverage.js";
|
|
12
|
+
import { formatPercentAmount as f, formatMoney as h } from "../../../utils/format-money.js";
|
|
9
13
|
import "@gearbox-protocol/sdk/common-utils";
|
|
10
14
|
import "luxon";
|
|
11
15
|
import "../../../utils/z-index.js";
|
|
12
|
-
import { ValueTest as
|
|
13
|
-
const
|
|
14
|
-
function
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
+
import { ValueTest as e } from "./constants.js";
|
|
17
|
+
const v = "—";
|
|
18
|
+
function n() {
|
|
19
|
+
return /* @__PURE__ */ r("span", { "data-testid": e.placeholder, children: v });
|
|
16
20
|
}
|
|
17
|
-
function
|
|
18
|
-
return `${
|
|
21
|
+
function l(t) {
|
|
22
|
+
return `${f(t / 100, 2)}%`;
|
|
19
23
|
}
|
|
20
|
-
function
|
|
21
|
-
return t === void 0 ? /* @__PURE__ */
|
|
24
|
+
function E({ data: t }) {
|
|
25
|
+
return t === void 0 ? /* @__PURE__ */ r(n, {}) : typeof t == "number" ? /* @__PURE__ */ r("span", { "data-testid": e.apy, children: l(t) }) : /* @__PURE__ */ r("span", { "data-testid": e.apy, children: /* @__PURE__ */ r(p, { apy: t }) });
|
|
22
26
|
}
|
|
23
|
-
function
|
|
27
|
+
function H({
|
|
24
28
|
data: t
|
|
25
29
|
}) {
|
|
26
|
-
return t == null ? /* @__PURE__ */
|
|
30
|
+
return t == null ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": e.usd, children: h(t) });
|
|
27
31
|
}
|
|
28
|
-
function
|
|
32
|
+
function N({
|
|
29
33
|
data: t
|
|
30
34
|
}) {
|
|
31
|
-
return t === void 0 ? /* @__PURE__ */
|
|
35
|
+
return t === void 0 ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": e.leverage, children: `${d(t)}x` });
|
|
32
36
|
}
|
|
33
37
|
function w({
|
|
34
38
|
data: t
|
|
35
39
|
}) {
|
|
36
|
-
return t === void 0 ? /* @__PURE__ */
|
|
40
|
+
return t === void 0 ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": e.utilization, children: l(t) });
|
|
37
41
|
}
|
|
38
|
-
function
|
|
42
|
+
function D({
|
|
39
43
|
data: t
|
|
40
44
|
}) {
|
|
41
45
|
if (t === void 0)
|
|
42
|
-
return /* @__PURE__ */
|
|
43
|
-
const
|
|
44
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ r(n, {});
|
|
47
|
+
const i = t < 1e4 ? "text-destructive" : t < 11e3 ? "text-warning" : "text-success";
|
|
48
|
+
return /* @__PURE__ */ r("span", { "data-testid": e.healthFactor, className: a(i), children: (t / 1e4).toFixed(2) });
|
|
45
49
|
}
|
|
46
|
-
function
|
|
50
|
+
function M({
|
|
47
51
|
data: t,
|
|
48
|
-
token:
|
|
52
|
+
token: i
|
|
49
53
|
}) {
|
|
50
|
-
if (t === void 0 ||
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
-
const
|
|
53
|
-
return
|
|
54
|
+
if (t === void 0 || i === void 0)
|
|
55
|
+
return /* @__PURE__ */ r(n, {});
|
|
56
|
+
const o = m(t, i.decimals);
|
|
57
|
+
return (
|
|
58
|
+
// `title` also keeps the amount where a hover tooltip cannot reach:
|
|
59
|
+
// keyboard, touch, and the browser's own find
|
|
60
|
+
/* @__PURE__ */ s("span", { "data-testid": e.tokenBigint, title: `${o} ${i.symbol}`, children: [
|
|
61
|
+
/* @__PURE__ */ r(
|
|
62
|
+
u,
|
|
63
|
+
{
|
|
64
|
+
placement: "top",
|
|
65
|
+
className: "break-all",
|
|
66
|
+
title: /* @__PURE__ */ r("span", { children: c(t, i.decimals) }),
|
|
67
|
+
children: /* @__PURE__ */ r("span", { children: o })
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
` ${i.symbol}`
|
|
71
|
+
] })
|
|
72
|
+
);
|
|
54
73
|
}
|
|
55
74
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
75
|
+
E as ApyValue,
|
|
76
|
+
D as HealthFactorValue,
|
|
77
|
+
N as LeverageValue,
|
|
78
|
+
M as TokenBigint,
|
|
79
|
+
H as UsdValue,
|
|
61
80
|
w as UtilizationValue,
|
|
62
|
-
|
|
81
|
+
l as bps
|
|
63
82
|
};
|
|
@@ -37,6 +37,7 @@ import "../simple-accordion/simple-accordion.js";
|
|
|
37
37
|
import "../tip-card/tip-card.js";
|
|
38
38
|
import "../typography/typography.js";
|
|
39
39
|
import "../points-icon/points-icon.js";
|
|
40
|
+
import "viem";
|
|
40
41
|
import "../vertical-indicator/vertical-indicator.js";
|
|
41
42
|
import "../base/page-title/page-title.js";
|
|
42
43
|
import "../detailed-page-title/detailed-page-title-copy-button.js";
|
|
@@ -72,7 +73,6 @@ import "../dialog/dialog-header.js";
|
|
|
72
73
|
import "../dialog/dialog-title.js";
|
|
73
74
|
import "../dialog/dialog-modal-container.js";
|
|
74
75
|
import "../dialog/dialog-overlay.js";
|
|
75
|
-
import "viem";
|
|
76
76
|
import "../input/input.js";
|
|
77
77
|
import { Label as k } from "../label/label.js";
|
|
78
78
|
import "../simple-dropdown/simple-dropdown.js";
|
|
@@ -37,6 +37,7 @@ import "../../simple-accordion/simple-accordion.js";
|
|
|
37
37
|
import "../../tip-card/tip-card.js";
|
|
38
38
|
import "../../typography/typography.js";
|
|
39
39
|
import "../../points-icon/points-icon.js";
|
|
40
|
+
import "viem";
|
|
40
41
|
import "../../vertical-indicator/vertical-indicator.js";
|
|
41
42
|
import "../../base/page-title/page-title.js";
|
|
42
43
|
import "../../detailed-page-title/detailed-page-title-copy-button.js";
|
|
@@ -73,7 +74,6 @@ import "../../dialog/dialog-header.js";
|
|
|
73
74
|
import "../../dialog/dialog-title.js";
|
|
74
75
|
import "../../dialog/dialog-modal-container.js";
|
|
75
76
|
import "../../dialog/dialog-overlay.js";
|
|
76
|
-
import "viem";
|
|
77
77
|
import "../../input/input.js";
|
|
78
78
|
import "../../label/label.js";
|
|
79
79
|
import "../../simple-dropdown/simple-dropdown.js";
|
|
@@ -69,7 +69,7 @@ function E({
|
|
|
69
69
|
maxLeverage: p,
|
|
70
70
|
collateralApy: r,
|
|
71
71
|
borrowApy: d,
|
|
72
|
-
|
|
72
|
+
quotaRate: a,
|
|
73
73
|
decimals: m = 2,
|
|
74
74
|
className: o
|
|
75
75
|
}) {
|
|
@@ -89,7 +89,7 @@ function E({
|
|
|
89
89
|
maxLeverage: p,
|
|
90
90
|
collateralApy: r,
|
|
91
91
|
borrowApy: d,
|
|
92
|
-
|
|
92
|
+
quotaRate: a,
|
|
93
93
|
className: o,
|
|
94
94
|
children: s()
|
|
95
95
|
}
|