@gearbox-protocol/ui-kit 4.0.0-next.31 → 4.0.0-next.33

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.
@@ -188,7 +188,7 @@ const e = {
188
188
  "components.poolApyBreakdownCard.incentiveApy": "Incentive APY",
189
189
  "components.poolApyBreakdownCard.incentiveApy7d": "Incentive APY (7d)",
190
190
  "components.strategyApyBreakdownCard.formula": "{leverage} × {base}",
191
- "components.strategyApyBreakdownCard.borrowFormula": "{debtMultiplier} × {borrowBase} + {quotaMultiplier} × {quotaBase}",
191
+ "components.strategyApyBreakdownCard.borrowFormula": "{leverage} × ({borrowRate} + {quotaRate}) {borrowRate}",
192
192
  "components.leveragePresetChips.label": "Leverage:",
193
193
  "components.liquidationParamsTable.lt": "Liquidation threshold",
194
194
  "components.liquidationParamsTable.penalty": "Liquidation discount",
@@ -1,27 +1,20 @@
1
- import { ApyBreakdown, Bps, Leverage } from '@gearbox-protocol/sdk/model';
1
+ import { Leverage, StrategyOpportunity } from '@gearbox-protocol/sdk/model';
2
2
  import { default as React } from 'react';
3
3
  import { StrategyApyBreakdownCardTest } from './constants';
4
4
  export { StrategyApyBreakdownCardTest };
5
- export interface StrategyApyBreakdownData {
5
+ /**
6
+ * What the card reads off a strategy: the seven-day feed, and the liquidation
7
+ * threshold the quota is weighted by.
8
+ *
9
+ * A slice of the SDK type rather than a shape of its own, so a caller hands
10
+ * over the opportunity it already holds and the card states what it reads.
11
+ */
12
+ export type StrategyApyBreakdownSlice = Pick<StrategyOpportunity, "borrowApyAvg7D" | "quotaRateAvg7D" | "liquidationThreshold" | "collateralApyAvg7D">;
13
+ export interface StrategyApyBreakdownCardProps {
14
+ /** The strategy being broken down; every figure is derived from it. */
15
+ readonly data: StrategyApyBreakdownSlice;
6
16
  /** Leverage every figure below is quoted at. */
7
17
  readonly leverage: Leverage;
8
- /**
9
- * **N** — the strategy's net rate on the user's equity, as
10
- * `calcNetStrategyApy` returns it. Passed in rather than reconstructed:
11
- * this is the same figure the badge and the list cell print, and it stays
12
- * the same figure by being handed over, not by two formulas agreeing.
13
- */
14
- readonly netApy: ApyBreakdown;
15
- /**
16
- * **B** — cost of the credit behind the position, quota folded in, as
17
- * `calcEffectiveBorrowApy` returns it. Positive; the card negates it.
18
- */
19
- readonly borrowCost: Bps;
20
- /** The collateral yield the net was computed from, for its incentive rows. */
21
- readonly collateralApy?: ApyBreakdown;
22
- }
23
- export interface StrategyApyBreakdownCardProps {
24
- readonly data: StrategyApyBreakdownData;
25
18
  /**
26
19
  * Multiplier caption under each figure — `11.18 × 3.11%` and the like.
27
20
  *
@@ -36,9 +29,11 @@ export interface StrategyApyBreakdownCardProps {
36
29
  * How a strategy's net APY is arrived at: collateral yield on the leveraged
37
30
  * position, less what the credit behind it costs.
38
31
  *
39
- * The card computes no rate of its own. **N** (`netApy`) and **B**
40
- * (`borrowCost`) arrive already calculated, and the collateral row is their
41
- * sum which is exactly `round(leverage × collateralApy)`, because the SDK
32
+ * The card is handed a strategy and a leverage and derives the rest, because
33
+ * every figure it shows is a figure only this card asks for. **N** and **B**
34
+ * come from the SDK `calcNetStrategyApy` and `calcEffectiveBorrowApy`, the
35
+ * same two the badge and the list cell are quoting — and the collateral row is
36
+ * their sum, which is exactly `round(leverage × collateralApy)` because the SDK
42
37
  * subtracts an integer `B` inside its own rounding. Deriving the third value
43
38
  * instead of recomputing it is what makes `N = C − B` hold to the basis point
44
39
  * rather than approximately.
@@ -47,4 +42,4 @@ export interface StrategyApyBreakdownCardProps {
47
42
  * remainder, so the column adds up to the chip even when each reward rounds
48
43
  * its own way.
49
44
  */
50
- export declare function StrategyApyBreakdownCard({ data, showFormula, period, }: StrategyApyBreakdownCardProps): React.ReactElement;
45
+ export declare function StrategyApyBreakdownCard({ data, leverage, showFormula, period, }: StrategyApyBreakdownCardProps): React.ReactElement;
@@ -228,7 +228,7 @@ declare const _default: {
228
228
  "components.poolApyBreakdownCard.incentiveApy": "Incentive APY",
229
229
  "components.poolApyBreakdownCard.incentiveApy7d": "Incentive APY (7d)",
230
230
  "components.strategyApyBreakdownCard.formula": "{leverage} × {base}",
231
- "components.strategyApyBreakdownCard.borrowFormula": "{debtMultiplier} × {borrowBase} + {quotaMultiplier} × {quotaBase}",
231
+ "components.strategyApyBreakdownCard.borrowFormula": "{leverage} × ({borrowRate} + {quotaRate}) {borrowRate}",
232
232
 
233
233
  "components.leveragePresetChips.label": "Leverage:",
234
234
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/ui-kit",
3
- "version": "4.0.0-next.31",
3
+ "version": "4.0.0-next.33",
4
4
  "description": "Internal UI components",
5
5
  "repository": {
6
6
  "type": "git",