@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
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { PendingSwap
|
|
1
|
+
import type { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
2
|
+
import type { PendingSwapStep } from 'rango-types';
|
|
2
3
|
|
|
3
4
|
import { i18n } from '@lingui/core';
|
|
4
5
|
import { useManager } from '@rango-dev/queue-manager-react';
|
|
@@ -10,6 +11,8 @@ import { Layout } from '../components/Layout';
|
|
|
10
11
|
import { SearchInput } from '../components/SearchInput';
|
|
11
12
|
import { SwapsGroup } from '../components/SwapsGroup';
|
|
12
13
|
import { NotFoundContainer } from '../components/SwapsGroup/SwapsGroup.styles';
|
|
14
|
+
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
15
|
+
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
13
16
|
import { useUiStore } from '../store/ui';
|
|
14
17
|
import { groupSwapsByDate } from '../utils/date';
|
|
15
18
|
import { containsText } from '../utils/numbers';
|
|
@@ -48,6 +51,7 @@ const isStepContainsText = (steps: PendingSwapStep[], value: string) => {
|
|
|
48
51
|
export function HistoryPage() {
|
|
49
52
|
const setSelectedSwap = useUiStore.use.setSelectedSwap();
|
|
50
53
|
const navigate = useNavigate();
|
|
54
|
+
const { navigateBackFrom } = useNavigateBack();
|
|
51
55
|
const { manager, state } = useManager();
|
|
52
56
|
const list: PendingSwap[] = getPendingSwaps(manager).map(({ swap }) => swap);
|
|
53
57
|
const [searchedFor, setSearchedFor] = useState<string>('');
|
|
@@ -74,6 +78,7 @@ export function HistoryPage() {
|
|
|
74
78
|
return (
|
|
75
79
|
<Layout
|
|
76
80
|
header={{
|
|
81
|
+
onBack: navigateBackFrom.bind(null, navigationRoutes.swaps),
|
|
77
82
|
title: i18n.t('History'),
|
|
78
83
|
}}>
|
|
79
84
|
<Container>
|
|
@@ -103,7 +108,7 @@ export function HistoryPage() {
|
|
|
103
108
|
list={filteredList}
|
|
104
109
|
onSwapClick={(requestId) => {
|
|
105
110
|
setSelectedSwap(requestId);
|
|
106
|
-
navigate(requestId);
|
|
111
|
+
navigate(`${requestId}`, { replace: true });
|
|
107
112
|
}}
|
|
108
113
|
groupBy={groupSwapsByDate}
|
|
109
114
|
isLoading={loading}
|
package/src/pages/Home.tsx
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
|
+
import type { SwapResult } from 'rango-sdk';
|
|
2
|
+
|
|
1
3
|
import { i18n } from '@lingui/core';
|
|
2
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Alert,
|
|
6
|
+
BestRoute,
|
|
7
|
+
BestRouteSkeleton,
|
|
8
|
+
Button,
|
|
9
|
+
Divider,
|
|
10
|
+
styled,
|
|
11
|
+
SwapInput,
|
|
12
|
+
Typography,
|
|
13
|
+
WarningIcon,
|
|
14
|
+
} from '@rango-dev/ui';
|
|
3
15
|
import React, { useEffect, useRef, useState } from 'react';
|
|
4
16
|
import { useNavigate } from 'react-router-dom';
|
|
5
17
|
|
|
6
18
|
import { HomeButtons } from '../components/HeaderButtons';
|
|
7
19
|
import { Layout } from '../components/Layout';
|
|
20
|
+
import { NoRoutes } from '../components/NoRoutes';
|
|
21
|
+
import { RouteErrors } from '../components/RouteErrors';
|
|
8
22
|
import { SwitchFromAndToButton } from '../components/SwitchFromAndTo';
|
|
9
23
|
import { errorMessages } from '../constants/errors';
|
|
10
24
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
11
25
|
import {
|
|
26
|
+
BALANCE_MAX_DECIMALS,
|
|
27
|
+
BALANCE_MIN_DECIMALS,
|
|
28
|
+
GAS_FEE_MAX_DECIMALS,
|
|
29
|
+
GAS_FEE_MIN_DECIMALS,
|
|
12
30
|
PERCENTAGE_CHANGE_MAX_DECIMALS,
|
|
13
31
|
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
14
32
|
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
@@ -16,24 +34,36 @@ import {
|
|
|
16
34
|
USD_VALUE_MAX_DECIMALS,
|
|
17
35
|
USD_VALUE_MIN_DECIMALS,
|
|
18
36
|
} from '../constants/routing';
|
|
19
|
-
import { QuoteInfo } from '../containers/QuoteInfo';
|
|
20
37
|
import { useSwapInput } from '../hooks/useSwapInput';
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
38
|
+
import { useBestRouteStore } from '../store/bestRoute';
|
|
39
|
+
import { useMetaStore } from '../store/meta';
|
|
23
40
|
import { useUiStore } from '../store/ui';
|
|
24
41
|
import { useWalletsStore } from '../store/wallets';
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
42
|
+
import { ButtonState } from '../types';
|
|
43
|
+
import { getContainer } from '../utils/common';
|
|
44
|
+
import { getBlockchainShortNameFor } from '../utils/meta';
|
|
45
|
+
import {
|
|
46
|
+
numberToString,
|
|
47
|
+
secondsToString,
|
|
48
|
+
totalArrivalTime,
|
|
49
|
+
} from '../utils/numbers';
|
|
50
|
+
import { getFormattedBestRoute, getPriceImpactLevel } from '../utils/routing';
|
|
51
|
+
import {
|
|
52
|
+
canComputePriceImpact,
|
|
53
|
+
getOutputRatio,
|
|
54
|
+
getPercentageChange,
|
|
55
|
+
getSwapButtonState,
|
|
56
|
+
getTotalFeeInUsd,
|
|
57
|
+
hasLimitError,
|
|
58
|
+
LimitErrorMessage,
|
|
59
|
+
outputRatioHasWarning,
|
|
60
|
+
} from '../utils/swap';
|
|
61
|
+
import { getBalanceFromWallet } from '../utils/wallets';
|
|
29
62
|
|
|
30
63
|
const Container = styled('div', {
|
|
31
64
|
display: 'flex',
|
|
32
65
|
flexDirection: 'column',
|
|
33
66
|
overflowY: 'visible',
|
|
34
|
-
'& .quote__container': {
|
|
35
|
-
paddingTop: '$2',
|
|
36
|
-
},
|
|
37
67
|
});
|
|
38
68
|
|
|
39
69
|
const FromContainer = styled('div', {
|
|
@@ -46,13 +76,27 @@ const InputsContainer = styled('div', {
|
|
|
46
76
|
gap: 5,
|
|
47
77
|
alignSelf: 'stretch',
|
|
48
78
|
});
|
|
79
|
+
|
|
80
|
+
const BestRouteContainer = styled('div', {
|
|
81
|
+
width: '100%',
|
|
82
|
+
paddingTop: '$2',
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const FooterStepAlarm = styled('div', {
|
|
86
|
+
paddingBottom: '$15',
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const FooterAlert = styled('div', {
|
|
90
|
+
width: '100%',
|
|
91
|
+
display: 'flex',
|
|
92
|
+
});
|
|
93
|
+
|
|
49
94
|
export function Home() {
|
|
50
95
|
const navigate = useNavigate();
|
|
51
96
|
const {
|
|
52
|
-
fetch:
|
|
53
|
-
loading:
|
|
54
|
-
error:
|
|
55
|
-
warning: quoteWarning,
|
|
97
|
+
fetch: refetchBestRoute,
|
|
98
|
+
loading: fetchingBestRoute,
|
|
99
|
+
error: bestRouteError,
|
|
56
100
|
} = useSwapInput();
|
|
57
101
|
const {
|
|
58
102
|
fromToken,
|
|
@@ -64,66 +108,175 @@ export function Home() {
|
|
|
64
108
|
inputUsdValue,
|
|
65
109
|
outputAmount,
|
|
66
110
|
outputUsdValue,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
} = useQuoteStore();
|
|
111
|
+
bestRoute,
|
|
112
|
+
resetRouteWallets,
|
|
113
|
+
} = useBestRouteStore();
|
|
71
114
|
|
|
72
|
-
const
|
|
115
|
+
const {
|
|
116
|
+
meta: { tokens, blockchains },
|
|
117
|
+
loadingStatus: loadingMetaStatus,
|
|
118
|
+
} = useMetaStore();
|
|
73
119
|
|
|
74
|
-
const
|
|
120
|
+
const connectedWallets = useWalletsStore.use.connectedWallets();
|
|
75
121
|
const setCurrentPage = useUiStore.use.setCurrentPage();
|
|
76
|
-
const [
|
|
122
|
+
const [openWarningModal, setOpenWarningModal] = useState(false);
|
|
123
|
+
const {
|
|
124
|
+
fromAmountRangeError,
|
|
125
|
+
swap: swapHasError,
|
|
126
|
+
recommendation,
|
|
127
|
+
} = LimitErrorMessage(bestRoute);
|
|
77
128
|
const layoutRef = useRef<HTMLDivElement>(null);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
129
|
+
|
|
130
|
+
const showBestRoute =
|
|
131
|
+
!!Number(inputAmount) &&
|
|
132
|
+
(!!bestRoute || fetchingBestRoute || !!bestRouteError);
|
|
81
133
|
|
|
82
134
|
const needsToWarnEthOnPath = false;
|
|
83
135
|
|
|
136
|
+
const outToInRatio = getOutputRatio(inputUsdValue, outputUsdValue);
|
|
137
|
+
const highValueLoss = outputRatioHasWarning(inputUsdValue, outToInRatio);
|
|
138
|
+
|
|
84
139
|
const priceImpactInputCanNotBeComputed = !canComputePriceImpact(
|
|
85
|
-
|
|
140
|
+
bestRoute,
|
|
86
141
|
inputAmount,
|
|
87
142
|
inputUsdValue
|
|
88
143
|
);
|
|
89
144
|
|
|
90
145
|
const priceImpactOutputCanNotBeComputed = !canComputePriceImpact(
|
|
91
|
-
|
|
146
|
+
bestRoute,
|
|
92
147
|
inputAmount,
|
|
93
148
|
outputUsdValue
|
|
94
149
|
);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
warning: quoteWarning,
|
|
150
|
+
const swapButtonState = getSwapButtonState(
|
|
151
|
+
loadingMetaStatus,
|
|
152
|
+
connectedWallets,
|
|
153
|
+
fetchingBestRoute,
|
|
154
|
+
bestRoute,
|
|
155
|
+
hasLimitError(bestRoute),
|
|
156
|
+
highValueLoss,
|
|
157
|
+
priceImpactInputCanNotBeComputed || priceImpactOutputCanNotBeComputed,
|
|
104
158
|
needsToWarnEthOnPath,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const fromTokenBalance = fromToken ? getBalanceFor(fromToken) : null;
|
|
159
|
+
inputAmount
|
|
160
|
+
);
|
|
108
161
|
|
|
109
|
-
const
|
|
110
|
-
|
|
162
|
+
const tokenBalance =
|
|
163
|
+
!!fromBlockchain && !!fromToken
|
|
164
|
+
? numberToString(
|
|
165
|
+
getBalanceFromWallet(
|
|
166
|
+
connectedWallets,
|
|
167
|
+
fromBlockchain?.name,
|
|
168
|
+
fromToken?.symbol,
|
|
169
|
+
fromToken?.address
|
|
170
|
+
)?.amount || '0',
|
|
171
|
+
BALANCE_MIN_DECIMALS,
|
|
172
|
+
BALANCE_MAX_DECIMALS
|
|
173
|
+
)
|
|
174
|
+
: '0';
|
|
111
175
|
|
|
112
176
|
const tokenBalanceReal =
|
|
113
177
|
!!fromBlockchain && !!fromToken
|
|
114
|
-
? numberToString(
|
|
178
|
+
? numberToString(
|
|
179
|
+
getBalanceFromWallet(
|
|
180
|
+
connectedWallets,
|
|
181
|
+
fromBlockchain?.name,
|
|
182
|
+
fromToken?.symbol,
|
|
183
|
+
fromToken?.address
|
|
184
|
+
)?.amount || '0',
|
|
185
|
+
getBalanceFromWallet(
|
|
186
|
+
connectedWallets,
|
|
187
|
+
fromBlockchain?.name,
|
|
188
|
+
fromToken?.symbol,
|
|
189
|
+
fromToken?.address
|
|
190
|
+
)?.decimal
|
|
191
|
+
)
|
|
115
192
|
: '0';
|
|
116
193
|
|
|
117
194
|
useEffect(() => {
|
|
118
195
|
setCurrentPage(navigationRoutes.home);
|
|
119
|
-
|
|
196
|
+
resetRouteWallets();
|
|
120
197
|
return setCurrentPage.bind(null, '');
|
|
121
198
|
}, []);
|
|
122
199
|
|
|
123
200
|
const percentageChange =
|
|
124
201
|
!inputUsdValue || !outputUsdValue || !outputUsdValue.gt(0)
|
|
125
202
|
? null
|
|
126
|
-
:
|
|
203
|
+
: getPercentageChange(
|
|
204
|
+
inputUsdValue.toNumber(),
|
|
205
|
+
outputUsdValue.toNumber()
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
const getBestRouteSteps = (swaps: SwapResult[]) => {
|
|
209
|
+
return swaps.map((swap, index) => ({
|
|
210
|
+
swapper: { displayName: swap.swapperId, image: swap.swapperLogo },
|
|
211
|
+
from: {
|
|
212
|
+
token: { displayName: swap.from.symbol, image: swap.from.logo },
|
|
213
|
+
chain: {
|
|
214
|
+
displayName:
|
|
215
|
+
getBlockchainShortNameFor(swap.from.blockchain, blockchains) ?? '',
|
|
216
|
+
image: swap.from.blockchainLogo,
|
|
217
|
+
},
|
|
218
|
+
price: {
|
|
219
|
+
value:
|
|
220
|
+
index === 0
|
|
221
|
+
? numberToString(
|
|
222
|
+
inputAmount,
|
|
223
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
224
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
225
|
+
)
|
|
226
|
+
: swap.fromAmount,
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
to: {
|
|
230
|
+
token: { displayName: swap.to.symbol, image: swap.to.logo },
|
|
231
|
+
chain: {
|
|
232
|
+
displayName:
|
|
233
|
+
getBlockchainShortNameFor(swap.to.blockchain, blockchains) ?? '',
|
|
234
|
+
image: swap.to.blockchainLogo,
|
|
235
|
+
},
|
|
236
|
+
price: {
|
|
237
|
+
value: swap.toAmount,
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
alerts:
|
|
241
|
+
swap.swapperId === swapHasError?.swapperId ? (
|
|
242
|
+
<FooterStepAlarm>
|
|
243
|
+
<Alert
|
|
244
|
+
type="error"
|
|
245
|
+
title={recommendation}
|
|
246
|
+
footer={
|
|
247
|
+
<FooterAlert>
|
|
248
|
+
<Typography size="xsmall" variant="body" color="neutral700">
|
|
249
|
+
{fromAmountRangeError}
|
|
250
|
+
</Typography>
|
|
251
|
+
<Divider direction="horizontal" size={8} />
|
|
252
|
+
<Typography size="xsmall" variant="body" color="neutral700">
|
|
253
|
+
|
|
|
254
|
+
</Typography>
|
|
255
|
+
<Divider direction="horizontal" size={8} />
|
|
256
|
+
<Typography size="xsmall" variant="body" color="neutral700">
|
|
257
|
+
{i18n.t({
|
|
258
|
+
id: 'Yours: {amount} {symbol}',
|
|
259
|
+
values: {
|
|
260
|
+
amount: numberToString(
|
|
261
|
+
swapHasError?.fromAmount || null,
|
|
262
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
263
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
264
|
+
),
|
|
265
|
+
symbol: swap?.from.symbol,
|
|
266
|
+
},
|
|
267
|
+
})}
|
|
268
|
+
</Typography>
|
|
269
|
+
</FooterAlert>
|
|
270
|
+
}
|
|
271
|
+
/>
|
|
272
|
+
</FooterStepAlarm>
|
|
273
|
+
) : undefined,
|
|
274
|
+
}));
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
const totalFeeInUsd = getTotalFeeInUsd(bestRoute, tokens);
|
|
278
|
+
|
|
279
|
+
const bestRouteData = getFormattedBestRoute(bestRoute);
|
|
127
280
|
|
|
128
281
|
return (
|
|
129
282
|
<Layout
|
|
@@ -136,14 +289,15 @@ export function Home() {
|
|
|
136
289
|
size="large"
|
|
137
290
|
disabled={swapButtonState.disabled}
|
|
138
291
|
prefix={
|
|
139
|
-
swapButtonState.
|
|
292
|
+
!swapButtonState.disabled &&
|
|
293
|
+
swapButtonState.hasWarning && <WarningIcon />
|
|
140
294
|
}
|
|
141
295
|
fullWidth
|
|
142
296
|
onClick={() => {
|
|
143
|
-
if (swapButtonState.
|
|
297
|
+
if (swapButtonState.state === ButtonState.WAITFORCONNECTING) {
|
|
144
298
|
navigate(navigationRoutes.wallets);
|
|
145
|
-
} else if (swapButtonState.
|
|
146
|
-
|
|
299
|
+
} else if (swapButtonState.state === ButtonState.NEEDTOCONFIRM) {
|
|
300
|
+
setOpenWarningModal(true);
|
|
147
301
|
} else {
|
|
148
302
|
navigate(navigationRoutes.confirmSwap);
|
|
149
303
|
}
|
|
@@ -152,15 +306,14 @@ export function Home() {
|
|
|
152
306
|
</Button>
|
|
153
307
|
}
|
|
154
308
|
header={{
|
|
155
|
-
|
|
156
|
-
navigate(navigationRoutes.wallets);
|
|
157
|
-
},
|
|
158
|
-
hasBackButton: false,
|
|
309
|
+
hasConnectWallet: true,
|
|
159
310
|
title: i18n.t('Swap'),
|
|
160
311
|
suffix: (
|
|
161
312
|
<HomeButtons
|
|
162
313
|
layoutRef={layoutRef.current}
|
|
163
|
-
onClickRefresh={
|
|
314
|
+
onClickRefresh={
|
|
315
|
+
!!bestRoute || bestRouteError ? refetchBestRoute : undefined
|
|
316
|
+
}
|
|
164
317
|
onClickHistory={() => navigate(navigationRoutes.swaps)}
|
|
165
318
|
onClickSettings={() => navigate(navigationRoutes.settings)}
|
|
166
319
|
/>
|
|
@@ -173,7 +326,7 @@ export function Home() {
|
|
|
173
326
|
label={i18n.t('From')}
|
|
174
327
|
mode="From"
|
|
175
328
|
onInputChange={setInputAmount}
|
|
176
|
-
balance={
|
|
329
|
+
balance={tokenBalance}
|
|
177
330
|
chain={{
|
|
178
331
|
displayName: fromBlockchain?.displayName || '',
|
|
179
332
|
image: fromBlockchain?.logo || '',
|
|
@@ -182,7 +335,7 @@ export function Home() {
|
|
|
182
335
|
displayName: fromToken?.symbol || '',
|
|
183
336
|
image: fromToken?.image || '',
|
|
184
337
|
}}
|
|
185
|
-
onClickToken={() => navigate(
|
|
338
|
+
onClickToken={() => navigate('from-swap')}
|
|
186
339
|
price={{
|
|
187
340
|
value: inputAmount,
|
|
188
341
|
usdValue: priceImpactInputCanNotBeComputed
|
|
@@ -196,11 +349,10 @@ export function Home() {
|
|
|
196
349
|
? errorMessages().unknownPriceError.impactTitle
|
|
197
350
|
: undefined,
|
|
198
351
|
}}
|
|
199
|
-
disabled={
|
|
200
|
-
loading={
|
|
201
|
-
loadingBalance={fetchingBalance}
|
|
352
|
+
disabled={loadingMetaStatus === 'failed'}
|
|
353
|
+
loading={loadingMetaStatus === 'loading'}
|
|
202
354
|
onSelectMaxBalance={() => {
|
|
203
|
-
if (
|
|
355
|
+
if (tokenBalance !== '0') {
|
|
204
356
|
setInputAmount(tokenBalanceReal.split(',').join(''));
|
|
205
357
|
}
|
|
206
358
|
}}
|
|
@@ -208,10 +360,9 @@ export function Home() {
|
|
|
208
360
|
<SwitchFromAndToButton />
|
|
209
361
|
</FromContainer>
|
|
210
362
|
<SwapInput
|
|
211
|
-
sharpBottomStyle={!!
|
|
363
|
+
sharpBottomStyle={!!bestRoute?.result || fetchingBestRoute}
|
|
212
364
|
label={i18n.t('To')}
|
|
213
365
|
mode="To"
|
|
214
|
-
fetchingQuote={fetchingQuote}
|
|
215
366
|
chain={{
|
|
216
367
|
displayName: toBlockchain?.displayName || '',
|
|
217
368
|
image: toBlockchain?.logo || '',
|
|
@@ -220,12 +371,18 @@ export function Home() {
|
|
|
220
371
|
displayName: toToken?.symbol || '',
|
|
221
372
|
image: toToken?.image || '',
|
|
222
373
|
}}
|
|
223
|
-
percentageChange={
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
374
|
+
percentageChange={
|
|
375
|
+
!!percentageChange?.lt(0)
|
|
376
|
+
? numberToString(
|
|
377
|
+
percentageChange,
|
|
378
|
+
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
379
|
+
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
380
|
+
)
|
|
381
|
+
: null
|
|
382
|
+
}
|
|
383
|
+
warningLevel={getPriceImpactLevel(
|
|
384
|
+
percentageChange?.toNumber() ?? 0
|
|
227
385
|
)}
|
|
228
|
-
warningLevel={getPriceImpactLevel(percentageChange ?? 0)}
|
|
229
386
|
price={{
|
|
230
387
|
value: numberToString(
|
|
231
388
|
outputAmount,
|
|
@@ -243,31 +400,89 @@ export function Home() {
|
|
|
243
400
|
? errorMessages().unknownPriceError.impactTitle
|
|
244
401
|
: undefined,
|
|
245
402
|
}}
|
|
246
|
-
onClickToken={() => navigate(
|
|
247
|
-
disabled={
|
|
248
|
-
loading={
|
|
403
|
+
onClickToken={() => navigate('to-swap')}
|
|
404
|
+
disabled={loadingMetaStatus === 'failed'}
|
|
405
|
+
loading={loadingMetaStatus === 'loading'}
|
|
249
406
|
/>
|
|
250
407
|
</InputsContainer>
|
|
251
|
-
|
|
252
|
-
<
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
408
|
+
{fetchingBestRoute && (
|
|
409
|
+
<BestRouteContainer>
|
|
410
|
+
<BestRouteSkeleton type="basic" />
|
|
411
|
+
</BestRouteContainer>
|
|
412
|
+
)}
|
|
413
|
+
{showBestRoute &&
|
|
414
|
+
!fetchingBestRoute &&
|
|
415
|
+
bestRouteData?.result?.swaps?.length ? (
|
|
416
|
+
<BestRouteContainer>
|
|
417
|
+
<BestRoute
|
|
418
|
+
type="basic"
|
|
419
|
+
recommended={true}
|
|
420
|
+
tooltipContainer={getContainer()}
|
|
421
|
+
input={{
|
|
422
|
+
value: numberToString(
|
|
423
|
+
inputAmount,
|
|
424
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
425
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
426
|
+
),
|
|
427
|
+
usdValue: numberToString(
|
|
428
|
+
inputUsdValue,
|
|
429
|
+
USD_VALUE_MIN_DECIMALS,
|
|
430
|
+
USD_VALUE_MAX_DECIMALS
|
|
431
|
+
),
|
|
432
|
+
}}
|
|
433
|
+
output={{
|
|
434
|
+
value: numberToString(
|
|
435
|
+
outputAmount,
|
|
436
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
437
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
438
|
+
),
|
|
439
|
+
usdValue: numberToString(
|
|
440
|
+
outputUsdValue,
|
|
441
|
+
USD_VALUE_MIN_DECIMALS,
|
|
442
|
+
USD_VALUE_MAX_DECIMALS
|
|
443
|
+
),
|
|
444
|
+
}}
|
|
445
|
+
steps={getBestRouteSteps(bestRouteData.result.swaps)}
|
|
446
|
+
percentageChange={numberToString(
|
|
447
|
+
percentageChange,
|
|
448
|
+
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
449
|
+
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
450
|
+
)}
|
|
451
|
+
totalFee={numberToString(
|
|
452
|
+
totalFeeInUsd,
|
|
453
|
+
GAS_FEE_MIN_DECIMALS,
|
|
454
|
+
GAS_FEE_MAX_DECIMALS
|
|
455
|
+
)}
|
|
456
|
+
totalTime={secondsToString(
|
|
457
|
+
totalArrivalTime(bestRoute?.result?.swaps)
|
|
458
|
+
)}
|
|
459
|
+
/>
|
|
460
|
+
</BestRouteContainer>
|
|
461
|
+
) : showBestRoute && !fetchingBestRoute ? (
|
|
462
|
+
<>
|
|
463
|
+
<Divider size={20} />
|
|
464
|
+
<NoRoutes
|
|
465
|
+
diagnosisMessage={bestRouteData?.diagnosisMessages?.[0]}
|
|
466
|
+
fetch={refetchBestRoute}
|
|
467
|
+
error={!!bestRouteError}
|
|
468
|
+
/>
|
|
469
|
+
</>
|
|
470
|
+
) : null}
|
|
270
471
|
</Container>
|
|
472
|
+
<RouteErrors
|
|
473
|
+
openModal={openWarningModal}
|
|
474
|
+
onToggle={setOpenWarningModal}
|
|
475
|
+
totalFeeInUsd={totalFeeInUsd}
|
|
476
|
+
outputUsdValue={outputUsdValue}
|
|
477
|
+
inputUsdValue={inputUsdValue}
|
|
478
|
+
percentageChange={percentageChange}
|
|
479
|
+
highValueLoss={highValueLoss}
|
|
480
|
+
priceImpactCanNotBeComputed={
|
|
481
|
+
priceImpactInputCanNotBeComputed || priceImpactOutputCanNotBeComputed
|
|
482
|
+
}
|
|
483
|
+
loading={fetchingBestRoute || loadingMetaStatus === 'loading'}
|
|
484
|
+
extraSpace={!!bestRoute?.result || !bestRoute}
|
|
485
|
+
/>
|
|
271
486
|
</Layout>
|
|
272
487
|
);
|
|
273
488
|
}
|
|
@@ -10,9 +10,13 @@ import React from 'react';
|
|
|
10
10
|
|
|
11
11
|
import { Layout } from '../components/Layout';
|
|
12
12
|
import { SettingsContainer } from '../components/SettingsContainer';
|
|
13
|
+
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
13
14
|
import { useLanguage } from '../hooks/useLanguage';
|
|
15
|
+
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
14
16
|
|
|
15
17
|
export function LanguagePage() {
|
|
18
|
+
const { navigateBackFrom } = useNavigateBack();
|
|
19
|
+
|
|
16
20
|
const { activeLanguage, changeLanguage, languages } = useLanguage();
|
|
17
21
|
|
|
18
22
|
const languageList = languages.map((languageItem) => {
|
|
@@ -34,6 +38,7 @@ export function LanguagePage() {
|
|
|
34
38
|
return (
|
|
35
39
|
<Layout
|
|
36
40
|
header={{
|
|
41
|
+
onBack: navigateBackFrom.bind(null, navigationRoutes.settings),
|
|
37
42
|
title: i18n.t('Language'),
|
|
38
43
|
}}>
|
|
39
44
|
<SettingsContainer>
|