@lifi/widget 1.14.1 → 1.16.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 +21 -0
- package/cjs/App.js +21 -0
- package/cjs/components/ActiveSwaps/ActiveSwapItem.d.ts +5 -0
- package/cjs/components/ActiveSwaps/ActiveSwapItem.js +45 -0
- package/cjs/components/{SwapInProgress/SwapInProgress.d.ts → ActiveSwaps/ActiveSwaps.d.ts} +1 -1
- package/cjs/components/ActiveSwaps/ActiveSwaps.js +30 -0
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +78 -0
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.js +40 -0
- package/cjs/components/ActiveSwaps/index.d.ts +2 -0
- package/cjs/components/ActiveSwaps/index.js +18 -0
- package/cjs/components/Card/Card.d.ts +7 -4
- package/cjs/components/Card/Card.js +38 -28
- package/cjs/{pages/SelectTokenPage → components/ChainSelect}/ChainSelect.d.ts +1 -1
- package/cjs/components/ChainSelect/ChainSelect.js +35 -0
- package/cjs/components/{SwapInProgress/SwapInProgress.style.d.ts → ChainSelect/ChainSelect.style.d.ts} +10 -19
- package/cjs/components/ChainSelect/ChainSelect.style.js +19 -0
- package/cjs/components/ChainSelect/index.d.ts +2 -0
- package/cjs/components/ChainSelect/index.js +18 -0
- package/cjs/components/ChainSelect/useChainSelect.d.ts +8 -0
- package/cjs/components/ChainSelect/useChainSelect.js +33 -0
- package/cjs/components/Header/Header.js +3 -11
- package/cjs/components/Header/NavigationHeader.js +10 -17
- package/cjs/components/Header/WalletHeader.js +4 -5
- package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/cjs/components/PoweredBy/PoweredBy.style.js +1 -0
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.js +10 -10
- package/cjs/components/SelectTokenButton/SelectTokenButton.d.ts +1 -1
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +3 -3
- package/{components/SwapInProgress/SwapInProgress.d.ts → cjs/components/SendToWallet/SendToWallet.d.ts} +1 -1
- package/cjs/components/SendToWallet/SendToWallet.js +53 -0
- package/cjs/components/SendToWallet/SendToWallet.style.d.ts +19 -0
- package/cjs/components/SendToWallet/SendToWallet.style.js +15 -0
- package/cjs/components/SendToWallet/index.d.ts +1 -0
- package/cjs/components/{SwapInProgress → SendToWallet}/index.js +1 -1
- package/cjs/components/Step/CircularProgress.js +1 -1
- package/cjs/components/Step/CircularProgress.style.js +1 -1
- package/cjs/components/Step/StepProcess.js +1 -5
- package/cjs/components/Step/StepProcess.style.d.ts +1 -1
- package/cjs/components/Step/StepTimer.d.ts +1 -0
- package/cjs/components/Step/StepTimer.js +6 -6
- package/cjs/components/SwapButton/SwapButton.js +10 -14
- package/cjs/components/SwapButton/types.d.ts +2 -2
- package/cjs/components/SwapInput/FormPriceHelperText.d.ts +1 -1
- package/cjs/components/SwapInput/FormPriceHelperText.js +4 -4
- package/cjs/components/SwapInput/SwapInput.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInput.js +4 -4
- package/cjs/components/SwapInput/SwapInputAdornment.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInputAdornment.js +4 -4
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +5 -4
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +3 -3
- package/cjs/components/TokenAvatar/TokenAvatar.style.js +0 -3
- package/cjs/components/TokenList/TokenList.js +14 -11
- package/cjs/components/TokenList/types.d.ts +1 -1
- package/cjs/config/theme.js +24 -23
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/index.d.ts +3 -0
- package/cjs/hooks/index.js +3 -0
- package/cjs/hooks/useChains.d.ts +1 -97
- package/cjs/hooks/useChains.js +8 -15
- package/cjs/hooks/useNavigateBack.d.ts +4 -0
- package/cjs/hooks/useNavigateBack.js +18 -0
- package/cjs/{components/Step/utils.d.ts → hooks/useProcessMessage.d.ts} +4 -0
- package/cjs/{components/Step/utils.js → hooks/useProcessMessage.js} +16 -10
- package/cjs/hooks/useRouteExecution.d.ts +1 -1
- package/cjs/hooks/useRouteExecution.js +20 -29
- package/cjs/hooks/useSwapRoutes.js +18 -7
- package/cjs/hooks/useWidgetEvents.d.ts +3 -0
- package/cjs/hooks/useWidgetEvents.js +13 -0
- package/cjs/i18n/en/translation.json +25 -15
- package/cjs/i18n/index.d.ts +20 -10
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +3 -1
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.d.ts +2 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +18 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +2 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.js +21 -0
- package/cjs/pages/ActiveSwapsPage/index.d.ts +1 -0
- package/cjs/pages/ActiveSwapsPage/index.js +17 -0
- package/cjs/pages/MainPage/MainPage.js +2 -2
- package/cjs/pages/MainPage/MainSwapButton.js +3 -1
- package/cjs/pages/MainPage/SwapRoutes.js +4 -1
- package/cjs/pages/SelectChainPage/SelectChainPage.d.ts +3 -0
- package/cjs/pages/SelectChainPage/SelectChainPage.js +33 -0
- package/cjs/pages/SelectChainPage/SelectChainPage.style.d.ts +21 -0
- package/cjs/pages/SelectChainPage/SelectChainPage.style.js +20 -0
- package/cjs/pages/SelectChainPage/index.d.ts +1 -0
- package/cjs/pages/SelectChainPage/index.js +17 -0
- package/cjs/pages/SelectTokenPage/SearchTokenInput.js +3 -3
- package/cjs/pages/SelectTokenPage/SelectTokenPage.d.ts +2 -4
- package/cjs/pages/SelectTokenPage/SelectTokenPage.js +4 -8
- package/cjs/pages/SelectWalletPage/SelectWalletPage.js +10 -10
- package/cjs/pages/SelectWalletPage/SelectWalletPage.style.d.ts +2 -27
- package/cjs/pages/SelectWalletPage/SelectWalletPage.style.js +4 -14
- package/cjs/pages/SettingsPage/AdvancedPreferences.js +2 -2
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +2 -2
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +3 -6
- package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +3 -5
- package/cjs/pages/SettingsPage/RoutePrioritySelect.js +5 -1
- package/cjs/pages/SettingsPage/SettingsPage.js +2 -1
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +2 -0
- package/cjs/pages/SettingsPage/ShowDestinationWallet.js +22 -0
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +4 -3
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
- package/cjs/pages/SwapPage/StatusBottomSheet.js +29 -41
- package/cjs/pages/SwapPage/SwapPage.js +7 -3
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
- package/cjs/providers/SwapFormProvider/SwapFormProvider.d.ts +1 -0
- package/cjs/providers/SwapFormProvider/SwapFormProvider.js +43 -9
- package/cjs/providers/SwapFormProvider/types.d.ts +3 -1
- package/cjs/providers/SwapFormProvider/types.js +1 -0
- package/cjs/providers/WalletProvider/WalletProvider.js +10 -4
- package/cjs/providers/WalletProvider/types.d.ts +4 -2
- package/cjs/providers/WidgetProvider/WidgetProvider.js +3 -7
- package/cjs/providers/index.d.ts +4 -0
- package/cjs/providers/index.js +20 -0
- package/cjs/stores/chains/index.d.ts +4 -0
- package/cjs/stores/chains/index.js +20 -0
- package/cjs/stores/chains/types.d.ts +8 -0
- package/cjs/stores/chains/types.js +2 -0
- package/cjs/stores/chains/useChainOrder.d.ts +1 -0
- package/cjs/stores/chains/useChainOrder.js +12 -0
- package/cjs/stores/chains/useChainOrderStore.d.ts +19 -0
- package/cjs/stores/chains/useChainOrderStore.js +42 -0
- package/cjs/stores/chains/useInitializeChainOrder.d.ts +1 -0
- package/cjs/stores/chains/useInitializeChainOrder.js +12 -0
- package/cjs/stores/route/index.d.ts +2 -1
- package/cjs/stores/route/index.js +2 -1
- package/cjs/stores/route/useExecutingRoutesIds.d.ts +1 -0
- package/cjs/stores/route/useExecutingRoutesIds.js +20 -0
- package/cjs/stores/route/useRouteStore.js +5 -4
- package/cjs/stores/route/utils.d.ts +4 -0
- package/cjs/stores/route/utils.js +21 -0
- package/cjs/stores/settings/types.d.ts +2 -1
- package/cjs/stores/settings/useSettingsStore.d.ts +4 -2
- package/cjs/stores/settings/useSettingsStore.js +6 -2
- package/cjs/types/events.d.ts +5 -0
- package/cjs/types/events.js +9 -0
- package/cjs/types/index.d.ts +1 -0
- package/cjs/types/index.js +1 -0
- package/cjs/types/widget.d.ts +3 -1
- package/cjs/utils/format.js +7 -2
- package/cjs/utils/navigationRoutes.d.ts +5 -0
- package/cjs/utils/navigationRoutes.js +31 -4
- package/components/ActiveSwaps/ActiveSwapItem.d.ts +5 -0
- package/components/ActiveSwaps/ActiveSwapItem.js +41 -0
- package/components/ActiveSwaps/ActiveSwaps.d.ts +3 -0
- package/components/ActiveSwaps/ActiveSwaps.js +26 -0
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +78 -0
- package/components/ActiveSwaps/ActiveSwaps.style.js +37 -0
- package/components/ActiveSwaps/index.d.ts +2 -0
- package/components/ActiveSwaps/index.js +2 -0
- package/components/Card/Card.d.ts +7 -4
- package/components/Card/Card.js +39 -29
- package/{pages/SelectTokenPage → components/ChainSelect}/ChainSelect.d.ts +1 -1
- package/components/ChainSelect/ChainSelect.js +31 -0
- package/components/{SwapInProgress/SwapInProgress.style.d.ts → ChainSelect/ChainSelect.style.d.ts} +10 -19
- package/components/ChainSelect/ChainSelect.style.js +16 -0
- package/components/ChainSelect/index.d.ts +2 -0
- package/components/ChainSelect/index.js +2 -0
- package/components/ChainSelect/useChainSelect.d.ts +8 -0
- package/components/ChainSelect/useChainSelect.js +29 -0
- package/components/Header/Header.js +2 -10
- package/components/Header/NavigationHeader.js +11 -18
- package/components/Header/WalletHeader.js +1 -2
- package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/components/PoweredBy/PoweredBy.style.js +1 -0
- package/components/ReverseTokensButton/ReverseTokensButton.js +1 -1
- package/components/SelectTokenButton/SelectTokenButton.d.ts +1 -1
- package/components/SelectTokenButton/SelectTokenButton.js +1 -1
- package/components/SendToWallet/SendToWallet.d.ts +3 -0
- package/components/SendToWallet/SendToWallet.js +49 -0
- package/components/SendToWallet/SendToWallet.style.d.ts +19 -0
- package/components/SendToWallet/SendToWallet.style.js +12 -0
- package/components/SendToWallet/index.d.ts +1 -0
- package/components/SendToWallet/index.js +1 -0
- package/components/Step/CircularProgress.js +3 -3
- package/components/Step/CircularProgress.style.js +1 -1
- package/components/Step/StepProcess.js +2 -6
- package/components/Step/StepProcess.style.d.ts +1 -1
- package/components/Step/StepTimer.d.ts +1 -0
- package/components/Step/StepTimer.js +6 -6
- package/components/SwapButton/SwapButton.js +7 -11
- package/components/SwapButton/types.d.ts +2 -2
- package/components/SwapInput/FormPriceHelperText.d.ts +1 -1
- package/components/SwapInput/FormPriceHelperText.js +1 -1
- package/components/SwapInput/SwapInput.d.ts +1 -1
- package/components/SwapInput/SwapInput.js +1 -1
- package/components/SwapInput/SwapInputAdornment.d.ts +1 -1
- package/components/SwapInput/SwapInputAdornment.js +1 -1
- package/components/SwapRouteCard/SwapRouteCard.js +5 -4
- package/components/SwapRouteCard/SwapRouteCard.style.js +3 -3
- package/components/TokenAvatar/TokenAvatar.style.js +0 -3
- package/components/TokenList/TokenList.js +7 -4
- package/components/TokenList/types.d.ts +1 -1
- package/config/theme.js +24 -23
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/index.d.ts +3 -0
- package/hooks/index.js +3 -0
- package/hooks/useChains.d.ts +1 -97
- package/hooks/useChains.js +8 -15
- package/hooks/useNavigateBack.d.ts +4 -0
- package/hooks/useNavigateBack.js +14 -0
- package/{components/Step/utils.d.ts → hooks/useProcessMessage.d.ts} +4 -0
- package/{pages/SwapPage/utils.js → hooks/useProcessMessage.js} +15 -10
- package/hooks/useRouteExecution.d.ts +1 -1
- package/hooks/useRouteExecution.js +21 -30
- package/hooks/useSwapRoutes.js +18 -7
- package/hooks/useWidgetEvents.d.ts +3 -0
- package/hooks/useWidgetEvents.js +6 -0
- package/i18n/en/translation.json +25 -15
- package/i18n/index.d.ts +20 -10
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +17 -19
- package/pages/ActiveSwapsPage/ActiveSwapsEmpty.d.ts +2 -0
- package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +14 -0
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +2 -0
- package/pages/ActiveSwapsPage/ActiveSwapsPage.js +17 -0
- package/pages/ActiveSwapsPage/index.d.ts +1 -0
- package/pages/ActiveSwapsPage/index.js +1 -0
- package/pages/MainPage/MainPage.js +2 -2
- package/pages/MainPage/MainSwapButton.js +3 -1
- package/pages/MainPage/SwapRoutes.js +4 -1
- package/pages/SelectChainPage/SelectChainPage.d.ts +3 -0
- package/pages/SelectChainPage/SelectChainPage.js +29 -0
- package/pages/SelectChainPage/SelectChainPage.style.d.ts +21 -0
- package/pages/SelectChainPage/SelectChainPage.style.js +17 -0
- package/pages/SelectChainPage/index.d.ts +1 -0
- package/pages/SelectChainPage/index.js +1 -0
- package/pages/SelectTokenPage/SearchTokenInput.js +1 -1
- package/pages/SelectTokenPage/SelectTokenPage.d.ts +2 -4
- package/pages/SelectTokenPage/SelectTokenPage.js +5 -9
- package/pages/SelectWalletPage/SelectWalletPage.js +10 -10
- package/pages/SelectWalletPage/SelectWalletPage.style.d.ts +2 -27
- package/pages/SelectWalletPage/SelectWalletPage.style.js +4 -14
- package/pages/SettingsPage/AdvancedPreferences.js +2 -2
- package/pages/SettingsPage/ColorSchemeButtonGroup.js +1 -1
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/pages/SettingsPage/EnabledBridgesSelect.js +4 -7
- package/pages/SettingsPage/EnabledExchangesSelect.js +4 -6
- package/pages/SettingsPage/RoutePrioritySelect.js +5 -1
- package/pages/SettingsPage/SettingsPage.js +2 -1
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +2 -0
- package/pages/SettingsPage/ShowDestinationWallet.js +18 -0
- package/pages/SwapDetailsPage/SwapDetailsPage.js +5 -4
- package/pages/SwapHistoryPage/SwapHistoryPage.js +1 -1
- package/pages/SwapPage/StatusBottomSheet.js +30 -42
- package/pages/SwapPage/SwapPage.js +9 -5
- package/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
- package/providers/SwapFormProvider/SwapFormProvider.d.ts +1 -0
- package/providers/SwapFormProvider/SwapFormProvider.js +43 -9
- package/providers/SwapFormProvider/types.d.ts +3 -1
- package/providers/SwapFormProvider/types.js +1 -0
- package/providers/WalletProvider/WalletProvider.js +10 -4
- package/providers/WalletProvider/types.d.ts +4 -2
- package/providers/WidgetProvider/WidgetProvider.js +3 -7
- package/providers/index.d.ts +4 -0
- package/providers/index.js +4 -0
- package/stores/chains/index.d.ts +4 -0
- package/stores/chains/index.js +4 -0
- package/stores/chains/types.d.ts +8 -0
- package/stores/chains/types.js +1 -0
- package/stores/chains/useChainOrder.d.ts +1 -0
- package/stores/chains/useChainOrder.js +5 -0
- package/stores/chains/useChainOrderStore.d.ts +19 -0
- package/stores/chains/useChainOrderStore.js +36 -0
- package/stores/chains/useInitializeChainOrder.d.ts +1 -0
- package/stores/chains/useInitializeChainOrder.js +5 -0
- package/stores/route/index.d.ts +2 -1
- package/stores/route/index.js +2 -1
- package/stores/route/useExecutingRoutesIds.d.ts +1 -0
- package/stores/route/useExecutingRoutesIds.js +13 -0
- package/stores/route/useRouteStore.js +5 -4
- package/stores/route/utils.d.ts +4 -0
- package/stores/route/utils.js +15 -0
- package/stores/settings/types.d.ts +2 -1
- package/stores/settings/useSettingsStore.d.ts +4 -2
- package/stores/settings/useSettingsStore.js +6 -2
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/events.d.ts +5 -0
- package/types/events.js +6 -0
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/types/widget.d.ts +3 -1
- package/utils/format.js +7 -2
- package/utils/navigationRoutes.d.ts +5 -0
- package/utils/navigationRoutes.js +30 -3
- package/cjs/components/SwapButton/SwapButton.style.d.ts +0 -65
- package/cjs/components/SwapButton/SwapButton.style.js +0 -15
- package/cjs/components/SwapInProgress/SwapInProgress.js +0 -29
- package/cjs/components/SwapInProgress/SwapInProgress.style.js +0 -17
- package/cjs/components/SwapInProgress/index.d.ts +0 -1
- package/cjs/pages/SelectTokenPage/ChainSelect.js +0 -32
- package/cjs/pages/SwapPage/utils.d.ts +0 -6
- package/cjs/pages/SwapPage/utils.js +0 -93
- package/cjs/stores/route/useExecutingRoutes.d.ts +0 -2
- package/cjs/stores/route/useExecutingRoutes.js +0 -13
- package/components/Step/utils.js +0 -89
- package/components/SwapButton/SwapButton.style.d.ts +0 -65
- package/components/SwapButton/SwapButton.style.js +0 -12
- package/components/SwapInProgress/SwapInProgress.js +0 -25
- package/components/SwapInProgress/SwapInProgress.style.js +0 -14
- package/components/SwapInProgress/index.d.ts +0 -1
- package/components/SwapInProgress/index.js +0 -1
- package/pages/SelectTokenPage/ChainSelect.js +0 -28
- package/pages/SwapPage/utils.d.ts +0 -6
- package/stores/route/useExecutingRoutes.d.ts +0 -2
- package/stores/route/useExecutingRoutes.js +0 -6
|
@@ -12,8 +12,7 @@ import { AccountBalanceWalletOutlined as AccountBalanceWalletIcon, Logout as Log
|
|
|
12
12
|
import { Box, IconButton, Typography } from '@mui/material';
|
|
13
13
|
import { useTranslation } from 'react-i18next';
|
|
14
14
|
import { useLocation, useNavigate } from 'react-router-dom';
|
|
15
|
-
import { useWallet } from '../../providers
|
|
16
|
-
import { useWidgetConfig } from '../../providers/WidgetProvider';
|
|
15
|
+
import { useWallet, useWidgetConfig } from '../../providers';
|
|
17
16
|
import { navigationRoutes } from '../../utils';
|
|
18
17
|
import { HeaderAppBar } from './Header.style';
|
|
19
18
|
export const WalletHeader = () => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const Link: import("@emotion/styled").StyledComponent<Omit<import("@mui/material").LinkBaseProps, "classes"> & {
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").LinkClasses> | undefined;
|
|
5
|
-
color?: import("@mui/system/styleFunctionSx").ResponsiveStyleValue<
|
|
5
|
+
color?: import("@mui/system/styleFunctionSx").ResponsiveStyleValue<string[] | import("csstype").Property.Color | undefined> | ((theme: import("@mui/material").Theme) => import("@mui/system/styleFunctionSx").ResponsiveStyleValue<string[] | import("csstype").Property.Color | undefined>);
|
|
6
6
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
7
7
|
TypographyClasses?: (Partial<import("@mui/material").TypographyClasses> & Partial<import("@mui/material").ClassNameMap<never>>) | undefined;
|
|
8
8
|
underline?: "none" | "always" | "hover" | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { SwapHoriz as SwapHorizIcon, SwapVert as SwapVertIcon, } from '@mui/icons-material';
|
|
3
3
|
import { useFormContext } from 'react-hook-form';
|
|
4
|
-
import { SwapFormKey } from '../../providers
|
|
4
|
+
import { SwapFormKey } from '../../providers';
|
|
5
5
|
import { IconButton } from './ReverseTokensButton.style';
|
|
6
6
|
export const ReverseTokensButton = ({ vertical, }) => {
|
|
7
7
|
const { setValue, getValues } = useFormContext();
|
|
@@ -5,7 +5,7 @@ import { useWatch } from 'react-hook-form';
|
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { useNavigate } from 'react-router-dom';
|
|
7
7
|
import { useChain, useToken } from '../../hooks';
|
|
8
|
-
import { SwapFormKeyHelper } from '../../providers
|
|
8
|
+
import { SwapFormKeyHelper } from '../../providers';
|
|
9
9
|
import { navigationRoutes } from '../../utils';
|
|
10
10
|
import { Card, CardTitle } from '../Card';
|
|
11
11
|
import { TokenAvatar } from '../TokenAvatar';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { isAddress } from '@ethersproject/address';
|
|
12
|
+
import { FormHelperText } from '@mui/material';
|
|
13
|
+
import { useEffect } from 'react';
|
|
14
|
+
import { useFormContext } from 'react-hook-form';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import { SwapFormKey, useWallet } from '../../providers';
|
|
17
|
+
import { useSettings } from '../../stores';
|
|
18
|
+
import { Card, CardTitle } from '../Card';
|
|
19
|
+
import { FormControl, Input } from './SendToWallet.style';
|
|
20
|
+
export const SendToWallet = (props) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
const { showDestinationWallet } = useSettings(['showDestinationWallet']);
|
|
24
|
+
const { account, provider } = useWallet();
|
|
25
|
+
const { register, trigger, formState: { errors }, } = useFormContext();
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
trigger(SwapFormKey.ToAddress);
|
|
28
|
+
}, [account.chainId, trigger]);
|
|
29
|
+
if (!showDestinationWallet) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const { onChange, onBlur, name, ref } = register(SwapFormKey.ToAddress, {
|
|
33
|
+
validate: (value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
+
try {
|
|
35
|
+
if (!value) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
const address = yield (provider === null || provider === void 0 ? void 0 : provider.resolveName(value));
|
|
39
|
+
return (isAddress(address || value) ||
|
|
40
|
+
t('swap.error.title.walletAddressInvalid'));
|
|
41
|
+
}
|
|
42
|
+
catch (_b) {
|
|
43
|
+
return t('swap.error.title.walletEnsAddressInvalid');
|
|
44
|
+
}
|
|
45
|
+
}),
|
|
46
|
+
onBlur: () => trigger(SwapFormKey.ToAddress),
|
|
47
|
+
});
|
|
48
|
+
return (_jsxs(Card, Object.assign({}, props, { children: [_jsx(CardTitle, { children: t('swap.sendToWallet') }), _jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [_jsx(Input, { ref: ref, size: "small", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: "false", onChange: onChange, onBlur: onBlur, name: name, placeholder: t('swap.walletAddressOrEns') }), _jsx(FormHelperText, Object.assign({ error: !!errors.toAddress }, { children: (_a = errors.toAddress) === null || _a === void 0 ? void 0 : _a.message }))] }))] })));
|
|
49
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const FormControl: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
classes?: Partial<import("@mui/material").FormControlClasses> | undefined;
|
|
5
|
+
color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | undefined;
|
|
6
|
+
disabled?: boolean | undefined;
|
|
7
|
+
error?: boolean | undefined;
|
|
8
|
+
fullWidth?: boolean | undefined;
|
|
9
|
+
focused?: boolean | undefined;
|
|
10
|
+
hiddenLabel?: boolean | undefined;
|
|
11
|
+
margin?: "none" | "normal" | "dense" | undefined;
|
|
12
|
+
required?: boolean | undefined;
|
|
13
|
+
size?: "small" | "medium" | undefined;
|
|
14
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
15
|
+
variant?: "outlined" | "filled" | "standard" | undefined;
|
|
16
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
17
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
18
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "children" | "disabled" | "sx" | "margin" | "fullWidth" | "size" | "variant" | "error" | "required" | "focused" | "hiddenLabel"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
19
|
+
export declare const Input: import("@emotion/styled").StyledComponent<import("@mui/material").InputBaseProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FormControl as MuiFormControl, InputBase } from '@mui/material';
|
|
2
|
+
import { inputBaseClasses } from '@mui/material/InputBase';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
export const FormControl = styled(MuiFormControl)(({ theme }) => ({
|
|
5
|
+
padding: theme.spacing(1.5, 2, 1.5, 0),
|
|
6
|
+
}));
|
|
7
|
+
export const Input = styled(InputBase)(({ theme }) => ({
|
|
8
|
+
[`.${inputBaseClasses.input}`]: {
|
|
9
|
+
height: 32,
|
|
10
|
+
padding: theme.spacing(0, 0, 0, 2),
|
|
11
|
+
},
|
|
12
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SendToWallet';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SendToWallet';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Done as DoneIcon, Info as InfoIcon, Warning as WarningIcon
|
|
2
|
+
import { Done as DoneIcon, Info as InfoIcon, Warning as WarningIcon } from '@mui/icons-material';
|
|
3
3
|
import { Box } from '@mui/material';
|
|
4
|
-
import { CircularProgress as CircularProgressStyled, CircularProgressPending
|
|
4
|
+
import { CircularProgress as CircularProgressStyled, CircularProgressPending } from './CircularProgress.style';
|
|
5
5
|
export function CircularProgress({ status }) {
|
|
6
6
|
return (_jsxs(Box, Object.assign({ sx: {
|
|
7
7
|
display: 'grid',
|
|
8
8
|
position: 'relative',
|
|
9
9
|
placeItems: 'center',
|
|
10
|
-
} }, { children: [_jsx(CircularProgressStyled, { variant: "determinate", status: status, size: 32, thickness: 3, value: 100 }), status === 'STARTED' || status === 'PENDING' ? (_jsx(CircularProgressPending, { size: 32, thickness: 3 })) : null, status === 'ACTION_REQUIRED' ? (_jsx(InfoIcon, { color: "
|
|
10
|
+
} }, { children: [_jsx(CircularProgressStyled, { variant: "determinate", status: status, size: 32, thickness: 3, value: 100 }), status === 'STARTED' || status === 'PENDING' ? (_jsx(CircularProgressPending, { size: 32, thickness: 3 })) : null, status === 'ACTION_REQUIRED' ? (_jsx(InfoIcon, { color: "info", sx: {
|
|
11
11
|
position: 'absolute',
|
|
12
12
|
fontSize: '1rem',
|
|
13
13
|
} })) : null, status === 'DONE' ? (_jsx(DoneIcon, { color: "success", sx: {
|
|
@@ -18,7 +18,7 @@ const circleAnimation = keyframes({
|
|
|
18
18
|
const getStatusColor = (status, theme) => {
|
|
19
19
|
switch (status) {
|
|
20
20
|
case 'ACTION_REQUIRED':
|
|
21
|
-
return theme.palette.
|
|
21
|
+
return theme.palette.info.main;
|
|
22
22
|
case 'DONE':
|
|
23
23
|
return theme.palette.success.main;
|
|
24
24
|
case 'FAILED':
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Link as LinkIcon } from '@mui/icons-material';
|
|
3
3
|
import { Box, Link, Typography } from '@mui/material';
|
|
4
|
-
import {
|
|
5
|
-
import { useChains } from '../../hooks';
|
|
4
|
+
import { useProcessMessage } from '../../hooks';
|
|
6
5
|
import { CircularProgress } from './CircularProgress';
|
|
7
6
|
import { LinkButton } from './StepProcess.style';
|
|
8
|
-
import { getProcessMessage } from './utils';
|
|
9
7
|
export const StepProcess = ({ step, process }) => {
|
|
10
|
-
const {
|
|
11
|
-
const { getChainById } = useChains();
|
|
12
|
-
const { title, message } = getProcessMessage(t, getChainById, step, process);
|
|
8
|
+
const { title, message } = useProcessMessage(step, process);
|
|
13
9
|
return (_jsxs(Box, Object.assign({ px: 2, py: 1 }, { children: [_jsxs(Box, Object.assign({ sx: {
|
|
14
10
|
display: 'flex',
|
|
15
11
|
alignItems: 'center',
|
|
@@ -29,7 +29,7 @@ export declare const LinkButton: import("@emotion/styled").StyledComponent<{
|
|
|
29
29
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "size" | "edge"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & Omit<import("@mui/material").LinkBaseProps, "classes"> & {
|
|
30
30
|
children?: import("react").ReactNode;
|
|
31
31
|
classes?: Partial<import("@mui/material").LinkClasses> | undefined;
|
|
32
|
-
color?: import("@mui/system/styleFunctionSx").ResponsiveStyleValue<
|
|
32
|
+
color?: import("@mui/system/styleFunctionSx").ResponsiveStyleValue<string[] | import("csstype").Property.Color | undefined> | ((theme: import("@mui/material").Theme) => import("@mui/system/styleFunctionSx").ResponsiveStyleValue<string[] | import("csstype").Property.Color | undefined>);
|
|
33
33
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
34
34
|
TypographyClasses?: (Partial<import("@mui/material").TypographyClasses> & Partial<import("@mui/material").ClassNameMap<never>>) | undefined;
|
|
35
35
|
underline?: "none" | "always" | "hover" | undefined;
|
|
@@ -7,7 +7,7 @@ const getExpiryTimestamp = (step) => {
|
|
|
7
7
|
return new Date(((_c = (_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.process[0]) === null || _b === void 0 ? void 0 : _b.startedAt) !== null && _c !== void 0 ? _c : Date.now()) +
|
|
8
8
|
step.estimate.executionDuration * 1000);
|
|
9
9
|
};
|
|
10
|
-
export const StepTimer = ({ step }) => {
|
|
10
|
+
export const StepTimer = ({ step, hideInProgress, }) => {
|
|
11
11
|
var _a, _b;
|
|
12
12
|
const { t } = useTranslation();
|
|
13
13
|
const [isExpired, setExpired] = useState(false);
|
|
@@ -26,9 +26,7 @@ export const StepTimer = ({ step }) => {
|
|
|
26
26
|
setExecutionStarted(true);
|
|
27
27
|
restart(getExpiryTimestamp(step));
|
|
28
28
|
}
|
|
29
|
-
const shouldBePaused = step.execution.process.some((process) => process.status === 'ACTION_REQUIRED' ||
|
|
30
|
-
process.status === 'CHAIN_SWITCH_REQUIRED' ||
|
|
31
|
-
process.status === 'FAILED');
|
|
29
|
+
const shouldBePaused = step.execution.process.some((process) => process.status === 'ACTION_REQUIRED' || process.status === 'FAILED');
|
|
32
30
|
if (isRunning && shouldBePaused) {
|
|
33
31
|
pause();
|
|
34
32
|
}
|
|
@@ -50,11 +48,13 @@ export const StepTimer = ({ step }) => {
|
|
|
50
48
|
value: (step.estimate.executionDuration / 60).toFixed(0),
|
|
51
49
|
}) }));
|
|
52
50
|
}
|
|
51
|
+
const isTimerExpired = isExpired || (!minutes && !seconds);
|
|
53
52
|
if (((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'DONE' ||
|
|
54
|
-
((_b = step.execution) === null || _b === void 0 ? void 0 : _b.status) === 'FAILED'
|
|
53
|
+
((_b = step.execution) === null || _b === void 0 ? void 0 : _b.status) === 'FAILED' ||
|
|
54
|
+
(isTimerExpired && hideInProgress)) {
|
|
55
55
|
return null;
|
|
56
56
|
}
|
|
57
|
-
return
|
|
57
|
+
return isTimerExpired ? (_jsx(_Fragment, { children: t('swap.inProgress') })) : (
|
|
58
58
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
59
59
|
_jsx(_Fragment, { children: `${minutes}:${seconds < 10 ? `0${seconds}` : seconds}` }));
|
|
60
60
|
};
|
|
@@ -9,19 +9,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { ChainId } from '@lifi/sdk';
|
|
12
|
+
import { Button } from '@mui/material';
|
|
12
13
|
import { useWatch } from 'react-hook-form';
|
|
13
14
|
import { useTranslation } from 'react-i18next';
|
|
14
15
|
import { useNavigate } from 'react-router-dom';
|
|
15
16
|
import { useChains, useGasSufficiency } from '../../hooks';
|
|
16
|
-
import { SwapFormKeyHelper } from '../../providers
|
|
17
|
-
import { useWallet } from '../../providers/WalletProvider';
|
|
18
|
-
import { useWidgetConfig } from '../../providers/WidgetProvider';
|
|
17
|
+
import { SwapFormKeyHelper, useWallet, useWidgetConfig } from '../../providers';
|
|
19
18
|
import { navigationRoutes } from '../../utils';
|
|
20
|
-
|
|
21
|
-
export const SwapButton = ({ onClick, currentRoute, text, loading, }) => {
|
|
19
|
+
export const SwapButton = ({ onClick, currentRoute, text, disable, }) => {
|
|
22
20
|
var _a;
|
|
23
|
-
const navigate = useNavigate();
|
|
24
21
|
const { t } = useTranslation();
|
|
22
|
+
const navigate = useNavigate();
|
|
25
23
|
const { getChainById } = useChains();
|
|
26
24
|
const config = useWidgetConfig();
|
|
27
25
|
const { account, switchChain, connect: walletConnect } = useWallet();
|
|
@@ -62,9 +60,7 @@ export const SwapButton = ({ onClick, currentRoute, text, loading, }) => {
|
|
|
62
60
|
}
|
|
63
61
|
return t(`button.connectWallet`);
|
|
64
62
|
};
|
|
65
|
-
return (_jsx(Button, Object.assign({ variant: "contained", color: account.isActive ? 'primary' : 'success', onClick: handleSwapButtonClick,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
currentRoute &&
|
|
69
|
-
!switchChainAllowed, fullWidth: true }, { children: getButtonText() })));
|
|
63
|
+
return (_jsx(Button, Object.assign({ variant: "contained", color: account.isActive ? 'primary' : 'success', onClick: handleSwapButtonClick, disabled: currentRoute &&
|
|
64
|
+
!switchChainAllowed &&
|
|
65
|
+
(insufficientFunds || !!insufficientGas.length || disable), fullWidth: true }, { children: getButtonText() })));
|
|
70
66
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { SwapFormTypeProps } from '../../providers
|
|
2
|
+
import type { SwapFormTypeProps } from '../../providers';
|
|
3
3
|
export declare const FormPriceHelperText: React.FC<SwapFormTypeProps & {
|
|
4
4
|
selected: boolean;
|
|
5
5
|
}>;
|
|
@@ -3,7 +3,7 @@ import { FormHelperText, Skeleton, Typography } from '@mui/material';
|
|
|
3
3
|
import { useWatch } from 'react-hook-form';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { useTokenBalance } from '../../hooks';
|
|
6
|
-
import { SwapFormKeyHelper } from '../../providers
|
|
6
|
+
import { SwapFormKeyHelper } from '../../providers';
|
|
7
7
|
import { formatTokenPrice } from '../../utils';
|
|
8
8
|
export const FormPriceHelperText = ({ formType, selected }) => {
|
|
9
9
|
const { t } = useTranslation();
|
|
@@ -3,7 +3,7 @@ import { useLayoutEffect, useRef } from 'react';
|
|
|
3
3
|
import { useFormContext, useWatch } from 'react-hook-form';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { useChain, useToken } from '../../hooks';
|
|
6
|
-
import { SwapFormKeyHelper } from '../../providers
|
|
6
|
+
import { SwapFormKeyHelper } from '../../providers';
|
|
7
7
|
import { fitInputText, formatAmount } from '../../utils';
|
|
8
8
|
import { Card, CardTitle } from '../Card';
|
|
9
9
|
import { TokenAvatar } from '../TokenAvatar';
|
|
@@ -3,7 +3,7 @@ import { InputAdornment, Skeleton } from '@mui/material';
|
|
|
3
3
|
import { useFormContext, useWatch } from 'react-hook-form';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { useTokenBalance } from '../../hooks';
|
|
6
|
-
import { SwapFormKeyHelper } from '../../providers
|
|
6
|
+
import { SwapFormKeyHelper } from '../../providers';
|
|
7
7
|
import { Button } from './SwapInputAdornment.style';
|
|
8
8
|
export const SwapInputAdornment = ({ formType }) => {
|
|
9
9
|
const { t } = useTranslation();
|
|
@@ -20,19 +20,20 @@ export const SwapRouteCard = (_a) => {
|
|
|
20
20
|
var _b, _c;
|
|
21
21
|
var { route, active, dense } = _a, other = __rest(_a, ["route", "active", "dense"]);
|
|
22
22
|
const { t } = useTranslation();
|
|
23
|
+
const alternativeTag = t(`swap.tags.ALTERNATIVE`);
|
|
23
24
|
const label = ((_b = route.tags) === null || _b === void 0 ? void 0 : _b.length)
|
|
24
|
-
? t(`swap.tags.${route.tags[0]
|
|
25
|
-
:
|
|
25
|
+
? t(`swap.tags.${route.tags[0]}`)
|
|
26
|
+
: alternativeTag;
|
|
26
27
|
return (_jsxs(Card, Object.assign({ dense: dense, indented: true }, other, { children: [_jsx(Box, Object.assign({ sx: {
|
|
27
28
|
display: 'flex',
|
|
28
29
|
alignItems: 'center',
|
|
29
30
|
justifyContent: 'space-between',
|
|
30
|
-
}, mb: 2 }, { children: _jsx(Label, Object.assign({ active: active }, { children: label })) })), _jsx(Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: route.toAmount }), mb: 2 }), !dense
|
|
31
|
+
}, mb: 2 }, { children: _jsx(Label, Object.assign({ active: active !== null && active !== void 0 ? active : label !== alternativeTag }, { children: label })) })), _jsx(Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: route.toAmount }), mb: 2 }), !dense
|
|
31
32
|
? route.steps.map((step) => (_jsx(StepActions, { step: step, mb: 2 }, step.id)))
|
|
32
33
|
: null, _jsxs(Box, Object.assign({ sx: {
|
|
33
34
|
display: 'flex',
|
|
34
35
|
justifyContent: 'space-between',
|
|
35
36
|
} }, { children: [_jsxs(Box, { children: [_jsx(Typography, Object.assign({ fontSize: 18, fontWeight: "500", lineHeight: 1, pt: 0.25 }, { children: t(`swap.currency`, { value: (_c = route.gasCostUSD) !== null && _c !== void 0 ? _c : 0 }) })), _jsx(Typography, Object.assign({ fontSize: 12, color: "text.secondary", lineHeight: 1, mt: 0.5 }, { children: t(`swap.gas`) }))] }), _jsxs(Box, { children: [_jsxs(Typography, Object.assign({ fontSize: 18, fontWeight: "500", display: "flex", justifyContent: "flex-end", lineHeight: 1, pt: 0.25 }, { children: ["~", (route.steps
|
|
36
37
|
.map((step) => step.estimate.executionDuration)
|
|
37
|
-
.reduce((
|
|
38
|
+
.reduce((duration, x) => duration + x) / 60).toFixed(0)] })), _jsx(Typography, Object.assign({ fontSize: 12, color: "text.secondary", textAlign: "end", lineHeight: 1, mt: 0.5 }, { children: t(`swap.minutes`) }))] })] }))] })));
|
|
38
39
|
};
|
|
@@ -4,16 +4,16 @@ import { getContrastTextColor } from '../../utils';
|
|
|
4
4
|
export const Label = styled(Typography, {
|
|
5
5
|
shouldForwardProp: (prop) => prop !== 'active',
|
|
6
6
|
})(({ theme, active }) => ({
|
|
7
|
-
backgroundColor: active ? theme.palette.
|
|
7
|
+
backgroundColor: active ? theme.palette.secondary.main : 'transparent',
|
|
8
8
|
border: '1px solid',
|
|
9
9
|
borderColor: active
|
|
10
|
-
? theme.palette.
|
|
10
|
+
? theme.palette.secondary.main
|
|
11
11
|
: theme.palette.mode === 'light'
|
|
12
12
|
? theme.palette.grey[500]
|
|
13
13
|
: theme.palette.grey[600],
|
|
14
14
|
borderRadius: theme.shape.borderRadiusSecondary,
|
|
15
15
|
color: active
|
|
16
|
-
? getContrastTextColor(theme, theme.palette.
|
|
16
|
+
? getContrastTextColor(theme, theme.palette.secondary.main)
|
|
17
17
|
: theme.palette.text.secondary,
|
|
18
18
|
padding: theme.spacing(0.75),
|
|
19
19
|
fontSize: 12,
|
|
@@ -3,9 +3,6 @@ import { avatarClasses } from '@mui/material/Avatar';
|
|
|
3
3
|
import { badgeClasses } from '@mui/material/Badge';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
5
|
export const TokenAvatarGroup = styled(AvatarGroup)(({ theme }) => ({
|
|
6
|
-
[`& .${avatarClasses.root}`]: {
|
|
7
|
-
background: theme.palette.background.paper,
|
|
8
|
-
},
|
|
9
6
|
[`& .${badgeClasses.badge}:last-child .${avatarClasses.root}`]: {
|
|
10
7
|
marginLeft: theme.spacing(-1),
|
|
11
8
|
boxSizing: 'border-box',
|
|
@@ -3,8 +3,7 @@ import { Box } from '@mui/material';
|
|
|
3
3
|
import { useCallback, useRef } from 'react';
|
|
4
4
|
import { useFormContext, useWatch } from 'react-hook-form';
|
|
5
5
|
import { useDebouncedWatch, useTokenBalances, useTokenSearch, } from '../../hooks';
|
|
6
|
-
import { SwapFormKey, SwapFormKeyHelper, } from '../../providers
|
|
7
|
-
import { useWallet } from '../../providers/WalletProvider';
|
|
6
|
+
import { SwapFormKey, SwapFormKeyHelper, useWallet } from '../../providers';
|
|
8
7
|
import { TokenNotFound } from './TokenNotFound';
|
|
9
8
|
import { VirtualizedTokenList } from './VirtualizedTokenList';
|
|
10
9
|
export const TokenList = ({ formType, height, onClick, }) => {
|
|
@@ -33,7 +32,9 @@ export const TokenList = ({ formType, height, onClick, }) => {
|
|
|
33
32
|
? [searchedToken]
|
|
34
33
|
: filteredTokens;
|
|
35
34
|
const handleTokenClick = useCallback((tokenAddress) => {
|
|
36
|
-
setValue(SwapFormKeyHelper.getTokenKey(formType), tokenAddress
|
|
35
|
+
setValue(SwapFormKeyHelper.getTokenKey(formType), tokenAddress, {
|
|
36
|
+
shouldDirty: true,
|
|
37
|
+
});
|
|
37
38
|
setValue(SwapFormKeyHelper.getAmountKey(formType), '');
|
|
38
39
|
const oppositeFormType = formType === 'from' ? 'to' : 'from';
|
|
39
40
|
const [selectedOppositeToken, selectedOppositeChain, selectedChain] = getValues([
|
|
@@ -43,7 +44,9 @@ export const TokenList = ({ formType, height, onClick, }) => {
|
|
|
43
44
|
]);
|
|
44
45
|
if (selectedOppositeToken === tokenAddress &&
|
|
45
46
|
selectedOppositeChain === selectedChain) {
|
|
46
|
-
setValue(SwapFormKeyHelper.getTokenKey(oppositeFormType), ''
|
|
47
|
+
setValue(SwapFormKeyHelper.getTokenKey(oppositeFormType), '', {
|
|
48
|
+
shouldDirty: false,
|
|
49
|
+
});
|
|
47
50
|
}
|
|
48
51
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
49
52
|
}, [formType, getValues, onClick, setValue]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TokenAmount } from '@lifi/sdk';
|
|
2
2
|
import type { MutableRefObject } from 'react';
|
|
3
|
-
import type { SwapFormDirection } from '../../providers
|
|
3
|
+
import type { SwapFormDirection } from '../../providers';
|
|
4
4
|
import type { Token } from '../../types';
|
|
5
5
|
export interface TokenListProps {
|
|
6
6
|
formType: SwapFormDirection;
|
package/config/theme.js
CHANGED
|
@@ -85,7 +85,29 @@ export const createTheme = (mode, theme = {}) => {
|
|
|
85
85
|
defaultProps: {
|
|
86
86
|
disableElevation: true,
|
|
87
87
|
},
|
|
88
|
-
styleOverrides: Object.assign(
|
|
88
|
+
styleOverrides: Object.assign({ root: {
|
|
89
|
+
borderRadius: (_v = (_u = theme.shape) === null || _u === void 0 ? void 0 : _u.borderRadiusSecondary) !== null && _v !== void 0 ? _v : shape.borderRadiusSecondary,
|
|
90
|
+
textTransform: 'none',
|
|
91
|
+
fontSize: '1rem',
|
|
92
|
+
'&.Mui-disabled, &.Mui-disabled:hover': {
|
|
93
|
+
color: mode === 'light'
|
|
94
|
+
? 'rgb(0 0 0 / 70%)'
|
|
95
|
+
: 'rgb(255 255 255 / 70%)',
|
|
96
|
+
cursor: 'not-allowed',
|
|
97
|
+
pointerEvents: 'auto',
|
|
98
|
+
},
|
|
99
|
+
}, contained: {
|
|
100
|
+
'&:hover': {
|
|
101
|
+
color: getContrastRatio(common.white, primaryMainColor) >= 3
|
|
102
|
+
? common.white
|
|
103
|
+
: common.black,
|
|
104
|
+
},
|
|
105
|
+
}, sizeMedium: {
|
|
106
|
+
padding: '10px 16px',
|
|
107
|
+
[`.${dialogActionsClasses.root} &`]: {
|
|
108
|
+
padding: '6px 12px',
|
|
109
|
+
},
|
|
110
|
+
} }, (mode === 'dark'
|
|
89
111
|
? {
|
|
90
112
|
outlined: {
|
|
91
113
|
color: primaryLightColor,
|
|
@@ -103,28 +125,7 @@ export const createTheme = (mode, theme = {}) => {
|
|
|
103
125
|
},
|
|
104
126
|
},
|
|
105
127
|
}
|
|
106
|
-
: {})),
|
|
107
|
-
borderRadius: (_v = (_u = theme.shape) === null || _u === void 0 ? void 0 : _u.borderRadiusSecondary) !== null && _v !== void 0 ? _v : shape.borderRadiusSecondary,
|
|
108
|
-
textTransform: 'none',
|
|
109
|
-
fontSize: '1rem',
|
|
110
|
-
padding: '10px 16px',
|
|
111
|
-
[`.${dialogActionsClasses.root} &`]: {
|
|
112
|
-
padding: '6px 12px',
|
|
113
|
-
},
|
|
114
|
-
'&.Mui-disabled, &.Mui-disabled:hover': {
|
|
115
|
-
color: mode === 'light'
|
|
116
|
-
? 'rgb(0 0 0 / 70%)'
|
|
117
|
-
: 'rgb(255 255 255 / 70%)',
|
|
118
|
-
cursor: 'not-allowed',
|
|
119
|
-
pointerEvents: 'auto',
|
|
120
|
-
},
|
|
121
|
-
}, contained: {
|
|
122
|
-
'&:hover': {
|
|
123
|
-
color: getContrastRatio(common.white, primaryMainColor) >= 3
|
|
124
|
-
? common.white
|
|
125
|
-
: common.black,
|
|
126
|
-
},
|
|
127
|
-
} }),
|
|
128
|
+
: {})),
|
|
128
129
|
},
|
|
129
130
|
MuiIconButton: {
|
|
130
131
|
styleOverrides: {
|
package/config/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "1.
|
|
2
|
+
export declare const version = "1.16.0";
|
package/config/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget';
|
|
2
|
-
export const version = '1.
|
|
2
|
+
export const version = '1.16.0';
|
package/hooks/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export * from './useDebouncedWatch';
|
|
|
5
5
|
export * from './useFeaturedTokens';
|
|
6
6
|
export * from './useGasSufficiency';
|
|
7
7
|
export * from './useInitializer';
|
|
8
|
+
export * from './useNavigateBack';
|
|
9
|
+
export * from './useProcessMessage';
|
|
8
10
|
export * from './useRouteExecution';
|
|
9
11
|
export * from './useScrollableContainer';
|
|
10
12
|
export * from './useSwapRoutes';
|
|
@@ -15,3 +17,4 @@ export * from './useTokenBalances';
|
|
|
15
17
|
export * from './useTokens';
|
|
16
18
|
export * from './useTokenSearch';
|
|
17
19
|
export * from './useTools';
|
|
20
|
+
export * from './useWidgetEvents';
|
package/hooks/index.js
CHANGED
|
@@ -5,6 +5,8 @@ export * from './useDebouncedWatch';
|
|
|
5
5
|
export * from './useFeaturedTokens';
|
|
6
6
|
export * from './useGasSufficiency';
|
|
7
7
|
export * from './useInitializer';
|
|
8
|
+
export * from './useNavigateBack';
|
|
9
|
+
export * from './useProcessMessage';
|
|
8
10
|
export * from './useRouteExecution';
|
|
9
11
|
export * from './useScrollableContainer';
|
|
10
12
|
export * from './useSwapRoutes';
|
|
@@ -15,3 +17,4 @@ export * from './useTokenBalances';
|
|
|
15
17
|
export * from './useTokens';
|
|
16
18
|
export * from './useTokenSearch';
|
|
17
19
|
export * from './useTools';
|
|
20
|
+
export * from './useWidgetEvents';
|