@lifi/widget 1.18.7 → 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.js +2 -12
- 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 +7 -5
- package/cjs/components/SwapRoutes/useSetSelectedRoute.d.ts +2 -0
- package/cjs/components/SwapRoutes/useSetSelectedRoute.js +13 -0
- 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 +3 -3
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useDebouncedWatch.js +1 -4
- package/cjs/hooks/useSwapRoutes.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/pages/MainPage/MainPage.js +3 -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.js +2 -12
- package/components/SwapRoutes/SwapRoutes.style.d.ts +14 -14
- package/components/SwapRoutes/SwapRoutes.style.js +13 -13
- package/components/SwapRoutes/SwapRoutesExpanded.js +7 -5
- package/components/SwapRoutes/useSetSelectedRoute.d.ts +2 -0
- package/components/SwapRoutes/useSetSelectedRoute.js +9 -0
- 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 +3 -3
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useDebouncedWatch.js +1 -4
- package/hooks/useSwapRoutes.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/pages/MainPage/MainPage.js +3 -1
- package/stores/routes/useRouteExecutionStore.js +1 -0
- package/stores/settings/useSettingsStore.js +5 -2
- package/tsconfig.cjs.tsbuildinfo +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { KeyboardArrowRight as KeyboardArrowRightIcon } from '@mui/icons-material';
|
|
3
3
|
import { Box, IconButton } from '@mui/material';
|
|
4
|
-
import { useEffect } from 'react';
|
|
5
4
|
import { useFormState } from 'react-hook-form';
|
|
6
5
|
import { useTranslation } from 'react-i18next';
|
|
7
6
|
import { useNavigate } from 'react-router-dom';
|
|
@@ -9,22 +8,16 @@ import { Card, CardTitle } from '../../components/Card';
|
|
|
9
8
|
import { ProgressToNextUpdate } from '../../components/ProgressToNextUpdate';
|
|
10
9
|
import { SwapRouteCard, SwapRouteCardSkeleton, SwapRouteNotFoundCard, } from '../../components/SwapRouteCard';
|
|
11
10
|
import { useSwapRoutes } from '../../hooks';
|
|
12
|
-
import { useWidgetConfig } from '../../providers';
|
|
13
|
-
import { useSelectedRouteStore } from '../../stores';
|
|
14
11
|
import { navigationRoutes } from '../../utils';
|
|
15
12
|
import { Stack } from './SwapRoutes.style';
|
|
13
|
+
import { useSetSelectedRoute } from './useSetSelectedRoute';
|
|
16
14
|
export const SwapRoutes = (props) => {
|
|
17
15
|
const { t } = useTranslation();
|
|
18
|
-
const { variant } = useWidgetConfig();
|
|
19
16
|
const navigate = useNavigate();
|
|
20
17
|
const { isValid, isValidating } = useFormState();
|
|
21
|
-
const setSelectedRoute = useSelectedRouteStore((state) => state.setSelectedRoute);
|
|
22
18
|
const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = useSwapRoutes();
|
|
23
19
|
const currentRoute = routes === null || routes === void 0 ? void 0 : routes[0];
|
|
24
|
-
|
|
25
|
-
setSelectedRoute(!isFetching ? currentRoute : undefined);
|
|
26
|
-
return () => setSelectedRoute(undefined);
|
|
27
|
-
}, [currentRoute, isFetching, setSelectedRoute]);
|
|
20
|
+
useSetSelectedRoute(currentRoute, isFetching);
|
|
28
21
|
if (!currentRoute && !isLoading && !isFetching && !isFetched) {
|
|
29
22
|
return null;
|
|
30
23
|
}
|
|
@@ -32,9 +25,6 @@ export const SwapRoutes = (props) => {
|
|
|
32
25
|
navigate(navigationRoutes.swapRoutes);
|
|
33
26
|
};
|
|
34
27
|
const routeNotFound = !currentRoute && !isLoading && !isFetching;
|
|
35
|
-
if (variant === 'expandable') {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
28
|
return (_jsxs(Card, Object.assign({}, props, { children: [_jsx(CardTitle, { children: t('swap.routes') }), _jsx(ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: {
|
|
39
29
|
position: 'absolute',
|
|
40
30
|
top: 8,
|
|
@@ -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
|
+
}));
|
|
@@ -10,13 +10,16 @@ import { navigationRoutes, navigationRoutesValues } from '../../utils';
|
|
|
10
10
|
import { ProgressToNextUpdate } from '../ProgressToNextUpdate';
|
|
11
11
|
import { SwapRouteCard, SwapRouteCardSkeleton, SwapRouteNotFoundCard, } from '../SwapRouteCard';
|
|
12
12
|
import { CollapseContainer, Container, Header, ScrollableContainer, } from './SwapRoutes.style';
|
|
13
|
+
import { useSetSelectedRoute } from './useSetSelectedRoute';
|
|
13
14
|
export const SwapRoutesExpanded = () => {
|
|
14
15
|
const { t } = useTranslation();
|
|
15
|
-
const { containerStyle } = useWidgetConfig();
|
|
16
16
|
const navigate = useNavigate();
|
|
17
|
-
const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = useSwapRoutes();
|
|
18
|
-
const { isValid, isValidating } = useFormState();
|
|
19
17
|
const setExecutableRoute = useSetExecutableRoute();
|
|
18
|
+
const { containerStyle } = useWidgetConfig();
|
|
19
|
+
const { isValid, isValidating } = useFormState();
|
|
20
|
+
const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = useSwapRoutes();
|
|
21
|
+
const currentRoute = routes === null || routes === void 0 ? void 0 : routes[0];
|
|
22
|
+
useSetSelectedRoute(currentRoute, isFetching);
|
|
20
23
|
const { pathname } = useLocation();
|
|
21
24
|
const cleanedPathname = pathname.endsWith('/')
|
|
22
25
|
? pathname.slice(0, -1)
|
|
@@ -31,8 +34,7 @@ export const SwapRoutesExpanded = () => {
|
|
|
31
34
|
});
|
|
32
35
|
}
|
|
33
36
|
};
|
|
34
|
-
const currentRoute = routes === null || routes === void 0 ? void 0 : routes[0];
|
|
35
37
|
const expanded = Boolean(currentRoute || isLoading || isFetching || isFetched) && !hasPath;
|
|
36
38
|
const routeNotFound = !currentRoute && !isLoading && !isFetching && expanded;
|
|
37
|
-
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)))) }))] }) })) })) })) }));
|
|
38
40
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useSelectedRouteStore } from '../../stores';
|
|
3
|
+
export const useSetSelectedRoute = (currentRoute, isFetching) => {
|
|
4
|
+
const setSelectedRoute = useSelectedRouteStore((state) => state.setSelectedRoute);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
setSelectedRoute(!isFetching ? currentRoute : undefined);
|
|
7
|
+
return () => setSelectedRoute(undefined);
|
|
8
|
+
}, [currentRoute, isFetching, setSelectedRoute]);
|
|
9
|
+
};
|
|
@@ -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
|
};
|
|
@@ -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,12 +1,8 @@
|
|
|
1
1
|
import { Box, Typography } from '@mui/material';
|
|
2
2
|
import { styled } from '@mui/material/styles';
|
|
3
|
-
export const
|
|
3
|
+
export const TextSecondaryContainer = styled(Box, {
|
|
4
4
|
shouldForwardProp: (prop) => prop !== 'connected',
|
|
5
5
|
})(({ theme, connected }) => ({
|
|
6
|
-
fontSize: 12,
|
|
7
|
-
lineHeight: 1,
|
|
8
|
-
fontWeight: 500,
|
|
9
|
-
color: theme.palette.text.secondary,
|
|
10
6
|
borderLeftWidth: connected ? 2 : 0,
|
|
11
7
|
borderLeftStyle: 'solid',
|
|
12
8
|
borderColor: theme.palette.mode === 'light'
|
|
@@ -14,12 +10,22 @@ export const TextSecondary = styled(Typography, {
|
|
|
14
10
|
: theme.palette.grey[800],
|
|
15
11
|
margin: connected
|
|
16
12
|
? theme.spacing(0.5, 0, 0, 1.875)
|
|
17
|
-
: theme.spacing(0
|
|
13
|
+
: theme.spacing(0, 0, 0, 6),
|
|
18
14
|
padding: connected
|
|
19
15
|
? theme.spacing(0, 0, 0, 3.875)
|
|
20
16
|
: theme.spacing(0, 0, 0, 0),
|
|
21
17
|
display: 'flex',
|
|
22
18
|
alignItems: 'flex-start',
|
|
19
|
+
flexWrap: 'wrap',
|
|
20
|
+
}));
|
|
21
|
+
export const TextSecondary = styled(Typography, {
|
|
22
|
+
shouldForwardProp: (prop) => prop !== 'connected',
|
|
23
|
+
})(({ theme, connected }) => ({
|
|
24
|
+
fontSize: 12,
|
|
25
|
+
lineHeight: 1,
|
|
26
|
+
fontWeight: 500,
|
|
27
|
+
color: theme.palette.text.secondary,
|
|
28
|
+
marginTop: connected ? 0 : theme.spacing(0.5),
|
|
23
29
|
}));
|
|
24
30
|
export const TokenDivider = styled(Box)(({ theme }) => ({
|
|
25
31
|
height: 12,
|
|
@@ -14,7 +14,7 @@ export const TokenList = ({ formType, height, onClick, }) => {
|
|
|
14
14
|
const [selectedChainId] = useWatch({
|
|
15
15
|
name: [SwapFormKeyHelper.getChainKey(formType)],
|
|
16
16
|
});
|
|
17
|
-
const [tokenSearchFilter] = useDebouncedWatch([SwapFormKey.TokenSearchFilter],
|
|
17
|
+
const [tokenSearchFilter] = useDebouncedWatch([SwapFormKey.TokenSearchFilter], 320);
|
|
18
18
|
const { tokens: chainTokens, tokensWithBalance, isLoading: isTokensLoading, isBalanceLoading, featuredTokens, } = useTokenBalances(selectedChainId);
|
|
19
19
|
let filteredTokens = ((_a = tokensWithBalance !== null && tokensWithBalance !== void 0 ? tokensWithBalance : chainTokens) !== null && _a !== void 0 ? _a : []);
|
|
20
20
|
const searchFilter = (_b = tokenSearchFilter === null || tokenSearchFilter === void 0 ? void 0 : tokenSearchFilter.toUpperCase()) !== null && _b !== void 0 ? _b : '';
|
|
@@ -24,10 +24,10 @@ export const TokenList = ({ formType, height, onClick, }) => {
|
|
|
24
24
|
token.address.toUpperCase().includes(searchFilter))
|
|
25
25
|
: filteredTokens;
|
|
26
26
|
const tokenSearchEnabled = !isTokensLoading &&
|
|
27
|
-
|
|
27
|
+
!filteredTokens.length &&
|
|
28
28
|
!!tokenSearchFilter &&
|
|
29
29
|
!!selectedChainId;
|
|
30
|
-
const { token: searchedToken, isLoading: isSearchedTokenLoading } = useTokenSearch(
|
|
30
|
+
const { token: searchedToken, isLoading: isSearchedTokenLoading } = useTokenSearch(selectedChainId, tokenSearchFilter, tokenSearchEnabled);
|
|
31
31
|
const isLoading = isTokensLoading || (tokenSearchEnabled && isSearchedTokenLoading);
|
|
32
32
|
const tokens = filteredTokens.length
|
|
33
33
|
? filteredTokens
|
package/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/config/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget';
|
|
2
|
-
export const version = '1.18.
|
|
2
|
+
export const version = '1.18.9';
|
|
@@ -12,10 +12,7 @@ export const useDebouncedWatch = (name, delay) => {
|
|
|
12
12
|
const hasWatchedValue = Array.isArray(watchedValue)
|
|
13
13
|
? watchedValue.some((value) => value)
|
|
14
14
|
: Boolean(watchedValue);
|
|
15
|
-
|
|
16
|
-
? debouncedValueRef.current.some((value) => value)
|
|
17
|
-
: Boolean(debouncedValueRef.current);
|
|
18
|
-
if (hasWatchedValue && hasDebouncedValue) {
|
|
15
|
+
if (hasWatchedValue) {
|
|
19
16
|
const handler = setTimeout(() => {
|
|
20
17
|
setDebouncedValue(watchedValue);
|
|
21
18
|
}, delay);
|
package/hooks/useSwapRoutes.js
CHANGED
|
@@ -35,7 +35,7 @@ export const useSwapRoutes = () => {
|
|
|
35
35
|
SwapFormKey.ToAddress,
|
|
36
36
|
],
|
|
37
37
|
});
|
|
38
|
-
const [fromTokenAmount] = useDebouncedWatch([SwapFormKey.FromAmount],
|
|
38
|
+
const [fromTokenAmount] = useDebouncedWatch([SwapFormKey.FromAmount], 320);
|
|
39
39
|
const { token } = useToken(fromChainId, fromTokenAddress);
|
|
40
40
|
const isEnabled =
|
|
41
41
|
// Boolean(account.address) &&
|
package/hooks/useToken.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { useTokens } from './useTokens';
|
|
3
|
+
import { useTokenSearch } from './useTokenSearch';
|
|
3
4
|
export const useToken = (chainId, tokenAddress) => {
|
|
4
5
|
const { tokens, isLoading } = useTokens(chainId);
|
|
5
6
|
const token = useMemo(() => {
|
|
6
7
|
const token = tokens === null || tokens === void 0 ? void 0 : tokens.find((token) => token.address === tokenAddress && token.chainId === chainId);
|
|
7
8
|
return token;
|
|
8
9
|
}, [chainId, tokenAddress, tokens]);
|
|
10
|
+
const tokenSearchEnabled = !isLoading && !token;
|
|
11
|
+
const { token: searchedToken, isLoading: isSearchedTokenLoading } = useTokenSearch(chainId, tokenAddress, tokenSearchEnabled);
|
|
9
12
|
return {
|
|
10
|
-
token,
|
|
11
|
-
isLoading,
|
|
13
|
+
token: token !== null && token !== void 0 ? token : searchedToken,
|
|
14
|
+
isLoading: isLoading || (tokenSearchEnabled && isSearchedTokenLoading),
|
|
12
15
|
};
|
|
13
16
|
};
|
package/hooks/useTokenBalance.js
CHANGED
|
@@ -18,18 +18,23 @@ export const useTokenBalance = (token, accountAddress) => {
|
|
|
18
18
|
const queryClient = useQueryClient();
|
|
19
19
|
const walletAddress = accountAddress !== null && accountAddress !== void 0 ? accountAddress : account.address;
|
|
20
20
|
const getTokenBalancesWithRetry = useCallback((accountAddress, tokens, depth = 0) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
try {
|
|
22
|
+
const tokenBalances = yield lifi.getTokenBalances(accountAddress, tokens);
|
|
23
|
+
if (!tokenBalances.every((token) => token.blockNumber)) {
|
|
24
|
+
if (depth > 5) {
|
|
25
|
+
console.warn('Token balance backoff depth exceeded.');
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
yield new Promise((resolve) => {
|
|
29
|
+
setTimeout(resolve, depth * 100);
|
|
30
|
+
});
|
|
31
|
+
return getTokenBalancesWithRetry(accountAddress, tokens, depth + 1);
|
|
26
32
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
return tokenBalances;
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
//
|
|
31
37
|
}
|
|
32
|
-
return tokenBalances;
|
|
33
38
|
}), [lifi]);
|
|
34
39
|
const tokenBalanceQueryKey = 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]);
|
|
35
40
|
const { data, isLoading, refetch } = 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
|
};
|
package/hooks/useTokenSearch.js
CHANGED
|
@@ -9,10 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
11
11
|
import { useLiFi } from '../providers';
|
|
12
|
-
export const useTokenSearch = (
|
|
12
|
+
export const useTokenSearch = (chainId, token, enabled) => {
|
|
13
13
|
const lifi = useLiFi();
|
|
14
14
|
const queryClient = useQueryClient();
|
|
15
|
-
const { data, isLoading
|
|
15
|
+
const { data, isLoading } = useQuery(['token-search', chainId, token], ({ queryKey: [, chainId, token], signal }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
16
|
const data = yield lifi.getToken(chainId, token, {
|
|
17
17
|
signal,
|
|
18
18
|
});
|
|
@@ -26,13 +26,11 @@ export const useTokenSearch = (token, chainId, enabled) => {
|
|
|
26
26
|
}
|
|
27
27
|
return data;
|
|
28
28
|
}), {
|
|
29
|
-
enabled,
|
|
29
|
+
enabled: Boolean(chainId && token && enabled),
|
|
30
30
|
retry: false,
|
|
31
31
|
});
|
|
32
32
|
return {
|
|
33
33
|
token: data,
|
|
34
34
|
isLoading,
|
|
35
|
-
isFetching,
|
|
36
|
-
isFetched,
|
|
37
35
|
};
|
|
38
36
|
};
|
package/i18n/en/translation.json
CHANGED
|
@@ -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}}",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.9",
|
|
4
4
|
"description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"@mui/icons-material": "^5.10.6",
|
|
48
48
|
"@mui/lab": "^5.0.0-alpha.101",
|
|
49
49
|
"@mui/material": "^5.10.7",
|
|
50
|
-
"@sentry/integrations": "^7.
|
|
51
|
-
"@sentry/react": "^7.
|
|
52
|
-
"@sentry/tracing": "^7.
|
|
53
|
-
"@tanstack/react-query": "^4.
|
|
50
|
+
"@sentry/integrations": "^7.14.0",
|
|
51
|
+
"@sentry/react": "^7.14.0",
|
|
52
|
+
"@sentry/tracing": "^7.14.0",
|
|
53
|
+
"@tanstack/react-query": "^4.8.0",
|
|
54
54
|
"@tanstack/react-virtual": "^3.0.0-beta.18",
|
|
55
55
|
"big.js": "^6.2.1",
|
|
56
56
|
"i18next": "^21.9.2",
|
|
@@ -6,8 +6,10 @@ import { SelectChainAndToken } from '../../components/SelectChainAndToken';
|
|
|
6
6
|
import { SendToWallet, SendToWalletButton, } from '../../components/SendToWallet';
|
|
7
7
|
import { SwapInput } from '../../components/SwapInput';
|
|
8
8
|
import { SwapRoutes } from '../../components/SwapRoutes';
|
|
9
|
+
import { useWidgetConfig } from '../../providers';
|
|
9
10
|
import { FormContainer } from './MainPage.style';
|
|
10
11
|
import { MainSwapButton } from './MainSwapButton';
|
|
11
12
|
export const MainPage = () => {
|
|
12
|
-
|
|
13
|
+
const { variant } = useWidgetConfig();
|
|
14
|
+
return (_jsxs(FormContainer, Object.assign({ disableGutters: true }, { children: [_jsx(ActiveSwaps, { mx: 3, mt: 1, mb: 2 }), _jsx(SelectChainAndToken, { mt: 1, mx: 3, mb: 3 }), _jsx(Box, Object.assign({ mx: 3, mb: 3 }, { children: _jsx(SwapInput, { formType: "from" }) })), variant !== 'expandable' ? _jsx(SwapRoutes, { mx: 3, mb: 3 }) : null, _jsx(GasSufficiencyMessage, { mx: 3, mb: 3 }), _jsxs(Box, Object.assign({ mx: 3, mb: 1 }, { children: [_jsx(SendToWallet, { mb: 3 }), _jsxs(Box, Object.assign({ sx: { display: 'flex' } }, { children: [_jsx(MainSwapButton, {}), _jsx(SendToWalletButton, {})] }))] }))] })));
|
|
13
15
|
};
|
|
@@ -20,7 +20,7 @@ export const useSettingsStore = create()(persist(immer((set) => ({
|
|
|
20
20
|
appearance: 'auto',
|
|
21
21
|
gasPrice: 'normal',
|
|
22
22
|
routePriority: 'RECOMMENDED',
|
|
23
|
-
slippage: '
|
|
23
|
+
slippage: '0.5',
|
|
24
24
|
setValue: (key, value) => set((state) => {
|
|
25
25
|
state[key] = value;
|
|
26
26
|
}),
|
|
@@ -65,7 +65,7 @@ export const useSettingsStore = create()(persist(immer((set) => ({
|
|
|
65
65
|
}),
|
|
66
66
|
})), {
|
|
67
67
|
name: 'li.fi-widget-settings',
|
|
68
|
-
version:
|
|
68
|
+
version: 2,
|
|
69
69
|
partialize: (state) => {
|
|
70
70
|
const { enabledBridges, enabledExchanges } = state, partializedState = __rest(state, ["enabledBridges", "enabledExchanges"]);
|
|
71
71
|
return partializedState;
|
|
@@ -83,6 +83,9 @@ export const useSettingsStore = create()(persist(immer((set) => ({
|
|
|
83
83
|
if (version === 0 && persistedState.appearance === 'system') {
|
|
84
84
|
persistedState.appearance = 'auto';
|
|
85
85
|
}
|
|
86
|
+
if (version === 1) {
|
|
87
|
+
persistedState.slippage = '0.5';
|
|
88
|
+
}
|
|
86
89
|
return persistedState;
|
|
87
90
|
},
|
|
88
91
|
}));
|