@gearbox-protocol/ui-kit 4.0.0-next.17 → 4.0.0-next.18
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/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/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/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/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/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
|
|
296
|
-
import { negativeTokenTemplate as
|
|
297
|
-
import { getTokenIcon as
|
|
298
|
-
import { TTL_CONSTANTS as
|
|
299
|
-
import { openInNewWindow as
|
|
300
|
-
import { Z_INDEX as
|
|
301
|
-
import { AmountInputTest as
|
|
302
|
-
import { DetailedPageTitleTest as
|
|
303
|
-
import { DetailsViewTest as
|
|
304
|
-
import { HistoryChartTest as
|
|
305
|
-
import { InfoListTest as
|
|
306
|
-
import { LeverageInputTest as
|
|
307
|
-
import { ManagePaneTest as
|
|
308
|
-
import { PageTitleTest as
|
|
309
|
-
import { ReviewButtonTest as
|
|
310
|
-
import { SectionHeadingTest as
|
|
311
|
-
import { SegmentedTabsTest as
|
|
312
|
-
import { StackTest as
|
|
313
|
-
import { StatBadgeTest as
|
|
314
|
-
import { StickyBarTest as
|
|
315
|
-
import { TabberTest as
|
|
316
|
-
import { TokenAmountTest as
|
|
317
|
-
import { BaseTableLineTest as
|
|
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
|
-
|
|
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
|
-
|
|
362
|
-
|
|
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
|
-
|
|
403
|
+
wg as DetailedPageTitleTest,
|
|
404
404
|
A as DetailsView,
|
|
405
405
|
b as DetailsViewLeftPane,
|
|
406
406
|
P as DetailsViewManagePane,
|
|
407
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
578
|
+
Xg as SectionHeadingTest,
|
|
579
579
|
Hl as SegmentedControl,
|
|
580
580
|
Ie as SegmentedTabs,
|
|
581
|
-
|
|
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
|
-
|
|
614
|
+
Yg as StackTest,
|
|
615
615
|
Ne as StatBadge,
|
|
616
616
|
Oe as StatBadgeGrid,
|
|
617
|
-
|
|
617
|
+
Jg as StatBadgeTest,
|
|
618
618
|
Zf as StatusBars,
|
|
619
619
|
Gf as StatusDot,
|
|
620
620
|
We as StickyBar,
|
|
621
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
706
|
-
|
|
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
|
-
|
|
794
|
+
Sg as getTTLZones,
|
|
795
795
|
Ff as getThumbInBoundsOffset,
|
|
796
|
-
|
|
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
|
-
|
|
831
|
+
lg as negativeTokenTemplate,
|
|
832
832
|
jx as nextMultiSortState,
|
|
833
|
-
|
|
833
|
+
Dg as openInNewWindow,
|
|
834
834
|
Hx as paddingVariants,
|
|
835
835
|
Nd as parseInputToBN,
|
|
836
|
-
|
|
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
|
-
|
|
879
|
-
|
|
880
|
-
|
|
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
|
-
|
|
887
|
-
|
|
888
|
-
|
|
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,
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
26
|
-
import { isLongString as
|
|
27
|
-
import { strategyApyPartsAtLeverage as He, strategyNetApyAtLeverage as We
|
|
28
|
-
import { negativeTokenTemplate as
|
|
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
|
|
31
|
-
import { openInNewWindow as
|
|
32
|
-
import { Z_INDEX as
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
67
|
+
G as getAdaptiveDecimals,
|
|
68
68
|
Ne as getAvailableRanges,
|
|
69
69
|
A as getCSSVariable,
|
|
70
70
|
ce as getNetworkIcon,
|
|
71
|
-
|
|
71
|
+
Ye as getTTLZones,
|
|
72
72
|
Ge as getTokenIcon,
|
|
73
73
|
v as hexToRgba,
|
|
74
74
|
y as hslToHex,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
82
|
-
|
|
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
|
-
|
|
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
|
-
|
|
106
|
-
K as toSignificantDigits,
|
|
105
|
+
Q as toSignificantDigits,
|
|
107
106
|
p as tokenRewardsOf,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
Ue as tokenTemplate,
|
|
108
|
+
Xe as tokenTemplateNumber,
|
|
109
|
+
qe as tokenTemplateString,
|
|
111
110
|
i as totalApyOf,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
|
8
|
-
leverage:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
|
23
|
-
collateralApy:
|
|
24
|
-
leverage:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
e as strategyQuotaRate
|
|
49
|
+
m as strategyApyPartsAtLeverage,
|
|
50
|
+
l as strategyNetApyAtLeverage
|
|
41
51
|
};
|
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;
|
|
@@ -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.18",
|
|
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",
|