@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
|
@@ -2,20 +2,15 @@
|
|
|
2
2
|
import type {
|
|
3
3
|
ConfirmSwap,
|
|
4
4
|
ConfirmSwapFetchResult,
|
|
5
|
-
} from '../hooks/useConfirmSwap';
|
|
6
|
-
import type { WidgetConfig } from '../types';
|
|
5
|
+
} from '../hooks/useConfirmSwap/useConfirmSwap.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
|
-
BestRoute,
|
|
13
|
-
BestRouteSkeleton,
|
|
14
11
|
Button,
|
|
15
12
|
Divider,
|
|
16
13
|
IconButton,
|
|
17
|
-
MessageBox,
|
|
18
|
-
Modal,
|
|
19
14
|
RefreshIcon,
|
|
20
15
|
SettingsIcon,
|
|
21
16
|
styled,
|
|
@@ -23,50 +18,24 @@ import {
|
|
|
23
18
|
Typography,
|
|
24
19
|
WalletIcon,
|
|
25
20
|
} from '@rango-dev/ui';
|
|
26
|
-
import React, { useEffect, useState } from 'react';
|
|
21
|
+
import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
27
22
|
import { flushSync } from 'react-dom';
|
|
28
23
|
import { useNavigate } from 'react-router-dom';
|
|
29
24
|
|
|
30
|
-
import {
|
|
31
|
-
formatBestRoute,
|
|
32
|
-
getRequiredWallets,
|
|
33
|
-
} from '../components/ConfirmWalletsModal/ConfirmWallets.helpers';
|
|
25
|
+
import { getRequiredWallets } from '../components/ConfirmWalletsModal/ConfirmWallets.helpers';
|
|
34
26
|
import { ConfirmWalletsModal } from '../components/ConfirmWalletsModal/ConfirmWalletsModal';
|
|
35
27
|
import { HeaderButton } from '../components/HeaderButtons/HeaderButtons.styles';
|
|
36
28
|
import { Layout } from '../components/Layout';
|
|
37
|
-
import { NoRoutes } from '../components/NoRoutes';
|
|
38
|
-
import { getConfirmSwapErrorMessage } from '../constants/errors';
|
|
39
29
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
40
|
-
import {
|
|
41
|
-
|
|
42
|
-
GAS_FEE_MIN_DECIMALS,
|
|
43
|
-
PERCENTAGE_CHANGE_MAX_DECIMALS,
|
|
44
|
-
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
45
|
-
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
46
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
47
|
-
USD_VALUE_MAX_DECIMALS,
|
|
48
|
-
USD_VALUE_MIN_DECIMALS,
|
|
49
|
-
} from '../constants/routing';
|
|
50
|
-
import { getRouteWarningMessage } from '../constants/warnings';
|
|
30
|
+
import { getQuoteUpdateWarningMessage } from '../constants/warnings';
|
|
31
|
+
import { QuoteInfo } from '../containers/QuoteInfo';
|
|
51
32
|
import { useConfirmSwap } from '../hooks/useConfirmSwap';
|
|
52
|
-
import {
|
|
53
|
-
import { useMetaStore } from '../store/meta';
|
|
33
|
+
import { useQuoteStore } from '../store/quote';
|
|
54
34
|
import { useSettingsStore } from '../store/settings';
|
|
55
35
|
import { useUiStore } from '../store/ui';
|
|
56
36
|
import { useWalletsStore } from '../store/wallets';
|
|
57
|
-
import {
|
|
58
|
-
ConfirmSwapErrorTypes,
|
|
59
|
-
RouteWarningType,
|
|
60
|
-
SlippageWarningType,
|
|
61
|
-
} from '../types';
|
|
37
|
+
import { QuoteWarningType } from '../types';
|
|
62
38
|
import { getContainer } from '../utils/common';
|
|
63
|
-
import {
|
|
64
|
-
numberToString,
|
|
65
|
-
secondsToString,
|
|
66
|
-
totalArrivalTime,
|
|
67
|
-
} from '../utils/numbers';
|
|
68
|
-
import { getPriceImpactLevel } from '../utils/routing';
|
|
69
|
-
import { getPercentageChange, getTotalFeeInUsd } from '../utils/swap';
|
|
70
39
|
|
|
71
40
|
const Container = styled('div', {
|
|
72
41
|
position: 'relative',
|
|
@@ -75,7 +44,6 @@ const Container = styled('div', {
|
|
|
75
44
|
display: 'flex',
|
|
76
45
|
justifyContent: 'space-between',
|
|
77
46
|
alignItems: 'center',
|
|
78
|
-
paddingBottom: '$10',
|
|
79
47
|
},
|
|
80
48
|
'& .icon': {
|
|
81
49
|
width: '$24',
|
|
@@ -84,6 +52,9 @@ const Container = styled('div', {
|
|
|
84
52
|
justifyContent: 'center',
|
|
85
53
|
alignItems: 'center',
|
|
86
54
|
},
|
|
55
|
+
'& .quote-update__alert': {
|
|
56
|
+
paddingTop: '$10',
|
|
57
|
+
},
|
|
87
58
|
});
|
|
88
59
|
|
|
89
60
|
const Buttons = styled('div', {
|
|
@@ -100,44 +71,31 @@ const Buttons = styled('div', {
|
|
|
100
71
|
},
|
|
101
72
|
});
|
|
102
73
|
|
|
103
|
-
|
|
104
|
-
config?: WidgetConfig;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export function ConfirmSwapPage(props: PropTypes) {
|
|
74
|
+
export function ConfirmSwapPage() {
|
|
108
75
|
//TODO: move component's logics to a custom hook
|
|
109
|
-
const { config } = props;
|
|
110
76
|
const {
|
|
111
|
-
|
|
112
|
-
inputAmount,
|
|
113
|
-
outputAmount,
|
|
114
|
-
inputUsdValue,
|
|
115
|
-
outputUsdValue,
|
|
77
|
+
quote,
|
|
116
78
|
setInputAmount,
|
|
117
79
|
selectedWallets,
|
|
118
|
-
|
|
119
|
-
|
|
80
|
+
quoteWalletsConfirmed,
|
|
81
|
+
setQuoteWalletConfirmed,
|
|
120
82
|
customDestination,
|
|
121
|
-
|
|
83
|
+
quoteWarningsConfirmed,
|
|
84
|
+
} = useQuoteStore();
|
|
122
85
|
const navigate = useNavigate();
|
|
123
86
|
const [dbErrorMessage, setDbErrorMessage] = useState<string>('');
|
|
124
|
-
const [showSlippageWarning, setShowSlippageWarning] = useState(false);
|
|
125
87
|
|
|
126
88
|
const { connectedWallets } = useWalletsStore();
|
|
127
|
-
const showWalletsOnInit = !
|
|
89
|
+
const showWalletsOnInit = !quoteWalletsConfirmed;
|
|
128
90
|
const [showWallets, setShowWallets] = useState(false);
|
|
129
91
|
const setSelectedSwap = useUiStore.use.setSelectedSwap();
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
} = useMetaStore();
|
|
134
|
-
const slippage = useSettingsStore.use.slippage();
|
|
135
|
-
const customSlippage = useSettingsStore.use.customSlippage();
|
|
92
|
+
const disabledLiquiditySources =
|
|
93
|
+
useSettingsStore.use.disabledLiquiditySources();
|
|
94
|
+
const prevDisabledLiquiditySources = useRef(disabledLiquiditySources);
|
|
136
95
|
const { manager } = useManager();
|
|
137
|
-
const selectedSlippage = customSlippage || slippage;
|
|
138
96
|
const {
|
|
139
97
|
fetch: confirmSwap,
|
|
140
|
-
loading:
|
|
98
|
+
loading: fetchingConfirmationQuote,
|
|
141
99
|
cancelFetch,
|
|
142
100
|
} = useConfirmSwap();
|
|
143
101
|
const [confirmSwapResult, setConfirmSwapResult] =
|
|
@@ -146,32 +104,8 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
146
104
|
error: null,
|
|
147
105
|
warnings: null,
|
|
148
106
|
});
|
|
149
|
-
const showSkeleton =
|
|
150
|
-
fetchingConfirmationRoute || loadingMetaStatus === 'loading';
|
|
151
|
-
const showNoRouteFound =
|
|
152
|
-
!fetchingConfirmationRoute &&
|
|
153
|
-
confirmSwapResult.error &&
|
|
154
|
-
[
|
|
155
|
-
ConfirmSwapErrorTypes.NO_ROUTE,
|
|
156
|
-
ConfirmSwapErrorTypes.REQUEST_FAILED,
|
|
157
|
-
].includes(confirmSwapResult.error.type);
|
|
158
|
-
const showBestRoute =
|
|
159
|
-
!showNoRouteFound &&
|
|
160
|
-
!fetchingConfirmationRoute &&
|
|
161
|
-
bestRoute &&
|
|
162
|
-
bestRoute.result;
|
|
163
|
-
|
|
164
|
-
const totalFeeInUsd = getTotalFeeInUsd(bestRoute, tokens);
|
|
165
|
-
const percentageChange = numberToString(
|
|
166
|
-
getPercentageChange(
|
|
167
|
-
inputUsdValue?.toNumber() ?? 0,
|
|
168
|
-
outputUsdValue?.toNumber() ?? 0
|
|
169
|
-
),
|
|
170
|
-
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
171
|
-
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
172
|
-
);
|
|
173
107
|
|
|
174
|
-
const
|
|
108
|
+
const [showQuoteWarningModal, setShowQuoteWarningModal] = useState(false);
|
|
175
109
|
|
|
176
110
|
const onConfirmSwap: ConfirmSwap['fetch'] = async ({
|
|
177
111
|
selectedWallets,
|
|
@@ -183,7 +117,7 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
183
117
|
};
|
|
184
118
|
|
|
185
119
|
const addNewSwap = async () => {
|
|
186
|
-
if (confirmSwapResult.swap &&
|
|
120
|
+
if (confirmSwapResult.swap && quoteWalletsConfirmed) {
|
|
187
121
|
try {
|
|
188
122
|
await manager?.create(
|
|
189
123
|
'swap',
|
|
@@ -191,12 +125,11 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
191
125
|
{ id: confirmSwapResult.swap.requestId }
|
|
192
126
|
);
|
|
193
127
|
setSelectedSwap(confirmSwapResult.swap.requestId);
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
);
|
|
128
|
+
|
|
129
|
+
const swap_url = `../${navigationRoutes.swaps}/${confirmSwapResult.swap.requestId}`;
|
|
130
|
+
navigate(swap_url, {
|
|
131
|
+
replace: true,
|
|
132
|
+
});
|
|
200
133
|
setTimeout(() => {
|
|
201
134
|
setInputAmount('');
|
|
202
135
|
}, 0);
|
|
@@ -211,8 +144,8 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
211
144
|
};
|
|
212
145
|
|
|
213
146
|
const onStartConfirmSwap = async () => {
|
|
214
|
-
if (confirmSwapResult?.warnings?.
|
|
215
|
-
|
|
147
|
+
if (confirmSwapResult?.warnings?.quote && !quoteWarningsConfirmed) {
|
|
148
|
+
setShowQuoteWarningModal(true);
|
|
216
149
|
} else {
|
|
217
150
|
await onConfirm();
|
|
218
151
|
}
|
|
@@ -224,13 +157,23 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
224
157
|
swap: null,
|
|
225
158
|
warnings: null,
|
|
226
159
|
});
|
|
227
|
-
confirmSwap({ selectedWallets })
|
|
160
|
+
confirmSwap({ selectedWallets, customDestination })
|
|
228
161
|
.then((res) => {
|
|
229
162
|
setConfirmSwapResult(res);
|
|
230
163
|
})
|
|
231
164
|
.catch((error) => console.error(error));
|
|
232
165
|
};
|
|
233
166
|
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
const disabledLiquiditySourceReset =
|
|
169
|
+
!!prevDisabledLiquiditySources.current.length &&
|
|
170
|
+
!disabledLiquiditySources.length;
|
|
171
|
+
if (disabledLiquiditySourceReset) {
|
|
172
|
+
void onRefresh();
|
|
173
|
+
}
|
|
174
|
+
prevDisabledLiquiditySources.current = disabledLiquiditySources;
|
|
175
|
+
}, [disabledLiquiditySources.length]);
|
|
176
|
+
|
|
234
177
|
useEffect(() => {
|
|
235
178
|
if (showWalletsOnInit) {
|
|
236
179
|
cancelFetch();
|
|
@@ -252,10 +195,10 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
252
195
|
}, []);
|
|
253
196
|
|
|
254
197
|
useEffect(() => {
|
|
255
|
-
const
|
|
256
|
-
confirmSwapResult.warnings?.
|
|
257
|
-
Object.values(
|
|
258
|
-
confirmSwapResult.warnings?.
|
|
198
|
+
const quoteChanged =
|
|
199
|
+
confirmSwapResult.warnings?.quote?.type &&
|
|
200
|
+
Object.values(QuoteWarningType).includes(
|
|
201
|
+
confirmSwapResult.warnings?.quote?.type
|
|
259
202
|
);
|
|
260
203
|
|
|
261
204
|
const selectedWalletDisconnected =
|
|
@@ -269,16 +212,15 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
269
212
|
)
|
|
270
213
|
);
|
|
271
214
|
|
|
272
|
-
let
|
|
215
|
+
let quoteWalletsChanged = false;
|
|
273
216
|
|
|
274
|
-
if (
|
|
275
|
-
let requiredWallets = getRequiredWallets(
|
|
217
|
+
if (quoteChanged) {
|
|
218
|
+
let requiredWallets = getRequiredWallets(quote);
|
|
276
219
|
|
|
277
220
|
const lastStepToBlockchain =
|
|
278
|
-
|
|
279
|
-
.blockchain;
|
|
221
|
+
quote?.result?.swaps[quote.result.swaps.length - 1].to.blockchain;
|
|
280
222
|
|
|
281
|
-
const isLastWalletRequired = !!
|
|
223
|
+
const isLastWalletRequired = !!quote?.result?.swaps.find(
|
|
282
224
|
(swap) => swap.from.blockchain === lastStepToBlockchain
|
|
283
225
|
);
|
|
284
226
|
|
|
@@ -297,26 +239,34 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
297
239
|
);
|
|
298
240
|
|
|
299
241
|
if (!allRequiredWalletsSelected) {
|
|
300
|
-
|
|
242
|
+
quoteWalletsChanged = true;
|
|
301
243
|
}
|
|
302
244
|
}
|
|
303
245
|
|
|
304
|
-
if (
|
|
246
|
+
if (quote && (selectedWalletDisconnected || quoteWalletsChanged)) {
|
|
305
247
|
queueMicrotask(() => flushSync(setShowWallets.bind(null, true)));
|
|
306
|
-
|
|
248
|
+
setQuoteWalletConfirmed(false);
|
|
307
249
|
}
|
|
308
250
|
}, [
|
|
309
|
-
confirmSwapResult.warnings?.
|
|
251
|
+
confirmSwapResult.warnings?.quote,
|
|
310
252
|
selectedWallets.length,
|
|
311
253
|
connectedWallets.length,
|
|
312
254
|
]);
|
|
313
255
|
|
|
256
|
+
useLayoutEffect(() => {
|
|
257
|
+
if (!quote) {
|
|
258
|
+
navigate(`../`);
|
|
259
|
+
}
|
|
260
|
+
}, []);
|
|
261
|
+
|
|
314
262
|
return (
|
|
315
263
|
<Layout
|
|
316
264
|
header={{
|
|
317
265
|
title: i18n.t('Confirm Swap'),
|
|
318
|
-
|
|
319
|
-
|
|
266
|
+
onWallet: () => {
|
|
267
|
+
const wallets_url = `../${navigationRoutes.wallets}`;
|
|
268
|
+
navigate(wallets_url);
|
|
269
|
+
},
|
|
320
270
|
suffix: (
|
|
321
271
|
<Tooltip
|
|
322
272
|
container={getContainer()}
|
|
@@ -325,7 +275,7 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
325
275
|
<HeaderButton
|
|
326
276
|
size="small"
|
|
327
277
|
variant="ghost"
|
|
328
|
-
onClick={() => navigate('
|
|
278
|
+
onClick={() => navigate('../' + navigationRoutes.settings)}>
|
|
329
279
|
<SettingsIcon size={18} color="black" />
|
|
330
280
|
</HeaderButton>
|
|
331
281
|
</Tooltip>
|
|
@@ -339,7 +289,7 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
339
289
|
type="primary"
|
|
340
290
|
size="large"
|
|
341
291
|
fullWidth
|
|
342
|
-
loading={
|
|
292
|
+
loading={fetchingConfirmationQuote}
|
|
343
293
|
disabled={!!confirmSwapResult.error}
|
|
344
294
|
onClick={onStartConfirmSwap}>
|
|
345
295
|
{i18n.t('Start Swap')}
|
|
@@ -349,72 +299,19 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
349
299
|
variant="contained"
|
|
350
300
|
type="primary"
|
|
351
301
|
size="large"
|
|
352
|
-
loading={
|
|
302
|
+
loading={fetchingConfirmationQuote}
|
|
353
303
|
onClick={setShowWallets.bind(null, true)}>
|
|
354
304
|
<WalletIcon size={24} />
|
|
355
305
|
</IconButton>
|
|
356
306
|
</Buttons>
|
|
357
307
|
}>
|
|
358
|
-
<Modal
|
|
359
|
-
anchor="bottom"
|
|
360
|
-
open={showSlippageWarning}
|
|
361
|
-
prefix={
|
|
362
|
-
<Button
|
|
363
|
-
size="small"
|
|
364
|
-
variant="ghost"
|
|
365
|
-
onClick={() => navigate('/' + navigationRoutes.settings)}>
|
|
366
|
-
<Typography variant="label" size="medium" color="$neutral700">
|
|
367
|
-
{i18n.t('Change settings')}
|
|
368
|
-
</Typography>
|
|
369
|
-
</Button>
|
|
370
|
-
}
|
|
371
|
-
container={document.querySelector('#swap-box') as HTMLDivElement}
|
|
372
|
-
onClose={setShowSlippageWarning.bind(null, (prevState) => !prevState)}>
|
|
373
|
-
{confirmSwapResult.warnings?.slippage && (
|
|
374
|
-
<MessageBox
|
|
375
|
-
type="warning"
|
|
376
|
-
title={
|
|
377
|
-
confirmSwapResult.warnings.slippage.type ===
|
|
378
|
-
SlippageWarningType.HIGH_SLIPPAGE
|
|
379
|
-
? i18n.t('High slippage')
|
|
380
|
-
: i18n.t('Low slippage')
|
|
381
|
-
}
|
|
382
|
-
description={
|
|
383
|
-
confirmSwapResult.warnings.slippage.type ===
|
|
384
|
-
SlippageWarningType.HIGH_SLIPPAGE
|
|
385
|
-
? i18n.t({
|
|
386
|
-
id: ' Caution, your slippage is high (={selectedSlippage}). Your trade may be front run.',
|
|
387
|
-
values: { selectedSlippage },
|
|
388
|
-
})
|
|
389
|
-
: i18n.t({
|
|
390
|
-
id: 'We recommend you to increase slippage to at least {minRequiredSlippage} for this route.',
|
|
391
|
-
values: {
|
|
392
|
-
minRequiredSlippage:
|
|
393
|
-
confirmSwapResult.warnings.slippage.slippage,
|
|
394
|
-
},
|
|
395
|
-
})
|
|
396
|
-
}>
|
|
397
|
-
<Divider size={18} />
|
|
398
|
-
<Divider size={32} />
|
|
399
|
-
<Button
|
|
400
|
-
size="large"
|
|
401
|
-
type="primary"
|
|
402
|
-
variant="contained"
|
|
403
|
-
fullWidth
|
|
404
|
-
onClick={onConfirm}>
|
|
405
|
-
{i18n.t('Confirm anyway')}
|
|
406
|
-
</Button>
|
|
407
|
-
</MessageBox>
|
|
408
|
-
)}
|
|
409
|
-
</Modal>
|
|
410
308
|
{showWallets && (
|
|
411
309
|
<ConfirmWalletsModal
|
|
412
310
|
open={showWallets}
|
|
413
311
|
onClose={() => setShowWallets(false)}
|
|
414
312
|
onCancel={cancelFetch}
|
|
415
|
-
loading={
|
|
313
|
+
loading={fetchingConfirmationQuote}
|
|
416
314
|
onCheckBalance={onConfirmSwap}
|
|
417
|
-
config={config}
|
|
418
315
|
/>
|
|
419
316
|
)}
|
|
420
317
|
|
|
@@ -426,7 +323,7 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
426
323
|
<Button
|
|
427
324
|
style={{ padding: '0' }}
|
|
428
325
|
variant="ghost"
|
|
429
|
-
disabled={
|
|
326
|
+
disabled={fetchingConfirmationQuote}
|
|
430
327
|
onClick={onRefresh}>
|
|
431
328
|
<div className="icon">
|
|
432
329
|
<RefreshIcon size={16} />
|
|
@@ -439,88 +336,38 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
439
336
|
<Divider size={12} />
|
|
440
337
|
</>
|
|
441
338
|
)}
|
|
442
|
-
{confirmSwapResult.warnings?.
|
|
443
|
-
|
|
339
|
+
{confirmSwapResult.warnings?.quoteUpdate && (
|
|
340
|
+
<div className="quote-update__alert">
|
|
444
341
|
<Alert
|
|
445
342
|
variant="alarm"
|
|
446
343
|
type="warning"
|
|
447
|
-
title={
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
{showSkeleton && <BestRouteSkeleton type="swap-preview" expanded />}
|
|
453
|
-
{showBestRoute && (
|
|
454
|
-
<BestRoute
|
|
455
|
-
expanded={true}
|
|
456
|
-
tooltipContainer={getContainer()}
|
|
457
|
-
steps={formatBestRoute(bestRoute, blockchains) ?? []}
|
|
458
|
-
input={{
|
|
459
|
-
value: numberToString(
|
|
460
|
-
inputAmount,
|
|
461
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
462
|
-
TOKEN_AMOUNT_MAX_DECIMALS
|
|
463
|
-
),
|
|
464
|
-
usdValue: numberToString(
|
|
465
|
-
inputUsdValue,
|
|
466
|
-
USD_VALUE_MIN_DECIMALS,
|
|
467
|
-
USD_VALUE_MAX_DECIMALS
|
|
468
|
-
),
|
|
469
|
-
}}
|
|
470
|
-
output={{
|
|
471
|
-
value: numberToString(
|
|
472
|
-
outputAmount,
|
|
473
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
474
|
-
TOKEN_AMOUNT_MAX_DECIMALS
|
|
475
|
-
),
|
|
476
|
-
usdValue: numberToString(
|
|
477
|
-
outputUsdValue,
|
|
478
|
-
USD_VALUE_MIN_DECIMALS,
|
|
479
|
-
USD_VALUE_MAX_DECIMALS
|
|
480
|
-
),
|
|
481
|
-
}}
|
|
482
|
-
totalFee={numberToString(
|
|
483
|
-
totalFeeInUsd,
|
|
484
|
-
GAS_FEE_MIN_DECIMALS,
|
|
485
|
-
GAS_FEE_MAX_DECIMALS
|
|
486
|
-
)}
|
|
487
|
-
totalTime={secondsToString(
|
|
488
|
-
totalArrivalTime(bestRoute.result?.swaps)
|
|
489
|
-
)}
|
|
490
|
-
recommended={true}
|
|
491
|
-
type="swap-preview"
|
|
492
|
-
percentageChange={percentageChange}
|
|
493
|
-
warningLevel={warningLevel}
|
|
494
|
-
/>
|
|
495
|
-
)}
|
|
496
|
-
{showNoRouteFound && (
|
|
497
|
-
<>
|
|
498
|
-
<Divider size={12} />
|
|
499
|
-
<NoRoutes
|
|
500
|
-
diagnosisMessage={
|
|
501
|
-
confirmSwapResult.error?.type === ConfirmSwapErrorTypes.NO_ROUTE
|
|
502
|
-
? confirmSwapResult.error.diagnosisMessage
|
|
503
|
-
: undefined
|
|
344
|
+
title={
|
|
345
|
+
confirmSwapResult.warnings.quoteUpdate &&
|
|
346
|
+
getQuoteUpdateWarningMessage(
|
|
347
|
+
confirmSwapResult.warnings.quoteUpdate
|
|
348
|
+
)
|
|
504
349
|
}
|
|
505
|
-
error={
|
|
506
|
-
confirmSwapResult.error?.type ===
|
|
507
|
-
ConfirmSwapErrorTypes.REQUEST_FAILED
|
|
508
|
-
}
|
|
509
|
-
fetch={onRefresh}
|
|
510
350
|
/>
|
|
511
|
-
|
|
512
|
-
)}
|
|
513
|
-
{confirmSwapResult.error?.type ===
|
|
514
|
-
ConfirmSwapErrorTypes.ROUTE_UPDATED_WITH_HIGH_VALUE_LOSS && (
|
|
515
|
-
<>
|
|
516
|
-
<Alert
|
|
517
|
-
variant="alarm"
|
|
518
|
-
type="error"
|
|
519
|
-
title={getConfirmSwapErrorMessage(confirmSwapResult.error)}
|
|
520
|
-
/>
|
|
521
|
-
<Divider size={12} />
|
|
522
|
-
</>
|
|
351
|
+
</div>
|
|
523
352
|
)}
|
|
353
|
+
<QuoteInfo
|
|
354
|
+
quote={quote}
|
|
355
|
+
type="swap-preview"
|
|
356
|
+
expanded={true}
|
|
357
|
+
alertPosition="top"
|
|
358
|
+
error={confirmSwapResult.error}
|
|
359
|
+
loading={fetchingConfirmationQuote}
|
|
360
|
+
warning={confirmSwapResult.warnings?.quote ?? null}
|
|
361
|
+
refetchQuote={onRefresh}
|
|
362
|
+
showWarningModal={showQuoteWarningModal}
|
|
363
|
+
onOpenWarningModal={() => setShowQuoteWarningModal(true)}
|
|
364
|
+
onCloseWarningModal={() => setShowQuoteWarningModal(false)}
|
|
365
|
+
onConfirmWarningModal={async () => {
|
|
366
|
+
setShowQuoteWarningModal(false);
|
|
367
|
+
await addNewSwap();
|
|
368
|
+
}}
|
|
369
|
+
onChangeSettings={() => navigate('../' + navigationRoutes.settings)}
|
|
370
|
+
/>
|
|
524
371
|
</Container>
|
|
525
372
|
</Layout>
|
|
526
373
|
);
|
|
@@ -11,8 +11,6 @@ import { Layout } from '../components/Layout';
|
|
|
11
11
|
import { SearchInput } from '../components/SearchInput';
|
|
12
12
|
import { SwapsGroup } from '../components/SwapsGroup';
|
|
13
13
|
import { NotFoundContainer } from '../components/SwapsGroup/SwapsGroup.styles';
|
|
14
|
-
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
15
|
-
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
16
14
|
import { useUiStore } from '../store/ui';
|
|
17
15
|
import { groupSwapsByDate } from '../utils/date';
|
|
18
16
|
import { containsText } from '../utils/numbers';
|
|
@@ -51,7 +49,6 @@ const isStepContainsText = (steps: PendingSwapStep[], value: string) => {
|
|
|
51
49
|
export function HistoryPage() {
|
|
52
50
|
const setSelectedSwap = useUiStore.use.setSelectedSwap();
|
|
53
51
|
const navigate = useNavigate();
|
|
54
|
-
const { navigateBackFrom } = useNavigateBack();
|
|
55
52
|
const { manager, state } = useManager();
|
|
56
53
|
const list: PendingSwap[] = getPendingSwaps(manager).map(({ swap }) => swap);
|
|
57
54
|
const [searchedFor, setSearchedFor] = useState<string>('');
|
|
@@ -78,7 +75,6 @@ export function HistoryPage() {
|
|
|
78
75
|
return (
|
|
79
76
|
<Layout
|
|
80
77
|
header={{
|
|
81
|
-
onBack: navigateBackFrom.bind(null, navigationRoutes.swaps),
|
|
82
78
|
title: i18n.t('History'),
|
|
83
79
|
}}>
|
|
84
80
|
<Container>
|
|
@@ -108,7 +104,7 @@ export function HistoryPage() {
|
|
|
108
104
|
list={filteredList}
|
|
109
105
|
onSwapClick={(requestId) => {
|
|
110
106
|
setSelectedSwap(requestId);
|
|
111
|
-
navigate(
|
|
107
|
+
navigate(requestId);
|
|
112
108
|
}}
|
|
113
109
|
groupBy={groupSwapsByDate}
|
|
114
110
|
isLoading={loading}
|