@gearbox-protocol/ui-kit 3.14.0-next.65 → 3.14.0-next.67
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/assets-list-cell/assets-list-cell.cjs +1 -1
- package/dist/cjs/components/block-sync/block-sync.cjs +1 -1
- package/dist/cjs/components/block-sync-pill/block-sync-pill.cjs +1 -1
- package/dist/cjs/components/breakpoint-provider.cjs +1 -0
- 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/complex-input/complex-input.cjs +1 -1
- package/dist/cjs/components/composites/index.cjs +1 -1
- package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-head.cjs +1 -1
- package/dist/cjs/components/composites/pool-credit-managers-table/pool-credit-managers-table-head.cjs +1 -1
- package/dist/cjs/components/composites/pool-table/columns.cjs +1 -1
- package/dist/cjs/components/composites/strategies-table/columns.cjs +1 -1
- package/dist/cjs/components/composites/strategies-table/components/cells/cells.cjs +1 -1
- package/dist/cjs/components/composites/strategies-table/components/cells/index.cjs +1 -1
- package/dist/cjs/components/composites/strategies-table/components/index.cjs +1 -1
- package/dist/cjs/components/composites/strategies-table/components/points-feature/points-feature.cjs +1 -1
- package/dist/cjs/components/composites/strategies-table/components/rewards-tooltip/tooltip-content.cjs +1 -1
- package/dist/cjs/components/composites/strategies-table/components/strategies-table.cjs +1 -1
- package/dist/cjs/components/composites/strategies-table/index.cjs +1 -1
- package/dist/cjs/components/composites/strategies-table/types/index.cjs +1 -1
- package/dist/cjs/components/composites/strategies-table/types/rewards-cell.cjs +1 -0
- package/dist/cjs/components/composites/tx-preview/confirm/amounts/TransactionConfirmAmountField.cjs +1 -1
- package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.cjs +1 -1
- package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.cjs +1 -1
- package/dist/cjs/components/composites/tx-preview/confirm/result/TransactionConfirmFailureResult.cjs +1 -1
- package/dist/cjs/components/composites/tx-preview/confirm/result/TransactionConfirmSuccessResult.cjs +1 -1
- package/dist/cjs/components/compound-apy/compound-apy-legacy.cjs +1 -0
- package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
- package/dist/cjs/components/compound-apy/index.cjs +1 -1
- package/dist/cjs/components/detailed-page-title/detailed-page-title.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/markdown-viewer/markdown-viewer.cjs +1 -1
- package/dist/cjs/components/pool-apy-tooltip/apy-tooltip.cjs +1 -0
- package/dist/cjs/components/pool-apy-tooltip/index.cjs +1 -1
- package/dist/cjs/components/pool-apy-tooltip/pool-apy-tooltip.cjs +1 -1
- package/dist/cjs/components/time-to-liquidation/time-to-liquidation.cjs +1 -1
- package/dist/cjs/components/token-icon/token-icon.cjs +1 -1
- package/dist/cjs/components/token-symbol/index.cjs +1 -1
- package/dist/cjs/components/token-symbol/token-symbol.cjs +1 -1
- package/dist/cjs/components/tokens-list-cell/tokens-list-cell.cjs +1 -1
- package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
- package/dist/cjs/components/yield-breakdown-tooltip/index.cjs +1 -0
- package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -0
- package/dist/cjs/hooks/use-debounce-call.cjs +1 -1
- package/dist/cjs/hooks/use-media-query.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/locale/en.json.cjs +1 -1
- package/dist/cjs/types/common.cjs +1 -1
- package/dist/cjs/utils/apy-breakdown.cjs +1 -0
- package/dist/cjs/utils/bps.cjs +1 -0
- package/dist/cjs/utils/index.cjs +1 -1
- package/dist/cjs/utils/token-icon-source.cjs +1 -0
- package/dist/esm/components/assets-list-cell/assets-list-cell.js +132 -206
- package/dist/esm/components/block-sync/block-sync.js +5 -4
- package/dist/esm/components/block-sync-pill/block-sync-pill.js +5 -4
- package/dist/esm/components/breakpoint-provider.js +67 -0
- package/dist/esm/components/checkbox/checkbox-labeled.js +3 -2
- package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +3 -2
- package/dist/esm/components/complex-input/complex-input.js +5 -4
- package/dist/esm/components/composites/index.js +86 -81
- package/dist/esm/components/composites/pool-assets-table/pool-assets-table-head.js +3 -2
- package/dist/esm/components/composites/pool-credit-managers-table/pool-credit-managers-table-head.js +3 -2
- package/dist/esm/components/composites/pool-table/columns.js +61 -60
- package/dist/esm/components/composites/strategies-table/columns.js +55 -86
- package/dist/esm/components/composites/strategies-table/components/cells/cells.js +150 -110
- package/dist/esm/components/composites/strategies-table/components/cells/index.js +7 -5
- package/dist/esm/components/composites/strategies-table/components/index.js +32 -30
- package/dist/esm/components/composites/strategies-table/components/points-feature/points-feature.js +35 -32
- package/dist/esm/components/composites/strategies-table/components/rewards-tooltip/tooltip-content.js +91 -224
- package/dist/esm/components/composites/strategies-table/components/strategies-table.js +26 -24
- package/dist/esm/components/composites/strategies-table/index.js +36 -31
- package/dist/esm/components/composites/strategies-table/types/index.js +5 -1
- package/dist/esm/components/composites/strategies-table/types/rewards-cell.js +40 -0
- package/dist/esm/components/composites/tx-preview/confirm/amounts/TransactionConfirmAmountField.js +32 -189
- package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.js +5 -4
- package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.js +26 -26
- package/dist/esm/components/composites/tx-preview/confirm/result/TransactionConfirmFailureResult.js +40 -38
- package/dist/esm/components/composites/tx-preview/confirm/result/TransactionConfirmSuccessResult.js +53 -47
- package/dist/esm/components/compound-apy/compound-apy-legacy.js +127 -0
- package/dist/esm/components/compound-apy/compound-apy.js +56 -245
- package/dist/esm/components/compound-apy/index.js +4 -2
- package/dist/esm/components/detailed-page-title/detailed-page-title.js +25 -180
- package/dist/esm/components/index.js +805 -787
- package/dist/esm/components/markdown-viewer/markdown-viewer.js +5 -4
- package/dist/esm/components/pool-apy-tooltip/apy-tooltip.js +155 -0
- package/dist/esm/components/pool-apy-tooltip/index.js +4 -2
- package/dist/esm/components/pool-apy-tooltip/pool-apy-tooltip.js +3 -3
- package/dist/esm/components/time-to-liquidation/time-to-liquidation.js +3 -2
- package/dist/esm/components/token-icon/token-icon.js +72 -58
- package/dist/esm/components/token-symbol/index.js +2 -3
- package/dist/esm/components/token-symbol/token-symbol.js +41 -62
- package/dist/esm/components/tokens-list-cell/tokens-list-cell.js +35 -192
- package/dist/esm/components/with-copy/with-copy.js +5 -4
- package/dist/esm/components/yield-breakdown-tooltip/index.js +4 -0
- package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +222 -0
- package/dist/esm/hooks/use-debounce-call.js +3 -2
- package/dist/esm/hooks/use-media-query.js +49 -16
- package/dist/esm/index.js +974 -946
- package/dist/esm/locale/en.json.js +9 -2
- package/dist/esm/types/common.js +1 -6
- package/dist/esm/utils/apy-breakdown.js +18 -0
- package/dist/esm/utils/bps.js +4 -0
- package/dist/esm/utils/index.js +105 -95
- package/dist/esm/utils/token-icon-source.js +48 -0
- package/dist/globals.css +1 -1
- package/dist/types/components/assets-list-cell/assets-list-cell.d.ts +44 -4
- package/dist/types/components/breakpoint-provider.d.ts +56 -0
- package/dist/types/components/composites/pool-table/pool-table-backend-contract.types.d.ts +1 -1
- package/dist/types/components/composites/strategies-table/components/cells/cells.d.ts +34 -3
- package/dist/types/components/composites/strategies-table/components/points-feature/points-feature.d.ts +14 -10
- package/dist/types/components/composites/strategies-table/components/rewards-tooltip/tooltip-content.d.ts +10 -13
- package/dist/types/components/composites/strategies-table/index.d.ts +1 -1
- package/dist/types/components/composites/strategies-table/types/index.d.ts +1 -0
- package/dist/types/components/composites/strategies-table/types/rewards-cell.d.ts +48 -0
- package/dist/types/components/composites/strategies-table/types/rewards-tooltip.d.ts +37 -32
- package/dist/types/components/composites/strategies-table/types/table.d.ts +27 -12
- package/dist/types/components/composites/tx-preview/confirm/amounts/TransactionConfirmAmountField.d.ts +3 -3
- package/dist/types/components/composites/tx-preview/confirm/result/TransactionConfirmFailureResult.d.ts +4 -0
- package/dist/types/components/composites/tx-preview/confirm/result/TransactionConfirmSuccessResult.d.ts +5 -0
- package/dist/types/components/compound-apy/compound-apy-legacy.d.ts +109 -0
- package/dist/types/components/compound-apy/compound-apy.d.ts +18 -94
- package/dist/types/components/compound-apy/index.d.ts +1 -0
- package/dist/types/components/index.d.ts +3 -1
- package/dist/types/components/points-icon/index.d.ts +1 -1
- package/dist/types/components/points-icon/points-icon.d.ts +13 -2
- package/dist/types/components/pool-apy-tooltip/apy-tooltip.d.ts +20 -0
- package/dist/types/components/pool-apy-tooltip/index.d.ts +1 -0
- package/dist/types/components/pool-apy-tooltip/pool-apy-tooltip.d.ts +18 -1
- package/dist/types/components/token-icon/token-icon.d.ts +11 -2
- package/dist/types/components/token-symbol/token-symbol.d.ts +4 -4
- package/dist/types/components/yield-breakdown-tooltip/index.d.ts +1 -0
- package/dist/types/components/yield-breakdown-tooltip/yield-breakdown-tooltip.d.ts +32 -0
- package/dist/types/hooks/use-media-query.d.ts +5 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/locale/en.json.d.ts +10 -2
- package/dist/types/types/common.d.ts +5 -11
- package/dist/types/utils/apy-breakdown.d.ts +18 -0
- package/dist/types/utils/bps.d.ts +3 -0
- package/dist/types/utils/index.d.ts +3 -0
- package/dist/types/utils/token-icon-source.d.ts +28 -0
- package/package.json +2 -2
|
@@ -1,110 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { LocaleKeys } from '../../locale';
|
|
3
|
-
import { TokenMetaInfo } from '../../types/common';
|
|
4
|
-
/**
|
|
5
|
-
* For GEAR token, use the logo symbol instead of the standard token icon.
|
|
6
|
-
* The standard gear.svg has a white background circle that looks bad on dark themes.
|
|
7
|
-
*/
|
|
8
|
-
export declare function getRewardTokenSymbol(token: TokenMetaInfo | undefined, rewardTokenSymbol: string | undefined): import('../token-icon').SymbolOrIcon | undefined;
|
|
9
|
-
export interface PoolBaseAPY {
|
|
10
|
-
type: "supplyAPY" | "tokenYield";
|
|
11
|
-
apy: number;
|
|
12
|
-
}
|
|
13
|
-
export interface ExtraRewardApy {
|
|
14
|
-
apy: number;
|
|
15
|
-
rewardToken: string;
|
|
16
|
-
rewardTokenSymbol: string;
|
|
17
|
-
}
|
|
18
|
-
export interface ExternalAPYData {
|
|
19
|
-
/**
|
|
20
|
-
* The total value including external APY
|
|
21
|
-
*/
|
|
22
|
-
totalValue: number;
|
|
23
|
-
/**
|
|
24
|
-
* The external APY value
|
|
25
|
-
*/
|
|
26
|
-
value?: number;
|
|
27
|
-
/**
|
|
28
|
-
* The external APY value (backward compatibility alias for value)
|
|
29
|
-
* @deprecated Use value instead
|
|
30
|
-
*/
|
|
31
|
-
apy?: number;
|
|
32
|
-
/**
|
|
33
|
-
* Name/label of the external APY source
|
|
34
|
-
*/
|
|
35
|
-
name: string;
|
|
36
|
-
/**
|
|
37
|
-
* Localization key for the external APY tooltip
|
|
38
|
-
* Will be rendered with FormattedMessageTyped with values: { name, value }
|
|
39
|
-
*/
|
|
40
|
-
tooltip?: LocaleKeys;
|
|
41
|
-
}
|
|
1
|
+
import { ApyBreakdown, Bps, Leverage } from '@gearbox-protocol/sdk/model';
|
|
42
2
|
export interface CompoundAPYProps {
|
|
43
3
|
/**
|
|
44
|
-
*
|
|
45
|
-
|
|
46
|
-
totalAPY: number;
|
|
47
|
-
/**
|
|
48
|
-
* Whether the total APY is loading (backward compatibility)
|
|
49
|
-
*/
|
|
50
|
-
totalAPYLoading?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Base APY array with different types
|
|
53
|
-
*/
|
|
54
|
-
baseAPY: Array<PoolBaseAPY>;
|
|
55
|
-
/**
|
|
56
|
-
* Extra/rewards APY array
|
|
4
|
+
* SDK `ApyBreakdown`. When undefined, renders an em-dash placeholder.
|
|
5
|
+
* Display-only: values are final; the component does not look up rates.
|
|
57
6
|
*/
|
|
58
|
-
|
|
7
|
+
apy: ApyBreakdown | undefined;
|
|
59
8
|
/**
|
|
60
|
-
*
|
|
9
|
+
* Strategy-only plain leverage multiplier (e.g. `13.6` for 13.6x).
|
|
10
|
+
* Forwarded to {@link YieldBreakdownTooltip}.
|
|
61
11
|
*/
|
|
62
|
-
|
|
12
|
+
maxLeverage?: Leverage;
|
|
63
13
|
/**
|
|
64
|
-
*
|
|
14
|
+
* Strategy collateral yield for Base / Incentive rows in the tooltip.
|
|
65
15
|
*/
|
|
66
|
-
|
|
16
|
+
collateralApy?: ApyBreakdown;
|
|
17
|
+
/** Strategy base borrow cost in bps. */
|
|
18
|
+
borrowApy?: Bps;
|
|
19
|
+
/** Strategy additional (quota) borrow cost in bps. */
|
|
20
|
+
additionalBorrowApy?: Bps;
|
|
67
21
|
/**
|
|
68
|
-
*
|
|
69
|
-
*/
|
|
70
|
-
apy7DAgo?: {
|
|
71
|
-
baseAPY?: Array<PoolBaseAPY>;
|
|
72
|
-
totalAPY?: number;
|
|
73
|
-
totalAPYLoading?: boolean;
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Token list for displaying token symbols in tooltips
|
|
77
|
-
*/
|
|
78
|
-
tokensList?: Record<string, TokenMetaInfo>;
|
|
79
|
-
/**
|
|
80
|
-
* Number of decimal places
|
|
22
|
+
* Number of decimal places for the total APY string.
|
|
81
23
|
* @default 2
|
|
82
24
|
*/
|
|
83
25
|
decimals?: number;
|
|
84
|
-
/**
|
|
85
|
-
* Custom className
|
|
86
|
-
*/
|
|
87
26
|
className?: string;
|
|
88
27
|
}
|
|
89
28
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* Renders an APY string with an info icon, cascading reward token icons, and points icons.
|
|
93
|
-
* When APY >= 0.001 and not loading, wraps content in PoolAPYTooltip for detailed breakdown.
|
|
29
|
+
* Compound APY display fed by an SDK `ApyBreakdown`.
|
|
94
30
|
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* <CompoundAPY
|
|
98
|
-
* totalAPY={15}
|
|
99
|
-
* baseAPY={[{ type: "supplyAPY", apy: 10 }]}
|
|
100
|
-
* extraAPY={[{ apy: 3, rewardToken: "0x...", rewardTokenSymbol: "GEAR" }]}
|
|
101
|
-
* externalAPY={{
|
|
102
|
-
* totalValue: 15,
|
|
103
|
-
* value: 2,
|
|
104
|
-
* name: "Curve",
|
|
105
|
-
* tooltip: "External APY from Curve"
|
|
106
|
-
* }}
|
|
107
|
-
* />
|
|
108
|
-
* ```
|
|
31
|
+
* No `tokensList`, no external APY, no 7D history, no "soon" points state.
|
|
32
|
+
* For the legacy percent-based API see {@link CompoundAPYLegacy}.
|
|
109
33
|
*/
|
|
110
|
-
export declare function CompoundAPY({
|
|
34
|
+
export declare function CompoundAPY({ apy, maxLeverage, collateralApy, borrowApy, additionalBorrowApy, decimals, className, }: CompoundAPYProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -15,6 +15,7 @@ export * from './base-link';
|
|
|
15
15
|
export * from './block-sync';
|
|
16
16
|
export * from './block-sync-pill';
|
|
17
17
|
export * from './breadcrumbs';
|
|
18
|
+
export * from './breakpoint-provider';
|
|
18
19
|
export * from './button-checkbox';
|
|
19
20
|
export * from './buttons';
|
|
20
21
|
export * from './card-grid';
|
|
@@ -26,7 +27,7 @@ export * from './client-adapters';
|
|
|
26
27
|
export * from './colored-text';
|
|
27
28
|
export * from './complex-input';
|
|
28
29
|
export * from './composites';
|
|
29
|
-
export type { ExternalAPYData, ExtraRewardApy, PoolBaseAPY, } from './compound-apy';
|
|
30
|
+
export type { CompoundAPYLegacyProps, CompoundAPYProps, ExternalAPYData, ExtraRewardApy, PoolBaseAPY, } from './compound-apy';
|
|
30
31
|
export * from './compound-apy';
|
|
31
32
|
export * from './confirm-menu';
|
|
32
33
|
export * from './credit-session-status';
|
|
@@ -140,3 +141,4 @@ export * from './vspace';
|
|
|
140
141
|
export * from './with-copy';
|
|
141
142
|
export * from './with-filter-button';
|
|
142
143
|
export * from './with-title';
|
|
144
|
+
export * from './yield-breakdown-tooltip';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PointsIcon, type PointsIconProps, type PointsReward, } from './points-icon';
|
|
1
|
+
export { PointsIcon, type PointsIconProps, type PointsIconReward, type PointsReward, } from './points-icon';
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { RoundedImageProps } from '../rounded-image/rounded-image';
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Minimal reward identity for {@link PointsIcon} (name + icon slug).
|
|
5
|
+
*
|
|
6
|
+
* Prefer this over the deprecated {@link PointsReward} alias — that name
|
|
7
|
+
* collides with SDK `PointsReward<T>` from `@gearbox-protocol/sdk/rewards`.
|
|
8
|
+
*/
|
|
9
|
+
export interface PointsIconReward {
|
|
4
10
|
/**
|
|
5
11
|
* Display name of the reward program
|
|
6
12
|
*/
|
|
@@ -10,11 +16,16 @@ export interface PointsReward {
|
|
|
10
16
|
*/
|
|
11
17
|
type: string;
|
|
12
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use {@link PointsIconReward}. The bare name conflicts with SDK
|
|
21
|
+
* `PointsReward<T>` from `@gearbox-protocol/sdk/rewards`.
|
|
22
|
+
*/
|
|
23
|
+
export type PointsReward = PointsIconReward;
|
|
13
24
|
export interface PointsIconProps extends React.HTMLAttributes<HTMLImageElement>, Omit<RoundedImageProps, "size" | "src" | "alt"> {
|
|
14
25
|
/**
|
|
15
26
|
* Reward information with name and type
|
|
16
27
|
*/
|
|
17
|
-
reward:
|
|
28
|
+
reward: PointsIconReward;
|
|
18
29
|
/**
|
|
19
30
|
* Size of the icon in pixels
|
|
20
31
|
*/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ApyBreakdown } from '@gearbox-protocol/sdk/model';
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
export interface ApyTooltipProps {
|
|
4
|
+
/**
|
|
5
|
+
* SDK `ApyBreakdown`. Display-only — organic base, token rewards, total,
|
|
6
|
+
* and points programs. No `tokensList`, 7D history, or external APY.
|
|
7
|
+
*/
|
|
8
|
+
apy: ApyBreakdown;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Tooltip for an SDK `ApyBreakdown` — organic base, token rewards, total,
|
|
14
|
+
* and points programs.
|
|
15
|
+
*
|
|
16
|
+
* Does not cover 1D/7D history, external APY, or rich point tip metadata
|
|
17
|
+
* (`duration`, `condition`, `tokenTitle`, preformatted `amount`). For those
|
|
18
|
+
* stay on the deprecated {@link PoolAPYTooltip}.
|
|
19
|
+
*/
|
|
20
|
+
export declare function ApyTooltip({ apy, children, className }: ApyTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { PoolBaseAPY } from '../compound-apy/compound-apy';
|
|
1
|
+
import { PoolBaseAPY } from '../compound-apy/compound-apy-legacy';
|
|
2
2
|
import { LocaleKeys } from '../../locale';
|
|
3
3
|
import { ExtraRewardApyData, TokenMetaInfo } from '../../types/common';
|
|
4
4
|
import type * as React from "react";
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Prefer SDK `ApyBreakdown` + {@link ApyTooltip}. Keep using this
|
|
7
|
+
* shape only when you need point metadata (`duration`, `condition`,
|
|
8
|
+
* `tokenTitle`, preformatted `amount`) that `PointsProgram` does not carry.
|
|
9
|
+
*/
|
|
5
10
|
export interface PoolAPYPointsTip {
|
|
6
11
|
reward?: {
|
|
7
12
|
duration?: string;
|
|
@@ -32,6 +37,13 @@ interface APY7DAgoData {
|
|
|
32
37
|
/** Allow extra fields from consumers */
|
|
33
38
|
[key: string]: unknown;
|
|
34
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Prefer {@link ApyTooltip} with SDK `ApyBreakdown`. This legacy
|
|
42
|
+
* tooltip remains the only option when you need:
|
|
43
|
+
* - 1D / 7D comparison (`apy7DAgo`);
|
|
44
|
+
* - external APY block;
|
|
45
|
+
* - rich point tip metadata (`duration`, `condition`, `tokenTitle`, `amount`).
|
|
46
|
+
*/
|
|
35
47
|
export interface PoolAPYTooltipProps {
|
|
36
48
|
children?: React.ReactNode;
|
|
37
49
|
totalAPY?: number;
|
|
@@ -43,5 +55,10 @@ export interface PoolAPYTooltipProps {
|
|
|
43
55
|
tokensList?: Record<string, TokenMetaInfo>;
|
|
44
56
|
className?: string;
|
|
45
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated Prefer {@link ApyTooltip} with SDK `ApyBreakdown`. Keep this
|
|
60
|
+
* component only when you still need 1D/7D history, external APY, or rich
|
|
61
|
+
* point tip metadata that `PointsProgram` does not carry.
|
|
62
|
+
*/
|
|
46
63
|
export declare function PoolAPYTooltip({ children, totalAPY, baseAPY, extraAPY, points, apy7DAgo, externalAPY, tokensList, className, }: PoolAPYTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
47
64
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IconComposite } from '@gearbox-protocol/sdk/common-utils';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
|
+
import { TokenIconInput } from '../../utils/token-icon-source';
|
|
3
4
|
import { RoundedImageProps } from '../rounded-image/rounded-image';
|
|
4
5
|
/**
|
|
5
6
|
* TokenIcon — component for displaying token/asset icons.
|
|
@@ -9,7 +10,10 @@ import { RoundedImageProps } from '../rounded-image/rounded-image';
|
|
|
9
10
|
* token symbols, asset icons, currency icons, token representations.
|
|
10
11
|
*
|
|
11
12
|
* Props:
|
|
12
|
-
* - `
|
|
13
|
+
* - `token` — token as it comes from the SDK/backend, or a bare symbol (preferred).
|
|
14
|
+
* The component resolves the icon itself via `getTokenIcon`, so callers never
|
|
15
|
+
* pass a pre-baked URL.
|
|
16
|
+
* - `symbol` — already-resolved source: direct icon URL or `IconComposite` (legacy).
|
|
13
17
|
* - `size` — icon size in pixels (defaults to 48).
|
|
14
18
|
*
|
|
15
19
|
* Note: Fetches icon from Gearbox static CDN based on symbol.
|
|
@@ -29,7 +33,12 @@ type DirectIcon = {
|
|
|
29
33
|
};
|
|
30
34
|
export type SymbolOrIcon = string | DirectIcon | IconComposite;
|
|
31
35
|
export interface TokenIconProps extends Omit<RoundedImageProps, "src" | "size"> {
|
|
32
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Token (or bare symbol). When set, takes precedence over `symbol` and is
|
|
38
|
+
* resolved via `getTokenIcon` (diesel composites, GEAR logo, etc.).
|
|
39
|
+
*/
|
|
40
|
+
token?: TokenIconInput | string;
|
|
41
|
+
symbol?: SymbolOrIcon | undefined;
|
|
33
42
|
size?: number;
|
|
34
43
|
className?: string;
|
|
35
44
|
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { NetworkType } from '@gearbox-protocol/sdk';
|
|
2
|
+
import { Token } from '@gearbox-protocol/sdk/model';
|
|
2
3
|
import { VariantProps } from 'class-variance-authority';
|
|
3
4
|
import { default as React } from 'react';
|
|
4
|
-
import { TokenIconProps } from '../token-icon';
|
|
5
5
|
import { TokenMetaInfo } from '../../types/common';
|
|
6
6
|
declare const tokenSymbolVariants: (props?: ({
|
|
7
7
|
marginSize?: "sm" | "lg" | "md" | null | undefined;
|
|
8
8
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
9
9
|
export interface TokenSymbolProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title">, VariantProps<typeof tokenSymbolVariants> {
|
|
10
10
|
/**
|
|
11
|
-
* Token
|
|
11
|
+
* SDK `Token`, `TokenMetaInfo`, or bare symbol string. Passed straight to
|
|
12
|
+
* `TokenIcon`, which resolves the icon via `getTokenIcon`.
|
|
12
13
|
*/
|
|
13
|
-
token?: TokenMetaInfo | string;
|
|
14
|
+
token?: Token | TokenMetaInfo | string;
|
|
14
15
|
/**
|
|
15
16
|
* Optional override title to display
|
|
16
17
|
*/
|
|
@@ -51,7 +52,6 @@ export interface TokenSymbolProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
51
52
|
*/
|
|
52
53
|
maxLength?: number;
|
|
53
54
|
}
|
|
54
|
-
export declare function getSymbolOrIcon(token: TokenSymbolProps["token"]): TokenIconProps["symbol"] | undefined;
|
|
55
55
|
/**
|
|
56
56
|
* TokenSymbol component for displaying token symbols with optional icon and comment
|
|
57
57
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './yield-breakdown-tooltip';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ApyBreakdown, Bps, Leverage } from '@gearbox-protocol/sdk/model';
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
export interface YieldBreakdownTooltipProps {
|
|
4
|
+
/**
|
|
5
|
+
* Net yield (`ApyBreakdown`). For a strategy this is the net at
|
|
6
|
+
* {@link maxLeverage}.
|
|
7
|
+
*/
|
|
8
|
+
supplyApy: ApyBreakdown;
|
|
9
|
+
/**
|
|
10
|
+
* Strategy-only plain leverage multiplier (e.g. `13.6` for 13.6x). When set,
|
|
11
|
+
* the header shows "at Nx leverage" and borrow rows may appear.
|
|
12
|
+
*/
|
|
13
|
+
maxLeverage?: Leverage;
|
|
14
|
+
/**
|
|
15
|
+
* Strategy collateral yield used for Base / Incentive rows. Falls back to
|
|
16
|
+
* {@link supplyApy} when omitted.
|
|
17
|
+
*/
|
|
18
|
+
collateralApy?: ApyBreakdown;
|
|
19
|
+
/** Strategy base borrow cost in bps (shown as a negative rate). */
|
|
20
|
+
borrowApy?: Bps;
|
|
21
|
+
/** Strategy additional (quota) borrow cost in bps (shown as a negative rate). */
|
|
22
|
+
additionalBorrowApy?: Bps;
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
className?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Yield Breakdown tooltip for Earn — pool and strategy layouts from SDK
|
|
28
|
+
* `ApyBreakdown` (+ optional strategy borrow / leverage fields).
|
|
29
|
+
*
|
|
30
|
+
* Visuals follow Figma «Yield Details Surface» (400px card, always expanded).
|
|
31
|
+
*/
|
|
32
|
+
export declare function YieldBreakdownTooltip({ supplyApy, maxLeverage, collateralApy, borrowApy, additionalBorrowApy, children, className, }: YieldBreakdownTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,8 +9,12 @@
|
|
|
9
9
|
* return <div>{isMobile ? "Mobile view" : "Desktop view"}</div>;
|
|
10
10
|
* }
|
|
11
11
|
* ```
|
|
12
|
+
*
|
|
13
|
+
* @param enabled When `false`, skips the `matchMedia` subscription. Used by
|
|
14
|
+
* the named breakpoint hooks so they do not attach listeners when a
|
|
15
|
+
* `BreakpointProvider` already owns the shared state.
|
|
12
16
|
*/
|
|
13
|
-
export declare function useMediaQuery(query: string): boolean;
|
|
17
|
+
export declare function useMediaQuery(query: string, enabled?: boolean): boolean;
|
|
14
18
|
/**
|
|
15
19
|
* Checks if the viewport is mobile-sized (max-width: 500px-)
|
|
16
20
|
*/
|
package/dist/types/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export * from './components/base-link';
|
|
|
16
16
|
export * from './components/block-sync';
|
|
17
17
|
export * from './components/block-sync-pill';
|
|
18
18
|
export * from './components/breadcrumbs';
|
|
19
|
+
export * from './components/breakpoint-provider';
|
|
19
20
|
export * from './components/button-checkbox';
|
|
20
21
|
export * from './components/buttons';
|
|
21
22
|
export * from './components/card-grid';
|
|
@@ -138,6 +139,7 @@ export * from './components/vspace';
|
|
|
138
139
|
export * from './components/with-copy';
|
|
139
140
|
export * from './components/with-filter-button';
|
|
140
141
|
export * from './components/with-title';
|
|
142
|
+
export * from './components/yield-breakdown-tooltip';
|
|
141
143
|
export * from './configs/design-tokens';
|
|
142
144
|
export * from './configs/variants';
|
|
143
145
|
export * from './hooks';
|
|
@@ -84,6 +84,16 @@ declare const _default: {
|
|
|
84
84
|
"components.apyParts.points": "{symbol} Incentive",
|
|
85
85
|
"components.apyParts.points.condition.crossDeposit": "For cross-chain deposits made via Omni",
|
|
86
86
|
|
|
87
|
+
"components.yieldBreakdown.title": "Yield Breakdown",
|
|
88
|
+
"components.yieldBreakdown.atLeverage": "at {leverage}× leverage",
|
|
89
|
+
"components.yieldBreakdown.baseYield": "Base Yield",
|
|
90
|
+
"components.yieldBreakdown.incentiveYield": "Incentive Yield",
|
|
91
|
+
"components.yieldBreakdown.borrowRate": "Borrow Rate",
|
|
92
|
+
"components.yieldBreakdown.baseRate": "Base Rate",
|
|
93
|
+
"components.yieldBreakdown.additionalRate": "Additional Rate",
|
|
94
|
+
"components.yieldBreakdown.netYield": "Net Yield",
|
|
95
|
+
"components.yieldBreakdown.points": "Points",
|
|
96
|
+
|
|
87
97
|
"components.openCopyButtons.copy": "Copy to clipboard",
|
|
88
98
|
|
|
89
99
|
"components.poolAssetsTable.asset": "Asset",
|
|
@@ -146,8 +156,6 @@ declare const _default: {
|
|
|
146
156
|
"components.rewardsTooltip.with.title": "With {leverage} Leverage",
|
|
147
157
|
"components.rewardsTooltip.with.borrowRate": "{symbol} borrow rate",
|
|
148
158
|
"components.rewardsTooltip.with.quotaRate": "Quota rate",
|
|
149
|
-
"components.rewardsTooltip.with.bonusAPY.title": "Target Bonuses Yield",
|
|
150
|
-
"components.rewardsTooltip.with.bonusAPY.tip": "Expected Bonuses APY is calculated by the Asset Issuer and represents the expected value to be paid out in points.",
|
|
151
159
|
"components.rewardsTooltip.with.extra": "+ Extra APR",
|
|
152
160
|
"components.rewardsTooltip.button": "Click to show rewards details",
|
|
153
161
|
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import { IconComposite } from '@gearbox-protocol/sdk/common-utils';
|
|
2
1
|
import { Address } from 'viem';
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Token metadata as it arrives from the SDK or backend. Deliberately carries no
|
|
4
|
+
* icon field: icons are a front-end concern resolved from the symbol by
|
|
5
|
+
* `getTokenIcon` inside `TokenIcon`.
|
|
6
|
+
*/
|
|
4
7
|
export type TokenMetaInfo = {
|
|
5
8
|
symbol: string;
|
|
6
9
|
title?: string;
|
|
7
|
-
/**
|
|
8
|
-
* Token icon:
|
|
9
|
-
* - **String** — direct URL to a single raster/SVG asset. Often the best choice when the image is
|
|
10
|
-
* baked on the server or CDN (single request, no client layering).
|
|
11
|
-
* - **`IconComposite`** — layered icon using named UI-kit presets (`stacked_full`, `centered_foreground`).
|
|
12
|
-
*
|
|
13
|
-
* Do not mix legacy alternate shapes; `icon` is a discriminated field (`string` vs `kind: "composite"`).
|
|
14
|
-
*/
|
|
15
|
-
icon?: string | IconComposite;
|
|
16
10
|
name?: string;
|
|
17
11
|
};
|
|
18
12
|
export type TokenFullData = TokenMetaInfo & {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ApyBreakdown, Bps, PointsProgram, TokenRewards } from '@gearbox-protocol/sdk/model';
|
|
2
|
+
/**
|
|
3
|
+
* Total APY as a UI should show it.
|
|
4
|
+
*
|
|
5
|
+
* `totalApy` is only reported in `offchain` mode; in `onchain` mode `rewards`
|
|
6
|
+
* is absent as well, so there are no incentives to fold in and organic yield is
|
|
7
|
+
* the whole figure.
|
|
8
|
+
*/
|
|
9
|
+
export declare function totalApyOf(apy: ApyBreakdown): Bps;
|
|
10
|
+
/** Token reward rows from an SDK `ApyBreakdown`. */
|
|
11
|
+
export declare function tokenRewardsOf(apy: ApyBreakdown): Array<TokenRewards>;
|
|
12
|
+
/** Points programs from an SDK `ApyBreakdown`. */
|
|
13
|
+
export declare function pointProgramsOf(apy: ApyBreakdown): Array<PointsProgram>;
|
|
14
|
+
/**
|
|
15
|
+
* Token rewards with a positive supply APR — shared filter for compound APY
|
|
16
|
+
* chips and breakdown tooltips.
|
|
17
|
+
*/
|
|
18
|
+
export declare function positiveTokenRewardsOf(apy: ApyBreakdown): Array<TokenRewards>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './a11y';
|
|
2
|
+
export * from './apy-breakdown';
|
|
2
3
|
export * from './bn-to-input-view';
|
|
3
4
|
export * from './bn-to-pretty-view';
|
|
5
|
+
export * from './bps';
|
|
4
6
|
export * from './cn';
|
|
5
7
|
export { cn as default } from './cn';
|
|
6
8
|
export * from './colors';
|
|
@@ -24,6 +26,7 @@ export * from './short-sha';
|
|
|
24
26
|
export * from './shorten-string';
|
|
25
27
|
export type { SortField as UtilsSortField, SortType } from './sort';
|
|
26
28
|
export * from './templates';
|
|
29
|
+
export * from './token-icon-source';
|
|
27
30
|
export * from './ttl';
|
|
28
31
|
export * from './window';
|
|
29
32
|
export * from './z-index';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IconComposite } from '@gearbox-protocol/sdk/common-utils';
|
|
2
|
+
/** Same shape as `TokenIcon`'s `symbol` prop — kept here to avoid a cycle. */
|
|
3
|
+
export type TokenIconSource = string | {
|
|
4
|
+
icon: string;
|
|
5
|
+
} | IconComposite;
|
|
6
|
+
/**
|
|
7
|
+
* Everything the resolver needs from a token. Structural on purpose so the SDK
|
|
8
|
+
* read-model `Token`, the `TokenData` class, and bare metadata all fit without
|
|
9
|
+
* carrying an icon field.
|
|
10
|
+
*/
|
|
11
|
+
export interface TokenIconInput {
|
|
12
|
+
symbol: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Underlying symbol of a pool share token, or `undefined` when the symbol is
|
|
16
|
+
* an ordinary token. Falling through is safe: the caller then uses the token's
|
|
17
|
+
* own CDN asset.
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseShareTokenUnderlying(symbol: string): string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Resolve a token (or bare symbol) into the value `TokenIcon` renders.
|
|
22
|
+
*
|
|
23
|
+
* Pure front-end concern: share token composites and the GEAR logo special
|
|
24
|
+
* case are derived from the symbol alone — callers must not pre-bake `icon` /
|
|
25
|
+
* `iconUrl`, and should hand the token to `TokenIcon` rather than calling this
|
|
26
|
+
* directly.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getTokenIcon(token: TokenIconInput | string | undefined): TokenIconSource | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/ui-kit",
|
|
3
|
-
"version": "3.14.0-next.
|
|
3
|
+
"version": "3.14.0-next.67",
|
|
4
4
|
"description": "Internal UI components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"@commitlint/cli": "^20.1.0",
|
|
157
157
|
"@commitlint/config-conventional": "^20.0.0",
|
|
158
158
|
"@gearbox-protocol/biome-config": "^1.0.2",
|
|
159
|
-
"@gearbox-protocol/sdk": "
|
|
159
|
+
"@gearbox-protocol/sdk": "v14.12.0-next.73",
|
|
160
160
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
161
161
|
"@storybook/addon-a11y": "^10.0.8",
|
|
162
162
|
"@storybook/addon-docs": "^10.0.8",
|