@lifi/widget 1.32.4 → 1.32.5
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/AppDrawer.js +2 -1
- package/cjs/AppDrawer.js +3 -2
- package/cjs/components/ActiveSwaps/ActiveSwapItem.js +6 -4
- package/cjs/components/ChainSelect/useChainSelect.js +1 -1
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +2 -2
- package/cjs/components/Header/NavigationHeader.js +5 -3
- package/cjs/components/Header/WalletHeader.js +8 -4
- package/cjs/components/NotFound.js +2 -2
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.js +3 -2
- package/cjs/components/SendToWallet/SendToWalletButton.js +2 -2
- package/cjs/components/Step/CircularProgress.js +8 -5
- package/cjs/components/Step/DestinationWalletAddress.js +4 -3
- package/cjs/components/Step/GasStepProcess.js +2 -2
- package/cjs/components/Step/StepProcess.js +2 -2
- package/cjs/components/StepActions/StepActions.js +2 -2
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +8 -4
- package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.js +2 -2
- package/cjs/components/SwapRoutes/SwapRoutes.js +2 -2
- package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +1 -2
- package/cjs/components/TokenList/TokenNotFound.js +2 -2
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useRouteExecution.js +1 -1
- package/cjs/hooks/useSwapRoutes.d.ts +2 -4
- package/cjs/hooks/useSwapRoutes.js +19 -0
- package/cjs/hooks/useTokenAddressBalance.js +1 -0
- package/cjs/hooks/useTokenBalance.js +7 -10
- package/cjs/hooks/useTokenBalances.js +0 -1
- package/cjs/hooks/useTokenSearch.js +6 -4
- package/cjs/i18n/index.js +0 -1
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +2 -2
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.js +2 -3
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +6 -3
- package/cjs/pages/SelectTokenPage/SearchTokenInput.js +2 -2
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +4 -2
- package/cjs/pages/SettingsPage/EnabledToolsButton.js +3 -3
- package/cjs/pages/SettingsPage/GasPriceSelect.js +2 -2
- package/cjs/pages/SettingsPage/LanguageSelect.js +2 -2
- package/cjs/pages/SettingsPage/RoutePrioritySelect.js +2 -2
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +4 -3
- package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.js +2 -2
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +2 -3
- package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +2 -2
- package/cjs/pages/SwapPage/StatusBottomSheet.js +6 -4
- package/cjs/pages/SwapPage/SwapPage.js +2 -2
- package/cjs/pages/SwapPage/TokenValueBottomSheet.js +2 -2
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +1 -2
- package/components/ActiveSwaps/ActiveSwapItem.js +5 -3
- package/components/ChainSelect/useChainSelect.js +1 -1
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +2 -2
- package/components/Header/NavigationHeader.js +5 -3
- package/components/Header/WalletHeader.js +6 -2
- package/components/NotFound.js +1 -1
- package/components/ReverseTokensButton/ReverseTokensButton.js +2 -1
- package/components/SendToWallet/SendToWalletButton.js +1 -1
- package/components/Step/CircularProgress.js +8 -5
- package/components/Step/DestinationWalletAddress.js +3 -2
- package/components/Step/GasStepProcess.js +2 -2
- package/components/Step/StepProcess.js +2 -2
- package/components/StepActions/StepActions.js +1 -1
- package/components/SwapRouteCard/SwapRouteCard.js +7 -3
- package/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -1
- package/components/SwapRoutes/SwapRoutes.js +1 -1
- package/components/SwapRoutes/SwapRoutes.style.d.ts +1 -2
- package/components/TokenList/TokenNotFound.js +1 -1
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useRouteExecution.js +1 -1
- package/hooks/useSwapRoutes.d.ts +2 -4
- package/hooks/useSwapRoutes.js +19 -0
- package/hooks/useTokenAddressBalance.js +1 -0
- package/hooks/useTokenBalance.js +7 -10
- package/hooks/useTokenBalances.js +0 -1
- package/hooks/useTokenSearch.js +6 -4
- package/i18n/index.js +0 -1
- package/package.json +8 -8
- package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -1
- package/pages/ActiveSwapsPage/ActiveSwapsPage.js +2 -3
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +6 -3
- package/pages/SelectTokenPage/SearchTokenInput.js +1 -1
- package/pages/SettingsPage/ColorSchemeButtonGroup.js +3 -1
- package/pages/SettingsPage/EnabledToolsButton.js +2 -2
- package/pages/SettingsPage/GasPriceSelect.js +1 -1
- package/pages/SettingsPage/LanguageSelect.js +1 -1
- package/pages/SettingsPage/RoutePrioritySelect.js +1 -1
- package/pages/SwapDetailsPage/SwapDetailsPage.js +3 -2
- package/pages/SwapHistoryPage/SwapHistoryEmpty.js +2 -2
- package/pages/SwapHistoryPage/SwapHistoryPage.js +2 -3
- package/pages/SwapPage/ExchangeRateBottomSheet.js +2 -2
- package/pages/SwapPage/StatusBottomSheet.js +6 -4
- package/pages/SwapPage/SwapPage.js +1 -1
- package/pages/SwapPage/TokenValueBottomSheet.js +2 -2
- package/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +1 -2
- package/tsconfig.cjs.tsbuildinfo +1 -1
package/AppDrawer.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft';
|
|
3
|
+
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
|
|
3
4
|
import { Drawer } from '@mui/material';
|
|
4
5
|
import { forwardRef, useCallback, useImperativeHandle, useMemo, useRef, useState, } from 'react';
|
|
5
6
|
import { useTranslation } from 'react-i18next';
|
package/cjs/AppDrawer.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DrawerButtonText = exports.AppDrawer = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const KeyboardArrowLeft_1 = require("@mui/icons-material/KeyboardArrowLeft");
|
|
6
|
+
const KeyboardArrowRight_1 = require("@mui/icons-material/KeyboardArrowRight");
|
|
6
7
|
const material_1 = require("@mui/material");
|
|
7
8
|
const react_1 = require("react");
|
|
8
9
|
const react_i18next_1 = require("react-i18next");
|
|
@@ -34,7 +35,7 @@ exports.AppDrawer = (0, react_1.forwardRef)(({ elementRef, open, config }, ref)
|
|
|
34
35
|
height: '100%',
|
|
35
36
|
},
|
|
36
37
|
}), [config]);
|
|
37
|
-
return ((0, jsx_runtime_1.jsxs)(AppProvider_1.AppProvider, { config: drawerConfig, children: [(0, jsx_runtime_1.jsxs)(AppDrawer_style_1.DrawerButton, { variant: "contained", onClick: toggleDrawer, open: drawerOpen, drawerProps: config?.containerStyle, children: [drawerOpen ? (0, jsx_runtime_1.jsx)(
|
|
38
|
+
return ((0, jsx_runtime_1.jsxs)(AppProvider_1.AppProvider, { config: drawerConfig, children: [(0, jsx_runtime_1.jsxs)(AppDrawer_style_1.DrawerButton, { variant: "contained", onClick: toggleDrawer, open: drawerOpen, drawerProps: config?.containerStyle, children: [drawerOpen ? (0, jsx_runtime_1.jsx)(KeyboardArrowRight_1.default, {}) : (0, jsx_runtime_1.jsx)(KeyboardArrowLeft_1.default, {}), (0, jsx_runtime_1.jsx)(exports.DrawerButtonText, { open: drawerOpen })] }), (0, jsx_runtime_1.jsx)(material_1.Drawer, { ref: elementRef, anchor: "right", open: drawerOpen, onClose: closeDrawer, BackdropProps: {
|
|
38
39
|
sx: {
|
|
39
40
|
backgroundColor: 'rgb(0 0 0 / 48%)',
|
|
40
41
|
backdropFilter: 'blur(3px)',
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ActiveSwapItem = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const ArrowForward_1 = require("@mui/icons-material/ArrowForward");
|
|
6
|
+
const ErrorRounded_1 = require("@mui/icons-material/ErrorRounded");
|
|
7
|
+
const InfoRounded_1 = require("@mui/icons-material/InfoRounded");
|
|
6
8
|
const material_1 = require("@mui/material");
|
|
7
9
|
const react_router_dom_1 = require("react-router-dom");
|
|
8
10
|
const hooks_1 = require("../../hooks");
|
|
@@ -33,9 +35,9 @@ const ActiveSwapItem = ({ routeId, dense }) => {
|
|
|
33
35
|
const getStatusComponent = () => {
|
|
34
36
|
switch (lastActiveProcess?.status) {
|
|
35
37
|
case 'ACTION_REQUIRED':
|
|
36
|
-
return (0, jsx_runtime_1.jsx)(
|
|
38
|
+
return (0, jsx_runtime_1.jsx)(InfoRounded_1.default, { color: "info", fontSize: "small" });
|
|
37
39
|
case 'FAILED':
|
|
38
|
-
return (0, jsx_runtime_1.jsx)(
|
|
40
|
+
return (0, jsx_runtime_1.jsx)(ErrorRounded_1.default, { color: "error", fontSize: "small" });
|
|
39
41
|
default:
|
|
40
42
|
return ((0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, fontWeight: 500, children: (0, jsx_runtime_1.jsx)(StepTimer_1.StepTimer, { step: lastActiveStep, hideInProgress: true }) }));
|
|
41
43
|
}
|
|
@@ -46,6 +48,6 @@ const ActiveSwapItem = ({ routeId, dense }) => {
|
|
|
46
48
|
alignItems: 'center',
|
|
47
49
|
marginLeft: 2,
|
|
48
50
|
height: 16,
|
|
49
|
-
}, children: [route.fromToken.symbol, (0, jsx_runtime_1.jsx)(
|
|
51
|
+
}, children: [route.fromToken.symbol, (0, jsx_runtime_1.jsx)(ArrowForward_1.default, { sx: { paddingX: 0.5 } }), route.toToken.symbol] }), secondary: status !== stores_1.RouteExecutionStatus.Done ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { fontWeight: 400, fontSize: 12, color: "text.secondary", lineHeight: 1, mt: 0.75, ml: 2, children: title })) : null }), getStatusComponent()] }));
|
|
50
52
|
};
|
|
51
53
|
exports.ActiveSwapItem = ActiveSwapItem;
|
|
@@ -17,7 +17,7 @@ const useChainSelect = (formType) => {
|
|
|
17
17
|
}
|
|
18
18
|
const selectedChains = chainOrder
|
|
19
19
|
.map((chainId) => chains.find((chain) => chain.id === chainId))
|
|
20
|
-
.filter(
|
|
20
|
+
.filter(Boolean);
|
|
21
21
|
return selectedChains;
|
|
22
22
|
};
|
|
23
23
|
const setCurrentChain = (chainId) => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GasSufficiencyMessage = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const WarningAmberRounded_1 = require("@mui/icons-material/WarningAmberRounded");
|
|
6
6
|
const material_1 = require("@mui/material");
|
|
7
7
|
const react_i18next_1 = require("react-i18next");
|
|
8
8
|
const hooks_1 = require("../../hooks");
|
|
@@ -13,7 +13,7 @@ const GasSufficiencyMessage = ({ route, ...props }) => {
|
|
|
13
13
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
14
14
|
const recommendedRoute = (0, stores_1.useRecommendedRouteStore)((state) => state.recommendedRoute);
|
|
15
15
|
const { insufficientFunds, insufficientGas } = (0, hooks_1.useGasSufficiency)(route ?? recommendedRoute);
|
|
16
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: 225, in: Boolean(insufficientFunds || insufficientGas?.length), unmountOnExit: true, mountOnEnter: true, appear: true, children: (0, jsx_runtime_1.jsx)(material_1.Box, { ...props, children: (0, jsx_runtime_1.jsxs)(GasSufficiencyMessage_style_1.MessageCard, { children: [(0, jsx_runtime_1.jsx)(
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: 225, in: Boolean(insufficientFunds || insufficientGas?.length), unmountOnExit: true, mountOnEnter: true, appear: true, children: (0, jsx_runtime_1.jsx)(material_1.Box, { ...props, children: (0, jsx_runtime_1.jsxs)(GasSufficiencyMessage_style_1.MessageCard, { children: [(0, jsx_runtime_1.jsx)(WarningAmberRounded_1.default, { sx: {
|
|
17
17
|
marginTop: 2,
|
|
18
18
|
marginLeft: 2,
|
|
19
19
|
} }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [insufficientGas?.length ? ((0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t(`swap.warning.title.insufficientGas`) })) : null, insufficientFunds ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", px: 2, pb: insufficientGas?.length ? 0 : 2, pt: insufficientGas?.length ? 1 : 2, children: insufficientFunds
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NavigationHeader = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const ArrowBack_1 = require("@mui/icons-material/ArrowBack");
|
|
6
|
+
const ReceiptLongRounded_1 = require("@mui/icons-material/ReceiptLongRounded");
|
|
7
|
+
const SettingsOutlined_1 = require("@mui/icons-material/SettingsOutlined");
|
|
6
8
|
const material_1 = require("@mui/material");
|
|
7
9
|
const react_i18next_1 = require("react-i18next");
|
|
8
10
|
const react_router_dom_1 = require("react-router-dom");
|
|
@@ -63,8 +65,8 @@ const NavigationHeader = () => {
|
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
};
|
|
66
|
-
return ((0, jsx_runtime_1.jsxs)(Header_style_1.HeaderAppBar, { elevation: 0, children: [utils_1.backButtonRoutes.includes(path) ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: (0, jsx_runtime_1.jsx)(
|
|
68
|
+
return ((0, jsx_runtime_1.jsxs)(Header_style_1.HeaderAppBar, { elevation: 0, children: [utils_1.backButtonRoutes.includes(path) ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: (0, jsx_runtime_1.jsx)(ArrowBack_1.default, {}) })) : null, (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true, children: handleHeaderTitle() }), (0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [(0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: utils_1.navigationRoutes.home, element: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [account.isActive ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`header.swapHistory`), enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "start", onClick: () => navigate(utils_1.navigationRoutes.swapHistory), children: (0, jsx_runtime_1.jsx)(ReceiptLongRounded_1.default, {}) }) })) : null, (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`header.settings`), enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", onClick: () => navigate(utils_1.navigationRoutes.settings), sx: {
|
|
67
69
|
marginRight: -1.25,
|
|
68
|
-
}, children: (0, jsx_runtime_1.jsx)(
|
|
70
|
+
}, children: (0, jsx_runtime_1.jsx)(SettingsOutlined_1.default, {}) }) })] }) }), (0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "*", element: element || (0, jsx_runtime_1.jsx)(material_1.Box, { width: 28, height: 40 }) })] })] }));
|
|
69
71
|
};
|
|
70
72
|
exports.NavigationHeader = NavigationHeader;
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WalletHeader = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const ContentCopy_1 = require("@mui/icons-material/ContentCopy");
|
|
6
|
+
const ExpandMore_1 = require("@mui/icons-material/ExpandMore");
|
|
7
|
+
const OpenInNewOutlined_1 = require("@mui/icons-material/OpenInNewOutlined");
|
|
8
|
+
const PowerSettingsNewRounded_1 = require("@mui/icons-material/PowerSettingsNewRounded");
|
|
9
|
+
const WalletOutlined_1 = require("@mui/icons-material/WalletOutlined");
|
|
6
10
|
const material_1 = require("@mui/material");
|
|
7
11
|
const react_1 = require("react");
|
|
8
12
|
const react_i18next_1 = require("react-i18next");
|
|
@@ -30,7 +34,7 @@ const ConnectButton = () => {
|
|
|
30
34
|
}
|
|
31
35
|
navigate(utils_1.navigationRoutes.selectWallet);
|
|
32
36
|
};
|
|
33
|
-
return ((0, jsx_runtime_1.jsx)(Header_style_1.WalletButton, { endIcon: (0, jsx_runtime_1.jsx)(
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(Header_style_1.WalletButton, { endIcon: (0, jsx_runtime_1.jsx)(WalletOutlined_1.default, {}), onClick: !pathname.includes(utils_1.navigationRoutes.selectWallet) ? connect : undefined, sx: {
|
|
34
38
|
marginRight: -1.25,
|
|
35
39
|
}, children: t(`button.connectWallet`) }));
|
|
36
40
|
};
|
|
@@ -54,9 +58,9 @@ const ConnectedButton = () => {
|
|
|
54
58
|
await navigator.clipboard.writeText(account.address ?? '');
|
|
55
59
|
handleClose();
|
|
56
60
|
};
|
|
57
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Header_style_1.WalletButton, { endIcon: (0, jsx_runtime_1.jsx)(
|
|
61
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Header_style_1.WalletButton, { endIcon: (0, jsx_runtime_1.jsx)(ExpandMore_1.default, {}), startIcon: (0, jsx_runtime_1.jsx)(material_1.Avatar, { src: chain?.logoURI, alt: chain?.key, sx: { width: 24, height: 24 }, children: chain?.name[0] }), sx: {
|
|
58
62
|
marginRight: -1.25,
|
|
59
|
-
}, onClick: handleClick, children: walletAddress }), (0, jsx_runtime_1.jsxs)(WalletMenu_1.WalletMenu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, children: [(0, jsx_runtime_1.jsxs)(material_1.MenuItem, { onClick: handleCopyAddress, children: [(0, jsx_runtime_1.jsx)(
|
|
63
|
+
}, onClick: handleClick, children: walletAddress }), (0, jsx_runtime_1.jsxs)(WalletMenu_1.WalletMenu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, children: [(0, jsx_runtime_1.jsxs)(material_1.MenuItem, { onClick: handleCopyAddress, children: [(0, jsx_runtime_1.jsx)(ContentCopy_1.default, {}), t(`button.copyAddress`)] }), (0, jsx_runtime_1.jsxs)(material_1.MenuItem, { component: "a", onClick: handleClose, href: `${chain?.metamask.blockExplorerUrls[0]}address/${account.address}`, target: "_blank", children: [(0, jsx_runtime_1.jsx)(OpenInNewOutlined_1.default, {}), t(`button.viewOnExplorer`)] }), (0, jsx_runtime_1.jsx)(material_1.Button, { onClick: handleDisconnect, fullWidth: true, startIcon: (0, jsx_runtime_1.jsx)(PowerSettingsNewRounded_1.default, {}), sx: {
|
|
60
64
|
marginTop: 1,
|
|
61
65
|
}, children: t(`button.disconnect`) })] })] }));
|
|
62
66
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NotFound = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const Block_1 = require("@mui/icons-material/Block");
|
|
6
6
|
const material_1 = require("@mui/material");
|
|
7
7
|
const react_i18next_1 = require("react-i18next");
|
|
8
8
|
const NotFound = () => {
|
|
@@ -14,6 +14,6 @@ const NotFound = () => {
|
|
|
14
14
|
flexDirection: 'column',
|
|
15
15
|
flex: 1,
|
|
16
16
|
padding: 3,
|
|
17
|
-
}, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 48, children: (0, jsx_runtime_1.jsx)(
|
|
17
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 48, children: (0, jsx_runtime_1.jsx)(Block_1.default, { fontSize: "inherit" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 18, fontWeight: 700, children: t('tooltip.notFound.title') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, color: "text.secondary", textAlign: "center", mt: 2, children: t('tooltip.notFound.text') })] }));
|
|
18
18
|
};
|
|
19
19
|
exports.NotFound = NotFound;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ReverseTokensButton = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const SwapHoriz_1 = require("@mui/icons-material/SwapHoriz");
|
|
6
|
+
const SwapVert_1 = require("@mui/icons-material/SwapVert");
|
|
6
7
|
const react_hook_form_1 = require("react-hook-form");
|
|
7
8
|
const providers_1 = require("../../providers");
|
|
8
9
|
const ReverseTokensButton_style_1 = require("./ReverseTokensButton.style");
|
|
@@ -21,6 +22,6 @@ const ReverseTokensButton = ({ vertical, }) => {
|
|
|
21
22
|
setValue(providers_1.SwapFormKey.ToChain, fromChain, { shouldTouch: true });
|
|
22
23
|
setValue(providers_1.SwapFormKey.ToToken, fromToken, { shouldTouch: true });
|
|
23
24
|
};
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)(ReverseTokensButton_style_1.IconButton, { onClick: handleClick, size: "small", children: vertical ? (0, jsx_runtime_1.jsx)(
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(ReverseTokensButton_style_1.IconButton, { onClick: handleClick, size: "small", children: vertical ? (0, jsx_runtime_1.jsx)(SwapVert_1.default, {}) : (0, jsx_runtime_1.jsx)(SwapHoriz_1.default, {}) }));
|
|
25
26
|
};
|
|
26
27
|
exports.ReverseTokensButton = ReverseTokensButton;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SendToWalletButton = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const WalletOutlined_1 = require("@mui/icons-material/WalletOutlined");
|
|
6
6
|
const material_1 = require("@mui/material");
|
|
7
7
|
const react_hook_form_1 = require("react-hook-form");
|
|
8
8
|
const react_i18next_1 = require("react-i18next");
|
|
@@ -31,6 +31,6 @@ const SendToWalletButton = () => {
|
|
|
31
31
|
return ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t('swap.sendToWallet'), placement: "bottom-end", enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.Button, { variant: showSendToWallet ? 'contained' : 'text', onClick: handleClick, sx: {
|
|
32
32
|
minWidth: 48,
|
|
33
33
|
marginLeft: 1,
|
|
34
|
-
}, children: (0, jsx_runtime_1.jsx)(
|
|
34
|
+
}, children: (0, jsx_runtime_1.jsx)(WalletOutlined_1.default, {}) }) }));
|
|
35
35
|
};
|
|
36
36
|
exports.SendToWalletButton = SendToWalletButton;
|
|
@@ -2,22 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CircularProgress = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const Done_1 = require("@mui/icons-material/Done");
|
|
6
|
+
const ErrorRounded_1 = require("@mui/icons-material/ErrorRounded");
|
|
7
|
+
const InfoRounded_1 = require("@mui/icons-material/InfoRounded");
|
|
8
|
+
const WarningRounded_1 = require("@mui/icons-material/WarningRounded");
|
|
6
9
|
const styles_1 = require("@mui/material/styles");
|
|
7
10
|
const CircularProgress_style_1 = require("./CircularProgress.style");
|
|
8
11
|
function CircularProgress({ process }) {
|
|
9
|
-
return ((0, jsx_runtime_1.jsxs)(CircularProgress_style_1.CircularIcon, { status: process.status, substatus: process.substatus, children: [process.status === 'STARTED' || process.status === 'PENDING' ? ((0, jsx_runtime_1.jsx)(CircularProgress_style_1.CircularProgressPending, { size: 32, thickness: 3 })) : null, process.status === 'ACTION_REQUIRED' ? ((0, jsx_runtime_1.jsx)(
|
|
12
|
+
return ((0, jsx_runtime_1.jsxs)(CircularProgress_style_1.CircularIcon, { status: process.status, substatus: process.substatus, children: [process.status === 'STARTED' || process.status === 'PENDING' ? ((0, jsx_runtime_1.jsx)(CircularProgress_style_1.CircularProgressPending, { size: 32, thickness: 3 })) : null, process.status === 'ACTION_REQUIRED' ? ((0, jsx_runtime_1.jsx)(InfoRounded_1.default, { color: "info", sx: {
|
|
10
13
|
position: 'absolute',
|
|
11
14
|
fontSize: '1rem',
|
|
12
15
|
} })) : null, process.status === 'DONE' &&
|
|
13
|
-
(process.substatus === 'PARTIAL' || process.substatus === 'REFUNDED') ? ((0, jsx_runtime_1.jsx)(
|
|
16
|
+
(process.substatus === 'PARTIAL' || process.substatus === 'REFUNDED') ? ((0, jsx_runtime_1.jsx)(WarningRounded_1.default, { sx: (theme) => ({
|
|
14
17
|
position: 'absolute',
|
|
15
18
|
fontSize: '1rem',
|
|
16
19
|
color: (0, styles_1.darken)(theme.palette.warning.main, 0.32),
|
|
17
|
-
}) })) : process.status === 'DONE' ? ((0, jsx_runtime_1.jsx)(
|
|
20
|
+
}) })) : process.status === 'DONE' ? ((0, jsx_runtime_1.jsx)(Done_1.default, { color: "success", sx: {
|
|
18
21
|
position: 'absolute',
|
|
19
22
|
fontSize: '1rem',
|
|
20
|
-
} })) : null, process.status === 'FAILED' ? ((0, jsx_runtime_1.jsx)(
|
|
23
|
+
} })) : null, process.status === 'FAILED' ? ((0, jsx_runtime_1.jsx)(ErrorRounded_1.default, { color: "error", sx: {
|
|
21
24
|
position: 'absolute',
|
|
22
25
|
fontSize: '1rem',
|
|
23
26
|
} })) : null] }));
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DestinationWalletAddress = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const LinkRounded_1 = require("@mui/icons-material/LinkRounded");
|
|
6
|
+
const WalletOutlined_1 = require("@mui/icons-material/WalletOutlined");
|
|
6
7
|
const material_1 = require("@mui/material");
|
|
7
8
|
const react_i18next_1 = require("react-i18next");
|
|
8
9
|
const CircularProgress_style_1 = require("./CircularProgress.style");
|
|
@@ -13,7 +14,7 @@ const DestinationWalletAddress = ({ step, toAddress, toAddressLink }) => {
|
|
|
13
14
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, { px: 2, py: 1, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
14
15
|
display: 'flex',
|
|
15
16
|
alignItems: 'center',
|
|
16
|
-
}, children: [(0, jsx_runtime_1.jsx)(CircularProgress_style_1.CircularIcon, { status: isDone ? 'DONE' : 'NOT_STARTED', children: (0, jsx_runtime_1.jsx)(
|
|
17
|
+
}, children: [(0, jsx_runtime_1.jsx)(CircularProgress_style_1.CircularIcon, { status: isDone ? 'DONE' : 'NOT_STARTED', children: (0, jsx_runtime_1.jsx)(WalletOutlined_1.default, { color: isDone ? 'success' : 'inherit', sx: {
|
|
17
18
|
position: 'absolute',
|
|
18
19
|
fontSize: '1rem',
|
|
19
20
|
} }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { ml: 2, fontSize: 14, fontWeight: 400, children: isDone
|
|
@@ -26,6 +27,6 @@ const DestinationWalletAddress = ({ step, toAddress, toAddressLink }) => {
|
|
|
26
27
|
display: 'flex',
|
|
27
28
|
flex: 1,
|
|
28
29
|
justifyContent: 'flex-end',
|
|
29
|
-
}, children: (0, jsx_runtime_1.jsx)(StepProcess_style_1.LinkButton, { size: "small", edge: "end", LinkComponent: material_1.Link, href: toAddressLink, target: "_blank", rel: "nofollow noreferrer", children: (0, jsx_runtime_1.jsx)(
|
|
30
|
+
}, children: (0, jsx_runtime_1.jsx)(StepProcess_style_1.LinkButton, { size: "small", edge: "end", LinkComponent: material_1.Link, href: toAddressLink, target: "_blank", rel: "nofollow noreferrer", children: (0, jsx_runtime_1.jsx)(LinkRounded_1.default, {}) }) })] }) }));
|
|
30
31
|
};
|
|
31
32
|
exports.DestinationWalletAddress = DestinationWalletAddress;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GasStepProcess = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const EvStationOutlined_1 = require("@mui/icons-material/EvStationOutlined");
|
|
6
6
|
const material_1 = require("@mui/material");
|
|
7
7
|
const react_i18next_1 = require("react-i18next");
|
|
8
8
|
const CircularProgress_style_1 = require("./CircularProgress.style");
|
|
@@ -12,7 +12,7 @@ const GasStepProcess = ({ step }) => {
|
|
|
12
12
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, { px: 2, py: 1, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
13
13
|
display: 'flex',
|
|
14
14
|
alignItems: 'center',
|
|
15
|
-
}, children: [(0, jsx_runtime_1.jsx)(CircularProgress_style_1.CircularIcon, { status: isDone ? 'DONE' : 'NOT_STARTED', children: (0, jsx_runtime_1.jsx)(
|
|
15
|
+
}, children: [(0, jsx_runtime_1.jsx)(CircularProgress_style_1.CircularIcon, { status: isDone ? 'DONE' : 'NOT_STARTED', children: (0, jsx_runtime_1.jsx)(EvStationOutlined_1.default, { color: isDone ? 'success' : 'inherit', sx: {
|
|
16
16
|
position: 'absolute',
|
|
17
17
|
fontSize: '1rem',
|
|
18
18
|
} }) }), (0, jsx_runtime_1.jsxs)(material_1.Typography, { ml: 2, fontSize: 14, fontWeight: 400, children: [t('format.currency', {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StepProcess = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const LinkRounded_1 = require("@mui/icons-material/LinkRounded");
|
|
6
6
|
const material_1 = require("@mui/material");
|
|
7
7
|
const hooks_1 = require("../../hooks");
|
|
8
8
|
const CircularProgress_1 = require("./CircularProgress");
|
|
@@ -16,6 +16,6 @@ const StepProcess = ({ step, process }) => {
|
|
|
16
16
|
display: 'flex',
|
|
17
17
|
flex: 1,
|
|
18
18
|
justifyContent: 'flex-end',
|
|
19
|
-
}, children: (0, jsx_runtime_1.jsx)(StepProcess_style_1.LinkButton, { size: "small", edge: "end", LinkComponent: material_1.Link, href: process.txLink, target: "_blank", rel: "nofollow noreferrer", children: (0, jsx_runtime_1.jsx)(
|
|
19
|
+
}, children: (0, jsx_runtime_1.jsx)(StepProcess_style_1.LinkButton, { size: "small", edge: "end", LinkComponent: material_1.Link, href: process.txLink, target: "_blank", rel: "nofollow noreferrer", children: (0, jsx_runtime_1.jsx)(LinkRounded_1.default, {}) }) })) : null] }), message ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { ml: 6, fontSize: 14, fontWeight: 500, color: "text.secondary", children: message })) : null] }));
|
|
20
20
|
};
|
|
21
21
|
exports.StepProcess = StepProcess;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SwapStepDetailsLabel = exports.CrossStepDetailsLabel = exports.CustomStepDetailsLabel = exports.StepDetailsContent = exports.StepActions = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const ArrowForward_1 = require("@mui/icons-material/ArrowForward");
|
|
6
6
|
const material_1 = require("@mui/material");
|
|
7
7
|
const react_i18next_1 = require("react-i18next");
|
|
8
8
|
const hooks_1 = require("../../hooks");
|
|
@@ -52,7 +52,7 @@ const StepDetailsContent = ({ step, variant }) => {
|
|
|
52
52
|
return ((0, jsx_runtime_1.jsxs)(material_1.Typography, { fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex", children: [t('format.number', {
|
|
53
53
|
value: (0, utils_1.formatTokenAmount)(step.estimate.fromAmount, step.action.fromToken.decimals),
|
|
54
54
|
}), ' ', step.action.fromToken.symbol, !((step.type === 'custom' || step.tool === 'custom') &&
|
|
55
|
-
variant === 'nft') ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(
|
|
55
|
+
variant === 'nft') ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ArrowForward_1.default, { sx: { fontSize: 18, paddingX: 0.5 } }), t('format.number', {
|
|
56
56
|
value: (0, utils_1.formatTokenAmount)(step.execution?.toAmount ?? step.estimate.toAmount, step.execution?.toToken?.decimals ?? step.action.toToken.decimals),
|
|
57
57
|
}), ' ', step.execution?.toToken?.symbol ?? step.action.toToken.symbol] })) : null] }));
|
|
58
58
|
};
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SwapRouteCardEssentials = exports.SwapRouteCard = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const AccessTime_1 = require("@mui/icons-material/AccessTime");
|
|
6
|
+
const EvStationOutlined_1 = require("@mui/icons-material/EvStationOutlined");
|
|
7
|
+
const ExpandLess_1 = require("@mui/icons-material/ExpandLess");
|
|
8
|
+
const ExpandMore_1 = require("@mui/icons-material/ExpandMore");
|
|
9
|
+
const LayersOutlined_1 = require("@mui/icons-material/LayersOutlined");
|
|
6
10
|
const material_1 = require("@mui/material");
|
|
7
11
|
const react_1 = require("react");
|
|
8
12
|
const react_i18next_1 = require("react-i18next");
|
|
@@ -27,7 +31,7 @@ const SwapRouteCard = ({ route, active, variant = 'default', expanded, ...other
|
|
|
27
31
|
const token = widgetVariant === 'nft'
|
|
28
32
|
? { ...route.fromToken, amount: route.fromAmount }
|
|
29
33
|
: { ...route.toToken, amount: route.toAmount };
|
|
30
|
-
const cardContent = ((0, jsx_runtime_1.jsxs)(material_1.Box, { flex: 1, children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? ((0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2, children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.Label, { active: active ?? label !== alternativeTag, children: label }), variant === 'stretched' ? ((0, jsx_runtime_1.jsx)(exports.SwapRouteCardEssentials, { route: route })) : null] })) : null, (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(Token_1.Token, { token: token, step: variant === 'stretched' ? route.steps[0] : undefined, disableDescription: variant === 'dense' && widgetVariant !== 'refuel' }), variant === 'stretched' && !expanded ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.IconButton, { onClick: handleExpand, size: "small", children: cardExpanded ? (0, jsx_runtime_1.jsx)(
|
|
34
|
+
const cardContent = ((0, jsx_runtime_1.jsxs)(material_1.Box, { flex: 1, children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? ((0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2, children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.Label, { active: active ?? label !== alternativeTag, children: label }), variant === 'stretched' ? ((0, jsx_runtime_1.jsx)(exports.SwapRouteCardEssentials, { route: route })) : null] })) : null, (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(Token_1.Token, { token: token, step: variant === 'stretched' ? route.steps[0] : undefined, disableDescription: variant === 'dense' && widgetVariant !== 'refuel' }), variant === 'stretched' && !expanded ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.IconButton, { onClick: handleExpand, size: "small", children: cardExpanded ? (0, jsx_runtime_1.jsx)(ExpandLess_1.default, {}) : (0, jsx_runtime_1.jsx)(ExpandMore_1.default, {}) })) : null] }), (0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true, children: route.steps.map((step) => ((0, jsx_runtime_1.jsx)(StepActions_1.StepActions, { step: step, mt: 2 }, step.id))) }), variant !== 'stretched' ? ((0, jsx_runtime_1.jsx)(exports.SwapRouteCardEssentials, { route: route, dense: true })) : null] }));
|
|
31
35
|
return widgetVariant === 'refuel' ? (cardContent) : ((0, jsx_runtime_1.jsx)(Card_1.Card, { variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true, ...other, children: cardContent }));
|
|
32
36
|
};
|
|
33
37
|
exports.SwapRouteCard = SwapRouteCard;
|
|
@@ -38,8 +42,8 @@ const SwapRouteCardEssentials = ({ route, dense }) => {
|
|
|
38
42
|
.reduce((duration, x) => duration + x, 0) / 60);
|
|
39
43
|
const gasCostUSD = parseFloat(route.gasCostUSD ?? '') || 0.01;
|
|
40
44
|
const gasCosts = (0, utils_1.getGasCostsBreakdown)(route);
|
|
41
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: dense ? 'space-between' : 'flex-end', flex: 1, pl: dense ? 0 : 2, mt: dense ? 2 : 0, children: [(0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "span", children: [t(`tooltip.estimatedNetworkFee`), gasCosts.map((gas) => ((0, jsx_runtime_1.jsxs)(material_1.Typography, { fontSize: 11, children: [gas.amount?.toFixed(6), " ", gas.token.symbol, " (", t(`format.currency`, { value: gas.amountUSD }), ")"] }, `${gas.token.address}${gas.token.symbol}`)))] }), placement: "top", enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", mr: dense ? 0 : 2, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { lineHeight: 0, mr: 0.5, color: "grey.500", children: (0, jsx_runtime_1.jsx)(
|
|
45
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: dense ? 'space-between' : 'flex-end', flex: 1, pl: dense ? 0 : 2, mt: dense ? 2 : 0, children: [(0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "span", children: [t(`tooltip.estimatedNetworkFee`), gasCosts.map((gas) => ((0, jsx_runtime_1.jsxs)(material_1.Typography, { fontSize: 11, children: [gas.amount?.toFixed(6), " ", gas.token.symbol, " (", t(`format.currency`, { value: gas.amountUSD }), ")"] }, `${gas.token.address}${gas.token.symbol}`)))] }), placement: "top", enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", mr: dense ? 0 : 2, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { lineHeight: 0, mr: 0.5, color: "grey.500", children: (0, jsx_runtime_1.jsx)(EvStationOutlined_1.default, { fontSize: dense ? 'medium' : 'small' }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: t(`format.currency`, { value: gasCostUSD }) })] }) }), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`tooltip.estimatedTime`), placement: "top", enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", mr: dense ? 0 : 2, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { lineHeight: 0, mr: 0.5, color: "grey.500", children: (0, jsx_runtime_1.jsx)(AccessTime_1.default, { fontSize: dense ? 'medium' : 'small' }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: t('swap.estimatedTime', {
|
|
42
46
|
value: executionTimeMinutes,
|
|
43
|
-
}) })] }) }), !dense ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`tooltip.numberOfSteps`), placement: "top", enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { lineHeight: 0, mr: 0.5, color: "grey.500", children: (0, jsx_runtime_1.jsx)(
|
|
47
|
+
}) })] }) }), !dense ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`tooltip.numberOfSteps`), placement: "top", enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { lineHeight: 0, mr: 0.5, color: "grey.500", children: (0, jsx_runtime_1.jsx)(LayersOutlined_1.default, { fontSize: dense ? 'medium' : 'small' }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: route.steps.length })] }) })) : null] }));
|
|
44
48
|
};
|
|
45
49
|
exports.SwapRouteCardEssentials = SwapRouteCardEssentials;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SwapRouteNotFoundCard = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const Route_1 = require("@mui/icons-material/Route");
|
|
6
6
|
const material_1 = require("@mui/material");
|
|
7
7
|
const react_i18next_1 = require("react-i18next");
|
|
8
8
|
const SwapRouteNotFoundCard = () => {
|
|
@@ -13,6 +13,6 @@ const SwapRouteNotFoundCard = () => {
|
|
|
13
13
|
justifyContent: 'center',
|
|
14
14
|
flexDirection: 'column',
|
|
15
15
|
flex: 1,
|
|
16
|
-
}, py: 1.625, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 48, children: (0, jsx_runtime_1.jsx)(
|
|
16
|
+
}, py: 1.625, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 48, children: (0, jsx_runtime_1.jsx)(Route_1.default, { fontSize: "inherit" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 18, fontWeight: 700, children: t('swap.info.title.routeNotFound') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, color: "text.secondary", textAlign: "center", mt: 2, children: t('swap.info.message.routeNotFound') })] }));
|
|
17
17
|
};
|
|
18
18
|
exports.SwapRouteNotFoundCard = SwapRouteNotFoundCard;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SwapRoutes = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const KeyboardArrowRight_1 = require("@mui/icons-material/KeyboardArrowRight");
|
|
6
6
|
const material_1 = require("@mui/material");
|
|
7
7
|
const react_hook_form_1 = require("react-hook-form");
|
|
8
8
|
const react_i18next_1 = require("react-i18next");
|
|
@@ -41,6 +41,6 @@ const SwapRoutes = (props) => {
|
|
|
41
41
|
(isFetching || (routes && routes.length > 1))
|
|
42
42
|
? 1
|
|
43
43
|
: 0,
|
|
44
|
-
}, children: isLoading ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { minWidth: !onlyRecommendedRoute ? '80%' : '100%', variant: "dense" }), !onlyRecommendedRoute ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { minWidth: "80%", variant: "dense" })) : null] })) : !currentRoute ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { minWidth: !onlyRecommendedRoute && routes.length > 1 ? '80%' : '100%', route: currentRoute, variant: "dense", active: true }), !onlyRecommendedRoute && routes.length > 1 ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { minWidth: "80%", route: routes[1], variant: "dense", pointerEvents: "none" })) : null] })) }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { display: 'flex', alignItems: 'center' }, children: !onlyRecommendedRoute && !routeNotFound ? ((0, jsx_runtime_1.jsx)(material_1.Box, { py: 1, pr: 1, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: handleCardClick, size: "medium", disabled: isValidating || !isValid, children: (0, jsx_runtime_1.jsx)(
|
|
44
|
+
}, children: isLoading ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { minWidth: !onlyRecommendedRoute ? '80%' : '100%', variant: "dense" }), !onlyRecommendedRoute ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { minWidth: "80%", variant: "dense" })) : null] })) : !currentRoute ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { minWidth: !onlyRecommendedRoute && routes.length > 1 ? '80%' : '100%', route: currentRoute, variant: "dense", active: true }), !onlyRecommendedRoute && routes.length > 1 ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { minWidth: "80%", route: routes[1], variant: "dense", pointerEvents: "none" })) : null] })) }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { display: 'flex', alignItems: 'center' }, children: !onlyRecommendedRoute && !routeNotFound ? ((0, jsx_runtime_1.jsx)(material_1.Box, { py: 1, pr: 1, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: handleCardClick, size: "medium", disabled: isValidating || !isValid, children: (0, jsx_runtime_1.jsx)(KeyboardArrowRight_1.default, {}) }) })) : null })] })] }));
|
|
45
45
|
};
|
|
46
46
|
exports.SwapRoutes = SwapRoutes;
|
|
@@ -32,7 +32,6 @@ export declare const Header: import("@emotion/styled").StyledComponent<import("@
|
|
|
32
32
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
33
33
|
}, "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
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
35
|
children?: import("react").ReactNode;
|
|
37
36
|
direction?: import("@mui/system").ResponsiveStyleValue<"column" | "column-reverse" | "row" | "row-reverse"> | undefined;
|
|
38
37
|
spacing?: import("@mui/system").ResponsiveStyleValue<string | number> | undefined;
|
|
@@ -40,4 +39,4 @@ export declare const Stack: import("@emotion/styled").StyledComponent<import("@m
|
|
|
40
39
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
41
40
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
42
41
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
43
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "
|
|
42
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "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>, {}, {}>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TokenNotFound = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const SearchOff_1 = require("@mui/icons-material/SearchOff");
|
|
6
6
|
const material_1 = require("@mui/material");
|
|
7
7
|
const react_hook_form_1 = require("react-hook-form");
|
|
8
8
|
const react_i18next_1 = require("react-i18next");
|
|
@@ -21,7 +21,7 @@ const TokenNotFound = ({ formType }) => {
|
|
|
21
21
|
flexDirection: 'column',
|
|
22
22
|
flex: 1,
|
|
23
23
|
padding: 3,
|
|
24
|
-
}, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 48, lineHeight: 1, children: (0, jsx_runtime_1.jsx)(
|
|
24
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 48, lineHeight: 1, children: (0, jsx_runtime_1.jsx)(SearchOff_1.default, { fontSize: "inherit" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, color: "text.secondary", textAlign: "center", mt: 2, px: 2, children: t('swap.info.message.emptyTokenList', {
|
|
25
25
|
chainName: getChainById(selectedChainId)?.name,
|
|
26
26
|
}) })] }));
|
|
27
27
|
};
|
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.32.
|
|
2
|
+
export declare const version = "1.32.5";
|
package/cjs/config/version.js
CHANGED
|
@@ -69,7 +69,7 @@ const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateU
|
|
|
69
69
|
if (!routeExecution?.route) {
|
|
70
70
|
throw Error('Execution route not found.');
|
|
71
71
|
}
|
|
72
|
-
queryClient.removeQueries(['routes']);
|
|
72
|
+
queryClient.removeQueries(['routes'], { exact: false });
|
|
73
73
|
return lifi.executeRoute(account.signer, routeExecution.route, {
|
|
74
74
|
updateCallback,
|
|
75
75
|
switchChainHook,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Route } from '@lifi/sdk';
|
|
1
|
+
import type { Route, RoutesResponse } from '@lifi/sdk';
|
|
2
2
|
export declare const useSwapRoutes: () => {
|
|
3
3
|
routes: Route[] | undefined;
|
|
4
4
|
isLoading: boolean;
|
|
@@ -6,7 +6,5 @@ export declare const useSwapRoutes: () => {
|
|
|
6
6
|
isFetched: boolean;
|
|
7
7
|
dataUpdatedAt: number;
|
|
8
8
|
refetchTime: number;
|
|
9
|
-
refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<
|
|
10
|
-
routes: Route[];
|
|
11
|
-
}, any>>;
|
|
9
|
+
refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<RoutesResponse, any>>;
|
|
12
10
|
};
|
|
@@ -154,6 +154,25 @@ const useSwapRoutes = () => {
|
|
|
154
154
|
}
|
|
155
155
|
return true;
|
|
156
156
|
},
|
|
157
|
+
onSuccess(data) {
|
|
158
|
+
if (data.routes[0]) {
|
|
159
|
+
// Update local tokens cache to keep priceUSD in sync
|
|
160
|
+
const { fromToken, toToken } = data.routes[0];
|
|
161
|
+
[fromToken, toToken].forEach((token) => {
|
|
162
|
+
queryClient.setQueriesData(['token-balances', account.address, token.chainId], (data) => {
|
|
163
|
+
if (data) {
|
|
164
|
+
const clonedData = [...data];
|
|
165
|
+
const index = clonedData.findIndex((dataToken) => dataToken.address === token.address);
|
|
166
|
+
clonedData[index] = {
|
|
167
|
+
...clonedData[index],
|
|
168
|
+
...token,
|
|
169
|
+
};
|
|
170
|
+
return clonedData;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
},
|
|
157
176
|
});
|
|
158
177
|
return {
|
|
159
178
|
routes: data?.routes,
|
|
@@ -6,6 +6,7 @@ const useTokenBalances_1 = require("./useTokenBalances");
|
|
|
6
6
|
const useTokenAddressBalance = (chainId, tokenAddress) => {
|
|
7
7
|
const { tokens, tokensWithBalance, isBalanceLoading, refetch } = (0, useTokenBalances_1.useTokenBalances)(chainId);
|
|
8
8
|
const token = (0, react_1.useMemo)(() => {
|
|
9
|
+
console.log('useTokenAddressBalance');
|
|
9
10
|
const token = (tokensWithBalance ?? tokens)?.find((token) => token.address === tokenAddress && token.chainId === chainId);
|
|
10
11
|
return token;
|
|
11
12
|
}, [chainId, tokenAddress, tokens, tokensWithBalance]);
|
|
@@ -54,15 +54,16 @@ const useTokenBalance = (token, accountAddress) => {
|
|
|
54
54
|
staleTime: defaultRefetchInterval,
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
queryClient.
|
|
57
|
+
queryClient.setQueriesData(['token-balances', accountAddress, token.chainId], (data) => {
|
|
58
58
|
if (data) {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
const clonedData = [...data];
|
|
60
|
+
const index = clonedData.findIndex((dataToken) => dataToken.address === token.address);
|
|
61
|
+
clonedData[index] = {
|
|
62
|
+
...clonedData[index],
|
|
62
63
|
amount: formattedAmount,
|
|
63
64
|
};
|
|
65
|
+
return clonedData;
|
|
64
66
|
}
|
|
65
|
-
return data;
|
|
66
67
|
});
|
|
67
68
|
return {
|
|
68
69
|
...tokenBalances[0],
|
|
@@ -74,11 +75,7 @@ const useTokenBalance = (token, accountAddress) => {
|
|
|
74
75
|
staleTime: defaultRefetchInterval,
|
|
75
76
|
});
|
|
76
77
|
const refetchAllBalances = () => {
|
|
77
|
-
queryClient.refetchQueries([
|
|
78
|
-
'token-balances',
|
|
79
|
-
token?.chainId,
|
|
80
|
-
accountAddress,
|
|
81
|
-
]);
|
|
78
|
+
queryClient.refetchQueries(['token-balances', accountAddress, token?.chainId], { exact: false });
|
|
82
79
|
};
|
|
83
80
|
const refetchNewBalance = (0, react_1.useCallback)(() => {
|
|
84
81
|
queryClient.setQueryDefaults(tokenBalanceQueryKey, {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useTokenBalances = void 0;
|
|
4
|
-
/* eslint-disable consistent-return */
|
|
5
4
|
const react_query_1 = require("@tanstack/react-query");
|
|
6
5
|
const react_1 = require("react");
|
|
7
6
|
const providers_1 = require("../providers");
|