@gearbox-protocol/ui-kit 4.0.0-next.17 → 4.0.0-next.19
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/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
- package/dist/cjs/components/hf-indicator/hf-indicator.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/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +121 -116
- package/dist/esm/components/compound-apy/compound-apy.js +2 -2
- package/dist/esm/components/hf-indicator/hf-indicator.js +55 -29
- package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +20 -21
- package/dist/esm/index.js +55 -56
- package/dist/esm/utils/index.js +29 -30
- package/dist/esm/utils/strategy-apy.js +41 -31
- package/dist/globals.css +1 -1
- package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts +7 -13
- package/dist/types/components/compound-apy/compound-apy.d.ts +2 -2
- package/dist/types/components/hf-indicator/hf-indicator.d.ts +12 -3
- 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
|
@@ -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
|
};
|
|
@@ -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
|
}
|
|
@@ -1,33 +1,59 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
]
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { jsxs as a, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
const d = {
|
|
3
|
+
sm: {
|
|
4
|
+
core: 40,
|
|
5
|
+
rings: [
|
|
6
|
+
[46, 0.6],
|
|
7
|
+
[52, 0.3]
|
|
8
|
+
],
|
|
9
|
+
font: "text-xs"
|
|
10
|
+
},
|
|
11
|
+
md: {
|
|
12
|
+
core: 80,
|
|
13
|
+
rings: [
|
|
14
|
+
[92, 0.8],
|
|
15
|
+
[104, 0.6],
|
|
16
|
+
[116, 0.4],
|
|
17
|
+
[128, 0.2]
|
|
18
|
+
],
|
|
19
|
+
font: "text-[21px]"
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
function f({
|
|
23
|
+
value: o,
|
|
24
|
+
size: i = "md"
|
|
13
25
|
}) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
const { core: t, rings: e, font: l } = d[i], n = e[e.length - 1]?.[0] ?? t;
|
|
27
|
+
return /* @__PURE__ */ a(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
className: "relative flex shrink-0 items-center justify-center",
|
|
31
|
+
style: { width: n, height: n },
|
|
32
|
+
children: [
|
|
33
|
+
e.map(([r, c]) => /* @__PURE__ */ s(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border border-solid bg-transparent",
|
|
37
|
+
style: {
|
|
38
|
+
width: r,
|
|
39
|
+
height: r,
|
|
40
|
+
borderColor: `color-mix(in srgb, var(--color-destructive) ${c * 100}%, transparent)`
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
r
|
|
44
|
+
)),
|
|
45
|
+
/* @__PURE__ */ s(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: "relative z-[1] flex items-center justify-center rounded-full bg-destructive",
|
|
49
|
+
style: { width: t, height: t },
|
|
50
|
+
children: /* @__PURE__ */ s("span", { className: `${l} font-bold`, children: o })
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
);
|
|
30
56
|
}
|
|
31
57
|
export {
|
|
32
|
-
|
|
58
|
+
f as HFIndicator
|
|
33
59
|
};
|
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
import { jsxs as a, jsx as e, Fragment as
|
|
2
|
-
import { PointsIcon as
|
|
3
|
-
import { TokenIcon as
|
|
4
|
-
import { SimpleTooltip as
|
|
1
|
+
import { jsxs as a, jsx as e, Fragment as k } from "react/jsx-runtime";
|
|
2
|
+
import { PointsIcon as N } from "../points-icon/points-icon.js";
|
|
3
|
+
import { TokenIcon as P } from "../token-icon/token-icon.js";
|
|
4
|
+
import { SimpleTooltip as A } from "../tooltip/simple-tooltip.js";
|
|
5
5
|
import "../tooltip/tooltip.js";
|
|
6
6
|
import { FormattedMessageTyped as s } from "../typed-intl/index.js";
|
|
7
7
|
import "react";
|
|
8
|
-
import { tokenRewardsOf as
|
|
8
|
+
import { tokenRewardsOf as I, pointProgramsOf as B, totalApyOf as T } from "../../utils/apy-breakdown.js";
|
|
9
9
|
import "@gearbox-protocol/sdk";
|
|
10
|
-
import { bpsToPercent as
|
|
10
|
+
import { bpsToPercent as $ } from "../../utils/bps.js";
|
|
11
11
|
import { cn as p } from "../../utils/cn.js";
|
|
12
12
|
import "sonner";
|
|
13
|
-
import { formatLeverage as
|
|
14
|
-
import { formatCompactPercent as
|
|
15
|
-
import { strategyQuotaRate as O } from "../../utils/strategy-apy.js";
|
|
13
|
+
import { formatLeverage as j } from "../../utils/format-leverage.js";
|
|
14
|
+
import { formatCompactPercent as S } from "../../utils/format-money.js";
|
|
16
15
|
import "@gearbox-protocol/sdk/common-utils";
|
|
17
16
|
import "luxon";
|
|
18
17
|
import "../../utils/z-index.js";
|
|
19
18
|
function i(n) {
|
|
20
|
-
const o =
|
|
19
|
+
const o = $(n), r = S(Math.abs(o));
|
|
21
20
|
return o < 0 ? `-${r}` : r;
|
|
22
21
|
}
|
|
23
|
-
function
|
|
22
|
+
function V({
|
|
24
23
|
supplyApy: n,
|
|
25
24
|
maxLeverage: o,
|
|
26
25
|
collateralApy: r,
|
|
27
26
|
borrowApy: c,
|
|
28
|
-
|
|
27
|
+
quotaRate: u,
|
|
29
28
|
children: h,
|
|
30
29
|
className: f
|
|
31
30
|
}) {
|
|
32
|
-
const g = o !== void 0 && o > 0, l = r ?? n,
|
|
31
|
+
const g = o !== void 0 && o > 0, l = r ?? n, w = I(l), y = B(n), b = T(n), d = c != null || u != null ? -((c ?? 0) + (u ?? 0)) : void 0, x = y.filter((t) => t.multiplier != null), v = /* @__PURE__ */ a(
|
|
33
32
|
"div",
|
|
34
33
|
{
|
|
35
34
|
className: p(
|
|
@@ -47,7 +46,7 @@ function L({
|
|
|
47
46
|
{
|
|
48
47
|
messageId: "components.yieldBreakdown.titleNetAtLeverage",
|
|
49
48
|
values: {
|
|
50
|
-
leverage:
|
|
49
|
+
leverage: j(o)
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
) : /* @__PURE__ */ e(s, { messageId: "components.apyParts.totalAPY" }) }),
|
|
@@ -70,7 +69,7 @@ function L({
|
|
|
70
69
|
value: i(l.organicApy)
|
|
71
70
|
}
|
|
72
71
|
),
|
|
73
|
-
|
|
72
|
+
w.map((t) => t.supplyApr == null ? null : /* @__PURE__ */ e(
|
|
74
73
|
m,
|
|
75
74
|
{
|
|
76
75
|
muted: t.supplyApr < 0,
|
|
@@ -82,7 +81,7 @@ function L({
|
|
|
82
81
|
values: { symbol: t.token.symbol }
|
|
83
82
|
}
|
|
84
83
|
) }),
|
|
85
|
-
/* @__PURE__ */ e(
|
|
84
|
+
/* @__PURE__ */ e(P, { token: t.token, size: 20 })
|
|
86
85
|
] }),
|
|
87
86
|
value: i(t.supplyApr)
|
|
88
87
|
},
|
|
@@ -96,7 +95,7 @@ function L({
|
|
|
96
95
|
value: i(d)
|
|
97
96
|
}
|
|
98
97
|
),
|
|
99
|
-
x.length > 0 && /* @__PURE__ */ a(
|
|
98
|
+
x.length > 0 && /* @__PURE__ */ a(k, { children: [
|
|
100
99
|
/* @__PURE__ */ e("div", { className: "h-px w-full bg-divider" }),
|
|
101
100
|
x.map((t) => /* @__PURE__ */ e(
|
|
102
101
|
m,
|
|
@@ -110,7 +109,7 @@ function L({
|
|
|
110
109
|
}
|
|
111
110
|
) }),
|
|
112
111
|
/* @__PURE__ */ e(
|
|
113
|
-
|
|
112
|
+
N,
|
|
114
113
|
{
|
|
115
114
|
reward: {
|
|
116
115
|
name: t.name,
|
|
@@ -129,7 +128,7 @@ function L({
|
|
|
129
128
|
}
|
|
130
129
|
);
|
|
131
130
|
return /* @__PURE__ */ e(
|
|
132
|
-
|
|
131
|
+
A,
|
|
133
132
|
{
|
|
134
133
|
placement: "bottom",
|
|
135
134
|
triangle: !1,
|
|
@@ -138,7 +137,7 @@ function L({
|
|
|
138
137
|
maxWidth: "100%",
|
|
139
138
|
title: /* @__PURE__ */ e("span", { className: f, children: h }),
|
|
140
139
|
triggerClassName: f,
|
|
141
|
-
children:
|
|
140
|
+
children: v
|
|
142
141
|
}
|
|
143
142
|
);
|
|
144
143
|
}
|
|
@@ -162,5 +161,5 @@ function m({
|
|
|
162
161
|
] });
|
|
163
162
|
}
|
|
164
163
|
export {
|
|
165
|
-
|
|
164
|
+
V as YieldBreakdownTooltip
|
|
166
165
|
};
|