@gearbox-protocol/ui-kit 4.0.0-next.15 → 4.0.0-next.17

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.
Files changed (51) hide show
  1. package/dist/cjs/components/base/index.cjs +1 -1
  2. package/dist/cjs/components/base/info-list/info-list.cjs +1 -1
  3. package/dist/cjs/components/base/position-assets/constants.cjs +1 -0
  4. package/dist/cjs/components/base/position-assets/index.cjs +1 -0
  5. package/dist/cjs/components/base/position-assets/position-assets.cjs +1 -0
  6. package/dist/cjs/components/base/stat-badge/constants.cjs +1 -1
  7. package/dist/cjs/components/base/stat-badge/stat-badge.cjs +1 -1
  8. package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
  9. package/dist/cjs/components/base/tabber/tabber.cjs +1 -1
  10. package/dist/cjs/components/base/values/scalars.cjs +1 -1
  11. package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
  12. package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
  13. package/dist/cjs/components/index.cjs +1 -1
  14. package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
  15. package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
  16. package/dist/cjs/index.cjs +1 -1
  17. package/dist/cjs/locale/en.json.cjs +1 -1
  18. package/dist/cjs/utils/index.cjs +1 -1
  19. package/dist/cjs/utils/strategy-apy.cjs +1 -0
  20. package/dist/esm/components/base/index.js +112 -108
  21. package/dist/esm/components/base/info-list/info-list.js +7 -6
  22. package/dist/esm/components/base/position-assets/constants.js +8 -0
  23. package/dist/esm/components/base/position-assets/index.js +6 -0
  24. package/dist/esm/components/base/position-assets/position-assets.js +73 -0
  25. package/dist/esm/components/base/stat-badge/constants.js +1 -0
  26. package/dist/esm/components/base/stat-badge/stat-badge.js +87 -52
  27. package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +130 -110
  28. package/dist/esm/components/base/tabber/tabber.js +67 -64
  29. package/dist/esm/components/base/values/scalars.js +52 -33
  30. package/dist/esm/components/checkbox/checkbox-labeled.js +1 -1
  31. package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +1 -1
  32. package/dist/esm/components/index.js +662 -658
  33. package/dist/esm/components/with-copy/with-copy.js +1 -1
  34. package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +20 -19
  35. package/dist/esm/index.js +858 -850
  36. package/dist/esm/locale/en.json.js +2 -1
  37. package/dist/esm/utils/index.js +64 -60
  38. package/dist/esm/utils/strategy-apy.js +41 -0
  39. package/dist/types/components/base/index.d.ts +1 -0
  40. package/dist/types/components/base/position-assets/constants.d.ts +5 -0
  41. package/dist/types/components/base/position-assets/index.d.ts +2 -0
  42. package/dist/types/components/base/position-assets/position-assets.d.ts +49 -0
  43. package/dist/types/components/base/stat-badge/constants.d.ts +1 -0
  44. package/dist/types/components/base/stat-badge/stat-badge.d.ts +11 -1
  45. package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts +12 -0
  46. package/dist/types/components/base/tabber/tabber.d.ts +2 -2
  47. package/dist/types/components/base/values/scalars.d.ts +4 -0
  48. package/dist/types/locale/en.json.d.ts +2 -1
  49. package/dist/types/utils/index.d.ts +1 -0
  50. package/dist/types/utils/strategy-apy.d.ts +37 -0
  51. package/package.json +1 -1
