@gearbox-protocol/ui-kit 4.0.0-next.43 → 4.0.0-next.44
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/borrow-rate-block/borrow-rate-block.cjs +1 -1
- 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/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/base/position-assets/position-assets.cjs +1 -1
- package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/base/token-amount/token-amount.cjs +1 -1
- package/dist/cjs/components/base/values/constants.cjs +1 -1
- package/dist/cjs/components/base/values/index.cjs +1 -1
- package/dist/cjs/components/base/values/no-value.cjs +1 -0
- package/dist/cjs/components/base/values/pnl-value.cjs +1 -1
- package/dist/cjs/components/base/values/price-impact-value.cjs +1 -1
- package/dist/cjs/components/base/values/scalars.cjs +1 -1
- package/dist/cjs/components/base-table/base-table-line.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/composites/pool-assets-table/pool-assets-table-row.cjs +1 -1
- package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
- package/dist/cjs/components/help-tip/help-tip.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/index.cjs +1 -1
- package/dist/cjs/locale/en.json.cjs +1 -1
- package/dist/esm/components/base/borrow-rate-block/borrow-rate-block.js +3 -2
- package/dist/esm/components/base/index.js +63 -61
- package/dist/esm/components/base/info-list/info-list.js +8 -7
- package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +74 -61
- package/dist/esm/components/base/position-assets/position-assets.js +4 -3
- package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +86 -74
- package/dist/esm/components/base/token-amount/token-amount.js +32 -16
- package/dist/esm/components/base/values/constants.js +1 -0
- package/dist/esm/components/base/values/index.js +21 -19
- package/dist/esm/components/base/values/no-value.js +34 -0
- package/dist/esm/components/base/values/pnl-value.js +10 -9
- package/dist/esm/components/base/values/price-impact-value.js +6 -5
- package/dist/esm/components/base/values/scalars.js +23 -26
- package/dist/esm/components/base-table/base-table-line.js +44 -36
- 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/composites/pool-assets-table/pool-assets-table-row.js +47 -46
- package/dist/esm/components/compound-apy/compound-apy.js +48 -40
- package/dist/esm/components/help-tip/help-tip.js +64 -59
- package/dist/esm/components/index.js +624 -622
- package/dist/esm/components/with-copy/with-copy.js +1 -1
- package/dist/esm/index.js +805 -803
- package/dist/esm/locale/en.json.js +1 -0
- package/dist/types/components/base/apy-breakdown-body/apy-breakdown-body.d.ts +4 -3
- package/dist/types/components/base/values/constants.d.ts +1 -0
- package/dist/types/components/base/values/index.d.ts +1 -0
- package/dist/types/components/base/values/no-value.d.ts +25 -0
- package/dist/types/components/base/values/scalars.d.ts +7 -2
- package/dist/types/locale/en.json.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,105 +1,117 @@
|
|
|
1
|
-
import { jsxs as A, jsx as
|
|
1
|
+
import { jsxs as A, jsx as o, Fragment as C } from "react/jsx-runtime";
|
|
2
2
|
import { calcNetStrategyApy as x, calcEffectiveBorrowApy as D } from "@gearbox-protocol/sdk/onchain";
|
|
3
|
-
import { ApyBreakdownBody as P,
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
3
|
+
import { ApyBreakdownBody as P, formatBreakdownRate as i, ApyBreakdownRow as v, periodMessageId as k, ApyBreakdownDivider as q, BREAKDOWN_DASH as O } from "../apy-breakdown-body/apy-breakdown-body.js";
|
|
4
|
+
import { NoValue as b } from "../values/no-value.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { totalApyOf as S, positiveTokenRewardsOf as L, pointProgramsOf as M } from "../../../utils/apy-breakdown.js";
|
|
7
|
+
import "clsx";
|
|
8
|
+
import "tailwind-merge";
|
|
9
|
+
import "sonner";
|
|
8
10
|
import { formatLeverage as d } from "../../../utils/format-leverage.js";
|
|
11
|
+
import "luxon";
|
|
12
|
+
import "../../../utils/z-index.js";
|
|
13
|
+
import { PointsIcon as $ } from "../../points-icon/points-icon.js";
|
|
14
|
+
import "viem";
|
|
15
|
+
import { TokenIcon as j } from "../../token-icon/token-icon.js";
|
|
16
|
+
import { FormattedMessageTyped as r } from "../../typed-intl/index.js";
|
|
17
|
+
import "../../tooltip/simple-tooltip.js";
|
|
18
|
+
import "../../tooltip/tooltip.js";
|
|
19
|
+
import "../../badge/badge.js";
|
|
20
|
+
import "../../badge/chip.js";
|
|
9
21
|
import { StrategyApyBreakdownCardTest as n } from "./constants.js";
|
|
10
|
-
function
|
|
11
|
-
const { borrowApyAvg7D:
|
|
12
|
-
return
|
|
13
|
-
borrowApy:
|
|
14
|
-
quotaRate:
|
|
15
|
-
liquidationThreshold:
|
|
22
|
+
function z(c) {
|
|
23
|
+
const { borrowApyAvg7D: t, quotaRateAvg7D: p, liquidationThreshold: s } = c;
|
|
24
|
+
return t === void 0 || p === void 0 ? null : {
|
|
25
|
+
borrowApy: t,
|
|
26
|
+
quotaRate: p,
|
|
27
|
+
liquidationThreshold: s
|
|
16
28
|
};
|
|
17
29
|
}
|
|
18
|
-
function
|
|
30
|
+
function so({
|
|
19
31
|
data: c,
|
|
20
|
-
leverage:
|
|
21
|
-
showFormula:
|
|
22
|
-
period:
|
|
32
|
+
leverage: t,
|
|
33
|
+
showFormula: p = !1,
|
|
34
|
+
period: s
|
|
23
35
|
}) {
|
|
24
|
-
const a =
|
|
36
|
+
const a = z(c), l = a && c.collateralApyAvg7D ? c.collateralApyAvg7D : void 0, f = a !== null && l !== void 0, g = f && a && l ? {
|
|
25
37
|
organicApy: x(
|
|
26
38
|
a,
|
|
27
39
|
l.organicApy,
|
|
28
|
-
|
|
40
|
+
t
|
|
29
41
|
),
|
|
30
42
|
totalApy: x(
|
|
31
43
|
a,
|
|
32
44
|
l.totalApy ?? l.organicApy,
|
|
33
|
-
|
|
45
|
+
t
|
|
34
46
|
),
|
|
35
47
|
...l.rewards ? { rewards: l.rewards } : {}
|
|
36
|
-
} : null,
|
|
48
|
+
} : null, m = f && a ? D(a, t) : null, u = g === null ? null : S(g), I = u === null || m === null ? null : u + m, N = l ? L(l) : [], B = l ? M(l) : [], T = N.map((e) => ({
|
|
37
49
|
reward: e,
|
|
38
|
-
value: Math.round(
|
|
39
|
-
})), y = I === null ? null : I - T.reduce((e,
|
|
50
|
+
value: Math.round(t * (e.supplyApr ?? 0))
|
|
51
|
+
})), y = I === null ? null : I - T.reduce((e, w) => e + w.value, 0), h = y !== null && t > 0 ? y / t : void 0, R = a && m !== null && t > 0 ? (m - a.borrowApy * (t - 1)) / t : void 0;
|
|
40
52
|
return /* @__PURE__ */ A(
|
|
41
53
|
P,
|
|
42
54
|
{
|
|
43
55
|
testId: n.root,
|
|
44
|
-
title: /* @__PURE__ */
|
|
45
|
-
|
|
56
|
+
title: /* @__PURE__ */ o(
|
|
57
|
+
r,
|
|
46
58
|
{
|
|
47
|
-
messageId:
|
|
48
|
-
|
|
59
|
+
messageId: k(
|
|
60
|
+
s,
|
|
49
61
|
"components.yieldBreakdown.titleNetAtLeverage",
|
|
50
62
|
"components.yieldBreakdown.titleNetAtLeverage7d"
|
|
51
63
|
),
|
|
52
|
-
values: { leverage: d(
|
|
64
|
+
values: { leverage: d(t) }
|
|
53
65
|
}
|
|
54
66
|
),
|
|
55
|
-
chip: u === null ?
|
|
67
|
+
chip: u === null ? /* @__PURE__ */ o(b, { reason: s }) : i(u),
|
|
56
68
|
chipPositive: (u ?? 0) > 0,
|
|
57
69
|
chipTestId: n.net,
|
|
58
70
|
children: [
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
|
|
71
|
+
/* @__PURE__ */ o(
|
|
72
|
+
v,
|
|
61
73
|
{
|
|
62
74
|
testId: n.collateral,
|
|
63
75
|
valueTestId: n.value,
|
|
64
76
|
captionTestId: n.caption,
|
|
65
|
-
label: /* @__PURE__ */
|
|
66
|
-
|
|
77
|
+
label: /* @__PURE__ */ o(
|
|
78
|
+
r,
|
|
67
79
|
{
|
|
68
|
-
messageId:
|
|
69
|
-
|
|
80
|
+
messageId: k(
|
|
81
|
+
s,
|
|
70
82
|
"components.yieldBreakdown.collateralApy",
|
|
71
83
|
"components.yieldBreakdown.collateralApy7d"
|
|
72
84
|
)
|
|
73
85
|
}
|
|
74
86
|
),
|
|
75
|
-
value: y === null ?
|
|
76
|
-
subtext:
|
|
77
|
-
|
|
87
|
+
value: y === null ? /* @__PURE__ */ o(b, { reason: s }) : i(y),
|
|
88
|
+
subtext: p && h !== void 0 ? /* @__PURE__ */ o(
|
|
89
|
+
r,
|
|
78
90
|
{
|
|
79
91
|
messageId: "components.strategyApyBreakdownCard.formula",
|
|
80
92
|
values: {
|
|
81
|
-
leverage: d(
|
|
82
|
-
base:
|
|
93
|
+
leverage: d(t),
|
|
94
|
+
base: i(h)
|
|
83
95
|
}
|
|
84
96
|
}
|
|
85
97
|
) : void 0
|
|
86
98
|
}
|
|
87
99
|
),
|
|
88
|
-
T.map(({ reward: e, value:
|
|
89
|
-
|
|
100
|
+
T.map(({ reward: e, value: w }) => /* @__PURE__ */ o(
|
|
101
|
+
v,
|
|
90
102
|
{
|
|
91
103
|
valueTestId: n.value,
|
|
92
104
|
captionTestId: n.caption,
|
|
93
105
|
label: /* @__PURE__ */ A("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
-
|
|
106
|
+
/* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(
|
|
107
|
+
r,
|
|
96
108
|
{
|
|
97
109
|
messageId: "components.apyParts.extraAPY",
|
|
98
110
|
values: { symbol: e.token.symbol }
|
|
99
111
|
}
|
|
100
112
|
) }),
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
|
|
113
|
+
/* @__PURE__ */ o(
|
|
114
|
+
j,
|
|
103
115
|
{
|
|
104
116
|
token: e.token,
|
|
105
117
|
symbol: e.token.symbol,
|
|
@@ -108,74 +120,74 @@ function J({
|
|
|
108
120
|
}
|
|
109
121
|
)
|
|
110
122
|
] }),
|
|
111
|
-
value:
|
|
112
|
-
subtext:
|
|
113
|
-
|
|
123
|
+
value: i(w),
|
|
124
|
+
subtext: p ? /* @__PURE__ */ o(
|
|
125
|
+
r,
|
|
114
126
|
{
|
|
115
127
|
messageId: "components.strategyApyBreakdownCard.formula",
|
|
116
128
|
values: {
|
|
117
|
-
leverage: d(
|
|
118
|
-
base:
|
|
129
|
+
leverage: d(t),
|
|
130
|
+
base: i(e.supplyApr ?? 0)
|
|
119
131
|
}
|
|
120
132
|
}
|
|
121
133
|
) : void 0
|
|
122
134
|
},
|
|
123
135
|
`incentive-${e.token.address}-${e.supplyApr ?? 0}`
|
|
124
136
|
)),
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
|
|
137
|
+
/* @__PURE__ */ o(
|
|
138
|
+
v,
|
|
127
139
|
{
|
|
128
140
|
muted: !0,
|
|
129
141
|
testId: n.borrow,
|
|
130
142
|
valueTestId: n.value,
|
|
131
143
|
captionTestId: n.caption,
|
|
132
|
-
label: /* @__PURE__ */
|
|
133
|
-
|
|
144
|
+
label: /* @__PURE__ */ o(
|
|
145
|
+
r,
|
|
134
146
|
{
|
|
135
|
-
messageId:
|
|
136
|
-
|
|
147
|
+
messageId: k(
|
|
148
|
+
s,
|
|
137
149
|
"components.yieldBreakdown.borrowRate",
|
|
138
150
|
"components.yieldBreakdown.borrowRate7d"
|
|
139
151
|
)
|
|
140
152
|
}
|
|
141
153
|
),
|
|
142
|
-
value:
|
|
143
|
-
subtext:
|
|
144
|
-
|
|
154
|
+
value: m === null ? /* @__PURE__ */ o(b, { reason: s }) : i(-m),
|
|
155
|
+
subtext: p && a && R !== void 0 ? /* @__PURE__ */ o(
|
|
156
|
+
r,
|
|
145
157
|
{
|
|
146
158
|
messageId: "components.strategyApyBreakdownCard.borrowFormula",
|
|
147
159
|
values: {
|
|
148
|
-
leverage: d(
|
|
160
|
+
leverage: d(t),
|
|
149
161
|
// What the position is charged per unit of itself: base
|
|
150
162
|
// interest plus the quota, added before either is rounded, so
|
|
151
163
|
// the caption is not the sum of two figures it also printed.
|
|
152
|
-
totalRate:
|
|
164
|
+
totalRate: i(a.borrowApy + R),
|
|
153
165
|
// Magnitudes, not signed rates: the row above already carries
|
|
154
166
|
// the minus, and `− −0.88%` reads as arithmetic to decode
|
|
155
167
|
// rather than a cost to understand.
|
|
156
|
-
borrowRate:
|
|
168
|
+
borrowRate: i(a.borrowApy)
|
|
157
169
|
}
|
|
158
170
|
}
|
|
159
171
|
) : void 0
|
|
160
172
|
}
|
|
161
173
|
),
|
|
162
174
|
B.length > 0 ? /* @__PURE__ */ A(C, { children: [
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
B.map((e) => /* @__PURE__ */
|
|
165
|
-
|
|
175
|
+
/* @__PURE__ */ o(q, {}),
|
|
176
|
+
B.map((e) => /* @__PURE__ */ o(
|
|
177
|
+
v,
|
|
166
178
|
{
|
|
167
179
|
valueTestId: n.points,
|
|
168
180
|
captionTestId: n.caption,
|
|
169
181
|
label: /* @__PURE__ */ A("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
-
|
|
182
|
+
/* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(
|
|
183
|
+
r,
|
|
172
184
|
{
|
|
173
185
|
messageId: "components.yieldBreakdown.programPoints",
|
|
174
186
|
values: { name: e.name }
|
|
175
187
|
}
|
|
176
188
|
) }),
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
|
|
189
|
+
/* @__PURE__ */ o(
|
|
190
|
+
$,
|
|
179
191
|
{
|
|
180
192
|
reward: { name: e.name, type: e.id },
|
|
181
193
|
size: 16,
|
|
@@ -183,13 +195,13 @@ function J({
|
|
|
183
195
|
}
|
|
184
196
|
)
|
|
185
197
|
] }),
|
|
186
|
-
value: e.multiplier != null ? `${d(e.multiplier *
|
|
187
|
-
subtext:
|
|
188
|
-
|
|
198
|
+
value: e.multiplier != null ? `${d(e.multiplier * t)}×` : O,
|
|
199
|
+
subtext: p && e.multiplier != null ? /* @__PURE__ */ o(
|
|
200
|
+
r,
|
|
189
201
|
{
|
|
190
202
|
messageId: "components.strategyApyBreakdownCard.formula",
|
|
191
203
|
values: {
|
|
192
|
-
leverage: d(
|
|
204
|
+
leverage: d(t),
|
|
193
205
|
base: d(e.multiplier)
|
|
194
206
|
}
|
|
195
207
|
}
|
|
@@ -203,6 +215,6 @@ function J({
|
|
|
203
215
|
);
|
|
204
216
|
}
|
|
205
217
|
export {
|
|
206
|
-
|
|
218
|
+
so as StrategyApyBreakdownCard,
|
|
207
219
|
n as StrategyApyBreakdownCardTest
|
|
208
220
|
};
|
|
@@ -1,30 +1,46 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { Stack as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
1
|
+
import { jsx as r, jsxs as e } from "react/jsx-runtime";
|
|
2
|
+
import { Stack as n } from "../stack/stack.js";
|
|
3
|
+
import { NoValue as a } from "../values/no-value.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import "@gearbox-protocol/sdk/onchain";
|
|
6
|
+
import "clsx";
|
|
7
|
+
import "tailwind-merge";
|
|
8
|
+
import "sonner";
|
|
9
|
+
import { formatMoney as s } from "../../../utils/format-money.js";
|
|
10
|
+
import "luxon";
|
|
11
|
+
import "../../../utils/z-index.js";
|
|
12
|
+
import "../../points-icon/points-icon.js";
|
|
13
|
+
import "viem";
|
|
14
|
+
import "../../token-icon/token-icon.js";
|
|
15
|
+
import "react-intl";
|
|
16
|
+
import "../../tooltip/simple-tooltip.js";
|
|
17
|
+
import "../../tooltip/tooltip.js";
|
|
18
|
+
import "../../badge/badge.js";
|
|
19
|
+
import "../../badge/chip.js";
|
|
20
|
+
import { TokenTemplate as l } from "../../token-template/token-template.js";
|
|
21
|
+
import { Typography as u } from "../../typography/typography.js";
|
|
22
|
+
import { TokenAmountTest as t } from "./constants.js";
|
|
23
|
+
function C({
|
|
8
24
|
data: o,
|
|
9
|
-
token:
|
|
10
|
-
align:
|
|
25
|
+
token: m,
|
|
26
|
+
align: i = "end"
|
|
11
27
|
}) {
|
|
12
28
|
if (o === null)
|
|
13
29
|
return /* @__PURE__ */ r(
|
|
14
30
|
"span",
|
|
15
31
|
{
|
|
16
32
|
className: "text-secondary-foreground",
|
|
17
|
-
"data-testid":
|
|
33
|
+
"data-testid": t.root,
|
|
18
34
|
children: "—"
|
|
19
35
|
}
|
|
20
36
|
);
|
|
21
|
-
const
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
/* @__PURE__ */ r(
|
|
24
|
-
/* @__PURE__ */ r(
|
|
37
|
+
const p = m ?? o.token;
|
|
38
|
+
return /* @__PURE__ */ e(n, { gap: "xs", align: i, "data-testid": t.root, children: [
|
|
39
|
+
/* @__PURE__ */ r(l, { value: o.value, token: p }),
|
|
40
|
+
/* @__PURE__ */ r(u, { as: "span", variant: "caption", color: "secondary", children: o.valueUsd === null ? /* @__PURE__ */ r(a, {}) : s(o.valueUsd) })
|
|
25
41
|
] });
|
|
26
42
|
}
|
|
27
43
|
export {
|
|
28
|
-
|
|
29
|
-
|
|
44
|
+
C as TokenAmount,
|
|
45
|
+
t as TokenAmountTest
|
|
30
46
|
};
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import { PositionShortLabelTest as t, ValueTest as r } from "./constants.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { NoValue as i } from "./no-value.js";
|
|
3
|
+
import { PnlValue as p } from "./pnl-value.js";
|
|
4
|
+
import { PointsValue as u } from "./points-value.js";
|
|
5
|
+
import { PositionShortLabel as V } from "./position-short-label.js";
|
|
5
6
|
import { PositionStatusBadge as n } from "./position-status-badge.js";
|
|
6
|
-
import { PositionTypeBadge as
|
|
7
|
-
import { PriceImpactValue as
|
|
8
|
-
import { ApyValue as
|
|
7
|
+
import { PositionTypeBadge as P } from "./position-type-badge.js";
|
|
8
|
+
import { PriceImpactValue as g, priceImpact as T } from "./price-impact-value.js";
|
|
9
|
+
import { ApyValue as d, HealthFactorValue as h, LeverageValue as B, TokenBigint as L, UsdValue as S, UtilizationValue as y, bps as I } from "./scalars.js";
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
i as
|
|
14
|
-
p as
|
|
15
|
-
|
|
11
|
+
d as ApyValue,
|
|
12
|
+
h as HealthFactorValue,
|
|
13
|
+
B as LeverageValue,
|
|
14
|
+
i as NoValue,
|
|
15
|
+
p as PnlValue,
|
|
16
|
+
u as PointsValue,
|
|
17
|
+
V as PositionShortLabel,
|
|
16
18
|
t as PositionShortLabelTest,
|
|
17
19
|
n as PositionStatusBadge,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
P as PositionTypeBadge,
|
|
21
|
+
g as PriceImpactValue,
|
|
22
|
+
L as TokenBigint,
|
|
23
|
+
S as UsdValue,
|
|
24
|
+
y as UtilizationValue,
|
|
23
25
|
r as ValueTest,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
I as bps,
|
|
27
|
+
T as priceImpact
|
|
26
28
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { HelpTip as o } from "../../help-tip/help-tip.js";
|
|
3
|
+
import { useIntlTyped as i } from "../../typed-intl/index.js";
|
|
4
|
+
import { ValueTest as n } from "./constants.js";
|
|
5
|
+
const c = "—";
|
|
6
|
+
function u({ reason: r }) {
|
|
7
|
+
const t = i();
|
|
8
|
+
if (r === void 0)
|
|
9
|
+
return /* @__PURE__ */ e(
|
|
10
|
+
"span",
|
|
11
|
+
{
|
|
12
|
+
className: "text-secondary-foreground",
|
|
13
|
+
"data-testid": n.placeholder,
|
|
14
|
+
children: c
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
const s = t.formatMessage({
|
|
18
|
+
messageId: "components.value.accruing"
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ a(
|
|
21
|
+
"span",
|
|
22
|
+
{
|
|
23
|
+
className: "inline-flex items-center leading-[0]",
|
|
24
|
+
"data-testid": n.accruing,
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ e(o, { iconSize: 18, children: s }),
|
|
27
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: s })
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
u as NoValue
|
|
34
|
+
};
|
|
@@ -5,23 +5,24 @@ import { cn as i } from "../../../utils/cn.js";
|
|
|
5
5
|
import "sonner";
|
|
6
6
|
import "luxon";
|
|
7
7
|
import "../../../utils/z-index.js";
|
|
8
|
-
import { ValueTest as
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import { ValueTest as s } from "./constants.js";
|
|
9
|
+
import { NoValue as m } from "./no-value.js";
|
|
10
|
+
function V({
|
|
11
|
+
data: o
|
|
11
12
|
}) {
|
|
12
|
-
const t = typeof
|
|
13
|
+
const t = typeof o == "number" ? o : o?.total.valueUsd ?? null;
|
|
13
14
|
if (t === null)
|
|
14
|
-
return /* @__PURE__ */ r(
|
|
15
|
-
const
|
|
15
|
+
return /* @__PURE__ */ r(m, {});
|
|
16
|
+
const e = t > 0 ? "+" : t < 0 ? "−" : "";
|
|
16
17
|
return /* @__PURE__ */ r(
|
|
17
18
|
"span",
|
|
18
19
|
{
|
|
19
|
-
"data-testid":
|
|
20
|
+
"data-testid": s.pnl,
|
|
20
21
|
className: i(t > 0 && "text-success", t < 0 && "text-destructive"),
|
|
21
|
-
children: `${
|
|
22
|
+
children: `${e}$${Math.abs(t).toFixed(2)}`
|
|
22
23
|
}
|
|
23
24
|
);
|
|
24
25
|
}
|
|
25
26
|
export {
|
|
26
|
-
|
|
27
|
+
V as PnlValue
|
|
27
28
|
};
|
|
@@ -8,15 +8,16 @@ import { formatPercentAmount as o } from "../../../utils/format-money.js";
|
|
|
8
8
|
import "luxon";
|
|
9
9
|
import "../../../utils/z-index.js";
|
|
10
10
|
import { ValueTest as i } from "./constants.js";
|
|
11
|
-
|
|
11
|
+
import { NoValue as m } from "./no-value.js";
|
|
12
|
+
function p(r) {
|
|
12
13
|
return `${r > 0n ? "+" : ""}${o(Number(r) / 1e4, 2)}%`;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
+
function x({
|
|
15
16
|
data: r
|
|
16
17
|
}) {
|
|
17
|
-
return r === void 0 ? /* @__PURE__ */ t(
|
|
18
|
+
return r === void 0 ? /* @__PURE__ */ t(m, {}) : /* @__PURE__ */ t("span", { "data-testid": i.priceImpact, children: p(r) });
|
|
18
19
|
}
|
|
19
20
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
x as PriceImpactValue,
|
|
22
|
+
p as priceImpact
|
|
22
23
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { formatUnits as
|
|
1
|
+
import { jsx as r, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import { formatUnits as l } from "viem";
|
|
3
3
|
import { CompoundAPY as p } from "../../compound-apy/compound-apy.js";
|
|
4
4
|
import { SimpleTooltip as a } from "../../tooltip/simple-tooltip.js";
|
|
5
5
|
import "../../tooltip/tooltip.js";
|
|
@@ -7,42 +7,39 @@ import "react";
|
|
|
7
7
|
import "@gearbox-protocol/sdk/onchain";
|
|
8
8
|
import { cn as c } from "../../../utils/cn.js";
|
|
9
9
|
import "sonner";
|
|
10
|
-
import { formatAssetAmount as
|
|
11
|
-
import { formatLeverage as
|
|
10
|
+
import { formatAssetAmount as f } from "../../../utils/format-asset-amount.js";
|
|
11
|
+
import { formatLeverage as d } from "../../../utils/format-leverage.js";
|
|
12
12
|
import { formatPercentAmount as h, formatMoney as v } from "../../../utils/format-money.js";
|
|
13
13
|
import "luxon";
|
|
14
14
|
import "../../../utils/z-index.js";
|
|
15
15
|
import { ValueTest as i } from "./constants.js";
|
|
16
|
-
|
|
17
|
-
function n() {
|
|
18
|
-
return /* @__PURE__ */ r("span", { "data-testid": i.placeholder, children: x });
|
|
19
|
-
}
|
|
16
|
+
import { NoValue as n } from "./no-value.js";
|
|
20
17
|
function s(t) {
|
|
21
18
|
return `${h(t / 100, 2)}%`;
|
|
22
19
|
}
|
|
23
|
-
function
|
|
20
|
+
function w({
|
|
24
21
|
data: t,
|
|
25
22
|
tooltip: e = !0,
|
|
26
23
|
period: o
|
|
27
24
|
}) {
|
|
28
|
-
return t === void 0 ? /* @__PURE__ */ r(n, {}) : typeof t == "number" ? /* @__PURE__ */ r("span", { "data-testid": i.apy, children: s(t) }) : /* @__PURE__ */ r("span", { "data-testid": i.apy, children: /* @__PURE__ */ r(p, { apy: t, tooltip: e, period: o }) });
|
|
25
|
+
return t === void 0 ? /* @__PURE__ */ r(n, { reason: o }) : typeof t == "number" ? /* @__PURE__ */ r("span", { "data-testid": i.apy, children: s(t) }) : /* @__PURE__ */ r("span", { "data-testid": i.apy, children: /* @__PURE__ */ r(p, { apy: t, tooltip: e, period: o }) });
|
|
29
26
|
}
|
|
30
|
-
function
|
|
27
|
+
function C({
|
|
31
28
|
data: t
|
|
32
29
|
}) {
|
|
33
30
|
return t == null ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": i.usd, children: v(t) });
|
|
34
31
|
}
|
|
35
|
-
function
|
|
32
|
+
function H({
|
|
36
33
|
data: t
|
|
37
34
|
}) {
|
|
38
|
-
return t === void 0 ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": i.leverage, children: `${
|
|
35
|
+
return t === void 0 ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": i.leverage, children: `${d(t)}x` });
|
|
39
36
|
}
|
|
40
|
-
function
|
|
37
|
+
function M({
|
|
41
38
|
data: t
|
|
42
39
|
}) {
|
|
43
40
|
return t === void 0 ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": i.utilization, children: s(t) });
|
|
44
41
|
}
|
|
45
|
-
function
|
|
42
|
+
function S({
|
|
46
43
|
data: t
|
|
47
44
|
}) {
|
|
48
45
|
if (t === void 0)
|
|
@@ -50,26 +47,26 @@ function D({
|
|
|
50
47
|
const e = t < 1e4 ? "text-destructive" : t < 11e3 ? "text-warning" : "text-success";
|
|
51
48
|
return /* @__PURE__ */ r("span", { "data-testid": i.healthFactor, className: c(e), children: (t / 1e4).toFixed(2) });
|
|
52
49
|
}
|
|
53
|
-
function
|
|
50
|
+
function Y({
|
|
54
51
|
data: t,
|
|
55
52
|
token: e,
|
|
56
53
|
showSymbol: o = !0
|
|
57
54
|
}) {
|
|
58
55
|
if (t === void 0 || e === void 0)
|
|
59
56
|
return /* @__PURE__ */ r(n, {});
|
|
60
|
-
const
|
|
57
|
+
const m = l(t, e.decimals);
|
|
61
58
|
return (
|
|
62
59
|
// `title` also keeps the amount where a hover tooltip cannot reach:
|
|
63
60
|
// keyboard, touch, and the browser's own find — and keeps the symbol
|
|
64
61
|
// reachable there even when the row is the one printing it
|
|
65
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ u("span", { "data-testid": i.tokenBigint, title: `${m} ${e.symbol}`, children: [
|
|
66
63
|
/* @__PURE__ */ r(
|
|
67
64
|
a,
|
|
68
65
|
{
|
|
69
66
|
placement: "top",
|
|
70
67
|
className: "break-all",
|
|
71
|
-
title: /* @__PURE__ */ r("span", { children:
|
|
72
|
-
children: /* @__PURE__ */ r("span", { children:
|
|
68
|
+
title: /* @__PURE__ */ r("span", { children: f(t, e.decimals) }),
|
|
69
|
+
children: /* @__PURE__ */ r("span", { children: m })
|
|
73
70
|
}
|
|
74
71
|
),
|
|
75
72
|
o && ` ${e.symbol}`
|
|
@@ -77,11 +74,11 @@ function M({
|
|
|
77
74
|
);
|
|
78
75
|
}
|
|
79
76
|
export {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
77
|
+
w as ApyValue,
|
|
78
|
+
S as HealthFactorValue,
|
|
79
|
+
H as LeverageValue,
|
|
80
|
+
Y as TokenBigint,
|
|
81
|
+
C as UsdValue,
|
|
82
|
+
M as UtilizationValue,
|
|
86
83
|
s as bps
|
|
87
84
|
};
|