@rango-dev/widget-embedded 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -113
- package/dist/QueueManager.d.ts +2 -5
- package/dist/QueueManager.d.ts.map +1 -1
- package/dist/Wallets.d.ts +17 -0
- package/dist/Wallets.d.ts.map +1 -0
- package/dist/Widget.d.ts +9 -0
- package/dist/Widget.d.ts.map +1 -0
- package/dist/components/AppRouter.d.ts +2 -0
- package/dist/components/AppRouter.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts +6 -1
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +3 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +62 -691
- 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 +3 -1
- 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 +4 -1
- 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.styles.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 +4 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +0 -1727
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +4 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.d.ts +4 -0
- package/dist/components/NoRoutes/NoRoutes.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts +3 -0
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +1 -0
- package/dist/components/{NoResult/NoResult.styles.d.ts → NoRoutes/NoRoutes.styles.d.ts} +1 -1
- package/dist/components/{NoResult/NoResult.styles.d.ts.map → NoRoutes/NoRoutes.styles.d.ts.map} +1 -1
- package/dist/components/{NoResult/NoResult.types.d.ts → NoRoutes/NoRoutes.types.d.ts} +3 -3
- package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +1 -0
- package/dist/components/NoRoutes/index.d.ts +2 -0
- package/dist/components/NoRoutes/index.d.ts.map +1 -0
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/RouteErrors/RouteErrors.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -0
- package/dist/components/{QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts → RouteErrors/RouteErrors.styles.d.ts} +1 -1
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrors.types.d.ts +24 -0
- package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +1 -0
- package/dist/components/RouteErrors/index.d.ts +2 -0
- package/dist/components/RouteErrors/index.d.ts.map +1 -0
- package/dist/components/Slippage/Slippage.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.styles.d.ts +0 -158
- package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +1 -1
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +0 -628
- 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.WalletState.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 +0 -157
- 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 +1 -1100
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.types.d.ts +9 -4
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
- package/dist/components/TokenList/index.d.ts +1 -0
- package/dist/components/TokenList/index.d.ts.map +1 -1
- package/dist/components/UpdateUrl.d.ts +6 -1
- package/dist/components/UpdateUrl.d.ts.map +1 -1
- package/dist/components/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 +0 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/messages.d.ts +1 -1
- package/dist/constants/navigationRoutes.d.ts +2 -1
- package/dist/constants/navigationRoutes.d.ts.map +1 -1
- package/dist/constants/searchParams.d.ts +1 -2
- 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/hooks/{useConfirmSwap/useConfirmSwap.types.d.ts → useConfirmSwap.d.ts} +7 -5
- package/dist/hooks/useConfirmSwap.d.ts.map +1 -0
- package/dist/hooks/{useFetchQuote.d.ts → useFetchBestRoute.d.ts} +3 -3
- package/dist/hooks/useFetchBestRoute.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 +3 -1
- 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 +7 -5
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts +0 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts +1 -5
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts.map +1 -1
- package/dist/hooks/useSwapInput.d.ts +2 -4
- package/dist/hooks/useSwapInput.d.ts.map +1 -1
- package/dist/hooks/useSyncStoresWithConfig.d.ts +2 -1
- 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 +8 -20
- 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 +6 -1
- 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 +2 -1
- 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 +6 -1
- 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 +8 -1
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/app.d.ts +22 -41
- package/dist/store/app.d.ts.map +1 -1
- package/dist/store/bestRoute.d.ts +77 -0
- package/dist/store/bestRoute.d.ts.map +1 -0
- package/dist/store/meta.d.ts +23 -0
- package/dist/store/meta.d.ts.map +1 -0
- package/dist/store/notification.d.ts +3 -4
- package/dist/store/notification.d.ts.map +1 -1
- package/dist/store/settings.d.ts +81 -0
- package/dist/store/settings.d.ts.map +1 -0
- package/dist/store/slices/config.d.ts +2 -3
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/slices/data.d.ts +2 -5
- package/dist/store/slices/data.d.ts.map +1 -1
- package/dist/store/ui.d.ts +1 -2
- package/dist/store/ui.d.ts.map +1 -1
- package/dist/store/wallets.d.ts +9 -14
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +8 -41
- 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/routing.d.ts +65 -0
- package/dist/types/routing.d.ts.map +1 -0
- package/dist/types/swap.d.ts +14 -4
- package/dist/types/swap.d.ts.map +1 -1
- package/dist/types/wallets.d.ts +1 -15
- package/dist/types/wallets.d.ts.map +1 -1
- package/dist/utils/colors.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +0 -1
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +1 -2
- 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/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/routing.d.ts +28 -0
- package/dist/utils/routing.d.ts.map +1 -0
- package/dist/utils/settings.d.ts +2 -6
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +24 -35
- 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 +10 -9
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +10 -12
- package/src/QueueManager.tsx +17 -18
- package/src/{containers/Wallets/Wallets.tsx → Wallets.tsx} +34 -48
- package/src/Widget.tsx +119 -0
- package/src/components/AppRouter.tsx +32 -8
- package/src/components/AppRoutes.tsx +69 -57
- package/src/components/BlockchainList/BlockchainList.styles.ts +2 -2
- package/src/components/BlockchainList/BlockchainList.tsx +4 -4
- package/src/components/BlockchainsSection/BlockchainsSection.styles.ts +1 -1
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +17 -26
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +64 -2
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +10 -29
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +47 -43
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +3 -1
- package/src/components/ConfirmWalletsModal/WalletList.tsx +8 -9
- package/src/components/ConfirmWalletsModal/WalletList.type.ts +4 -1
- package/src/components/HeaderButtons/HomeButtons.tsx +18 -28
- package/src/components/Layout/Layout.styles.ts +0 -2
- package/src/components/Layout/Layout.tsx +7 -20
- package/src/components/Layout/Layout.types.ts +2 -2
- package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +41 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +61 -65
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +34 -28
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +3 -0
- package/src/components/{NoResult/NoResult.helpers.ts → NoRoutes/NoRoutes.helper.ts} +16 -23
- package/src/components/{NoResult/NoResult.styles.ts → NoRoutes/NoRoutes.styles.ts} +0 -2
- package/src/components/{NoResult/NoResult.tsx → NoRoutes/NoRoutes.tsx} +17 -12
- package/src/components/{NoResult/NoResult.types.ts → NoRoutes/NoRoutes.types.ts} +2 -3
- package/src/components/NoRoutes/index.ts +1 -0
- package/src/components/NotificationContent/NotificationContent.tsx +3 -5
- package/src/components/{QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts → RouteErrors/RouteErrors.styles.ts} +1 -8
- package/src/components/RouteErrors/RouteErrors.tsx +79 -0
- package/src/components/RouteErrors/RouteErrors.types.ts +29 -0
- package/src/components/RouteErrors/RouteErrorsModal.tsx +129 -0
- package/src/components/{QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx → RouteErrors/RouteErrorsModalItem.tsx} +4 -4
- package/src/components/RouteErrors/index.ts +1 -0
- package/src/components/Slippage/Slippage.styles.ts +5 -15
- package/src/components/Slippage/Slippage.tsx +10 -11
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +8 -5
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.styles.ts +33 -36
- package/src/components/SwapDetails/SwapDetails.tsx +56 -41
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.tsx +1 -1
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +3 -4
- package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +2 -2
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +8 -14
- 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 +1 -10
- package/src/components/SwapsGroup/SwapsGroup.tsx +5 -3
- package/src/components/SwitchFromAndTo.tsx +2 -2
- package/src/components/TokenList/TokenList.helpers.ts +2 -2
- package/src/components/TokenList/TokenList.styles.ts +38 -74
- package/src/components/TokenList/TokenList.tsx +26 -35
- package/src/components/TokenList/TokenList.types.ts +10 -4
- package/src/components/TokenList/index.ts +1 -0
- package/src/components/UpdateUrl.tsx +30 -35
- package/src/components/WidgetEvents.tsx +2 -4
- package/src/constants/errors.ts +15 -17
- package/src/constants/index.ts +0 -1
- package/src/constants/messages.ts +1 -1
- package/src/constants/navigationRoutes.ts +8 -7
- package/src/constants/searchParams.ts +0 -1
- package/src/constants/warnings.ts +7 -7
- package/src/hooks/useConfirmSwap.ts +303 -0
- package/src/hooks/{useFetchQuote.ts → useFetchBestRoute.ts} +3 -3
- package/src/hooks/useLanguage.ts +5 -4
- package/src/hooks/useNavigateBack.ts +52 -3
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -1
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.ts +7 -37
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +0 -60
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +3 -78
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.ts +6 -15
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.ts +1 -6
- package/src/hooks/useSwapInput.ts +48 -141
- package/src/hooks/useSyncStoresWithConfig.ts +24 -40
- package/src/hooks/useTheme.ts +5 -4
- package/src/hooks/useWalletList.ts +5 -3
- package/src/index.ts +5 -53
- package/src/pages/ConfirmSwapPage.tsx +266 -117
- package/src/pages/HistoryPage.tsx +7 -2
- package/src/pages/Home.tsx +303 -88
- package/src/pages/LanguagePage.tsx +5 -0
- package/src/pages/LiquiditySourcePage.tsx +37 -24
- package/src/pages/SelectBlockchainPage.tsx +24 -31
- package/src/pages/SelectSwapItemsPage.tsx +31 -18
- package/src/pages/SettingsPage.tsx +27 -32
- package/src/pages/SwapDetailsPage.tsx +7 -6
- package/src/pages/ThemePage.tsx +7 -2
- package/src/pages/WalletsPage.tsx +19 -9
- package/src/services/httpService.ts +1 -1
- package/src/store/app.ts +6 -44
- package/src/store/{quote.ts → bestRoute.ts} +64 -71
- package/src/store/meta.ts +39 -0
- package/src/store/settings.ts +158 -0
- package/src/store/slices/config.ts +15 -26
- package/src/store/slices/data.ts +35 -74
- package/src/store/wallets.ts +37 -68
- package/src/types/config.ts +8 -53
- package/src/types/index.ts +1 -1
- package/src/types/routing.ts +77 -0
- package/src/types/swap.ts +13 -4
- package/src/types/wallets.ts +1 -18
- package/src/utils/colors.ts +1 -2
- package/src/utils/configs.ts +1 -2
- package/src/utils/date.ts +1 -1
- package/src/utils/meta.ts +1 -8
- package/src/utils/numbers.ts +1 -1
- package/src/utils/providers.ts +5 -8
- package/src/utils/queue.ts +2 -2
- package/src/utils/routing.ts +321 -0
- package/src/utils/settings.ts +10 -17
- package/src/utils/swap.ts +120 -154
- package/src/utils/time.ts +1 -1
- package/src/utils/wallets.ts +161 -156
- package/dist/components/NoResult/NoResult.d.ts +0 -4
- package/dist/components/NoResult/NoResult.d.ts.map +0 -1
- package/dist/components/NoResult/NoResult.helpers.d.ts +0 -4
- package/dist/components/NoResult/NoResult.helpers.d.ts.map +0 -1
- package/dist/components/NoResult/NoResult.types.d.ts.map +0 -1
- package/dist/components/NoResult/index.d.ts +0 -2
- package/dist/components/NoResult/index.d.ts.map +0 -1
- package/dist/components/Quote/Quote.d.ts +0 -4
- package/dist/components/Quote/Quote.d.ts.map +0 -1
- package/dist/components/Quote/Quote.styles.d.ts +0 -2217
- package/dist/components/Quote/Quote.styles.d.ts.map +0 -1
- package/dist/components/Quote/Quote.types.d.ts +0 -21
- package/dist/components/Quote/Quote.types.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSummary.d.ts +0 -11
- package/dist/components/Quote/QuoteSummary.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSummary.styles.d.ts +0 -315
- package/dist/components/Quote/QuoteSummary.styles.d.ts.map +0 -1
- package/dist/components/Quote/index.d.ts +0 -3
- package/dist/components/Quote/index.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.d.ts +0 -4
- package/dist/components/QuoteSkeleton/QuoteSkeleton.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +0 -633
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts +0 -6
- package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts +0 -4
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +0 -1571
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts +0 -6
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/StepSkeleton.d.ts +0 -4
- package/dist/components/QuoteSkeleton/StepSkeleton.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +0 -786
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts +0 -4
- package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/index.d.ts +0 -4
- package/dist/components/QuoteSkeleton/index.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts +0 -11
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts +0 -4
- package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts +0 -4
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts +0 -9
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +0 -23
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +0 -11
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +0 -11
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/index.d.ts +0 -2
- package/dist/components/QuoteWarningsAndErrors/index.d.ts.map +0 -1
- package/dist/containers/App/App.d.ts +0 -3
- package/dist/containers/App/App.d.ts.map +0 -1
- package/dist/containers/App/App.styles.d.ts +0 -158
- package/dist/containers/App/App.styles.d.ts.map +0 -1
- package/dist/containers/App/index.d.ts +0 -2
- package/dist/containers/App/index.d.ts.map +0 -1
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts +0 -4
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +0 -1
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +0 -788
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +0 -1
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +0 -20
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +0 -1
- package/dist/containers/QuoteInfo/index.d.ts +0 -2
- package/dist/containers/QuoteInfo/index.d.ts.map +0 -1
- package/dist/containers/Wallets/Wallets.d.ts +0 -6
- package/dist/containers/Wallets/Wallets.d.ts.map +0 -1
- package/dist/containers/Wallets/Wallets.types.d.ts +0 -11
- package/dist/containers/Wallets/Wallets.types.d.ts.map +0 -1
- package/dist/containers/Wallets/index.d.ts +0 -2
- package/dist/containers/Wallets/index.d.ts.map +0 -1
- package/dist/containers/Widget/Widget.d.ts +0 -5
- package/dist/containers/Widget/Widget.d.ts.map +0 -1
- package/dist/containers/Widget/Widget.types.d.ts +0 -5
- package/dist/containers/Widget/Widget.types.d.ts.map +0 -1
- package/dist/containers/Widget/index.d.ts +0 -3
- package/dist/containers/Widget/index.d.ts.map +0 -1
- package/dist/containers/WidgetInfo/WidgetInfo.d.ts +0 -6
- package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +0 -1
- package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts +0 -20
- package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts.map +0 -1
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +0 -21
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +0 -1
- package/dist/containers/WidgetInfo/index.d.ts +0 -2
- package/dist/containers/WidgetInfo/index.d.ts.map +0 -1
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts +0 -5
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +0 -1
- package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts +0 -7
- package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts.map +0 -1
- package/dist/containers/WidgetProvider/index.d.ts +0 -2
- package/dist/containers/WidgetProvider/index.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap/index.d.ts +0 -2
- package/dist/hooks/useConfirmSwap/index.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts +0 -3
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +0 -19
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +0 -1
- package/dist/hooks/useFetchQuote.d.ts.map +0 -1
- package/dist/hooks/useForceAutoConnect.d.ts +0 -2
- package/dist/hooks/useForceAutoConnect.d.ts.map +0 -1
- package/dist/store/AppStore.d.ts +0 -47
- package/dist/store/AppStore.d.ts.map +0 -1
- package/dist/store/quote.d.ts +0 -89
- package/dist/store/quote.d.ts.map +0 -1
- package/dist/store/slices/settings.d.ts +0 -39
- package/dist/store/slices/settings.d.ts.map +0 -1
- package/dist/types/quote.d.ts +0 -82
- package/dist/types/quote.d.ts.map +0 -1
- package/dist/utils/quote.d.ts +0 -32
- package/dist/utils/quote.d.ts.map +0 -1
- package/src/components/NoResult/index.ts +0 -1
- package/src/components/Quote/Quote.styles.ts +0 -249
- package/src/components/Quote/Quote.tsx +0 -414
- package/src/components/Quote/Quote.types.ts +0 -15
- package/src/components/Quote/QuoteSummary.styles.ts +0 -16
- package/src/components/Quote/QuoteSummary.tsx +0 -46
- package/src/components/Quote/index.ts +0 -2
- package/src/components/QuoteSkeleton/QuoteSkeleton.styles.ts +0 -42
- package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +0 -30
- package/src/components/QuoteSkeleton/QuoteSkeleton.types.ts +0 -5
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.styles.ts +0 -57
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.tsx +0 -76
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.types.ts +0 -6
- package/src/components/QuoteSkeleton/StepSkeleton.styles.ts +0 -33
- package/src/components/QuoteSkeleton/StepSkeleton.tsx +0 -44
- package/src/components/QuoteSkeleton/StepSkeleton.types.ts +0 -1
- package/src/components/QuoteSkeleton/index.ts +0 -3
- package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +0 -107
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +0 -74
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +0 -103
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +0 -25
- package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +0 -77
- package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +0 -38
- package/src/components/QuoteWarningsAndErrors/index.ts +0 -1
- package/src/containers/App/App.styles.ts +0 -18
- package/src/containers/App/App.tsx +0 -52
- package/src/containers/App/index.ts +0 -1
- package/src/containers/QuoteInfo/QuoteInfo.styles.ts +0 -31
- package/src/containers/QuoteInfo/QuoteInfo.tsx +0 -99
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +0 -20
- package/src/containers/QuoteInfo/index.ts +0 -1
- package/src/containers/Wallets/Wallets.types.ts +0 -12
- package/src/containers/Wallets/index.ts +0 -1
- package/src/containers/Widget/Widget.tsx +0 -19
- package/src/containers/Widget/Widget.types.ts +0 -5
- package/src/containers/Widget/index.ts +0 -2
- package/src/containers/WidgetInfo/WidgetInfo.helpers.ts +0 -64
- package/src/containers/WidgetInfo/WidgetInfo.tsx +0 -62
- package/src/containers/WidgetInfo/WidgetInfo.types.ts +0 -21
- package/src/containers/WidgetInfo/index.ts +0 -1
- package/src/containers/WidgetProvider/WidgetProvider.tsx +0 -28
- package/src/containers/WidgetProvider/WidgetProvider.types.ts +0 -7
- package/src/containers/WidgetProvider/index.ts +0 -1
- package/src/hooks/useConfirmSwap/index.ts +0 -1
- package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +0 -172
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +0 -137
- package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +0 -19
- package/src/hooks/useForceAutoConnect.ts +0 -27
- package/src/store/AppStore.tsx +0 -41
- package/src/store/slices/settings.ts +0 -168
- package/src/types/quote.ts +0 -107
- package/src/utils/quote.ts +0 -338
package/src/index.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { WidgetProps } from './containers/Widget';
|
|
2
|
-
import type { ConnectedWallet } from './store/wallets';
|
|
3
1
|
import type {
|
|
4
2
|
BlockchainAndTokenConfig,
|
|
5
3
|
WidgetColors,
|
|
@@ -7,12 +5,10 @@ import type {
|
|
|
7
5
|
WidgetConfig,
|
|
8
6
|
WidgetTheme,
|
|
9
7
|
} from './types';
|
|
8
|
+
import type { WidgetProps } from './Widget';
|
|
10
9
|
import type {
|
|
11
|
-
EventSeverity,
|
|
12
|
-
PendingSwapWithQueueID,
|
|
13
10
|
Route,
|
|
14
11
|
RouteEvent,
|
|
15
|
-
RouteExecutionEvents,
|
|
16
12
|
RouteFailedEvent,
|
|
17
13
|
RouteStartedEvent,
|
|
18
14
|
RouteSucceededEvent,
|
|
@@ -31,16 +27,7 @@ import type {
|
|
|
31
27
|
EventHandler as HandleWalletsUpdate,
|
|
32
28
|
ProviderInterface,
|
|
33
29
|
} from '@rango-dev/wallets-react';
|
|
34
|
-
import type {
|
|
35
|
-
WalletInfo,
|
|
36
|
-
WalletState,
|
|
37
|
-
WalletType,
|
|
38
|
-
} from '@rango-dev/wallets-shared';
|
|
39
|
-
import type {
|
|
40
|
-
PendingSwap,
|
|
41
|
-
PendingSwapNetworkStatus,
|
|
42
|
-
PendingSwapStep,
|
|
43
|
-
} from 'rango-types';
|
|
30
|
+
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
44
31
|
|
|
45
32
|
import {
|
|
46
33
|
MainEvents,
|
|
@@ -50,18 +37,10 @@ import {
|
|
|
50
37
|
StepExecutionEventStatus,
|
|
51
38
|
useEvents as useWidgetEvents,
|
|
52
39
|
} from '@rango-dev/queue-manager-rango-preset';
|
|
53
|
-
import {
|
|
54
|
-
readAccountAddress,
|
|
55
|
-
useWallets,
|
|
56
|
-
Events as WalletEvents,
|
|
57
|
-
} from '@rango-dev/wallets-react';
|
|
58
|
-
import { Networks, WalletTypes } from '@rango-dev/wallets-shared';
|
|
40
|
+
import { useWallets } from '@rango-dev/wallets-react';
|
|
59
41
|
|
|
60
|
-
import { WidgetWallets } from './
|
|
61
|
-
import { Widget } from './
|
|
62
|
-
import { useWidget } from './containers/WidgetInfo';
|
|
63
|
-
import { WidgetProvider } from './containers/WidgetProvider';
|
|
64
|
-
import { customizedThemeTokens } from './utils/ui';
|
|
42
|
+
import { WidgetWallets } from './Wallets';
|
|
43
|
+
import { Widget } from './Widget';
|
|
65
44
|
|
|
66
45
|
export type {
|
|
67
46
|
WidgetConfig,
|
|
@@ -88,42 +67,15 @@ export type {
|
|
|
88
67
|
StepApprovalTxSucceededEvent,
|
|
89
68
|
StepOutputRevealedEvent,
|
|
90
69
|
HandleWalletsUpdate,
|
|
91
|
-
ConnectedWallet,
|
|
92
70
|
};
|
|
93
71
|
export {
|
|
94
72
|
Widget,
|
|
95
|
-
/**
|
|
96
|
-
* @deprecated Use `WidgetProvider` instead. This component will be removed in future versions.
|
|
97
|
-
*/
|
|
98
73
|
WidgetWallets,
|
|
99
|
-
WidgetProvider,
|
|
100
|
-
useWidget,
|
|
101
74
|
useWallets,
|
|
102
75
|
useWidgetEvents,
|
|
103
|
-
customizedThemeTokens,
|
|
104
76
|
MainEvents,
|
|
105
77
|
RouteEventType,
|
|
106
78
|
StepEventType,
|
|
107
79
|
StepExecutionEventStatus,
|
|
108
80
|
StepExecutionBlockedEventStatus,
|
|
109
81
|
};
|
|
110
|
-
|
|
111
|
-
// Internal type exports for Rango
|
|
112
|
-
export type {
|
|
113
|
-
WalletState,
|
|
114
|
-
WalletInfo,
|
|
115
|
-
PendingSwap,
|
|
116
|
-
PendingSwapWithQueueID,
|
|
117
|
-
PendingSwapStep,
|
|
118
|
-
RouteExecutionEvents,
|
|
119
|
-
EventSeverity,
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
// Internal function and enum exports for Rango
|
|
123
|
-
export {
|
|
124
|
-
readAccountAddress,
|
|
125
|
-
Networks,
|
|
126
|
-
WalletEvents,
|
|
127
|
-
WalletTypes,
|
|
128
|
-
PendingSwapNetworkStatus,
|
|
129
|
-
};
|
|
@@ -2,16 +2,20 @@
|
|
|
2
2
|
import type {
|
|
3
3
|
ConfirmSwap,
|
|
4
4
|
ConfirmSwapFetchResult,
|
|
5
|
-
} from '../hooks/useConfirmSwap
|
|
5
|
+
} from '../hooks/useConfirmSwap';
|
|
6
|
+
import type { WidgetConfig } from '../types';
|
|
6
7
|
|
|
7
8
|
import { i18n } from '@lingui/core';
|
|
8
9
|
import { useManager } from '@rango-dev/queue-manager-react';
|
|
9
10
|
import {
|
|
10
11
|
Alert,
|
|
12
|
+
BestRoute,
|
|
13
|
+
BestRouteSkeleton,
|
|
11
14
|
Button,
|
|
12
|
-
css,
|
|
13
15
|
Divider,
|
|
14
16
|
IconButton,
|
|
17
|
+
MessageBox,
|
|
18
|
+
Modal,
|
|
15
19
|
RefreshIcon,
|
|
16
20
|
SettingsIcon,
|
|
17
21
|
styled,
|
|
@@ -19,31 +23,66 @@ import {
|
|
|
19
23
|
Typography,
|
|
20
24
|
WalletIcon,
|
|
21
25
|
} from '@rango-dev/ui';
|
|
22
|
-
import React, { useEffect,
|
|
26
|
+
import React, { useEffect, useState } from 'react';
|
|
23
27
|
import { flushSync } from 'react-dom';
|
|
24
28
|
import { useNavigate } from 'react-router-dom';
|
|
25
29
|
|
|
26
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
formatBestRoute,
|
|
32
|
+
getRequiredWallets,
|
|
33
|
+
} from '../components/ConfirmWalletsModal/ConfirmWallets.helpers';
|
|
27
34
|
import { ConfirmWalletsModal } from '../components/ConfirmWalletsModal/ConfirmWalletsModal';
|
|
28
35
|
import { HeaderButton } from '../components/HeaderButtons/HeaderButtons.styles';
|
|
29
36
|
import { Layout } from '../components/Layout';
|
|
37
|
+
import { NoRoutes } from '../components/NoRoutes';
|
|
38
|
+
import { getConfirmSwapErrorMessage } from '../constants/errors';
|
|
30
39
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
31
|
-
import {
|
|
32
|
-
|
|
40
|
+
import {
|
|
41
|
+
GAS_FEE_MAX_DECIMALS,
|
|
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';
|
|
33
51
|
import { useConfirmSwap } from '../hooks/useConfirmSwap';
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
52
|
+
import { useBestRouteStore } from '../store/bestRoute';
|
|
53
|
+
import { useMetaStore } from '../store/meta';
|
|
54
|
+
import { useSettingsStore } from '../store/settings';
|
|
36
55
|
import { useUiStore } from '../store/ui';
|
|
37
56
|
import { useWalletsStore } from '../store/wallets';
|
|
38
|
-
import {
|
|
57
|
+
import {
|
|
58
|
+
ConfirmSwapErrorTypes,
|
|
59
|
+
RouteWarningType,
|
|
60
|
+
SlippageWarningType,
|
|
61
|
+
} from '../types';
|
|
39
62
|
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';
|
|
40
70
|
|
|
41
71
|
const Container = styled('div', {
|
|
42
72
|
position: 'relative',
|
|
43
73
|
width: '100%',
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
74
|
+
'& .description': {
|
|
75
|
+
display: 'flex',
|
|
76
|
+
justifyContent: 'space-between',
|
|
77
|
+
alignItems: 'center',
|
|
78
|
+
paddingBottom: '$10',
|
|
79
|
+
},
|
|
80
|
+
'& .icon': {
|
|
81
|
+
width: '$24',
|
|
82
|
+
height: '$24',
|
|
83
|
+
display: 'flex',
|
|
84
|
+
justifyContent: 'center',
|
|
85
|
+
alignItems: 'center',
|
|
47
86
|
},
|
|
48
87
|
});
|
|
49
88
|
|
|
@@ -51,55 +90,54 @@ const Buttons = styled('div', {
|
|
|
51
90
|
width: '100%',
|
|
52
91
|
display: 'flex',
|
|
53
92
|
justifyContent: 'space-between',
|
|
93
|
+
'& .confirm-button': {
|
|
94
|
+
flexGrow: 1,
|
|
95
|
+
paddingRight: '$10',
|
|
96
|
+
},
|
|
54
97
|
[`& ${IconButton}`]: {
|
|
55
98
|
width: '$48',
|
|
56
99
|
height: '$48',
|
|
57
100
|
},
|
|
58
101
|
});
|
|
59
102
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const iconStyles = css({
|
|
66
|
-
width: '$24',
|
|
67
|
-
height: '$24',
|
|
68
|
-
display: 'flex',
|
|
69
|
-
justifyContent: 'center',
|
|
70
|
-
alignItems: 'center',
|
|
71
|
-
});
|
|
103
|
+
type PropTypes = {
|
|
104
|
+
config?: WidgetConfig;
|
|
105
|
+
};
|
|
72
106
|
|
|
73
|
-
|
|
74
|
-
display: 'flex',
|
|
75
|
-
justifyContent: 'space-between',
|
|
76
|
-
alignItems: 'center',
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
export function ConfirmSwapPage() {
|
|
107
|
+
export function ConfirmSwapPage(props: PropTypes) {
|
|
80
108
|
//TODO: move component's logics to a custom hook
|
|
109
|
+
const { config } = props;
|
|
81
110
|
const {
|
|
82
|
-
|
|
111
|
+
bestRoute,
|
|
112
|
+
inputAmount,
|
|
113
|
+
outputAmount,
|
|
114
|
+
inputUsdValue,
|
|
115
|
+
outputUsdValue,
|
|
83
116
|
setInputAmount,
|
|
84
117
|
selectedWallets,
|
|
85
|
-
|
|
86
|
-
|
|
118
|
+
routeWalletsConfirmed,
|
|
119
|
+
setRouteWalletConfirmed,
|
|
87
120
|
customDestination,
|
|
88
|
-
|
|
89
|
-
} = useQuoteStore();
|
|
121
|
+
} = useBestRouteStore();
|
|
90
122
|
const navigate = useNavigate();
|
|
91
123
|
const [dbErrorMessage, setDbErrorMessage] = useState<string>('');
|
|
124
|
+
const [showSlippageWarning, setShowSlippageWarning] = useState(false);
|
|
92
125
|
|
|
93
126
|
const { connectedWallets } = useWalletsStore();
|
|
94
|
-
const showWalletsOnInit = !
|
|
127
|
+
const showWalletsOnInit = !routeWalletsConfirmed;
|
|
95
128
|
const [showWallets, setShowWallets] = useState(false);
|
|
96
129
|
const setSelectedSwap = useUiStore.use.setSelectedSwap();
|
|
97
|
-
const
|
|
98
|
-
|
|
130
|
+
const {
|
|
131
|
+
meta: { tokens, blockchains },
|
|
132
|
+
loadingStatus: loadingMetaStatus,
|
|
133
|
+
} = useMetaStore();
|
|
134
|
+
const slippage = useSettingsStore.use.slippage();
|
|
135
|
+
const customSlippage = useSettingsStore.use.customSlippage();
|
|
99
136
|
const { manager } = useManager();
|
|
137
|
+
const selectedSlippage = customSlippage || slippage;
|
|
100
138
|
const {
|
|
101
139
|
fetch: confirmSwap,
|
|
102
|
-
loading:
|
|
140
|
+
loading: fetchingConfirmationRoute,
|
|
103
141
|
cancelFetch,
|
|
104
142
|
} = useConfirmSwap();
|
|
105
143
|
const [confirmSwapResult, setConfirmSwapResult] =
|
|
@@ -108,8 +146,32 @@ export function ConfirmSwapPage() {
|
|
|
108
146
|
error: null,
|
|
109
147
|
warnings: null,
|
|
110
148
|
});
|
|
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
|
+
);
|
|
111
173
|
|
|
112
|
-
const
|
|
174
|
+
const warningLevel = getPriceImpactLevel(parseFloat(percentageChange));
|
|
113
175
|
|
|
114
176
|
const onConfirmSwap: ConfirmSwap['fetch'] = async ({
|
|
115
177
|
selectedWallets,
|
|
@@ -121,7 +183,7 @@ export function ConfirmSwapPage() {
|
|
|
121
183
|
};
|
|
122
184
|
|
|
123
185
|
const addNewSwap = async () => {
|
|
124
|
-
if (confirmSwapResult.swap &&
|
|
186
|
+
if (confirmSwapResult.swap && routeWalletsConfirmed) {
|
|
125
187
|
try {
|
|
126
188
|
await manager?.create(
|
|
127
189
|
'swap',
|
|
@@ -129,11 +191,12 @@ export function ConfirmSwapPage() {
|
|
|
129
191
|
{ id: confirmSwapResult.swap.requestId }
|
|
130
192
|
);
|
|
131
193
|
setSelectedSwap(confirmSwapResult.swap.requestId);
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
194
|
+
navigate(
|
|
195
|
+
'/' + navigationRoutes.swaps + `/${confirmSwapResult.swap.requestId}`,
|
|
196
|
+
{
|
|
197
|
+
replace: true,
|
|
198
|
+
}
|
|
199
|
+
);
|
|
137
200
|
setTimeout(() => {
|
|
138
201
|
setInputAmount('');
|
|
139
202
|
}, 0);
|
|
@@ -148,8 +211,8 @@ export function ConfirmSwapPage() {
|
|
|
148
211
|
};
|
|
149
212
|
|
|
150
213
|
const onStartConfirmSwap = async () => {
|
|
151
|
-
if (confirmSwapResult?.warnings?.
|
|
152
|
-
|
|
214
|
+
if (confirmSwapResult?.warnings?.slippage) {
|
|
215
|
+
setShowSlippageWarning(true);
|
|
153
216
|
} else {
|
|
154
217
|
await onConfirm();
|
|
155
218
|
}
|
|
@@ -161,23 +224,13 @@ export function ConfirmSwapPage() {
|
|
|
161
224
|
swap: null,
|
|
162
225
|
warnings: null,
|
|
163
226
|
});
|
|
164
|
-
confirmSwap({ selectedWallets
|
|
227
|
+
confirmSwap({ selectedWallets })
|
|
165
228
|
.then((res) => {
|
|
166
229
|
setConfirmSwapResult(res);
|
|
167
230
|
})
|
|
168
231
|
.catch((error) => console.error(error));
|
|
169
232
|
};
|
|
170
233
|
|
|
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
|
-
|
|
181
234
|
useEffect(() => {
|
|
182
235
|
if (showWalletsOnInit) {
|
|
183
236
|
cancelFetch();
|
|
@@ -199,10 +252,10 @@ export function ConfirmSwapPage() {
|
|
|
199
252
|
}, []);
|
|
200
253
|
|
|
201
254
|
useEffect(() => {
|
|
202
|
-
const
|
|
203
|
-
confirmSwapResult.warnings?.
|
|
204
|
-
Object.values(
|
|
205
|
-
confirmSwapResult.warnings?.
|
|
255
|
+
const routeChanged =
|
|
256
|
+
confirmSwapResult.warnings?.route?.type &&
|
|
257
|
+
Object.values(RouteWarningType).includes(
|
|
258
|
+
confirmSwapResult.warnings?.route?.type
|
|
206
259
|
);
|
|
207
260
|
|
|
208
261
|
const selectedWalletDisconnected =
|
|
@@ -216,15 +269,16 @@ export function ConfirmSwapPage() {
|
|
|
216
269
|
)
|
|
217
270
|
);
|
|
218
271
|
|
|
219
|
-
let
|
|
272
|
+
let routeWalletsChanged = false;
|
|
220
273
|
|
|
221
|
-
if (
|
|
222
|
-
let requiredWallets = getRequiredWallets(
|
|
274
|
+
if (routeChanged) {
|
|
275
|
+
let requiredWallets = getRequiredWallets(bestRoute);
|
|
223
276
|
|
|
224
277
|
const lastStepToBlockchain =
|
|
225
|
-
|
|
278
|
+
bestRoute?.result?.swaps[bestRoute.result.swaps.length - 1].to
|
|
279
|
+
.blockchain;
|
|
226
280
|
|
|
227
|
-
const isLastWalletRequired = !!
|
|
281
|
+
const isLastWalletRequired = !!bestRoute?.result?.swaps.find(
|
|
228
282
|
(swap) => swap.from.blockchain === lastStepToBlockchain
|
|
229
283
|
);
|
|
230
284
|
|
|
@@ -243,34 +297,26 @@ export function ConfirmSwapPage() {
|
|
|
243
297
|
);
|
|
244
298
|
|
|
245
299
|
if (!allRequiredWalletsSelected) {
|
|
246
|
-
|
|
300
|
+
routeWalletsChanged = true;
|
|
247
301
|
}
|
|
248
302
|
}
|
|
249
303
|
|
|
250
|
-
if (
|
|
304
|
+
if (bestRoute && (selectedWalletDisconnected || routeWalletsChanged)) {
|
|
251
305
|
queueMicrotask(() => flushSync(setShowWallets.bind(null, true)));
|
|
252
|
-
|
|
306
|
+
setRouteWalletConfirmed(false);
|
|
253
307
|
}
|
|
254
308
|
}, [
|
|
255
|
-
confirmSwapResult.warnings?.
|
|
309
|
+
confirmSwapResult.warnings?.route,
|
|
256
310
|
selectedWallets.length,
|
|
257
311
|
connectedWallets.length,
|
|
258
312
|
]);
|
|
259
313
|
|
|
260
|
-
useLayoutEffect(() => {
|
|
261
|
-
if (!quote) {
|
|
262
|
-
navigate(`../`);
|
|
263
|
-
}
|
|
264
|
-
}, []);
|
|
265
|
-
|
|
266
314
|
return (
|
|
267
315
|
<Layout
|
|
268
316
|
header={{
|
|
269
317
|
title: i18n.t('Confirm Swap'),
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
navigate(wallets_url);
|
|
273
|
-
},
|
|
318
|
+
onBack: navigate.bind(null, -1),
|
|
319
|
+
hasConnectWallet: true,
|
|
274
320
|
suffix: (
|
|
275
321
|
<Tooltip
|
|
276
322
|
container={getContainer()}
|
|
@@ -279,7 +325,7 @@ export function ConfirmSwapPage() {
|
|
|
279
325
|
<HeaderButton
|
|
280
326
|
size="small"
|
|
281
327
|
variant="ghost"
|
|
282
|
-
onClick={() => navigate('
|
|
328
|
+
onClick={() => navigate('/' + navigationRoutes.settings)}>
|
|
283
329
|
<SettingsIcon size={18} color="black" />
|
|
284
330
|
</HeaderButton>
|
|
285
331
|
</Tooltip>
|
|
@@ -287,13 +333,13 @@ export function ConfirmSwapPage() {
|
|
|
287
333
|
}}
|
|
288
334
|
footer={
|
|
289
335
|
<Buttons>
|
|
290
|
-
<div className=
|
|
336
|
+
<div className="confirm-button">
|
|
291
337
|
<Button
|
|
292
338
|
variant="contained"
|
|
293
339
|
type="primary"
|
|
294
340
|
size="large"
|
|
295
341
|
fullWidth
|
|
296
|
-
loading={
|
|
342
|
+
loading={fetchingConfirmationRoute}
|
|
297
343
|
disabled={!!confirmSwapResult.error}
|
|
298
344
|
onClick={onStartConfirmSwap}>
|
|
299
345
|
{i18n.t('Start Swap')}
|
|
@@ -303,33 +349,86 @@ export function ConfirmSwapPage() {
|
|
|
303
349
|
variant="contained"
|
|
304
350
|
type="primary"
|
|
305
351
|
size="large"
|
|
306
|
-
loading={
|
|
352
|
+
loading={fetchingConfirmationRoute}
|
|
307
353
|
onClick={setShowWallets.bind(null, true)}>
|
|
308
354
|
<WalletIcon size={24} />
|
|
309
355
|
</IconButton>
|
|
310
356
|
</Buttons>
|
|
311
357
|
}>
|
|
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>
|
|
312
410
|
{showWallets && (
|
|
313
411
|
<ConfirmWalletsModal
|
|
314
412
|
open={showWallets}
|
|
315
413
|
onClose={() => setShowWallets(false)}
|
|
316
414
|
onCancel={cancelFetch}
|
|
317
|
-
loading={
|
|
415
|
+
loading={fetchingConfirmationRoute}
|
|
318
416
|
onCheckBalance={onConfirmSwap}
|
|
417
|
+
config={config}
|
|
319
418
|
/>
|
|
320
419
|
)}
|
|
321
420
|
|
|
322
421
|
<Container>
|
|
323
|
-
<div className=
|
|
422
|
+
<div className="description">
|
|
324
423
|
<Typography variant="title" size="small">
|
|
325
424
|
{i18n.t('You get')}
|
|
326
425
|
</Typography>
|
|
327
426
|
<Button
|
|
328
427
|
style={{ padding: '0' }}
|
|
329
428
|
variant="ghost"
|
|
330
|
-
disabled={
|
|
429
|
+
disabled={fetchingConfirmationRoute}
|
|
331
430
|
onClick={onRefresh}>
|
|
332
|
-
<div className=
|
|
431
|
+
<div className="icon">
|
|
333
432
|
<RefreshIcon size={16} />
|
|
334
433
|
</div>
|
|
335
434
|
</Button>
|
|
@@ -340,38 +439,88 @@ export function ConfirmSwapPage() {
|
|
|
340
439
|
<Divider size={12} />
|
|
341
440
|
</>
|
|
342
441
|
)}
|
|
343
|
-
{confirmSwapResult.warnings?.
|
|
344
|
-
|
|
442
|
+
{confirmSwapResult.warnings?.route && (
|
|
443
|
+
<>
|
|
345
444
|
<Alert
|
|
346
445
|
variant="alarm"
|
|
347
446
|
type="warning"
|
|
348
|
-
title={
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
447
|
+
title={getRouteWarningMessage(confirmSwapResult.warnings.route)}
|
|
448
|
+
/>
|
|
449
|
+
<Divider size={12} />
|
|
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
|
|
353
504
|
}
|
|
505
|
+
error={
|
|
506
|
+
confirmSwapResult.error?.type ===
|
|
507
|
+
ConfirmSwapErrorTypes.REQUEST_FAILED
|
|
508
|
+
}
|
|
509
|
+
fetch={onRefresh}
|
|
354
510
|
/>
|
|
355
|
-
|
|
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
|
+
</>
|
|
356
523
|
)}
|
|
357
|
-
<QuoteInfo
|
|
358
|
-
quote={quote}
|
|
359
|
-
type="swap-preview"
|
|
360
|
-
expanded={true}
|
|
361
|
-
alertPosition="top"
|
|
362
|
-
error={confirmSwapResult.error}
|
|
363
|
-
loading={fetchingConfirmationQuote}
|
|
364
|
-
warning={confirmSwapResult.warnings?.quote ?? null}
|
|
365
|
-
refetchQuote={onRefresh}
|
|
366
|
-
showWarningModal={showQuoteWarningModal}
|
|
367
|
-
onOpenWarningModal={() => setShowQuoteWarningModal(true)}
|
|
368
|
-
onCloseWarningModal={() => setShowQuoteWarningModal(false)}
|
|
369
|
-
onConfirmWarningModal={async () => {
|
|
370
|
-
setShowQuoteWarningModal(false);
|
|
371
|
-
await addNewSwap();
|
|
372
|
-
}}
|
|
373
|
-
onChangeSettings={() => navigate('../' + navigationRoutes.settings)}
|
|
374
|
-
/>
|
|
375
524
|
</Container>
|
|
376
525
|
</Layout>
|
|
377
526
|
);
|