@gearbox-protocol/permissionless-ui 1.26.9 → 1.26.11-next.1
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/table/table.cjs +1 -1
- package/dist/cjs/hooks/use-hf.cjs +1 -1
- package/dist/cjs/hooks/use-liquidation/index.cjs +1 -1
- package/dist/cjs/types/common.cjs +1 -0
- package/dist/esm/components/table/table.js +94 -97
- package/dist/esm/hooks/use-hf.js +3 -3
- package/dist/esm/hooks/use-liquidation/index.js +38 -38
- package/dist/esm/types/common.js +1 -0
- package/dist/globals.css +1 -1
- package/dist/types/components/asset-line/asset-line.d.ts +4 -3
- package/dist/types/components/compound-apy/compound-apy.d.ts +3 -4
- package/dist/types/components/credit-session-status/credit-session-status.d.ts +1 -1
- package/dist/types/components/currency-button/currency-button.d.ts +2 -2
- package/dist/types/components/detailed-apy/detailed-apy.d.ts +5 -5
- package/dist/types/components/detailed-page-title/detailed-page-title.d.ts +2 -2
- package/dist/types/components/liquidation/liquidation-assets-table/liquidation-assets-table.d.ts +2 -2
- package/dist/types/components/liquidation/liquidation-graph/liquidation-graph.d.ts +5 -4
- package/dist/types/components/liquidation/liquidation-graph-tip/liquidation-graph-tip.d.ts +2 -2
- package/dist/types/components/pool-apy-tooltip/pool-apy-tooltip.d.ts +3 -3
- package/dist/types/components/slider-token/slider-token.d.ts +2 -2
- package/dist/types/components/smart-number-input/balance-indicator.d.ts +2 -2
- package/dist/types/components/smart-number-input/smart-number-input.d.ts +2 -10
- package/dist/types/components/token-symbol/token-symbol.d.ts +2 -6
- package/dist/types/components/token-template/token-template.d.ts +2 -2
- package/dist/types/components/tokens-list-cell/tokens-list-cell.d.ts +2 -2
- package/dist/types/hooks/use-hf.d.ts +4 -3
- package/dist/types/hooks/use-liquidation/index.d.ts +9 -8
- package/dist/types/hooks/use-liquidation/types.d.ts +2 -2
- package/dist/types/hooks/use-liquidation/utils.d.ts +11 -10
- package/dist/types/types/common.d.ts +23 -0
- package/dist/types/utils/interface.d.ts +0 -9
- package/dist/types/utils/search-in-token.d.ts +4 -4
- package/dist/types/utils/templates.d.ts +6 -8
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),c=require("class-variance-authority"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),c=require("class-variance-authority"),S=require("react"),u=require("@fortawesome/free-solid-svg-icons"),V=require("../icons/fa-icon.cjs");require("../tooltip/simple-tooltip.cjs");const l=require("../tooltip/tooltip.cjs");require("@gearbox-protocol/sdk");const s=require("../../utils/cn.cjs");require("sonner");require("luxon");require("../../utils/z-index.cjs");function z(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(a,e,o.get?o:{enumerable:!0,get:()=>t[e]})}}return a.default=t,Object.freeze(a)}const n=z(S),p=c.cva("w-full caption-bottom",{variants:{size:{sm:"text-xs",default:"text-sm",lg:"text-base"}},defaultVariants:{size:"default"}}),m=n.forwardRef(({className:t,size:a,wrapperClassName:e,...o},i)=>r.jsx("div",{className:s.cn("relative w-full overflow-auto rounded-lg border border-input bg-card",e),children:r.jsx("table",{ref:i,className:s.cn(p({size:a,className:t})),...o})}));m.displayName="Table";const x=n.forwardRef(({className:t,...a},e)=>r.jsx("thead",{ref:e,className:s.cn("[&_tr]:after:inset-x-0 [&_tr]:after:bg-input [&_tr]:hover:bg-transparent [&_tr]:hover:before:opacity-0",t),...a}));x.displayName="TableHeader";const g=n.forwardRef(({className:t,...a},e)=>r.jsx("tbody",{ref:e,className:s.cn("[&_tr:last-child]:after:hidden",t),...a}));g.displayName="TableBody";const T=n.forwardRef(({className:t,...a},e)=>r.jsx("tfoot",{ref:e,className:s.cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...a}));T.displayName="TableFooter";const y=n.forwardRef(({className:t,...a},e)=>r.jsx("tr",{ref:e,className:s.cn("relative isolate transition-colors data-[state=selected]:bg-muted","before:absolute before:inset-0 before:-z-10 before:bg-muted/50 before:opacity-0 before:transition-opacity before:pointer-events-none","hover:before:opacity-100","after:absolute after:bottom-0 after:inset-x-3 after:h-px after:bg-border",t),...a}));y.displayName="TableRow";const h=c.cva("border-b bg-muted/50 text-left align-middle font-medium text-muted-foreground border-input",{variants:{size:{sm:"h-8 px-1 text-xs",default:"h-10 px-2",lg:"h-12 px-4"}},defaultVariants:{size:"default"}}),d=n.forwardRef(({className:t,size:a,...e},o)=>r.jsx("th",{ref:o,className:s.cn(h({size:a,className:t})),...e}));d.displayName="TableHead";const j=c.cva("align-middle",{variants:{size:{sm:"p-1",default:"p-2",lg:"p-4"}},defaultVariants:{size:"default"}}),N=n.forwardRef(({className:t,size:a,...e},o)=>r.jsx("td",{ref:o,className:s.cn(j({size:a,className:t})),...e}));N.displayName="TableCell";const v=n.forwardRef(({className:t,...a},e)=>r.jsx("caption",{ref:e,className:s.cn("mt-4 text-sm text-muted-foreground",t),...a}));v.displayName="TableCaption";const w=n.forwardRef(function({title:a,isSorted:e,direction:o,setSort:i,placement:b="right",children:R,className:C,..._},q){const H=e&&o==="asc"?u.faCaretUp:u.faCaretDown,f=r.jsx("span",{className:s.cn("inline-flex items-center transition-opacity",e?"opacity-100":"opacity-0 group-hover:opacity-100"),children:r.jsx(V.FaIcon,{icon:H,className:"size-3 text-muted-foreground"})});return r.jsx(d,{ref:q,className:C,..._,children:r.jsx(l.TooltipProvider,{children:r.jsxs(l.Tooltip,{delayDuration:200,children:[r.jsx(l.TooltipTrigger,{asChild:!0,children:r.jsxs("button",{type:"button",onClick:()=>i(o==="asc"?"desc":"asc"),className:s.cn("group inline-flex items-center gap-1 text-sm font-medium text-muted-foreground","cursor-pointer hover:text-foreground transition-colors"),children:[b==="left"&&f,R,b==="right"&&f]})}),r.jsxs(l.TooltipContent,{side:"top",children:["Sort by ",a]})]})})})});w.displayName="SortingTableHead";exports.SortingTableHead=w;exports.Table=m;exports.TableBody=g;exports.TableCaption=v;exports.TableCell=N;exports.TableFooter=T;exports.TableHead=d;exports.TableHeader=x;exports.TableRow=y;exports.tableCellVariants=j;exports.tableHeadVariants=h;exports.tableVariants=p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@gearbox-protocol/sdk"),i=require("react");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@gearbox-protocol/sdk"),i=require("react");function F({assets:t,quotas:c,prices:u,liquidationThresholds:n,underlyingToken:o,debt:e,quotasInfo:a,allowZeroDebt:f=!1,tokensList:l}){return{hf:i.useMemo(()=>{try{return e===0n&&!f?0:s.CreditAccountDataUtils.calcHealthFactor({assets:t,quotas:c,prices:u,liquidationThresholds:n,underlyingToken:o,debt:e,quotasInfo:a,tokensList:l})}catch(r){return typeof r=="object"&&r!==null&&"reason"in r&&r.reason==="overflow"?Number.MAX_SAFE_INTEGER:0}},[t,c,u,n,o,e,a,f,l])}}exports.useHF=F;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("@gearbox-protocol/sdk"),C=require("react"),e=require("./utils.cjs"),d=35;function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("@gearbox-protocol/sdk"),C=require("react"),e=require("./utils.cjs"),d=35;function N({xMin:t,xMax:i,yMin:s,yMax:a,xLabel:r,yLabel:n,assets:u,quotas:c,prices:L,liquidationThresholds:o,quotasInfo:E,underlyingTokenAddress:l,debt:_,tokensList:P}){return C.useMemo(()=>{const h=i-t,x=a-s,p=h/d,m=x/d,D=Array.from(Array(d)),I={...L};return D.flatMap((G,O)=>{const T=t+O*p,f=t+(O+1)*p;return r&&(I[r.address]=A.toBN(String((T+f)/2),A.PRICE_DECIMALS_POW)),D.map((F,S)=>{const U=s+S*m,X=s+(S+1)*m;return n&&(I[n.address]=A.toBN(String((U+X)/2),A.PRICE_DECIMALS_POW)),{x:T,xEnd:f,y:U,yEnd:X,value:A.CreditAccountDataUtils.calcHealthFactor({assets:u,quotas:c,prices:I,liquidationThresholds:o,underlyingToken:l,debt:_,quotasInfo:E,tokensList:P})}})})},[t,i,s,a,r,n,u,c,L,o,l,_,E,P])}function R({prices:t}){const[i,s]=C.useState({}),a=C.useMemo(()=>({...t,...i}),[t,i]),r=C.useCallback((n,u)=>{s({...i,[u]:n})},[i]);return[a,r]}function v({assets:t,liquidationThresholds:i,quotas:s,quotasInfo:a,tokensList:r,prices:n}){const[u]=e.useFixedAssets({assets:t,liquidationThresholds:i,quotas:s,quotasInfo:a}),[c,L]=e.usePriceInNumber({asset:u[0],tokensList:r,prices:n}),[o,E]=e.usePriceInNumber({asset:u[1],tokensList:r,prices:n}),l=e.useAxis({currentPrice:c,token:L}),_=e.useAxis({currentPrice:o,token:E});return{xAxis:l,yAxis:_,currentPoint:[c||e.DEFAULT_AXIS_MAX/2,o||e.DEFAULT_AXIS_MAX/2],fixedBalances:u}}exports.CELL_BAD=e.CELL_BAD;exports.CELL_CURRENT=e.CELL_CURRENT;exports.CELL_GOOD=e.CELL_GOOD;exports.CELL_HOVERED=e.CELL_HOVERED;exports.CELL_LIQUIDATION=e.CELL_LIQUIDATION;exports.CELL_OK=e.CELL_OK;exports.DEFAULT_AXIS_MAX=e.DEFAULT_AXIS_MAX;exports.DEFAULT_AXIS_MIN=e.DEFAULT_AXIS_MIN;exports.formatAxisLabel=e.formatAxisLabel;exports.formatAxisTipLabel=e.formatAxisTipLabel;exports.formatAxisTipPrice=e.formatAxisTipPrice;exports.getCellClass=e.getCellClass;exports.isPointInCell=e.isPointInCell;exports.useAxis=e.useAxis;exports.useFixedAssets=e.useFixedAssets;exports.useIsAxisInRelativeUnits=e.useIsAxisInRelativeUnits;exports.useLiquidationGraphActivePrice=e.useLiquidationGraphActivePrice;exports.useLiquidationGraphCurrentActiveValue=e.useLiquidationGraphCurrentActiveValue;exports.usePriceInNumber=e.usePriceInNumber;exports.useWithLiquidationGraphActivePrices=e.useWithLiquidationGraphActivePrices;exports.useEditPriceManually=R;exports.useLiquidationGraphParams=v;exports.useLiquidationHeatmap=N;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { cva as
|
|
3
|
-
import * as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { FaIcon as h } from "../icons/fa-icon.js";
|
|
1
|
+
import { jsx as r, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { cva as d } from "class-variance-authority";
|
|
3
|
+
import * as i from "react";
|
|
4
|
+
import { faCaretUp as h, faCaretDown as T } from "@fortawesome/free-solid-svg-icons";
|
|
5
|
+
import { FaIcon as y } from "../icons/fa-icon.js";
|
|
7
6
|
import "../tooltip/simple-tooltip.js";
|
|
8
|
-
import { TooltipProvider as
|
|
7
|
+
import { TooltipProvider as N, Tooltip as v, TooltipTrigger as w, TooltipContent as R } from "../tooltip/tooltip.js";
|
|
9
8
|
import "@gearbox-protocol/sdk";
|
|
10
9
|
import { cn as o } from "../../utils/cn.js";
|
|
11
10
|
import "sonner";
|
|
12
11
|
import "luxon";
|
|
13
12
|
import "../../utils/z-index.js";
|
|
14
|
-
const
|
|
13
|
+
const C = d("w-full caption-bottom", {
|
|
15
14
|
variants: {
|
|
16
15
|
size: {
|
|
17
16
|
sm: "text-xs",
|
|
@@ -22,77 +21,77 @@ const w = n("w-full caption-bottom", {
|
|
|
22
21
|
defaultVariants: {
|
|
23
22
|
size: "default"
|
|
24
23
|
}
|
|
25
|
-
}),
|
|
26
|
-
({ className: a, size:
|
|
24
|
+
}), z = i.forwardRef(
|
|
25
|
+
({ className: a, size: t, wrapperClassName: e, ...l }, s) => /* @__PURE__ */ r(
|
|
27
26
|
"div",
|
|
28
27
|
{
|
|
29
28
|
className: o(
|
|
30
29
|
"relative w-full overflow-auto rounded-lg border border-input bg-card",
|
|
31
|
-
|
|
30
|
+
e
|
|
32
31
|
),
|
|
33
32
|
children: /* @__PURE__ */ r(
|
|
34
33
|
"table",
|
|
35
34
|
{
|
|
36
35
|
ref: s,
|
|
37
|
-
className: o(
|
|
38
|
-
...
|
|
36
|
+
className: o(C({ size: t, className: a })),
|
|
37
|
+
...l
|
|
39
38
|
}
|
|
40
39
|
)
|
|
41
40
|
}
|
|
42
41
|
)
|
|
43
42
|
);
|
|
44
|
-
|
|
45
|
-
const
|
|
43
|
+
z.displayName = "Table";
|
|
44
|
+
const H = i.forwardRef(({ className: a, ...t }, e) => /* @__PURE__ */ r(
|
|
46
45
|
"thead",
|
|
47
46
|
{
|
|
48
|
-
ref:
|
|
47
|
+
ref: e,
|
|
49
48
|
className: o(
|
|
50
49
|
"[&_tr]:after:inset-x-0 [&_tr]:after:bg-input [&_tr]:hover:bg-transparent [&_tr]:hover:before:opacity-0",
|
|
51
50
|
a
|
|
52
51
|
),
|
|
53
|
-
...
|
|
52
|
+
...t
|
|
54
53
|
}
|
|
55
54
|
));
|
|
56
|
-
|
|
57
|
-
const
|
|
55
|
+
H.displayName = "TableHeader";
|
|
56
|
+
const V = i.forwardRef(({ className: a, ...t }, e) => /* @__PURE__ */ r(
|
|
58
57
|
"tbody",
|
|
59
58
|
{
|
|
60
|
-
ref:
|
|
59
|
+
ref: e,
|
|
61
60
|
className: o("[&_tr:last-child]:after:hidden", a),
|
|
62
|
-
...
|
|
61
|
+
...t
|
|
63
62
|
}
|
|
64
63
|
));
|
|
65
|
-
|
|
66
|
-
const
|
|
64
|
+
V.displayName = "TableBody";
|
|
65
|
+
const _ = i.forwardRef(({ className: a, ...t }, e) => /* @__PURE__ */ r(
|
|
67
66
|
"tfoot",
|
|
68
67
|
{
|
|
69
|
-
ref:
|
|
68
|
+
ref: e,
|
|
70
69
|
className: o(
|
|
71
70
|
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
|
|
72
71
|
a
|
|
73
72
|
),
|
|
74
|
-
...
|
|
73
|
+
...t
|
|
75
74
|
}
|
|
76
75
|
));
|
|
77
|
-
|
|
78
|
-
const
|
|
76
|
+
_.displayName = "TableFooter";
|
|
77
|
+
const F = i.forwardRef(({ className: a, ...t }, e) => /* @__PURE__ */ r(
|
|
79
78
|
"tr",
|
|
80
79
|
{
|
|
81
|
-
ref:
|
|
80
|
+
ref: e,
|
|
82
81
|
className: o(
|
|
83
82
|
"relative isolate transition-colors data-[state=selected]:bg-muted",
|
|
84
83
|
// Hover background with rounded corners
|
|
85
|
-
"before:absolute before:inset-0 before:-z-10 before:
|
|
84
|
+
"before:absolute before:inset-0 before:-z-10 before:bg-muted/50 before:opacity-0 before:transition-opacity before:pointer-events-none",
|
|
86
85
|
"hover:before:opacity-100",
|
|
87
86
|
// Border line that doesn't extend to rounded corners
|
|
88
87
|
"after:absolute after:bottom-0 after:inset-x-3 after:h-px after:bg-border",
|
|
89
88
|
a
|
|
90
89
|
),
|
|
91
|
-
...
|
|
90
|
+
...t
|
|
92
91
|
}
|
|
93
92
|
));
|
|
94
|
-
|
|
95
|
-
const
|
|
93
|
+
F.displayName = "TableRow";
|
|
94
|
+
const S = d(
|
|
96
95
|
"border-b bg-muted/50 text-left align-middle font-medium text-muted-foreground border-input",
|
|
97
96
|
{
|
|
98
97
|
variants: {
|
|
@@ -106,18 +105,18 @@ const _ = n(
|
|
|
106
105
|
size: "default"
|
|
107
106
|
}
|
|
108
107
|
}
|
|
109
|
-
),
|
|
110
|
-
({ className: a, size:
|
|
108
|
+
), c = i.forwardRef(
|
|
109
|
+
({ className: a, size: t, ...e }, l) => /* @__PURE__ */ r(
|
|
111
110
|
"th",
|
|
112
111
|
{
|
|
113
|
-
ref:
|
|
114
|
-
className: o(
|
|
115
|
-
...
|
|
112
|
+
ref: l,
|
|
113
|
+
className: o(S({ size: t, className: a })),
|
|
114
|
+
...e
|
|
116
115
|
}
|
|
117
116
|
)
|
|
118
117
|
);
|
|
119
|
-
|
|
120
|
-
const
|
|
118
|
+
c.displayName = "TableHead";
|
|
119
|
+
const j = d("align-middle", {
|
|
121
120
|
variants: {
|
|
122
121
|
size: {
|
|
123
122
|
sm: "p-1",
|
|
@@ -128,83 +127,81 @@ const B = n("align-middle", {
|
|
|
128
127
|
defaultVariants: {
|
|
129
128
|
size: "default"
|
|
130
129
|
}
|
|
131
|
-
}),
|
|
132
|
-
({ className: a, size:
|
|
130
|
+
}), B = i.forwardRef(
|
|
131
|
+
({ className: a, size: t, ...e }, l) => /* @__PURE__ */ r(
|
|
133
132
|
"td",
|
|
134
133
|
{
|
|
135
|
-
ref:
|
|
136
|
-
className: o(
|
|
137
|
-
...
|
|
134
|
+
ref: l,
|
|
135
|
+
className: o(j({ size: t, className: a })),
|
|
136
|
+
...e
|
|
138
137
|
}
|
|
139
138
|
)
|
|
140
139
|
);
|
|
141
|
-
|
|
142
|
-
const
|
|
140
|
+
B.displayName = "TableCell";
|
|
141
|
+
const D = i.forwardRef(({ className: a, ...t }, e) => /* @__PURE__ */ r(
|
|
143
142
|
"caption",
|
|
144
143
|
{
|
|
145
|
-
ref:
|
|
144
|
+
ref: e,
|
|
146
145
|
className: o("mt-4 text-sm text-muted-foreground", a),
|
|
147
|
-
...
|
|
146
|
+
...t
|
|
148
147
|
}
|
|
149
148
|
));
|
|
150
|
-
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
149
|
+
D.displayName = "TableCaption";
|
|
150
|
+
const I = i.forwardRef(function({
|
|
151
|
+
title: t,
|
|
152
|
+
isSorted: e,
|
|
153
|
+
direction: l,
|
|
154
|
+
setSort: s,
|
|
155
|
+
placement: f = "right",
|
|
156
|
+
children: b,
|
|
157
|
+
className: p,
|
|
158
|
+
...u
|
|
159
|
+
}, g) {
|
|
160
|
+
const x = e && l === "asc" ? h : T, m = /* @__PURE__ */ r(
|
|
161
|
+
"span",
|
|
162
|
+
{
|
|
163
|
+
className: o(
|
|
164
|
+
"inline-flex items-center transition-opacity",
|
|
165
|
+
e ? "opacity-100" : "opacity-0 group-hover:opacity-100"
|
|
166
|
+
),
|
|
167
|
+
children: /* @__PURE__ */ r(y, { icon: x, className: "size-3 text-muted-foreground" })
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
return /* @__PURE__ */ r(c, { ref: g, className: p, ...u, children: /* @__PURE__ */ r(N, { children: /* @__PURE__ */ n(v, { delayDuration: 200, children: [
|
|
171
|
+
/* @__PURE__ */ r(w, { asChild: !0, children: /* @__PURE__ */ n(
|
|
172
|
+
"button",
|
|
164
173
|
{
|
|
174
|
+
type: "button",
|
|
175
|
+
onClick: () => s(l === "asc" ? "desc" : "asc"),
|
|
165
176
|
className: o(
|
|
166
|
-
"group flex items-center gap-1
|
|
167
|
-
|
|
177
|
+
"group inline-flex items-center gap-1 text-sm font-medium text-muted-foreground",
|
|
178
|
+
"cursor-pointer hover:text-foreground transition-colors"
|
|
168
179
|
),
|
|
169
|
-
onClick: () => i(t === "asc" ? "desc" : "asc"),
|
|
170
180
|
children: [
|
|
181
|
+
f === "left" && m,
|
|
171
182
|
b,
|
|
172
|
-
|
|
173
|
-
g,
|
|
174
|
-
{
|
|
175
|
-
variant: "text",
|
|
176
|
-
size: "auto",
|
|
177
|
-
className: e ? void 0 : "opacity-0 group-hover:opacity-100",
|
|
178
|
-
children: /* @__PURE__ */ r(
|
|
179
|
-
h,
|
|
180
|
-
{
|
|
181
|
-
icon: e ? t === "asc" ? x : f : f,
|
|
182
|
-
className: "size-3 text-muted-foreground transition-opacity duration-200"
|
|
183
|
-
}
|
|
184
|
-
)
|
|
185
|
-
}
|
|
186
|
-
)
|
|
183
|
+
f === "right" && m
|
|
187
184
|
]
|
|
188
185
|
}
|
|
189
186
|
) }),
|
|
190
|
-
/* @__PURE__ */
|
|
187
|
+
/* @__PURE__ */ n(R, { side: "top", children: [
|
|
191
188
|
"Sort by ",
|
|
192
|
-
|
|
189
|
+
t
|
|
193
190
|
] })
|
|
194
|
-
] }) }) })
|
|
195
|
-
);
|
|
196
|
-
|
|
191
|
+
] }) }) });
|
|
192
|
+
});
|
|
193
|
+
I.displayName = "SortingTableHead";
|
|
197
194
|
export {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
195
|
+
I as SortingTableHead,
|
|
196
|
+
z as Table,
|
|
197
|
+
V as TableBody,
|
|
198
|
+
D as TableCaption,
|
|
199
|
+
B as TableCell,
|
|
200
|
+
_ as TableFooter,
|
|
201
|
+
c as TableHead,
|
|
202
|
+
H as TableHeader,
|
|
203
|
+
F as TableRow,
|
|
204
|
+
j as tableCellVariants,
|
|
205
|
+
S as tableHeadVariants,
|
|
206
|
+
C as tableVariants
|
|
210
207
|
};
|
package/dist/esm/hooks/use-hf.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CreditAccountDataUtils as l } from "@gearbox-protocol/sdk";
|
|
2
2
|
import { useMemo as p } from "react";
|
|
3
|
-
function
|
|
3
|
+
function i({
|
|
4
4
|
assets: e,
|
|
5
5
|
quotas: c,
|
|
6
6
|
prices: n,
|
|
@@ -39,5 +39,5 @@ function _({
|
|
|
39
39
|
]) };
|
|
40
40
|
}
|
|
41
41
|
export {
|
|
42
|
-
|
|
42
|
+
i as useHF
|
|
43
43
|
};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { toBN as v, PRICE_DECIMALS_POW as R,
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { useFixedAssets as
|
|
4
|
-
import { CELL_BAD as J, CELL_CURRENT as Z, CELL_GOOD as $, CELL_HOVERED as b, CELL_LIQUIDATION as j, CELL_OK as M, DEFAULT_AXIS_MIN as tt, formatAxisLabel as et, formatAxisTipLabel as rt, formatAxisTipPrice as it, getCellClass as
|
|
1
|
+
import { toBN as v, PRICE_DECIMALS_POW as R, CreditAccountDataUtils as T } from "@gearbox-protocol/sdk";
|
|
2
|
+
import { useMemo as x, useState as F, useCallback as Y } from "react";
|
|
3
|
+
import { useFixedAssets as g, usePriceInNumber as S, useAxis as U, DEFAULT_AXIS_MAX as X } from "./utils.js";
|
|
4
|
+
import { CELL_BAD as J, CELL_CURRENT as Z, CELL_GOOD as $, CELL_HOVERED as b, CELL_LIQUIDATION as j, CELL_OK as M, DEFAULT_AXIS_MIN as tt, formatAxisLabel as et, formatAxisTipLabel as rt, formatAxisTipPrice as it, getCellClass as st, isPointInCell as nt, useIsAxisInRelativeUnits as ct, useLiquidationGraphActivePrice as ot, useLiquidationGraphCurrentActiveValue as at, useWithLiquidationGraphActivePrices as ut } from "./utils.js";
|
|
5
5
|
const m = 35;
|
|
6
|
-
function
|
|
6
|
+
function y({
|
|
7
7
|
xMin: t,
|
|
8
8
|
xMax: e,
|
|
9
9
|
yMin: r,
|
|
10
10
|
yMax: c,
|
|
11
11
|
xLabel: i,
|
|
12
|
-
yLabel:
|
|
13
|
-
assets:
|
|
12
|
+
yLabel: s,
|
|
13
|
+
assets: n,
|
|
14
14
|
quotas: o,
|
|
15
15
|
prices: u,
|
|
16
16
|
liquidationThresholds: a,
|
|
17
17
|
quotasInfo: A,
|
|
18
18
|
underlyingTokenAddress: p,
|
|
19
19
|
debt: E,
|
|
20
|
-
tokensList:
|
|
20
|
+
tokensList: L
|
|
21
21
|
}) {
|
|
22
|
-
return
|
|
23
|
-
const
|
|
22
|
+
return x(() => {
|
|
23
|
+
const G = e - t, N = c - r, d = G / m, C = N / m, P = Array.from(Array(m)), l = { ...u };
|
|
24
24
|
return P.flatMap((B, _) => {
|
|
25
25
|
const f = t + _ * d, I = t + (_ + 1) * d;
|
|
26
|
-
return i && (
|
|
26
|
+
return i && (l[i.address] = v(
|
|
27
27
|
String((f + I) / 2),
|
|
28
28
|
R
|
|
29
29
|
)), P.map((H, D) => {
|
|
30
30
|
const O = r + D * C, h = r + (D + 1) * C;
|
|
31
|
-
return
|
|
31
|
+
return s && (l[s.address] = v(
|
|
32
32
|
String((O + h) / 2),
|
|
33
33
|
R
|
|
34
34
|
)), {
|
|
@@ -36,15 +36,15 @@ function W({
|
|
|
36
36
|
xEnd: I,
|
|
37
37
|
y: O,
|
|
38
38
|
yEnd: h,
|
|
39
|
-
value:
|
|
40
|
-
assets:
|
|
39
|
+
value: T.calcHealthFactor({
|
|
40
|
+
assets: n,
|
|
41
41
|
quotas: o,
|
|
42
|
-
prices:
|
|
42
|
+
prices: l,
|
|
43
43
|
liquidationThresholds: a,
|
|
44
44
|
underlyingToken: p,
|
|
45
45
|
debt: E,
|
|
46
46
|
quotasInfo: A,
|
|
47
|
-
tokensList:
|
|
47
|
+
tokensList: L
|
|
48
48
|
})
|
|
49
49
|
};
|
|
50
50
|
});
|
|
@@ -55,24 +55,24 @@ function W({
|
|
|
55
55
|
r,
|
|
56
56
|
c,
|
|
57
57
|
i,
|
|
58
|
-
n,
|
|
59
58
|
s,
|
|
59
|
+
n,
|
|
60
60
|
o,
|
|
61
61
|
u,
|
|
62
62
|
a,
|
|
63
63
|
p,
|
|
64
64
|
E,
|
|
65
65
|
A,
|
|
66
|
-
|
|
66
|
+
L
|
|
67
67
|
]);
|
|
68
68
|
}
|
|
69
69
|
function K({ prices: t }) {
|
|
70
|
-
const [e, r] =
|
|
70
|
+
const [e, r] = F({}), c = x(
|
|
71
71
|
() => ({ ...t, ...e }),
|
|
72
72
|
[t, e]
|
|
73
|
-
), i =
|
|
74
|
-
(
|
|
75
|
-
r({ ...e, [
|
|
73
|
+
), i = Y(
|
|
74
|
+
(s, n) => {
|
|
75
|
+
r({ ...e, [n]: s });
|
|
76
76
|
},
|
|
77
77
|
[e]
|
|
78
78
|
);
|
|
@@ -84,30 +84,30 @@ function Q({
|
|
|
84
84
|
quotas: r,
|
|
85
85
|
quotasInfo: c,
|
|
86
86
|
tokensList: i,
|
|
87
|
-
prices:
|
|
87
|
+
prices: s
|
|
88
88
|
}) {
|
|
89
|
-
const [
|
|
89
|
+
const [n] = g({
|
|
90
90
|
assets: t,
|
|
91
91
|
liquidationThresholds: e,
|
|
92
92
|
quotas: r,
|
|
93
93
|
quotasInfo: c
|
|
94
94
|
}), [o, u] = S({
|
|
95
|
-
asset:
|
|
95
|
+
asset: n[0],
|
|
96
96
|
tokensList: i,
|
|
97
|
-
prices:
|
|
97
|
+
prices: s
|
|
98
98
|
}), [a, A] = S({
|
|
99
|
-
asset:
|
|
99
|
+
asset: n[1],
|
|
100
100
|
tokensList: i,
|
|
101
|
-
prices:
|
|
102
|
-
}), p =
|
|
101
|
+
prices: s
|
|
102
|
+
}), p = U({ currentPrice: o, token: u }), E = U({ currentPrice: a, token: A });
|
|
103
103
|
return {
|
|
104
104
|
xAxis: p,
|
|
105
105
|
yAxis: E,
|
|
106
106
|
currentPoint: [
|
|
107
|
-
o ||
|
|
108
|
-
a ||
|
|
107
|
+
o || X / 2,
|
|
108
|
+
a || X / 2
|
|
109
109
|
],
|
|
110
|
-
fixedBalances:
|
|
110
|
+
fixedBalances: n
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
113
|
export {
|
|
@@ -117,21 +117,21 @@ export {
|
|
|
117
117
|
b as CELL_HOVERED,
|
|
118
118
|
j as CELL_LIQUIDATION,
|
|
119
119
|
M as CELL_OK,
|
|
120
|
-
|
|
120
|
+
X as DEFAULT_AXIS_MAX,
|
|
121
121
|
tt as DEFAULT_AXIS_MIN,
|
|
122
122
|
et as formatAxisLabel,
|
|
123
123
|
rt as formatAxisTipLabel,
|
|
124
124
|
it as formatAxisTipPrice,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
st as getCellClass,
|
|
126
|
+
nt as isPointInCell,
|
|
127
|
+
U as useAxis,
|
|
128
128
|
K as useEditPriceManually,
|
|
129
|
-
|
|
129
|
+
g as useFixedAssets,
|
|
130
130
|
ct as useIsAxisInRelativeUnits,
|
|
131
131
|
ot as useLiquidationGraphActivePrice,
|
|
132
132
|
at as useLiquidationGraphCurrentActiveValue,
|
|
133
133
|
Q as useLiquidationGraphParams,
|
|
134
|
-
|
|
134
|
+
y as useLiquidationHeatmap,
|
|
135
135
|
S as usePriceInNumber,
|
|
136
136
|
ut as useWithLiquidationGraphActivePrices
|
|
137
137
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|