@gearbox-protocol/ui-kit 4.0.0-next.43 → 4.0.0-next.45
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/liquidation-price-block/liquidation-price-block.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/time-to-liquidation-block/time-to-liquidation-block.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/composites/tx-preview/confirm/amounts/TransactionConfirmAmountField.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/cjs/utils/format.cjs +1 -1
- package/dist/cjs/utils/index.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/liquidation-price-block/liquidation-price-block.js +46 -38
- 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 +45 -41
- package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +86 -74
- package/dist/esm/components/base/time-to-liquidation-block/time-to-liquidation-block.js +40 -32
- 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/composites/tx-preview/confirm/amounts/TransactionConfirmAmountField.js +26 -25
- 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 +814 -811
- package/dist/esm/locale/en.json.js +1 -0
- package/dist/esm/utils/format.js +14 -12
- package/dist/esm/utils/index.js +76 -75
- package/dist/globals.css +1 -1
- package/dist/types/components/base/apy-breakdown-body/apy-breakdown-body.d.ts +4 -3
- package/dist/types/components/base/liquidation-price-block/liquidation-price-block.d.ts +8 -1
- package/dist/types/components/base/position-assets/position-assets.d.ts +7 -1
- package/dist/types/components/base/time-to-liquidation-block/time-to-liquidation-block.d.ts +8 -1
- 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/dist/types/utils/format.d.ts +8 -0
- package/package.json +1 -1
|
@@ -1,121 +1,134 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { ApyBreakdownBody as w,
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
1
|
+
import { jsxs as p, jsx as e, Fragment as v } from "react/jsx-runtime";
|
|
2
|
+
import { ApyBreakdownBody as w, formatBreakdownRate as a, ApyBreakdownRow as i, periodMessageId as d, ApyBreakdownDivider as g, BREAKDOWN_DASH as f } from "../apy-breakdown-body/apy-breakdown-body.js";
|
|
3
|
+
import { NoValue as c } from "../values/no-value.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { totalApyOf as B, tokenRewardsOf as I, pointProgramsOf as h } from "../../../utils/apy-breakdown.js";
|
|
6
|
+
import "@gearbox-protocol/sdk/onchain";
|
|
7
|
+
import "clsx";
|
|
8
|
+
import "tailwind-merge";
|
|
9
|
+
import "sonner";
|
|
10
|
+
import "luxon";
|
|
11
|
+
import "../../../utils/z-index.js";
|
|
12
|
+
import { PointsIcon as b } from "../../points-icon/points-icon.js";
|
|
13
|
+
import "viem";
|
|
14
|
+
import { PoolApyBreakdownCardTest as t } from "./constants.js";
|
|
15
|
+
import { TokenIcon as C } from "../../token-icon/token-icon.js";
|
|
16
|
+
import "../../tooltip/simple-tooltip.js";
|
|
17
|
+
import "../../tooltip/tooltip.js";
|
|
18
|
+
import { FormattedMessageTyped as l } from "../../typed-intl/index.js";
|
|
19
|
+
import "../../badge/badge.js";
|
|
20
|
+
import "../../badge/chip.js";
|
|
21
|
+
function q({
|
|
9
22
|
data: n,
|
|
10
|
-
period:
|
|
23
|
+
period: r
|
|
11
24
|
}) {
|
|
12
|
-
const
|
|
13
|
-
return /* @__PURE__ */
|
|
25
|
+
const s = n ? B(n) : void 0, m = n?.organicApy, u = n == null ? void 0 : (s ?? 0) - (m ?? 0), y = n ? I(n) : [], A = n ? h(n) : [], k = [...y.filter((o) => o.supplyApr != null), ...A];
|
|
26
|
+
return /* @__PURE__ */ p(
|
|
14
27
|
w,
|
|
15
28
|
{
|
|
16
|
-
testId:
|
|
17
|
-
title: /* @__PURE__ */
|
|
18
|
-
|
|
29
|
+
testId: t.root,
|
|
30
|
+
title: /* @__PURE__ */ e(
|
|
31
|
+
l,
|
|
19
32
|
{
|
|
20
|
-
messageId:
|
|
21
|
-
|
|
33
|
+
messageId: d(
|
|
34
|
+
r,
|
|
22
35
|
"components.poolApyBreakdownCard.title",
|
|
23
36
|
"components.poolApyBreakdownCard.title7d"
|
|
24
37
|
)
|
|
25
38
|
}
|
|
26
39
|
),
|
|
27
|
-
chip:
|
|
28
|
-
chipPositive: (
|
|
29
|
-
chipTestId:
|
|
40
|
+
chip: s == null ? /* @__PURE__ */ e(c, { reason: r }) : a(s),
|
|
41
|
+
chipPositive: (s ?? 0) > 0,
|
|
42
|
+
chipTestId: t.net,
|
|
30
43
|
children: [
|
|
31
|
-
/* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */ e(
|
|
32
45
|
i,
|
|
33
46
|
{
|
|
34
|
-
valueTestId:
|
|
35
|
-
label: /* @__PURE__ */
|
|
36
|
-
|
|
47
|
+
valueTestId: t.value,
|
|
48
|
+
label: /* @__PURE__ */ e(
|
|
49
|
+
l,
|
|
37
50
|
{
|
|
38
|
-
messageId:
|
|
39
|
-
|
|
51
|
+
messageId: d(
|
|
52
|
+
r,
|
|
40
53
|
"components.poolApyBreakdownCard.organicApy",
|
|
41
54
|
"components.poolApyBreakdownCard.organicApy7d"
|
|
42
55
|
)
|
|
43
56
|
}
|
|
44
57
|
),
|
|
45
|
-
value: m == null ?
|
|
58
|
+
value: m == null ? /* @__PURE__ */ e(c, { reason: r }) : a(m)
|
|
46
59
|
}
|
|
47
60
|
),
|
|
48
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ e(
|
|
49
62
|
i,
|
|
50
63
|
{
|
|
51
|
-
valueTestId:
|
|
52
|
-
label: /* @__PURE__ */
|
|
53
|
-
|
|
64
|
+
valueTestId: t.value,
|
|
65
|
+
label: /* @__PURE__ */ e(
|
|
66
|
+
l,
|
|
54
67
|
{
|
|
55
|
-
messageId:
|
|
56
|
-
|
|
68
|
+
messageId: d(
|
|
69
|
+
r,
|
|
57
70
|
"components.poolApyBreakdownCard.incentiveApy",
|
|
58
71
|
"components.poolApyBreakdownCard.incentiveApy7d"
|
|
59
72
|
)
|
|
60
73
|
}
|
|
61
74
|
),
|
|
62
|
-
value:
|
|
75
|
+
value: u == null ? /* @__PURE__ */ e(c, { reason: r }) : a(u)
|
|
63
76
|
}
|
|
64
77
|
),
|
|
65
|
-
k.length > 0 ? /* @__PURE__ */
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
|
|
68
|
-
(
|
|
78
|
+
k.length > 0 ? /* @__PURE__ */ p(v, { children: [
|
|
79
|
+
/* @__PURE__ */ e(g, {}),
|
|
80
|
+
y.map(
|
|
81
|
+
(o) => o.supplyApr == null ? null : /* @__PURE__ */ e(
|
|
69
82
|
i,
|
|
70
83
|
{
|
|
71
|
-
valueTestId:
|
|
72
|
-
label: /* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
|
|
84
|
+
valueTestId: t.reward,
|
|
85
|
+
label: /* @__PURE__ */ p("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
86
|
+
/* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
|
|
87
|
+
l,
|
|
75
88
|
{
|
|
76
89
|
messageId: "components.apyParts.extraAPY",
|
|
77
|
-
values: { symbol:
|
|
90
|
+
values: { symbol: o.token.symbol }
|
|
78
91
|
}
|
|
79
92
|
) }),
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
|
|
93
|
+
/* @__PURE__ */ e(
|
|
94
|
+
C,
|
|
82
95
|
{
|
|
83
|
-
token:
|
|
84
|
-
symbol:
|
|
96
|
+
token: o.token,
|
|
97
|
+
symbol: o.token.symbol,
|
|
85
98
|
size: 16,
|
|
86
99
|
className: "shrink-0"
|
|
87
100
|
}
|
|
88
101
|
)
|
|
89
102
|
] }),
|
|
90
|
-
value:
|
|
103
|
+
value: a(o.supplyApr)
|
|
91
104
|
},
|
|
92
|
-
`incentive-${
|
|
105
|
+
`incentive-${o.token.address}-${o.supplyApr}`
|
|
93
106
|
)
|
|
94
107
|
),
|
|
95
|
-
A.map((
|
|
108
|
+
A.map((o) => /* @__PURE__ */ e(
|
|
96
109
|
i,
|
|
97
110
|
{
|
|
98
|
-
valueTestId:
|
|
99
|
-
label: /* @__PURE__ */
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
|
|
111
|
+
valueTestId: t.points,
|
|
112
|
+
label: /* @__PURE__ */ p("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
113
|
+
/* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
|
|
114
|
+
l,
|
|
102
115
|
{
|
|
103
116
|
messageId: "components.yieldBreakdown.programPoints",
|
|
104
|
-
values: { name:
|
|
117
|
+
values: { name: o.name }
|
|
105
118
|
}
|
|
106
119
|
) }),
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
|
|
120
|
+
/* @__PURE__ */ e(
|
|
121
|
+
b,
|
|
109
122
|
{
|
|
110
|
-
reward: { name:
|
|
123
|
+
reward: { name: o.name, type: o.id },
|
|
111
124
|
size: 16,
|
|
112
125
|
className: "shrink-0"
|
|
113
126
|
}
|
|
114
127
|
)
|
|
115
128
|
] }),
|
|
116
|
-
value:
|
|
129
|
+
value: o.multiplier != null ? `${o.multiplier}×` : f
|
|
117
130
|
},
|
|
118
|
-
|
|
131
|
+
o.id
|
|
119
132
|
))
|
|
120
133
|
] }) : null
|
|
121
134
|
]
|
|
@@ -123,6 +136,6 @@ function D({
|
|
|
123
136
|
);
|
|
124
137
|
}
|
|
125
138
|
export {
|
|
126
|
-
|
|
127
|
-
|
|
139
|
+
q as PoolApyBreakdownCard,
|
|
140
|
+
t as PoolApyBreakdownCardTest
|
|
128
141
|
};
|
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as e, jsxs as m, Fragment as p } from "react/jsx-runtime";
|
|
2
2
|
import { Stack as h } from "../stack/stack.js";
|
|
3
|
+
import "../../help-tip/help-tip.js";
|
|
3
4
|
import "react";
|
|
5
|
+
import "react-intl";
|
|
4
6
|
import "@gearbox-protocol/sdk/onchain";
|
|
5
7
|
import "clsx";
|
|
6
8
|
import "tailwind-merge";
|
|
7
9
|
import "sonner";
|
|
10
|
+
import { APPROXIMATE_SYMBOL as f } from "../../../utils/format.js";
|
|
8
11
|
import "luxon";
|
|
9
12
|
import "../../../utils/z-index.js";
|
|
10
13
|
import "../../points-icon/points-icon.js";
|
|
11
14
|
import { TokenBigint as d } from "../values/scalars.js";
|
|
12
15
|
import "../../badge/badge.js";
|
|
13
16
|
import "../../badge/chip.js";
|
|
14
|
-
import "
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { Typography as k } from "../../typography/typography.js";
|
|
17
|
+
import { ShortString as u } from "../../short-string/short-string.js";
|
|
18
|
+
import { TokenSymbol as k } from "../../token-symbol/token-symbol.js";
|
|
19
|
+
import { Typography as v } from "../../typography/typography.js";
|
|
18
20
|
import { PositionAssetsTest as c } from "./constants.js";
|
|
19
|
-
const
|
|
20
|
-
function
|
|
21
|
+
const g = 1, y = 20;
|
|
22
|
+
function I({
|
|
21
23
|
assets: s,
|
|
22
|
-
to:
|
|
24
|
+
to: r,
|
|
23
25
|
empty: a,
|
|
24
|
-
|
|
26
|
+
approximate: l,
|
|
27
|
+
testId: o
|
|
25
28
|
}) {
|
|
26
|
-
const
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
|
|
29
|
+
const n = S(s, r), i = r !== void 0;
|
|
30
|
+
return /* @__PURE__ */ e(h, { gap: "sm", align: "end", "data-testid": o ?? c.root, children: n.length === 0 ? a !== void 0 && /* @__PURE__ */ e(
|
|
31
|
+
v,
|
|
29
32
|
{
|
|
30
33
|
variant: "caption",
|
|
31
34
|
color: "secondary",
|
|
@@ -33,63 +36,64 @@ function X({
|
|
|
33
36
|
"data-testid": c.empty,
|
|
34
37
|
children: a
|
|
35
38
|
}
|
|
36
|
-
) :
|
|
39
|
+
) : n.map((t) => /* @__PURE__ */ m(
|
|
37
40
|
"span",
|
|
38
41
|
{
|
|
39
42
|
className: "flex items-center gap-2",
|
|
40
43
|
"data-testid": c.row,
|
|
41
44
|
children: [
|
|
42
|
-
/* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ e(k, { size: 20, token: t.token }),
|
|
43
46
|
/* @__PURE__ */ m("span", { className: "flex items-center", children: [
|
|
44
|
-
|
|
45
|
-
/* @__PURE__ */
|
|
47
|
+
i && /* @__PURE__ */ m(p, { children: [
|
|
48
|
+
/* @__PURE__ */ e("span", { className: "text-secondary-foreground line-through [&_*]:text-secondary-foreground [&_*]:line-through", children: /* @__PURE__ */ e(
|
|
46
49
|
d,
|
|
47
50
|
{
|
|
48
|
-
data:
|
|
49
|
-
token:
|
|
51
|
+
data: t.value,
|
|
52
|
+
token: t.token,
|
|
50
53
|
showSymbol: !1
|
|
51
54
|
}
|
|
52
55
|
) }),
|
|
53
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ e("span", { className: "px-1.5 text-gray-70", children: "→" })
|
|
54
57
|
] }),
|
|
55
|
-
/* @__PURE__ */
|
|
58
|
+
l ? /* @__PURE__ */ e("span", { children: f }) : null,
|
|
59
|
+
/* @__PURE__ */ e(
|
|
56
60
|
d,
|
|
57
61
|
{
|
|
58
|
-
data:
|
|
59
|
-
token:
|
|
62
|
+
data: i ? t.valueTo : t.value,
|
|
63
|
+
token: t.token,
|
|
60
64
|
showSymbol: !1
|
|
61
65
|
}
|
|
62
66
|
),
|
|
63
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ e(u, { className: "ml-1", maxLength: y, children: t.token.symbol })
|
|
64
68
|
] })
|
|
65
69
|
]
|
|
66
70
|
},
|
|
67
|
-
|
|
71
|
+
t.token.address
|
|
68
72
|
)) });
|
|
69
73
|
}
|
|
70
|
-
function
|
|
71
|
-
const a = /* @__PURE__ */ new Map(),
|
|
72
|
-
const
|
|
73
|
-
a.set(
|
|
74
|
-
token:
|
|
74
|
+
function S(s, r) {
|
|
75
|
+
const a = /* @__PURE__ */ new Map(), l = (o, n) => {
|
|
76
|
+
const i = o.token.address.toLowerCase(), t = a.get(i);
|
|
77
|
+
a.set(i, {
|
|
78
|
+
token: t?.token ?? o.token,
|
|
75
79
|
// a token only the other side holds is a zero here, not a gap
|
|
76
|
-
value:
|
|
77
|
-
valueTo:
|
|
78
|
-
worth: x(
|
|
80
|
+
value: n === "from" ? o.value : t?.value ?? 0n,
|
|
81
|
+
valueTo: n === "to" ? o.value : t?.valueTo ?? 0n,
|
|
82
|
+
worth: x(t?.worth, o.valueUsd)
|
|
79
83
|
});
|
|
80
84
|
};
|
|
81
|
-
for (const
|
|
82
|
-
for (const
|
|
83
|
-
return [...a.values()].filter((
|
|
84
|
-
(
|
|
85
|
-
|
|
85
|
+
for (const o of s ?? []) l(o, "from");
|
|
86
|
+
for (const o of r ?? []) l(o, "to");
|
|
87
|
+
return [...a.values()].filter((o) => o.worth === null || o.worth >= g).sort(
|
|
88
|
+
(o, n) => (n.worth ?? 0) - (o.worth ?? 0) || // a tie has to break the same way every render, or the rows drift
|
|
89
|
+
o.token.address.localeCompare(n.token.address)
|
|
86
90
|
);
|
|
87
91
|
}
|
|
88
|
-
function x(s,
|
|
89
|
-
return s === void 0 ?
|
|
92
|
+
function x(s, r) {
|
|
93
|
+
return s === void 0 ? r : s === null || r === null ? null : Math.max(s, r);
|
|
90
94
|
}
|
|
91
95
|
export {
|
|
92
|
-
|
|
96
|
+
I as PositionAssets,
|
|
93
97
|
c as PositionAssetsTest,
|
|
94
|
-
|
|
98
|
+
S as visibleAssets
|
|
95
99
|
};
|
|
@@ -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
|
};
|