@rango-dev/widget-embedded 0.17.1-next.2 → 0.17.1-next.21
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.helpers.d.ts +1 -3
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +1 -3
- 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/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/NoResult/NoResult.d.ts +4 -0
- package/dist/components/NoResult/NoResult.d.ts.map +1 -0
- package/dist/components/NoResult/NoResult.helpers.d.ts +4 -0
- package/dist/components/NoResult/NoResult.helpers.d.ts.map +1 -0
- package/dist/components/{NoRoutes/NoRoutes.styles.d.ts → NoResult/NoResult.styles.d.ts} +1 -1
- package/dist/components/{NoRoutes/NoRoutes.styles.d.ts.map → NoResult/NoResult.styles.d.ts.map} +1 -1
- package/dist/components/{NoRoutes/NoRoutes.types.d.ts → NoResult/NoResult.types.d.ts} +3 -3
- package/dist/components/NoResult/NoResult.types.d.ts.map +1 -0
- package/dist/components/NoResult/index.d.ts +2 -0
- package/dist/components/NoResult/index.d.ts.map +1 -0
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts +4 -0
- package/dist/components/Quote/Quote.d.ts.map +1 -0
- package/dist/components/Quote/Quote.styles.d.ts +1588 -0
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -0
- package/dist/components/Quote/Quote.types.d.ts +21 -0
- package/dist/components/Quote/Quote.types.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSkeleton.d.ts +4 -0
- package/dist/components/Quote/QuoteSkeleton.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSkeleton.styles.d.ts +319 -0
- package/dist/components/Quote/QuoteSkeleton.styles.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSkeleton.types.d.ts +6 -0
- package/dist/components/Quote/QuoteSkeleton.types.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSummary.d.ts +11 -0
- package/dist/components/Quote/QuoteSummary.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts +158 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -0
- package/dist/components/Quote/index.d.ts +4 -0
- package/dist/components/Quote/index.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts +11 -0
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts +4 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts +4 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts +9 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -0
- package/dist/components/{RouteErrors/RouteErrors.styles.d.ts → QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts} +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +23 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +11 -0
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +11 -0
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/index.d.ts +2 -0
- package/dist/components/QuoteWarningsAndErrors/index.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
- 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.styles.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 +4 -4
- 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/messages.d.ts +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/constants/warnings.d.ts +2 -2
- package/dist/constants/warnings.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 +4 -0
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -0
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +788 -0
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -0
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +20 -0
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -0
- package/dist/containers/QuoteInfo/index.d.ts +2 -0
- package/dist/containers/QuoteInfo/index.d.ts.map +1 -0
- 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.types.d.ts +14 -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/index.d.ts +2 -0
- package/dist/hooks/useConfirmSwap/index.d.ts.map +1 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts +3 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +19 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -0
- package/dist/hooks/{useConfirmSwap.d.ts → useConfirmSwap/useConfirmSwap.types.d.ts} +5 -7
- package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +1 -0
- package/dist/hooks/{useFetchBestRoute.d.ts → useFetchQuote.d.ts} +3 -3
- package/dist/hooks/useFetchQuote.d.ts.map +1 -0
- 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 +5 -7
- 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 +4 -2
- 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/useWalletList.d.ts.map +1 -1
- package/dist/index.d.ts +13 -5
- 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 +11 -0
- package/dist/store/AppStore.d.ts.map +1 -0
- package/dist/store/app.d.ts +5 -23
- package/dist/store/app.d.ts.map +1 -1
- package/dist/store/{bestRoute.d.ts → quote.d.ts} +39 -27
- package/dist/store/quote.d.ts.map +1 -0
- package/dist/store/settings.d.ts +3 -2
- package/dist/store/settings.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/wallets.d.ts +5 -4
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +19 -5
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/quote.d.ts +82 -0
- package/dist/types/quote.d.ts.map +1 -0
- package/dist/types/swap.d.ts +3 -13
- package/dist/types/swap.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/numbers.d.ts +1 -1
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/{routing.d.ts → quote.d.ts} +16 -12
- package/dist/utils/quote.d.ts.map +1 -0
- package/dist/utils/settings.d.ts +3 -2
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +34 -23
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +2 -2
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +6 -6
- 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.tsx +4 -4
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +7 -7
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +2 -64
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +39 -45
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +1 -3
- package/src/components/ConfirmWalletsModal/WalletList.tsx +6 -5
- package/src/components/ConfirmWalletsModal/WalletList.type.ts +1 -4
- package/src/components/Layout/Layout.tsx +10 -7
- package/src/components/Layout/Layout.types.ts +2 -2
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +3 -3
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +6 -6
- package/src/components/{NoRoutes/NoRoutes.helper.ts → NoResult/NoResult.helpers.ts} +23 -16
- package/src/components/{NoRoutes/NoRoutes.styles.ts → NoResult/NoResult.styles.ts} +2 -0
- package/src/components/{NoRoutes/NoRoutes.tsx → NoResult/NoResult.tsx} +10 -12
- package/src/components/{NoRoutes/NoRoutes.types.ts → NoResult/NoResult.types.ts} +3 -2
- package/src/components/NoResult/index.ts +1 -0
- package/src/components/NotificationContent/NotificationContent.tsx +5 -3
- package/src/components/Quote/Quote.styles.ts +239 -0
- package/src/components/Quote/Quote.tsx +413 -0
- package/src/components/Quote/Quote.types.ts +15 -0
- package/src/components/Quote/QuoteSkeleton.styles.ts +110 -0
- package/src/components/Quote/QuoteSkeleton.tsx +108 -0
- package/src/components/Quote/QuoteSkeleton.types.ts +5 -0
- package/src/components/Quote/QuoteSummary.styles.ts +15 -0
- package/src/components/Quote/QuoteSummary.tsx +46 -0
- package/src/components/Quote/index.ts +3 -0
- package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +107 -0
- package/src/components/{RouteErrors/RouteErrorsModalItem.tsx → QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx} +4 -4
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +74 -0
- package/src/components/{RouteErrors/RouteErrors.styles.ts → QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts} +8 -1
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +103 -0
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +25 -0
- package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +77 -0
- package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +38 -0
- package/src/components/QuoteWarningsAndErrors/index.ts +1 -0
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +0 -4
- package/src/components/SwapDetails/SwapDetails.tsx +17 -24
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +4 -3
- package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +2 -2
- package/src/components/SwapsGroup/SwapsGroup.styles.ts +8 -1
- package/src/components/SwapsGroup/SwapsGroup.tsx +0 -2
- package/src/components/SwitchFromAndTo.tsx +2 -2
- package/src/components/TokenList/TokenList.styles.ts +14 -2
- package/src/components/TokenList/TokenList.tsx +6 -7
- package/src/components/UpdateUrl.tsx +36 -29
- package/src/components/WidgetEvents.tsx +4 -2
- package/src/constants/errors.ts +17 -15
- package/src/constants/index.ts +1 -0
- package/src/constants/messages.ts +1 -1
- package/src/constants/navigationRoutes.ts +7 -8
- package/src/constants/searchParams.ts +1 -0
- package/src/constants/warnings.ts +7 -7
- package/src/containers/App/App.styles.ts +18 -0
- package/src/containers/App/App.tsx +55 -0
- package/src/containers/App/index.ts +1 -0
- package/src/containers/QuoteInfo/QuoteInfo.styles.ts +31 -0
- package/src/containers/QuoteInfo/QuoteInfo.tsx +98 -0
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +20 -0
- package/src/containers/QuoteInfo/index.ts +1 -0
- package/src/{Wallets.tsx → containers/Wallets/Wallets.tsx} +40 -32
- 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.tsx +47 -0
- package/src/containers/WidgetInfo/WidgetInfo.types.ts +14 -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/index.ts +1 -0
- package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +172 -0
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +137 -0
- package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +19 -0
- package/src/hooks/{useFetchBestRoute.ts → useFetchQuote.ts} +3 -3
- package/src/hooks/useForceAutoConnect.ts +27 -0
- package/src/hooks/useLanguage.ts +2 -2
- 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 +13 -4
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.ts +6 -1
- package/src/hooks/useSwapInput.ts +139 -46
- package/src/hooks/useSyncStoresWithConfig.ts +22 -19
- package/src/hooks/useWalletList.ts +3 -5
- package/src/index.ts +14 -3
- package/src/pages/ConfirmSwapPage.tsx +95 -248
- package/src/pages/HistoryPage.tsx +1 -5
- package/src/pages/Home.tsx +75 -270
- package/src/pages/LanguagePage.tsx +0 -5
- package/src/pages/LiquiditySourcePage.tsx +22 -35
- package/src/pages/SelectBlockchainPage.tsx +31 -24
- package/src/pages/SelectSwapItemsPage.tsx +9 -23
- package/src/pages/SettingsPage.tsx +8 -15
- package/src/pages/SwapDetailsPage.tsx +6 -7
- package/src/pages/ThemePage.tsx +0 -4
- package/src/pages/WalletsPage.tsx +4 -15
- package/src/services/httpService.ts +1 -1
- package/src/store/AppStore.tsx +35 -0
- package/src/store/app.ts +18 -6
- package/src/store/{bestRoute.ts → quote.ts} +68 -60
- package/src/store/settings.ts +7 -4
- package/src/store/slices/config.ts +25 -15
- package/src/store/slices/data.ts +64 -29
- package/src/store/wallets.ts +12 -8
- package/src/types/config.ts +20 -5
- package/src/types/index.ts +1 -1
- package/src/types/quote.ts +107 -0
- package/src/types/swap.ts +3 -12
- package/src/utils/colors.ts +2 -1
- package/src/utils/configs.ts +2 -1
- package/src/utils/meta.ts +8 -1
- package/src/utils/numbers.ts +1 -1
- package/src/utils/quote.ts +338 -0
- package/src/utils/settings.ts +8 -7
- package/src/utils/swap.ts +153 -116
- package/src/utils/wallets.ts +29 -17
- 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/components/NoRoutes/NoRoutes.d.ts +0 -4
- package/dist/components/NoRoutes/NoRoutes.d.ts.map +0 -1
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts +0 -3
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +0 -1
- package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +0 -1
- package/dist/components/NoRoutes/index.d.ts +0 -2
- package/dist/components/NoRoutes/index.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrors.d.ts +0 -4
- package/dist/components/RouteErrors/RouteErrors.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrors.types.d.ts +0 -24
- package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts +0 -4
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +0 -4
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +0 -1
- package/dist/components/RouteErrors/index.d.ts +0 -2
- package/dist/components/RouteErrors/index.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap.d.ts.map +0 -1
- package/dist/hooks/useFetchBestRoute.d.ts.map +0 -1
- package/dist/store/bestRoute.d.ts.map +0 -1
- package/dist/store/meta.d.ts +0 -23
- package/dist/store/meta.d.ts.map +0 -1
- package/dist/types/routing.d.ts +0 -65
- package/dist/types/routing.d.ts.map +0 -1
- package/dist/utils/routing.d.ts.map +0 -1
- package/src/Widget.tsx +0 -119
- package/src/components/NoRoutes/index.ts +0 -1
- package/src/components/RouteErrors/RouteErrors.tsx +0 -79
- package/src/components/RouteErrors/RouteErrors.types.ts +0 -29
- package/src/components/RouteErrors/RouteErrorsModal.tsx +0 -129
- package/src/components/RouteErrors/index.ts +0 -1
- package/src/hooks/useConfirmSwap.ts +0 -303
- package/src/store/meta.ts +0 -39
- package/src/types/routing.ts +0 -77
- package/src/utils/routing.ts +0 -321
package/src/pages/Home.tsx
CHANGED
|
@@ -1,32 +1,16 @@
|
|
|
1
|
-
import type { SwapResult } from 'rango-sdk';
|
|
2
|
-
|
|
3
1
|
import { i18n } from '@lingui/core';
|
|
4
|
-
import {
|
|
5
|
-
Alert,
|
|
6
|
-
BestRoute,
|
|
7
|
-
BestRouteSkeleton,
|
|
8
|
-
Button,
|
|
9
|
-
Divider,
|
|
10
|
-
styled,
|
|
11
|
-
SwapInput,
|
|
12
|
-
Typography,
|
|
13
|
-
WarningIcon,
|
|
14
|
-
} from '@rango-dev/ui';
|
|
2
|
+
import { Button, styled, SwapInput, WarningIcon } from '@rango-dev/ui';
|
|
15
3
|
import React, { useEffect, useRef, useState } from 'react';
|
|
16
4
|
import { useNavigate } from 'react-router-dom';
|
|
17
5
|
|
|
18
6
|
import { HomeButtons } from '../components/HeaderButtons';
|
|
19
7
|
import { Layout } from '../components/Layout';
|
|
20
|
-
import { NoRoutes } from '../components/NoRoutes';
|
|
21
|
-
import { RouteErrors } from '../components/RouteErrors';
|
|
22
8
|
import { SwitchFromAndToButton } from '../components/SwitchFromAndTo';
|
|
23
9
|
import { errorMessages } from '../constants/errors';
|
|
24
10
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
25
11
|
import {
|
|
26
12
|
BALANCE_MAX_DECIMALS,
|
|
27
13
|
BALANCE_MIN_DECIMALS,
|
|
28
|
-
GAS_FEE_MAX_DECIMALS,
|
|
29
|
-
GAS_FEE_MIN_DECIMALS,
|
|
30
14
|
PERCENTAGE_CHANGE_MAX_DECIMALS,
|
|
31
15
|
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
32
16
|
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
@@ -34,36 +18,24 @@ import {
|
|
|
34
18
|
USD_VALUE_MAX_DECIMALS,
|
|
35
19
|
USD_VALUE_MIN_DECIMALS,
|
|
36
20
|
} from '../constants/routing';
|
|
21
|
+
import { QuoteInfo } from '../containers/QuoteInfo';
|
|
37
22
|
import { useSwapInput } from '../hooks/useSwapInput';
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
23
|
+
import { useAppStore } from '../store/AppStore';
|
|
24
|
+
import { useQuoteStore } from '../store/quote';
|
|
40
25
|
import { useUiStore } from '../store/ui';
|
|
41
26
|
import { useWalletsStore } from '../store/wallets';
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
numberToString,
|
|
47
|
-
secondsToString,
|
|
48
|
-
totalArrivalTime,
|
|
49
|
-
} from '../utils/numbers';
|
|
50
|
-
import { getFormattedBestRoute, getPriceImpactLevel } from '../utils/routing';
|
|
51
|
-
import {
|
|
52
|
-
canComputePriceImpact,
|
|
53
|
-
getOutputRatio,
|
|
54
|
-
getPercentageChange,
|
|
55
|
-
getSwapButtonState,
|
|
56
|
-
getTotalFeeInUsd,
|
|
57
|
-
hasLimitError,
|
|
58
|
-
LimitErrorMessage,
|
|
59
|
-
outputRatioHasWarning,
|
|
60
|
-
} from '../utils/swap';
|
|
27
|
+
import { numberToString } from '../utils/numbers';
|
|
28
|
+
import { getPriceImpact, getPriceImpactLevel } from '../utils/quote';
|
|
29
|
+
import { canComputePriceImpact, getSwapButtonState } from '../utils/swap';
|
|
61
30
|
import { getBalanceFromWallet } from '../utils/wallets';
|
|
62
31
|
|
|
63
32
|
const Container = styled('div', {
|
|
64
33
|
display: 'flex',
|
|
65
34
|
flexDirection: 'column',
|
|
66
35
|
overflowY: 'visible',
|
|
36
|
+
'& .quote__container': {
|
|
37
|
+
paddingTop: '$2',
|
|
38
|
+
},
|
|
67
39
|
});
|
|
68
40
|
|
|
69
41
|
const FromContainer = styled('div', {
|
|
@@ -76,27 +48,13 @@ const InputsContainer = styled('div', {
|
|
|
76
48
|
gap: 5,
|
|
77
49
|
alignSelf: 'stretch',
|
|
78
50
|
});
|
|
79
|
-
|
|
80
|
-
const BestRouteContainer = styled('div', {
|
|
81
|
-
width: '100%',
|
|
82
|
-
paddingTop: '$2',
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
const FooterStepAlarm = styled('div', {
|
|
86
|
-
paddingBottom: '$15',
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
const FooterAlert = styled('div', {
|
|
90
|
-
width: '100%',
|
|
91
|
-
display: 'flex',
|
|
92
|
-
});
|
|
93
|
-
|
|
94
51
|
export function Home() {
|
|
95
52
|
const navigate = useNavigate();
|
|
96
53
|
const {
|
|
97
|
-
fetch:
|
|
98
|
-
loading:
|
|
99
|
-
error:
|
|
54
|
+
fetch: fetchQuote,
|
|
55
|
+
loading: fetchingQuote,
|
|
56
|
+
error: quoteError,
|
|
57
|
+
warning: quoteWarning,
|
|
100
58
|
} = useSwapInput();
|
|
101
59
|
const {
|
|
102
60
|
fromToken,
|
|
@@ -108,56 +66,42 @@ export function Home() {
|
|
|
108
66
|
inputUsdValue,
|
|
109
67
|
outputAmount,
|
|
110
68
|
outputUsdValue,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
69
|
+
quote,
|
|
70
|
+
resetQuoteWallets,
|
|
71
|
+
setQuoteWarningsConfirmed,
|
|
72
|
+
} = useQuoteStore();
|
|
114
73
|
|
|
115
|
-
const
|
|
116
|
-
meta: { tokens, blockchains },
|
|
117
|
-
loadingStatus: loadingMetaStatus,
|
|
118
|
-
} = useMetaStore();
|
|
74
|
+
const fetchMetaStatus = useAppStore().fetchStatus;
|
|
119
75
|
|
|
120
76
|
const connectedWallets = useWalletsStore.use.connectedWallets();
|
|
121
77
|
const setCurrentPage = useUiStore.use.setCurrentPage();
|
|
122
|
-
const [
|
|
123
|
-
const {
|
|
124
|
-
fromAmountRangeError,
|
|
125
|
-
swap: swapHasError,
|
|
126
|
-
recommendation,
|
|
127
|
-
} = LimitErrorMessage(bestRoute);
|
|
78
|
+
const [showQuoteWarningModal, setShowQuoteWarningModal] = useState(false);
|
|
128
79
|
const layoutRef = useRef<HTMLDivElement>(null);
|
|
129
80
|
|
|
130
|
-
const showBestRoute =
|
|
131
|
-
!!Number(inputAmount) &&
|
|
132
|
-
(!!bestRoute || fetchingBestRoute || !!bestRouteError);
|
|
133
|
-
|
|
134
81
|
const needsToWarnEthOnPath = false;
|
|
135
82
|
|
|
136
|
-
const outToInRatio = getOutputRatio(inputUsdValue, outputUsdValue);
|
|
137
|
-
const highValueLoss = outputRatioHasWarning(inputUsdValue, outToInRatio);
|
|
138
|
-
|
|
139
83
|
const priceImpactInputCanNotBeComputed = !canComputePriceImpact(
|
|
140
|
-
|
|
84
|
+
quote,
|
|
141
85
|
inputAmount,
|
|
142
86
|
inputUsdValue
|
|
143
87
|
);
|
|
144
88
|
|
|
145
89
|
const priceImpactOutputCanNotBeComputed = !canComputePriceImpact(
|
|
146
|
-
|
|
90
|
+
quote,
|
|
147
91
|
inputAmount,
|
|
148
92
|
outputUsdValue
|
|
149
93
|
);
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
94
|
+
|
|
95
|
+
const swapButtonState = getSwapButtonState({
|
|
96
|
+
fetchMetaStatus,
|
|
97
|
+
fetchingQuote,
|
|
98
|
+
inputAmount,
|
|
99
|
+
quote,
|
|
100
|
+
anyWalletConnected: connectedWallets.length > 0,
|
|
101
|
+
error: quoteError,
|
|
102
|
+
warning: quoteWarning,
|
|
158
103
|
needsToWarnEthOnPath,
|
|
159
|
-
|
|
160
|
-
);
|
|
104
|
+
});
|
|
161
105
|
|
|
162
106
|
const tokenBalance =
|
|
163
107
|
!!fromBlockchain && !!fromToken
|
|
@@ -193,90 +137,14 @@ export function Home() {
|
|
|
193
137
|
|
|
194
138
|
useEffect(() => {
|
|
195
139
|
setCurrentPage(navigationRoutes.home);
|
|
196
|
-
|
|
140
|
+
resetQuoteWallets();
|
|
197
141
|
return setCurrentPage.bind(null, '');
|
|
198
142
|
}, []);
|
|
199
143
|
|
|
200
144
|
const percentageChange =
|
|
201
145
|
!inputUsdValue || !outputUsdValue || !outputUsdValue.gt(0)
|
|
202
146
|
? null
|
|
203
|
-
:
|
|
204
|
-
inputUsdValue.toNumber(),
|
|
205
|
-
outputUsdValue.toNumber()
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
const getBestRouteSteps = (swaps: SwapResult[]) => {
|
|
209
|
-
return swaps.map((swap, index) => ({
|
|
210
|
-
swapper: { displayName: swap.swapperId, image: swap.swapperLogo },
|
|
211
|
-
from: {
|
|
212
|
-
token: { displayName: swap.from.symbol, image: swap.from.logo },
|
|
213
|
-
chain: {
|
|
214
|
-
displayName:
|
|
215
|
-
getBlockchainShortNameFor(swap.from.blockchain, blockchains) ?? '',
|
|
216
|
-
image: swap.from.blockchainLogo,
|
|
217
|
-
},
|
|
218
|
-
price: {
|
|
219
|
-
value:
|
|
220
|
-
index === 0
|
|
221
|
-
? numberToString(
|
|
222
|
-
inputAmount,
|
|
223
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
224
|
-
TOKEN_AMOUNT_MAX_DECIMALS
|
|
225
|
-
)
|
|
226
|
-
: swap.fromAmount,
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
to: {
|
|
230
|
-
token: { displayName: swap.to.symbol, image: swap.to.logo },
|
|
231
|
-
chain: {
|
|
232
|
-
displayName:
|
|
233
|
-
getBlockchainShortNameFor(swap.to.blockchain, blockchains) ?? '',
|
|
234
|
-
image: swap.to.blockchainLogo,
|
|
235
|
-
},
|
|
236
|
-
price: {
|
|
237
|
-
value: swap.toAmount,
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
alerts:
|
|
241
|
-
swap.swapperId === swapHasError?.swapperId ? (
|
|
242
|
-
<FooterStepAlarm>
|
|
243
|
-
<Alert
|
|
244
|
-
type="error"
|
|
245
|
-
title={recommendation}
|
|
246
|
-
footer={
|
|
247
|
-
<FooterAlert>
|
|
248
|
-
<Typography size="xsmall" variant="body" color="neutral700">
|
|
249
|
-
{fromAmountRangeError}
|
|
250
|
-
</Typography>
|
|
251
|
-
<Divider direction="horizontal" size={8} />
|
|
252
|
-
<Typography size="xsmall" variant="body" color="neutral700">
|
|
253
|
-
|
|
|
254
|
-
</Typography>
|
|
255
|
-
<Divider direction="horizontal" size={8} />
|
|
256
|
-
<Typography size="xsmall" variant="body" color="neutral700">
|
|
257
|
-
{i18n.t({
|
|
258
|
-
id: 'Yours: {amount} {symbol}',
|
|
259
|
-
values: {
|
|
260
|
-
amount: numberToString(
|
|
261
|
-
swapHasError?.fromAmount || null,
|
|
262
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
263
|
-
TOKEN_AMOUNT_MAX_DECIMALS
|
|
264
|
-
),
|
|
265
|
-
symbol: swap?.from.symbol,
|
|
266
|
-
},
|
|
267
|
-
})}
|
|
268
|
-
</Typography>
|
|
269
|
-
</FooterAlert>
|
|
270
|
-
}
|
|
271
|
-
/>
|
|
272
|
-
</FooterStepAlarm>
|
|
273
|
-
) : undefined,
|
|
274
|
-
}));
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
const totalFeeInUsd = getTotalFeeInUsd(bestRoute, tokens);
|
|
278
|
-
|
|
279
|
-
const bestRouteData = getFormattedBestRoute(bestRoute);
|
|
147
|
+
: getPriceImpact(inputUsdValue.toString(), outputUsdValue.toString());
|
|
280
148
|
|
|
281
149
|
return (
|
|
282
150
|
<Layout
|
|
@@ -289,15 +157,14 @@ export function Home() {
|
|
|
289
157
|
size="large"
|
|
290
158
|
disabled={swapButtonState.disabled}
|
|
291
159
|
prefix={
|
|
292
|
-
|
|
293
|
-
swapButtonState.hasWarning && <WarningIcon />
|
|
160
|
+
swapButtonState.action === 'confirm-warning' && <WarningIcon />
|
|
294
161
|
}
|
|
295
162
|
fullWidth
|
|
296
163
|
onClick={() => {
|
|
297
|
-
if (swapButtonState.
|
|
164
|
+
if (swapButtonState.action === 'connect-wallet') {
|
|
298
165
|
navigate(navigationRoutes.wallets);
|
|
299
|
-
} else if (swapButtonState.
|
|
300
|
-
|
|
166
|
+
} else if (swapButtonState.action === 'confirm-warning') {
|
|
167
|
+
setShowQuoteWarningModal(true);
|
|
301
168
|
} else {
|
|
302
169
|
navigate(navigationRoutes.confirmSwap);
|
|
303
170
|
}
|
|
@@ -306,14 +173,15 @@ export function Home() {
|
|
|
306
173
|
</Button>
|
|
307
174
|
}
|
|
308
175
|
header={{
|
|
309
|
-
|
|
176
|
+
onWallet: () => {
|
|
177
|
+
navigate(navigationRoutes.wallets);
|
|
178
|
+
},
|
|
179
|
+
hasBackButton: false,
|
|
310
180
|
title: i18n.t('Swap'),
|
|
311
181
|
suffix: (
|
|
312
182
|
<HomeButtons
|
|
313
183
|
layoutRef={layoutRef.current}
|
|
314
|
-
onClickRefresh={
|
|
315
|
-
!!bestRoute || bestRouteError ? refetchBestRoute : undefined
|
|
316
|
-
}
|
|
184
|
+
onClickRefresh={!!quote || quoteError ? fetchQuote : undefined}
|
|
317
185
|
onClickHistory={() => navigate(navigationRoutes.swaps)}
|
|
318
186
|
onClickSettings={() => navigate(navigationRoutes.settings)}
|
|
319
187
|
/>
|
|
@@ -335,7 +203,7 @@ export function Home() {
|
|
|
335
203
|
displayName: fromToken?.symbol || '',
|
|
336
204
|
image: fromToken?.image || '',
|
|
337
205
|
}}
|
|
338
|
-
onClickToken={() => navigate(
|
|
206
|
+
onClickToken={() => navigate(navigationRoutes.fromSwap)}
|
|
339
207
|
price={{
|
|
340
208
|
value: inputAmount,
|
|
341
209
|
usdValue: priceImpactInputCanNotBeComputed
|
|
@@ -349,8 +217,8 @@ export function Home() {
|
|
|
349
217
|
? errorMessages().unknownPriceError.impactTitle
|
|
350
218
|
: undefined,
|
|
351
219
|
}}
|
|
352
|
-
disabled={
|
|
353
|
-
loading={
|
|
220
|
+
disabled={fetchMetaStatus === 'failed'}
|
|
221
|
+
loading={fetchMetaStatus === 'loading'}
|
|
354
222
|
onSelectMaxBalance={() => {
|
|
355
223
|
if (tokenBalance !== '0') {
|
|
356
224
|
setInputAmount(tokenBalanceReal.split(',').join(''));
|
|
@@ -360,9 +228,10 @@ export function Home() {
|
|
|
360
228
|
<SwitchFromAndToButton />
|
|
361
229
|
</FromContainer>
|
|
362
230
|
<SwapInput
|
|
363
|
-
sharpBottomStyle={!!
|
|
231
|
+
sharpBottomStyle={!!quote?.result || fetchingQuote}
|
|
364
232
|
label={i18n.t('To')}
|
|
365
233
|
mode="To"
|
|
234
|
+
fetchingQuote={fetchingQuote}
|
|
366
235
|
chain={{
|
|
367
236
|
displayName: toBlockchain?.displayName || '',
|
|
368
237
|
image: toBlockchain?.logo || '',
|
|
@@ -371,18 +240,12 @@ export function Home() {
|
|
|
371
240
|
displayName: toToken?.symbol || '',
|
|
372
241
|
image: toToken?.image || '',
|
|
373
242
|
}}
|
|
374
|
-
percentageChange={
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
379
|
-
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
380
|
-
)
|
|
381
|
-
: null
|
|
382
|
-
}
|
|
383
|
-
warningLevel={getPriceImpactLevel(
|
|
384
|
-
percentageChange?.toNumber() ?? 0
|
|
243
|
+
percentageChange={numberToString(
|
|
244
|
+
getPriceImpact(inputUsdValue, outputUsdValue),
|
|
245
|
+
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
246
|
+
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
385
247
|
)}
|
|
248
|
+
warningLevel={getPriceImpactLevel(percentageChange ?? 0)}
|
|
386
249
|
price={{
|
|
387
250
|
value: numberToString(
|
|
388
251
|
outputAmount,
|
|
@@ -400,89 +263,31 @@ export function Home() {
|
|
|
400
263
|
? errorMessages().unknownPriceError.impactTitle
|
|
401
264
|
: undefined,
|
|
402
265
|
}}
|
|
403
|
-
onClickToken={() => navigate(
|
|
404
|
-
disabled={
|
|
405
|
-
loading={
|
|
266
|
+
onClickToken={() => navigate(navigationRoutes.toSwap)}
|
|
267
|
+
disabled={fetchMetaStatus === 'failed'}
|
|
268
|
+
loading={fetchMetaStatus === 'loading'}
|
|
406
269
|
/>
|
|
407
270
|
</InputsContainer>
|
|
408
|
-
|
|
409
|
-
<
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
usdValue: numberToString(
|
|
428
|
-
inputUsdValue,
|
|
429
|
-
USD_VALUE_MIN_DECIMALS,
|
|
430
|
-
USD_VALUE_MAX_DECIMALS
|
|
431
|
-
),
|
|
432
|
-
}}
|
|
433
|
-
output={{
|
|
434
|
-
value: numberToString(
|
|
435
|
-
outputAmount,
|
|
436
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
437
|
-
TOKEN_AMOUNT_MAX_DECIMALS
|
|
438
|
-
),
|
|
439
|
-
usdValue: numberToString(
|
|
440
|
-
outputUsdValue,
|
|
441
|
-
USD_VALUE_MIN_DECIMALS,
|
|
442
|
-
USD_VALUE_MAX_DECIMALS
|
|
443
|
-
),
|
|
444
|
-
}}
|
|
445
|
-
steps={getBestRouteSteps(bestRouteData.result.swaps)}
|
|
446
|
-
percentageChange={numberToString(
|
|
447
|
-
percentageChange,
|
|
448
|
-
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
449
|
-
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
450
|
-
)}
|
|
451
|
-
totalFee={numberToString(
|
|
452
|
-
totalFeeInUsd,
|
|
453
|
-
GAS_FEE_MIN_DECIMALS,
|
|
454
|
-
GAS_FEE_MAX_DECIMALS
|
|
455
|
-
)}
|
|
456
|
-
totalTime={secondsToString(
|
|
457
|
-
totalArrivalTime(bestRoute?.result?.swaps)
|
|
458
|
-
)}
|
|
459
|
-
/>
|
|
460
|
-
</BestRouteContainer>
|
|
461
|
-
) : showBestRoute && !fetchingBestRoute ? (
|
|
462
|
-
<>
|
|
463
|
-
<Divider size={20} />
|
|
464
|
-
<NoRoutes
|
|
465
|
-
diagnosisMessage={bestRouteData?.diagnosisMessages?.[0]}
|
|
466
|
-
fetch={refetchBestRoute}
|
|
467
|
-
error={!!bestRouteError}
|
|
468
|
-
/>
|
|
469
|
-
</>
|
|
470
|
-
) : null}
|
|
271
|
+
<div className="quote__container">
|
|
272
|
+
<QuoteInfo
|
|
273
|
+
quote={quote}
|
|
274
|
+
loading={fetchingQuote}
|
|
275
|
+
error={quoteError}
|
|
276
|
+
warning={quoteWarning}
|
|
277
|
+
type="basic"
|
|
278
|
+
refetchQuote={fetchQuote}
|
|
279
|
+
showWarningModal={showQuoteWarningModal}
|
|
280
|
+
onOpenWarningModal={() => setShowQuoteWarningModal(true)}
|
|
281
|
+
onCloseWarningModal={() => setShowQuoteWarningModal(false)}
|
|
282
|
+
onConfirmWarningModal={() => {
|
|
283
|
+
setShowQuoteWarningModal(false);
|
|
284
|
+
setQuoteWarningsConfirmed(true);
|
|
285
|
+
navigate(navigationRoutes.confirmSwap);
|
|
286
|
+
}}
|
|
287
|
+
onChangeSettings={() => navigate(navigationRoutes.settings)}
|
|
288
|
+
/>
|
|
289
|
+
</div>
|
|
471
290
|
</Container>
|
|
472
|
-
<RouteErrors
|
|
473
|
-
openModal={openWarningModal}
|
|
474
|
-
onToggle={setOpenWarningModal}
|
|
475
|
-
totalFeeInUsd={totalFeeInUsd}
|
|
476
|
-
outputUsdValue={outputUsdValue}
|
|
477
|
-
inputUsdValue={inputUsdValue}
|
|
478
|
-
percentageChange={percentageChange}
|
|
479
|
-
highValueLoss={highValueLoss}
|
|
480
|
-
priceImpactCanNotBeComputed={
|
|
481
|
-
priceImpactInputCanNotBeComputed || priceImpactOutputCanNotBeComputed
|
|
482
|
-
}
|
|
483
|
-
loading={fetchingBestRoute || loadingMetaStatus === 'loading'}
|
|
484
|
-
extraSpace={!!bestRoute?.result || !bestRoute}
|
|
485
|
-
/>
|
|
486
291
|
</Layout>
|
|
487
292
|
);
|
|
488
293
|
}
|
|
@@ -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.bind(null, 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';
|
|
26
|
+
import { useAppStore } from '../store/AppStore';
|
|
29
27
|
import { useSettingsStore } from '../store/settings';
|
|
30
28
|
import { containsText } from '../utils/numbers';
|
|
31
|
-
import {
|
|
32
|
-
getUniqueSwappersGroups,
|
|
33
|
-
sortLiquiditySourcesByGroupTitle,
|
|
34
|
-
} from '../utils/settings';
|
|
29
|
+
import { getUniqueSwappersGroups } from '../utils/settings';
|
|
35
30
|
|
|
36
31
|
interface PropTypes {
|
|
37
|
-
supportedSwappers?: string[];
|
|
38
32
|
sourceType: 'Exchanges' | 'Bridges';
|
|
39
33
|
}
|
|
40
34
|
|
|
41
|
-
export function LiquiditySourcePage({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}: PropTypes) {
|
|
35
|
+
export function LiquiditySourcePage({ sourceType }: PropTypes) {
|
|
36
|
+
const fetchStatus = useAppStore().fetchStatus;
|
|
37
|
+
const swappers = useAppStore().swappers();
|
|
45
38
|
const [searchedFor, setSearchedFor] = useState<string>('');
|
|
46
39
|
const toggleLiquiditySource = useSettingsStore.use.toggleLiquiditySource();
|
|
47
|
-
const { navigateBackFrom } = useNavigateBack();
|
|
48
|
-
const loadingMetaStatus = useMetaStore.use.loadingStatus();
|
|
49
|
-
|
|
50
40
|
const supportedUniqueSwappersGroups: Array<UniqueSwappersGroupType> =
|
|
51
|
-
getUniqueSwappersGroups(
|
|
41
|
+
getUniqueSwappersGroups(swappers);
|
|
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.bind(null, 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 (
|