@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/esm/index.js CHANGED
@@ -292,29 +292,29 @@ import { searchInString as Yd } from "./utils/search.js";
292
292
  import { createTokenSearchFilter as Jd, searchInToken as $d } from "./utils/search-in-token.js";
293
293
  import { shortSHA as og } from "./utils/short-sha.js";
294
294
  import { isLongString as tg, shortenString as ag } from "./utils/shorten-string.js";
295
- import { strategyApyPartsAtLeverage as ng, strategyNetApyAtLeverage as pg, strategyQuotaRate as mg } from "./utils/strategy-apy.js";
296
- import { negativeTokenTemplate as fg, tokenTemplate as sg, tokenTemplateNumber as xg, tokenTemplateString as Tg } from "./utils/templates.js";
297
- import { getTokenIcon as gg, parseShareTokenUnderlying as cg } from "./utils/token-icon-source.js";
298
- import { TTL_CONSTANTS as Sg, getTTLZones as Cg, ttlFromTimestamp as Ag, ttlLeft as bg, ttlLeftHuman as Pg } from "./utils/ttl.js";
299
- import { openInNewWindow as Lg } from "./utils/window.js";
300
- import { Z_INDEX as hg, Z_INDEX_VALUES as kg } from "./utils/z-index.js";
301
- import { AmountInputTest as Vg } from "./components/base/amount-input/constants.js";
302
- import { DetailedPageTitleTest as Fg } from "./components/base/detailed-page-title/constants.js";
303
- import { DetailsViewTest as yg } from "./components/base/details-view/constants.js";
304
- import { HistoryChartTest as Eg } from "./components/base/history-chart/constants.js";
305
- import { InfoListTest as Hg } from "./components/base/info-list/constants.js";
306
- import { LeverageInputTest as Ng } from "./components/base/leverage-input/constants.js";
307
- import { ManagePaneTest as Gg } from "./components/base/manage-pane/constants.js";
308
- import { PageTitleTest as Ug } from "./components/base/page-title/constants.js";
309
- import { ReviewButtonTest as Zg } from "./components/base/review-button/constants.js";
310
- import { SectionHeadingTest as zg } from "./components/base/section-heading/constants.js";
311
- import { SegmentedTabsTest as Qg } from "./components/base/segmented-tabs/constants.js";
312
- import { StackTest as jg } from "./components/base/stack/constants.js";
313
- import { StatBadgeTest as $g } from "./components/base/stat-badge/constants.js";
314
- import { StickyBarTest as oc } from "./components/base/sticky-bar/constants.js";
315
- import { TabberTest as tc } from "./components/base/tabber/constants.js";
316
- import { TokenAmountTest as ic } from "./components/base/token-amount/constants.js";
317
- import { BaseTableLineTest as pc, BaseTableTest as mc } from "./components/base-table/constants.js";
295
+ import { strategyApyPartsAtLeverage as ng, strategyNetApyAtLeverage as pg } from "./utils/strategy-apy.js";
296
+ import { negativeTokenTemplate as lg, tokenTemplate as fg, tokenTemplateNumber as sg, tokenTemplateString as xg } from "./utils/templates.js";
297
+ import { getTokenIcon as dg, parseShareTokenUnderlying as gg } from "./utils/token-icon-source.js";
298
+ import { TTL_CONSTANTS as ug, getTTLZones as Sg, ttlFromTimestamp as Cg, ttlLeft as Ag, ttlLeftHuman as bg } from "./utils/ttl.js";
299
+ import { openInNewWindow as Dg } from "./utils/window.js";
300
+ import { Z_INDEX as Bg, Z_INDEX_VALUES as hg } from "./utils/z-index.js";
301
+ import { AmountInputTest as Ig } from "./components/base/amount-input/constants.js";
302
+ import { DetailedPageTitleTest as wg } from "./components/base/detailed-page-title/constants.js";
303
+ import { DetailsViewTest as Mg } from "./components/base/details-view/constants.js";
304
+ import { HistoryChartTest as Rg } from "./components/base/history-chart/constants.js";
305
+ import { InfoListTest as vg } from "./components/base/info-list/constants.js";
306
+ import { LeverageInputTest as _g } from "./components/base/leverage-input/constants.js";
307
+ import { ManagePaneTest as Og } from "./components/base/manage-pane/constants.js";
308
+ import { PageTitleTest as Wg } from "./components/base/page-title/constants.js";
309
+ import { ReviewButtonTest as qg } from "./components/base/review-button/constants.js";
310
+ import { SectionHeadingTest as Xg } from "./components/base/section-heading/constants.js";
311
+ import { SegmentedTabsTest as Kg } from "./components/base/segmented-tabs/constants.js";
312
+ import { StackTest as Yg } from "./components/base/stack/constants.js";
313
+ import { StatBadgeTest as Jg } from "./components/base/stat-badge/constants.js";
314
+ import { StickyBarTest as ec } from "./components/base/sticky-bar/constants.js";
315
+ import { TabberTest as rc } from "./components/base/tabber/constants.js";
316
+ import { TokenAmountTest as ac } from "./components/base/token-amount/constants.js";
317
+ import { BaseTableLineTest as nc, BaseTableTest as pc } from "./components/base-table/constants.js";
318
318
  export {
319
319
  Wo as Accordion,
320
320
  Uo as AccordionContent,
@@ -336,7 +336,7 @@ export {
336
336
  yt as AllocationWheel,
337
337
  Ht as AllocationWheelTest,
338
338
  r as AmountInput,
339
- Vg as AmountInputTest,
339
+ Ig as AmountInputTest,
340
340
  fr as AppBar,
341
341
  sr as AppBarCenter,
342
342
  xr as AppBarCenterContent,
@@ -358,8 +358,8 @@ export {
358
358
  wr as BaseLink,
359
359
  Mr as BaseTable,
360
360
  Rr as BaseTableLine,
361
- pc as BaseTableLineTest,
362
- mc as BaseTableTest,
361
+ nc as BaseTableLineTest,
362
+ pc as BaseTableTest,
363
363
  wm as BlockedRegionDialog,
364
364
  n as BorrowRateBlock,
365
365
  m as BorrowRateBlockTest,
@@ -400,11 +400,11 @@ export {
400
400
  d as DetailedPageTitle,
401
401
  Na as DetailedPageTitleCopyButton,
402
402
  Ga as DetailedPageTitleExplorerDropdown,
403
- Fg as DetailedPageTitleTest,
403
+ wg as DetailedPageTitleTest,
404
404
  A as DetailsView,
405
405
  b as DetailsViewLeftPane,
406
406
  P as DetailsViewManagePane,
407
- yg as DetailsViewTest,
407
+ Mg as DetailsViewTest,
408
408
  Za as Dialog,
409
409
  Qa as DialogContainer,
410
410
  ja as DialogContent,
@@ -487,12 +487,12 @@ export {
487
487
  mp as HelpTip,
488
488
  lp as HelpTipIcon,
489
489
  I as HistoryChart,
490
- Eg as HistoryChartTest,
490
+ Rg as HistoryChartTest,
491
491
  dp as IconButton,
492
492
  am as InfiniteScrollWrapper,
493
493
  w as InfoLine,
494
494
  F as InfoList,
495
- Hg as InfoListTest,
495
+ vg as InfoListTest,
496
496
  E as InfoPortalOut,
497
497
  v as InfoPortalProvider,
498
498
  M as InfoSectionTitle,
@@ -506,7 +506,7 @@ export {
506
506
  Em as LegalAgreementPanel,
507
507
  vm as LegalAgreementPanelTest,
508
508
  _ as LeverageInput,
509
- Ng as LeverageInputTest,
509
+ _g as LeverageInputTest,
510
510
  W as LeveragePresetChips,
511
511
  O as LeveragePresetChipsTest,
512
512
  vo as LeverageValue,
@@ -524,7 +524,7 @@ export {
524
524
  ee as ManagePaneMessage,
525
525
  oe as ManagePaneTab,
526
526
  re as ManagePaneTabDropdown,
527
- Gg as ManagePaneTest,
527
+ Og as ManagePaneTest,
528
528
  Ua as Modal,
529
529
  ne as MoreAccordion,
530
530
  ae as MoreAccordionTest,
@@ -540,7 +540,7 @@ export {
540
540
  Ti as OneFieldDialog,
541
541
  xe as PageHeadProvider,
542
542
  Te as PageTitle,
543
- Ug as PageTitleTest,
543
+ Wg as PageTitleTest,
544
544
  Lo as PnlValue,
545
545
  gl as PointsIcon,
546
546
  y as PointsInfoLine,
@@ -566,7 +566,7 @@ export {
566
566
  Ll as RWA_POOL_ROW_HOVER_WRAPPER_CLASS,
567
567
  nt as RangeButtons,
568
568
  De as ReviewButton,
569
- Zg as ReviewButtonTest,
569
+ qg as ReviewButtonTest,
570
570
  Cl as RoundedImage,
571
571
  ke as SEGMENTED_TABS_INACTIVE_BUTTON_CLASS,
572
572
  Re as SPACE_HEIGHT,
@@ -575,10 +575,10 @@ export {
575
575
  hl as SdkStatusPillTest,
576
576
  Ml as SearchLine,
577
577
  Be as SectionHeading,
578
- zg as SectionHeadingTest,
578
+ Xg as SectionHeadingTest,
579
579
  Hl as SegmentedControl,
580
580
  Ie as SegmentedTabs,
581
- Qg as SegmentedTabsTest,
581
+ Kg as SegmentedTabsTest,
582
582
  Ol as Select,
583
583
  Gl as SelectContent,
584
584
  Wl as SelectGroup,
@@ -611,14 +611,14 @@ export {
611
611
  Ef as SpinnerOverlay,
612
612
  Nf as SplitList,
613
613
  He as Stack,
614
- jg as StackTest,
614
+ Yg as StackTest,
615
615
  Ne as StatBadge,
616
616
  Oe as StatBadgeGrid,
617
- $g as StatBadgeTest,
617
+ Jg as StatBadgeTest,
618
618
  Zf as StatusBars,
619
619
  Gf as StatusDot,
620
620
  We as StickyBar,
621
- oc as StickyBarTest,
621
+ ec as StickyBarTest,
622
622
  Xe as StrategyApyBreakdownCard,
623
623
  qe as StrategyApyBreakdownCardTest,
624
624
  kt as StyledButton,
@@ -627,13 +627,13 @@ export {
627
627
  kf as THEME_COLOR_MAP,
628
628
  If as THUMB_HALF,
629
629
  Vf as THUMB_SIZE,
630
- Sg as TTL_CONSTANTS,
630
+ ug as TTL_CONSTANTS,
631
631
  mt as TabButton,
632
632
  zf as TabControl,
633
633
  Kf as TabItem,
634
634
  Ke as Tabber,
635
635
  Qe as TabberSection,
636
- tc as TabberTest,
636
+ rc as TabberTest,
637
637
  Ss as Table,
638
638
  Cs as TableBody,
639
639
  As as TableCaption,
@@ -662,7 +662,7 @@ export {
662
662
  mo as TitleMeta,
663
663
  no as TitleMetaTest,
664
664
  fo as TokenAmount,
665
- ic as TokenAmountTest,
665
+ ac as TokenAmountTest,
666
666
  Ho as TokenBigint,
667
667
  $s as TokenIcon,
668
668
  go as TokenPairSymbol,
@@ -702,8 +702,8 @@ export {
702
702
  yl as WithSearchLine,
703
703
  wx as WithTitle,
704
704
  Mx as YieldBreakdownTooltip,
705
- hg as Z_INDEX,
706
- kg as Z_INDEX_VALUES,
705
+ Bg as Z_INDEX,
706
+ hg as Z_INDEX_VALUES,
707
707
  Ko as alertBadgeVariants,
708
708
  Ld as allLoaded,
709
709
  zr as backButtonVariants,
@@ -791,9 +791,9 @@ export {
791
791
  Hn as getSeriesColorPalette,
792
792
  Qx as getSortForField,
793
793
  Yx as getSortForFields,
794
- Cg as getTTLZones,
794
+ Sg as getTTLZones,
795
795
  Ff as getThumbInBoundsOffset,
796
- gg as getTokenIcon,
796
+ dg as getTokenIcon,
797
797
  _n as getVerticalLineLabelStyle,
798
798
  Nn as getVerticalLineTooltipContent,
799
799
  wn as getXFormatter,
@@ -828,12 +828,12 @@ export {
828
828
  Pd as leveragePresets,
829
829
  Bd as loadingProgress,
830
830
  Lf as makeMarkerPoints,
831
- fg as negativeTokenTemplate,
831
+ lg as negativeTokenTemplate,
832
832
  jx as nextMultiSortState,
833
- Lg as openInNewWindow,
833
+ Dg as openInNewWindow,
834
834
  Hx as paddingVariants,
835
835
  Nd as parseInputToBN,
836
- cg as parseShareTokenUnderlying,
836
+ gg as parseShareTokenUnderlying,
837
837
  Od as parseSmallNumber,
838
838
  md as percentTemplate,
839
839
  ld as percentageTemplate,
@@ -866,7 +866,6 @@ export {
866
866
  Wf as statusDotVariants,
867
867
  ng as strategyApyPartsAtLeverage,
868
868
  pg as strategyNetApyAtLeverage,
869
- mg as strategyQuotaRate,
870
869
  Ur as subscribeBreakpoints,
871
870
  hs as tableCellVariants,
872
871
  ks as tableHeadVariants,
@@ -875,17 +874,17 @@ export {
875
874
  js as tipCardVariants,
876
875
  ud as toSignificantDigits,
877
876
  IT as tokenRewardsOf,
878
- sg as tokenTemplate,
879
- xg as tokenTemplateNumber,
880
- Tg as tokenTemplateString,
877
+ fg as tokenTemplate,
878
+ sg as tokenTemplateNumber,
879
+ xg as tokenTemplateString,
881
880
  VT as totalApyOf,
882
881
  aa as transactionConfirmDialogShellVariants,
883
882
  ia as transactionConfirmModalContainerVariants,
884
883
  na as transactionConfirmPreviewScrollVariants,
885
884
  pa as transactionConfirmShellContentVariants,
886
- Ag as ttlFromTimestamp,
887
- bg as ttlLeft,
888
- Pg as ttlLeftHuman,
885
+ Cg as ttlFromTimestamp,
886
+ Ag as ttlLeft,
887
+ bg as ttlLeftHuman,
889
888
  bx as typographyVariants,
890
889
  qr as useBreakpointContext,
891
890
  Gx as useCheckboxSelect,
@@ -8,9 +8,9 @@ import { generateColorsFromBase as h, getCSSVariable as A, hexToRgba as v, hslTo
8
8
  import { copyToClipboard as N } from "./copy.js";
9
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 B } from "./format-leverage.js";
11
+ import { formatLeverage as M } 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 Q, getAdaptiveDecimals as j, isBelowDisplayThreshold as G, isEffectivelyZero as J, toSignificantDigits as K } from "./format-number.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";
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";
@@ -22,19 +22,19 @@ import { getAvailableRanges as Ne } from "./ranges.js";
22
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 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";
25
+ import { shortSHA as Be } from "./short-sha.js";
26
+ import { isLongString as Re, shortenString as _e } from "./shorten-string.js";
27
+ import { strategyApyPartsAtLeverage as He, strategyNetApyAtLeverage as We } from "./strategy-apy.js";
28
+ import { negativeTokenTemplate as ze, tokenTemplate as Ue, tokenTemplateNumber as Xe, tokenTemplateString as qe } from "./templates.js";
29
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";
30
+ import { TTL_CONSTANTS as Qe, getTTLZones as Ye, ttlFromTimestamp as $e, ttlLeft as eo, ttlLeftHuman as oo } from "./ttl.js";
31
+ import { openInNewWindow as to } from "./window.js";
32
+ import { Z_INDEX as mo, Z_INDEX_VALUES as no } from "./z-index.js";
33
33
  export {
34
34
  X as FORMAT_CONSTANTS,
35
- Ye as TTL_CONSTANTS,
36
- no as Z_INDEX,
37
- po as Z_INDEX_VALUES,
35
+ Qe as TTL_CONSTANTS,
36
+ mo as Z_INDEX,
37
+ no as Z_INDEX_VALUES,
38
38
  ae as allLoaded,
39
39
  s as bnToInputView,
40
40
  de as bnToLiquidationPriceView,
@@ -53,33 +53,33 @@ export {
53
53
  C as formatBytecodeVersion,
54
54
  oe as formatChipLeverage,
55
55
  _ as formatCompactPercent,
56
- B as formatLeverage,
56
+ M as formatLeverage,
57
57
  E as formatMoney,
58
58
  H as formatMoneyAmount,
59
59
  q as formatNumberWithSuffix,
60
60
  W as formatPercentAmount,
61
- Q as formatPrice,
61
+ j as formatPrice,
62
62
  w as formatTimestamp,
63
63
  se as formatWithDecimals,
64
64
  le as formatWithoutDecimals,
65
65
  h as generateColorsFromBase,
66
66
  r as generateId,
67
- j as getAdaptiveDecimals,
67
+ G as getAdaptiveDecimals,
68
68
  Ne as getAvailableRanges,
69
69
  A as getCSSVariable,
70
70
  ce as getNetworkIcon,
71
- $e as getTTLZones,
71
+ Ye as getTTLZones,
72
72
  Ge as getTokenIcon,
73
73
  v as hexToRgba,
74
74
  y as hslToHex,
75
- G as isBelowDisplayThreshold,
76
- J as isEffectivelyZero,
77
- Me as isLongString,
75
+ J as isBelowDisplayThreshold,
76
+ K as isEffectivelyZero,
77
+ Re as isLongString,
78
78
  ue as isPositiveFloat,
79
79
  re as leveragePresets,
80
80
  me as loadingProgress,
81
- Ue as negativeTokenTemplate,
82
- ao as openInNewWindow,
81
+ ze as negativeTokenTemplate,
82
+ to as openInNewWindow,
83
83
  he as parseInputToBN,
84
84
  Je as parseShareTokenUnderlying,
85
85
  Ae as parseSmallNumber,
@@ -94,7 +94,7 @@ export {
94
94
  Oe as searchInToken,
95
95
  Pe as selectPluralString,
96
96
  ke as serializeValue,
97
- Re as shortSHA,
97
+ Be as shortSHA,
98
98
  F as shortenHash,
99
99
  _e as shortenString,
100
100
  D as significantTrunc,
@@ -102,16 +102,15 @@ export {
102
102
  xe as splitInterval,
103
103
  He as strategyApyPartsAtLeverage,
104
104
  We as strategyNetApyAtLeverage,
105
- Ze as strategyQuotaRate,
106
- K as toSignificantDigits,
105
+ Q as toSignificantDigits,
107
106
  p as tokenRewardsOf,
108
- Xe as tokenTemplate,
109
- qe as tokenTemplateNumber,
110
- Qe as tokenTemplateString,
107
+ Ue as tokenTemplate,
108
+ Xe as tokenTemplateNumber,
109
+ qe as tokenTemplateString,
111
110
  i as totalApyOf,
112
- eo as ttlFromTimestamp,
113
- oo as ttlLeft,
114
- ro as ttlLeftHuman,
111
+ $e as ttlFromTimestamp,
112
+ eo as ttlLeft,
113
+ oo as ttlLeftHuman,
115
114
  t as useFormFieldIds,
116
115
  Te as validateMinMax
117
116
  };
@@ -1,41 +1,51 @@
1
- function e({
2
- additionalBorrowApy: o = 0,
3
- maxLeverage: t
4
- }) {
5
- return t != null && t > 0 ? o / t : 0;
1
+ import { calcEffectiveBorrowApy as o, calcNetStrategyApy as u } from "@gearbox-protocol/sdk";
2
+ function f(t, e, r) {
3
+ switch (r) {
4
+ case "min":
5
+ return Math.max(t - 1, 0);
6
+ case "aggressive":
7
+ return 1.05 * Math.max(t - 1, 0);
8
+ default:
9
+ return t * e / 1e4;
10
+ }
6
11
  }
7
- function i({
8
- leverage: o,
9
- maxLeverage: t,
10
- borrowApy: r = 0,
11
- additionalBorrowApy: u = 0
12
+ function m({
13
+ leverage: t,
14
+ borrowApy: e = 0,
15
+ quotaRate: r = 0,
16
+ liquidationThreshold: s = 0,
17
+ quotaMode: a = "safe"
12
18
  }) {
13
- const n = Math.max(o - 1, 0), s = r * n, a = e({ additionalBorrowApy: u, maxLeverage: t }), c = a * o;
19
+ const c = {
20
+ borrowApy: e,
21
+ quotaRate: r,
22
+ liquidationThreshold: s
23
+ }, n = Math.max(t - 1, 0), i = f(t, s, a);
14
24
  return {
15
25
  debtMultiplier: n,
16
- borrowCost: s,
17
- quotaRate: a,
18
- quotaCost: c,
19
- totalCost: s + c
26
+ quotaMultiplier: i,
27
+ borrowCost: e * n,
28
+ quotaRate: r,
29
+ quotaCost: r * i,
30
+ totalCost: o(c, t, a)
20
31
  };
21
32
  }
22
- function y({
23
- collateralApy: o,
24
- leverage: t,
25
- maxLeverage: r,
26
- borrowApy: u,
27
- additionalBorrowApy: n
33
+ function l({
34
+ collateralApy: t,
35
+ leverage: e,
36
+ borrowApy: r = 0,
37
+ quotaRate: s = 0,
38
+ liquidationThreshold: a = 0,
39
+ quotaMode: c = "safe"
28
40
  }) {
29
- const { totalCost: s } = i({
30
- leverage: t,
31
- maxLeverage: r,
32
- borrowApy: u,
33
- additionalBorrowApy: n
34
- });
35
- return o * t - s;
41
+ return u(
42
+ { borrowApy: r, quotaRate: s, liquidationThreshold: a },
43
+ t,
44
+ e,
45
+ c
46
+ );
36
47
  }
37
48
  export {
38
- i as strategyApyPartsAtLeverage,
39
- y as strategyNetApyAtLeverage,
40
- e as strategyQuotaRate
49
+ m as strategyApyPartsAtLeverage,
50
+ l as strategyNetApyAtLeverage
41
51
  };