@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.
@@ -1,22 +1,16 @@
1
- import { ApyBreakdown, Bps, Leverage } from '@gearbox-protocol/sdk/model';
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
- readonly borrowApy?: Bps;
8
- readonly additionalBorrowApy?: Bps;
8
+ /** Leverage the card falls back to when the toolbar names none. */
9
9
  readonly maxLeverage?: Leverage;
10
10
  /**
11
- * SDK net at {@link maxLeverage}. Used for the net chip when the selected
12
- * leverage is max, so the chip matches the Max APY badge instead of a
13
- * client-side reconstruction.
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
- additionalBorrowApy?: Bps;
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, additionalBorrowApy, decimals, className, }: CompoundAPYProps): import("react/jsx-runtime").JSX.Element;
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
- readonly value?: string;
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 additional (quota) borrow cost in bps (folded into Borrow Rate). */
22
- additionalBorrowApy?: Bps;
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, additionalBorrowApy, children, className, }: YieldBreakdownTooltipProps): import("react/jsx-runtime").JSX.Element;
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
- * Quota rate at 1x. `additionalBorrowApy` from the SDK is already scaled to
4
- * {@link maxLeverage} (`quotaRate × (1 + feeInterest) × maxLeverage`).
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 declare function strategyQuotaRate({ additionalBorrowApy, maxLeverage, }: {
7
- readonly additionalBorrowApy?: Bps;
8
- readonly maxLeverage?: Leverage;
9
- }): Bps;
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 + quota cost of a strategy at leverage `l`, in bps.
16
+ * Borrow and quota cost of a strategy at one leverage, split so each can have
17
+ * its own row.
12
18
  *
13
- * `cost = borrowApy × max(l 1, 0) + quotaRate × l`
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, maxLeverage, borrowApy, additionalBorrowApy, }: {
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 `l`, in bps:
29
- * `collateralApy × l cost(l)`.
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, maxLeverage, borrowApy, additionalBorrowApy, }: {
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.17",
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": "15.1.0-next.17",
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",