@lifi/widget 1.15.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/{SwapsInProgress/SwapsInProgress.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 +0 -0
- package/cjs/components/ChainSelect/ChainSelect.js +35 -0
- package/cjs/components/{SwapsInProgress/SwapsInProgress.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 +1 -9
- package/cjs/components/Header/NavigationHeader.js +6 -11
- package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/cjs/components/PoweredBy/PoweredBy.style.js +1 -0
- package/cjs/components/SendToWallet/SendToWallet.js +6 -6
- 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 +5 -12
- package/cjs/components/SwapButton/types.d.ts +2 -2
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +1 -1
- package/cjs/components/TokenAvatar/TokenAvatar.style.js +0 -3
- package/cjs/components/TokenList/TokenList.js +6 -2
- 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 +2 -0
- package/cjs/hooks/index.js +2 -0
- package/cjs/hooks/useChains.d.ts +1 -97
- package/cjs/hooks/useChains.js +8 -15
- 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/useWidgetEvents.d.ts +3 -0
- package/cjs/hooks/useWidgetEvents.js +13 -0
- package/cjs/i18n/en/translation.json +13 -8
- package/cjs/i18n/index.d.ts +10 -5
- 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/{components/SwapsInProgress → pages/ActiveSwapsPage}/index.js +1 -1
- package/cjs/pages/MainPage/MainPage.js +2 -3
- 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/SelectTokenPage.d.ts +2 -4
- package/cjs/pages/SelectTokenPage/SelectTokenPage.js +2 -2
- package/cjs/pages/SelectWalletPage/SelectWalletPage.js +4 -4
- package/cjs/pages/SelectWalletPage/SelectWalletPage.style.d.ts +2 -27
- package/cjs/pages/SelectWalletPage/SelectWalletPage.style.js +4 -14
- 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/SwapDetailsPage/SwapDetailsPage.js +1 -1
- package/cjs/pages/SwapPage/StatusBottomSheet.js +25 -36
- package/cjs/pages/SwapPage/SwapPage.js +5 -1
- package/cjs/providers/SwapFormProvider/SwapFormProvider.js +39 -11
- package/cjs/providers/WidgetProvider/WidgetProvider.js +3 -7
- 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/useSettingsStore.js +5 -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 +2 -1
- 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/{SwapsInProgress/SwapsInProgress.d.ts → ActiveSwaps/ActiveSwaps.d.ts} +1 -1
- 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 +0 -0
- package/components/ChainSelect/ChainSelect.js +31 -0
- package/components/{SwapsInProgress/SwapsInProgress.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 +1 -9
- package/components/Header/NavigationHeader.js +6 -11
- package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/components/PoweredBy/PoweredBy.style.js +1 -0
- package/components/SendToWallet/SendToWallet.js +6 -6
- 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 +6 -13
- package/components/SwapButton/types.d.ts +2 -2
- package/components/SwapRouteCard/SwapRouteCard.js +1 -1
- package/components/TokenAvatar/TokenAvatar.style.js +0 -3
- package/components/TokenList/TokenList.js +6 -2
- package/config/theme.js +24 -23
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/index.d.ts +2 -0
- package/hooks/index.js +2 -0
- package/hooks/useChains.d.ts +1 -97
- package/hooks/useChains.js +8 -15
- 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/useWidgetEvents.d.ts +3 -0
- package/hooks/useWidgetEvents.js +6 -0
- package/i18n/en/translation.json +13 -8
- package/i18n/index.d.ts +10 -5
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +14 -13
- 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 -3
- 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/SelectTokenPage.d.ts +2 -4
- package/pages/SelectTokenPage/SelectTokenPage.js +2 -2
- package/pages/SelectWalletPage/SelectWalletPage.js +5 -5
- package/pages/SelectWalletPage/SelectWalletPage.style.d.ts +2 -27
- package/pages/SelectWalletPage/SelectWalletPage.style.js +4 -14
- 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/SwapDetailsPage/SwapDetailsPage.js +1 -1
- package/pages/SwapPage/StatusBottomSheet.js +27 -38
- package/pages/SwapPage/SwapPage.js +5 -1
- package/providers/SwapFormProvider/SwapFormProvider.js +39 -11
- package/providers/WidgetProvider/WidgetProvider.js +3 -7
- 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/useSettingsStore.js +5 -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 +2 -1
- 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/SwapsInProgress/SwapsInProgress.js +0 -29
- package/cjs/components/SwapsInProgress/SwapsInProgress.style.js +0 -17
- package/cjs/components/SwapsInProgress/index.d.ts +0 -1
- package/cjs/pages/SelectTokenPage/ChainSelect.js +0 -31
- 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/SwapsInProgress/SwapsInProgress.js +0 -25
- package/components/SwapsInProgress/SwapsInProgress.style.js +0 -14
- package/components/SwapsInProgress/index.d.ts +0 -1
- package/components/SwapsInProgress/index.js +0 -1
- package/pages/SelectTokenPage/ChainSelect.js +0 -27
- package/pages/SwapPage/utils.d.ts +0 -6
- package/stores/route/useExecutingRoutes.d.ts +0 -2
- package/stores/route/useExecutingRoutes.js +0 -6
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./SelectChainPage"), exports);
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
export declare const SelectTokenPage: FC<
|
|
4
|
-
formType: SwapFormDirection;
|
|
5
|
-
}>;
|
|
2
|
+
import type { SwapFormTypeProps } from '../../providers';
|
|
3
|
+
export declare const SelectTokenPage: FC<SwapFormTypeProps>;
|
|
@@ -4,11 +4,11 @@ exports.SelectTokenPage = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const react_1 = require("react");
|
|
7
|
+
const ChainSelect_1 = require("../../components/ChainSelect");
|
|
7
8
|
const TokenList_1 = require("../../components/TokenList");
|
|
8
9
|
const hooks_1 = require("../../hooks");
|
|
9
|
-
const ChainSelect_1 = require("./ChainSelect");
|
|
10
10
|
const SearchTokenInput_1 = require("./SearchTokenInput");
|
|
11
|
-
const SelectTokenPage = ({ formType
|
|
11
|
+
const SelectTokenPage = ({ formType }) => {
|
|
12
12
|
(0, hooks_1.useScrollableOverflowHidden)();
|
|
13
13
|
const { navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
14
14
|
const headerRef = (0, react_1.useRef)(null);
|
|
@@ -28,7 +28,7 @@ const SelectWalletPage = () => {
|
|
|
28
28
|
const closeDialog = () => {
|
|
29
29
|
setWalletIdentity((state) => (Object.assign(Object.assign({}, state), { show: false })));
|
|
30
30
|
};
|
|
31
|
-
const handleConnect = (0, react_1.useCallback)((
|
|
31
|
+
const handleConnect = (0, react_1.useCallback)((wallet) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
32
|
const { ethereum } = window;
|
|
33
33
|
const identityCheckPassed = wallet.checkProviderIdentity({
|
|
34
34
|
provider: ethereum,
|
|
@@ -44,9 +44,9 @@ const SelectWalletPage = () => {
|
|
|
44
44
|
yield connect(wallet);
|
|
45
45
|
}), [connect, navigateBack]);
|
|
46
46
|
return ((0, jsx_runtime_1.jsxs)(material_1.Container, Object.assign({ disableGutters: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ sx: {
|
|
47
|
-
paddingLeft:
|
|
48
|
-
paddingRight:
|
|
49
|
-
} }, { children: wallet_management_1.supportedWallets.map((wallet) => ((0, jsx_runtime_1.jsxs)(SelectWalletPage_style_1.
|
|
47
|
+
paddingLeft: 1.5,
|
|
48
|
+
paddingRight: 1.5,
|
|
49
|
+
} }, { children: wallet_management_1.supportedWallets.map((wallet) => ((0, jsx_runtime_1.jsxs)(SelectWalletPage_style_1.ListItemButton, Object.assign({ onClick: () => handleConnect(wallet), disableRipple: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemAvatar, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, Object.assign({ src: wallet.icon.src || wallet.icon, alt: wallet.name }, { children: wallet.name[0] })) }), (0, jsx_runtime_1.jsx)(SelectWalletPage_style_1.ListItemText, { primary: wallet.name })] }), wallet.name))) })), (0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, Object.assign({ open: walletIdentity.show, onClose: closeDialog }, { children: [(0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsx)(material_1.DialogContentText, { children: t('wallet.extensionNotFound', {
|
|
50
50
|
name: (_a = walletIdentity.wallet) === null || _a === void 0 ? void 0 : _a.name,
|
|
51
51
|
}) }) }), (0, jsx_runtime_1.jsx)(material_1.DialogActions, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ onClick: closeDialog, autoFocus: true }, { children: t('button.ok') })) })] }))] })));
|
|
52
52
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const ListItemButton: import("@emotion/styled").StyledComponent<import("@mui/material").ListItemButtonBaseProps & Omit<{
|
|
3
3
|
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
4
4
|
centerRipple?: boolean | undefined;
|
|
5
5
|
children?: import("react").ReactNode;
|
|
@@ -18,29 +18,4 @@ export declare const WalletListItemButton: import("@emotion/styled").StyledCompo
|
|
|
18
18
|
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
19
19
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
20
20
|
}, "className" | "style" | "classes" | "tabIndex" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "alignItems" | "autoFocus" | "dense" | "divider" | "selected" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
21
|
-
export declare const
|
|
22
|
-
button?: false | undefined;
|
|
23
|
-
} & import("@mui/material").ListItemBaseProps & {
|
|
24
|
-
components?: {
|
|
25
|
-
Root?: import("react").ElementType<any> | undefined;
|
|
26
|
-
} | undefined;
|
|
27
|
-
componentsProps?: {
|
|
28
|
-
root?: (import("react").HTMLAttributes<HTMLDivElement> & import("@mui/material").ListItemComponentsPropsOverrides) | undefined;
|
|
29
|
-
} | undefined;
|
|
30
|
-
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "key" | keyof import("react").LiHTMLAttributes<HTMLLIElement>> & {
|
|
31
|
-
ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
|
|
32
|
-
}, "button" | "className" | "style" | "classes" | "children" | "disabled" | "sx" | "alignItems" | "autoFocus" | "dense" | "divider" | "components" | "componentsProps" | "selected" | "disableGutters" | "ContainerComponent" | "ContainerProps" | "disablePadding" | "secondaryAction"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
33
|
-
export declare const WalletListItemText: import("@emotion/styled").StyledComponent<import("@mui/material").ListItemTextProps<import("react").ElementType<any>, import("react").ElementType<any>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
34
|
-
export declare const WalletIdentityPopoverContent: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
35
|
-
align?: "inherit" | "left" | "right" | "center" | "justify" | undefined;
|
|
36
|
-
children?: import("react").ReactNode;
|
|
37
|
-
classes?: Partial<import("@mui/material").TypographyClasses> | undefined;
|
|
38
|
-
gutterBottom?: boolean | undefined;
|
|
39
|
-
noWrap?: boolean | undefined;
|
|
40
|
-
paragraph?: boolean | undefined;
|
|
41
|
-
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
42
|
-
variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)" | undefined;
|
|
43
|
-
variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)", string>> | undefined;
|
|
44
|
-
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof import("react").HTMLAttributes<HTMLSpanElement>> & {
|
|
45
|
-
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
46
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | ("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") | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
21
|
+
export declare const ListItemText: import("@emotion/styled").StyledComponent<import("@mui/material").ListItemTextProps<import("react").ElementType<any>, import("react").ElementType<any>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -1,30 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ListItemText = exports.ListItemButton = void 0;
|
|
4
4
|
const material_1 = require("@mui/material");
|
|
5
|
-
const ListItemSecondaryAction_1 = require("@mui/material/ListItemSecondaryAction");
|
|
6
5
|
const ListItemText_1 = require("@mui/material/ListItemText");
|
|
7
6
|
const styles_1 = require("@mui/material/styles");
|
|
8
7
|
const utils_1 = require("../../utils");
|
|
9
|
-
exports.
|
|
8
|
+
exports.ListItemButton = (0, styles_1.styled)(material_1.ListItemButton)(({ theme }) => ({
|
|
10
9
|
borderRadius: theme.shape.borderRadiusSecondary,
|
|
11
10
|
paddingLeft: theme.spacing(1.5),
|
|
12
|
-
height:
|
|
11
|
+
height: 56,
|
|
13
12
|
'&:hover': {
|
|
14
13
|
backgroundColor: (0, utils_1.getContrastAlphaColor)(theme, '4%'),
|
|
15
14
|
},
|
|
16
15
|
}));
|
|
17
|
-
exports.
|
|
18
|
-
padding: theme.spacing(1.5),
|
|
19
|
-
[`.${ListItemSecondaryAction_1.listItemSecondaryActionClasses.root}`]: {
|
|
20
|
-
right: theme.spacing(3),
|
|
21
|
-
},
|
|
22
|
-
}));
|
|
23
|
-
exports.WalletListItemText = (0, styles_1.styled)(material_1.ListItemText)(({ theme }) => ({
|
|
16
|
+
exports.ListItemText = (0, styles_1.styled)(material_1.ListItemText)(({ theme }) => ({
|
|
24
17
|
[`.${ListItemText_1.listItemTextClasses.primary}`]: {
|
|
25
18
|
fontWeight: 400,
|
|
26
19
|
},
|
|
27
20
|
}));
|
|
28
|
-
exports.WalletIdentityPopoverContent = (0, styles_1.styled)(material_1.Typography)({
|
|
29
|
-
maxWidth: 400,
|
|
30
|
-
});
|
|
@@ -11,7 +11,7 @@ export declare const ToggleButton: import("@emotion/styled").StyledComponent<{
|
|
|
11
11
|
selected?: boolean | undefined;
|
|
12
12
|
size?: "small" | "medium" | "large" | undefined;
|
|
13
13
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
14
|
-
value:
|
|
14
|
+
value: {};
|
|
15
15
|
} & Omit<{
|
|
16
16
|
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
17
17
|
centerRipple?: boolean | undefined;
|
|
@@ -14,17 +14,14 @@ const Select_1 = require("../../components/Select");
|
|
|
14
14
|
const hooks_1 = require("../../hooks");
|
|
15
15
|
const stores_1 = require("../../stores");
|
|
16
16
|
const EnabledBridgesSelect = () => {
|
|
17
|
-
var _a;
|
|
18
17
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
19
18
|
const { tools, formattedTools } = (0, hooks_1.useTools)();
|
|
20
19
|
const [enabledBridges, setTools] = (0, stores_1.useSettingsStore)((state) => [state.enabledBridges, state.setTools], shallow_1.default);
|
|
21
|
-
return (tools === null || tools === void 0 ? void 0 : tools.bridges.length) ? ((0, jsx_runtime_1.jsxs)(Card_1.Card, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t(`settings.enabledBridges`) }), (0, jsx_runtime_1.jsx)(material_1.FormControl, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(Select_1.Select, Object.assign({ multiple: true, placeholder: t(`settings.selectEnabledBridges`), MenuProps: { elevation: 2 }, IconComponent: icons_material_1.KeyboardArrowDown, value: enabledBridges !== null && enabledBridges !== void 0 ? enabledBridges : [], onChange: (event) => {
|
|
22
|
-
|
|
23
|
-
setTools('Bridges', event.target.value, tools.bridges);
|
|
24
|
-
}
|
|
20
|
+
return (tools === null || tools === void 0 ? void 0 : tools.bridges.length) ? ((0, jsx_runtime_1.jsxs)(Card_1.Card, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t(`settings.enabledBridges`) }), (0, jsx_runtime_1.jsx)(material_1.FormControl, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(Select_1.Select, Object.assign({ multiple: true, placeholder: t(`settings.selectEnabledBridges`), MenuProps: { elevation: 2, PaperProps: { sx: { maxHeight: 320 } } }, IconComponent: icons_material_1.KeyboardArrowDown, value: enabledBridges !== null && enabledBridges !== void 0 ? enabledBridges : [], onChange: (event) => {
|
|
21
|
+
setTools('Bridges', event.target.value, tools.bridges);
|
|
25
22
|
}, renderValue: (selected) => ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: { display: 'flex', flexWrap: 'wrap', gap: 0.5 } }, { children: selected.map((value) => {
|
|
26
23
|
var _a, _b, _c;
|
|
27
24
|
return ((0, jsx_runtime_1.jsx)(material_1.Chip, { label: (_c = (_b = (_a = formattedTools.bridges) === null || _a === void 0 ? void 0 : _a[value]) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : value }, value));
|
|
28
|
-
}) }))) }, { children: (
|
|
25
|
+
}) }))) }, { children: tools.bridges.map((bridge) => ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ value: bridge.key, sx: { paddingTop: 0, paddingBottom: 0 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Checkbox, { checked: enabledBridges === null || enabledBridges === void 0 ? void 0 : enabledBridges.includes(bridge.key) }), bridge.name] }), bridge.key))) })) }))] })) : ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width: "100%", height: 134, sx: { borderRadius: 1 } }));
|
|
29
26
|
};
|
|
30
27
|
exports.EnabledBridgesSelect = EnabledBridgesSelect;
|
|
@@ -18,12 +18,10 @@ const EnabledExchangesSelect = () => {
|
|
|
18
18
|
const { tools, formattedTools } = (0, hooks_1.useTools)();
|
|
19
19
|
const [enabledExchanges, setTools] = (0, stores_1.useSettingsStore)((state) => [state.enabledExchanges, state.setTools], shallow_1.default);
|
|
20
20
|
return (tools === null || tools === void 0 ? void 0 : tools.exchanges.length) ? ((0, jsx_runtime_1.jsxs)(Card_1.Card, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t(`settings.enabledExchanges`) }), (0, jsx_runtime_1.jsx)(material_1.FormControl, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(Select_1.Select, Object.assign({ multiple: true, placeholder: t(`settings.selectEnabledExchanges`), value: enabledExchanges !== null && enabledExchanges !== void 0 ? enabledExchanges : [], onChange: (event) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
}, MenuProps: { elevation: 2 }, IconComponent: icons_material_1.KeyboardArrowDown, renderValue: (selected) => ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: { display: 'flex', flexWrap: 'wrap', gap: 0.5 } }, { children: selected.map((value) => {
|
|
21
|
+
setTools('Exchanges', event.target.value, tools.exchanges);
|
|
22
|
+
}, MenuProps: { elevation: 2, PaperProps: { sx: { maxHeight: 320 } } }, IconComponent: icons_material_1.KeyboardArrowDown, renderValue: (selected) => ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: { display: 'flex', flexWrap: 'wrap', gap: 0.5 } }, { children: selected.map((value) => {
|
|
25
23
|
var _a, _b, _c;
|
|
26
24
|
return ((0, jsx_runtime_1.jsx)(material_1.Chip, { label: (_c = (_b = (_a = formattedTools.exchanges) === null || _a === void 0 ? void 0 : _a[value]) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : value }, value));
|
|
27
|
-
}) }))) }, { children: tools
|
|
25
|
+
}) }))) }, { children: tools.exchanges.map((exchange) => ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ value: exchange.key, sx: { paddingTop: 0, paddingBottom: 0 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Checkbox, { checked: enabledExchanges === null || enabledExchanges === void 0 ? void 0 : enabledExchanges.includes(exchange.key) }), exchange.name] }), exchange.key))) })) }))] })) : ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width: "100%", height: 206, sx: { borderRadius: 1 } }));
|
|
28
26
|
};
|
|
29
27
|
exports.EnabledExchangesSelect = EnabledExchangesSelect;
|
|
@@ -13,6 +13,10 @@ const RoutePrioritySelect = () => {
|
|
|
13
13
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
14
14
|
const [setValue] = (0, stores_1.useSetSettings)();
|
|
15
15
|
const { routePriority } = (0, stores_1.useSettings)(['routePriority']);
|
|
16
|
-
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t(`settings.routePriority`) }), (0, jsx_runtime_1.jsx)(material_1.FormControl, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(Select_1.Select, Object.assign({ MenuProps: { elevation: 2 }, value: routePriority, onChange: (event) => setValue('routePriority', event.target.value), IconComponent: icons_material_1.KeyboardArrowDown, dense: true }, { children: sdk_1.Orders.map((order) =>
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t(`settings.routePriority`) }), (0, jsx_runtime_1.jsx)(material_1.FormControl, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(Select_1.Select, Object.assign({ MenuProps: { elevation: 2 }, value: routePriority, onChange: (event) => setValue('routePriority', event.target.value), IconComponent: icons_material_1.KeyboardArrowDown, dense: true }, { children: sdk_1.Orders.map((order) => {
|
|
17
|
+
const tag = t(`swap.tags.${order.toUpperCase()}`);
|
|
18
|
+
const tagName = `${tag[0]}${tag.slice(1).toLowerCase()}`;
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ value: order }, { children: tagName }), order));
|
|
20
|
+
}) })) }))] }));
|
|
17
21
|
};
|
|
18
22
|
exports.RoutePrioritySelect = RoutePrioritySelect;
|
|
@@ -65,6 +65,6 @@ const SwapDetailsPage = () => {
|
|
|
65
65
|
}), (0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ mt: 2 }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: {
|
|
66
66
|
display: 'flex',
|
|
67
67
|
flex: 1,
|
|
68
|
-
} }, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, Object.assign({ flex: 1 }, { children: t('swap.
|
|
68
|
+
} }, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, Object.assign({ flex: 1 }, { children: t('swap.supportId') })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mr: 1, mt: 1 }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "settings", onClick: copyRouteId }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.ContentCopy, { fontSize: "small" }) })) }))] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", pt: 1, pb: 2, px: 2, sx: { wordBreak: 'break-all' } }, { children: routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route.id }))] })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "contained", href: "https://discord.com/channels/849912621360218112/863689862514343946", target: "_blank", rel: "nofollow noreferrer", fullWidth: true }, { children: t('button.contactSupport') })) })), (0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, Object.assign({ open: open, onClose: toggleDialog }, { children: [(0, jsx_runtime_1.jsx)(material_1.DialogTitle, { children: t('swap.warning.title.deleteSwap') }), (0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsx)(material_1.DialogContentText, { children: t('swap.warning.message.deleteSwap') }) }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ onClick: toggleDialog }, { children: t('button.cancel') })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ onClick: handleDeleteRoute, autoFocus: true }, { children: t('button.delete') }))] })] }))] }));
|
|
69
69
|
};
|
|
70
70
|
exports.SwapDetailsPage = SwapDetailsPage;
|
|
@@ -12,9 +12,8 @@ const Token_1 = require("../../components/Token");
|
|
|
12
12
|
const hooks_1 = require("../../hooks");
|
|
13
13
|
const providers_1 = require("../../providers");
|
|
14
14
|
const StatusBottomSheet_style_1 = require("./StatusBottomSheet.style");
|
|
15
|
-
const utils_1 = require("./utils");
|
|
16
15
|
const StatusBottomSheet = ({ status, route, }) => {
|
|
17
|
-
var _a, _b, _c, _d, _e;
|
|
16
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
18
17
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
19
18
|
const { navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
20
19
|
const ref = (0, react_1.useRef)(null);
|
|
@@ -34,41 +33,31 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
34
33
|
clearFromAmount();
|
|
35
34
|
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.closeDrawer();
|
|
36
35
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
const process = (_b = step === null || step === void 0 ? void 0 : step.execution) === null || _b === void 0 ? void 0 : _b.process.find((process) => process.status === 'FAILED');
|
|
55
|
-
if (!step || !process) {
|
|
56
|
-
return {};
|
|
57
|
-
}
|
|
58
|
-
return (0, utils_1.getProcessMessage)(t, getChainById, step, process);
|
|
36
|
+
let title;
|
|
37
|
+
let message;
|
|
38
|
+
switch (status) {
|
|
39
|
+
case 'success':
|
|
40
|
+
title = t('swap.success.title.fundsReceived');
|
|
41
|
+
message = t('swap.success.message.fundsReceived', {
|
|
42
|
+
amount: token === null || token === void 0 ? void 0 : token.amount,
|
|
43
|
+
tokenSymbol: token === null || token === void 0 ? void 0 : token.symbol,
|
|
44
|
+
chainName: (_a = getChainById(route.toChainId)) === null || _a === void 0 ? void 0 : _a.name,
|
|
45
|
+
});
|
|
46
|
+
break;
|
|
47
|
+
case 'error': {
|
|
48
|
+
const step = route.steps.find((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'FAILED'; });
|
|
49
|
+
const process = (_b = step === null || step === void 0 ? void 0 : step.execution) === null || _b === void 0 ? void 0 : _b.process.find((process) => process.status === 'FAILED');
|
|
50
|
+
if (!step || !process) {
|
|
51
|
+
break;
|
|
59
52
|
}
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
const processMessage = (0, hooks_1.getProcessMessage)(t, getChainById, step, process);
|
|
54
|
+
title = processMessage.title;
|
|
55
|
+
message = processMessage.message;
|
|
56
|
+
break;
|
|
62
57
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
route.toChainId,
|
|
67
|
-
status,
|
|
68
|
-
t,
|
|
69
|
-
token === null || token === void 0 ? void 0 : token.amount,
|
|
70
|
-
token === null || token === void 0 ? void 0 : token.symbol,
|
|
71
|
-
]);
|
|
58
|
+
default:
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
72
61
|
(0, react_1.useEffect)(() => {
|
|
73
62
|
var _a, _b;
|
|
74
63
|
if ((status === 'success' || status === 'error') &&
|
|
@@ -77,6 +66,6 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
77
66
|
(_b = ref.current) === null || _b === void 0 ? void 0 : _b.openDrawer();
|
|
78
67
|
}
|
|
79
68
|
}, [refetchBalance, status]);
|
|
80
|
-
return ((0, jsx_runtime_1.jsx)(BottomSheet_1.BottomSheet, Object.assign({ ref: ref }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ p: 3 }, { children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconContainer, { children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconCircle, Object.assign({ status: status, mb: 1 }, { children: [status === 'idle' ? ((0, jsx_runtime_1.jsx)(icons_material_1.Info, { color: "primary", sx: StatusBottomSheet_style_1.iconStyles })) : null, status === 'success' ? ((0, jsx_runtime_1.jsx)(icons_material_1.Done, { color: "success", sx: StatusBottomSheet_style_1.iconStyles })) : null, status === 'error' ? ((0, jsx_runtime_1.jsx)(icons_material_1.Warning, { color: "error", sx: StatusBottomSheet_style_1.iconStyles })) : null] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: title })), status === 'success' ? ((0, jsx_runtime_1.jsx)(Token_1.Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: (
|
|
69
|
+
return ((0, jsx_runtime_1.jsx)(BottomSheet_1.BottomSheet, Object.assign({ ref: ref }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ p: 3 }, { children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconContainer, { children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconCircle, Object.assign({ status: status, mb: 1 }, { children: [status === 'idle' ? ((0, jsx_runtime_1.jsx)(icons_material_1.Info, { color: "primary", sx: StatusBottomSheet_style_1.iconStyles })) : null, status === 'success' ? ((0, jsx_runtime_1.jsx)(icons_material_1.Done, { color: "success", sx: StatusBottomSheet_style_1.iconStyles })) : null, status === 'error' ? ((0, jsx_runtime_1.jsx)(icons_material_1.Warning, { color: "error", sx: StatusBottomSheet_style_1.iconStyles })) : null] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: title })), status === 'success' ? ((0, jsx_runtime_1.jsx)(Token_1.Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: (_g = (_e = (_d = (_c = route.steps.at(-1)) === null || _c === void 0 ? void 0 : _c.execution) === null || _d === void 0 ? void 0 : _d.toAmount) !== null && _e !== void 0 ? _e : (_f = route.steps.at(-1)) === null || _f === void 0 ? void 0 : _f.estimate.toAmount) !== null && _g !== void 0 ? _g : route.toAmount }), py: 1 })) : null] }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ pt: 2, pb: 1 }, { children: message })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsxs)(material_1.Button, Object.assign({ variant: "contained", fullWidth: true, onClick: status === 'success' ? handleDone : handleClose }, { children: [status === 'idle' ? t('button.okay') : null, status === 'success' ? t('button.done') : null, status === 'error' ? t('button.tryAgain') : null] })) })), status === 'success' ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "outlined", fullWidth: true, onClick: handleClose }, { children: t('button.seeDetails') })) }))) : null] })) })));
|
|
81
70
|
};
|
|
82
71
|
exports.StatusBottomSheet = StatusBottomSheet;
|
|
@@ -4,6 +4,7 @@ exports.SwapPage = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const react_1 = require("react");
|
|
7
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
7
8
|
const react_i18next_1 = require("react-i18next");
|
|
8
9
|
const react_router_dom_1 = require("react-router-dom");
|
|
9
10
|
const GasSufficiencyMessage_1 = require("../../components/GasSufficiencyMessage");
|
|
@@ -11,12 +12,14 @@ const Step_1 = require("../../components/Step");
|
|
|
11
12
|
const StepDivider_1 = require("../../components/StepDivider");
|
|
12
13
|
const SwapButton_1 = require("../../components/SwapButton");
|
|
13
14
|
const hooks_1 = require("../../hooks");
|
|
15
|
+
const providers_1 = require("../../providers");
|
|
14
16
|
const StatusBottomSheet_1 = require("./StatusBottomSheet");
|
|
15
17
|
const SwapPage_style_1 = require("./SwapPage.style");
|
|
16
18
|
const SwapPage = () => {
|
|
17
19
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
18
20
|
const { state } = (0, react_router_dom_1.useLocation)();
|
|
19
21
|
const { navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
22
|
+
const { setValue, formState: { isValid, isValidating }, } = (0, react_hook_form_1.useFormContext)();
|
|
20
23
|
const { route, status, executeRoute, restartRoute, deleteRoute } = (0, hooks_1.useRouteExecution)(state === null || state === void 0 ? void 0 : state.routeId);
|
|
21
24
|
const handleRemoveRoute = () => {
|
|
22
25
|
navigateBack();
|
|
@@ -25,6 +28,7 @@ const SwapPage = () => {
|
|
|
25
28
|
const handleSwapClick = () => {
|
|
26
29
|
if (status === 'idle') {
|
|
27
30
|
executeRoute();
|
|
31
|
+
setValue(providers_1.SwapFormKey.FromAmount, '');
|
|
28
32
|
}
|
|
29
33
|
if (status === 'error') {
|
|
30
34
|
restartRoute();
|
|
@@ -44,6 +48,6 @@ const SwapPage = () => {
|
|
|
44
48
|
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Step_1.Step, { step: step, fromToken: index === 0
|
|
45
49
|
? Object.assign(Object.assign({}, step.action.fromToken), { amount: step.action.fromAmount }) : undefined, toToken: index === steps.length - 1
|
|
46
50
|
? Object.assign(Object.assign({}, step.action.toToken), { amount: (_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toAmount) !== null && _b !== void 0 ? _b : step.estimate.toAmount }) : undefined }), steps.length > 1 && index !== steps.length - 1 ? ((0, jsx_runtime_1.jsx)(StepDivider_1.StepDivider, {})) : null] }, step.id));
|
|
47
|
-
}), status === 'idle' ? ((0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, { route: route, mt: 2 })) : null, status === 'idle' || status === 'error' ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsx)(SwapButton_1.SwapButton, { text: getSwapButtonText(), onClick: handleSwapClick, currentRoute: route }) }))) : null, status === 'error' ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "outlined", onClick: handleRemoveRoute, fullWidth: true }, { children: t('button.removeSwap') })) }))) : null, route && status ? ((0, jsx_runtime_1.jsx)(StatusBottomSheet_1.StatusBottomSheet, { status: status, route: route })) : null] }));
|
|
51
|
+
}), status === 'idle' ? ((0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, { route: route, mt: 2 })) : null, status === 'idle' || status === 'error' ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsx)(SwapButton_1.SwapButton, { text: getSwapButtonText(), onClick: handleSwapClick, currentRoute: route, disable: status === 'idle' && (isValidating || !isValid) }) }))) : null, status === 'error' ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "outlined", onClick: handleRemoveRoute, fullWidth: true }, { children: t('button.removeSwap') })) }))) : null, route && status ? ((0, jsx_runtime_1.jsx)(StatusBottomSheet_1.StatusBottomSheet, { status: status, route: route })) : null] }));
|
|
48
52
|
};
|
|
49
53
|
exports.SwapPage = SwapPage;
|
|
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const sdk_1 = require("@lifi/sdk");
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const react_hook_form_1 = require("react-hook-form");
|
|
8
|
+
const chains_1 = require("../../stores/chains");
|
|
8
9
|
const WalletProvider_1 = require("../WalletProvider");
|
|
9
10
|
const WidgetProvider_1 = require("../WidgetProvider");
|
|
10
11
|
const types_1 = require("./types");
|
|
@@ -14,6 +15,7 @@ exports.formDefaultValues = {
|
|
|
14
15
|
[types_1.SwapFormKey.TokenSearchFilter]: '',
|
|
15
16
|
};
|
|
16
17
|
const SwapFormProvider = ({ children, }) => {
|
|
18
|
+
const [setChain] = (0, chains_1.useSetChainOrder)();
|
|
17
19
|
const { account } = (0, WalletProvider_1.useWallet)();
|
|
18
20
|
const { fromChain, fromToken, fromAmount, toChain, toToken, toAddress } = (0, WidgetProvider_1.useWidgetConfig)();
|
|
19
21
|
const methods = (0, react_hook_form_1.useForm)({
|
|
@@ -27,25 +29,51 @@ const SwapFormProvider = ({ children, }) => {
|
|
|
27
29
|
if (!account.isActive || !account.chainId) {
|
|
28
30
|
return;
|
|
29
31
|
}
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
const [fromChainValue, toChainValue] = methods.getValues([
|
|
33
|
+
types_1.SwapFormKey.FromChain,
|
|
34
|
+
types_1.SwapFormKey.ToChain,
|
|
35
|
+
]);
|
|
36
|
+
const { isDirty: isFromChainDirty } = methods.getFieldState(types_1.SwapFormKey.FromChain, methods.formState);
|
|
37
|
+
const { isDirty: isToChainDirty } = methods.getFieldState(types_1.SwapFormKey.ToChain, methods.formState);
|
|
38
|
+
const { isDirty: isFromTokenDirty } = methods.getFieldState(types_1.SwapFormKey.FromToken, methods.formState);
|
|
39
|
+
const { isDirty: isToTokenDirty } = methods.getFieldState(types_1.SwapFormKey.ToToken, methods.formState);
|
|
40
|
+
// Users can switch chains in the wallet.
|
|
41
|
+
// If we don't have a chain in the ordered chain list we should add it.
|
|
42
|
+
setChain(account.chainId);
|
|
43
|
+
// If we ran out of slots for the ordered chain list and the current chain isn't there
|
|
44
|
+
// we should make a recently switched chain as current.
|
|
45
|
+
const { chainOrder } = chains_1.useChainOrderStore.getState();
|
|
46
|
+
const hasFromChainInOrderedList = chainOrder.includes(fromChainValue);
|
|
47
|
+
const hasToChainInOrderedList = chainOrder.includes(toChainValue);
|
|
48
|
+
if ((!fromChain && !isFromChainDirty && !isFromTokenDirty) ||
|
|
49
|
+
!hasFromChainInOrderedList) {
|
|
33
50
|
methods.setValue(types_1.SwapFormKey.FromChain, account.chainId, {
|
|
34
51
|
shouldDirty: false,
|
|
35
|
-
|
|
52
|
+
});
|
|
53
|
+
methods.setValue(types_1.SwapFormKey.FromToken, '', {
|
|
54
|
+
shouldDirty: false,
|
|
55
|
+
});
|
|
56
|
+
methods.setValue(types_1.SwapFormKey.FromAmount, '', {
|
|
57
|
+
shouldDirty: false,
|
|
36
58
|
});
|
|
37
59
|
}
|
|
38
|
-
if (!toChain &&
|
|
39
|
-
!
|
|
40
|
-
!isToChainTouched &&
|
|
41
|
-
!isFromChainDirty &&
|
|
42
|
-
!isFromChainTouched) {
|
|
60
|
+
if ((!toChain && !isToChainDirty && !isToTokenDirty) ||
|
|
61
|
+
!hasToChainInOrderedList) {
|
|
43
62
|
methods.setValue(types_1.SwapFormKey.ToChain, account.chainId, {
|
|
44
63
|
shouldDirty: false,
|
|
45
|
-
|
|
64
|
+
});
|
|
65
|
+
methods.setValue(types_1.SwapFormKey.ToToken, '', {
|
|
66
|
+
shouldDirty: false,
|
|
46
67
|
});
|
|
47
68
|
}
|
|
48
|
-
}, [
|
|
69
|
+
}, [
|
|
70
|
+
account.chainId,
|
|
71
|
+
account.isActive,
|
|
72
|
+
fromChain,
|
|
73
|
+
methods,
|
|
74
|
+
setChain,
|
|
75
|
+
toChain,
|
|
76
|
+
]);
|
|
49
77
|
return (0, jsx_runtime_1.jsx)(react_hook_form_1.FormProvider, Object.assign({}, methods, { children: children }));
|
|
50
78
|
};
|
|
51
79
|
exports.SwapFormProvider = SwapFormProvider;
|
|
@@ -27,7 +27,7 @@ const WidgetContext = (0, react_1.createContext)(initialContext);
|
|
|
27
27
|
const useWidgetConfig = () => (0, react_1.useContext)(WidgetContext);
|
|
28
28
|
exports.useWidgetConfig = useWidgetConfig;
|
|
29
29
|
const WidgetProvider = (_a) => {
|
|
30
|
-
var { children } = _a, _b = _a.config, _c = _b === void 0 ? {} : _b, { fromChain, fromToken, toChain, toToken, fromAmount, integrator } = _c, config = __rest(_c, ["fromChain", "fromToken", "toChain", "toToken", "fromAmount", "integrator"]);
|
|
30
|
+
var { children } = _a, _b = _a.config, _c = _b === void 0 ? {} : _b, { fromChain, fromToken, toChain, toToken, fromAmount, integrator, sdkConfig } = _c, config = __rest(_c, ["fromChain", "fromToken", "toChain", "toToken", "fromAmount", "integrator", "sdkConfig"]);
|
|
31
31
|
const value = (0, react_1.useMemo)(() => {
|
|
32
32
|
var _a, _b, _c, _d;
|
|
33
33
|
try {
|
|
@@ -58,12 +58,8 @@ const WidgetProvider = (_a) => {
|
|
|
58
58
|
}
|
|
59
59
|
}, [config, fromAmount, fromChain, fromToken, toChain, toToken]);
|
|
60
60
|
(0, react_1.useEffect)(() => {
|
|
61
|
-
(0, lifi_1.updateLiFiConfig)({
|
|
62
|
-
|
|
63
|
-
integrator: integrator !== null && integrator !== void 0 ? integrator : window.location.hostname,
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
}, [integrator]);
|
|
61
|
+
(0, lifi_1.updateLiFiConfig)(Object.assign(Object.assign({}, sdkConfig), { defaultRouteOptions: Object.assign(Object.assign({}, sdkConfig === null || sdkConfig === void 0 ? void 0 : sdkConfig.defaultRouteOptions), { integrator: integrator !== null && integrator !== void 0 ? integrator : window.location.hostname }) }));
|
|
62
|
+
}, [integrator, sdkConfig]);
|
|
67
63
|
(0, react_1.useEffect)(() => {
|
|
68
64
|
(0, sdk_1.checkPackageUpdates)(version_1.name, version_1.version);
|
|
69
65
|
}, []);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./useChainOrder"), exports);
|
|
19
|
+
__exportStar(require("./useChainOrderStore"), exports);
|
|
20
|
+
__exportStar(require("./useInitializeChainOrder"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useChainOrder: () => [number[], (chainId: number) => void];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useChainOrder = void 0;
|
|
7
|
+
const shallow_1 = __importDefault(require("zustand/shallow"));
|
|
8
|
+
const useChainOrderStore_1 = require("./useChainOrderStore");
|
|
9
|
+
const useChainOrder = () => {
|
|
10
|
+
return (0, useChainOrderStore_1.useChainOrderStore)((state) => [state.chainOrder, state.setChain], shallow_1.default);
|
|
11
|
+
};
|
|
12
|
+
exports.useChainOrder = useChainOrder;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ChainOrderStore } from './types';
|
|
2
|
+
export declare const maxChainToOrder = 9;
|
|
3
|
+
export declare const useChainOrderStore: import("zustand").UseBoundStore<Omit<Omit<import("zustand").StoreApi<ChainOrderStore>, "persist"> & {
|
|
4
|
+
persist: {
|
|
5
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<ChainOrderStore, {
|
|
6
|
+
chainOrder: number[];
|
|
7
|
+
}>>) => void;
|
|
8
|
+
clearStorage: () => void;
|
|
9
|
+
rehydrate: () => Promise<void>;
|
|
10
|
+
hasHydrated: () => boolean;
|
|
11
|
+
onHydrate: (fn: (state: ChainOrderStore) => void) => () => void;
|
|
12
|
+
onFinishHydration: (fn: (state: ChainOrderStore) => void) => () => void;
|
|
13
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<ChainOrderStore, {
|
|
14
|
+
chainOrder: number[];
|
|
15
|
+
}>>;
|
|
16
|
+
};
|
|
17
|
+
}, "setState"> & {
|
|
18
|
+
setState(nextStateOrUpdater: ChainOrderStore | Partial<ChainOrderStore> | ((state: import("immer/dist/internal").WritableDraft<ChainOrderStore>) => void), shouldReplace?: boolean | undefined): void;
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useChainOrderStore = exports.maxChainToOrder = void 0;
|
|
7
|
+
/* eslint-disable no-underscore-dangle */
|
|
8
|
+
const zustand_1 = __importDefault(require("zustand"));
|
|
9
|
+
const middleware_1 = require("zustand/middleware");
|
|
10
|
+
const immer_1 = require("zustand/middleware/immer");
|
|
11
|
+
exports.maxChainToOrder = 9;
|
|
12
|
+
exports.useChainOrderStore = (0, zustand_1.default)()((0, middleware_1.persist)((0, immer_1.immer)((set) => ({
|
|
13
|
+
chainOrder: [],
|
|
14
|
+
availableChains: [],
|
|
15
|
+
initializeChains: (chainIds) => set((state) => {
|
|
16
|
+
state.availableChains = chainIds;
|
|
17
|
+
state.chainOrder = state.chainOrder.filter((chainId) => chainIds.includes(chainId));
|
|
18
|
+
const chainsToAdd = chainIds.filter((chainId) => !state.chainOrder.includes(chainId));
|
|
19
|
+
if (state.chainOrder.length === exports.maxChainToOrder ||
|
|
20
|
+
!chainsToAdd.length) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const chainsToAddLength = exports.maxChainToOrder - state.chainOrder.length;
|
|
24
|
+
for (let index = 0; index < chainsToAddLength; index++) {
|
|
25
|
+
state.chainOrder.push(chainsToAdd[index]);
|
|
26
|
+
}
|
|
27
|
+
}),
|
|
28
|
+
setChain: (chainId) => set((state) => {
|
|
29
|
+
if (state.chainOrder.includes(chainId) ||
|
|
30
|
+
!state.availableChains.includes(chainId)) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
state.chainOrder.unshift(chainId);
|
|
34
|
+
if (state.chainOrder.length > exports.maxChainToOrder) {
|
|
35
|
+
state.chainOrder.pop();
|
|
36
|
+
}
|
|
37
|
+
}),
|
|
38
|
+
})), {
|
|
39
|
+
name: 'li.fi-widget-chains-order',
|
|
40
|
+
version: 0,
|
|
41
|
+
partialize: (state) => ({ chainOrder: state.chainOrder }),
|
|
42
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useSetChainOrder: () => [(chainId: number) => void, (chainIds: number[]) => void];
|