@lifi/widget 1.18.8 → 1.18.9
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/cjs/components/SwapRouteCard/SwapRouteCard.js +6 -3
- package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +14 -14
- package/cjs/components/SwapRoutes/SwapRoutes.style.js +13 -13
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +1 -1
- package/cjs/components/Token/Token.js +5 -5
- package/cjs/components/Token/Token.style.d.ts +10 -0
- package/cjs/components/Token/Token.style.js +13 -7
- package/cjs/components/TokenList/TokenList.js +1 -1
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useToken.js +5 -2
- package/cjs/hooks/useTokenBalance.js +15 -10
- package/cjs/hooks/useTokenSearch.d.ts +1 -3
- package/cjs/hooks/useTokenSearch.js +3 -5
- package/cjs/i18n/en/translation.json +1 -1
- package/cjs/stores/routes/useRouteExecutionStore.js +1 -0
- package/cjs/stores/settings/useSettingsStore.js +5 -2
- package/components/SwapRouteCard/SwapRouteCard.js +6 -3
- package/components/SwapRoutes/SwapRoutes.style.d.ts +14 -14
- package/components/SwapRoutes/SwapRoutes.style.js +13 -13
- package/components/SwapRoutes/SwapRoutesExpanded.js +1 -1
- package/components/Token/Token.js +7 -7
- package/components/Token/Token.style.d.ts +10 -0
- package/components/Token/Token.style.js +12 -6
- package/components/TokenList/TokenList.js +1 -1
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useToken.js +5 -2
- package/hooks/useTokenBalance.js +15 -10
- package/hooks/useTokenSearch.d.ts +1 -3
- package/hooks/useTokenSearch.js +3 -5
- package/i18n/en/translation.json +1 -1
- package/package.json +5 -5
- package/stores/routes/useRouteExecutionStore.js +1 -0
- package/stores/settings/useSettingsStore.js +5 -2
- package/tsconfig.cjs.tsbuildinfo +1 -1
|
@@ -40,8 +40,11 @@ exports.SwapRouteCard = SwapRouteCard;
|
|
|
40
40
|
const SwapRouteCardEssentials = ({ route, dense }) => {
|
|
41
41
|
var _a;
|
|
42
42
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const executionTime = (route.steps
|
|
44
|
+
.map((step) => step.estimate.executionDuration)
|
|
45
|
+
.reduce((duration, x) => duration + x) / 60).toFixed(0) || 1;
|
|
46
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: dense ? 'space-between' : 'flex-end', flex: 1, pl: dense ? 0 : 2, mt: dense ? 2 : 0 }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center", pr: dense ? 0 : 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.EvStationOutlined, { fontSize: dense ? 'medium' : 'small' }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: t(`swap.currency`, { value: (_a = route.gasCostUSD) !== null && _a !== void 0 ? _a : 0.01 }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center", pr: dense ? 0 : 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.AccessTime, { fontSize: dense ? 'medium' : 'small' }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: t('swap.estimatedTime', {
|
|
47
|
+
value: executionTime,
|
|
48
|
+
}) }))] })), !dense ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.LayersOutlined, { fontSize: dense ? 'medium' : 'small' }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: route.steps.length }))] }))) : null] })));
|
|
46
49
|
};
|
|
47
50
|
exports.SwapRouteCardEssentials = SwapRouteCardEssentials;
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const Stack: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
3
|
-
ref?: import("react").Ref<unknown> | undefined;
|
|
4
|
-
children?: import("react").ReactNode;
|
|
5
|
-
direction?: import("@mui/system").ResponsiveStyleValue<"row" | "column" | "column-reverse" | "row-reverse"> | undefined;
|
|
6
|
-
spacing?: import("@mui/system").ResponsiveStyleValue<string | number> | undefined;
|
|
7
|
-
divider?: import("react").ReactNode;
|
|
8
|
-
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
9
|
-
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
10
|
-
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
11
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | "direction" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
12
2
|
export declare const CollapseContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
13
3
|
children?: import("react").ReactNode;
|
|
14
4
|
component?: import("react").ElementType<any> | undefined;
|
|
@@ -25,14 +15,14 @@ export declare const ScrollableContainer: import("@emotion/styled").StyledCompon
|
|
|
25
15
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
26
16
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
27
17
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
28
|
-
export declare const Container: import("@emotion/styled").StyledComponent<
|
|
18
|
+
export declare const Container: import("@emotion/styled").StyledComponent<{
|
|
29
19
|
children?: import("react").ReactNode;
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
classes?: Partial<import("@mui/material").ScopedCssBaselineClasses> | undefined;
|
|
21
|
+
enableColorScheme?: boolean | undefined;
|
|
32
22
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
33
23
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
34
24
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
35
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "
|
|
25
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "enableColorScheme"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
36
26
|
export declare const Header: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
37
27
|
children?: import("react").ReactNode;
|
|
38
28
|
component?: import("react").ElementType<any> | undefined;
|
|
@@ -41,3 +31,13 @@ export declare const Header: import("@emotion/styled").StyledComponent<import("@
|
|
|
41
31
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
42
32
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
43
33
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
34
|
+
export declare const Stack: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
35
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
36
|
+
children?: import("react").ReactNode;
|
|
37
|
+
direction?: import("@mui/system").ResponsiveStyleValue<"row" | "column" | "column-reverse" | "row-reverse"> | undefined;
|
|
38
|
+
spacing?: import("@mui/system").ResponsiveStyleValue<string | number> | undefined;
|
|
39
|
+
divider?: import("react").ReactNode;
|
|
40
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
41
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
42
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
43
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | "direction" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Stack = exports.Header = exports.Container = exports.ScrollableContainer = exports.CollapseContainer = void 0;
|
|
4
4
|
const material_1 = require("@mui/material");
|
|
5
5
|
const styles_1 = require("@mui/material/styles");
|
|
6
6
|
const AppContainer_1 = require("../AppContainer");
|
|
7
|
-
exports.Stack = (0, styles_1.styled)(material_1.Stack)(({ theme }) => ({
|
|
8
|
-
alignItems: 'stretch',
|
|
9
|
-
display: 'flex',
|
|
10
|
-
flex: 1,
|
|
11
|
-
flexWrap: 'nowrap',
|
|
12
|
-
overflow: 'hidden',
|
|
13
|
-
borderRight: `solid ${theme.palette.mode === 'light'
|
|
14
|
-
? theme.palette.grey[300]
|
|
15
|
-
: theme.palette.grey[800]}`,
|
|
16
|
-
width: 'calc(100% - 48px)',
|
|
17
|
-
}));
|
|
18
7
|
exports.CollapseContainer = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
|
|
19
8
|
height: AppContainer_1.maxHeight,
|
|
20
9
|
}));
|
|
@@ -25,7 +14,7 @@ exports.ScrollableContainer = (0, styles_1.styled)(material_1.Box)({
|
|
|
25
14
|
display: 'flex',
|
|
26
15
|
flexDirection: 'column',
|
|
27
16
|
});
|
|
28
|
-
exports.Container = (0, styles_1.styled)(material_1.
|
|
17
|
+
exports.Container = (0, styles_1.styled)(material_1.ScopedCssBaseline)(({ theme }) => ({
|
|
29
18
|
backgroundColor: theme.palette.background.default,
|
|
30
19
|
overflow: 'auto',
|
|
31
20
|
width: 436,
|
|
@@ -45,3 +34,14 @@ exports.Header = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
|
|
|
45
34
|
top: 0,
|
|
46
35
|
zIndex: 1200,
|
|
47
36
|
}));
|
|
37
|
+
exports.Stack = (0, styles_1.styled)(material_1.Stack)(({ theme }) => ({
|
|
38
|
+
alignItems: 'stretch',
|
|
39
|
+
display: 'flex',
|
|
40
|
+
flex: 1,
|
|
41
|
+
flexWrap: 'nowrap',
|
|
42
|
+
overflow: 'hidden',
|
|
43
|
+
borderRight: `solid ${theme.palette.mode === 'light'
|
|
44
|
+
? theme.palette.grey[300]
|
|
45
|
+
: theme.palette.grey[800]}`,
|
|
46
|
+
width: 'calc(100% - 48px)',
|
|
47
|
+
}));
|
|
@@ -39,6 +39,6 @@ const SwapRoutesExpanded = () => {
|
|
|
39
39
|
};
|
|
40
40
|
const expanded = Boolean(currentRoute || isLoading || isFetching || isFetched) && !hasPath;
|
|
41
41
|
const routeNotFound = !currentRoute && !isLoading && !isFetching && expanded;
|
|
42
|
-
return ((0, jsx_runtime_1.jsx)(SwapRoutes_style_1.CollapseContainer, { children: (0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ appear: true, timeout: 225, in: expanded, orientation: "horizontal" }, { children: (0, jsx_runtime_1.jsx)(material_1.Grow, Object.assign({ appear: true, timeout: 225, in: expanded }, { children: (0, jsx_runtime_1.jsx)(SwapRoutes_style_1.Container, Object.assign({ sx: containerStyle }, { children: (0, jsx_runtime_1.jsxs)(SwapRoutes_style_1.ScrollableContainer, { children: [(0, jsx_runtime_1.jsxs)(SwapRoutes_style_1.Header, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 18, fontWeight: "700", flex: 1, noWrap: true }, { children: t('swap.routes') })), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 } })] }), (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ direction: "column", spacing: 2, flex: 1, paddingX: 3, paddingBottom: 3 }, { children: routeNotFound ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { variant: "stretched" }, index)))) : (routes === null || routes === void 0 ? void 0 : routes.map((route, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0, variant: "stretched", expanded: (routes === null || routes === void 0 ? void 0 : routes.length) <= 2 }, route.id)))) }))] }) })) })) })) }));
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(SwapRoutes_style_1.CollapseContainer, { children: (0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ appear: true, timeout: 225, in: expanded, orientation: "horizontal" }, { children: (0, jsx_runtime_1.jsx)(material_1.Grow, Object.assign({ appear: true, timeout: 225, in: expanded }, { children: (0, jsx_runtime_1.jsx)(SwapRoutes_style_1.Container, Object.assign({ sx: containerStyle, enableColorScheme: true }, { children: (0, jsx_runtime_1.jsxs)(SwapRoutes_style_1.ScrollableContainer, { children: [(0, jsx_runtime_1.jsxs)(SwapRoutes_style_1.Header, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 18, fontWeight: "700", flex: 1, noWrap: true }, { children: t('swap.routes') })), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 } })] }), (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ direction: "column", spacing: 2, flex: 1, paddingX: 3, paddingBottom: 3 }, { children: routeNotFound ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { variant: "stretched" }, index)))) : (routes === null || routes === void 0 ? void 0 : routes.map((route, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0, variant: "stretched", expanded: (routes === null || routes === void 0 ? void 0 : routes.length) <= 2 }, route.id)))) }))] }) })) })) })) }));
|
|
43
43
|
};
|
|
44
44
|
exports.SwapRoutesExpanded = SwapRoutesExpanded;
|
|
@@ -28,12 +28,12 @@ const Token = (_a) => {
|
|
|
28
28
|
const { getChainById } = (0, hooks_1.useChains)();
|
|
29
29
|
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ flex: 1 }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", flex: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: token, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(TextFitter_1.TextFitter, Object.assign({ height: 30, textStyle: {
|
|
30
30
|
fontWeight: 700,
|
|
31
|
-
} }, { children: (0, utils_1.formatTokenAmount)(token.amount, token.decimals) }))] })), (0, jsx_runtime_1.jsxs)(
|
|
31
|
+
} }, { children: (0, utils_1.formatTokenAmount)(token.amount, token.decimals) }))] })), (0, jsx_runtime_1.jsxs)(Token_style_1.TextSecondaryContainer, Object.assign({ connected: connected, component: "span" }, { children: [(0, jsx_runtime_1.jsx)(Token_style_1.TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
|
|
32
32
|
tokenSymbol: token.symbol,
|
|
33
33
|
chainName: (_b = getChainById(token.chainId)) === null || _b === void 0 ? void 0 : _b.name,
|
|
34
|
-
}) })), step ? ((0, jsx_runtime_1.jsxs)(material_1.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
}) })), step ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12, lineHeight: 1, fontWeight: 500, color: "text.secondary", px: 1, mt: 0.5 }, { children: "\u2022" })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "flex-end", height: 12, mt: 0.5 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ pr: 0.75 }, { children: (0, jsx_runtime_1.jsx)(SmallAvatar_1.SmallAvatar, Object.assign({ src: step.toolDetails.logoURI, alt: step.toolDetails.name, sx: {
|
|
35
|
+
border: 0,
|
|
36
|
+
marginBottom: -0.25,
|
|
37
|
+
} }, { children: step.toolDetails.name[0] })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12, lineHeight: 1, fontWeight: 500, color: "text.secondary" }, { children: step.toolDetails.name }))] }))] })) : null] }))] })));
|
|
38
38
|
};
|
|
39
39
|
exports.Token = Token;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
export declare const TextSecondaryContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
component?: import("react").ElementType<any> | undefined;
|
|
5
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
6
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
7
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
8
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
9
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
10
|
+
connected?: boolean | undefined;
|
|
11
|
+
}, {}, {}>;
|
|
2
12
|
export declare const TextSecondary: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
3
13
|
align?: "inherit" | "left" | "right" | "center" | "justify" | undefined;
|
|
4
14
|
children?: import("react").ReactNode;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TokenDivider = exports.TextSecondary = void 0;
|
|
3
|
+
exports.TokenDivider = exports.TextSecondary = exports.TextSecondaryContainer = void 0;
|
|
4
4
|
const material_1 = require("@mui/material");
|
|
5
5
|
const styles_1 = require("@mui/material/styles");
|
|
6
|
-
exports.
|
|
6
|
+
exports.TextSecondaryContainer = (0, styles_1.styled)(material_1.Box, {
|
|
7
7
|
shouldForwardProp: (prop) => prop !== 'connected',
|
|
8
8
|
})(({ theme, connected }) => ({
|
|
9
|
-
fontSize: 12,
|
|
10
|
-
lineHeight: 1,
|
|
11
|
-
fontWeight: 500,
|
|
12
|
-
color: theme.palette.text.secondary,
|
|
13
9
|
borderLeftWidth: connected ? 2 : 0,
|
|
14
10
|
borderLeftStyle: 'solid',
|
|
15
11
|
borderColor: theme.palette.mode === 'light'
|
|
@@ -17,12 +13,22 @@ exports.TextSecondary = (0, styles_1.styled)(material_1.Typography, {
|
|
|
17
13
|
: theme.palette.grey[800],
|
|
18
14
|
margin: connected
|
|
19
15
|
? theme.spacing(0.5, 0, 0, 1.875)
|
|
20
|
-
: theme.spacing(0
|
|
16
|
+
: theme.spacing(0, 0, 0, 6),
|
|
21
17
|
padding: connected
|
|
22
18
|
? theme.spacing(0, 0, 0, 3.875)
|
|
23
19
|
: theme.spacing(0, 0, 0, 0),
|
|
24
20
|
display: 'flex',
|
|
25
21
|
alignItems: 'flex-start',
|
|
22
|
+
flexWrap: 'wrap',
|
|
23
|
+
}));
|
|
24
|
+
exports.TextSecondary = (0, styles_1.styled)(material_1.Typography, {
|
|
25
|
+
shouldForwardProp: (prop) => prop !== 'connected',
|
|
26
|
+
})(({ theme, connected }) => ({
|
|
27
|
+
fontSize: 12,
|
|
28
|
+
lineHeight: 1,
|
|
29
|
+
fontWeight: 500,
|
|
30
|
+
color: theme.palette.text.secondary,
|
|
31
|
+
marginTop: connected ? 0 : theme.spacing(0.5),
|
|
26
32
|
}));
|
|
27
33
|
exports.TokenDivider = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
|
|
28
34
|
height: 12,
|
|
@@ -30,7 +30,7 @@ const TokenList = ({ formType, height, onClick, }) => {
|
|
|
30
30
|
!filteredTokens.length &&
|
|
31
31
|
!!tokenSearchFilter &&
|
|
32
32
|
!!selectedChainId;
|
|
33
|
-
const { token: searchedToken, isLoading: isSearchedTokenLoading } = (0, hooks_1.useTokenSearch)(
|
|
33
|
+
const { token: searchedToken, isLoading: isSearchedTokenLoading } = (0, hooks_1.useTokenSearch)(selectedChainId, tokenSearchFilter, tokenSearchEnabled);
|
|
34
34
|
const isLoading = isTokensLoading || (tokenSearchEnabled && isSearchedTokenLoading);
|
|
35
35
|
const tokens = filteredTokens.length
|
|
36
36
|
? filteredTokens
|
package/cjs/config/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "1.18.
|
|
2
|
+
export declare const version = "1.18.9";
|
package/cjs/config/version.js
CHANGED
package/cjs/hooks/useToken.js
CHANGED
|
@@ -3,15 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useToken = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const useTokens_1 = require("./useTokens");
|
|
6
|
+
const useTokenSearch_1 = require("./useTokenSearch");
|
|
6
7
|
const useToken = (chainId, tokenAddress) => {
|
|
7
8
|
const { tokens, isLoading } = (0, useTokens_1.useTokens)(chainId);
|
|
8
9
|
const token = (0, react_1.useMemo)(() => {
|
|
9
10
|
const token = tokens === null || tokens === void 0 ? void 0 : tokens.find((token) => token.address === tokenAddress && token.chainId === chainId);
|
|
10
11
|
return token;
|
|
11
12
|
}, [chainId, tokenAddress, tokens]);
|
|
13
|
+
const tokenSearchEnabled = !isLoading && !token;
|
|
14
|
+
const { token: searchedToken, isLoading: isSearchedTokenLoading } = (0, useTokenSearch_1.useTokenSearch)(chainId, tokenAddress, tokenSearchEnabled);
|
|
12
15
|
return {
|
|
13
|
-
token,
|
|
14
|
-
isLoading,
|
|
16
|
+
token: token !== null && token !== void 0 ? token : searchedToken,
|
|
17
|
+
isLoading: isLoading || (tokenSearchEnabled && isSearchedTokenLoading),
|
|
15
18
|
};
|
|
16
19
|
};
|
|
17
20
|
exports.useToken = useToken;
|
|
@@ -21,18 +21,23 @@ const useTokenBalance = (token, accountAddress) => {
|
|
|
21
21
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
22
22
|
const walletAddress = accountAddress !== null && accountAddress !== void 0 ? accountAddress : account.address;
|
|
23
23
|
const getTokenBalancesWithRetry = (0, react_1.useCallback)((accountAddress, tokens, depth = 0) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
try {
|
|
25
|
+
const tokenBalances = yield lifi.getTokenBalances(accountAddress, tokens);
|
|
26
|
+
if (!tokenBalances.every((token) => token.blockNumber)) {
|
|
27
|
+
if (depth > 5) {
|
|
28
|
+
console.warn('Token balance backoff depth exceeded.');
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
yield new Promise((resolve) => {
|
|
32
|
+
setTimeout(resolve, depth * 100);
|
|
33
|
+
});
|
|
34
|
+
return getTokenBalancesWithRetry(accountAddress, tokens, depth + 1);
|
|
29
35
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
return tokenBalances;
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
//
|
|
34
40
|
}
|
|
35
|
-
return tokenBalances;
|
|
36
41
|
}), [lifi]);
|
|
37
42
|
const tokenBalanceQueryKey = (0, react_1.useMemo)(() => ['token-balance', walletAddress, token === null || token === void 0 ? void 0 : token.chainId, token === null || token === void 0 ? void 0 : token.address], [token === null || token === void 0 ? void 0 : token.address, token === null || token === void 0 ? void 0 : token.chainId, walletAddress]);
|
|
38
43
|
const { data, isLoading, refetch } = (0, react_query_1.useQuery)(tokenBalanceQueryKey, ({ queryKey: [, accountAddress] }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { Token } from '../types';
|
|
2
|
-
export declare const useTokenSearch: (
|
|
2
|
+
export declare const useTokenSearch: (chainId: number, token: string, enabled?: boolean) => {
|
|
3
3
|
token: Token | undefined;
|
|
4
4
|
isLoading: boolean;
|
|
5
|
-
isFetching: boolean;
|
|
6
|
-
isFetched: boolean;
|
|
7
5
|
};
|
|
@@ -12,10 +12,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.useTokenSearch = void 0;
|
|
13
13
|
const react_query_1 = require("@tanstack/react-query");
|
|
14
14
|
const providers_1 = require("../providers");
|
|
15
|
-
const useTokenSearch = (
|
|
15
|
+
const useTokenSearch = (chainId, token, enabled) => {
|
|
16
16
|
const lifi = (0, providers_1.useLiFi)();
|
|
17
17
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
18
|
-
const { data, isLoading
|
|
18
|
+
const { data, isLoading } = (0, react_query_1.useQuery)(['token-search', chainId, token], ({ queryKey: [, chainId, token], signal }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
19
|
const data = yield lifi.getToken(chainId, token, {
|
|
20
20
|
signal,
|
|
21
21
|
});
|
|
@@ -29,14 +29,12 @@ const useTokenSearch = (token, chainId, enabled) => {
|
|
|
29
29
|
}
|
|
30
30
|
return data;
|
|
31
31
|
}), {
|
|
32
|
-
enabled,
|
|
32
|
+
enabled: Boolean(chainId && token && enabled),
|
|
33
33
|
retry: false,
|
|
34
34
|
});
|
|
35
35
|
return {
|
|
36
36
|
token: data,
|
|
37
37
|
isLoading,
|
|
38
|
-
isFetching,
|
|
39
|
-
isFetched,
|
|
40
38
|
};
|
|
41
39
|
};
|
|
42
40
|
exports.useTokenSearch = useTokenSearch;
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"stepSwap": "Swap",
|
|
59
59
|
"stepBridge": "Bridge",
|
|
60
60
|
"stepSwapAndBridge": "Swap and bridge",
|
|
61
|
-
"estimatedTime": "
|
|
61
|
+
"estimatedTime": "{{value}}m",
|
|
62
62
|
"crossStepDetails": "Bridge from {{from}} to {{to}} via {{tool}}",
|
|
63
63
|
"swapStepDetails": "Swap on {{chain}} via {{tool}}",
|
|
64
64
|
"tokenOnChain": "{{tokenSymbol}} on {{chainName}}",
|
|
@@ -23,7 +23,7 @@ exports.useSettingsStore = (0, zustand_1.default)()((0, middleware_1.persist)((0
|
|
|
23
23
|
appearance: 'auto',
|
|
24
24
|
gasPrice: 'normal',
|
|
25
25
|
routePriority: 'RECOMMENDED',
|
|
26
|
-
slippage: '
|
|
26
|
+
slippage: '0.5',
|
|
27
27
|
setValue: (key, value) => set((state) => {
|
|
28
28
|
state[key] = value;
|
|
29
29
|
}),
|
|
@@ -68,7 +68,7 @@ exports.useSettingsStore = (0, zustand_1.default)()((0, middleware_1.persist)((0
|
|
|
68
68
|
}),
|
|
69
69
|
})), {
|
|
70
70
|
name: 'li.fi-widget-settings',
|
|
71
|
-
version:
|
|
71
|
+
version: 2,
|
|
72
72
|
partialize: (state) => {
|
|
73
73
|
const { enabledBridges, enabledExchanges } = state, partializedState = __rest(state, ["enabledBridges", "enabledExchanges"]);
|
|
74
74
|
return partializedState;
|
|
@@ -86,6 +86,9 @@ exports.useSettingsStore = (0, zustand_1.default)()((0, middleware_1.persist)((0
|
|
|
86
86
|
if (version === 0 && persistedState.appearance === 'system') {
|
|
87
87
|
persistedState.appearance = 'auto';
|
|
88
88
|
}
|
|
89
|
+
if (version === 1) {
|
|
90
|
+
persistedState.slippage = '0.5';
|
|
91
|
+
}
|
|
89
92
|
return persistedState;
|
|
90
93
|
},
|
|
91
94
|
}));
|
|
@@ -36,7 +36,10 @@ export const SwapRouteCard = (_a) => {
|
|
|
36
36
|
export const SwapRouteCardEssentials = ({ route, dense }) => {
|
|
37
37
|
var _a;
|
|
38
38
|
const { t } = useTranslation();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const executionTime = (route.steps
|
|
40
|
+
.map((step) => step.estimate.executionDuration)
|
|
41
|
+
.reduce((duration, x) => duration + x) / 60).toFixed(0) || 1;
|
|
42
|
+
return (_jsxs(Box, Object.assign({ display: "flex", justifyContent: dense ? 'space-between' : 'flex-end', flex: 1, pl: dense ? 0 : 2, mt: dense ? 2 : 0 }, { children: [_jsxs(Box, Object.assign({ display: "flex", alignItems: "center", pr: dense ? 0 : 2 }, { children: [_jsx(Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: _jsx(EvStationIcon, { fontSize: dense ? 'medium' : 'small' }) })), _jsx(Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: t(`swap.currency`, { value: (_a = route.gasCostUSD) !== null && _a !== void 0 ? _a : 0.01 }) }))] })), _jsxs(Box, Object.assign({ display: "flex", alignItems: "center", pr: dense ? 0 : 2 }, { children: [_jsx(Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: _jsx(AccessTimeIcon, { fontSize: dense ? 'medium' : 'small' }) })), _jsx(Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: t('swap.estimatedTime', {
|
|
43
|
+
value: executionTime,
|
|
44
|
+
}) }))] })), !dense ? (_jsxs(Box, Object.assign({ display: "flex", alignItems: "center" }, { children: [_jsx(Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: _jsx(LayersIcon, { fontSize: dense ? 'medium' : 'small' }) })), _jsx(Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: route.steps.length }))] }))) : null] })));
|
|
42
45
|
};
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const Stack: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
3
|
-
ref?: import("react").Ref<unknown> | undefined;
|
|
4
|
-
children?: import("react").ReactNode;
|
|
5
|
-
direction?: import("@mui/system").ResponsiveStyleValue<"row" | "column" | "column-reverse" | "row-reverse"> | undefined;
|
|
6
|
-
spacing?: import("@mui/system").ResponsiveStyleValue<string | number> | undefined;
|
|
7
|
-
divider?: import("react").ReactNode;
|
|
8
|
-
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
9
|
-
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
10
|
-
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
11
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | "direction" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
12
2
|
export declare const CollapseContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
13
3
|
children?: import("react").ReactNode;
|
|
14
4
|
component?: import("react").ElementType<any> | undefined;
|
|
@@ -25,14 +15,14 @@ export declare const ScrollableContainer: import("@emotion/styled").StyledCompon
|
|
|
25
15
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
26
16
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
27
17
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
28
|
-
export declare const Container: import("@emotion/styled").StyledComponent<
|
|
18
|
+
export declare const Container: import("@emotion/styled").StyledComponent<{
|
|
29
19
|
children?: import("react").ReactNode;
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
classes?: Partial<import("@mui/material").ScopedCssBaselineClasses> | undefined;
|
|
21
|
+
enableColorScheme?: boolean | undefined;
|
|
32
22
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
33
23
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
34
24
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
35
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "
|
|
25
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "enableColorScheme"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
36
26
|
export declare const Header: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
37
27
|
children?: import("react").ReactNode;
|
|
38
28
|
component?: import("react").ElementType<any> | undefined;
|
|
@@ -41,3 +31,13 @@ export declare const Header: import("@emotion/styled").StyledComponent<import("@
|
|
|
41
31
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
42
32
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
43
33
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
34
|
+
export declare const Stack: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
35
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
36
|
+
children?: import("react").ReactNode;
|
|
37
|
+
direction?: import("@mui/system").ResponsiveStyleValue<"row" | "column" | "column-reverse" | "row-reverse"> | undefined;
|
|
38
|
+
spacing?: import("@mui/system").ResponsiveStyleValue<string | number> | undefined;
|
|
39
|
+
divider?: import("react").ReactNode;
|
|
40
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
41
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
42
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
43
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | "direction" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import { Box, Stack as MuiStack } from '@mui/material';
|
|
1
|
+
import { Box, ScopedCssBaseline, Stack as MuiStack } from '@mui/material';
|
|
2
2
|
import { alpha, styled } from '@mui/material/styles';
|
|
3
3
|
import { maxHeight } from '../AppContainer';
|
|
4
|
-
export const Stack = styled(MuiStack)(({ theme }) => ({
|
|
5
|
-
alignItems: 'stretch',
|
|
6
|
-
display: 'flex',
|
|
7
|
-
flex: 1,
|
|
8
|
-
flexWrap: 'nowrap',
|
|
9
|
-
overflow: 'hidden',
|
|
10
|
-
borderRight: `solid ${theme.palette.mode === 'light'
|
|
11
|
-
? theme.palette.grey[300]
|
|
12
|
-
: theme.palette.grey[800]}`,
|
|
13
|
-
width: 'calc(100% - 48px)',
|
|
14
|
-
}));
|
|
15
4
|
export const CollapseContainer = styled(Box)(({ theme }) => ({
|
|
16
5
|
height: maxHeight,
|
|
17
6
|
}));
|
|
@@ -22,7 +11,7 @@ export const ScrollableContainer = styled(Box)({
|
|
|
22
11
|
display: 'flex',
|
|
23
12
|
flexDirection: 'column',
|
|
24
13
|
});
|
|
25
|
-
export const Container = styled(
|
|
14
|
+
export const Container = styled(ScopedCssBaseline)(({ theme }) => ({
|
|
26
15
|
backgroundColor: theme.palette.background.default,
|
|
27
16
|
overflow: 'auto',
|
|
28
17
|
width: 436,
|
|
@@ -42,3 +31,14 @@ export const Header = styled(Box)(({ theme }) => ({
|
|
|
42
31
|
top: 0,
|
|
43
32
|
zIndex: 1200,
|
|
44
33
|
}));
|
|
34
|
+
export const Stack = styled(MuiStack)(({ theme }) => ({
|
|
35
|
+
alignItems: 'stretch',
|
|
36
|
+
display: 'flex',
|
|
37
|
+
flex: 1,
|
|
38
|
+
flexWrap: 'nowrap',
|
|
39
|
+
overflow: 'hidden',
|
|
40
|
+
borderRight: `solid ${theme.palette.mode === 'light'
|
|
41
|
+
? theme.palette.grey[300]
|
|
42
|
+
: theme.palette.grey[800]}`,
|
|
43
|
+
width: 'calc(100% - 48px)',
|
|
44
|
+
}));
|
|
@@ -36,5 +36,5 @@ export const SwapRoutesExpanded = () => {
|
|
|
36
36
|
};
|
|
37
37
|
const expanded = Boolean(currentRoute || isLoading || isFetching || isFetched) && !hasPath;
|
|
38
38
|
const routeNotFound = !currentRoute && !isLoading && !isFetching && expanded;
|
|
39
|
-
return (_jsx(CollapseContainer, { children: _jsx(Collapse, Object.assign({ appear: true, timeout: 225, in: expanded, orientation: "horizontal" }, { children: _jsx(Grow, Object.assign({ appear: true, timeout: 225, in: expanded }, { children: _jsx(Container, Object.assign({ sx: containerStyle }, { children: _jsxs(ScrollableContainer, { children: [_jsxs(Header, { children: [_jsx(Typography, Object.assign({ fontSize: 18, fontWeight: "700", flex: 1, noWrap: true }, { children: t('swap.routes') })), _jsx(ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 } })] }), _jsx(Stack, Object.assign({ direction: "column", spacing: 2, flex: 1, paddingX: 3, paddingBottom: 3 }, { children: routeNotFound ? (_jsx(SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => (_jsx(SwapRouteCardSkeleton, { variant: "stretched" }, index)))) : (routes === null || routes === void 0 ? void 0 : routes.map((route, index) => (_jsx(SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0, variant: "stretched", expanded: (routes === null || routes === void 0 ? void 0 : routes.length) <= 2 }, route.id)))) }))] }) })) })) })) }));
|
|
39
|
+
return (_jsx(CollapseContainer, { children: _jsx(Collapse, Object.assign({ appear: true, timeout: 225, in: expanded, orientation: "horizontal" }, { children: _jsx(Grow, Object.assign({ appear: true, timeout: 225, in: expanded }, { children: _jsx(Container, Object.assign({ sx: containerStyle, enableColorScheme: true }, { children: _jsxs(ScrollableContainer, { children: [_jsxs(Header, { children: [_jsx(Typography, Object.assign({ fontSize: 18, fontWeight: "700", flex: 1, noWrap: true }, { children: t('swap.routes') })), _jsx(ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 } })] }), _jsx(Stack, Object.assign({ direction: "column", spacing: 2, flex: 1, paddingX: 3, paddingBottom: 3 }, { children: routeNotFound ? (_jsx(SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => (_jsx(SwapRouteCardSkeleton, { variant: "stretched" }, index)))) : (routes === null || routes === void 0 ? void 0 : routes.map((route, index) => (_jsx(SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0, variant: "stretched", expanded: (routes === null || routes === void 0 ? void 0 : routes.length) <= 2 }, route.id)))) }))] }) })) })) })) }));
|
|
40
40
|
};
|
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
13
|
import { Box, Typography } from '@mui/material';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useChains } from '../../hooks';
|
|
@@ -17,7 +17,7 @@ import { formatTokenAmount } from '../../utils';
|
|
|
17
17
|
import { SmallAvatar } from '../SmallAvatar';
|
|
18
18
|
import { TextFitter } from '../TextFitter';
|
|
19
19
|
import { TokenAvatar } from '../TokenAvatar';
|
|
20
|
-
import { TextSecondary } from './Token.style';
|
|
20
|
+
import { TextSecondary, TextSecondaryContainer } from './Token.style';
|
|
21
21
|
export const Token = (_a) => {
|
|
22
22
|
var _b;
|
|
23
23
|
var { token, connected, step } = _a, other = __rest(_a, ["token", "connected", "step"]);
|
|
@@ -25,11 +25,11 @@ export const Token = (_a) => {
|
|
|
25
25
|
const { getChainById } = useChains();
|
|
26
26
|
return (_jsxs(Box, Object.assign({ flex: 1 }, other, { children: [_jsxs(Box, Object.assign({ display: "flex", flex: 1, alignItems: "center" }, { children: [_jsx(TokenAvatar, { token: token, sx: { marginRight: 2 } }), _jsx(TextFitter, Object.assign({ height: 30, textStyle: {
|
|
27
27
|
fontWeight: 700,
|
|
28
|
-
} }, { children: formatTokenAmount(token.amount, token.decimals) }))] })), _jsxs(
|
|
28
|
+
} }, { children: formatTokenAmount(token.amount, token.decimals) }))] })), _jsxs(TextSecondaryContainer, Object.assign({ connected: connected, component: "span" }, { children: [_jsx(TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
|
|
29
29
|
tokenSymbol: token.symbol,
|
|
30
30
|
chainName: (_b = getChainById(token.chainId)) === null || _b === void 0 ? void 0 : _b.name,
|
|
31
|
-
}) })), step ? (_jsxs(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
}) })), step ? (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ fontSize: 12, lineHeight: 1, fontWeight: 500, color: "text.secondary", px: 1, mt: 0.5 }, { children: "\u2022" })), _jsxs(Box, Object.assign({ display: "flex", alignItems: "flex-end", height: 12, mt: 0.5 }, { children: [_jsx(Box, Object.assign({ pr: 0.75 }, { children: _jsx(SmallAvatar, Object.assign({ src: step.toolDetails.logoURI, alt: step.toolDetails.name, sx: {
|
|
32
|
+
border: 0,
|
|
33
|
+
marginBottom: -0.25,
|
|
34
|
+
} }, { children: step.toolDetails.name[0] })) })), _jsx(Typography, Object.assign({ fontSize: 12, lineHeight: 1, fontWeight: 500, color: "text.secondary" }, { children: step.toolDetails.name }))] }))] })) : null] }))] })));
|
|
35
35
|
};
|