@gearbox-protocol/ui-kit 4.0.0-next.20 → 4.0.0-next.22
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/position-assets/position-assets.cjs +1 -1
- package/dist/cjs/components/base/strategy-apy-breakdown-card/constants.cjs +1 -1
- 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/composites/pool-assets-table/pool-assets-table-row.cjs +1 -1
- package/dist/cjs/components/composites/pool-assets-table/pool-assets-table.cjs +1 -1
- package/dist/cjs/components/compound-apy/compound-apy.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/locale/en.json.cjs +1 -1
- package/dist/cjs/utils/index.cjs +1 -1
- package/dist/esm/components/base/position-assets/position-assets.js +62 -39
- package/dist/esm/components/base/strategy-apy-breakdown-card/constants.js +7 -3
- package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +140 -166
- package/dist/esm/components/base/values/scalars.js +40 -35
- package/dist/esm/components/composites/pool-assets-table/pool-assets-table-row.js +60 -61
- package/dist/esm/components/composites/pool-assets-table/pool-assets-table.js +22 -24
- package/dist/esm/components/compound-apy/compound-apy.js +24 -23
- package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +15 -15
- package/dist/esm/index.js +88 -91
- package/dist/esm/locale/en.json.js +3 -7
- package/dist/esm/utils/index.js +48 -51
- package/dist/globals.css +1 -1
- package/dist/types/components/base/position-assets/position-assets.d.ts +19 -13
- package/dist/types/components/base/strategy-apy-breakdown-card/constants.d.ts +5 -1
- package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts +39 -14
- package/dist/types/components/base/values/scalars.d.ts +17 -2
- package/dist/types/components/composites/pool-assets-table/pool-assets-table-row.d.ts +1 -2
- package/dist/types/components/composites/pool-assets-table/pool-assets-table.d.ts +1 -2
- package/dist/types/components/compound-apy/compound-apy.d.ts +11 -1
- package/dist/types/locale/en.json.d.ts +1 -6
- package/dist/types/utils/index.d.ts +0 -1
- package/package.json +1 -1
- package/dist/cjs/utils/strategy-apy.cjs +0 -1
- package/dist/esm/utils/strategy-apy.js +0 -51
- package/dist/types/utils/strategy-apy.d.ts +0 -40
|
@@ -1,82 +1,87 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { formatUnits as
|
|
1
|
+
import { jsx as r, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { formatUnits as u } from "viem";
|
|
3
3
|
import { CompoundAPY as p } from "../../compound-apy/compound-apy.js";
|
|
4
|
-
import { SimpleTooltip as
|
|
4
|
+
import { SimpleTooltip as a } from "../../tooltip/simple-tooltip.js";
|
|
5
5
|
import "../../tooltip/tooltip.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import "@gearbox-protocol/sdk";
|
|
8
|
-
import { cn as
|
|
8
|
+
import { cn as c } from "../../../utils/cn.js";
|
|
9
9
|
import "sonner";
|
|
10
|
-
import { formatAssetAmount as
|
|
11
|
-
import { formatLeverage as
|
|
12
|
-
import { formatPercentAmount as
|
|
10
|
+
import { formatAssetAmount as d } from "../../../utils/format-asset-amount.js";
|
|
11
|
+
import { formatLeverage as f } from "../../../utils/format-leverage.js";
|
|
12
|
+
import { formatPercentAmount as h, formatMoney as v } from "../../../utils/format-money.js";
|
|
13
13
|
import "@gearbox-protocol/sdk/common-utils";
|
|
14
14
|
import "luxon";
|
|
15
15
|
import "../../../utils/z-index.js";
|
|
16
|
-
import { ValueTest as
|
|
17
|
-
const
|
|
16
|
+
import { ValueTest as i } from "./constants.js";
|
|
17
|
+
const x = "—";
|
|
18
18
|
function n() {
|
|
19
|
-
return /* @__PURE__ */ r("span", { "data-testid":
|
|
19
|
+
return /* @__PURE__ */ r("span", { "data-testid": i.placeholder, children: x });
|
|
20
20
|
}
|
|
21
21
|
function l(t) {
|
|
22
|
-
return `${
|
|
23
|
-
}
|
|
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
|
+
return `${h(t / 100, 2)}%`;
|
|
26
23
|
}
|
|
27
24
|
function H({
|
|
28
|
-
data: t
|
|
25
|
+
data: t,
|
|
26
|
+
tooltip: e = !0
|
|
29
27
|
}) {
|
|
30
|
-
return t
|
|
28
|
+
return t === void 0 ? /* @__PURE__ */ r(n, {}) : typeof t == "number" ? /* @__PURE__ */ r("span", { "data-testid": i.apy, children: l(t) }) : /* @__PURE__ */ r("span", { "data-testid": i.apy, children: /* @__PURE__ */ r(p, { apy: t, tooltip: e }) });
|
|
31
29
|
}
|
|
32
30
|
function N({
|
|
33
31
|
data: t
|
|
34
32
|
}) {
|
|
35
|
-
return t
|
|
33
|
+
return t == null ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": i.usd, children: v(t) });
|
|
36
34
|
}
|
|
37
35
|
function w({
|
|
38
36
|
data: t
|
|
39
37
|
}) {
|
|
40
|
-
return t === void 0 ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid":
|
|
38
|
+
return t === void 0 ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": i.leverage, children: `${f(t)}x` });
|
|
41
39
|
}
|
|
42
40
|
function D({
|
|
43
41
|
data: t
|
|
42
|
+
}) {
|
|
43
|
+
return t === void 0 ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", { "data-testid": i.utilization, children: l(t) });
|
|
44
|
+
}
|
|
45
|
+
function M({
|
|
46
|
+
data: t
|
|
44
47
|
}) {
|
|
45
48
|
if (t === void 0)
|
|
46
49
|
return /* @__PURE__ */ r(n, {});
|
|
47
|
-
const
|
|
48
|
-
return /* @__PURE__ */ r("span", { "data-testid":
|
|
50
|
+
const e = t < 1e4 ? "text-destructive" : t < 11e3 ? "text-warning" : "text-success";
|
|
51
|
+
return /* @__PURE__ */ r("span", { "data-testid": i.healthFactor, className: c(e), children: (t / 1e4).toFixed(2) });
|
|
49
52
|
}
|
|
50
|
-
function
|
|
53
|
+
function O({
|
|
51
54
|
data: t,
|
|
52
|
-
token:
|
|
55
|
+
token: e,
|
|
56
|
+
showSymbol: s = !0
|
|
53
57
|
}) {
|
|
54
|
-
if (t === void 0 ||
|
|
58
|
+
if (t === void 0 || e === void 0)
|
|
55
59
|
return /* @__PURE__ */ r(n, {});
|
|
56
|
-
const o =
|
|
60
|
+
const o = u(t, e.decimals);
|
|
57
61
|
return (
|
|
58
62
|
// `title` also keeps the amount where a hover tooltip cannot reach:
|
|
59
|
-
// keyboard, touch, and the browser's own find
|
|
60
|
-
|
|
63
|
+
// keyboard, touch, and the browser's own find — and keeps the symbol
|
|
64
|
+
// reachable there even when the row is the one printing it
|
|
65
|
+
/* @__PURE__ */ m("span", { "data-testid": i.tokenBigint, title: `${o} ${e.symbol}`, children: [
|
|
61
66
|
/* @__PURE__ */ r(
|
|
62
|
-
|
|
67
|
+
a,
|
|
63
68
|
{
|
|
64
69
|
placement: "top",
|
|
65
70
|
className: "break-all",
|
|
66
|
-
title: /* @__PURE__ */ r("span", { children:
|
|
71
|
+
title: /* @__PURE__ */ r("span", { children: d(t, e.decimals) }),
|
|
67
72
|
children: /* @__PURE__ */ r("span", { children: o })
|
|
68
73
|
}
|
|
69
74
|
),
|
|
70
|
-
` ${
|
|
75
|
+
s && ` ${e.symbol}`
|
|
71
76
|
] })
|
|
72
77
|
);
|
|
73
78
|
}
|
|
74
79
|
export {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
H as ApyValue,
|
|
81
|
+
M as HealthFactorValue,
|
|
82
|
+
w as LeverageValue,
|
|
83
|
+
O as TokenBigint,
|
|
84
|
+
N as UsdValue,
|
|
85
|
+
D as UtilizationValue,
|
|
81
86
|
l as bps
|
|
82
87
|
};
|
|
@@ -1,148 +1,147 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as m, Fragment as N } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import "@gearbox-protocol/sdk";
|
|
4
4
|
import "clsx";
|
|
5
5
|
import "tailwind-merge";
|
|
6
6
|
import "sonner";
|
|
7
|
-
import { formatMoney as
|
|
7
|
+
import { formatMoney as y } from "../../../utils/format-money.js";
|
|
8
8
|
import "@gearbox-protocol/sdk/common-utils";
|
|
9
9
|
import "luxon";
|
|
10
10
|
import "../../../utils/z-index.js";
|
|
11
11
|
import "../../points-icon/points-icon.js";
|
|
12
|
-
import { UtilizationValue as
|
|
12
|
+
import { UtilizationValue as C } from "../../base/values/scalars.js";
|
|
13
13
|
import "../../badge/badge.js";
|
|
14
14
|
import "../../badge/chip.js";
|
|
15
|
-
import { FormattedMessageTyped as
|
|
16
|
-
import { AllocationWheel as
|
|
15
|
+
import { FormattedMessageTyped as a } from "../../typed-intl/index.js";
|
|
16
|
+
import { AllocationWheel as S } from "../../collateral-allocation-tooltip/allocation-wheel.js";
|
|
17
17
|
import "@fortawesome/free-solid-svg-icons";
|
|
18
18
|
import "../../icons/fa-icon.js";
|
|
19
19
|
import "../../token-icon/token-icon.js";
|
|
20
20
|
import "../../tooltip/simple-tooltip.js";
|
|
21
21
|
import "../../tooltip/tooltip.js";
|
|
22
|
-
import { NameCell as
|
|
23
|
-
import { ShortString as
|
|
22
|
+
import { NameCell as L } from "../../name-cell/name-cell.js";
|
|
23
|
+
import { ShortString as b } from "../../short-string/short-string.js";
|
|
24
24
|
import "react-intl";
|
|
25
25
|
import "../../buttons/button/button.js";
|
|
26
|
-
import { GridTableRow as
|
|
26
|
+
import { GridTableRow as U, GridTableCell as o } from "../../table/grid-table.js";
|
|
27
27
|
import "../../skeleton/skeleton.js";
|
|
28
28
|
import "../../table/table.js";
|
|
29
|
-
import { TableLineSm as
|
|
30
|
-
import { TokenSymbol as
|
|
31
|
-
import { TokenTemplate as
|
|
32
|
-
import { VerticalIndicator as
|
|
33
|
-
import { PoolAssetsTableTest as
|
|
34
|
-
function
|
|
29
|
+
import { TableLineSm as k, TableCellSm as n } from "../../table/table-sm.js";
|
|
30
|
+
import { TokenSymbol as w } from "../../token-symbol/token-symbol.js";
|
|
31
|
+
import { TokenTemplate as v } from "../../token-template/token-template.js";
|
|
32
|
+
import { VerticalIndicator as I } from "../../vertical-indicator/vertical-indicator.js";
|
|
33
|
+
import { PoolAssetsTableTest as p } from "./constants.js";
|
|
34
|
+
function P(i, t) {
|
|
35
35
|
if (t !== 0n)
|
|
36
36
|
return Number(i * 10000n / t);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function j(i, t) {
|
|
39
39
|
return t <= 0n || i <= 0n ? 0 : Number(i * 10000n / t) / 1e4;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
last: T,
|
|
41
|
+
function ue({
|
|
42
|
+
asset: i,
|
|
43
|
+
underlyingToken: t,
|
|
44
|
+
last: x,
|
|
46
45
|
isCompact: c,
|
|
47
|
-
totalUsed:
|
|
48
|
-
colorIndex:
|
|
46
|
+
totalUsed: T,
|
|
47
|
+
colorIndex: z
|
|
49
48
|
}) {
|
|
50
|
-
const { token:
|
|
51
|
-
|
|
49
|
+
const { token: r, limit: s, used: l } = i, A = c ? 40 : 21, d = j(l.value, T), u = () => /* @__PURE__ */ e(
|
|
50
|
+
L,
|
|
52
51
|
{
|
|
53
|
-
leading: /* @__PURE__ */ e(
|
|
54
|
-
title: /* @__PURE__ */ e(
|
|
55
|
-
subtitle: /* @__PURE__ */ e(
|
|
52
|
+
leading: /* @__PURE__ */ e(w, { size: 32, token: r }),
|
|
53
|
+
title: /* @__PURE__ */ e(b, { maxLength: A, children: r.symbol }),
|
|
54
|
+
subtitle: /* @__PURE__ */ e(b, { maxLength: 20, children: r.name })
|
|
56
55
|
}
|
|
57
|
-
),
|
|
56
|
+
), h = () => /* @__PURE__ */ m(
|
|
58
57
|
"div",
|
|
59
58
|
{
|
|
60
59
|
className: "flex items-center justify-end gap-2",
|
|
61
|
-
"data-testid":
|
|
60
|
+
"data-testid": p.exposureCell,
|
|
62
61
|
children: [
|
|
63
62
|
/* @__PURE__ */ e(
|
|
64
|
-
|
|
63
|
+
S,
|
|
65
64
|
{
|
|
66
|
-
share:
|
|
67
|
-
colorIndex:
|
|
68
|
-
idle:
|
|
65
|
+
share: d,
|
|
66
|
+
colorIndex: z,
|
|
67
|
+
idle: d === 0
|
|
69
68
|
}
|
|
70
69
|
),
|
|
71
70
|
/* @__PURE__ */ e(
|
|
72
|
-
|
|
71
|
+
I,
|
|
73
72
|
{
|
|
74
73
|
value: /* @__PURE__ */ e(
|
|
75
|
-
|
|
74
|
+
v,
|
|
76
75
|
{
|
|
77
76
|
decimalPartLength: 2,
|
|
78
77
|
precision: 2,
|
|
79
78
|
showSymbol: !1,
|
|
80
|
-
token:
|
|
79
|
+
token: t,
|
|
81
80
|
value: l.value
|
|
82
81
|
}
|
|
83
82
|
),
|
|
84
|
-
valueDescription: l.valueUsd === null ? "—" :
|
|
83
|
+
valueDescription: l.valueUsd === null ? "—" : y(l.valueUsd)
|
|
85
84
|
}
|
|
86
85
|
)
|
|
87
86
|
]
|
|
88
87
|
}
|
|
89
|
-
),
|
|
90
|
-
|
|
88
|
+
), f = () => /* @__PURE__ */ e("div", { "data-testid": p.capCell, children: s.value === 0n ? /* @__PURE__ */ e("span", { children: "—" }) : /* @__PURE__ */ e(
|
|
89
|
+
v,
|
|
91
90
|
{
|
|
92
91
|
decimalPartLength: 2,
|
|
93
92
|
precision: 2,
|
|
94
93
|
showSymbol: !1,
|
|
95
|
-
token:
|
|
96
|
-
value:
|
|
94
|
+
token: t,
|
|
95
|
+
value: s.value
|
|
97
96
|
}
|
|
98
|
-
) }),
|
|
97
|
+
) }), g = () => /* @__PURE__ */ e("div", { "data-testid": p.capUtilizationCell, children: /* @__PURE__ */ e(C, { data: P(l.value, s.value) }) });
|
|
99
98
|
return /* @__PURE__ */ e(
|
|
100
|
-
|
|
99
|
+
U,
|
|
101
100
|
{
|
|
102
|
-
last:
|
|
101
|
+
last: x,
|
|
103
102
|
height: "auto",
|
|
104
103
|
className: "cursor-default",
|
|
105
104
|
style: { minHeight: "75px" },
|
|
106
|
-
children: c ? /* @__PURE__ */ e(o, { className: "px-3 py-0!", size: "sm", span: "full", children: /* @__PURE__ */
|
|
107
|
-
|
|
105
|
+
children: c ? /* @__PURE__ */ e(o, { className: "px-3 py-0!", size: "sm", span: "full", children: /* @__PURE__ */ m(
|
|
106
|
+
k,
|
|
108
107
|
{
|
|
109
108
|
className: "w-full",
|
|
110
109
|
columns: 3,
|
|
111
110
|
columnsXs: 3,
|
|
112
|
-
title:
|
|
111
|
+
title: u(),
|
|
113
112
|
children: [
|
|
114
113
|
/* @__PURE__ */ e(
|
|
115
|
-
|
|
114
|
+
n,
|
|
116
115
|
{
|
|
117
|
-
title: /* @__PURE__ */ e(
|
|
118
|
-
children:
|
|
116
|
+
title: /* @__PURE__ */ e(a, { messageId: "components.poolAssetsTable.exposure" }),
|
|
117
|
+
children: h()
|
|
119
118
|
}
|
|
120
119
|
),
|
|
121
120
|
/* @__PURE__ */ e(
|
|
122
|
-
|
|
121
|
+
n,
|
|
123
122
|
{
|
|
124
|
-
title: /* @__PURE__ */ e(
|
|
125
|
-
children:
|
|
123
|
+
title: /* @__PURE__ */ e(a, { messageId: "components.poolAssetsTable.cap" }),
|
|
124
|
+
children: f()
|
|
126
125
|
}
|
|
127
126
|
),
|
|
128
127
|
/* @__PURE__ */ e(
|
|
129
|
-
|
|
128
|
+
n,
|
|
130
129
|
{
|
|
131
|
-
title: /* @__PURE__ */ e(
|
|
132
|
-
children:
|
|
130
|
+
title: /* @__PURE__ */ e(a, { messageId: "components.poolAssetsTable.capUtilization" }),
|
|
131
|
+
children: g()
|
|
133
132
|
}
|
|
134
133
|
)
|
|
135
134
|
]
|
|
136
135
|
}
|
|
137
|
-
) }) : /* @__PURE__ */
|
|
138
|
-
/* @__PURE__ */ e(o, { className: "pl-4", size: "sm", textAlign: "left", children:
|
|
136
|
+
) }) : /* @__PURE__ */ m(N, { children: [
|
|
137
|
+
/* @__PURE__ */ e(o, { className: "pl-4", size: "sm", textAlign: "left", children: u() }),
|
|
138
|
+
/* @__PURE__ */ e(o, { size: "sm", textAlign: "right", children: h() }),
|
|
139
139
|
/* @__PURE__ */ e(o, { size: "sm", textAlign: "right", children: f() }),
|
|
140
|
-
/* @__PURE__ */ e(o, { size: "sm", textAlign: "right", children: g() })
|
|
141
|
-
/* @__PURE__ */ e(o, { className: "pr-4", size: "sm", textAlign: "right", children: v() })
|
|
140
|
+
/* @__PURE__ */ e(o, { className: "pr-4", size: "sm", textAlign: "right", children: g() })
|
|
142
141
|
] })
|
|
143
142
|
}
|
|
144
143
|
);
|
|
145
144
|
}
|
|
146
145
|
export {
|
|
147
|
-
|
|
146
|
+
ue as PoolAssetsTableRow
|
|
148
147
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { Card as
|
|
1
|
+
import { jsx as o, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { Card as c } from "../../cards/card/card.js";
|
|
3
3
|
import "clsx";
|
|
4
4
|
import "tailwind-merge";
|
|
5
5
|
import "react";
|
|
@@ -12,41 +12,39 @@ import "luxon";
|
|
|
12
12
|
import "../../../utils/z-index.js";
|
|
13
13
|
import "react-intl";
|
|
14
14
|
import "../../buttons/button/button.js";
|
|
15
|
-
import { GridTable as
|
|
15
|
+
import { GridTable as f, GridTableHeader as b, GridTableBody as T } from "../../table/grid-table.js";
|
|
16
16
|
import "../../skeleton/skeleton.js";
|
|
17
17
|
import "../../table/table.js";
|
|
18
|
-
import { useIsMobile as
|
|
19
|
-
import { useObservedWidthKey as
|
|
20
|
-
import { PoolAssetsTableTest as
|
|
21
|
-
import { PoolAssetsTableHead as
|
|
22
|
-
import { PoolAssetsTableRow as
|
|
23
|
-
const
|
|
24
|
-
function
|
|
18
|
+
import { useIsMobile as h } from "../../../hooks/use-media-query.js";
|
|
19
|
+
import { useObservedWidthKey as u } from "../../../hooks/use-observed-width-key.js";
|
|
20
|
+
import { PoolAssetsTableTest as x } from "./constants.js";
|
|
21
|
+
import { PoolAssetsTableHead as v } from "./pool-assets-table-head.js";
|
|
22
|
+
import { PoolAssetsTableRow as w } from "./pool-assets-table-row.js";
|
|
23
|
+
const A = 680;
|
|
24
|
+
function U({
|
|
25
25
|
list: t,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
underlyingToken: l
|
|
26
|
+
sort: s,
|
|
27
|
+
underlyingToken: p
|
|
29
28
|
}) {
|
|
30
|
-
const
|
|
31
|
-
return /* @__PURE__ */ o(
|
|
32
|
-
|
|
29
|
+
const l = h(), { ref: a, widthKey: m } = u(), i = m > 0 ? m < A : l, d = t.reduce((r, e) => r + e.used.value, 0n);
|
|
30
|
+
return /* @__PURE__ */ o(c, { ref: a, className: "overflow-hidden rounded-lg p-2", children: /* @__PURE__ */ n(
|
|
31
|
+
f,
|
|
33
32
|
{
|
|
34
33
|
cols: i ? "1fr" : "1fr max-content max-content minmax(0,1fr)",
|
|
35
|
-
"data-testid":
|
|
34
|
+
"data-testid": x.root,
|
|
36
35
|
gap: 0,
|
|
37
36
|
size: "lg",
|
|
38
37
|
wrapperClassName: "overflow-visible",
|
|
39
38
|
children: [
|
|
40
|
-
!i && /* @__PURE__ */ o(
|
|
41
|
-
/* @__PURE__ */ o(
|
|
42
|
-
|
|
39
|
+
!i && /* @__PURE__ */ o(b, { children: /* @__PURE__ */ o(v, { sort: s }) }),
|
|
40
|
+
/* @__PURE__ */ o(T, { children: t.map((r, e) => /* @__PURE__ */ o(
|
|
41
|
+
w,
|
|
43
42
|
{
|
|
44
43
|
asset: r,
|
|
45
|
-
|
|
46
|
-
underlyingToken: l,
|
|
44
|
+
underlyingToken: p,
|
|
47
45
|
last: e === t.length - 1,
|
|
48
46
|
isCompact: i,
|
|
49
|
-
totalUsed:
|
|
47
|
+
totalUsed: d,
|
|
50
48
|
colorIndex: e
|
|
51
49
|
},
|
|
52
50
|
r.token.address
|
|
@@ -56,5 +54,5 @@ function q({
|
|
|
56
54
|
) });
|
|
57
55
|
}
|
|
58
56
|
export {
|
|
59
|
-
|
|
57
|
+
U as PoolAssetsTable
|
|
60
58
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useId as
|
|
3
|
-
import { YieldBreakdownTooltip as
|
|
4
|
-
import { totalApyOf as
|
|
1
|
+
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import { useId as w } from "react";
|
|
3
|
+
import { YieldBreakdownTooltip as x } from "../yield-breakdown-tooltip/yield-breakdown-tooltip.js";
|
|
4
|
+
import { totalApyOf as v, positiveTokenRewardsOf as C, pointProgramsOf as I } from "../../utils/apy-breakdown.js";
|
|
5
5
|
import "@gearbox-protocol/sdk";
|
|
6
|
-
import { bpsToPercent as
|
|
7
|
-
import { cn as
|
|
6
|
+
import { bpsToPercent as k } from "../../utils/bps.js";
|
|
7
|
+
import { cn as P } from "../../utils/cn.js";
|
|
8
8
|
import "sonner";
|
|
9
|
-
import { formatCompactPercent as
|
|
9
|
+
import { formatCompactPercent as A } from "../../utils/format-money.js";
|
|
10
10
|
import "@gearbox-protocol/sdk/common-utils";
|
|
11
11
|
import "luxon";
|
|
12
12
|
import "../../utils/z-index.js";
|
|
13
13
|
const l = 14;
|
|
14
|
-
function
|
|
15
|
-
const t = `additional-incentives-${
|
|
16
|
-
return /* @__PURE__ */
|
|
14
|
+
function O() {
|
|
15
|
+
const t = `additional-incentives-${w().replace(/:/g, "")}`;
|
|
16
|
+
return /* @__PURE__ */ r(
|
|
17
17
|
"svg",
|
|
18
18
|
{
|
|
19
19
|
width: l,
|
|
@@ -42,7 +42,7 @@ function A() {
|
|
|
42
42
|
strokeLinecap: "round"
|
|
43
43
|
}
|
|
44
44
|
),
|
|
45
|
-
/* @__PURE__ */ e("defs", { children: /* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ e("defs", { children: /* @__PURE__ */ r(
|
|
46
46
|
"linearGradient",
|
|
47
47
|
{
|
|
48
48
|
id: t,
|
|
@@ -62,32 +62,33 @@ function A() {
|
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
64
|
function c(t) {
|
|
65
|
-
return t == null ? !1 :
|
|
65
|
+
return t == null ? !1 : C(t).length > 0 || I(t).length > 0;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function U({
|
|
68
68
|
apy: t,
|
|
69
69
|
maxLeverage: p,
|
|
70
|
-
collateralApy:
|
|
70
|
+
collateralApy: n,
|
|
71
71
|
borrowApy: d,
|
|
72
72
|
quotaRate: a,
|
|
73
73
|
decimals: m = 2,
|
|
74
|
+
tooltip: f = !0,
|
|
74
75
|
className: o
|
|
75
76
|
}) {
|
|
76
77
|
if (!t)
|
|
77
78
|
return /* @__PURE__ */ e("span", { className: "text-secondary-foreground", children: "—" });
|
|
78
|
-
const i =
|
|
79
|
-
const
|
|
80
|
-
return /* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */ e("span", { className: "inline-flex items-center", children:
|
|
82
|
-
|
|
79
|
+
const i = v(t), h = c(t) || c(n), u = f && i >= 1, s = () => {
|
|
80
|
+
const g = A(k(i), m);
|
|
81
|
+
return /* @__PURE__ */ r("div", { className: P("inline-flex items-center gap-1.5", o), children: [
|
|
82
|
+
/* @__PURE__ */ e("span", { className: "inline-flex items-center", children: g }),
|
|
83
|
+
h ? /* @__PURE__ */ e(O, {}) : null
|
|
83
84
|
] });
|
|
84
85
|
};
|
|
85
|
-
return
|
|
86
|
-
|
|
86
|
+
return u ? /* @__PURE__ */ e(
|
|
87
|
+
x,
|
|
87
88
|
{
|
|
88
89
|
supplyApy: t,
|
|
89
90
|
maxLeverage: p,
|
|
90
|
-
collateralApy:
|
|
91
|
+
collateralApy: n,
|
|
91
92
|
borrowApy: d,
|
|
92
93
|
quotaRate: a,
|
|
93
94
|
className: o,
|
|
@@ -96,5 +97,5 @@ function E({
|
|
|
96
97
|
) : s();
|
|
97
98
|
}
|
|
98
99
|
export {
|
|
99
|
-
|
|
100
|
+
U as CompoundAPY
|
|
100
101
|
};
|
|
@@ -8,7 +8,7 @@ import "react";
|
|
|
8
8
|
import { tokenRewardsOf as I, pointProgramsOf as B, totalApyOf as T } from "../../utils/apy-breakdown.js";
|
|
9
9
|
import "@gearbox-protocol/sdk";
|
|
10
10
|
import { bpsToPercent as $ } from "../../utils/bps.js";
|
|
11
|
-
import { cn as
|
|
11
|
+
import { cn as c } from "../../utils/cn.js";
|
|
12
12
|
import "sonner";
|
|
13
13
|
import { formatLeverage as j } from "../../utils/format-leverage.js";
|
|
14
14
|
import { formatCompactPercent as S } from "../../utils/format-money.js";
|
|
@@ -23,15 +23,15 @@ function V({
|
|
|
23
23
|
supplyApy: n,
|
|
24
24
|
maxLeverage: o,
|
|
25
25
|
collateralApy: r,
|
|
26
|
-
borrowApy:
|
|
27
|
-
quotaRate:
|
|
26
|
+
borrowApy: u,
|
|
27
|
+
quotaRate: f,
|
|
28
28
|
children: h,
|
|
29
|
-
className:
|
|
29
|
+
className: g
|
|
30
30
|
}) {
|
|
31
|
-
const
|
|
31
|
+
const d = o !== void 0 && o > 0, l = d ? r : r ?? n, w = l ? I(l) : [], y = B(n), b = T(n), p = u != null || f != null ? -((u ?? 0) + (f ?? 0)) : void 0, x = y.filter((t) => t.multiplier != null), v = /* @__PURE__ */ a(
|
|
32
32
|
"div",
|
|
33
33
|
{
|
|
34
|
-
className:
|
|
34
|
+
className: c(
|
|
35
35
|
"flex w-[400px] max-w-[calc(100vw-32px)] flex-col gap-4 p-4",
|
|
36
36
|
"rounded-xl",
|
|
37
37
|
"bg-card text-card-foreground",
|
|
@@ -41,7 +41,7 @@ function V({
|
|
|
41
41
|
),
|
|
42
42
|
children: [
|
|
43
43
|
/* @__PURE__ */ a("div", { className: "flex h-6 items-center justify-between gap-3", children: [
|
|
44
|
-
/* @__PURE__ */ e("span", { className: "text-base font-semibold leading-4 text-foreground", children:
|
|
44
|
+
/* @__PURE__ */ e("span", { className: "text-base font-semibold leading-4 text-foreground", children: d ? /* @__PURE__ */ e(
|
|
45
45
|
s,
|
|
46
46
|
{
|
|
47
47
|
messageId: "components.yieldBreakdown.titleNetAtLeverage",
|
|
@@ -53,7 +53,7 @@ function V({
|
|
|
53
53
|
/* @__PURE__ */ e(
|
|
54
54
|
"span",
|
|
55
55
|
{
|
|
56
|
-
className:
|
|
56
|
+
className: c(
|
|
57
57
|
"rounded-md px-2 py-0.5 text-sm font-semibold tabular-nums",
|
|
58
58
|
b > 0 ? "bg-success/20 text-success" : "bg-muted text-muted-foreground"
|
|
59
59
|
),
|
|
@@ -61,7 +61,7 @@ function V({
|
|
|
61
61
|
}
|
|
62
62
|
)
|
|
63
63
|
] }),
|
|
64
|
-
l
|
|
64
|
+
l?.organicApy != null && /* @__PURE__ */ e(
|
|
65
65
|
m,
|
|
66
66
|
{
|
|
67
67
|
muted: l.organicApy < 0,
|
|
@@ -87,12 +87,12 @@ function V({
|
|
|
87
87
|
},
|
|
88
88
|
`incentive-${t.token.address}-${t.supplyApr}`
|
|
89
89
|
)),
|
|
90
|
-
|
|
90
|
+
d && p != null && /* @__PURE__ */ e(
|
|
91
91
|
m,
|
|
92
92
|
{
|
|
93
|
-
muted:
|
|
93
|
+
muted: p < 0,
|
|
94
94
|
label: /* @__PURE__ */ e(s, { messageId: "components.yieldBreakdown.borrowRate" }),
|
|
95
|
-
value: i(
|
|
95
|
+
value: i(p)
|
|
96
96
|
}
|
|
97
97
|
),
|
|
98
98
|
x.length > 0 && /* @__PURE__ */ a(k, { children: [
|
|
@@ -135,8 +135,8 @@ function V({
|
|
|
135
135
|
type: "modal-tooltip",
|
|
136
136
|
minWidth: "100%",
|
|
137
137
|
maxWidth: "100%",
|
|
138
|
-
title: /* @__PURE__ */ e("span", { className:
|
|
139
|
-
triggerClassName:
|
|
138
|
+
title: /* @__PURE__ */ e("span", { className: g, children: h }),
|
|
139
|
+
triggerClassName: g,
|
|
140
140
|
children: v
|
|
141
141
|
}
|
|
142
142
|
);
|
|
@@ -151,7 +151,7 @@ function m({
|
|
|
151
151
|
/* @__PURE__ */ e(
|
|
152
152
|
"span",
|
|
153
153
|
{
|
|
154
|
-
className:
|
|
154
|
+
className: c(
|
|
155
155
|
"shrink-0 font-semibold tabular-nums",
|
|
156
156
|
r ? "text-muted-foreground" : "text-foreground"
|
|
157
157
|
),
|