@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
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { ModalPropTypes } from './RouteErrors.types';
|
|
2
|
+
|
|
3
|
+
import { i18n } from '@lingui/core';
|
|
4
|
+
import {
|
|
5
|
+
Button,
|
|
6
|
+
Divider,
|
|
7
|
+
MessageBox,
|
|
8
|
+
Modal,
|
|
9
|
+
Typography,
|
|
10
|
+
WarningIcon,
|
|
11
|
+
} from '@rango-dev/ui';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { useNavigate } from 'react-router-dom';
|
|
14
|
+
|
|
15
|
+
import { errorMessages } from '../../constants/errors';
|
|
16
|
+
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
17
|
+
import {
|
|
18
|
+
GAS_FEE_MAX_DECIMALS,
|
|
19
|
+
GAS_FEE_MIN_DECIMALS,
|
|
20
|
+
HIGHT_PRICE_IMPACT,
|
|
21
|
+
PERCENTAGE_CHANGE_MAX_DECIMALS,
|
|
22
|
+
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
23
|
+
USD_VALUE_MAX_DECIMALS,
|
|
24
|
+
USD_VALUE_MIN_DECIMALS,
|
|
25
|
+
} from '../../constants/routing';
|
|
26
|
+
import { numberToString } from '../../utils/numbers';
|
|
27
|
+
|
|
28
|
+
import { Flex } from './RouteErrors.styles';
|
|
29
|
+
import { RouteErrorsModalItem } from './RouteErrorsModalItem';
|
|
30
|
+
|
|
31
|
+
export function RouteErrorsModal(props: ModalPropTypes) {
|
|
32
|
+
const {
|
|
33
|
+
highValueLoss,
|
|
34
|
+
open,
|
|
35
|
+
onToggle,
|
|
36
|
+
percentageChange,
|
|
37
|
+
inputUsdValue,
|
|
38
|
+
outputUsdValue,
|
|
39
|
+
totalFeeInUsd,
|
|
40
|
+
} = props;
|
|
41
|
+
const navigate = useNavigate();
|
|
42
|
+
const type =
|
|
43
|
+
highValueLoss && !!percentageChange?.lt(HIGHT_PRICE_IMPACT)
|
|
44
|
+
? 'error'
|
|
45
|
+
: 'warning';
|
|
46
|
+
const highValueLossData = [
|
|
47
|
+
{
|
|
48
|
+
title: i18n.t('Swapping'),
|
|
49
|
+
value: numberToString(
|
|
50
|
+
inputUsdValue,
|
|
51
|
+
USD_VALUE_MIN_DECIMALS,
|
|
52
|
+
USD_VALUE_MAX_DECIMALS
|
|
53
|
+
),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
title: i18n.t('Gas cost'),
|
|
57
|
+
value: numberToString(
|
|
58
|
+
totalFeeInUsd,
|
|
59
|
+
GAS_FEE_MIN_DECIMALS,
|
|
60
|
+
GAS_FEE_MAX_DECIMALS
|
|
61
|
+
),
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
title: i18n.t('Receiving'),
|
|
65
|
+
value: numberToString(
|
|
66
|
+
outputUsdValue,
|
|
67
|
+
USD_VALUE_MIN_DECIMALS,
|
|
68
|
+
USD_VALUE_MAX_DECIMALS
|
|
69
|
+
),
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
title: i18n.t('Price impact'),
|
|
73
|
+
value: numberToString(
|
|
74
|
+
percentageChange,
|
|
75
|
+
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
76
|
+
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
77
|
+
),
|
|
78
|
+
valueColor: `${type}500`,
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<Modal
|
|
84
|
+
open={open}
|
|
85
|
+
onClose={() => onToggle(false)}
|
|
86
|
+
container={document.getElementById('swap-box') || document.body}>
|
|
87
|
+
{highValueLoss ? (
|
|
88
|
+
<MessageBox
|
|
89
|
+
type={type}
|
|
90
|
+
title={errorMessages().highValueLossError.impactTitle}
|
|
91
|
+
description={errorMessages().highValueLossError.description}
|
|
92
|
+
/>
|
|
93
|
+
) : (
|
|
94
|
+
<MessageBox
|
|
95
|
+
type={type}
|
|
96
|
+
title={errorMessages().unknownPriceError.impactTitle}
|
|
97
|
+
description={errorMessages().unknownPriceError.description}
|
|
98
|
+
/>
|
|
99
|
+
)}
|
|
100
|
+
{highValueLoss && (
|
|
101
|
+
<Flex>
|
|
102
|
+
<Divider size={20} />
|
|
103
|
+
<Typography size="small" variant="title">
|
|
104
|
+
{i18n.t('Details')}
|
|
105
|
+
</Typography>
|
|
106
|
+
<Flex>
|
|
107
|
+
{highValueLossData.map((item, index) => {
|
|
108
|
+
const key = index;
|
|
109
|
+
return <RouteErrorsModalItem key={key} {...item} />;
|
|
110
|
+
})}
|
|
111
|
+
</Flex>
|
|
112
|
+
</Flex>
|
|
113
|
+
)}
|
|
114
|
+
<Divider size={32} />
|
|
115
|
+
<Button
|
|
116
|
+
type="primary"
|
|
117
|
+
size="large"
|
|
118
|
+
prefix={<WarningIcon />}
|
|
119
|
+
fullWidth
|
|
120
|
+
onClick={() => {
|
|
121
|
+
navigate(navigationRoutes.confirmSwap);
|
|
122
|
+
}}>
|
|
123
|
+
{highValueLoss
|
|
124
|
+
? errorMessages().highValueLossError.confirmMessage
|
|
125
|
+
: errorMessages().unknownPriceError.confirmMessage}
|
|
126
|
+
</Button>
|
|
127
|
+
</Modal>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { ModalContentData } from './
|
|
1
|
+
import type { ModalContentData } from './RouteErrors.types';
|
|
2
2
|
|
|
3
3
|
import { Typography } from '@rango-dev/ui';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
|
-
import { Item } from './
|
|
6
|
+
import { Item } from './RouteErrors.styles';
|
|
7
7
|
|
|
8
|
-
export function
|
|
8
|
+
export function RouteErrorsModalItem(props: ModalContentData) {
|
|
9
9
|
const { title, value, valueColor } = props;
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
12
|
<Item>
|
|
13
|
-
<Typography size="medium" variant="label"
|
|
13
|
+
<Typography size="medium" variant="label" color="neutral600">
|
|
14
14
|
{title}
|
|
15
15
|
</Typography>
|
|
16
16
|
<Typography
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RouteErrors } from './RouteErrors';
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { styled } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
3
|
export const BaseContainer = styled('div', {
|
|
4
4
|
paddingTop: '$5',
|
|
5
|
-
|
|
5
|
+
paddingBottom: '30px',
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
export const SlippageChipsContainer = styled('div', {
|
|
9
9
|
display: 'flex',
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
[`& ${TextField}`]: {
|
|
13
|
-
flex: '1 1 0',
|
|
14
|
-
maxWidth: '127px',
|
|
15
|
-
minWidth: '85px',
|
|
16
|
-
},
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
justifyContent: 'start',
|
|
17
12
|
});
|
|
18
13
|
|
|
19
14
|
export const Head = styled('div', {
|
|
@@ -24,11 +19,6 @@ export const Head = styled('div', {
|
|
|
24
19
|
});
|
|
25
20
|
|
|
26
21
|
export const SlippageTooltipContainer = styled('div', {
|
|
27
|
-
maxWidth: '
|
|
22
|
+
maxWidth: '300px',
|
|
28
23
|
padding: '$10',
|
|
29
24
|
});
|
|
30
|
-
|
|
31
|
-
export const SlippageChip = styled(Chip, {
|
|
32
|
-
width: '61px',
|
|
33
|
-
flexShrink: 0,
|
|
34
|
-
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { i18n } from '@lingui/core';
|
|
2
2
|
import {
|
|
3
|
+
Chip,
|
|
3
4
|
Divider,
|
|
4
5
|
InfoIcon,
|
|
5
6
|
TextField,
|
|
@@ -13,20 +14,17 @@ import {
|
|
|
13
14
|
MIN_SLIPPGAE,
|
|
14
15
|
SLIPPAGES,
|
|
15
16
|
} from '../../constants/swapSettings';
|
|
16
|
-
import {
|
|
17
|
+
import { useSettingsStore } from '../../store/settings';
|
|
17
18
|
import { getContainer } from '../../utils/common';
|
|
18
19
|
|
|
19
|
-
import {
|
|
20
|
-
BaseContainer,
|
|
21
|
-
Head,
|
|
22
|
-
SlippageChip,
|
|
23
|
-
SlippageChipsContainer,
|
|
24
|
-
} from './Slippage.styles';
|
|
20
|
+
import { BaseContainer, Head, SlippageChipsContainer } from './Slippage.styles';
|
|
25
21
|
import { SlippageTooltipContent } from './SlippageTooltipContent';
|
|
26
22
|
|
|
27
23
|
export function Slippage() {
|
|
28
|
-
const
|
|
29
|
-
|
|
24
|
+
const slippage = useSettingsStore.use.slippage();
|
|
25
|
+
const setSlippage = useSettingsStore.use.setSlippage();
|
|
26
|
+
const customSlippage = useSettingsStore.use.customSlippage();
|
|
27
|
+
const setCustomSlippage = useSettingsStore.use.setCustomSlippage();
|
|
30
28
|
|
|
31
29
|
return (
|
|
32
30
|
<BaseContainer>
|
|
@@ -38,7 +36,6 @@ export function Slippage() {
|
|
|
38
36
|
<Tooltip
|
|
39
37
|
container={getContainer()}
|
|
40
38
|
side="top"
|
|
41
|
-
sideOffset={4}
|
|
42
39
|
content={<SlippageTooltipContent />}>
|
|
43
40
|
<InfoIcon color="gray" />
|
|
44
41
|
</Tooltip>
|
|
@@ -48,7 +45,8 @@ export function Slippage() {
|
|
|
48
45
|
const key = `slippage-${index}`;
|
|
49
46
|
return (
|
|
50
47
|
<>
|
|
51
|
-
<
|
|
48
|
+
<Chip
|
|
49
|
+
style={{ width: '64px', flexShrink: 0 }}
|
|
52
50
|
key={key}
|
|
53
51
|
onClick={() => {
|
|
54
52
|
if (customSlippage) {
|
|
@@ -59,6 +57,7 @@ export function Slippage() {
|
|
|
59
57
|
selected={!customSlippage && slippageItem === slippage}
|
|
60
58
|
label={`${slippageItem.toString()}%`}
|
|
61
59
|
/>
|
|
60
|
+
<Divider direction="horizontal" size={8} />
|
|
62
61
|
</>
|
|
63
62
|
);
|
|
64
63
|
})}
|
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
} from '@rango-dev/ui';
|
|
11
11
|
import React from 'react';
|
|
12
12
|
|
|
13
|
+
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
14
|
+
import { useNavigateBack } from '../../hooks/useNavigateBack';
|
|
13
15
|
import { SuffixContainer } from '../HeaderButtons/HeaderButtons.styles';
|
|
14
16
|
import { Layout } from '../Layout';
|
|
15
17
|
import { LoadingSwapDetails } from '../LoadingSwapDetails';
|
|
@@ -18,27 +20,28 @@ import {
|
|
|
18
20
|
Container,
|
|
19
21
|
HeaderDetails,
|
|
20
22
|
PlaceholderContainer,
|
|
21
|
-
requestIdStyles,
|
|
22
|
-
rowStyles,
|
|
23
23
|
} from './SwapDetails.styles';
|
|
24
24
|
|
|
25
25
|
export function SwapDetailsPlaceholder(props: SwapDetailsPlaceholderPropTypes) {
|
|
26
26
|
const { requestId, showSkeleton } = props;
|
|
27
|
+
const { navigateBackFrom } = useNavigateBack();
|
|
28
|
+
|
|
27
29
|
return (
|
|
28
30
|
<Layout
|
|
29
31
|
noPadding
|
|
30
32
|
header={{
|
|
31
33
|
title: i18n.t('Swap and Bridge'),
|
|
34
|
+
onBack: navigateBackFrom.bind(null, navigationRoutes.swapDetails),
|
|
32
35
|
suffix: <SuffixContainer />,
|
|
33
36
|
}}>
|
|
34
37
|
{showSkeleton && (
|
|
35
38
|
<Container>
|
|
36
39
|
<HeaderDetails>
|
|
37
|
-
<div className=
|
|
40
|
+
<div className="row">
|
|
38
41
|
<Typography variant="label" size="large" color="neutral700">
|
|
39
42
|
{`${i18n.t('Request ID')}:`}
|
|
40
43
|
</Typography>
|
|
41
|
-
<div className=
|
|
44
|
+
<div className="request-id">
|
|
42
45
|
<Typography variant="label" size="small" color="neutral700">
|
|
43
46
|
<Skeleton width={60} height={10} variant="rounded" />
|
|
44
47
|
</Typography>
|
|
@@ -47,7 +50,7 @@ export function SwapDetailsPlaceholder(props: SwapDetailsPlaceholderPropTypes) {
|
|
|
47
50
|
</IconButton>
|
|
48
51
|
</div>
|
|
49
52
|
</div>
|
|
50
|
-
<div className=
|
|
53
|
+
<div className="row">
|
|
51
54
|
<Typography variant="label" size="large" color="neutral700">
|
|
52
55
|
{`${i18n.t('Created at')}:`}
|
|
53
56
|
</Typography>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GetStep } from '../SwapDetailsAlerts';
|
|
2
|
+
import type { PendingSwapStep } from '@rango-dev/queue-manager-rango-preset';
|
|
2
3
|
import type { Step, StepDetailsProps } from '@rango-dev/ui';
|
|
3
|
-
import type { PendingSwapStep } from 'rango-types';
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { darkTheme, styled } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
3
|
export const Container = styled('div', {
|
|
4
4
|
display: 'flex',
|
|
@@ -7,6 +7,38 @@ export const Container = styled('div', {
|
|
|
7
7
|
alignItems: 'center',
|
|
8
8
|
height: '0',
|
|
9
9
|
flexGrow: 1,
|
|
10
|
+
'& .row': {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
width: '100%',
|
|
13
|
+
justifyContent: 'space-between',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
padding: '$10 $20',
|
|
16
|
+
borderBottom: '1px solid',
|
|
17
|
+
$$color: '$colors$neutral300',
|
|
18
|
+
[`.${darkTheme} &`]: {
|
|
19
|
+
$$color: '$colors$neutral400',
|
|
20
|
+
},
|
|
21
|
+
borderColor: '$$color',
|
|
22
|
+
color: '$neutral500',
|
|
23
|
+
},
|
|
24
|
+
'& .request-id': {
|
|
25
|
+
display: 'flex',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
height: '$24',
|
|
29
|
+
},
|
|
30
|
+
'& .output': {
|
|
31
|
+
display: 'flex',
|
|
32
|
+
width: '100%',
|
|
33
|
+
padding: '$15 $20 $20',
|
|
34
|
+
flexDirection: 'column',
|
|
35
|
+
alignItems: 'start',
|
|
36
|
+
},
|
|
37
|
+
'& .title-steps': {
|
|
38
|
+
textAlign: 'left',
|
|
39
|
+
width: '100%',
|
|
40
|
+
padding: '0 $20 $10',
|
|
41
|
+
},
|
|
10
42
|
});
|
|
11
43
|
|
|
12
44
|
export const HeaderDetails = styled('div', {
|
|
@@ -38,38 +70,3 @@ export const LoaderContainer = styled('div', {
|
|
|
38
70
|
paddingTop: '33%',
|
|
39
71
|
flex: 1,
|
|
40
72
|
});
|
|
41
|
-
|
|
42
|
-
export const rowStyles = css({
|
|
43
|
-
display: 'flex',
|
|
44
|
-
width: '100%',
|
|
45
|
-
justifyContent: 'space-between',
|
|
46
|
-
alignItems: 'center',
|
|
47
|
-
padding: '$10 $20',
|
|
48
|
-
borderBottom: '1px solid',
|
|
49
|
-
$$color: '$colors$neutral300',
|
|
50
|
-
[`.${darkTheme} &`]: {
|
|
51
|
-
$$color: '$colors$neutral400',
|
|
52
|
-
},
|
|
53
|
-
borderColor: '$$color',
|
|
54
|
-
color: '$neutral500',
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
export const requestIdStyles = css({
|
|
58
|
-
display: 'flex',
|
|
59
|
-
justifyContent: 'center',
|
|
60
|
-
alignItems: 'center',
|
|
61
|
-
height: '$24',
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
export const outputStyles = css({
|
|
65
|
-
display: 'flex',
|
|
66
|
-
width: '100%',
|
|
67
|
-
padding: '$15 $20 $20',
|
|
68
|
-
flexDirection: 'column',
|
|
69
|
-
alignItems: 'start',
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
export const titleStepsStyles = css({
|
|
73
|
-
width: '100%',
|
|
74
|
-
padding: '0 $20 $10',
|
|
75
|
-
});
|
|
@@ -6,22 +6,24 @@ import {
|
|
|
6
6
|
getCurrentBlockchainOfOrNull,
|
|
7
7
|
getCurrentStep,
|
|
8
8
|
getRelatedWalletOrNull,
|
|
9
|
+
PendingSwapNetworkStatus,
|
|
9
10
|
} from '@rango-dev/queue-manager-rango-preset';
|
|
10
11
|
import {
|
|
11
12
|
Button,
|
|
12
13
|
CopyIcon,
|
|
13
14
|
Divider,
|
|
14
15
|
IconButton,
|
|
15
|
-
|
|
16
|
+
RouteCost,
|
|
17
|
+
RouteSummary,
|
|
16
18
|
StepDetails,
|
|
17
19
|
Typography,
|
|
18
20
|
useCopyToClipboard,
|
|
19
21
|
} from '@rango-dev/ui';
|
|
20
22
|
import { useWallets } from '@rango-dev/wallets-react';
|
|
21
|
-
import { PendingSwapNetworkStatus } from 'rango-types';
|
|
22
23
|
import React, { useEffect, useRef, useState } from 'react';
|
|
23
24
|
import { useNavigate } from 'react-router-dom';
|
|
24
25
|
|
|
26
|
+
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
25
27
|
import {
|
|
26
28
|
GAS_FEE_MAX_DECIMALS,
|
|
27
29
|
GAS_FEE_MIN_DECIMALS,
|
|
@@ -32,54 +34,49 @@ import {
|
|
|
32
34
|
USD_VALUE_MAX_DECIMALS,
|
|
33
35
|
USD_VALUE_MIN_DECIMALS,
|
|
34
36
|
} from '../../constants/routing';
|
|
35
|
-
import {
|
|
37
|
+
import { useNavigateBack } from '../../hooks/useNavigateBack';
|
|
38
|
+
import { useBestRouteStore } from '../../store/bestRoute';
|
|
39
|
+
import { useMetaStore } from '../../store/meta';
|
|
36
40
|
import { useNotificationStore } from '../../store/notification';
|
|
37
|
-
import { useQuoteStore } from '../../store/quote';
|
|
38
41
|
import {
|
|
39
42
|
numberToString,
|
|
40
43
|
secondsToString,
|
|
41
44
|
totalArrivalTime,
|
|
42
45
|
} from '../../utils/numbers';
|
|
43
|
-
import {
|
|
46
|
+
import { getPriceImpactLevel } from '../../utils/routing';
|
|
44
47
|
import {
|
|
45
48
|
getLastConvertedTokenInFailedSwap,
|
|
49
|
+
getPercentageChange,
|
|
46
50
|
getSwapMessages,
|
|
47
51
|
shouldRetrySwap,
|
|
48
52
|
} from '../../utils/swap';
|
|
49
53
|
import { getSwapDate } from '../../utils/time';
|
|
50
|
-
import { getConciseAddress } from '../../utils/wallets';
|
|
54
|
+
import { getConciseAddress, getUsdPrice } from '../../utils/wallets';
|
|
51
55
|
import { SuffixContainer } from '../HeaderButtons/HeaderButtons.styles';
|
|
52
56
|
import { Layout } from '../Layout';
|
|
53
|
-
import { QuoteSummary } from '../Quote';
|
|
54
57
|
import {
|
|
55
58
|
SwapDetailsCompleteModal,
|
|
56
59
|
SwapDetailsModal,
|
|
57
60
|
} from '../SwapDetailsModal';
|
|
58
61
|
|
|
59
62
|
import { getSteps, getStepState, RESET_INTERVAL } from './SwapDetails.helpers';
|
|
60
|
-
import {
|
|
61
|
-
Container,
|
|
62
|
-
HeaderDetails,
|
|
63
|
-
outputStyles,
|
|
64
|
-
requestIdStyles,
|
|
65
|
-
rowStyles,
|
|
66
|
-
StepsList,
|
|
67
|
-
titleStepsStyles,
|
|
68
|
-
} from './SwapDetails.styles';
|
|
63
|
+
import { Container, HeaderDetails, StepsList } from './SwapDetails.styles';
|
|
69
64
|
|
|
70
65
|
export function SwapDetails(props: SwapDetailsProps) {
|
|
71
66
|
const { swap, requestId, onDelete, onCancel: onCancelProps } = props;
|
|
72
67
|
const { canSwitchNetworkTo, connect, getWalletInfo } = useWallets();
|
|
73
|
-
const
|
|
74
|
-
const tokens = useAppStore().tokens();
|
|
75
|
-
const retry = useQuoteStore.use.retry();
|
|
68
|
+
const retry = useBestRouteStore.use.retry();
|
|
76
69
|
const navigate = useNavigate();
|
|
70
|
+
const { navigateBackFrom } = useNavigateBack();
|
|
77
71
|
const [_, handleCopy] = useCopyToClipboard(RESET_INTERVAL);
|
|
78
72
|
const listRef = useRef<HTMLDivElement | null>(null);
|
|
79
73
|
const [modalState, setModalState] = useState<ModalState>(null);
|
|
80
74
|
const [showCompletedModal, setShowCompletedModal] = useState<
|
|
81
75
|
'success' | 'failed' | null
|
|
82
76
|
>(null);
|
|
77
|
+
const {
|
|
78
|
+
meta: { tokens, blockchains },
|
|
79
|
+
} = useMetaStore();
|
|
83
80
|
|
|
84
81
|
const onCancel = () => {
|
|
85
82
|
onCancelProps();
|
|
@@ -154,7 +151,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
154
151
|
showNetworkModal: currentStepNetworkStatus,
|
|
155
152
|
setNetworkModal: setModalState,
|
|
156
153
|
message: stepMessage,
|
|
157
|
-
blockchains
|
|
154
|
+
blockchains,
|
|
158
155
|
});
|
|
159
156
|
const numberOfSteps = steps.length;
|
|
160
157
|
const [firstStep, lastStep] = [swap.steps[0], swap.steps[numberOfSteps - 1]];
|
|
@@ -171,24 +168,40 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
171
168
|
)?.diagnosisUrl;
|
|
172
169
|
|
|
173
170
|
const outputUsdValue = numberToString(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
171
|
+
String(
|
|
172
|
+
parseFloat(
|
|
173
|
+
numberToString(
|
|
174
|
+
outputAmount,
|
|
175
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
176
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
177
|
+
)
|
|
178
|
+
) *
|
|
179
|
+
(getUsdPrice(
|
|
180
|
+
lastStep.toBlockchain,
|
|
181
|
+
lastStep.toSymbol,
|
|
182
|
+
lastStep.toSymbolAddress,
|
|
183
|
+
tokens
|
|
184
|
+
) || 0)
|
|
185
|
+
),
|
|
181
186
|
USD_VALUE_MIN_DECIMALS,
|
|
182
187
|
USD_VALUE_MAX_DECIMALS
|
|
183
188
|
);
|
|
184
189
|
|
|
185
190
|
const inputUsdValue = numberToString(
|
|
186
|
-
|
|
191
|
+
String(
|
|
192
|
+
parseFloat(swap.inputAmount) *
|
|
193
|
+
(getUsdPrice(
|
|
194
|
+
firstStep.fromBlockchain,
|
|
195
|
+
firstStep.fromSymbol,
|
|
196
|
+
firstStep.fromSymbolAddress,
|
|
197
|
+
tokens
|
|
198
|
+
) || 0)
|
|
199
|
+
),
|
|
187
200
|
USD_VALUE_MIN_DECIMALS,
|
|
188
201
|
USD_VALUE_MAX_DECIMALS
|
|
189
202
|
);
|
|
190
203
|
|
|
191
|
-
const percentageChange =
|
|
204
|
+
const percentageChange = getPercentageChange(inputUsdValue, outputUsdValue);
|
|
192
205
|
|
|
193
206
|
const completeModalDesc =
|
|
194
207
|
swap.status === 'success'
|
|
@@ -226,6 +239,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
226
239
|
noPadding
|
|
227
240
|
header={{
|
|
228
241
|
title: i18n.t('Swap and Bridge'),
|
|
242
|
+
onBack: navigateBackFrom.bind(null, navigationRoutes.swapDetails),
|
|
229
243
|
onCancel:
|
|
230
244
|
swap.status === 'running' ? () => setModalState('cancel') : undefined,
|
|
231
245
|
suffix: swap.status !== 'running' && (
|
|
@@ -251,10 +265,9 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
251
265
|
type="primary"
|
|
252
266
|
size="large"
|
|
253
267
|
onClick={() => {
|
|
254
|
-
retry(swap
|
|
268
|
+
retry(swap);
|
|
255
269
|
setTimeout(() => {
|
|
256
|
-
|
|
257
|
-
navigate(home);
|
|
270
|
+
navigate(navigationRoutes.home);
|
|
258
271
|
}, 0);
|
|
259
272
|
}}>
|
|
260
273
|
{i18n.t('Try again')}
|
|
@@ -263,11 +276,11 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
263
276
|
}>
|
|
264
277
|
<Container>
|
|
265
278
|
<HeaderDetails>
|
|
266
|
-
<div className=
|
|
279
|
+
<div className="row">
|
|
267
280
|
<Typography variant="label" size="large" color="neutral700">
|
|
268
281
|
{`${i18n.t('Request ID')}:`}
|
|
269
282
|
</Typography>
|
|
270
|
-
<div className=
|
|
283
|
+
<div className="request-id">
|
|
271
284
|
<Typography variant="label" size="small" color="neutral700">
|
|
272
285
|
{requestId}
|
|
273
286
|
</Typography>
|
|
@@ -278,7 +291,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
278
291
|
</IconButton>
|
|
279
292
|
</div>
|
|
280
293
|
</div>
|
|
281
|
-
<div className=
|
|
294
|
+
<div className="row">
|
|
282
295
|
<Typography variant="label" size="large" color="neutral700">
|
|
283
296
|
{`${i18n.t('Created at')}:`}
|
|
284
297
|
</Typography>
|
|
@@ -288,8 +301,8 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
288
301
|
</div>
|
|
289
302
|
</HeaderDetails>
|
|
290
303
|
|
|
291
|
-
<div className=
|
|
292
|
-
<
|
|
304
|
+
<div className="output">
|
|
305
|
+
<RouteCost
|
|
293
306
|
fee={numberToString(
|
|
294
307
|
String(totalFee),
|
|
295
308
|
GAS_FEE_MIN_DECIMALS,
|
|
@@ -298,7 +311,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
298
311
|
time={secondsToString(totalArrivalTime(swap.steps))}
|
|
299
312
|
steps={numberOfSteps}
|
|
300
313
|
/>
|
|
301
|
-
<
|
|
314
|
+
<RouteSummary
|
|
302
315
|
from={{
|
|
303
316
|
price: {
|
|
304
317
|
value: numberToString(
|
|
@@ -340,10 +353,12 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
340
353
|
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
341
354
|
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
342
355
|
)}
|
|
343
|
-
warningLevel={getPriceImpactLevel(
|
|
356
|
+
warningLevel={getPriceImpactLevel(
|
|
357
|
+
percentageChange?.toNumber() ?? 0
|
|
358
|
+
)}
|
|
344
359
|
/>
|
|
345
360
|
</div>
|
|
346
|
-
<div className=
|
|
361
|
+
<div className="title-steps">
|
|
347
362
|
<Typography variant="title" size="small">
|
|
348
363
|
{i18n.t('Swaps steps')}
|
|
349
364
|
</Typography>
|
|
@@ -362,7 +377,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
362
377
|
<StepDetails
|
|
363
378
|
key={key}
|
|
364
379
|
step={step}
|
|
365
|
-
type="
|
|
380
|
+
type="route-progress"
|
|
366
381
|
ref={listRef}
|
|
367
382
|
state={state}
|
|
368
383
|
hasSeparator={index !== 0}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { WaningAlertsProps } from './SwapDetailsAlerts.types';
|
|
2
2
|
|
|
3
3
|
import { i18n } from '@lingui/core';
|
|
4
|
+
import { PendingSwapNetworkStatus } from '@rango-dev/queue-manager-rango-preset';
|
|
4
5
|
import { Alert, Button } from '@rango-dev/ui';
|
|
5
|
-
import { PendingSwapNetworkStatus } from 'rango-types';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
export function WarningAlert(props: WaningAlertsProps) {
|
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { useNavigate } from 'react-router-dom';
|
|
14
14
|
|
|
15
|
+
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
16
|
+
|
|
15
17
|
export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
|
|
16
18
|
const {
|
|
17
19
|
open,
|
|
@@ -68,10 +70,7 @@ export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
|
|
|
68
70
|
variant="contained"
|
|
69
71
|
type="primary"
|
|
70
72
|
size="large"
|
|
71
|
-
onClick={() =>
|
|
72
|
-
const home = '../../';
|
|
73
|
-
navigate(home);
|
|
74
|
-
}}>
|
|
73
|
+
onClick={() => navigate(navigationRoutes.home)}>
|
|
75
74
|
<Typography variant="title" size="medium" color="neutral100">
|
|
76
75
|
{i18n.t('Done')}
|
|
77
76
|
</Typography>
|
|
@@ -10,8 +10,8 @@ export const CancelContent = ({ onCancel, onClose }: CancelContentProps) => {
|
|
|
10
10
|
<Divider size={20} />
|
|
11
11
|
<MessageBox
|
|
12
12
|
type="error"
|
|
13
|
-
title={i18n.t('Cancel
|
|
14
|
-
description={i18n.t('Are you sure you want to
|
|
13
|
+
title={i18n.t('Transaction Cancel')}
|
|
14
|
+
description={i18n.t('Are you sure you want to Cancel this swap?')}
|
|
15
15
|
/>
|
|
16
16
|
<Divider size={32} />
|
|
17
17
|
<Button
|