@@ -179,7 +179,8 @@ const e = {
179
179
  "components.strategyApyBreakdownCard.collateralApy": "Collateral APY",
180
180
  "components.strategyApyBreakdownCard.incentiveApy": "Incentive APY",
181
181
  "components.strategyApyBreakdownCard.borrowRate": "Borrow Rate",
182
- "components.strategyApyBreakdownCard.formula": "{base} × {leverage} Lev.",
182
+ "components.strategyApyBreakdownCard.quotaRate": "Quota Rate",
183
+ "components.strategyApyBreakdownCard.formula": "{leverage} × {base}",
183
184
  "components.leveragePresetChips.label": "Leverage:",
184
185
  "components.liquidationParamsTable.lt": "Liquidation threshold",
185
186
  "components.liquidationParamsTable.penalty": "Liquidation discount",
@@ -1,113 +1,117 @@
1
1
  import { generateId as r, useFormFieldIds as t } from "./a11y.js";
2
- import { pointProgramsOf as m, positiveTokenRewardsOf as n, tokenRewardsOf as i, totalApyOf as p } from "./apy-breakdown.js";
3
- import { bnToInputView as l } from "./bn-to-input-view.js";
2
+ import { pointProgramsOf as m, positiveTokenRewardsOf as n, tokenRewardsOf as p, totalApyOf as i } from "./apy-breakdown.js";
3
+ import { bnToInputView as s } from "./bn-to-input-view.js";
4
4
  import { bnToPrettyView as x } from "./bn-to-pretty-view.js";
5
- import { bpsToPercent as c } from "./bps.js";
5
+ import { bpsToPercent as g } from "./bps.js";
6
6
  import { cn as S, cn as d } from "./cn.js";
7
- import { generateColorsFromBase as h, getCSSVariable as v, hexToRgba as P, hslToHex as b, resolveCSSColor as A } from "./colors.js";
7
+ import { generateColorsFromBase as h, getCSSVariable as A, hexToRgba as v, hslToHex as y, resolveCSSColor as P } from "./colors.js";
8
8
  import { copyToClipboard as N } from "./copy.js";
9
- import { convertPercent as L, formatBytecodeSize as y, formatBytecodeVersion as C, formatTimestamp as w, shortenHash as F, significantTrunc as D } from "./format.js";
9
+ import { convertPercent as I, formatBytecodeSize as k, formatBytecodeVersion as C, formatTimestamp as w, shortenHash as F, significantTrunc as D } from "./format.js";
10
10
  import { formatAssetAmount as V } from "./format-asset-amount.js";
11
- import { formatLeverage as M } from "./format-leverage.js";
11
+ import { formatLeverage as B } from "./format-leverage.js";
12
12
  import { formatCompactPercent as _, formatMoney as E, formatMoneyAmount as H, formatPercentAmount as W, percentTemplate as Z, percentageTemplate as z } from "./format-money.js";
13
- import { FORMAT_CONSTANTS as X, formatNumberWithSuffix as q, formatPrice as j, getAdaptiveDecimals as G, isBelowDisplayThreshold as J, isEffectivelyZero as K, toSignificantDigits as Q } from "./format-number.js";
13
+ import { FORMAT_CONSTANTS as X, formatNumberWithSuffix as q, formatPrice as Q, getAdaptiveDecimals as j, isBelowDisplayThreshold as G, isEffectivelyZero as J, toSignificantDigits as K } from "./format-number.js";
14
14
  import { slippageTemplate as $ } from "./format-slippage.js";
15
15
  import { formatChipLeverage as oe, leveragePresets as re } from "./leverage-presets.js";
16
16
  import { allLoaded as ae, loadingProgress as me, round5 as ne } from "./loading.js";
17
- import { decimalsToStep as pe, findClosestPoint as fe, formatWithDecimals as le, formatWithoutDecimals as se, splitInterval as xe, validateMinMax as Te } from "./math.js";
18
- import { getNetworkIcon as ge } from "./network-icons.js";
19
- import { bnToLiquidationPriceView as de, isPositiveFloat as ue, parseInputToBN as he, parseSmallNumber as ve } from "./parse-input-to-bn.js";
20
- import { pluralize as be, selectPluralString as Ae } from "./plural.js";
17
+ import { decimalsToStep as ie, findClosestPoint as fe, formatWithDecimals as se, formatWithoutDecimals as le, splitInterval as xe, validateMinMax as Te } from "./math.js";
18
+ import { getNetworkIcon as ce } from "./network-icons.js";
19
+ import { bnToLiquidationPriceView as de, isPositiveFloat as ue, parseInputToBN as he, parseSmallNumber as Ae } from "./parse-input-to-bn.js";
20
+ import { pluralize as ye, selectPluralString as Pe } from "./plural.js";
21
21
  import { getAvailableRanges as Ne } from "./ranges.js";
22
- import { extractTextFromLabel as Le, serializeValue as ye } from "./react.js";
22
+ import { extractTextFromLabel as Ie, serializeValue as ke } from "./react.js";
23
23
  import { searchInString as we } from "./search.js";
24
24
  import { createTokenSearchFilter as De, searchInToken as Oe } from "./search-in-token.js";
25
- import { shortSHA as Be } from "./short-sha.js";
26
- import { isLongString as Re, shortenString as _e } from "./shorten-string.js";
27
- import { negativeTokenTemplate as He, tokenTemplate as We, tokenTemplateNumber as Ze, tokenTemplateString as ze } from "./templates.js";
28
- import { getTokenIcon as Xe, parseShareTokenUnderlying as qe } from "./token-icon-source.js";
29
- import { TTL_CONSTANTS as Ge, getTTLZones as Je, ttlFromTimestamp as Ke, ttlLeft as Qe, ttlLeftHuman as Ye } from "./ttl.js";
30
- import { openInNewWindow as eo } from "./window.js";
31
- import { Z_INDEX as ro, Z_INDEX_VALUES as to } from "./z-index.js";
25
+ import { shortSHA as Re } from "./short-sha.js";
26
+ import { isLongString as Me, shortenString as _e } from "./shorten-string.js";
27
+ import { strategyApyPartsAtLeverage as He, strategyNetApyAtLeverage as We, strategyQuotaRate as Ze } from "./strategy-apy.js";
28
+ import { negativeTokenTemplate as Ue, tokenTemplate as Xe, tokenTemplateNumber as qe, tokenTemplateString as Qe } from "./templates.js";
29
+ import { getTokenIcon as Ge, parseShareTokenUnderlying as Je } from "./token-icon-source.js";
30
+ import { TTL_CONSTANTS as Ye, getTTLZones as $e, ttlFromTimestamp as eo, ttlLeft as oo, ttlLeftHuman as ro } from "./ttl.js";
31
+ import { openInNewWindow as ao } from "./window.js";
32
+ import { Z_INDEX as no, Z_INDEX_VALUES as po } from "./z-index.js";
32
33
  export {
33
34
  X as FORMAT_CONSTANTS,
34
- Ge as TTL_CONSTANTS,
35
- ro as Z_INDEX,
36
- to as Z_INDEX_VALUES,
35
+ Ye as TTL_CONSTANTS,
36
+ no as Z_INDEX,
37
+ po as Z_INDEX_VALUES,
37
38
  ae as allLoaded,
38
- l as bnToInputView,
39
+ s as bnToInputView,
39
40
  de as bnToLiquidationPriceView,
40
41
  x as bnToPrettyView,
41
- c as bpsToPercent,
42
+ g as bpsToPercent,
42
43
  S as cn,
43
- L as convertPercent,
44
+ I as convertPercent,
44
45
  N as copyToClipboard,
45
46
  De as createTokenSearchFilter,
46
- pe as decimalsToStep,
47
+ ie as decimalsToStep,
47
48
  d as default,
48
- Le as extractTextFromLabel,
49
+ Ie as extractTextFromLabel,
49
50
  fe as findClosestPoint,
50
51
  V as formatAssetAmount,
51
- y as formatBytecodeSize,
52
+ k as formatBytecodeSize,
52
53
  C as formatBytecodeVersion,
53
54
  oe as formatChipLeverage,
54
55
  _ as formatCompactPercent,
55
- M as formatLeverage,
56
+ B as formatLeverage,
56
57
  E as formatMoney,
57
58
  H as formatMoneyAmount,
58
59
  q as formatNumberWithSuffix,
59
60
  W as formatPercentAmount,
60
- j as formatPrice,
61
+ Q as formatPrice,
61
62
  w as formatTimestamp,
62
- le as formatWithDecimals,
63
- se as formatWithoutDecimals,
63
+ se as formatWithDecimals,
64
+ le as formatWithoutDecimals,
64
65
  h as generateColorsFromBase,
65
66
  r as generateId,
66
- G as getAdaptiveDecimals,
67
+ j as getAdaptiveDecimals,
67
68
  Ne as getAvailableRanges,
68
- v as getCSSVariable,
69
- ge as getNetworkIcon,
70
- Je as getTTLZones,
71
- Xe as getTokenIcon,
72
- P as hexToRgba,
73
- b as hslToHex,
74
- J as isBelowDisplayThreshold,
75
- K as isEffectivelyZero,
76
- Re as isLongString,
69
+ A as getCSSVariable,
70
+ ce as getNetworkIcon,
71
+ $e as getTTLZones,
72
+ Ge as getTokenIcon,
73
+ v as hexToRgba,
74
+ y as hslToHex,
75
+ G as isBelowDisplayThreshold,
76
+ J as isEffectivelyZero,
77
+ Me as isLongString,
77
78
  ue as isPositiveFloat,
78
79
  re as leveragePresets,
79
80
  me as loadingProgress,
80
- He as negativeTokenTemplate,
81
- eo as openInNewWindow,
81
+ Ue as negativeTokenTemplate,
82
+ ao as openInNewWindow,
82
83
  he as parseInputToBN,
83
- qe as parseShareTokenUnderlying,
84
- ve as parseSmallNumber,
84
+ Je as parseShareTokenUnderlying,
85
+ Ae as parseSmallNumber,
85
86
  Z as percentTemplate,
86
87
  z as percentageTemplate,
87
- be as pluralize,
88
+ ye as pluralize,
88
89
  m as pointProgramsOf,
89
90
  n as positiveTokenRewardsOf,
90
- A as resolveCSSColor,
91
+ P as resolveCSSColor,
91
92
  ne as round5,
92
93
  we as searchInString,
93
94
  Oe as searchInToken,
94
- Ae as selectPluralString,
95
- ye as serializeValue,
96
- Be as shortSHA,
95
+ Pe as selectPluralString,
96
+ ke as serializeValue,
97
+ Re as shortSHA,
97
98
  F as shortenHash,
98
99
  _e as shortenString,
99
100
  D as significantTrunc,
100
101
  $ as slippageTemplate,
101
102
  xe as splitInterval,
102
- Q as toSignificantDigits,
103
- i as tokenRewardsOf,
104
- We as tokenTemplate,
105
- Ze as tokenTemplateNumber,
106
- ze as tokenTemplateString,
107
- p as totalApyOf,
108
- Ke as ttlFromTimestamp,
109
- Qe as ttlLeft,
110
- Ye as ttlLeftHuman,
103
+ He as strategyApyPartsAtLeverage,
104
+ We as strategyNetApyAtLeverage,
105
+ Ze as strategyQuotaRate,
106
+ K as toSignificantDigits,
107
+ p as tokenRewardsOf,
108
+ Xe as tokenTemplate,
109
+ qe as tokenTemplateNumber,
110
+ Qe as tokenTemplateString,
111
+ i as totalApyOf,
112
+ eo as ttlFromTimestamp,
113
+ oo as ttlLeft,
114
+ ro as ttlLeftHuman,
111
115
  t as useFormFieldIds,
112
116
  Te as validateMinMax
113
117
  };
@@ -0,0 +1,41 @@
1
+ function e({
2
+ additionalBorrowApy: o = 0,
3
+ maxLeverage: t
4
+ }) {
5
+ return t != null && t > 0 ? o / t : 0;
6
+ }
7
+ function i({
8
+ leverage: o,
9
+ maxLeverage: t,
10
+ borrowApy: r = 0,
11
+ additionalBorrowApy: u = 0
12
+ }) {
13
+ const n = Math.max(o - 1, 0), s = r * n, a = e({ additionalBorrowApy: u, maxLeverage: t }), c = a * o;
14
+ return {
15
+ debtMultiplier: n,
16
+ borrowCost: s,
17
+ quotaRate: a,
18
+ quotaCost: c,
19
+ totalCost: s + c
20
+ };
21
+ }
22
+ function y({
23
+ collateralApy: o,
24
+ leverage: t,
25
+ maxLeverage: r,
26
+ borrowApy: u,
27
+ additionalBorrowApy: n
28
+ }) {
29
+ const { totalCost: s } = i({
30
+ leverage: t,
31
+ maxLeverage: r,
32
+ borrowApy: u,
33
+ additionalBorrowApy: n
34
+ });
35
+ return o * t - s;
36
+ }
37
+ export {
38
+ i as strategyApyPartsAtLeverage,
39
+ y as strategyNetApyAtLeverage,
40
+ e as strategyQuotaRate
41
+ };
@@ -16,6 +16,7 @@ export * from './more-accordion';
16
16
  export * from './nested-info-stack';
17
17
  export * from './page-title';
18
18
  export * from './pool-apy-breakdown-card';
19
+ export * from './position-assets';
19
20
  export * from './review-button';
20
21
  export * from './section-heading';
21
22
  export * from './segmented-tabs';
@@ -0,0 +1,5 @@
1
+ export declare class PositionAssetsTest {
2
+ static root: string;
3
+ static row: string;
4
+ static empty: string;
5
+ }
@@ -0,0 +1,2 @@
1
+ export { PositionAssetsTest } from './constants';
2
+ export { PositionAssets, type PositionAssetsProps } from './position-assets';
@@ -0,0 +1,49 @@
1
+ import { TokenAmount } from '@gearbox-protocol/sdk/model';
2
+ import { default as React } from 'react';
3
+ import { PositionAssetsTest } from './constants';
4
+ export { PositionAssetsTest };
5
+ export interface PositionAssetsProps {
6
+ /** What this side holds. */
7
+ readonly assets?: readonly TokenAmount[];
8
+ /**
9
+ * The list this one is shown against — the other slot of the same row.
10
+ * Never rendered: it only joins the row set and the order, so two lists in
11
+ * `value` and `valueTo` list the same tokens in the same order and their
12
+ * rows line up. Pass each side the other one.
13
+ */
14
+ readonly against?: readonly TokenAmount[];
15
+ /** Rendered in place of the rows when nothing survives the dust filter. */
16
+ readonly empty?: React.ReactNode;
17
+ readonly testId?: string;
18
+ }
19
+ /**
20
+ * Holdings token by token, most valuable first — the position itself rather
21
+ * than the one number its collateral adds up to. A right-aligned column, so it
22
+ * reads as the value of the `InfoLine` a caller drops it into, in either slot.
23
+ *
24
+ * The rows carry no label of their own, which is why they are not `InfoLine`s:
25
+ * `VerticalIndicator` leaves out its left column entirely when no label is
26
+ * given and never justifies what remains, so a label-less row would sit on the
27
+ * wrong side.
28
+ *
29
+ * Dust is left out: an account carries stray fractions of a cent from
30
+ * rounding, and listing them buries the holdings that matter. A token the
31
+ * oracle cannot price is never dust — an unknown value is not a small one.
32
+ */
33
+ export declare function PositionAssets({ assets, against, empty, testId, }: PositionAssetsProps): React.ReactElement;
34
+ /** One token as a side lists it. */
35
+ export interface AssetRow {
36
+ readonly token: TokenAmount["token"];
37
+ /** What this side holds — zero for a token only the other side has. */
38
+ readonly value: bigint;
39
+ /**
40
+ * What the token is worth at its richer side, which is what decides both
41
+ * dust and order. `null` when a side the oracle cannot price is involved.
42
+ */
43
+ readonly worth: number | null;
44
+ }
45
+ /**
46
+ * What earns a row, most valuable first — decided across both sides, so the
47
+ * order is a property of the pair rather than of the side that renders it.
48
+ */
49
+ export declare function visibleAssets(assets: readonly TokenAmount[] | undefined, against?: readonly TokenAmount[]): AssetRow[];
@@ -2,4 +2,5 @@ export declare class StatBadgeTest {
2
2
  static root: string;
3
3
  static grid: string;
4
4
  static action: string;
5
+ static delta: string;
5
6
  }
@@ -3,10 +3,20 @@ import { TitleText } from '../text';
3
3
  import { StatBadgeTest } from './constants';
4
4
  export { StatBadgeTest };
5
5
  export type StatBadgeSize = "sm" | "md" | "default";
6
+ export interface StatBadgeDelta {
7
+ /** Formatted change, e.g. `"12.50%"`. Sign is taken from `value`, not this string. */
8
+ readonly label: ReactNode;
9
+ /** Signed change; `> 0` is success, `< 0` is destructive. */
10
+ readonly value: number;
11
+ /** Period hint shown on hover, e.g. `"7D"`. */
12
+ readonly tooltip?: ReactNode;
13
+ }
6
14
  export interface StatBadgeProps {
7
15
  /** A messageId (formatted here) or a node. */
8
16
  readonly title: TitleText;
9
17
  readonly value: React.ReactNode;
18
+ /** Optional change chip in the top-right of the card. Hidden while `isLoading`. */
19
+ readonly delta?: StatBadgeDelta;
10
20
  /** Optional control in the top-right of the card, e.g. a Claim button. */
11
21
  readonly action?: ReactNode;
12
22
  readonly className?: string;
@@ -16,7 +26,7 @@ export interface StatBadgeProps {
16
26
  readonly testId?: string;
17
27
  readonly size?: StatBadgeSize;
18
28
  }
19
- export declare function StatBadge({ title, value, isLoading, size, action, className, testId, }: StatBadgeProps): React.ReactElement;
29
+ export declare function StatBadge({ title, value, isLoading, size, delta, action, className, testId, }: StatBadgeProps): React.ReactElement;
20
30
  export interface StatBadgeGridProps {
21
31
  readonly cols?: 1 | 2 | 3 | 4;
22
32
  readonly colsLg?: 1 | 2 | 3 | 4;
@@ -7,6 +7,18 @@ export interface StrategyApyBreakdownData {
7
7
  readonly borrowApy?: Bps;
8
8
  readonly additionalBorrowApy?: Bps;
9
9
  readonly maxLeverage?: Leverage;
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.
20
+ */
21
+ readonly netApy?: ApyBreakdown;
10
22
  }
11
23
  export interface StrategyApyBreakdownCardProps {
12
24
  readonly data: StrategyApyBreakdownData;
@@ -10,8 +10,8 @@ export interface TabberSectionProps {
10
10
  readonly actions?: React.ReactNode;
11
11
  readonly children?: React.ReactNode;
12
12
  /**
13
- * Render this section above the sticky tab bar (overview badges). The tab
14
- * still appears in the bar and scroll-spy still tracks the section.
13
+ * Render this section above the sticky tab bar (overview badges). The
14
+ * section is not listed in the bar; scroll-spy tracks only sections below it.
15
15
  */
16
16
  readonly beforeBar?: boolean;
17
17
  /** Skip the in-section h2 — overview has badges, not a heading. */
@@ -36,6 +36,10 @@ export declare function HealthFactorValue({ data, }: {
36
36
  * A bare `bigint` in token units (simulate previews carry these): the only
37
37
  * value component that needs a denomination passed with it, because the SDK
38
38
  * hands these out without one.
39
+ *
40
+ * Shown to `formatAssetAmount`'s three decimals, with the exact amount in a
41
+ * tooltip — a metrics row reads better short, and nothing is lost: the figure
42
+ * behind the rounding stays a hover away.
39
43
  */
40
44
  export declare function TokenBigint({ data, token, }: {
41
45
  readonly data: bigint | undefined;
@@ -220,7 +220,8 @@ declare const _default: {
220
220
  "components.strategyApyBreakdownCard.collateralApy": "Collateral APY",
221
221
  "components.strategyApyBreakdownCard.incentiveApy": "Incentive APY",
222
222
  "components.strategyApyBreakdownCard.borrowRate": "Borrow Rate",
223
- "components.strategyApyBreakdownCard.formula": "{base} × {leverage} Lev.",
223
+ "components.strategyApyBreakdownCard.quotaRate": "Quota Rate",
224
+ "components.strategyApyBreakdownCard.formula": "{leverage} × {base}",
224
225
 
225
226
  "components.leveragePresetChips.label": "Leverage:",
226
227
 
@@ -27,6 +27,7 @@ export * from './search-in-token';
27
27
  export * from './short-sha';
28
28
  export * from './shorten-string';
29
29
  export type { SortField as UtilsSortField, SortType } from './sort';
30
+ export * from './strategy-apy';
30
31
  export * from './templates';
31
32
  export * from './token-icon-source';
32
33
  export * from './ttl';
@@ -0,0 +1,37 @@
1
+ import { Bps, Leverage } from '@gearbox-protocol/sdk/model';
2
+ /**
3
+ * Quota rate at 1x. `additionalBorrowApy` from the SDK is already scaled to
4
+ * {@link maxLeverage} (`quotaRate × (1 + feeInterest) × maxLeverage`).
5
+ */
6
+ export declare function strategyQuotaRate({ additionalBorrowApy, maxLeverage, }: {
7
+ readonly additionalBorrowApy?: Bps;
8
+ readonly maxLeverage?: Leverage;
9
+ }): Bps;
10
+ /**
11
+ * Borrow + quota cost of a strategy at leverage `l`, in bps.
12
+ *
13
+ * `cost = borrowApy × max(l − 1, 0) + quotaRate × l`
14
+ */
15
+ export declare function strategyApyPartsAtLeverage({ leverage, maxLeverage, borrowApy, additionalBorrowApy, }: {
16
+ readonly leverage: Leverage;
17
+ readonly maxLeverage?: Leverage;
18
+ readonly borrowApy?: Bps;
19
+ readonly additionalBorrowApy?: Bps;
20
+ }): {
21
+ readonly debtMultiplier: number;
22
+ readonly borrowCost: Bps;
23
+ readonly quotaRate: Bps;
24
+ readonly quotaCost: Bps;
25
+ readonly totalCost: Bps;
26
+ };
27
+ /**
28
+ * Net strategy APY at leverage `l`, in bps:
29
+ * `collateralApy × l − cost(l)`.
30
+ */
31
+ export declare function strategyNetApyAtLeverage({ collateralApy, leverage, maxLeverage, borrowApy, additionalBorrowApy, }: {
32
+ readonly collateralApy: Bps;
33
+ readonly leverage: Leverage;
34
+ readonly maxLeverage?: Leverage;
35
+ readonly borrowApy?: Bps;
36
+ readonly additionalBorrowApy?: Bps;
37
+ }): Bps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/ui-kit",
3
- "version": "4.0.0-next.15",
3
+ "version": "4.0.0-next.17",
4
4
  "description": "Internal UI components",
5
5
  "repository": {
6
6
  "type": "git",