@rango-dev/widget-embedded 0.17.1-next.3 → 0.17.1-next.31
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/dist/QueueManager.d.ts +5 -2
- package/dist/QueueManager.d.ts.map +1 -1
- package/dist/components/AppRouter.d.ts +0 -2
- package/dist/components/AppRouter.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts +1 -6
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +370 -56
- 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/ConfirmWalletsModal.types.d.ts +0 -2
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +1 -4
- package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
- package/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/Layout/Layout.types.d.ts +2 -2
- package/dist/components/Layout/Layout.types.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +1727 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/Quote.styles.d.ts +633 -3
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.types.d.ts +0 -1
- package/dist/components/Quote/Quote.types.d.ts.map +1 -1
- package/dist/components/Quote/QuoteSummary.styles.d.ts +157 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.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 +1 -1
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +628 -0
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +1 -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 +157 -0
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.helpers.d.ts +2 -2
- package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.styles.d.ts +942 -0
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.types.d.ts +3 -9
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
- package/dist/components/TokenList/index.d.ts +0 -1
- package/dist/components/TokenList/index.d.ts.map +1 -1
- package/dist/components/UpdateUrl.d.ts +1 -6
- package/dist/components/UpdateUrl.d.ts.map +1 -1
- package/dist/components/WidgetEvents.d.ts.map +1 -1
- package/dist/constants/errors.d.ts.map +1 -1
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/navigationRoutes.d.ts +1 -2
- package/dist/constants/navigationRoutes.d.ts.map +1 -1
- package/dist/constants/searchParams.d.ts +2 -1
- package/dist/constants/searchParams.d.ts.map +1 -1
- package/dist/containers/App/App.d.ts +3 -0
- package/dist/containers/App/App.d.ts.map +1 -0
- package/dist/containers/App/App.styles.d.ts +158 -0
- package/dist/containers/App/App.styles.d.ts.map +1 -0
- package/dist/containers/App/index.d.ts +2 -0
- package/dist/containers/App/index.d.ts.map +1 -0
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +316 -0
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +3 -0
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
- package/dist/containers/Wallets/Wallets.d.ts +6 -0
- package/dist/containers/Wallets/Wallets.d.ts.map +1 -0
- package/dist/containers/Wallets/Wallets.types.d.ts +11 -0
- package/dist/containers/Wallets/Wallets.types.d.ts.map +1 -0
- package/dist/containers/Wallets/index.d.ts +2 -0
- package/dist/containers/Wallets/index.d.ts.map +1 -0
- package/dist/containers/Widget/Widget.d.ts +5 -0
- package/dist/containers/Widget/Widget.d.ts.map +1 -0
- package/dist/containers/Widget/Widget.types.d.ts +5 -0
- package/dist/containers/Widget/Widget.types.d.ts.map +1 -0
- package/dist/containers/Widget/index.d.ts +3 -0
- package/dist/containers/Widget/index.d.ts.map +1 -0
- package/dist/containers/WidgetInfo/WidgetInfo.d.ts +6 -0
- package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -0
- package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts +20 -0
- package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts.map +1 -0
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +21 -0
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -0
- package/dist/containers/WidgetInfo/index.d.ts +2 -0
- package/dist/containers/WidgetInfo/index.d.ts.map +1 -0
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts +5 -0
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -0
- package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts +7 -0
- package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts.map +1 -0
- package/dist/containers/WidgetProvider/index.d.ts +2 -0
- package/dist/containers/WidgetProvider/index.d.ts.map +1 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +6 -3
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +1 -1
- package/dist/hooks/useForceAutoConnect.d.ts +2 -0
- package/dist/hooks/useForceAutoConnect.d.ts.map +1 -0
- package/dist/hooks/useLanguage.d.ts +1 -1
- package/dist/hooks/useLanguage.d.ts.map +1 -1
- package/dist/hooks/useNavigateBack.d.ts +1 -3
- package/dist/hooks/useNavigateBack.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.d.ts +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts +2 -2
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +3 -5
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts +1 -0
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts +5 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts.map +1 -1
- package/dist/hooks/useSwapInput.d.ts.map +1 -1
- package/dist/hooks/useSyncStoresWithConfig.d.ts +1 -2
- package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
- package/dist/hooks/useTheme.d.ts +1 -1
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts.map +1 -1
- package/dist/index.d.ts +20 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts +1 -6
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/HistoryPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/LanguagePage.d.ts.map +1 -1
- package/dist/pages/LiquiditySourcePage.d.ts +1 -2
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
- package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
- package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts +1 -6
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
- package/dist/pages/ThemePage.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts +1 -8
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/AppStore.d.ts +47 -0
- package/dist/store/AppStore.d.ts.map +1 -0
- package/dist/store/app.d.ts +41 -22
- package/dist/store/app.d.ts.map +1 -1
- package/dist/store/notification.d.ts +4 -3
- package/dist/store/notification.d.ts.map +1 -1
- package/dist/store/quote.d.ts +23 -16
- package/dist/store/quote.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts +3 -2
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/slices/data.d.ts +3 -0
- package/dist/store/slices/data.d.ts.map +1 -1
- package/dist/store/slices/settings.d.ts +39 -0
- package/dist/store/slices/settings.d.ts.map +1 -0
- package/dist/store/ui.d.ts +2 -1
- package/dist/store/ui.d.ts.map +1 -1
- package/dist/store/wallets.d.ts +14 -9
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +38 -5
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/swap.d.ts +4 -14
- package/dist/types/swap.d.ts.map +1 -1
- package/dist/types/wallets.d.ts +15 -1
- package/dist/types/wallets.d.ts.map +1 -1
- package/dist/utils/colors.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +1 -0
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +2 -1
- package/dist/utils/meta.d.ts.map +1 -1
- package/dist/utils/providers.d.ts +2 -2
- package/dist/utils/providers.d.ts.map +1 -1
- package/dist/utils/queue.d.ts +2 -2
- package/dist/utils/queue.d.ts.map +1 -1
- package/dist/utils/quote.d.ts +1 -1
- package/dist/utils/quote.d.ts.map +1 -1
- package/dist/utils/settings.d.ts +6 -2
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +16 -7
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/time.d.ts +1 -1
- package/dist/utils/time.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +7 -9
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +12 -10
- package/src/QueueManager.tsx +18 -17
- package/src/components/AppRouter.tsx +8 -32
- package/src/components/AppRoutes.tsx +57 -69
- package/src/components/BlockchainList/BlockchainList.styles.ts +2 -2
- package/src/components/BlockchainList/BlockchainList.tsx +4 -4
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +4 -4
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +12 -6
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +20 -21
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +0 -2
- package/src/components/ConfirmWalletsModal/WalletList.tsx +6 -5
- package/src/components/ConfirmWalletsModal/WalletList.type.ts +1 -4
- package/src/components/HeaderButtons/HomeButtons.tsx +28 -18
- package/src/components/Layout/Layout.tsx +20 -7
- package/src/components/Layout/Layout.types.ts +2 -2
- package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +14 -7
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +63 -60
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +17 -8
- package/src/components/NoResult/NoResult.helpers.ts +12 -12
- package/src/components/NoResult/NoResult.tsx +6 -6
- package/src/components/NotificationContent/NotificationContent.tsx +5 -3
- package/src/components/Quote/Quote.styles.ts +42 -12
- package/src/components/Quote/Quote.tsx +106 -37
- package/src/components/Quote/Quote.types.ts +0 -1
- package/src/components/Quote/QuoteSkeleton.tsx +1 -1
- package/src/components/Quote/QuoteSummary.styles.ts +9 -8
- package/src/components/Quote/QuoteSummary.tsx +2 -2
- package/src/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx +1 -1
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +11 -4
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +8 -1
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +13 -13
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +1 -0
- package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +3 -3
- package/src/components/Slippage/Slippage.tsx +3 -5
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +5 -7
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.styles.ts +37 -33
- package/src/components/SwapDetails/SwapDetails.tsx +33 -45
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.tsx +1 -1
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +4 -3
- package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +2 -2
- package/src/components/SwapDetailsModal/SwapDetailsModal.helpers.tsx +1 -1
- package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +1 -1
- package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +1 -1
- package/src/components/SwapsGroup/SwapsGroup.styles.ts +10 -1
- package/src/components/SwapsGroup/SwapsGroup.tsx +3 -5
- package/src/components/TokenList/TokenList.helpers.ts +2 -2
- package/src/components/TokenList/TokenList.styles.ts +58 -37
- package/src/components/TokenList/TokenList.tsx +28 -23
- package/src/components/TokenList/TokenList.types.ts +3 -10
- package/src/components/TokenList/index.ts +0 -1
- package/src/components/UpdateUrl.tsx +23 -18
- package/src/components/WidgetEvents.tsx +4 -2
- package/src/constants/errors.ts +9 -5
- package/src/constants/index.ts +1 -0
- package/src/constants/navigationRoutes.ts +7 -8
- package/src/constants/searchParams.ts +1 -0
- package/src/containers/App/App.styles.ts +18 -0
- package/src/containers/App/App.tsx +52 -0
- package/src/containers/App/index.ts +1 -0
- package/src/containers/QuoteInfo/QuoteInfo.styles.ts +17 -1
- package/src/containers/QuoteInfo/QuoteInfo.tsx +44 -43
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +3 -0
- package/src/{Wallets.tsx → containers/Wallets/Wallets.tsx} +48 -34
- package/src/containers/Wallets/Wallets.types.ts +12 -0
- package/src/containers/Wallets/index.ts +1 -0
- package/src/containers/Widget/Widget.tsx +19 -0
- package/src/containers/Widget/Widget.types.ts +5 -0
- package/src/containers/Widget/index.ts +2 -0
- package/src/containers/WidgetInfo/WidgetInfo.helpers.ts +64 -0
- package/src/containers/WidgetInfo/WidgetInfo.tsx +62 -0
- package/src/containers/WidgetInfo/WidgetInfo.types.ts +21 -0
- package/src/containers/WidgetInfo/index.ts +1 -0
- package/src/containers/WidgetProvider/WidgetProvider.tsx +28 -0
- package/src/containers/WidgetProvider/WidgetProvider.types.ts +7 -0
- package/src/containers/WidgetProvider/index.ts +1 -0
- package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +15 -11
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +25 -24
- package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +1 -1
- package/src/hooks/useForceAutoConnect.ts +27 -0
- package/src/hooks/useLanguage.ts +4 -5
- package/src/hooks/useNavigateBack.ts +3 -52
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -1
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.ts +37 -7
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +60 -0
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +78 -3
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.ts +15 -6
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.ts +6 -1
- package/src/hooks/useSwapInput.ts +89 -30
- package/src/hooks/useSyncStoresWithConfig.ts +38 -22
- package/src/hooks/useTheme.ts +4 -5
- package/src/hooks/useWalletList.ts +3 -5
- package/src/index.ts +53 -5
- package/src/pages/ConfirmSwapPage.tsx +61 -41
- package/src/pages/HistoryPage.tsx +2 -7
- package/src/pages/Home.tsx +58 -88
- package/src/pages/LanguagePage.tsx +0 -5
- package/src/pages/LiquiditySourcePage.tsx +24 -37
- package/src/pages/SelectBlockchainPage.tsx +28 -21
- package/src/pages/SelectSwapItemsPage.tsx +10 -27
- package/src/pages/SettingsPage.tsx +28 -24
- package/src/pages/SwapDetailsPage.tsx +6 -7
- package/src/pages/ThemePage.tsx +2 -7
- package/src/pages/WalletsPage.tsx +4 -15
- package/src/services/httpService.ts +1 -1
- package/src/store/AppStore.tsx +41 -0
- package/src/store/app.ts +44 -6
- package/src/store/quote.ts +29 -26
- package/src/store/slices/config.ts +25 -15
- package/src/store/slices/data.ts +64 -29
- package/src/store/slices/settings.ts +168 -0
- package/src/store/wallets.ts +68 -37
- package/src/types/config.ts +50 -5
- package/src/types/swap.ts +4 -13
- package/src/types/wallets.ts +18 -1
- package/src/utils/colors.ts +2 -1
- package/src/utils/configs.ts +2 -1
- package/src/utils/date.ts +1 -1
- package/src/utils/meta.ts +8 -1
- package/src/utils/providers.ts +8 -5
- package/src/utils/queue.ts +2 -2
- package/src/utils/quote.ts +7 -7
- package/src/utils/settings.ts +17 -10
- package/src/utils/swap.ts +59 -55
- package/src/utils/time.ts +1 -1
- package/src/utils/wallets.ts +107 -149
- package/dist/Wallets.d.ts +0 -17
- package/dist/Wallets.d.ts.map +0 -1
- package/dist/Widget.d.ts +0 -9
- package/dist/Widget.d.ts.map +0 -1
- package/dist/store/meta.d.ts +0 -23
- package/dist/store/meta.d.ts.map +0 -1
- package/dist/store/settings.d.ts +0 -81
- package/dist/store/settings.d.ts.map +0 -1
- package/src/Widget.tsx +0 -119
- package/src/store/meta.ts +0 -39
- package/src/store/settings.ts +0 -158
|
@@ -3,13 +3,13 @@ import type {
|
|
|
3
3
|
ConfirmSwap,
|
|
4
4
|
ConfirmSwapFetchResult,
|
|
5
5
|
} from '../hooks/useConfirmSwap/useConfirmSwap.types';
|
|
6
|
-
import type { WidgetConfig } from '../types';
|
|
7
6
|
|
|
8
7
|
import { i18n } from '@lingui/core';
|
|
9
8
|
import { useManager } from '@rango-dev/queue-manager-react';
|
|
10
9
|
import {
|
|
11
10
|
Alert,
|
|
12
11
|
Button,
|
|
12
|
+
css,
|
|
13
13
|
Divider,
|
|
14
14
|
IconButton,
|
|
15
15
|
RefreshIcon,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
Typography,
|
|
20
20
|
WalletIcon,
|
|
21
21
|
} from '@rango-dev/ui';
|
|
22
|
-
import React, { useEffect, useState } from 'react';
|
|
22
|
+
import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
23
23
|
import { flushSync } from 'react-dom';
|
|
24
24
|
import { useNavigate } from 'react-router-dom';
|
|
25
25
|
|
|
@@ -31,6 +31,7 @@ import { navigationRoutes } from '../constants/navigationRoutes';
|
|
|
31
31
|
import { getQuoteUpdateWarningMessage } from '../constants/warnings';
|
|
32
32
|
import { QuoteInfo } from '../containers/QuoteInfo';
|
|
33
33
|
import { useConfirmSwap } from '../hooks/useConfirmSwap';
|
|
34
|
+
import { useAppStore } from '../store/AppStore';
|
|
34
35
|
import { useQuoteStore } from '../store/quote';
|
|
35
36
|
import { useUiStore } from '../store/ui';
|
|
36
37
|
import { useWalletsStore } from '../store/wallets';
|
|
@@ -40,18 +41,9 @@ import { getContainer } from '../utils/common';
|
|
|
40
41
|
const Container = styled('div', {
|
|
41
42
|
position: 'relative',
|
|
42
43
|
width: '100%',
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
alignItems: 'center',
|
|
47
|
-
paddingBottom: '$10',
|
|
48
|
-
},
|
|
49
|
-
'& .icon': {
|
|
50
|
-
width: '$24',
|
|
51
|
-
height: '$24',
|
|
52
|
-
display: 'flex',
|
|
53
|
-
justifyContent: 'center',
|
|
54
|
-
alignItems: 'center',
|
|
44
|
+
|
|
45
|
+
'& .quote-update__alert': {
|
|
46
|
+
paddingTop: '$10',
|
|
55
47
|
},
|
|
56
48
|
});
|
|
57
49
|
|
|
@@ -59,23 +51,33 @@ const Buttons = styled('div', {
|
|
|
59
51
|
width: '100%',
|
|
60
52
|
display: 'flex',
|
|
61
53
|
justifyContent: 'space-between',
|
|
62
|
-
'& .confirm-button': {
|
|
63
|
-
flexGrow: 1,
|
|
64
|
-
paddingRight: '$10',
|
|
65
|
-
},
|
|
66
54
|
[`& ${IconButton}`]: {
|
|
67
55
|
width: '$48',
|
|
68
56
|
height: '$48',
|
|
69
57
|
},
|
|
70
58
|
});
|
|
71
59
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
60
|
+
const confirmBtnStyles = css({
|
|
61
|
+
flexGrow: 1,
|
|
62
|
+
paddingRight: '$10',
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const iconStyles = css({
|
|
66
|
+
width: '$24',
|
|
67
|
+
height: '$24',
|
|
68
|
+
display: 'flex',
|
|
69
|
+
justifyContent: 'center',
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const descriptionStyles = css({
|
|
74
|
+
display: 'flex',
|
|
75
|
+
justifyContent: 'space-between',
|
|
76
|
+
alignItems: 'center',
|
|
77
|
+
});
|
|
75
78
|
|
|
76
|
-
export function ConfirmSwapPage(
|
|
79
|
+
export function ConfirmSwapPage() {
|
|
77
80
|
//TODO: move component's logics to a custom hook
|
|
78
|
-
const { config } = props;
|
|
79
81
|
const {
|
|
80
82
|
quote,
|
|
81
83
|
setInputAmount,
|
|
@@ -92,7 +94,8 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
92
94
|
const showWalletsOnInit = !quoteWalletsConfirmed;
|
|
93
95
|
const [showWallets, setShowWallets] = useState(false);
|
|
94
96
|
const setSelectedSwap = useUiStore.use.setSelectedSwap();
|
|
95
|
-
|
|
97
|
+
const disabledLiquiditySources = useAppStore().disabledLiquiditySources;
|
|
98
|
+
const prevDisabledLiquiditySources = useRef(disabledLiquiditySources);
|
|
96
99
|
const { manager } = useManager();
|
|
97
100
|
const {
|
|
98
101
|
fetch: confirmSwap,
|
|
@@ -126,12 +129,11 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
126
129
|
{ id: confirmSwapResult.swap.requestId }
|
|
127
130
|
);
|
|
128
131
|
setSelectedSwap(confirmSwapResult.swap.requestId);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
);
|
|
132
|
+
|
|
133
|
+
const swap_url = `../${navigationRoutes.swaps}/${confirmSwapResult.swap.requestId}`;
|
|
134
|
+
navigate(swap_url, {
|
|
135
|
+
replace: true,
|
|
136
|
+
});
|
|
135
137
|
setTimeout(() => {
|
|
136
138
|
setInputAmount('');
|
|
137
139
|
}, 0);
|
|
@@ -159,13 +161,23 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
159
161
|
swap: null,
|
|
160
162
|
warnings: null,
|
|
161
163
|
});
|
|
162
|
-
confirmSwap({ selectedWallets })
|
|
164
|
+
confirmSwap({ selectedWallets, customDestination })
|
|
163
165
|
.then((res) => {
|
|
164
166
|
setConfirmSwapResult(res);
|
|
165
167
|
})
|
|
166
168
|
.catch((error) => console.error(error));
|
|
167
169
|
};
|
|
168
170
|
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
const disabledLiquiditySourceReset =
|
|
173
|
+
!!prevDisabledLiquiditySources.current.length &&
|
|
174
|
+
!disabledLiquiditySources.length;
|
|
175
|
+
if (disabledLiquiditySourceReset) {
|
|
176
|
+
void onRefresh();
|
|
177
|
+
}
|
|
178
|
+
prevDisabledLiquiditySources.current = disabledLiquiditySources;
|
|
179
|
+
}, [disabledLiquiditySources.length]);
|
|
180
|
+
|
|
169
181
|
useEffect(() => {
|
|
170
182
|
if (showWalletsOnInit) {
|
|
171
183
|
cancelFetch();
|
|
@@ -245,12 +257,20 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
245
257
|
connectedWallets.length,
|
|
246
258
|
]);
|
|
247
259
|
|
|
260
|
+
useLayoutEffect(() => {
|
|
261
|
+
if (!quote) {
|
|
262
|
+
navigate(`../`);
|
|
263
|
+
}
|
|
264
|
+
}, []);
|
|
265
|
+
|
|
248
266
|
return (
|
|
249
267
|
<Layout
|
|
250
268
|
header={{
|
|
251
269
|
title: i18n.t('Confirm Swap'),
|
|
252
|
-
|
|
253
|
-
|
|
270
|
+
onWallet: () => {
|
|
271
|
+
const wallets_url = `../${navigationRoutes.wallets}`;
|
|
272
|
+
navigate(wallets_url);
|
|
273
|
+
},
|
|
254
274
|
suffix: (
|
|
255
275
|
<Tooltip
|
|
256
276
|
container={getContainer()}
|
|
@@ -259,7 +279,7 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
259
279
|
<HeaderButton
|
|
260
280
|
size="small"
|
|
261
281
|
variant="ghost"
|
|
262
|
-
onClick={() => navigate('
|
|
282
|
+
onClick={() => navigate('../' + navigationRoutes.settings)}>
|
|
263
283
|
<SettingsIcon size={18} color="black" />
|
|
264
284
|
</HeaderButton>
|
|
265
285
|
</Tooltip>
|
|
@@ -267,7 +287,7 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
267
287
|
}}
|
|
268
288
|
footer={
|
|
269
289
|
<Buttons>
|
|
270
|
-
<div className=
|
|
290
|
+
<div className={confirmBtnStyles()}>
|
|
271
291
|
<Button
|
|
272
292
|
variant="contained"
|
|
273
293
|
type="primary"
|
|
@@ -296,12 +316,11 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
296
316
|
onCancel={cancelFetch}
|
|
297
317
|
loading={fetchingConfirmationQuote}
|
|
298
318
|
onCheckBalance={onConfirmSwap}
|
|
299
|
-
config={config}
|
|
300
319
|
/>
|
|
301
320
|
)}
|
|
302
321
|
|
|
303
322
|
<Container>
|
|
304
|
-
<div className=
|
|
323
|
+
<div className={descriptionStyles()}>
|
|
305
324
|
<Typography variant="title" size="small">
|
|
306
325
|
{i18n.t('You get')}
|
|
307
326
|
</Typography>
|
|
@@ -310,7 +329,7 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
310
329
|
variant="ghost"
|
|
311
330
|
disabled={fetchingConfirmationQuote}
|
|
312
331
|
onClick={onRefresh}>
|
|
313
|
-
<div className=
|
|
332
|
+
<div className={iconStyles()}>
|
|
314
333
|
<RefreshIcon size={16} />
|
|
315
334
|
</div>
|
|
316
335
|
</Button>
|
|
@@ -322,7 +341,7 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
322
341
|
</>
|
|
323
342
|
)}
|
|
324
343
|
{confirmSwapResult.warnings?.quoteUpdate && (
|
|
325
|
-
|
|
344
|
+
<div className="quote-update__alert">
|
|
326
345
|
<Alert
|
|
327
346
|
variant="alarm"
|
|
328
347
|
type="warning"
|
|
@@ -333,13 +352,13 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
333
352
|
)
|
|
334
353
|
}
|
|
335
354
|
/>
|
|
336
|
-
|
|
337
|
-
</>
|
|
355
|
+
</div>
|
|
338
356
|
)}
|
|
339
357
|
<QuoteInfo
|
|
340
358
|
quote={quote}
|
|
341
359
|
type="swap-preview"
|
|
342
360
|
expanded={true}
|
|
361
|
+
alertPosition="top"
|
|
343
362
|
error={confirmSwapResult.error}
|
|
344
363
|
loading={fetchingConfirmationQuote}
|
|
345
364
|
warning={confirmSwapResult.warnings?.quote ?? null}
|
|
@@ -351,6 +370,7 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
351
370
|
setShowQuoteWarningModal(false);
|
|
352
371
|
await addNewSwap();
|
|
353
372
|
}}
|
|
373
|
+
onChangeSettings={() => navigate('../' + navigationRoutes.settings)}
|
|
354
374
|
/>
|
|
355
375
|
</Container>
|
|
356
376
|
</Layout>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { PendingSwap } from '
|
|
2
|
-
import type { PendingSwapStep } from 'rango-types';
|
|
1
|
+
import type { PendingSwap, PendingSwapStep } from 'rango-types';
|
|
3
2
|
|
|
4
3
|
import { i18n } from '@lingui/core';
|
|
5
4
|
import { useManager } from '@rango-dev/queue-manager-react';
|
|
@@ -11,8 +10,6 @@ import { Layout } from '../components/Layout';
|
|
|
11
10
|
import { SearchInput } from '../components/SearchInput';
|
|
12
11
|
import { SwapsGroup } from '../components/SwapsGroup';
|
|
13
12
|
import { NotFoundContainer } from '../components/SwapsGroup/SwapsGroup.styles';
|
|
14
|
-
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
15
|
-
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
16
13
|
import { useUiStore } from '../store/ui';
|
|
17
14
|
import { groupSwapsByDate } from '../utils/date';
|
|
18
15
|
import { containsText } from '../utils/numbers';
|
|
@@ -51,7 +48,6 @@ const isStepContainsText = (steps: PendingSwapStep[], value: string) => {
|
|
|
51
48
|
export function HistoryPage() {
|
|
52
49
|
const setSelectedSwap = useUiStore.use.setSelectedSwap();
|
|
53
50
|
const navigate = useNavigate();
|
|
54
|
-
const { navigateBackFrom } = useNavigateBack();
|
|
55
51
|
const { manager, state } = useManager();
|
|
56
52
|
const list: PendingSwap[] = getPendingSwaps(manager).map(({ swap }) => swap);
|
|
57
53
|
const [searchedFor, setSearchedFor] = useState<string>('');
|
|
@@ -78,7 +74,6 @@ export function HistoryPage() {
|
|
|
78
74
|
return (
|
|
79
75
|
<Layout
|
|
80
76
|
header={{
|
|
81
|
-
onBack: () => navigateBackFrom(navigationRoutes.swaps),
|
|
82
77
|
title: i18n.t('History'),
|
|
83
78
|
}}>
|
|
84
79
|
<Container>
|
|
@@ -108,7 +103,7 @@ export function HistoryPage() {
|
|
|
108
103
|
list={filteredList}
|
|
109
104
|
onSwapClick={(requestId) => {
|
|
110
105
|
setSelectedSwap(requestId);
|
|
111
|
-
navigate(
|
|
106
|
+
navigate(requestId);
|
|
112
107
|
}}
|
|
113
108
|
groupBy={groupSwapsByDate}
|
|
114
109
|
isLoading={loading}
|
package/src/pages/Home.tsx
CHANGED
|
@@ -9,8 +9,6 @@ import { SwitchFromAndToButton } from '../components/SwitchFromAndTo';
|
|
|
9
9
|
import { errorMessages } from '../constants/errors';
|
|
10
10
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
11
11
|
import {
|
|
12
|
-
BALANCE_MAX_DECIMALS,
|
|
13
|
-
BALANCE_MIN_DECIMALS,
|
|
14
12
|
PERCENTAGE_CHANGE_MAX_DECIMALS,
|
|
15
13
|
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
16
14
|
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
@@ -20,27 +18,22 @@ import {
|
|
|
20
18
|
} from '../constants/routing';
|
|
21
19
|
import { QuoteInfo } from '../containers/QuoteInfo';
|
|
22
20
|
import { useSwapInput } from '../hooks/useSwapInput';
|
|
23
|
-
import {
|
|
21
|
+
import { useAppStore } from '../store/AppStore';
|
|
24
22
|
import { useQuoteStore } from '../store/quote';
|
|
25
23
|
import { useUiStore } from '../store/ui';
|
|
26
24
|
import { useWalletsStore } from '../store/wallets';
|
|
27
|
-
import { ButtonState } from '../types';
|
|
28
25
|
import { numberToString } from '../utils/numbers';
|
|
29
26
|
import { getPriceImpact, getPriceImpactLevel } from '../utils/quote';
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
getOutputRatio,
|
|
33
|
-
getPercentageChange,
|
|
34
|
-
getSwapButtonState,
|
|
35
|
-
hasHighValueLoss,
|
|
36
|
-
hasLimitError,
|
|
37
|
-
} from '../utils/swap';
|
|
38
|
-
import { getBalanceFromWallet } from '../utils/wallets';
|
|
27
|
+
import { canComputePriceImpact, getSwapButtonState } from '../utils/swap';
|
|
28
|
+
import { formatBalance } from '../utils/wallets';
|
|
39
29
|
|
|
40
30
|
const Container = styled('div', {
|
|
41
31
|
display: 'flex',
|
|
42
32
|
flexDirection: 'column',
|
|
43
33
|
overflowY: 'visible',
|
|
34
|
+
'& .quote__container': {
|
|
35
|
+
paddingTop: '$2',
|
|
36
|
+
},
|
|
44
37
|
});
|
|
45
38
|
|
|
46
39
|
const FromContainer = styled('div', {
|
|
@@ -76,18 +69,15 @@ export function Home() {
|
|
|
76
69
|
setQuoteWarningsConfirmed,
|
|
77
70
|
} = useQuoteStore();
|
|
78
71
|
|
|
79
|
-
const
|
|
72
|
+
const fetchMetaStatus = useAppStore().fetchStatus;
|
|
80
73
|
|
|
81
|
-
const connectedWallets = useWalletsStore
|
|
74
|
+
const { connectedWallets, getBalanceFor } = useWalletsStore();
|
|
82
75
|
const setCurrentPage = useUiStore.use.setCurrentPage();
|
|
83
76
|
const [showQuoteWarningModal, setShowQuoteWarningModal] = useState(false);
|
|
84
77
|
const layoutRef = useRef<HTMLDivElement>(null);
|
|
85
78
|
|
|
86
79
|
const needsToWarnEthOnPath = false;
|
|
87
80
|
|
|
88
|
-
const outToInRatio = getOutputRatio(inputUsdValue, outputUsdValue);
|
|
89
|
-
const highValueLoss = hasHighValueLoss(inputUsdValue, outToInRatio);
|
|
90
|
-
|
|
91
81
|
const priceImpactInputCanNotBeComputed = !canComputePriceImpact(
|
|
92
82
|
quote,
|
|
93
83
|
inputAmount,
|
|
@@ -99,48 +89,26 @@ export function Home() {
|
|
|
99
89
|
inputAmount,
|
|
100
90
|
outputUsdValue
|
|
101
91
|
);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
92
|
+
|
|
93
|
+
const swapButtonState = getSwapButtonState({
|
|
94
|
+
fetchMetaStatus,
|
|
105
95
|
fetchingQuote,
|
|
96
|
+
inputAmount,
|
|
106
97
|
quote,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
98
|
+
anyWalletConnected: connectedWallets.length > 0,
|
|
99
|
+
error: quoteError,
|
|
100
|
+
warning: quoteWarning,
|
|
110
101
|
needsToWarnEthOnPath,
|
|
111
|
-
|
|
112
|
-
);
|
|
102
|
+
});
|
|
113
103
|
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
connectedWallets,
|
|
119
|
-
fromBlockchain?.name,
|
|
120
|
-
fromToken?.symbol,
|
|
121
|
-
fromToken?.address
|
|
122
|
-
)?.amount || '0',
|
|
123
|
-
BALANCE_MIN_DECIMALS,
|
|
124
|
-
BALANCE_MAX_DECIMALS
|
|
125
|
-
)
|
|
126
|
-
: '0';
|
|
104
|
+
const fromTokenBalance = fromToken ? getBalanceFor(fromToken) : null;
|
|
105
|
+
|
|
106
|
+
const fromTokenFormattedBalance =
|
|
107
|
+
formatBalance(fromTokenBalance)?.amount ?? '0';
|
|
127
108
|
|
|
128
109
|
const tokenBalanceReal =
|
|
129
110
|
!!fromBlockchain && !!fromToken
|
|
130
|
-
? numberToString(
|
|
131
|
-
getBalanceFromWallet(
|
|
132
|
-
connectedWallets,
|
|
133
|
-
fromBlockchain?.name,
|
|
134
|
-
fromToken?.symbol,
|
|
135
|
-
fromToken?.address
|
|
136
|
-
)?.amount || '0',
|
|
137
|
-
getBalanceFromWallet(
|
|
138
|
-
connectedWallets,
|
|
139
|
-
fromBlockchain?.name,
|
|
140
|
-
fromToken?.symbol,
|
|
141
|
-
fromToken?.address
|
|
142
|
-
)?.decimal
|
|
143
|
-
)
|
|
111
|
+
? numberToString(fromTokenBalance?.amount, fromTokenBalance?.decimals)
|
|
144
112
|
: '0';
|
|
145
113
|
|
|
146
114
|
useEffect(() => {
|
|
@@ -152,10 +120,8 @@ export function Home() {
|
|
|
152
120
|
const percentageChange =
|
|
153
121
|
!inputUsdValue || !outputUsdValue || !outputUsdValue.gt(0)
|
|
154
122
|
? null
|
|
155
|
-
:
|
|
156
|
-
|
|
157
|
-
outputUsdValue.toString()
|
|
158
|
-
);
|
|
123
|
+
: getPriceImpact(inputUsdValue.toString(), outputUsdValue.toString());
|
|
124
|
+
|
|
159
125
|
return (
|
|
160
126
|
<Layout
|
|
161
127
|
ref={layoutRef}
|
|
@@ -167,14 +133,13 @@ export function Home() {
|
|
|
167
133
|
size="large"
|
|
168
134
|
disabled={swapButtonState.disabled}
|
|
169
135
|
prefix={
|
|
170
|
-
|
|
171
|
-
swapButtonState.hasWarning && <WarningIcon />
|
|
136
|
+
swapButtonState.action === 'confirm-warning' && <WarningIcon />
|
|
172
137
|
}
|
|
173
138
|
fullWidth
|
|
174
139
|
onClick={() => {
|
|
175
|
-
if (swapButtonState.
|
|
140
|
+
if (swapButtonState.action === 'connect-wallet') {
|
|
176
141
|
navigate(navigationRoutes.wallets);
|
|
177
|
-
} else if (
|
|
142
|
+
} else if (swapButtonState.action === 'confirm-warning') {
|
|
178
143
|
setShowQuoteWarningModal(true);
|
|
179
144
|
} else {
|
|
180
145
|
navigate(navigationRoutes.confirmSwap);
|
|
@@ -184,7 +149,10 @@ export function Home() {
|
|
|
184
149
|
</Button>
|
|
185
150
|
}
|
|
186
151
|
header={{
|
|
187
|
-
|
|
152
|
+
onWallet: () => {
|
|
153
|
+
navigate(navigationRoutes.wallets);
|
|
154
|
+
},
|
|
155
|
+
hasBackButton: false,
|
|
188
156
|
title: i18n.t('Swap'),
|
|
189
157
|
suffix: (
|
|
190
158
|
<HomeButtons
|
|
@@ -200,11 +168,9 @@ export function Home() {
|
|
|
200
168
|
<FromContainer>
|
|
201
169
|
<SwapInput
|
|
202
170
|
label={i18n.t('From')}
|
|
203
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
204
|
-
//@ts-ignore
|
|
205
171
|
mode="From"
|
|
206
172
|
onInputChange={setInputAmount}
|
|
207
|
-
balance={
|
|
173
|
+
balance={fromTokenFormattedBalance}
|
|
208
174
|
chain={{
|
|
209
175
|
displayName: fromBlockchain?.displayName || '',
|
|
210
176
|
image: fromBlockchain?.logo || '',
|
|
@@ -213,7 +179,7 @@ export function Home() {
|
|
|
213
179
|
displayName: fromToken?.symbol || '',
|
|
214
180
|
image: fromToken?.image || '',
|
|
215
181
|
}}
|
|
216
|
-
onClickToken={() => navigate(
|
|
182
|
+
onClickToken={() => navigate(navigationRoutes.fromSwap)}
|
|
217
183
|
price={{
|
|
218
184
|
value: inputAmount,
|
|
219
185
|
usdValue: priceImpactInputCanNotBeComputed
|
|
@@ -227,10 +193,10 @@ export function Home() {
|
|
|
227
193
|
? errorMessages().unknownPriceError.impactTitle
|
|
228
194
|
: undefined,
|
|
229
195
|
}}
|
|
230
|
-
disabled={
|
|
231
|
-
loading={
|
|
196
|
+
disabled={fetchMetaStatus === 'failed'}
|
|
197
|
+
loading={fetchMetaStatus === 'loading'}
|
|
232
198
|
onSelectMaxBalance={() => {
|
|
233
|
-
if (
|
|
199
|
+
if (fromTokenFormattedBalance !== '0') {
|
|
234
200
|
setInputAmount(tokenBalanceReal.split(',').join(''));
|
|
235
201
|
}
|
|
236
202
|
}}
|
|
@@ -241,6 +207,7 @@ export function Home() {
|
|
|
241
207
|
sharpBottomStyle={!!quote?.result || fetchingQuote}
|
|
242
208
|
label={i18n.t('To')}
|
|
243
209
|
mode="To"
|
|
210
|
+
fetchingQuote={fetchingQuote}
|
|
244
211
|
chain={{
|
|
245
212
|
displayName: toBlockchain?.displayName || '',
|
|
246
213
|
image: toBlockchain?.logo || '',
|
|
@@ -272,27 +239,30 @@ export function Home() {
|
|
|
272
239
|
? errorMessages().unknownPriceError.impactTitle
|
|
273
240
|
: undefined,
|
|
274
241
|
}}
|
|
275
|
-
onClickToken={() => navigate(
|
|
276
|
-
disabled={
|
|
277
|
-
loading={
|
|
242
|
+
onClickToken={() => navigate(navigationRoutes.toSwap)}
|
|
243
|
+
disabled={fetchMetaStatus === 'failed'}
|
|
244
|
+
loading={fetchMetaStatus === 'loading'}
|
|
278
245
|
/>
|
|
279
246
|
</InputsContainer>
|
|
280
|
-
<
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
247
|
+
<div className="quote__container">
|
|
248
|
+
<QuoteInfo
|
|
249
|
+
quote={quote}
|
|
250
|
+
loading={fetchingQuote}
|
|
251
|
+
error={quoteError}
|
|
252
|
+
warning={quoteWarning}
|
|
253
|
+
type="basic"
|
|
254
|
+
refetchQuote={fetchQuote}
|
|
255
|
+
showWarningModal={showQuoteWarningModal}
|
|
256
|
+
onOpenWarningModal={() => setShowQuoteWarningModal(true)}
|
|
257
|
+
onCloseWarningModal={() => setShowQuoteWarningModal(false)}
|
|
258
|
+
onConfirmWarningModal={() => {
|
|
259
|
+
setShowQuoteWarningModal(false);
|
|
260
|
+
setQuoteWarningsConfirmed(true);
|
|
261
|
+
navigate(navigationRoutes.confirmSwap);
|
|
262
|
+
}}
|
|
263
|
+
onChangeSettings={() => navigate(navigationRoutes.settings)}
|
|
264
|
+
/>
|
|
265
|
+
</div>
|
|
296
266
|
</Container>
|
|
297
267
|
</Layout>
|
|
298
268
|
);
|
|
@@ -10,13 +10,9 @@ import React from 'react';
|
|
|
10
10
|
|
|
11
11
|
import { Layout } from '../components/Layout';
|
|
12
12
|
import { SettingsContainer } from '../components/SettingsContainer';
|
|
13
|
-
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
14
13
|
import { useLanguage } from '../hooks/useLanguage';
|
|
15
|
-
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
16
14
|
|
|
17
15
|
export function LanguagePage() {
|
|
18
|
-
const { navigateBackFrom } = useNavigateBack();
|
|
19
|
-
|
|
20
16
|
const { activeLanguage, changeLanguage, languages } = useLanguage();
|
|
21
17
|
|
|
22
18
|
const languageList = languages.map((languageItem) => {
|
|
@@ -38,7 +34,6 @@ export function LanguagePage() {
|
|
|
38
34
|
return (
|
|
39
35
|
<Layout
|
|
40
36
|
header={{
|
|
41
|
-
onBack: () => navigateBackFrom(navigationRoutes.settings),
|
|
42
37
|
title: i18n.t('Language'),
|
|
43
38
|
}}>
|
|
44
39
|
<SettingsContainer>
|
|
@@ -23,32 +23,22 @@ import {
|
|
|
23
23
|
NotFoundContainer,
|
|
24
24
|
SettingsContainer,
|
|
25
25
|
} from '../components/SettingsContainer';
|
|
26
|
-
import {
|
|
27
|
-
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
28
|
-
import { useMetaStore } from '../store/meta';
|
|
29
|
-
import { useSettingsStore } from '../store/settings';
|
|
26
|
+
import { useAppStore } from '../store/AppStore';
|
|
30
27
|
import { containsText } from '../utils/numbers';
|
|
31
|
-
import {
|
|
32
|
-
getUniqueSwappersGroups,
|
|
33
|
-
sortLiquiditySourcesByGroupTitle,
|
|
34
|
-
} from '../utils/settings';
|
|
28
|
+
import { getUniqueSwappersGroups } from '../utils/settings';
|
|
35
29
|
|
|
36
30
|
interface PropTypes {
|
|
37
|
-
supportedSwappers?: string[];
|
|
38
31
|
sourceType: 'Exchanges' | 'Bridges';
|
|
39
32
|
}
|
|
40
33
|
|
|
41
|
-
export function LiquiditySourcePage({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
export function LiquiditySourcePage({ sourceType }: PropTypes) {
|
|
35
|
+
const fetchStatus = useAppStore().fetchStatus;
|
|
36
|
+
const swappers = useAppStore().swappers();
|
|
37
|
+
const disabledLiquiditySources = useAppStore().disabledLiquiditySources;
|
|
45
38
|
const [searchedFor, setSearchedFor] = useState<string>('');
|
|
46
|
-
const toggleLiquiditySource =
|
|
47
|
-
const { navigateBackFrom } = useNavigateBack();
|
|
48
|
-
const loadingMetaStatus = useMetaStore.use.loadingStatus();
|
|
49
|
-
|
|
39
|
+
const toggleLiquiditySource = useAppStore().toggleLiquiditySource;
|
|
50
40
|
const supportedUniqueSwappersGroups: Array<UniqueSwappersGroupType> =
|
|
51
|
-
getUniqueSwappersGroups(
|
|
41
|
+
getUniqueSwappersGroups(swappers, disabledLiquiditySources);
|
|
52
42
|
|
|
53
43
|
const validTypes: Array<LiquiditySourceType> = [];
|
|
54
44
|
if (sourceType === 'Exchanges') {
|
|
@@ -79,22 +69,20 @@ export function LiquiditySourcePage({
|
|
|
79
69
|
});
|
|
80
70
|
};
|
|
81
71
|
|
|
82
|
-
const list = liquiditySources
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
};
|
|
97
|
-
});
|
|
72
|
+
const list = liquiditySources.map((sourceItem) => {
|
|
73
|
+
const { selected, groupTitle, logo } = sourceItem;
|
|
74
|
+
return {
|
|
75
|
+
start: <Image src={logo} size={22} type="circular" />,
|
|
76
|
+
onClick: () => toggleLiquiditySource(groupTitle),
|
|
77
|
+
end: <Checkbox checked={selected} />,
|
|
78
|
+
title: (
|
|
79
|
+
<Typography variant="title" size="xmedium">
|
|
80
|
+
{i18n.t(groupTitle)}
|
|
81
|
+
</Typography>
|
|
82
|
+
),
|
|
83
|
+
...sourceItem,
|
|
84
|
+
};
|
|
85
|
+
});
|
|
98
86
|
|
|
99
87
|
const searchHandler = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
100
88
|
const value = event.target.value;
|
|
@@ -111,7 +99,6 @@ export function LiquiditySourcePage({
|
|
|
111
99
|
return (
|
|
112
100
|
<Layout
|
|
113
101
|
header={{
|
|
114
|
-
onBack: () => navigateBackFrom(navigationRoutes.settings),
|
|
115
102
|
title: i18n.t(sourceType),
|
|
116
103
|
suffix: (
|
|
117
104
|
<LiquiditySourceSuffix>
|
|
@@ -131,7 +118,7 @@ export function LiquiditySourcePage({
|
|
|
131
118
|
placeholder={i18n.t('Search {sourceType}', { sourceType })}
|
|
132
119
|
onChange={searchHandler}
|
|
133
120
|
/>
|
|
134
|
-
{
|
|
121
|
+
{fetchStatus === 'loading' && <LoadingLiquiditySourceList />}
|
|
135
122
|
|
|
136
123
|
{!filteredList.length && !!searchedFor ? (
|
|
137
124
|
<NotFoundContainer>
|
|
@@ -141,7 +128,7 @@ export function LiquiditySourcePage({
|
|
|
141
128
|
/>
|
|
142
129
|
</NotFoundContainer>
|
|
143
130
|
) : (
|
|
144
|
-
|
|
131
|
+
fetchStatus === 'success' && (
|
|
145
132
|
<LiquiditySourceList>
|
|
146
133
|
{filteredList.map((sourceItem) => {
|
|
147
134
|
return (
|