@rango-dev/widget-embedded 0.12.1-next.9 → 0.13.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/CHANGELOG.md +55 -0
- package/dist/Widget.d.ts.map +1 -1
- package/dist/components/AppRouter.d.ts +5 -2
- package/dist/components/AppRouter.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts +14 -4
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +6 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +94 -17
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +18 -3
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +25 -284
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +1 -0
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
- package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts.map +1 -1
- package/dist/components/HeaderButtons/WalletButton.d.ts.map +1 -1
- package/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/Layout/Layout.styles.d.ts +18 -3
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +6 -1
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts +4 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts +3 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts.map +1 -0
- package/dist/components/{SelectableCategoryList/SelectableCategoryList.styles.d.ts → LoadingSwapDetails/LoadingSwapDetails.styles.d.ts} +21 -6
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +4 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/index.d.ts +2 -0
- package/dist/components/LoadingSwapDetails/index.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +1 -1
- package/dist/components/NoRoutes/NoRoutes.styles.d.ts +18 -3
- package/dist/components/NoRoutes/NoRoutes.styles.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts +24 -4
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
- package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -1
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts +24 -4
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -1
- package/dist/components/RouteErrors/RouteErrors.types.d.ts +3 -1
- package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +1 -1
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +1 -1
- package/dist/components/SearchInput/SearchInput.styles.d.ts +6 -1
- package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +23 -151
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
- package/dist/components/SettingsContainer/index.d.ts +1 -1
- package/dist/components/SettingsContainer/index.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.styles.d.ts +24 -4
- package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +2 -9
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +35 -153
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.types.d.ts +1 -1
- package/dist/components/SwapDetails/SwapDetails.types.d.ts.map +1 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +6 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +2 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +6 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +2 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +24 -4
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
- package/dist/components/SwitchFromAndTo.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.styles.d.ts +207 -9
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.types.d.ts +1 -1
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
- package/dist/components/UpdateUrl.d.ts +6 -1
- package/dist/components/UpdateUrl.d.ts.map +1 -1
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts +24 -4
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -1
- package/dist/components/WidgetEvents.d.ts.map +1 -1
- package/dist/constants/errors.d.ts +2 -2
- package/dist/constants/routing.d.ts +12 -2
- package/dist/constants/routing.d.ts.map +1 -1
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/globalStyles.d.ts +1 -1
- package/dist/globalStyles.d.ts.map +1 -1
- package/dist/hooks/useNavigateBack.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList.d.ts +18 -0
- package/dist/hooks/usePrepareBlockchainList.d.ts.map +1 -0
- package/dist/hooks/useSwapInput.d.ts.map +1 -1
- package/dist/hooks/useSyncStoresWithConfig.d.ts +3 -0
- package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -0
- package/dist/hooks/useTheme.d.ts +3 -6
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useWalletProviders.d.ts +3 -3
- package/dist/hooks/useWalletProviders.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
- package/dist/pages/SelectBlockchainPage.d.ts +1 -2
- package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
- package/dist/pages/SelectSwapItemsPage.d.ts +1 -5
- package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/services/httpService.d.ts +0 -1
- package/dist/services/httpService.d.ts.map +1 -1
- package/dist/store/app.d.ts +26 -0
- package/dist/store/app.d.ts.map +1 -0
- package/dist/store/bestRoute.d.ts +4 -8
- package/dist/store/bestRoute.d.ts.map +1 -1
- package/dist/store/meta.d.ts +0 -2
- package/dist/store/meta.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts +8 -0
- package/dist/store/slices/config.d.ts.map +1 -0
- package/dist/store/slices/data.d.ts +26 -0
- package/dist/store/slices/data.d.ts.map +1 -0
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +3 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/common.d.ts +1 -0
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +5 -0
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +1 -0
- package/dist/utils/meta.d.ts.map +1 -1
- package/dist/utils/numbers.d.ts +3 -1
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/routing.d.ts +6 -3
- package/dist/utils/routing.d.ts.map +1 -1
- package/dist/utils/settings.d.ts +1 -0
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +1 -1
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/time.d.ts +2 -2
- package/dist/utils/time.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +1 -1
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +8 -8
- package/readme.md +3 -1
- package/src/Widget.tsx +22 -3
- package/src/components/AppRouter.tsx +38 -7
- package/src/components/AppRoutes.tsx +4 -28
- package/src/components/BlockchainList/BlockchainList.helpers.ts +1 -1
- package/src/components/BlockchainList/BlockchainList.styles.ts +6 -5
- package/src/components/BlockchainList/BlockchainList.tsx +6 -9
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +29 -42
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +33 -7
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +48 -7
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +59 -16
- package/src/components/ConfirmWalletsModal/WalletList.tsx +66 -22
- package/src/components/HeaderButtons/HeaderButtons.styles.ts +2 -2
- package/src/components/HeaderButtons/HeaderButtons.types.ts +1 -0
- package/src/components/HeaderButtons/HomeButtons.tsx +18 -5
- package/src/components/HeaderButtons/UnreadNotificationsBadge.tsx +1 -2
- package/src/components/HeaderButtons/WalletButton.tsx +4 -1
- package/src/components/Layout/Layout.styles.ts +5 -3
- package/src/components/Layout/Layout.tsx +5 -20
- package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +41 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +78 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +53 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +3 -0
- package/src/components/LoadingSwapDetails/index.ts +1 -0
- package/src/components/NoRoutes/NoRoutes.helper.ts +4 -2
- package/src/components/NotificationContent/NotificationContent.tsx +3 -7
- package/src/components/RouteErrors/RouteErrors.styles.ts +2 -1
- package/src/components/RouteErrors/RouteErrors.tsx +37 -26
- package/src/components/RouteErrors/RouteErrors.types.ts +3 -1
- package/src/components/RouteErrors/RouteErrorsModal.tsx +42 -14
- package/src/components/SettingsContainer/SettingsContainer.style.ts +2 -7
- package/src/components/SettingsContainer/index.ts +0 -1
- package/src/components/Slippage/Slippage.tsx +6 -2
- package/src/components/Slippage/SlippageTooltipContent.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +52 -16
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +19 -33
- package/src/components/SwapDetails/SwapDetails.styles.ts +10 -14
- package/src/components/SwapDetails/SwapDetails.tsx +143 -101
- package/src/components/SwapDetails/SwapDetails.types.ts +1 -1
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +5 -4
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +6 -7
- package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +3 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +2 -1
- package/src/components/SwapsGroup/SwapsGroup.tsx +3 -2
- package/src/components/SwitchFromAndTo.tsx +1 -35
- package/src/components/TokenList/TokenList.helpers.ts +6 -8
- package/src/components/TokenList/TokenList.styles.ts +7 -1
- package/src/components/TokenList/TokenList.tsx +29 -23
- package/src/components/TokenList/TokenList.types.ts +1 -1
- package/src/components/UpdateUrl.tsx +7 -1
- package/src/components/WidgetEvents.tsx +9 -3
- package/src/constants/errors.ts +2 -2
- package/src/constants/routing.ts +17 -2
- package/src/constants.ts +1 -0
- package/src/globalStyles.ts +1 -4
- package/src/hooks/useFetchBestRoute.ts +2 -2
- package/src/hooks/useNavigateBack.ts +10 -0
- package/src/hooks/usePrepareBlockchainList.ts +125 -0
- package/src/hooks/useSwapInput.ts +17 -3
- package/src/hooks/useSyncStoresWithConfig.ts +102 -0
- package/src/hooks/useTheme.ts +37 -75
- package/src/hooks/useWalletProviders.ts +7 -7
- package/src/pages/ConfirmSwapPage.tsx +65 -36
- package/src/pages/HistoryPage.tsx +2 -2
- package/src/pages/Home.tsx +114 -50
- package/src/pages/LanguagePage.tsx +1 -1
- package/src/pages/LiquiditySourcePage.tsx +22 -18
- package/src/pages/SelectBlockchainPage.tsx +19 -20
- package/src/pages/SelectSwapItemsPage.tsx +66 -88
- package/src/pages/SettingsPage.tsx +42 -15
- package/src/pages/SwapDetailsPage.tsx +9 -2
- package/src/pages/ThemePage.tsx +1 -1
- package/src/pages/WalletsPage.tsx +11 -5
- package/src/services/httpService.ts +4 -5
- package/src/store/app.ts +15 -0
- package/src/store/bestRoute.ts +45 -71
- package/src/store/meta.ts +11 -29
- package/src/store/slices/config.ts +26 -0
- package/src/store/slices/data.ts +203 -0
- package/src/store/wallets.ts +0 -27
- package/src/types/config.ts +3 -0
- package/src/utils/common.ts +3 -0
- package/src/utils/configs.ts +8 -2
- package/src/utils/meta.ts +7 -0
- package/src/utils/numbers.ts +3 -2
- package/src/utils/routing.ts +76 -14
- package/src/utils/settings.ts +15 -0
- package/src/utils/swap.ts +82 -26
- package/src/utils/time.ts +69 -36
- package/src/utils/wallets.ts +49 -29
- package/dist/components/BlockchainsChip/BlockchainsChip.d.ts +0 -5
- package/dist/components/BlockchainsChip/BlockchainsChip.d.ts.map +0 -1
- package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts +0 -151
- package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts.map +0 -1
- package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts +0 -6
- package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts.map +0 -1
- package/dist/components/BlockchainsChip/index.d.ts +0 -2
- package/dist/components/BlockchainsChip/index.d.ts.map +0 -1
- package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts +0 -3
- package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts.map +0 -1
- package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts +0 -4
- package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts.map +0 -1
- package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts +0 -4
- package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts.map +0 -1
- package/dist/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts.map +0 -1
- package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts +0 -12
- package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts.map +0 -1
- package/dist/components/SelectableCategoryList/index.d.ts +0 -2
- package/dist/components/SelectableCategoryList/index.d.ts.map +0 -1
- package/src/components/BlockchainsChip/BlockchainsChip.styles.ts +0 -30
- package/src/components/BlockchainsChip/BlockchainsChip.tsx +0 -15
- package/src/components/BlockchainsChip/BlockchainsChip.types.ts +0 -4
- package/src/components/BlockchainsChip/index.ts +0 -1
- package/src/components/BlockchainsSection/BlockchainSection.helpers.ts +0 -20
- package/src/components/SelectableCategoryList/SelectableCategoryList.helpers.ts +0 -20
- package/src/components/SelectableCategoryList/SelectableCategoryList.styles.ts +0 -21
- package/src/components/SelectableCategoryList/SelectableCategoryList.tsx +0 -79
- package/src/components/SelectableCategoryList/SelectableCategoryList.types.ts +0 -12
- package/src/components/SelectableCategoryList/index.ts +0 -1
|
@@ -2,10 +2,12 @@ import { i18n } from '@lingui/core';
|
|
|
2
2
|
import {
|
|
3
3
|
ChevronRightIcon,
|
|
4
4
|
Divider,
|
|
5
|
+
InfoIcon,
|
|
5
6
|
List,
|
|
6
7
|
ListItemButton,
|
|
7
8
|
Skeleton,
|
|
8
9
|
Switch,
|
|
10
|
+
Tooltip,
|
|
9
11
|
Typography,
|
|
10
12
|
} from '@rango-dev/ui';
|
|
11
13
|
import React from 'react';
|
|
@@ -14,10 +16,12 @@ import { useNavigate } from 'react-router-dom';
|
|
|
14
16
|
import { Layout } from '../components/Layout';
|
|
15
17
|
import { SettingsContainer } from '../components/SettingsContainer';
|
|
16
18
|
import { Slippage } from '../components/Slippage';
|
|
19
|
+
import { SlippageTooltipContainer as TooltipContainer } from '../components/Slippage/Slippage.styles';
|
|
17
20
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
18
21
|
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
19
22
|
import { useMetaStore } from '../store/meta';
|
|
20
23
|
import { useSettingsStore } from '../store/settings';
|
|
24
|
+
import { getContainer } from '../utils/common';
|
|
21
25
|
import { getUniqueSwappersGroups } from '../utils/settings';
|
|
22
26
|
|
|
23
27
|
interface PropTypes {
|
|
@@ -60,7 +64,7 @@ export function SettingsPage({ supportedSwappers, singleTheme }: PropTypes) {
|
|
|
60
64
|
case 'failed':
|
|
61
65
|
return (
|
|
62
66
|
<Typography variant="body" size="medium" color="$error500">
|
|
63
|
-
Loading failed
|
|
67
|
+
{i18n.t('Loading failed')}
|
|
64
68
|
</Typography>
|
|
65
69
|
);
|
|
66
70
|
default:
|
|
@@ -106,16 +110,18 @@ export function SettingsPage({ supportedSwappers, singleTheme }: PropTypes) {
|
|
|
106
110
|
onClick: () => navigate(navigationRoutes.exchanges),
|
|
107
111
|
};
|
|
108
112
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
/*
|
|
114
|
+
* const languageItem = {
|
|
115
|
+
* id: 'language-item',
|
|
116
|
+
* title: (
|
|
117
|
+
* <Typography variant="title" size="xmedium">
|
|
118
|
+
* {i18n.t('Language')}
|
|
119
|
+
* </Typography>
|
|
120
|
+
* ),
|
|
121
|
+
* end: <ChevronRightIcon color="gray" />,
|
|
122
|
+
* onClick: () => navigate(navigationRoutes.languages),
|
|
123
|
+
* };
|
|
124
|
+
*/
|
|
119
125
|
|
|
120
126
|
const themeItem = {
|
|
121
127
|
id: 'theme-item',
|
|
@@ -131,15 +137,36 @@ export function SettingsPage({ supportedSwappers, singleTheme }: PropTypes) {
|
|
|
131
137
|
const infiniteApprovalItem = {
|
|
132
138
|
id: 'infinite-approval-item',
|
|
133
139
|
title: (
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
140
|
+
<>
|
|
141
|
+
<Typography variant="title" size="xmedium">
|
|
142
|
+
{i18n.t('Infinite Approval')}
|
|
143
|
+
</Typography>
|
|
144
|
+
<Divider direction="horizontal" size={4} />
|
|
145
|
+
<Tooltip
|
|
146
|
+
side="top"
|
|
147
|
+
container={getContainer()}
|
|
148
|
+
content={
|
|
149
|
+
<TooltipContainer>
|
|
150
|
+
<Typography variant="label" size="medium" color="neutral900">
|
|
151
|
+
{i18n.t(
|
|
152
|
+
"Enabling the 'Infinite Approval' mode grants unrestricted access to smart contracts of DEXes/Bridges, allowing them to utilize the approved token amount without limitations."
|
|
153
|
+
)}
|
|
154
|
+
</Typography>
|
|
155
|
+
</TooltipContainer>
|
|
156
|
+
}>
|
|
157
|
+
<InfoIcon color="gray" />
|
|
158
|
+
</Tooltip>
|
|
159
|
+
</>
|
|
137
160
|
),
|
|
138
161
|
end: <Switch checked={infiniteApprove} />,
|
|
139
162
|
onClick: toggleInfiniteApprove,
|
|
140
163
|
};
|
|
141
164
|
|
|
142
|
-
const settingItems = [
|
|
165
|
+
const settingItems = [
|
|
166
|
+
bridgeItem,
|
|
167
|
+
exchangeItem,
|
|
168
|
+
// languageItem
|
|
169
|
+
];
|
|
143
170
|
if (!singleTheme) {
|
|
144
171
|
settingItems.push(themeItem);
|
|
145
172
|
}
|
|
@@ -6,6 +6,7 @@ import { SwapDetails } from '../components/SwapDetails';
|
|
|
6
6
|
import { SwapDetailsPlaceholder } from '../components/SwapDetails/SwapDetails.Placeholder';
|
|
7
7
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
8
8
|
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
9
|
+
import { useMetaStore } from '../store/meta';
|
|
9
10
|
import { useUiStore } from '../store/ui';
|
|
10
11
|
import { getPendingSwaps } from '../utils/queue';
|
|
11
12
|
|
|
@@ -15,6 +16,9 @@ export function SwapDetailsPage() {
|
|
|
15
16
|
const pendingSwaps = getPendingSwaps(manager);
|
|
16
17
|
const requestId = useUiStore.use.selectedSwapRequestId();
|
|
17
18
|
const { navigateBackFrom } = useNavigateBack();
|
|
19
|
+
const { loadingStatus } = useMetaStore();
|
|
20
|
+
|
|
21
|
+
const showSkeleton = loading || loadingStatus === 'loading';
|
|
18
22
|
|
|
19
23
|
const selectedSwap = pendingSwaps.find(
|
|
20
24
|
({ swap }) => swap.requestId === requestId
|
|
@@ -41,9 +45,12 @@ export function SwapDetailsPage() {
|
|
|
41
45
|
};
|
|
42
46
|
const swap = selectedSwap?.swap;
|
|
43
47
|
|
|
44
|
-
if (!swap) {
|
|
48
|
+
if (!swap || showSkeleton) {
|
|
45
49
|
return (
|
|
46
|
-
<SwapDetailsPlaceholder
|
|
50
|
+
<SwapDetailsPlaceholder
|
|
51
|
+
requestId={requestId || ''}
|
|
52
|
+
showSkeleton={showSkeleton}
|
|
53
|
+
/>
|
|
47
54
|
);
|
|
48
55
|
}
|
|
49
56
|
|
package/src/pages/ThemePage.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import { navigationRoutes } from '../constants/navigationRoutes';
|
|
|
11
11
|
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
12
12
|
import { useWalletList } from '../hooks/useWalletList';
|
|
13
13
|
import { useMetaStore } from '../store/meta';
|
|
14
|
+
import { getContainer } from '../utils/common';
|
|
14
15
|
|
|
15
16
|
interface PropTypes {
|
|
16
17
|
supportedWallets: WidgetConfig['wallets'];
|
|
@@ -36,14 +37,16 @@ export const TIME_TO_IGNORE_MODAL = 300;
|
|
|
36
37
|
|
|
37
38
|
export function WalletsPage({ config }: PropTypes) {
|
|
38
39
|
const { navigateBackFrom } = useNavigateBack();
|
|
39
|
-
const [openModal, setOpenModal] = useState
|
|
40
|
+
const [openModal, setOpenModal] = useState(false);
|
|
41
|
+
const [selectedWalletType, setSelectedWalletType] = useState<WalletType>('');
|
|
40
42
|
let modalTimerId: ReturnType<typeof setTimeout> | null = null;
|
|
41
43
|
|
|
42
44
|
const { list, handleClick, error } = useWalletList({
|
|
43
45
|
config,
|
|
44
46
|
onBeforeConnect: (type) => {
|
|
45
47
|
modalTimerId = setTimeout(() => {
|
|
46
|
-
setOpenModal(
|
|
48
|
+
setOpenModal(true);
|
|
49
|
+
setSelectedWalletType(type);
|
|
47
50
|
}, TIME_TO_IGNORE_MODAL);
|
|
48
51
|
},
|
|
49
52
|
onConnect: () => {
|
|
@@ -51,13 +54,15 @@ export function WalletsPage({ config }: PropTypes) {
|
|
|
51
54
|
clearTimeout(modalTimerId);
|
|
52
55
|
}
|
|
53
56
|
setTimeout(() => {
|
|
54
|
-
setOpenModal(
|
|
57
|
+
setOpenModal(false);
|
|
55
58
|
}, TIME_TO_CLOSE_MODAL);
|
|
56
59
|
},
|
|
57
60
|
});
|
|
58
61
|
|
|
59
62
|
const loadingMetaStatus = useMetaStore.use.loadingStatus();
|
|
60
|
-
const selectedWallet = list.find(
|
|
63
|
+
const selectedWallet = list.find(
|
|
64
|
+
(wallet) => wallet.type === selectedWalletType
|
|
65
|
+
);
|
|
61
66
|
const selectedWalletImage = selectedWallet?.image || '';
|
|
62
67
|
const selectedWalletState =
|
|
63
68
|
selectedWallet?.state || WalletState.NOT_INSTALLED;
|
|
@@ -79,6 +84,7 @@ export function WalletsPage({ config }: PropTypes) {
|
|
|
79
84
|
<Fragment key={key}>
|
|
80
85
|
<Wallet
|
|
81
86
|
{...wallet}
|
|
87
|
+
container={getContainer()}
|
|
82
88
|
onClick={(type) => {
|
|
83
89
|
void handleClick(type);
|
|
84
90
|
}}
|
|
@@ -89,7 +95,7 @@ export function WalletsPage({ config }: PropTypes) {
|
|
|
89
95
|
})}
|
|
90
96
|
<WalletModal
|
|
91
97
|
open={!!openModal}
|
|
92
|
-
onClose={() => setOpenModal(
|
|
98
|
+
onClose={() => setOpenModal(false)}
|
|
93
99
|
image={selectedWalletImage}
|
|
94
100
|
state={selectedWalletState}
|
|
95
101
|
error={error}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { RangoClient } from 'rango-sdk';
|
|
2
|
-
import { getConfig } from '../utils/configs';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
// it is only for test purpose
|
|
6
|
-
export const RANGO_PUBLIC_API_KEY = 'c6381a79-2817-4602-83bf-6a641a409e32';
|
|
3
|
+
import { getConfig } from '../utils/configs';
|
|
7
4
|
|
|
8
5
|
let rango: RangoClient | undefined = undefined;
|
|
9
6
|
|
|
10
7
|
export const httpService = () => {
|
|
11
|
-
if (rango)
|
|
8
|
+
if (rango) {
|
|
9
|
+
return rango;
|
|
10
|
+
}
|
|
12
11
|
rango = new RangoClient(getConfig('API_KEY'));
|
|
13
12
|
return rango;
|
|
14
13
|
};
|
package/src/store/app.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ConfigSlice } from './slices/config';
|
|
2
|
+
import type { DataSlice } from './slices/data';
|
|
3
|
+
|
|
4
|
+
import { create } from 'zustand';
|
|
5
|
+
|
|
6
|
+
import createSelectors from './selectors';
|
|
7
|
+
import { createConfigSlice } from './slices/config';
|
|
8
|
+
import { createDataSlice } from './slices/data';
|
|
9
|
+
|
|
10
|
+
const store = create<DataSlice & ConfigSlice>()((...a) => ({
|
|
11
|
+
...createDataSlice(...a),
|
|
12
|
+
...createConfigSlice(...a),
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
export const useAppStore = createSelectors(store);
|
package/src/store/bestRoute.ts
CHANGED
|
@@ -11,15 +11,10 @@ import { ZERO } from '../constants/numbers';
|
|
|
11
11
|
import { isPositiveNumber } from '../utils/numbers';
|
|
12
12
|
import { getBestRouteToTokenUsdPrice } from '../utils/routing';
|
|
13
13
|
import { calcOutputUsdValue } from '../utils/swap';
|
|
14
|
-
import {
|
|
15
|
-
getDefaultToken,
|
|
16
|
-
getSortedTokens,
|
|
17
|
-
tokensAreEqual,
|
|
18
|
-
} from '../utils/wallets';
|
|
14
|
+
import { tokensAreEqual } from '../utils/wallets';
|
|
19
15
|
|
|
20
16
|
import { useMetaStore } from './meta';
|
|
21
17
|
import createSelectors from './selectors';
|
|
22
|
-
import { useWalletsStore } from './wallets';
|
|
23
18
|
|
|
24
19
|
const getUsdValue = (token: Token | null, amount: string): BigNumber | null =>
|
|
25
20
|
token?.usdPrice
|
|
@@ -36,20 +31,12 @@ export interface RouteState {
|
|
|
36
31
|
fromToken: TokenWithBalance | null;
|
|
37
32
|
toToken: TokenWithBalance | null;
|
|
38
33
|
routeWalletsConfirmed: boolean;
|
|
39
|
-
sourceTokens: Token[];
|
|
40
|
-
destinationTokens: Token[];
|
|
41
34
|
selectedWallets: Wallet[];
|
|
42
35
|
resetRoute: () => void;
|
|
43
36
|
resetToBlockchain: () => void;
|
|
44
37
|
resetFromBlockchain: () => void;
|
|
45
|
-
setFromBlockchain: (
|
|
46
|
-
|
|
47
|
-
setDefaultToken?: boolean
|
|
48
|
-
) => void;
|
|
49
|
-
setToBlockchain: (
|
|
50
|
-
chian: BlockchainMeta | null,
|
|
51
|
-
setDefaultToken?: boolean
|
|
52
|
-
) => void;
|
|
38
|
+
setFromBlockchain: (chain: BlockchainMeta | null) => void;
|
|
39
|
+
setToBlockchain: (chian: BlockchainMeta | null) => void;
|
|
53
40
|
|
|
54
41
|
setFromToken: (token: Token | null) => void;
|
|
55
42
|
setToToken: (token: Token | null) => void;
|
|
@@ -78,8 +65,6 @@ export const useBestRouteStore = createSelectors(
|
|
|
78
65
|
toToken: null,
|
|
79
66
|
bestRoute: null,
|
|
80
67
|
routeWalletsConfirmed: false,
|
|
81
|
-
sourceTokens: [],
|
|
82
|
-
destinationTokens: [],
|
|
83
68
|
selectedWallets: [],
|
|
84
69
|
customDestination: '',
|
|
85
70
|
setRoute: (bestRoute) =>
|
|
@@ -112,66 +97,65 @@ export const useBestRouteStore = createSelectors(
|
|
|
112
97
|
outputAmount: null,
|
|
113
98
|
outputUsdValue: new BigNumber(0),
|
|
114
99
|
})),
|
|
115
|
-
setFromBlockchain: (chain
|
|
100
|
+
setFromBlockchain: (chain) => {
|
|
116
101
|
set((state) => {
|
|
117
102
|
if (state.fromBlockchain?.name === chain?.name) {
|
|
118
103
|
return {};
|
|
119
104
|
}
|
|
120
|
-
|
|
121
|
-
const connectedWallets = useWalletsStore.getState().connectedWallets;
|
|
122
|
-
const sortedTokens = getSortedTokens(
|
|
123
|
-
chain,
|
|
124
|
-
tokens,
|
|
125
|
-
connectedWallets,
|
|
126
|
-
state.destinationTokens
|
|
127
|
-
);
|
|
128
|
-
const fromToken = getDefaultToken(sortedTokens, state.toToken);
|
|
105
|
+
|
|
129
106
|
return {
|
|
130
107
|
fromBlockchain: chain,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
fromToken,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
inputUsdValue: getUsdValue(fromToken, state.inputAmount),
|
|
108
|
+
...(state.fromToken && {
|
|
109
|
+
bestRoute: null,
|
|
110
|
+
fromToken: null,
|
|
111
|
+
outputAmount: null,
|
|
112
|
+
outputUsdValue: null,
|
|
137
113
|
}),
|
|
138
114
|
};
|
|
139
115
|
});
|
|
140
116
|
},
|
|
141
|
-
setFromToken: (token) =>
|
|
142
|
-
|
|
117
|
+
setFromToken: (token) => {
|
|
118
|
+
const { blockchains } = useMetaStore.getState().meta;
|
|
119
|
+
const fromBlockchain =
|
|
120
|
+
blockchains.find(
|
|
121
|
+
(blockchain) => blockchain.name === token?.blockchain
|
|
122
|
+
) ?? null;
|
|
123
|
+
return set((state) => ({
|
|
143
124
|
fromToken: token,
|
|
125
|
+
fromBlockchain,
|
|
144
126
|
...(!!state.inputAmount && {
|
|
145
127
|
inputUsdValue: getUsdValue(token, state.inputAmount),
|
|
146
128
|
}),
|
|
147
|
-
}))
|
|
148
|
-
|
|
129
|
+
}));
|
|
130
|
+
},
|
|
131
|
+
setToBlockchain: (chain) => {
|
|
149
132
|
set((state) => {
|
|
150
133
|
if (state.toBlockchain?.name === chain?.name) {
|
|
151
134
|
return {};
|
|
152
135
|
}
|
|
153
|
-
const tokens = useMetaStore.getState().meta.tokens;
|
|
154
|
-
const connectedWallets = useWalletsStore.getState().connectedWallets;
|
|
155
|
-
const sortedTokens = getSortedTokens(
|
|
156
|
-
chain,
|
|
157
|
-
tokens,
|
|
158
|
-
connectedWallets,
|
|
159
|
-
state.destinationTokens
|
|
160
|
-
);
|
|
161
136
|
|
|
162
137
|
return {
|
|
163
138
|
toBlockchain: chain,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
toToken:
|
|
139
|
+
...(state.toToken && {
|
|
140
|
+
bestRoute: null,
|
|
141
|
+
toToken: null,
|
|
142
|
+
outputAmount: null,
|
|
143
|
+
outputUsdValue: null,
|
|
167
144
|
}),
|
|
168
145
|
};
|
|
169
146
|
});
|
|
170
147
|
},
|
|
171
|
-
setToToken: (token) =>
|
|
172
|
-
|
|
148
|
+
setToToken: (token) => {
|
|
149
|
+
const { blockchains } = useMetaStore.getState().meta;
|
|
150
|
+
const toBlockchain =
|
|
151
|
+
blockchains.find(
|
|
152
|
+
(blockchain) => blockchain.name === token?.blockchain
|
|
153
|
+
) ?? null;
|
|
154
|
+
return set(() => ({
|
|
173
155
|
toToken: token,
|
|
174
|
-
|
|
156
|
+
toBlockchain,
|
|
157
|
+
}));
|
|
158
|
+
},
|
|
175
159
|
setInputAmount: (amount) => {
|
|
176
160
|
set((state) => ({
|
|
177
161
|
inputAmount: amount,
|
|
@@ -187,7 +171,6 @@ export const useBestRouteStore = createSelectors(
|
|
|
187
171
|
},
|
|
188
172
|
retry: (pendingSwap) => {
|
|
189
173
|
const { tokens, blockchains } = useMetaStore.getState().meta;
|
|
190
|
-
const connectedWallets = useWalletsStore.getState().connectedWallets;
|
|
191
174
|
const failedIndex =
|
|
192
175
|
pendingSwap.status === 'failed'
|
|
193
176
|
? pendingSwap.steps.findIndex((s) => s.status === 'failed')
|
|
@@ -223,18 +206,7 @@ export const useBestRouteStore = createSelectors(
|
|
|
223
206
|
address: lastStep.toSymbolAddress,
|
|
224
207
|
})
|
|
225
208
|
);
|
|
226
|
-
|
|
227
|
-
fromBlockchain,
|
|
228
|
-
tokens,
|
|
229
|
-
connectedWallets,
|
|
230
|
-
[]
|
|
231
|
-
);
|
|
232
|
-
const sortedDestinationTokens = getSortedTokens(
|
|
233
|
-
toBlockchain,
|
|
234
|
-
tokens,
|
|
235
|
-
connectedWallets,
|
|
236
|
-
[]
|
|
237
|
-
);
|
|
209
|
+
|
|
238
210
|
const inputAmount = pendingSwap.inputAmount;
|
|
239
211
|
set({
|
|
240
212
|
fromBlockchain,
|
|
@@ -246,8 +218,6 @@ export const useBestRouteStore = createSelectors(
|
|
|
246
218
|
toBlockchain,
|
|
247
219
|
toToken,
|
|
248
220
|
bestRoute: null,
|
|
249
|
-
sourceTokens: sortedSourceTokens,
|
|
250
|
-
destinationTokens: sortedDestinationTokens,
|
|
251
221
|
});
|
|
252
222
|
},
|
|
253
223
|
switchFromAndTo: () =>
|
|
@@ -256,8 +226,6 @@ export const useBestRouteStore = createSelectors(
|
|
|
256
226
|
fromToken: state.toToken,
|
|
257
227
|
toBlockchain: state.fromBlockchain,
|
|
258
228
|
toToken: state.fromToken,
|
|
259
|
-
sourceTokens: state.destinationTokens,
|
|
260
|
-
destinationTokens: state.sourceTokens,
|
|
261
229
|
inputAmount: state.outputAmount?.toString() || '',
|
|
262
230
|
inputUsdValue: getUsdValue(
|
|
263
231
|
state.toToken,
|
|
@@ -267,13 +235,19 @@ export const useBestRouteStore = createSelectors(
|
|
|
267
235
|
|
|
268
236
|
resetFromBlockchain: () =>
|
|
269
237
|
set(() => ({
|
|
238
|
+
fromToken: null,
|
|
270
239
|
fromBlockchain: null,
|
|
271
|
-
|
|
240
|
+
outputAmount: null,
|
|
241
|
+
outputUsdValue: null,
|
|
242
|
+
bestRoute: null,
|
|
272
243
|
})),
|
|
273
244
|
resetToBlockchain: () =>
|
|
274
245
|
set(() => ({
|
|
246
|
+
toToken: null,
|
|
275
247
|
toBlockchain: null,
|
|
276
|
-
|
|
248
|
+
outputAmount: null,
|
|
249
|
+
outputUsdValue: null,
|
|
250
|
+
bestRoute: null,
|
|
277
251
|
})),
|
|
278
252
|
setRouteWalletConfirmed: (flag) =>
|
|
279
253
|
set({
|
package/src/store/meta.ts
CHANGED
|
@@ -3,12 +3,8 @@ import type { MetaResponse } from 'rango-sdk';
|
|
|
3
3
|
|
|
4
4
|
import { create } from 'zustand';
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { removeDuplicateFrom } from '../utils/common';
|
|
8
|
-
import { getTokensWithBalance, sortTokens } from '../utils/wallets';
|
|
9
|
-
|
|
6
|
+
import { useAppStore } from './app';
|
|
10
7
|
import createSelectors from './selectors';
|
|
11
|
-
import { useWalletsStore } from './wallets';
|
|
12
8
|
|
|
13
9
|
export type LoadingStatus = 'loading' | 'success' | 'failed';
|
|
14
10
|
|
|
@@ -16,38 +12,24 @@ export interface MetaState {
|
|
|
16
12
|
meta: MetaResponse & { tokens: TokenWithBalance[] };
|
|
17
13
|
loadingStatus: LoadingStatus;
|
|
18
14
|
fetchMeta: () => Promise<void>;
|
|
19
|
-
setTokensWithBalance: () => void;
|
|
20
15
|
}
|
|
21
16
|
|
|
22
17
|
export const useMetaStore = createSelectors(
|
|
23
18
|
create<MetaState>()((set) => ({
|
|
24
19
|
meta: { blockchains: [], popularTokens: [], swappers: [], tokens: [] },
|
|
25
20
|
loadingStatus: 'loading',
|
|
26
|
-
setTokensWithBalance: () => {
|
|
27
|
-
const connectedWallets = useWalletsStore.getState().connectedWallets;
|
|
28
|
-
|
|
29
|
-
set((state) => ({
|
|
30
|
-
...state,
|
|
31
|
-
meta: {
|
|
32
|
-
...state.meta,
|
|
33
|
-
tokens: sortTokens(
|
|
34
|
-
getTokensWithBalance(state.meta.tokens, connectedWallets)
|
|
35
|
-
),
|
|
36
|
-
},
|
|
37
|
-
}));
|
|
38
|
-
},
|
|
39
21
|
fetchMeta: async () => {
|
|
40
22
|
try {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
23
|
+
await useAppStore.getState().fetch();
|
|
24
|
+
|
|
25
|
+
const state = useAppStore.getState();
|
|
26
|
+
const response: MetaResponse = {
|
|
27
|
+
blockchains: state.blockchains(),
|
|
28
|
+
tokens: state.tokens(),
|
|
29
|
+
popularTokens: state._popularTokens,
|
|
30
|
+
swappers: state._swappers,
|
|
31
|
+
};
|
|
32
|
+
|
|
51
33
|
set({ meta: response, loadingStatus: 'success' });
|
|
52
34
|
} catch (error) {
|
|
53
35
|
set({ loadingStatus: 'failed' });
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { WidgetConfig } from '../../types';
|
|
2
|
+
import type { StateCreator } from 'zustand';
|
|
3
|
+
|
|
4
|
+
const initConfig: WidgetConfig = { apiKey: '' };
|
|
5
|
+
|
|
6
|
+
export type ConfigSlice = {
|
|
7
|
+
config: WidgetConfig;
|
|
8
|
+
|
|
9
|
+
updateConfig: (config: WidgetConfig) => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const createConfigSlice: StateCreator<ConfigSlice> = (set, get) => ({
|
|
13
|
+
config: initConfig,
|
|
14
|
+
|
|
15
|
+
// Actions
|
|
16
|
+
updateConfig: (nextConfig: WidgetConfig) => {
|
|
17
|
+
const currentConfig = get().config;
|
|
18
|
+
|
|
19
|
+
set({
|
|
20
|
+
config: {
|
|
21
|
+
...currentConfig,
|
|
22
|
+
...nextConfig,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
});
|