@lifi/widget 1.18.9 → 1.19.0
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/App.js +3 -3
- package/cjs/App.js +3 -3
- package/cjs/components/ActiveSwaps/ActiveSwaps.js +1 -1
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +0 -14
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.js +1 -9
- package/cjs/components/AppContainer.d.ts +11 -1
- package/cjs/components/AppContainer.js +3 -6
- package/cjs/components/BottomSheet/BottomSheet.js +9 -32
- package/cjs/components/BottomSheet/types.d.ts +2 -2
- package/cjs/components/Card/Card.js +1 -1
- package/cjs/components/Card/CardHeader.d.ts +1 -1
- package/cjs/components/ChainSelect/ChainSelect.js +1 -1
- package/cjs/components/ChainSelect/useChainSelect.js +2 -4
- package/cjs/components/Dialog.d.ts +22 -1
- package/cjs/components/Dialog.js +23 -20
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +19 -22
- package/cjs/components/Header/NavigationHeader.js +1 -1
- package/cjs/components/Header/WalletHeader.js +2 -2
- package/cjs/components/PoweredBy/PoweredBy.js +1 -1
- package/cjs/components/ProgressToNextUpdate/ProgressToNextUpdate.js +1 -1
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.js +6 -6
- package/cjs/components/SelectTokenButton/SelectTokenButton.style.d.ts +1 -1
- package/cjs/components/SendToWallet/SendToWallet.d.ts +1 -0
- package/cjs/components/SendToWallet/SendToWallet.js +10 -5
- package/cjs/components/SendToWallet/SendToWalletButton.js +2 -2
- package/cjs/components/Step/StepProcess.js +1 -1
- package/cjs/components/SwapButton/SwapButton.js +4 -4
- package/cjs/components/SwapButton/types.d.ts +2 -0
- package/cjs/components/SwapInput/SwapInput.js +6 -2
- package/cjs/components/SwapInput/SwapInputAdornment.js +4 -2
- package/cjs/components/SwapInput/SwapInputAdornment.style.js +1 -13
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +7 -6
- package/cjs/components/SwapRoutes/SwapRoutes.js +4 -4
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +1 -0
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +17 -12
- package/cjs/components/SwapRoutes/useSetRecommendedRoute.d.ts +2 -0
- package/cjs/components/SwapRoutes/useSetRecommendedRoute.js +13 -0
- package/cjs/components/TokenList/TokenList.js +9 -6
- package/cjs/config/theme.js +22 -8
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/index.d.ts +1 -0
- package/cjs/hooks/index.js +1 -0
- package/cjs/hooks/useExpandableVariant.d.ts +1 -0
- package/cjs/hooks/useExpandableVariant.js +14 -0
- package/cjs/hooks/useGasSufficiency.d.ts +3 -2
- package/cjs/hooks/useGasSufficiency.js +50 -26
- package/cjs/hooks/useSwapRoutes.js +4 -2
- package/cjs/hooks/useTokenBalance.js +2 -2
- package/cjs/i18n/en/translation.json +8 -7
- package/cjs/i18n/index.d.ts +6 -5
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.js +21 -4
- package/cjs/pages/MainPage/MainPage.js +3 -3
- package/cjs/pages/SelectWalletPage/SelectWalletPage.js +1 -1
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +2 -2
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
- package/cjs/pages/SwapPage/StatusBottomSheet.js +4 -4
- package/cjs/pages/SwapPage/SwapPage.js +4 -4
- package/cjs/providers/SwapFormProvider/SwapFormProvider.js +3 -2
- package/cjs/providers/SwapFormProvider/URLSearchParamsBuilder.d.ts +1 -0
- package/cjs/providers/SwapFormProvider/URLSearchParamsBuilder.js +46 -0
- package/cjs/providers/SwapFormProvider/types.d.ts +4 -4
- package/cjs/providers/SwapFormProvider/types.js +2 -2
- package/cjs/providers/WalletProvider/WalletFormUpdate.d.ts +5 -0
- package/cjs/providers/WalletProvider/WalletFormUpdate.js +64 -0
- package/cjs/providers/WalletProvider/WalletProvider.js +3 -58
- package/cjs/providers/WidgetProvider/WidgetProvider.js +12 -5
- package/cjs/stores/routes/index.d.ts +1 -1
- package/cjs/stores/routes/index.js +1 -1
- package/cjs/stores/routes/types.d.ts +4 -4
- package/cjs/stores/routes/useRecommendedRouteStore.d.ts +4 -0
- package/cjs/stores/routes/{useSelectedRouteStore.js → useRecommendedRouteStore.js} +4 -4
- package/cjs/stores/routes/useRouteExecutionStore.js +9 -2
- package/cjs/types/widget.d.ts +1 -0
- package/components/ActiveSwaps/ActiveSwaps.js +3 -3
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +0 -14
- package/components/ActiveSwaps/ActiveSwaps.style.js +1 -9
- package/components/AppContainer.d.ts +11 -1
- package/components/AppContainer.js +2 -4
- package/components/BottomSheet/BottomSheet.js +9 -32
- package/components/BottomSheet/types.d.ts +2 -2
- package/components/Card/Card.js +1 -1
- package/components/Card/CardHeader.d.ts +1 -1
- package/components/ChainSelect/ChainSelect.js +1 -1
- package/components/ChainSelect/useChainSelect.js +2 -4
- package/components/Dialog.d.ts +22 -1
- package/components/Dialog.js +22 -19
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +21 -24
- package/components/Header/NavigationHeader.js +2 -2
- package/components/Header/WalletHeader.js +2 -2
- package/components/PoweredBy/PoweredBy.js +1 -1
- package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +1 -1
- package/components/ReverseTokensButton/ReverseTokensButton.js +6 -6
- package/components/SelectTokenButton/SelectTokenButton.style.d.ts +1 -1
- package/components/SendToWallet/SendToWallet.d.ts +1 -0
- package/components/SendToWallet/SendToWallet.js +9 -5
- package/components/SendToWallet/SendToWalletButton.js +2 -2
- package/components/Step/StepProcess.js +1 -1
- package/components/SwapButton/SwapButton.js +4 -4
- package/components/SwapButton/types.d.ts +2 -0
- package/components/SwapInput/SwapInput.js +6 -2
- package/components/SwapInput/SwapInputAdornment.js +4 -2
- package/components/SwapInput/SwapInputAdornment.style.js +2 -14
- package/components/SwapRouteCard/SwapRouteCard.js +8 -7
- package/components/SwapRoutes/SwapRoutes.js +4 -4
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +1 -0
- package/components/SwapRoutes/SwapRoutesExpanded.js +16 -12
- package/components/SwapRoutes/useSetRecommendedRoute.d.ts +2 -0
- package/components/SwapRoutes/useSetRecommendedRoute.js +9 -0
- package/components/TokenList/TokenList.js +9 -6
- package/config/theme.js +22 -8
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +1 -0
- package/hooks/useExpandableVariant.d.ts +1 -0
- package/hooks/useExpandableVariant.js +10 -0
- package/hooks/useGasSufficiency.d.ts +3 -2
- package/hooks/useGasSufficiency.js +50 -26
- package/hooks/useSwapRoutes.js +4 -2
- package/hooks/useTokenBalance.js +2 -2
- package/i18n/en/translation.json +8 -7
- package/i18n/index.d.ts +6 -5
- package/package.json +11 -11
- package/pages/ActiveSwapsPage/ActiveSwapsPage.js +24 -7
- package/pages/MainPage/MainPage.js +3 -3
- package/pages/SelectWalletPage/SelectWalletPage.js +1 -1
- package/pages/SwapDetailsPage/SwapDetailsPage.js +2 -2
- package/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
- package/pages/SwapPage/StatusBottomSheet.js +4 -4
- package/pages/SwapPage/SwapPage.js +5 -5
- package/providers/SwapFormProvider/SwapFormProvider.js +4 -3
- package/providers/SwapFormProvider/URLSearchParamsBuilder.d.ts +1 -0
- package/providers/SwapFormProvider/URLSearchParamsBuilder.js +42 -0
- package/providers/SwapFormProvider/types.d.ts +4 -4
- package/providers/SwapFormProvider/types.js +2 -2
- package/providers/WalletProvider/WalletFormUpdate.d.ts +5 -0
- package/providers/WalletProvider/WalletFormUpdate.js +60 -0
- package/providers/WalletProvider/WalletProvider.js +5 -60
- package/providers/WidgetProvider/WidgetProvider.js +12 -5
- package/stores/routes/index.d.ts +1 -1
- package/stores/routes/index.js +1 -1
- package/stores/routes/types.d.ts +4 -4
- package/stores/routes/useRecommendedRouteStore.d.ts +4 -0
- package/stores/routes/useRecommendedRouteStore.js +9 -0
- package/stores/routes/useRouteExecutionStore.js +9 -2
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/widget.d.ts +1 -0
- package/cjs/components/SwapRoutes/useSetSelectedRoute.d.ts +0 -2
- package/cjs/components/SwapRoutes/useSetSelectedRoute.js +0 -13
- package/cjs/stores/routes/useSelectedRouteStore.d.ts +0 -4
- package/components/SwapRoutes/useSetSelectedRoute.d.ts +0 -2
- package/components/SwapRoutes/useSetSelectedRoute.js +0 -9
- package/stores/routes/useSelectedRouteStore.d.ts +0 -4
- package/stores/routes/useSelectedRouteStore.js +0 -9
|
@@ -5,9 +5,9 @@ import { useNavigate } from 'react-router-dom';
|
|
|
5
5
|
import { useWallet } from '../../providers';
|
|
6
6
|
import { useExecutingRoutesIds } from '../../stores';
|
|
7
7
|
import { navigationRoutes } from '../../utils';
|
|
8
|
-
import { CardTitle } from '../Card';
|
|
8
|
+
import { Card, CardTitle } from '../Card';
|
|
9
9
|
import { ActiveSwapItem } from './ActiveSwapItem';
|
|
10
|
-
import {
|
|
10
|
+
import { ShowAllButton } from './ActiveSwaps.style';
|
|
11
11
|
export const ActiveSwaps = (props) => {
|
|
12
12
|
const { t } = useTranslation();
|
|
13
13
|
const navigate = useNavigate();
|
|
@@ -20,7 +20,7 @@ export const ActiveSwaps = (props) => {
|
|
|
20
20
|
navigate(navigationRoutes.activeSwaps);
|
|
21
21
|
};
|
|
22
22
|
const hasShowAll = (executingRoutes === null || executingRoutes === void 0 ? void 0 : executingRoutes.length) > 2;
|
|
23
|
-
return (_jsxs(
|
|
23
|
+
return (_jsxs(Card, Object.assign({ variant: "selected", selectionColor: "secondary" }, props, { children: [_jsx(CardTitle, { children: t('header.activeSwaps') }), _jsx(Stack, Object.assign({ spacing: 1.5, pt: 1.5, pb: hasShowAll ? 0 : 2 }, { children: executingRoutes.slice(0, 2).map((routeId) => (_jsx(ActiveSwapItem, { routeId: routeId, dense: true }, routeId))) })), hasShowAll ? (_jsx(ShowAllButton, Object.assign({ disableRipple: true, fullWidth: true, onClick: handleShowAll, sx: (theme) => ({
|
|
24
24
|
padding: theme.spacing(0.75, 2),
|
|
25
25
|
}) }, { children: t('button.showAll') }))) : null] })));
|
|
26
26
|
};
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const ProgressCard: 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
|
-
variant?: ("default" | "error" | "selected") | undefined;
|
|
11
|
-
selectionColor?: "primary" | "secondary" | undefined;
|
|
12
|
-
dense?: boolean | undefined;
|
|
13
|
-
indented?: boolean | undefined;
|
|
14
|
-
onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
15
|
-
}, {}, {}>;
|
|
16
2
|
export declare const ListItemButton: import("@emotion/styled").StyledComponent<import("@mui/material").ListItemButtonBaseProps & Omit<{
|
|
17
3
|
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
18
4
|
centerRipple?: boolean | undefined;
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import { Button, ListItem as MuiListItem, ListItemButton as MuiListItemButton, } from '@mui/material';
|
|
2
2
|
import { listItemSecondaryActionClasses } from '@mui/material/ListItemSecondaryAction';
|
|
3
|
-
import {
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { getContrastAlphaColor } from '../../utils';
|
|
5
|
-
import { Card } from '../Card';
|
|
6
|
-
export const ProgressCard = styled(Card)(({ theme }) => ({
|
|
7
|
-
borderColor: alpha(theme.palette.secondary.main, 0.48),
|
|
8
|
-
background: alpha(theme.palette.secondary.main, 0.08),
|
|
9
|
-
'&:hover': {
|
|
10
|
-
background: alpha(theme.palette.secondary.main, 0.08),
|
|
11
|
-
},
|
|
12
|
-
}));
|
|
13
5
|
export const ListItemButton = styled(MuiListItemButton)(({ theme }) => ({
|
|
14
6
|
borderRadius: theme.shape.borderRadiusSecondary,
|
|
15
7
|
paddingLeft: theme.spacing(1.5),
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import type { WidgetVariant } from '../types';
|
|
2
3
|
export declare const maxHeight = 680;
|
|
4
|
+
export declare const AppExpandedContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
5
|
+
children?: import("react").ReactNode;
|
|
6
|
+
component?: import("react").ElementType<any> | undefined;
|
|
7
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
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" | ("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> & {
|
|
12
|
+
variant?: WidgetVariant | undefined;
|
|
13
|
+
}, {}, {}>;
|
|
3
14
|
export declare const FlexContainer: import("@emotion/styled").StyledComponent<{
|
|
4
15
|
children?: import("react").ReactNode;
|
|
5
16
|
classes?: Partial<import("@mui/material").ContainerClasses> | undefined;
|
|
@@ -11,4 +22,3 @@ export declare const FlexContainer: import("@emotion/styled").StyledComponent<{
|
|
|
11
22
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
12
23
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "maxWidth" | "fixed" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
13
24
|
export declare const AppContainer: React.FC<PropsWithChildren<{}>>;
|
|
14
|
-
export declare const AppExpandedContainer: React.FC<PropsWithChildren<{}>>;
|
|
@@ -4,7 +4,7 @@ import { styled } from '@mui/material/styles';
|
|
|
4
4
|
import { useWidgetConfig } from '../providers';
|
|
5
5
|
import { ElementId } from '../utils';
|
|
6
6
|
export const maxHeight = 680;
|
|
7
|
-
const
|
|
7
|
+
export const AppExpandedContainer = styled(Box, {
|
|
8
8
|
shouldForwardProp: (prop) => prop !== 'variant',
|
|
9
9
|
})(({ variant }) => ({
|
|
10
10
|
display: 'flex',
|
|
@@ -30,6 +30,7 @@ const RelativeContainer = styled(Box, {
|
|
|
30
30
|
const CssBaselineContainer = styled(ScopedCssBaseline, {
|
|
31
31
|
shouldForwardProp: (prop) => prop !== 'variant',
|
|
32
32
|
})(({ variant }) => ({
|
|
33
|
+
position: 'relative',
|
|
33
34
|
display: 'flex',
|
|
34
35
|
flex: 1,
|
|
35
36
|
flexDirection: 'column',
|
|
@@ -50,6 +51,3 @@ export const AppContainer = ({ children }) => {
|
|
|
50
51
|
const { containerStyle, variant } = useWidgetConfig();
|
|
51
52
|
return (_jsx(RelativeContainer, Object.assign({ sx: containerStyle, variant: variant }, { children: _jsx(CssBaselineContainer, Object.assign({ id: ElementId.ScrollableContainer, variant: variant, enableColorScheme: true }, { children: _jsx(FlexContainer, Object.assign({ disableGutters: true }, { children: children })) })) })));
|
|
52
53
|
};
|
|
53
|
-
export const AppExpandedContainer = ({ children, }) => {
|
|
54
|
-
return _jsx(ExpandedContainer, { children: children });
|
|
55
|
-
};
|
|
@@ -1,44 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Drawer } from '@mui/material';
|
|
3
3
|
import { forwardRef, useCallback, useImperativeHandle, useRef, useState, } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { backdropProps, modalProps, paperProps } from '../Dialog';
|
|
5
5
|
export const BottomSheet = forwardRef(({ elementRef, children, open }, ref) => {
|
|
6
6
|
const openRef = useRef(open);
|
|
7
7
|
const [drawerOpen, setDrawerOpen] = useState(open);
|
|
8
|
-
const
|
|
9
|
-
const openDrawer = useCallback(() => {
|
|
10
|
-
setDrawerOpen(true);
|
|
11
|
-
openRef.current = true;
|
|
12
|
-
}, []);
|
|
13
|
-
const closeDrawer = useCallback(() => {
|
|
8
|
+
const close = useCallback(() => {
|
|
14
9
|
setDrawerOpen(false);
|
|
15
10
|
openRef.current = false;
|
|
16
11
|
}, []);
|
|
17
12
|
useImperativeHandle(ref, () => ({
|
|
18
13
|
isOpen: () => openRef.current,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
keepMounted: true,
|
|
28
|
-
}, PaperProps: {
|
|
29
|
-
sx: (theme) => ({
|
|
30
|
-
position: 'absolute',
|
|
31
|
-
backgroundImage: 'none',
|
|
32
|
-
borderTopLeftRadius: theme.shape.borderRadius,
|
|
33
|
-
borderTopRightRadius: theme.shape.borderRadius,
|
|
34
|
-
}),
|
|
35
|
-
}, BackdropProps: {
|
|
36
|
-
sx: {
|
|
37
|
-
position: 'absolute',
|
|
38
|
-
backgroundColor: 'rgb(0 0 0 / 48%)',
|
|
39
|
-
backdropFilter: 'blur(3px)',
|
|
40
|
-
},
|
|
41
|
-
}, SlideProps: {
|
|
42
|
-
container: containerElement,
|
|
43
|
-
} }, { children: children })));
|
|
14
|
+
open: () => {
|
|
15
|
+
setDrawerOpen(true);
|
|
16
|
+
openRef.current = true;
|
|
17
|
+
},
|
|
18
|
+
close,
|
|
19
|
+
}), [close]);
|
|
20
|
+
return (_jsx(Drawer, Object.assign({ ref: elementRef, anchor: "bottom", open: drawerOpen, onClose: close, ModalProps: modalProps, PaperProps: paperProps, BackdropProps: backdropProps, disableAutoFocus: true, disableEnforceFocus: true, disableScrollLock: true, disablePortal: true }, { children: children })));
|
|
44
21
|
});
|
package/components/Card/Card.js
CHANGED
|
@@ -5,7 +5,7 @@ const getBackgroundColor = (theme, variant, selectionColor) => variant === 'sele
|
|
|
5
5
|
? theme.palette.mode === 'light'
|
|
6
6
|
? alpha(theme.palette.primary.main, 0.04)
|
|
7
7
|
: alpha(theme.palette.primary.main, 0.42)
|
|
8
|
-
: alpha(theme.palette.secondary.main, 0.08)
|
|
8
|
+
: alpha(theme.palette.secondary.main, theme.palette.mode === 'light' ? 0.08 : 0.12)
|
|
9
9
|
: theme.palette.background.paper;
|
|
10
10
|
export const Card = styled(Box, {
|
|
11
11
|
shouldForwardProp: (prop) => !['dense', 'variant', 'indented', 'selectionColor'].includes(prop),
|
|
@@ -15,4 +15,4 @@ export declare const CardHeader: import("@emotion/styled").StyledComponent<{
|
|
|
15
15
|
}> | undefined;
|
|
16
16
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
17
17
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
18
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "title" | "action" | "sx" | "
|
|
18
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "title" | "action" | "sx" | "disableTypography" | "avatar" | "subheader" | "subheaderTypographyProps" | "titleTypographyProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -22,7 +22,7 @@ export const ChainSelect = ({ formType }) => {
|
|
|
22
22
|
const chainsToHide = ((_a = chains === null || chains === void 0 ? void 0 : chains.length) !== null && _a !== void 0 ? _a : 0) - maxChainToOrder;
|
|
23
23
|
return (_jsxs(ChainContainer, { children: [isLoading
|
|
24
24
|
? Array.from({ length: maxChainToOrder + 1 }).map((_, index) => (_jsx(Skeleton, { variant: "rectangular", width: 56, height: 56, sx: { borderRadius: 1 } }, index)))
|
|
25
|
-
: getChains().map((chain) => (_jsx(Tooltip, Object.assign({ title: chain.name, placement: "top", enterDelay:
|
|
25
|
+
: getChains().map((chain) => (_jsx(Tooltip, Object.assign({ title: chain.name, placement: "top", enterDelay: 400, enterNextDelay: 400, arrow: true }, { children: _jsx(ChainCard, Object.assign({ onClick: () => setCurrentChain(chain.id), variant: chainId === chain.id ? 'selected' : 'default' }, { children: _jsx(Avatar, Object.assign({ src: chain.logoURI, alt: chain.key, sx: { width: 40, height: 40 } }, { children: chain.name[0] })) })) }), chain.id))), chainsToHide > 0 ? (_jsx(ChainCard, Object.assign({ onClick: showAllChains }, { children: _jsx(Box, Object.assign({ sx: {
|
|
26
26
|
width: 40,
|
|
27
27
|
height: 40,
|
|
28
28
|
display: 'grid',
|
|
@@ -17,10 +17,8 @@ export const useChainSelect = (formType) => {
|
|
|
17
17
|
return selectedChains;
|
|
18
18
|
};
|
|
19
19
|
const setCurrentChain = (chainId) => {
|
|
20
|
-
setValue(chainKey, chainId, {
|
|
21
|
-
setValue(SwapFormKeyHelper.getTokenKey(formType), ''
|
|
22
|
-
shouldDirty: false,
|
|
23
|
-
});
|
|
20
|
+
setValue(chainKey, chainId, { shouldTouch: true });
|
|
21
|
+
setValue(SwapFormKeyHelper.getTokenKey(formType), '');
|
|
24
22
|
setValue(SwapFormKeyHelper.getAmountKey(formType), '');
|
|
25
23
|
setValue(SwapFormKey.TokenSearchFilter, '');
|
|
26
24
|
setChainOrder(chainId);
|
package/components/Dialog.d.ts
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
-
import type { DialogProps } from '@mui/material';
|
|
1
|
+
import type { DialogProps, Theme } from '@mui/material';
|
|
2
2
|
import type { PropsWithChildren } from 'react';
|
|
3
|
+
export declare const modalProps: {
|
|
4
|
+
sx: {
|
|
5
|
+
position: string;
|
|
6
|
+
overflow: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare const paperProps: {
|
|
10
|
+
sx: (theme: Theme) => {
|
|
11
|
+
position: string;
|
|
12
|
+
backgroundImage: string;
|
|
13
|
+
borderTopLeftRadius: number;
|
|
14
|
+
borderTopRightRadius: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare const backdropProps: {
|
|
18
|
+
sx: {
|
|
19
|
+
position: string;
|
|
20
|
+
backgroundColor: string;
|
|
21
|
+
backdropFilter: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
3
24
|
export declare const Dialog: React.FC<PropsWithChildren<DialogProps>>;
|
package/components/Dialog.js
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Dialog as MuiDialog } from '@mui/material';
|
|
3
|
-
|
|
3
|
+
export const modalProps = {
|
|
4
|
+
sx: {
|
|
5
|
+
position: 'absolute',
|
|
6
|
+
overflow: 'hidden',
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
export const paperProps = {
|
|
10
|
+
sx: (theme) => ({
|
|
11
|
+
position: 'absolute',
|
|
12
|
+
backgroundImage: 'none',
|
|
13
|
+
borderTopLeftRadius: theme.shape.borderRadius,
|
|
14
|
+
borderTopRightRadius: theme.shape.borderRadius,
|
|
15
|
+
}),
|
|
16
|
+
};
|
|
17
|
+
export const backdropProps = {
|
|
18
|
+
sx: {
|
|
19
|
+
position: 'absolute',
|
|
20
|
+
backgroundColor: 'rgb(0 0 0 / 32%)',
|
|
21
|
+
backdropFilter: 'blur(3px)',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
4
24
|
export const Dialog = ({ children, open, onClose, }) => {
|
|
5
|
-
|
|
6
|
-
return (_jsx(MuiDialog, Object.assign({ open: open, onClose: onClose, container: containerElement, sx: {
|
|
7
|
-
position: 'absolute',
|
|
8
|
-
overflow: 'hidden',
|
|
9
|
-
}, PaperProps: {
|
|
10
|
-
sx: (theme) => ({
|
|
11
|
-
position: 'absolute',
|
|
12
|
-
backgroundImage: 'none',
|
|
13
|
-
borderTopLeftRadius: theme.shape.borderRadius,
|
|
14
|
-
borderTopRightRadius: theme.shape.borderRadius,
|
|
15
|
-
}),
|
|
16
|
-
}, BackdropProps: {
|
|
17
|
-
sx: {
|
|
18
|
-
position: 'absolute',
|
|
19
|
-
backgroundColor: 'rgb(0 0 0 / 32%)',
|
|
20
|
-
backdropFilter: 'blur(3px)',
|
|
21
|
-
},
|
|
22
|
-
} }, { children: children })));
|
|
25
|
+
return (_jsx(MuiDialog, Object.assign({ open: open, onClose: onClose, sx: modalProps.sx, PaperProps: paperProps, BackdropProps: backdropProps, disableAutoFocus: true, disableEnforceFocus: true, disableScrollLock: true, disablePortal: true }, { children: children })));
|
|
23
26
|
};
|
|
@@ -11,35 +11,32 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { WarningAmber as WarningIcon } from '@mui/icons-material';
|
|
14
|
-
import { Box, Typography } from '@mui/material';
|
|
14
|
+
import { Box, Collapse, Typography } from '@mui/material';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { useGasSufficiency } from '../../hooks';
|
|
17
|
-
import {
|
|
17
|
+
import { useRecommendedRouteStore } from '../../stores';
|
|
18
18
|
import { CardTitle } from '../Card';
|
|
19
19
|
import { MessageCard } from './GasSufficiencyMessage.style';
|
|
20
20
|
export const GasSufficiencyMessage = (_a) => {
|
|
21
21
|
var { route } = _a, props = __rest(_a, ["route"]);
|
|
22
22
|
const { t } = useTranslation();
|
|
23
|
-
const
|
|
24
|
-
const { insufficientFunds, insufficientGas } = useGasSufficiency(route !== null && route !== void 0 ? route :
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}) }), index));
|
|
43
|
-
})
|
|
44
|
-
: null] })] })));
|
|
23
|
+
const recommendedRoute = useRecommendedRouteStore((state) => state.recommendedRoute);
|
|
24
|
+
const { insufficientFunds, insufficientGas } = useGasSufficiency(route !== null && route !== void 0 ? route : recommendedRoute);
|
|
25
|
+
return (_jsx(Collapse, Object.assign({ timeout: 225, in: Boolean(insufficientFunds || (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length)), unmountOnExit: true, mountOnEnter: true, appear: true }, { children: _jsx(Box, Object.assign({}, props, { children: _jsxs(MessageCard, { children: [_jsx(WarningIcon, { sx: {
|
|
26
|
+
marginTop: 2,
|
|
27
|
+
marginLeft: 2,
|
|
28
|
+
} }), _jsxs(Box, { children: [(insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? (_jsx(CardTitle, { children: t(`swap.warning.title.insufficientGas`) })) : null, insufficientFunds ? (_jsx(Typography, Object.assign({ variant: "body2", px: 2, pb: (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? 0 : 2, pt: (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? 1 : 2 }, { children: insufficientFunds
|
|
29
|
+
? t(`swap.warning.message.insufficientFunds`)
|
|
30
|
+
: null }))) : null, (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? (_jsx(Typography, Object.assign({ variant: "body2", px: 2, pt: 1 }, { children: t(`swap.warning.message.insufficientGas`) }))) : null, (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length)
|
|
31
|
+
? insufficientGas.map((item, index) => {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
return (_jsx(Typography
|
|
34
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
35
|
+
, Object.assign({ variant: "body2", px: 2, pb: insufficientGas.length - 1 === index ? 2 : 0, pt: 0.5 }, { children: t(`swap.tokenOnChainAmount`, {
|
|
36
|
+
amount: (_a = item.insufficientAmount) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
37
|
+
tokenSymbol: item.token.symbol,
|
|
38
|
+
chainName: (_b = item.chain) === null || _b === void 0 ? void 0 : _b.name,
|
|
39
|
+
}) }), index));
|
|
40
|
+
})
|
|
41
|
+
: null] })] }) })) })));
|
|
45
42
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ArrowBack as ArrowBackIcon, History as HistoryIcon, SettingsOutlined as SettingsIcon, } from '@mui/icons-material';
|
|
3
|
-
import { Box, IconButton, Typography } from '@mui/material';
|
|
3
|
+
import { Box, IconButton, Tooltip, Typography } from '@mui/material';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { Route, Routes, useLocation } from 'react-router-dom';
|
|
6
6
|
import { useNavigateBack } from '../../hooks';
|
|
@@ -46,5 +46,5 @@ export const NavigationHeader = () => {
|
|
|
46
46
|
return t(`header.swap`);
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
return (_jsxs(HeaderAppBar, Object.assign({ elevation: 0 }, { children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, Object.assign({ size: "medium",
|
|
49
|
+
return (_jsxs(HeaderAppBar, Object.assign({ elevation: 0 }, { children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, Object.assign({ size: "medium", edge: "start", onClick: navigateBack }, { children: _jsx(ArrowBackIcon, {}) }))) : null, _jsx(Typography, Object.assign({ fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true }, { children: handleHeaderTitle() })), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsxs(_Fragment, { children: [account.isActive ? (_jsx(Tooltip, Object.assign({ title: t(`header.swapHistory`), enterDelay: 400, enterNextDelay: 400, arrow: true }, { children: _jsx(IconButton, Object.assign({ size: "medium", edge: "start", onClick: () => navigate(navigationRoutes.swapHistory) }, { children: _jsx(HistoryIcon, {}) })) }))) : null, _jsx(Tooltip, Object.assign({ title: t(`header.settings`), enterDelay: 400, enterNextDelay: 400, arrow: true }, { children: _jsx(IconButton, Object.assign({ size: "medium", edge: "end", onClick: () => navigate(navigationRoutes.settings) }, { children: _jsx(SettingsIcon, {}) })) }))] }) }), _jsx(Route, { path: "*", element: element || _jsx(Box, { width: 28, height: 40 }) })] })] })));
|
|
50
50
|
};
|
|
@@ -23,7 +23,7 @@ export const WalletHeader = () => {
|
|
|
23
23
|
display: 'flex',
|
|
24
24
|
flex: 1,
|
|
25
25
|
flexDirection: 'column',
|
|
26
|
-
}, mr: 0.5 }, { children: [_jsx(Typography, Object.assign({ variant: "caption", align: "right" }, { children: t(`header.walletConnected`) })), _jsx(Typography, Object.assign({ variant: "body2", align: "right", fontWeight: "600" }, { children: walletAddress }))] })), _jsx(IconButton, Object.assign({ size: "medium",
|
|
26
|
+
}, mr: 0.5 }, { children: [_jsx(Typography, Object.assign({ variant: "caption", align: "right" }, { children: t(`header.walletConnected`) })), _jsx(Typography, Object.assign({ variant: "body2", align: "right", fontWeight: "600" }, { children: walletAddress }))] })), _jsx(IconButton, Object.assign({ size: "medium", edge: "end", onClick: disconnect }, { children: _jsx(LogoutIcon, {}) }))] })) : (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ variant: "body2", align: "right", fontWeight: "600", flex: 1, mr: 0.5 }, { children: t(`header.connectWallet`) })), _jsx(ConnectButton, {})] })) })));
|
|
27
27
|
};
|
|
28
28
|
const ConnectButton = () => {
|
|
29
29
|
const { pathname } = useLocation();
|
|
@@ -37,5 +37,5 @@ const ConnectButton = () => {
|
|
|
37
37
|
}
|
|
38
38
|
navigate(navigationRoutes.selectWallet);
|
|
39
39
|
});
|
|
40
|
-
return (_jsx(IconButton, Object.assign({ size: "medium",
|
|
40
|
+
return (_jsx(IconButton, Object.assign({ size: "medium", edge: "end", onClick: !pathname.includes(navigationRoutes.selectWallet) ? connect : undefined }, { children: _jsx(WalletOutlinedIcon, {}) })));
|
|
41
41
|
};
|
|
@@ -15,5 +15,5 @@ export const PoweredBy = () => {
|
|
|
15
15
|
display: 'flex',
|
|
16
16
|
alignItems: 'flex-end',
|
|
17
17
|
justifyContent: 'flex-end',
|
|
18
|
-
} }, { children: _jsx(Tooltip, Object.assign({ title: `v${version}`, placement: "top", enterDelay:
|
|
18
|
+
} }, { children: _jsx(Tooltip, Object.assign({ title: `v${version}`, placement: "top", enterDelay: 3000, arrow: true }, { children: _jsxs(Link, Object.assign({ href: "https://li.fi", target: "_blank", underline: "none", color: "text.primary" }, { children: [_jsx(Typography, Object.assign({ color: "text.secondary", fontSize: 12, px: 0.5 }, { children: "Powered by" })), _jsx(LiFiLogo, { variant: "full", style: { height: 16, width: 42 } })] })) })) })));
|
|
19
19
|
};
|
|
@@ -39,7 +39,7 @@ export const ProgressToNextUpdate = (_a) => {
|
|
|
39
39
|
}, [isLoading]);
|
|
40
40
|
return (_jsx(IconButton, Object.assign({ onClick: onClick, disabled: isLoading }, other, { children: _jsx(Tooltip, Object.assign({ title: t('tooltip.progressToNextUpdate', {
|
|
41
41
|
value: getSecondsToUpdate(updatedAt, timeToUpdate),
|
|
42
|
-
}), placement: "top", enterDelay:
|
|
42
|
+
}), placement: "top", enterDelay: 400, enterNextDelay: 400, arrow: true }, { children: _jsxs(Box, Object.assign({ sx: {
|
|
43
43
|
display: 'grid',
|
|
44
44
|
position: 'relative',
|
|
45
45
|
placeItems: 'center',
|
|
@@ -12,11 +12,11 @@ export const ReverseTokensButton = ({ vertical, }) => {
|
|
|
12
12
|
SwapFormKey.ToChain,
|
|
13
13
|
SwapFormKey.ToToken,
|
|
14
14
|
]);
|
|
15
|
-
setValue(SwapFormKey.FromAmount, '');
|
|
16
|
-
setValue(SwapFormKey.FromChain, toChain);
|
|
17
|
-
setValue(SwapFormKey.FromToken, toToken);
|
|
18
|
-
setValue(SwapFormKey.ToChain, fromChain);
|
|
19
|
-
setValue(SwapFormKey.ToToken, fromToken);
|
|
15
|
+
setValue(SwapFormKey.FromAmount, '', { shouldTouch: true });
|
|
16
|
+
setValue(SwapFormKey.FromChain, toChain, { shouldTouch: true });
|
|
17
|
+
setValue(SwapFormKey.FromToken, toToken, { shouldTouch: true });
|
|
18
|
+
setValue(SwapFormKey.ToChain, fromChain, { shouldTouch: true });
|
|
19
|
+
setValue(SwapFormKey.ToToken, fromToken, { shouldTouch: true });
|
|
20
20
|
};
|
|
21
|
-
return (_jsx(IconButton, Object.assign({ onClick: handleClick, size: "small"
|
|
21
|
+
return (_jsx(IconButton, Object.assign({ onClick: handleClick, size: "small" }, { children: vertical ? _jsx(SwapVertIcon, {}) : _jsx(SwapHorizIcon, {}) })));
|
|
22
22
|
};
|
|
@@ -15,7 +15,7 @@ export declare const SelectTokenCardHeader: import("@emotion/styled").StyledComp
|
|
|
15
15
|
}> | undefined;
|
|
16
16
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
17
17
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
18
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "title" | "action" | "sx" | "
|
|
18
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "title" | "action" | "sx" | "disableTypography" | "avatar" | "subheader" | "subheaderTypographyProps" | "titleTypographyProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
19
19
|
selected?: boolean | undefined;
|
|
20
20
|
compact?: boolean | undefined;
|
|
21
21
|
}, {}, {}>;
|
|
@@ -11,18 +11,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
import { isAddress } from '@ethersproject/address';
|
|
12
12
|
import { Collapse, FormHelperText } from '@mui/material';
|
|
13
13
|
import { forwardRef, useEffect } from 'react';
|
|
14
|
-
import { useFormContext } from 'react-hook-form';
|
|
14
|
+
import { useFormContext, useFormState } from 'react-hook-form';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { SwapFormKey, useWallet } from '../../providers';
|
|
17
17
|
import { Card, CardTitle } from '../Card';
|
|
18
18
|
import { FormControl, Input } from './SendToWallet.style';
|
|
19
19
|
import { useSendToWalletStore } from './store';
|
|
20
20
|
export const SendToWallet = forwardRef((props, ref) => {
|
|
21
|
-
var _a;
|
|
22
21
|
const { t } = useTranslation();
|
|
23
22
|
const showSendToWallet = useSendToWalletStore((state) => state.showSendToWallet);
|
|
24
23
|
const { account, provider } = useWallet();
|
|
25
|
-
const { register, trigger
|
|
24
|
+
const { register, trigger } = useFormContext();
|
|
26
25
|
useEffect(() => {
|
|
27
26
|
trigger(SwapFormKey.ToAddress);
|
|
28
27
|
}, [account.chainId, trigger]);
|
|
@@ -36,11 +35,16 @@ export const SendToWallet = forwardRef((props, ref) => {
|
|
|
36
35
|
return (isAddress(address || value) ||
|
|
37
36
|
t('swap.error.title.walletAddressInvalid'));
|
|
38
37
|
}
|
|
39
|
-
catch (
|
|
38
|
+
catch (_a) {
|
|
40
39
|
return t('swap.error.title.walletEnsAddressInvalid');
|
|
41
40
|
}
|
|
42
41
|
}),
|
|
43
42
|
onBlur: () => trigger(SwapFormKey.ToAddress),
|
|
44
43
|
});
|
|
45
|
-
return (_jsx(Collapse, Object.assign({ timeout: 225,
|
|
44
|
+
return (_jsx(Collapse, Object.assign({ timeout: 225, in: showSendToWallet, mountOnEnter: true, unmountOnExit: true }, { children: _jsxs(Card, Object.assign({}, props, { ref: ref }, { children: [_jsx(CardTitle, { children: t('swap.sendToWallet') }), _jsxs(FormControl, Object.assign({ fullWidth: true, sx: { paddingTop: '6px', paddingBottom: '5px' } }, { children: [_jsx(Input, { ref: inputRef, size: "small", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: "false", onChange: onChange, onBlur: onBlur, name: name, placeholder: t('swap.walletAddressOrEns'), autoFocus: true }), _jsx(SendToWalletFormHelperText, {})] }))] })) })));
|
|
46
45
|
});
|
|
46
|
+
export const SendToWalletFormHelperText = () => {
|
|
47
|
+
var _a;
|
|
48
|
+
const { errors } = useFormState();
|
|
49
|
+
return (_jsx(FormHelperText, Object.assign({ error: !!errors.toAddress }, { children: (_a = errors.toAddress) === null || _a === void 0 ? void 0 : _a.message })));
|
|
50
|
+
};
|
|
@@ -17,11 +17,11 @@ export const SendToWalletButton = () => {
|
|
|
17
17
|
}
|
|
18
18
|
const handleClick = () => {
|
|
19
19
|
if (showSendToWallet) {
|
|
20
|
-
setValue(SwapFormKey.ToAddress, '');
|
|
20
|
+
setValue(SwapFormKey.ToAddress, '', { shouldTouch: true });
|
|
21
21
|
}
|
|
22
22
|
toggleSendToWallet();
|
|
23
23
|
};
|
|
24
|
-
return (_jsx(Tooltip, Object.assign({ title: t('swap.sendToWallet'), placement: "bottom-end", enterDelay:
|
|
24
|
+
return (_jsx(Tooltip, Object.assign({ title: t('swap.sendToWallet'), placement: "bottom-end", enterDelay: 400, enterNextDelay: 400, arrow: true }, { children: _jsx(Button, Object.assign({ variant: showSendToWallet ? 'contained' : 'text', onClick: handleClick, sx: {
|
|
25
25
|
minWidth: 48,
|
|
26
26
|
marginLeft: 1,
|
|
27
27
|
} }, { children: _jsx(WalletOutlinedIcon, {}) })) })));
|
|
@@ -13,5 +13,5 @@ export const StepProcess = ({ step, process }) => {
|
|
|
13
13
|
display: 'flex',
|
|
14
14
|
flex: 1,
|
|
15
15
|
justifyContent: 'flex-end',
|
|
16
|
-
} }, { children: _jsx(LinkButton, Object.assign({ size: "small",
|
|
16
|
+
} }, { children: _jsx(LinkButton, Object.assign({ size: "small", edge: "end", LinkComponent: Link, href: process.txLink, target: "_blank", rel: "nofollow noreferrer" }, { children: _jsx(LinkIcon, {}) })) }))) : null] })), message ? (_jsx(Typography, Object.assign({ ml: 6, fontSize: 14, fontWeight: 500, color: "text.secondary" }, { children: message }))) : null] })));
|
|
17
17
|
};
|
|
@@ -8,19 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
import {
|
|
11
|
+
import { LoadingButton } from '@mui/lab';
|
|
12
12
|
import { forwardRef } from 'react';
|
|
13
13
|
import { useTranslation } from 'react-i18next';
|
|
14
14
|
import { useNavigate } from 'react-router-dom';
|
|
15
15
|
import { useGasSufficiency } from '../../hooks';
|
|
16
16
|
import { useWallet, useWidgetConfig } from '../../providers';
|
|
17
17
|
import { navigationRoutes } from '../../utils';
|
|
18
|
-
export const SwapButton = forwardRef(({ onClick, currentRoute, text, disable }, ref) => {
|
|
18
|
+
export const SwapButton = forwardRef(({ onClick, currentRoute, text, disable, enableLoading, loading }, ref) => {
|
|
19
19
|
const { t } = useTranslation();
|
|
20
20
|
const navigate = useNavigate();
|
|
21
21
|
const config = useWidgetConfig();
|
|
22
22
|
const { account, connect } = useWallet();
|
|
23
|
-
const { insufficientFunds, insufficientGas } = useGasSufficiency(currentRoute);
|
|
23
|
+
const { insufficientFunds, insufficientGas, isLoading: isGasSufficiencyLoading, } = useGasSufficiency(currentRoute);
|
|
24
24
|
const handleSwapButtonClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
25
|
if (!account.isActive) {
|
|
26
26
|
if (config.walletManagement) {
|
|
@@ -43,5 +43,5 @@ export const SwapButton = forwardRef(({ onClick, currentRoute, text, disable },
|
|
|
43
43
|
}
|
|
44
44
|
return t(`button.connectWallet`);
|
|
45
45
|
};
|
|
46
|
-
return (_jsx(
|
|
46
|
+
return (_jsx(LoadingButton, Object.assign({ variant: "contained", color: account.isActive ? 'primary' : 'success', onClick: handleSwapButtonClick, disabled: insufficientFunds || !!(insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) || disable, loading: enableLoading && (loading || isGasSufficiencyLoading), loadingPosition: "center", fullWidth: true, ref: ref }, { children: getButtonText() })));
|
|
47
47
|
});
|
|
@@ -27,11 +27,15 @@ export const SwapInput = ({ formType }) => {
|
|
|
27
27
|
const isSelected = !!(chain && token);
|
|
28
28
|
const handleChange = (event) => {
|
|
29
29
|
const { value } = event.target;
|
|
30
|
-
|
|
30
|
+
const formattedAmount = formatAmount(value, true);
|
|
31
|
+
setValue(amountKey, formattedAmount, {
|
|
32
|
+
shouldTouch: true,
|
|
33
|
+
});
|
|
31
34
|
};
|
|
32
35
|
const handleBlur = (event) => {
|
|
33
36
|
const { value } = event.target;
|
|
34
|
-
|
|
37
|
+
const formattedAmount = formatAmount(value);
|
|
38
|
+
setValue(amountKey, formattedAmount);
|
|
35
39
|
};
|
|
36
40
|
useLayoutEffect(() => {
|
|
37
41
|
fitInputText(maxInputFontSize, minInputFontSize, ref.current);
|
|
@@ -17,7 +17,9 @@ export const SwapInputAdornment = ({ formType }) => {
|
|
|
17
17
|
const { token, isLoading } = useTokenAddressBalance(chainId, tokenAddress);
|
|
18
18
|
const handleMax = () => {
|
|
19
19
|
var _a;
|
|
20
|
-
setValue(SwapFormKeyHelper.getAmountKey(formType), (_a = token === null || token === void 0 ? void 0 : token.amount) !== null && _a !== void 0 ? _a : ''
|
|
20
|
+
setValue(SwapFormKeyHelper.getAmountKey(formType), (_a = token === null || token === void 0 ? void 0 : token.amount) !== null && _a !== void 0 ? _a : '', {
|
|
21
|
+
shouldTouch: true,
|
|
22
|
+
});
|
|
21
23
|
};
|
|
22
|
-
return (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: isLoading && tokenAddress ? (_jsx(Skeleton, { variant: "rectangular", width: 46, height: 20, sx: { borderRadius: 0.5 } })) : formType === 'from' && (token === null || token === void 0 ? void 0 : token.amount) ? (_jsx(Button, Object.assign({ onClick: handleMax
|
|
24
|
+
return (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: isLoading && tokenAddress ? (_jsx(Skeleton, { variant: "rectangular", width: 46, height: 20, sx: { borderRadius: 0.5 } })) : formType === 'from' && (token === null || token === void 0 ? void 0 : token.amount) ? (_jsx(Button, Object.assign({ onClick: handleMax }, { children: t('button.max') }))) : null })));
|
|
23
25
|
};
|