@gearbox-protocol/ui-kit 4.0.0-next.17 → 4.0.0-next.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
- package/dist/cjs/components/hf-indicator/hf-indicator.cjs +1 -1
- package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/utils/index.cjs +1 -1
- package/dist/cjs/utils/strategy-apy.cjs +1 -1
- package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +121 -116
- package/dist/esm/components/compound-apy/compound-apy.js +2 -2
- package/dist/esm/components/hf-indicator/hf-indicator.js +55 -29
- package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +20 -21
- package/dist/esm/index.js +55 -56
- package/dist/esm/utils/index.js +29 -30
- package/dist/esm/utils/strategy-apy.js +41 -31
- package/dist/globals.css +1 -1
- package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts +7 -13
- package/dist/types/components/compound-apy/compound-apy.d.ts +2 -2
- package/dist/types/components/hf-indicator/hf-indicator.d.ts +12 -3
- package/dist/types/components/yield-breakdown-tooltip/yield-breakdown-tooltip.d.ts +3 -3
- package/dist/types/utils/strategy-apy.d.ts +21 -18
- package/package.json +2 -2
package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
import { ApyBreakdown,
|
|
1
|
+
import { ApyBreakdown, Leverage } from '@gearbox-protocol/sdk/model';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
|
+
import { StrategyApyRates } from '../../../utils/strategy-apy';
|
|
3
4
|
import { StrategyApyBreakdownCardTest } from './constants';
|
|
4
5
|
export { StrategyApyBreakdownCardTest };
|
|
5
|
-
export interface StrategyApyBreakdownData {
|
|
6
|
+
export interface StrategyApyBreakdownData extends StrategyApyRates {
|
|
6
7
|
readonly collateralApy?: ApyBreakdown;
|
|
7
|
-
|
|
8
|
-
readonly additionalBorrowApy?: Bps;
|
|
8
|
+
/** Leverage the card falls back to when the toolbar names none. */
|
|
9
9
|
readonly maxLeverage?: Leverage;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
readonly maxLeverageApy?: ApyBreakdown;
|
|
16
|
-
/**
|
|
17
|
-
* SDK net at the displayed {@link StrategyApyBreakdownCardProps.leverage}
|
|
18
|
-
* (e.g. a position's `netApy`). Preferred over both `maxLeverageApy` and
|
|
19
|
-
* the reconstructed formula.
|
|
11
|
+
* Net rate the caller already knows — a position's own `netApy`. Preferred
|
|
12
|
+
* over the rows' arithmetic, which answers for the strategy rather than for
|
|
13
|
+
* one account inside it.
|
|
20
14
|
*/
|
|
21
15
|
readonly netApy?: ApyBreakdown;
|
|
22
16
|
}
|
|
@@ -17,7 +17,7 @@ export interface CompoundAPYProps {
|
|
|
17
17
|
/** Strategy base borrow cost in bps. */
|
|
18
18
|
borrowApy?: Bps;
|
|
19
19
|
/** Strategy additional (quota) borrow cost in bps. */
|
|
20
|
-
|
|
20
|
+
quotaRate?: Bps;
|
|
21
21
|
/**
|
|
22
22
|
* Number of decimal places for the total APY string.
|
|
23
23
|
* @default 2
|
|
@@ -31,4 +31,4 @@ export interface CompoundAPYProps {
|
|
|
31
31
|
* No `tokensList`, no external APY, no 7D history, no "soon" points state.
|
|
32
32
|
* For the legacy percent-based API see {@link CompoundAPYLegacy}.
|
|
33
33
|
*/
|
|
34
|
-
export declare function CompoundAPY({ apy, maxLeverage, collateralApy, borrowApy,
|
|
34
|
+
export declare function CompoundAPY({ apy, maxLeverage, collateralApy, borrowApy, quotaRate, decimals, className, }: CompoundAPYProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
export type HFIndicatorSize = "sm" | "md";
|
|
2
3
|
export interface HFIndicatorProps {
|
|
3
|
-
|
|
4
|
+
/** Pre-formatted health factor, e.g. `"1.05"`. */
|
|
5
|
+
readonly value: string;
|
|
6
|
+
/** `md` stands alone on a screen; `sm` fits a one-row banner. */
|
|
7
|
+
readonly size?: HFIndicatorSize;
|
|
4
8
|
}
|
|
5
9
|
/**
|
|
6
|
-
* Concentric rings around a health-factor value. Presentation only
|
|
10
|
+
* Concentric rings around a health-factor value. Presentation only: the number
|
|
11
|
+
* arrives formatted, and the colour does not follow it — every caller so far
|
|
12
|
+
* renders this because the factor is already low.
|
|
13
|
+
*
|
|
14
|
+
* The box is the outermost ring, so the component occupies exactly what it
|
|
15
|
+
* paints and a caller can place it like any other block.
|
|
7
16
|
*/
|
|
8
|
-
export declare function HFIndicator({ value, }: HFIndicatorProps): React.ReactElement;
|
|
17
|
+
export declare function HFIndicator({ value, size, }: HFIndicatorProps): React.ReactElement;
|
|
@@ -18,8 +18,8 @@ export interface YieldBreakdownTooltipProps {
|
|
|
18
18
|
collateralApy?: ApyBreakdown;
|
|
19
19
|
/** Strategy base borrow cost in bps (shown as a negative rate). */
|
|
20
20
|
borrowApy?: Bps;
|
|
21
|
-
/** Strategy
|
|
22
|
-
|
|
21
|
+
/** Strategy quota rate in bps, at 1x (folded into Borrow Rate). */
|
|
22
|
+
quotaRate?: Bps;
|
|
23
23
|
children?: React.ReactNode;
|
|
24
24
|
className?: string;
|
|
25
25
|
}
|
|
@@ -27,4 +27,4 @@ export interface YieldBreakdownTooltipProps {
|
|
|
27
27
|
* Earn APY tooltip — strategy (`Net APY at Nx Leverage`) and pool
|
|
28
28
|
* (`Overall APY`) layouts from SDK `ApyBreakdown`.
|
|
29
29
|
*/
|
|
30
|
-
export declare function YieldBreakdownTooltip({ supplyApy, maxLeverage, collateralApy, borrowApy,
|
|
30
|
+
export declare function YieldBreakdownTooltip({ supplyApy, maxLeverage, collateralApy, borrowApy, quotaRate, children, className, }: YieldBreakdownTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,37 +1,40 @@
|
|
|
1
|
+
import { QuotaMode, StrategyRateInputs } from '@gearbox-protocol/sdk';
|
|
1
2
|
import { Bps, Leverage } from '@gearbox-protocol/sdk/model';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
4
|
+
* The rates a strategy's cost of credit is made of — the SDK's own
|
|
5
|
+
* `StrategyRateInputs`, spelled the same way so a caller hands over the fields
|
|
6
|
+
* of a `StrategyOpportunity` rather than a translation of them.
|
|
7
|
+
*
|
|
8
|
+
* Optional only because a card may be rendered before its strategy has loaded;
|
|
9
|
+
* the SDK requires all three, and so does the arithmetic.
|
|
5
10
|
*/
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
readonly
|
|
9
|
-
}
|
|
11
|
+
export type StrategyApyRates = Readonly<Partial<StrategyRateInputs>> & {
|
|
12
|
+
/** How much quota the position quotes; the SDK's `"safe"` unless told. */
|
|
13
|
+
readonly quotaMode?: QuotaMode;
|
|
14
|
+
};
|
|
10
15
|
/**
|
|
11
|
-
* Borrow
|
|
16
|
+
* Borrow and quota cost of a strategy at one leverage, split so each can have
|
|
17
|
+
* its own row.
|
|
12
18
|
*
|
|
13
|
-
* `
|
|
19
|
+
* `totalCost` comes from `calcEffectiveBorrowApy` rather than from adding the
|
|
20
|
+
* two parts up here: the SDK rounds once, at the end, and a card whose rows
|
|
21
|
+
* sum to something other than its own total is the bug this replaced.
|
|
14
22
|
*/
|
|
15
|
-
export declare function strategyApyPartsAtLeverage({ leverage,
|
|
23
|
+
export declare function strategyApyPartsAtLeverage({ leverage, borrowApy, quotaRate, liquidationThreshold, quotaMode, }: StrategyApyRates & {
|
|
16
24
|
readonly leverage: Leverage;
|
|
17
|
-
readonly maxLeverage?: Leverage;
|
|
18
|
-
readonly borrowApy?: Bps;
|
|
19
|
-
readonly additionalBorrowApy?: Bps;
|
|
20
25
|
}): {
|
|
21
26
|
readonly debtMultiplier: number;
|
|
27
|
+
readonly quotaMultiplier: number;
|
|
22
28
|
readonly borrowCost: Bps;
|
|
23
29
|
readonly quotaRate: Bps;
|
|
24
30
|
readonly quotaCost: Bps;
|
|
25
31
|
readonly totalCost: Bps;
|
|
26
32
|
};
|
|
27
33
|
/**
|
|
28
|
-
* Net strategy APY at leverage
|
|
29
|
-
*
|
|
34
|
+
* Net strategy APY at one leverage, straight from the SDK — the same call the
|
|
35
|
+
* app makes for the badge beside this card, so the two cannot disagree.
|
|
30
36
|
*/
|
|
31
|
-
export declare function strategyNetApyAtLeverage({ collateralApy, leverage,
|
|
37
|
+
export declare function strategyNetApyAtLeverage({ collateralApy, leverage, borrowApy, quotaRate, liquidationThreshold, quotaMode, }: StrategyApyRates & {
|
|
32
38
|
readonly collateralApy: Bps;
|
|
33
39
|
readonly leverage: Leverage;
|
|
34
|
-
readonly maxLeverage?: Leverage;
|
|
35
|
-
readonly borrowApy?: Bps;
|
|
36
|
-
readonly additionalBorrowApy?: Bps;
|
|
37
40
|
}): Bps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/ui-kit",
|
|
3
|
-
"version": "4.0.0-next.
|
|
3
|
+
"version": "4.0.0-next.19",
|
|
4
4
|
"description": "Internal UI components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"@commitlint/cli": "^20.1.0",
|
|
116
116
|
"@commitlint/config-conventional": "^20.0.0",
|
|
117
117
|
"@gearbox-protocol/biome-config": "^1.0.2",
|
|
118
|
-
"@gearbox-protocol/sdk": "
|
|
118
|
+
"@gearbox-protocol/sdk": "16.0.0-next.1",
|
|
119
119
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
120
120
|
"@storybook/addon-a11y": "^10.0.8",
|
|
121
121
|
"@storybook/addon-docs": "^10.0.8",
|