@rango-dev/widget-embedded 0.12.1-next.6 → 0.12.1-next.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Wallets.d.ts +4 -3
- package/dist/Wallets.d.ts.map +1 -1
- package/dist/Widget.d.ts +3 -2
- package/dist/Widget.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts +1 -1
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.d.ts +4 -0
- package/dist/components/BlockchainList/BlockchainList.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts +4 -0
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts +297 -0
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.types.d.ts +8 -0
- package/dist/components/BlockchainList/BlockchainList.types.d.ts.map +1 -0
- package/dist/components/BlockchainList/LoadingBlockchainList.d.ts +3 -0
- package/dist/components/BlockchainList/LoadingBlockchainList.d.ts.map +1 -0
- package/dist/components/BlockchainList/index.d.ts +2 -0
- package/dist/components/BlockchainList/index.d.ts.map +1 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.d.ts +5 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.d.ts.map +1 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts +151 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts.map +1 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts +6 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts.map +1 -0
- package/dist/components/BlockchainsChip/index.d.ts +2 -0
- package/dist/components/BlockchainsChip/index.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts +3 -0
- package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.d.ts +4 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +149 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.types.d.ts +9 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.types.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/index.d.ts +2 -0
- package/dist/components/BlockchainsSection/index.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +6 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +2522 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts +4 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +11 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts +4 -0
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +445 -0
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +12 -0
- package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -0
- package/dist/components/HeaderButtons/BackButton.d.ts +5 -0
- package/dist/components/HeaderButtons/BackButton.d.ts.map +1 -0
- package/dist/components/HeaderButtons/CancelButton.d.ts +5 -0
- package/dist/components/HeaderButtons/CancelButton.d.ts.map +1 -0
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +875 -0
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -0
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +12 -0
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -0
- package/dist/components/HeaderButtons/HomeButtons.d.ts +4 -0
- package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -0
- package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts +3 -0
- package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts.map +1 -0
- package/dist/components/HeaderButtons/WalletButton.d.ts +5 -0
- package/dist/components/HeaderButtons/WalletButton.d.ts.map +1 -0
- package/dist/components/HeaderButtons/index.d.ts +5 -0
- package/dist/components/HeaderButtons/index.d.ts.map +1 -0
- package/dist/components/Layout/Layout.d.ts +7 -0
- package/dist/components/Layout/Layout.d.ts.map +1 -0
- package/dist/components/Layout/Layout.styles.d.ts +449 -0
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -0
- package/dist/components/Layout/Layout.types.d.ts +17 -0
- package/dist/components/Layout/Layout.types.d.ts.map +1 -0
- package/dist/components/Layout/index.d.ts +2 -0
- package/dist/components/Layout/index.d.ts.map +1 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.d.ts +3 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.d.ts.map +1 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +150 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -0
- package/dist/components/LoadingLiquiditySourceList/index.d.ts +2 -0
- package/dist/components/LoadingLiquiditySourceList/index.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/NoRoutes/NoRoutes.styles.d.ts +445 -0
- package/dist/components/NoRoutes/NoRoutes.styles.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.types.d.ts +20 -0
- 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 +3 -0
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -0
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts +593 -0
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -0
- package/dist/components/NotificationContent/NotificationNotFound.d.ts +3 -0
- package/dist/components/NotificationContent/NotificationNotFound.d.ts.map +1 -0
- package/dist/components/NotificationContent/index.d.ts +2 -0
- package/dist/components/NotificationContent/index.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrors.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts +593 -0
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrors.types.d.ts +22 -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/SearchInput/SearchInput.d.ts +4 -0
- package/dist/components/SearchInput/SearchInput.d.ts.map +1 -0
- package/dist/components/SearchInput/SearchInput.styles.d.ts +149 -0
- package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -0
- package/dist/components/SearchInput/SearchInput.types.d.ts +10 -0
- package/dist/components/SearchInput/SearchInput.types.d.ts.map +1 -0
- package/dist/components/SearchInput/index.d.ts +2 -0
- package/dist/components/SearchInput/index.d.ts.map +1 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts +4 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts.map +1 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts +4 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts.map +1 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts +445 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts.map +1 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts +12 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts.map +1 -0
- package/dist/components/SelectableCategoryList/index.d.ts +2 -0
- package/dist/components/SelectableCategoryList/index.d.ts.map +1 -0
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +741 -0
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -0
- package/dist/components/SettingsContainer/index.d.ts +2 -0
- package/dist/components/SettingsContainer/index.d.ts.map +1 -0
- package/dist/components/Slippage/Slippage.d.ts +3 -0
- package/dist/components/Slippage/Slippage.d.ts.map +1 -0
- package/dist/components/Slippage/Slippage.styles.d.ts +593 -0
- package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -0
- package/dist/components/Slippage/SlippageTooltipContent.d.ts +3 -0
- package/dist/components/Slippage/SlippageTooltipContent.d.ts.map +1 -0
- package/dist/components/Slippage/index.d.ts +2 -0
- package/dist/components/Slippage/index.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts +4 -0
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.d.ts +4 -0
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +15 -0
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +1037 -0
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.types.d.ts +12 -0
- package/dist/components/SwapDetails/SwapDetails.types.d.ts.map +1 -0
- package/dist/components/SwapDetails/index.d.ts +2 -0
- package/dist/components/SwapDetails/index.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.d.ts +4 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.d.ts +4 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts +4 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +149 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +20 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/index.d.ts +3 -0
- package/dist/components/SwapDetailsAlerts/index.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Cancel.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Cancel.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Delete.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Delete.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +149 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +45 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/index.d.ts +4 -0
- package/dist/components/SwapDetailsModal/index.d.ts.map +1 -0
- package/dist/components/SwapsGroup/SwapsGroup.d.ts +4 -0
- package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -0
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +593 -0
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -0
- package/dist/components/SwapsGroup/SwapsGroup.types.d.ts +12 -0
- package/dist/components/SwapsGroup/SwapsGroup.types.d.ts.map +1 -0
- package/dist/components/SwapsGroup/index.d.ts +2 -0
- package/dist/components/SwapsGroup/index.d.ts.map +1 -0
- package/dist/components/SwitchFromAndTo.d.ts +1 -1
- package/dist/components/SwitchFromAndTo.d.ts.map +1 -1
- package/dist/components/TokenList/LoadingTokenList.d.ts +4 -0
- package/dist/components/TokenList/LoadingTokenList.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.d.ts +4 -0
- package/dist/components/TokenList/TokenList.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.helpers.d.ts +3 -0
- package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.styles.d.ts +1334 -0
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.types.d.ts +40 -0
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -0
- package/dist/components/TokenList/index.d.ts +3 -0
- package/dist/components/TokenList/index.d.ts.map +1 -0
- package/dist/components/UpdateUrl.d.ts.map +1 -1
- package/dist/components/WalletModal/WalletModal.d.ts +4 -0
- package/dist/components/WalletModal/WalletModal.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModal.types.d.ts +10 -0
- package/dist/components/WalletModal/WalletModal.types.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModalContent.d.ts +4 -0
- package/dist/components/WalletModal/WalletModalContent.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts +593 -0
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -0
- package/dist/components/WalletModal/index.d.ts +2 -0
- package/dist/components/WalletModal/index.d.ts.map +1 -0
- package/dist/components/WidgetEvents.d.ts.map +1 -1
- package/dist/constants/errors.d.ts +29 -0
- package/dist/constants/errors.d.ts.map +1 -1
- package/dist/constants/messages.d.ts +7 -0
- package/dist/constants/messages.d.ts.map +1 -0
- package/dist/constants/navigationRoutes.d.ts +8 -4
- package/dist/constants/navigationRoutes.d.ts.map +1 -1
- package/dist/constants/routing.d.ts +3 -0
- package/dist/constants/routing.d.ts.map +1 -0
- package/dist/constants/searchParams.d.ts +2 -2
- package/dist/constants/searchParams.d.ts.map +1 -1
- package/dist/constants/swapSettings.d.ts.map +1 -1
- package/dist/constants/wallets.d.ts +3 -0
- package/dist/constants/wallets.d.ts.map +1 -0
- package/dist/constants/warnings.d.ts +3 -0
- package/dist/constants/warnings.d.ts.map +1 -0
- package/dist/hooks/useConfirmSwap.d.ts +14 -6
- package/dist/hooks/useConfirmSwap.d.ts.map +1 -1
- package/dist/hooks/useFetchBestRoute.d.ts +9 -0
- package/dist/hooks/useFetchBestRoute.d.ts.map +1 -0
- package/dist/hooks/useNavigateBack.d.ts.map +1 -1
- package/dist/hooks/useSwapInput.d.ts +12 -0
- package/dist/hooks/useSwapInput.d.ts.map +1 -0
- package/dist/hooks/useTheme.d.ts +3 -26
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts +20 -0
- package/dist/hooks/useWalletList.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts +6 -3
- 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 +3 -0
- package/dist/pages/LanguagePage.d.ts.map +1 -0
- package/dist/pages/LiquiditySourcePage.d.ts +8 -0
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -0
- package/dist/pages/SelectBlockchainPage.d.ts +8 -0
- package/dist/pages/SelectBlockchainPage.d.ts.map +1 -0
- package/dist/pages/SelectSwapItemsPage.d.ts +11 -0
- package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -0
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
- package/dist/pages/ThemePage.d.ts +3 -0
- package/dist/pages/ThemePage.d.ts.map +1 -0
- package/dist/pages/WalletsPage.d.ts +4 -2
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/bestRoute.d.ts +32 -19
- package/dist/store/bestRoute.d.ts.map +1 -1
- package/dist/store/meta.d.ts +10 -3
- package/dist/store/meta.d.ts.map +1 -1
- package/dist/store/notification.d.ts +38 -0
- package/dist/store/notification.d.ts.map +1 -0
- package/dist/store/settings.d.ts +2 -2
- package/dist/store/settings.d.ts.map +1 -1
- package/dist/store/ui.d.ts +0 -2
- package/dist/store/ui.d.ts.map +1 -1
- package/dist/store/wallets.d.ts +14 -12
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +8 -6
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/notification.d.ts +22 -0
- package/dist/types/notification.d.ts.map +1 -0
- package/dist/types/routing.d.ts +30 -23
- package/dist/types/routing.d.ts.map +1 -1
- package/dist/types/swap.d.ts +8 -1
- package/dist/types/swap.d.ts.map +1 -1
- package/dist/utils/common.d.ts +5 -0
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/date.d.ts +1 -1
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +3 -0
- package/dist/utils/meta.d.ts.map +1 -0
- package/dist/utils/numbers.d.ts +2 -1
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/routing.d.ts +5 -5
- package/dist/utils/routing.d.ts.map +1 -1
- package/dist/utils/settings.d.ts +10 -0
- package/dist/utils/settings.d.ts.map +1 -0
- package/dist/utils/swap.d.ts +28 -13
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +20 -14
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/Wallets.tsx +23 -17
- package/src/Widget.tsx +21 -27
- package/src/components/AppRoutes.tsx +54 -19
- package/src/components/BlockchainList/BlockchainList.helpers.ts +37 -0
- package/src/components/BlockchainList/BlockchainList.styles.ts +18 -0
- package/src/components/BlockchainList/BlockchainList.tsx +76 -0
- package/src/components/BlockchainList/BlockchainList.types.ts +8 -0
- package/src/components/BlockchainList/LoadingBlockchainList.tsx +20 -0
- package/src/components/BlockchainList/index.ts +1 -0
- package/src/components/BlockchainsChip/BlockchainsChip.styles.ts +30 -0
- package/src/components/BlockchainsChip/BlockchainsChip.tsx +15 -0
- package/src/components/BlockchainsChip/BlockchainsChip.types.ts +4 -0
- package/src/components/BlockchainsChip/index.ts +1 -0
- package/src/components/BlockchainsSection/BlockchainSection.helpers.ts +20 -0
- package/src/components/BlockchainsSection/BlockchainsSection.styles.ts +7 -0
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +100 -0
- package/src/components/BlockchainsSection/BlockchainsSection.types.ts +9 -0
- package/src/components/BlockchainsSection/index.ts +1 -0
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +64 -0
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +169 -0
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +451 -0
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +11 -0
- package/src/components/ConfirmWalletsModal/WalletList.styles.ts +34 -0
- package/src/components/ConfirmWalletsModal/WalletList.tsx +250 -0
- package/src/components/ConfirmWalletsModal/WalletList.type.ts +12 -0
- package/src/components/HeaderButtons/BackButton.tsx +16 -0
- package/src/components/HeaderButtons/CancelButton.tsx +21 -0
- package/src/components/HeaderButtons/HeaderButtons.styles.ts +40 -0
- package/src/components/HeaderButtons/HeaderButtons.types.ts +11 -0
- package/src/components/HeaderButtons/HomeButtons.tsx +68 -0
- package/src/components/HeaderButtons/UnreadNotificationsBadge.tsx +21 -0
- package/src/components/HeaderButtons/WalletButton.tsx +20 -0
- package/src/components/HeaderButtons/index.ts +4 -0
- package/src/components/Layout/Layout.styles.ts +51 -0
- package/src/components/Layout/Layout.tsx +89 -0
- package/src/components/Layout/Layout.types.ts +20 -0
- package/src/components/Layout/index.ts +1 -0
- package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.ts +5 -0
- package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.tsx +23 -0
- package/src/components/LoadingLiquiditySourceList/index.ts +1 -0
- package/src/components/NoRoutes/NoRoutes.helper.ts +50 -0
- package/src/components/NoRoutes/NoRoutes.styles.ts +15 -0
- package/src/components/NoRoutes/NoRoutes.tsx +81 -0
- package/src/components/NoRoutes/NoRoutes.types.ts +21 -0
- package/src/components/NoRoutes/index.ts +1 -0
- package/src/components/NotificationContent/NotificationContent.styles.ts +34 -0
- package/src/components/NotificationContent/NotificationContent.tsx +112 -0
- package/src/components/NotificationContent/NotificationNotFound.tsx +17 -0
- package/src/components/NotificationContent/index.ts +1 -0
- package/src/components/RouteErrors/RouteErrors.styles.ts +27 -0
- package/src/components/RouteErrors/RouteErrors.tsx +68 -0
- package/src/components/RouteErrors/RouteErrors.types.ts +27 -0
- package/src/components/RouteErrors/RouteErrorsModal.tsx +101 -0
- package/src/components/RouteErrors/RouteErrorsModalItem.tsx +24 -0
- package/src/components/RouteErrors/index.ts +1 -0
- package/src/components/SearchInput/SearchInput.styles.ts +9 -0
- package/src/components/SearchInput/SearchInput.tsx +51 -0
- package/src/components/SearchInput/SearchInput.types.ts +10 -0
- package/src/components/SearchInput/index.ts +1 -0
- package/src/components/SelectableCategoryList/SelectableCategoryList.helpers.ts +20 -0
- package/src/components/SelectableCategoryList/SelectableCategoryList.styles.ts +21 -0
- package/src/components/SelectableCategoryList/SelectableCategoryList.tsx +79 -0
- package/src/components/SelectableCategoryList/SelectableCategoryList.types.ts +12 -0
- package/src/components/SelectableCategoryList/index.ts +1 -0
- package/src/components/SettingsContainer/SettingsContainer.style.ts +33 -0
- package/src/components/SettingsContainer/index.ts +7 -0
- package/src/components/Slippage/Slippage.styles.ts +24 -0
- package/src/components/Slippage/Slippage.tsx +90 -0
- package/src/components/Slippage/SlippageTooltipContent.tsx +23 -0
- package/src/components/Slippage/index.ts +1 -0
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +43 -0
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +102 -0
- package/src/components/SwapDetails/SwapDetails.styles.ts +76 -0
- package/src/components/SwapDetails/SwapDetails.tsx +387 -0
- package/src/components/SwapDetails/SwapDetails.types.ts +12 -0
- package/src/components/SwapDetails/index.ts +1 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.tsx +36 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.tsx +55 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.ts +7 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.tsx +74 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +28 -0
- package/src/components/SwapDetailsAlerts/index.ts +2 -0
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +101 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +34 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.Delete.tsx +34 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +35 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.helpers.tsx +22 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.styles.ts +6 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +42 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +53 -0
- package/src/components/SwapDetailsModal/index.ts +3 -0
- package/src/components/SwapsGroup/SwapsGroup.styles.ts +26 -0
- package/src/components/SwapsGroup/SwapsGroup.tsx +125 -0
- package/src/components/SwapsGroup/SwapsGroup.types.ts +13 -0
- package/src/components/SwapsGroup/index.ts +1 -0
- package/src/components/SwitchFromAndTo.tsx +24 -8
- package/src/components/TokenList/LoadingTokenList.tsx +34 -0
- package/src/components/TokenList/TokenList.helpers.ts +13 -0
- package/src/components/TokenList/TokenList.styles.ts +115 -0
- package/src/components/TokenList/TokenList.tsx +269 -0
- package/src/components/TokenList/TokenList.types.ts +47 -0
- package/src/components/TokenList/index.ts +2 -0
- package/src/components/UpdateUrl.tsx +40 -22
- package/src/components/WalletModal/WalletModal.tsx +20 -0
- package/src/components/WalletModal/WalletModal.types.ts +11 -0
- package/src/components/WalletModal/WalletModalContent.styles.ts +44 -0
- package/src/components/WalletModal/WalletModalContent.tsx +54 -0
- package/src/components/WalletModal/index.ts +1 -0
- package/src/components/WidgetEvents.tsx +30 -4
- package/src/constants/errors.ts +56 -1
- package/src/constants/messages.ts +8 -0
- package/src/constants/navigationRoutes.ts +8 -4
- package/src/constants/routing.ts +2 -0
- package/src/constants/searchParams.ts +2 -2
- package/src/constants/swapSettings.ts +5 -1
- package/src/constants/wallets.ts +3 -0
- package/src/constants/warnings.ts +26 -0
- package/src/hooks/useConfirmSwap.ts +251 -220
- package/src/hooks/useFetchBestRoute.ts +38 -0
- package/src/hooks/useNavigateBack.ts +15 -9
- package/src/hooks/useSwapInput.ts +102 -0
- package/src/hooks/useTheme.ts +59 -60
- package/src/hooks/useWalletList.ts +125 -0
- package/src/pages/ConfirmSwapPage.tsx +470 -228
- package/src/pages/HistoryPage.tsx +104 -15
- package/src/pages/Home.tsx +345 -111
- package/src/pages/LanguagePage.tsx +83 -0
- package/src/pages/LiquiditySourcePage.tsx +160 -0
- package/src/pages/SelectBlockchainPage.tsx +77 -0
- package/src/pages/SelectSwapItemsPage.tsx +153 -0
- package/src/pages/SettingsPage.tsx +144 -72
- package/src/pages/SwapDetailsPage.tsx +35 -143
- package/src/pages/ThemePage.tsx +96 -0
- package/src/pages/WalletsPage.tsx +73 -124
- package/src/store/bestRoute.ts +85 -180
- package/src/store/meta.ts +23 -3
- package/src/store/notification.ts +77 -0
- package/src/store/settings.ts +20 -13
- package/src/store/ui.ts +1 -5
- package/src/store/wallets.ts +92 -76
- package/src/types/config.ts +9 -7
- package/src/types/notification.ts +33 -0
- package/src/types/routing.ts +29 -28
- package/src/types/swap.ts +9 -1
- package/src/utils/common.ts +53 -3
- package/src/utils/date.ts +15 -18
- package/src/utils/meta.ts +9 -0
- package/src/utils/numbers.ts +63 -18
- package/src/utils/routing.ts +30 -14
- package/src/utils/settings.ts +57 -0
- package/src/utils/swap.ts +166 -95
- package/src/utils/wallets.ts +159 -110
- package/dist/components/ConfirmSwapErrors.d.ts +0 -4
- package/dist/components/ConfirmSwapErrors.d.ts.map +0 -1
- package/dist/components/ConfirmSwapWarnings.d.ts +0 -3
- package/dist/components/ConfirmSwapWarnings.d.ts.map +0 -1
- package/dist/components/Layout.d.ts +0 -7
- package/dist/components/Layout.d.ts.map +0 -1
- package/dist/pages/LiquiditySourcesPage.d.ts +0 -7
- package/dist/pages/LiquiditySourcesPage.d.ts.map +0 -1
- package/dist/pages/SelectChainPage.d.ts +0 -8
- package/dist/pages/SelectChainPage.d.ts.map +0 -1
- package/dist/pages/SelectTokenPage.d.ts +0 -15
- package/dist/pages/SelectTokenPage.d.ts.map +0 -1
- package/src/components/ConfirmSwapErrors.tsx +0 -34
- package/src/components/ConfirmSwapWarnings.tsx +0 -22
- package/src/components/Layout.tsx +0 -105
- package/src/pages/LiquiditySourcesPage.tsx +0 -63
- package/src/pages/SelectChainPage.tsx +0 -42
- package/src/pages/SelectTokenPage.tsx +0 -64
|
@@ -1,32 +1,121 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
2
|
+
import type { PendingSwapStep } from 'rango-types';
|
|
3
|
+
|
|
4
|
+
import { i18n } from '@lingui/core';
|
|
2
5
|
import { useManager } from '@rango-dev/queue-manager-react';
|
|
3
|
-
import
|
|
6
|
+
import { Divider, NotFound, styled } from '@rango-dev/ui';
|
|
7
|
+
import React, { useState } from 'react';
|
|
4
8
|
import { useNavigate } from 'react-router-dom';
|
|
9
|
+
|
|
10
|
+
import { Layout } from '../components/Layout';
|
|
11
|
+
import { SearchInput } from '../components/SearchInput';
|
|
12
|
+
import { SwapsGroup } from '../components/SwapsGroup';
|
|
13
|
+
import { NotFoundContainer } from '../components/SwapsGroup/SwapsGroup.styles';
|
|
5
14
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
6
15
|
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
7
|
-
import { getPendingSwaps } from '../utils/queue';
|
|
8
16
|
import { useUiStore } from '../store/ui';
|
|
9
17
|
import { groupSwapsByDate } from '../utils/date';
|
|
18
|
+
import { containsText } from '../utils/numbers';
|
|
19
|
+
import { getPendingSwaps } from '../utils/queue';
|
|
20
|
+
|
|
21
|
+
const Container = styled('div', {
|
|
22
|
+
display: 'flex',
|
|
23
|
+
flexDirection: 'column',
|
|
24
|
+
alignItems: 'flex-start',
|
|
25
|
+
height: '100%',
|
|
26
|
+
gap: 15,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const SwapsGroupContainer = styled('div', {
|
|
30
|
+
overflowY: 'visible',
|
|
31
|
+
width: '100%',
|
|
32
|
+
display: 'flex',
|
|
33
|
+
flexDirection: 'column',
|
|
34
|
+
gap: 15,
|
|
35
|
+
height: '100%',
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const isStepContainsText = (steps: PendingSwapStep[], value: string) => {
|
|
39
|
+
if (!steps?.length) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return steps.filter(
|
|
43
|
+
(step) =>
|
|
44
|
+
containsText(step.fromBlockchain, value) ||
|
|
45
|
+
containsText(step.toBlockchain, value) ||
|
|
46
|
+
containsText(step.toSymbol, value) ||
|
|
47
|
+
containsText(step.fromSymbol, value)
|
|
48
|
+
).length;
|
|
49
|
+
};
|
|
10
50
|
|
|
11
51
|
export function HistoryPage() {
|
|
12
52
|
const setSelectedSwap = useUiStore.use.setSelectedSwap();
|
|
13
53
|
const navigate = useNavigate();
|
|
14
54
|
const { navigateBackFrom } = useNavigateBack();
|
|
15
55
|
const { manager, state } = useManager();
|
|
16
|
-
const
|
|
17
|
-
|
|
56
|
+
const list: PendingSwap[] = getPendingSwaps(manager).map(({ swap }) => swap);
|
|
57
|
+
const [searchedFor, setSearchedFor] = useState<string>('');
|
|
18
58
|
const loading = !state.loadedFromPersistor;
|
|
19
59
|
|
|
60
|
+
const searchHandler = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
61
|
+
const value = event.target.value;
|
|
62
|
+
setSearchedFor(value);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
let filteredList = list;
|
|
66
|
+
if (searchedFor) {
|
|
67
|
+
filteredList = list.filter(
|
|
68
|
+
(swap) =>
|
|
69
|
+
containsText(swap.inputAmount, searchedFor) ||
|
|
70
|
+
containsText(swap.status, searchedFor) ||
|
|
71
|
+
isStepContainsText(swap.steps, searchedFor) ||
|
|
72
|
+
containsText(swap.requestId, searchedFor)
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const isEmpty = !filteredList?.length && !loading;
|
|
77
|
+
|
|
20
78
|
return (
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
79
|
+
<Layout
|
|
80
|
+
header={{
|
|
81
|
+
onBack: navigateBackFrom.bind(null, '/' + navigationRoutes.swaps),
|
|
82
|
+
title: i18n.t('History'),
|
|
83
|
+
}}>
|
|
84
|
+
<Container>
|
|
85
|
+
<SearchInput
|
|
86
|
+
setValue={setSearchedFor}
|
|
87
|
+
fullWidth
|
|
88
|
+
variant="contained"
|
|
89
|
+
placeholder="Search Transaction"
|
|
90
|
+
autoFocus
|
|
91
|
+
onChange={searchHandler}
|
|
92
|
+
value={searchedFor}
|
|
93
|
+
/>
|
|
94
|
+
<SwapsGroupContainer>
|
|
95
|
+
{isEmpty && (
|
|
96
|
+
<NotFoundContainer>
|
|
97
|
+
<Divider size={32} />
|
|
98
|
+
<NotFound
|
|
99
|
+
title={i18n.t('No results found')}
|
|
100
|
+
description={
|
|
101
|
+
searchedFor ? i18n.t('Try using different keywords') : ''
|
|
102
|
+
}
|
|
103
|
+
/>
|
|
104
|
+
</NotFoundContainer>
|
|
105
|
+
)}
|
|
106
|
+
{!isEmpty && (
|
|
107
|
+
<SwapsGroup
|
|
108
|
+
list={filteredList}
|
|
109
|
+
onSwapClick={(requestId) => {
|
|
110
|
+
setSelectedSwap(requestId);
|
|
111
|
+
navigate(`${requestId}`, { replace: true });
|
|
112
|
+
}}
|
|
113
|
+
groupBy={groupSwapsByDate}
|
|
114
|
+
isLoading={loading}
|
|
115
|
+
/>
|
|
116
|
+
)}
|
|
117
|
+
</SwapsGroupContainer>
|
|
118
|
+
</Container>
|
|
119
|
+
</Layout>
|
|
31
120
|
);
|
|
32
121
|
}
|
package/src/pages/Home.tsx
CHANGED
|
@@ -1,76 +1,144 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { SwapResult } from 'rango-sdk';
|
|
2
|
+
|
|
3
|
+
import { i18n } from '@lingui/core';
|
|
4
|
+
import {
|
|
5
|
+
Alert,
|
|
6
|
+
BestRoute,
|
|
7
|
+
BestRouteSkeleton,
|
|
8
|
+
Button,
|
|
9
|
+
Divider,
|
|
10
|
+
styled,
|
|
11
|
+
SwapInput,
|
|
12
|
+
Typography,
|
|
13
|
+
WarningIcon,
|
|
14
|
+
} from '@rango-dev/ui';
|
|
15
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
16
|
import { useNavigate } from 'react-router-dom';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
17
|
+
|
|
18
|
+
import { HomeButtons } from '../components/HeaderButtons';
|
|
19
|
+
import { Layout } from '../components/Layout';
|
|
20
|
+
import { NoRoutes } from '../components/NoRoutes';
|
|
21
|
+
import { RouteErrors } from '../components/RouteErrors';
|
|
22
|
+
import { SwitchFromAndToButton } from '../components/SwitchFromAndTo';
|
|
23
|
+
import { errorMessages } from '../constants/errors';
|
|
6
24
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
25
|
+
import { useSwapInput } from '../hooks/useSwapInput';
|
|
26
|
+
import { useBestRouteStore } from '../store/bestRoute';
|
|
7
27
|
import { useMetaStore } from '../store/meta';
|
|
8
|
-
import { useWalletsStore } from '../store/wallets';
|
|
9
|
-
import { errorMessages } from '../constants/errors';
|
|
10
|
-
import {
|
|
11
|
-
getSwapButtonState,
|
|
12
|
-
getOutputRatio,
|
|
13
|
-
hasLimitError,
|
|
14
|
-
outputRatioHasWarning,
|
|
15
|
-
canComputePriceImpact,
|
|
16
|
-
LimitErrorMessage,
|
|
17
|
-
getTotalFeeInUsd,
|
|
18
|
-
hasHighFee,
|
|
19
|
-
getPercentageChange,
|
|
20
|
-
} from '../utils/swap';
|
|
21
28
|
import { useUiStore } from '../store/ui';
|
|
29
|
+
import { useWalletsStore } from '../store/wallets';
|
|
30
|
+
import { ButtonState } from '../types';
|
|
22
31
|
import {
|
|
23
32
|
numberToString,
|
|
24
33
|
secondsToString,
|
|
25
34
|
totalArrivalTime,
|
|
26
35
|
} from '../utils/numbers';
|
|
27
|
-
import { getBalanceFromWallet } from '../utils/wallets';
|
|
28
36
|
import { getFormatedBestRoute } from '../utils/routing';
|
|
29
|
-
import
|
|
37
|
+
import {
|
|
38
|
+
canComputePriceImpact,
|
|
39
|
+
getOutputRatio,
|
|
40
|
+
getPercentageChange,
|
|
41
|
+
getSwapButtonState,
|
|
42
|
+
getTotalFeeInUsd,
|
|
43
|
+
hasLimitError,
|
|
44
|
+
LimitErrorMessage,
|
|
45
|
+
outputRatioHasWarning,
|
|
46
|
+
} from '../utils/swap';
|
|
47
|
+
import { getBalanceFromWallet } from '../utils/wallets';
|
|
48
|
+
|
|
49
|
+
const Container = styled('div', {
|
|
50
|
+
display: 'flex',
|
|
51
|
+
flexDirection: 'column',
|
|
52
|
+
overflowY: 'visible',
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const FromContainer = styled('div', {
|
|
56
|
+
position: 'relative',
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const InputsContainer = styled('div', {
|
|
60
|
+
display: 'flex',
|
|
61
|
+
flexDirection: 'column',
|
|
62
|
+
gap: 5,
|
|
63
|
+
alignSelf: 'stretch',
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const BestRouteContainer = styled('div', {
|
|
67
|
+
width: '100%',
|
|
68
|
+
paddingTop: '$2',
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const FooterStepAlarm = styled('div', {
|
|
72
|
+
paddingBottom: '$15',
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const FooterAlert = styled('div', {
|
|
76
|
+
width: '100%',
|
|
77
|
+
display: 'flex',
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const BALANCE_PRECISION = 8;
|
|
81
|
+
const TWO_DECIMAL = 2;
|
|
82
|
+
const MAX_DECIMAL = 6;
|
|
83
|
+
const MIN_DECIMAL = 0;
|
|
84
|
+
const WARNING_LEVEL_LIMIT = -10;
|
|
30
85
|
|
|
31
86
|
export function Home() {
|
|
32
87
|
const navigate = useNavigate();
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
88
|
+
const {
|
|
89
|
+
fetch: refetchBestRoute,
|
|
90
|
+
loading: fetchingBestRoute,
|
|
91
|
+
error: bestRouteError,
|
|
92
|
+
} = useSwapInput();
|
|
93
|
+
const {
|
|
94
|
+
fromToken,
|
|
95
|
+
fromBlockchain,
|
|
96
|
+
toToken,
|
|
97
|
+
toBlockchain,
|
|
98
|
+
setInputAmount,
|
|
99
|
+
inputAmount,
|
|
100
|
+
inputUsdValue,
|
|
101
|
+
outputAmount,
|
|
102
|
+
outputUsdValue,
|
|
103
|
+
bestRoute,
|
|
104
|
+
resetRouteWallets,
|
|
105
|
+
} = useBestRouteStore();
|
|
106
|
+
|
|
107
|
+
const {
|
|
108
|
+
meta: { tokens },
|
|
109
|
+
loadingStatus: loadingMetaStatus,
|
|
110
|
+
} = useMetaStore();
|
|
111
|
+
|
|
47
112
|
const connectedWallets = useWalletsStore.use.connectedWallets();
|
|
48
113
|
const setCurrentPage = useUiStore.use.setCurrentPage();
|
|
114
|
+
const [openWarningModal, setOpenWarningModal] = useState(false);
|
|
115
|
+
const {
|
|
116
|
+
fromAmountRangeError,
|
|
117
|
+
swap: swapHasError,
|
|
118
|
+
recommendation,
|
|
119
|
+
} = LimitErrorMessage(bestRoute);
|
|
120
|
+
const layoutRef = useRef<HTMLDivElement>(null);
|
|
49
121
|
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
: bestRouteError;
|
|
122
|
+
const showBestRoute =
|
|
123
|
+
!!Number(inputAmount) &&
|
|
124
|
+
(!!bestRoute || fetchingBestRoute || !!bestRouteError);
|
|
54
125
|
|
|
55
126
|
const needsToWarnEthOnPath = false;
|
|
56
127
|
|
|
57
|
-
const showBestRoute =
|
|
58
|
-
!!inputAmount && (!!bestRoute || fetchingBestRoute || !!bestRouteError);
|
|
59
|
-
|
|
60
128
|
const outToInRatio = getOutputRatio(inputUsdValue, outputUsdValue);
|
|
61
|
-
|
|
62
129
|
const highValueLoss = outputRatioHasWarning(inputUsdValue, outToInRatio);
|
|
63
130
|
|
|
64
|
-
const
|
|
65
|
-
|
|
131
|
+
const priceImpactInputCanNotBeComputed = !canComputePriceImpact(
|
|
132
|
+
bestRoute,
|
|
133
|
+
inputAmount,
|
|
134
|
+
inputUsdValue
|
|
135
|
+
);
|
|
66
136
|
|
|
67
|
-
const
|
|
137
|
+
const priceImpactOutputCanNotBeComputed = !canComputePriceImpact(
|
|
68
138
|
bestRoute,
|
|
69
139
|
inputAmount,
|
|
70
|
-
inputUsdValue,
|
|
71
140
|
outputUsdValue
|
|
72
141
|
);
|
|
73
|
-
|
|
74
142
|
const swapButtonState = getSwapButtonState(
|
|
75
143
|
loadingMetaStatus,
|
|
76
144
|
connectedWallets,
|
|
@@ -78,40 +146,36 @@ export function Home() {
|
|
|
78
146
|
bestRoute,
|
|
79
147
|
hasLimitError(bestRoute),
|
|
80
148
|
highValueLoss,
|
|
81
|
-
|
|
149
|
+
priceImpactInputCanNotBeComputed || priceImpactOutputCanNotBeComputed,
|
|
82
150
|
needsToWarnEthOnPath,
|
|
83
151
|
inputAmount
|
|
84
152
|
);
|
|
85
153
|
|
|
86
|
-
const totalFeeInUsd = getTotalFeeInUsd(bestRoute, tokens);
|
|
87
|
-
|
|
88
|
-
const highFee = hasHighFee(totalFeeInUsd);
|
|
89
|
-
|
|
90
154
|
const tokenBalance =
|
|
91
|
-
!!
|
|
155
|
+
!!fromBlockchain && !!fromToken
|
|
92
156
|
? numberToString(
|
|
93
157
|
getBalanceFromWallet(
|
|
94
158
|
connectedWallets,
|
|
95
|
-
|
|
159
|
+
fromBlockchain?.name,
|
|
96
160
|
fromToken?.symbol,
|
|
97
161
|
fromToken?.address
|
|
98
162
|
)?.amount || '0',
|
|
99
|
-
|
|
163
|
+
BALANCE_PRECISION
|
|
100
164
|
)
|
|
101
165
|
: '0';
|
|
102
166
|
|
|
103
167
|
const tokenBalanceReal =
|
|
104
|
-
!!
|
|
168
|
+
!!fromBlockchain && !!fromToken
|
|
105
169
|
? numberToString(
|
|
106
170
|
getBalanceFromWallet(
|
|
107
171
|
connectedWallets,
|
|
108
|
-
|
|
172
|
+
fromBlockchain?.name,
|
|
109
173
|
fromToken?.symbol,
|
|
110
174
|
fromToken?.address
|
|
111
175
|
)?.amount || '0',
|
|
112
176
|
getBalanceFromWallet(
|
|
113
177
|
connectedWallets,
|
|
114
|
-
|
|
178
|
+
fromBlockchain?.name,
|
|
115
179
|
fromToken?.symbol,
|
|
116
180
|
fromToken?.address
|
|
117
181
|
)?.decimal
|
|
@@ -120,7 +184,7 @@ export function Home() {
|
|
|
120
184
|
|
|
121
185
|
useEffect(() => {
|
|
122
186
|
setCurrentPage(navigationRoutes.home);
|
|
123
|
-
|
|
187
|
+
resetRouteWallets();
|
|
124
188
|
return setCurrentPage.bind(null, '');
|
|
125
189
|
}, []);
|
|
126
190
|
|
|
@@ -132,60 +196,230 @@ export function Home() {
|
|
|
132
196
|
outputUsdValue.toNumber()
|
|
133
197
|
);
|
|
134
198
|
|
|
199
|
+
const getBestRouteSteps = (swaps: SwapResult[]) => {
|
|
200
|
+
return swaps.map((swap, index) => ({
|
|
201
|
+
swapper: { displayName: swap.swapperId, image: swap.swapperLogo },
|
|
202
|
+
from: {
|
|
203
|
+
token: { displayName: swap.from.symbol, image: swap.from.logo },
|
|
204
|
+
chain: {
|
|
205
|
+
displayName: swap.from.blockchain,
|
|
206
|
+
image: swap.from.blockchainLogo,
|
|
207
|
+
},
|
|
208
|
+
price: {
|
|
209
|
+
value:
|
|
210
|
+
index === 0
|
|
211
|
+
? numberToString(inputAmount, MIN_DECIMAL, TWO_DECIMAL)
|
|
212
|
+
: swap.fromAmount,
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
to: {
|
|
216
|
+
token: { displayName: swap.to.symbol, image: swap.to.logo },
|
|
217
|
+
chain: {
|
|
218
|
+
displayName: swap.to.blockchain,
|
|
219
|
+
image: swap.to.blockchainLogo,
|
|
220
|
+
},
|
|
221
|
+
price: {
|
|
222
|
+
value: swap.toAmount,
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
alerts:
|
|
226
|
+
swap.swapperId === swapHasError?.swapperId ? (
|
|
227
|
+
<FooterStepAlarm>
|
|
228
|
+
<Alert
|
|
229
|
+
type="error"
|
|
230
|
+
title={recommendation}
|
|
231
|
+
footer={
|
|
232
|
+
<FooterAlert>
|
|
233
|
+
<Typography size="xsmall" variant="body" color="neutral900">
|
|
234
|
+
{fromAmountRangeError}
|
|
235
|
+
</Typography>
|
|
236
|
+
<Divider direction="horizontal" size={8} />
|
|
237
|
+
<Typography size="xsmall" variant="body" color="neutral900">
|
|
238
|
+
|
|
|
239
|
+
</Typography>
|
|
240
|
+
<Divider direction="horizontal" size={8} />
|
|
241
|
+
<Typography size="xsmall" variant="body" color="neutral900">
|
|
242
|
+
{`Yours: ${numberToString(
|
|
243
|
+
swapHasError?.fromAmount || null
|
|
244
|
+
)} ${swap?.from.symbol}`}
|
|
245
|
+
</Typography>
|
|
246
|
+
</FooterAlert>
|
|
247
|
+
}
|
|
248
|
+
/>
|
|
249
|
+
</FooterStepAlarm>
|
|
250
|
+
) : undefined,
|
|
251
|
+
}));
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
const totalFeeInUsd = getTotalFeeInUsd(bestRoute, tokens);
|
|
255
|
+
|
|
256
|
+
const bestRouteData = getFormatedBestRoute(bestRoute);
|
|
257
|
+
|
|
135
258
|
return (
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
259
|
+
<Layout
|
|
260
|
+
ref={layoutRef}
|
|
261
|
+
fixedHeight={false}
|
|
262
|
+
hasLogo
|
|
263
|
+
footer={
|
|
264
|
+
<Button
|
|
265
|
+
type="primary"
|
|
266
|
+
size="large"
|
|
267
|
+
disabled={swapButtonState.disabled}
|
|
268
|
+
prefix={
|
|
269
|
+
!swapButtonState.disabled &&
|
|
270
|
+
swapButtonState.hasWarning && <WarningIcon />
|
|
271
|
+
}
|
|
272
|
+
fullWidth
|
|
273
|
+
onClick={() => {
|
|
274
|
+
if (swapButtonState.state === ButtonState.WAITFORCONNECTING) {
|
|
275
|
+
navigate(navigationRoutes.wallets);
|
|
276
|
+
} else if (swapButtonState.state === ButtonState.NEEDTOCONFIRM) {
|
|
277
|
+
setOpenWarningModal(true);
|
|
278
|
+
} else {
|
|
279
|
+
navigate(navigationRoutes.confirmSwap);
|
|
280
|
+
}
|
|
281
|
+
}}>
|
|
282
|
+
{swapButtonState.title}
|
|
283
|
+
</Button>
|
|
151
284
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
285
|
+
header={{
|
|
286
|
+
hasConnectWallet: true,
|
|
287
|
+
title: i18n.t('Swap'),
|
|
288
|
+
suffix: (
|
|
289
|
+
<HomeButtons
|
|
290
|
+
layoutRef={layoutRef.current}
|
|
291
|
+
onClickRefresh={
|
|
292
|
+
!!bestRoute || bestRouteError ? refetchBestRoute : undefined
|
|
293
|
+
}
|
|
294
|
+
onClickHistory={() => navigate(navigationRoutes.swaps)}
|
|
295
|
+
onClickSettings={() => navigate(navigationRoutes.settings)}
|
|
296
|
+
/>
|
|
297
|
+
),
|
|
298
|
+
}}>
|
|
299
|
+
<Container>
|
|
300
|
+
<InputsContainer>
|
|
301
|
+
<FromContainer>
|
|
302
|
+
<SwapInput
|
|
303
|
+
label="From"
|
|
304
|
+
onInputChange={setInputAmount}
|
|
305
|
+
balance={tokenBalance}
|
|
306
|
+
chain={{
|
|
307
|
+
displayName: fromBlockchain?.displayName || '',
|
|
308
|
+
image: fromBlockchain?.logo || '',
|
|
309
|
+
}}
|
|
310
|
+
token={{
|
|
311
|
+
displayName: fromToken?.symbol || '',
|
|
312
|
+
image: fromToken?.image || '',
|
|
313
|
+
}}
|
|
314
|
+
onClickToken={() => navigate('from-swap')}
|
|
315
|
+
price={{
|
|
316
|
+
value: inputAmount,
|
|
317
|
+
usdValue: priceImpactInputCanNotBeComputed
|
|
318
|
+
? undefined
|
|
319
|
+
: numberToString(inputUsdValue),
|
|
320
|
+
error: priceImpactInputCanNotBeComputed
|
|
321
|
+
? errorMessages.unknownPriceError.impacTitle
|
|
322
|
+
: undefined,
|
|
323
|
+
}}
|
|
324
|
+
disabled={loadingMetaStatus === 'failed'}
|
|
325
|
+
loading={loadingMetaStatus === 'loading'}
|
|
326
|
+
onSelectMaxBalance={() => {
|
|
327
|
+
if (tokenBalance !== '0') {
|
|
328
|
+
setInputAmount(tokenBalanceReal.split(',').join(''));
|
|
329
|
+
}
|
|
330
|
+
}}
|
|
331
|
+
/>
|
|
332
|
+
<SwitchFromAndToButton />
|
|
333
|
+
</FromContainer>
|
|
334
|
+
<SwapInput
|
|
335
|
+
sharpBottomStyle={!!bestRoute?.result || fetchingBestRoute}
|
|
336
|
+
label="To"
|
|
337
|
+
chain={{
|
|
338
|
+
displayName: toBlockchain?.displayName || '',
|
|
339
|
+
image: toBlockchain?.logo || '',
|
|
340
|
+
}}
|
|
341
|
+
token={{
|
|
342
|
+
displayName: toToken?.symbol || '',
|
|
343
|
+
image: toToken?.image || '',
|
|
344
|
+
}}
|
|
345
|
+
percentageChange={
|
|
346
|
+
!!percentageChange?.lt(0)
|
|
347
|
+
? numberToString(percentageChange, MIN_DECIMAL, TWO_DECIMAL)
|
|
348
|
+
: null
|
|
349
|
+
}
|
|
350
|
+
warningLevel={
|
|
351
|
+
!!percentageChange?.lt(WARNING_LEVEL_LIMIT) ? 'high' : 'low'
|
|
352
|
+
}
|
|
353
|
+
price={{
|
|
354
|
+
value: numberToString(outputAmount),
|
|
355
|
+
usdValue: priceImpactOutputCanNotBeComputed
|
|
356
|
+
? undefined
|
|
357
|
+
: numberToString(outputUsdValue),
|
|
358
|
+
error: priceImpactOutputCanNotBeComputed
|
|
359
|
+
? errorMessages.unknownPriceError.impacTitle
|
|
360
|
+
: undefined,
|
|
361
|
+
}}
|
|
362
|
+
onClickToken={() => navigate('to-swap')}
|
|
363
|
+
disabled={loadingMetaStatus === 'failed'}
|
|
364
|
+
loading={loadingMetaStatus === 'loading'}
|
|
365
|
+
/>
|
|
366
|
+
</InputsContainer>
|
|
367
|
+
{fetchingBestRoute && (
|
|
368
|
+
<BestRouteContainer>
|
|
369
|
+
<BestRouteSkeleton type="basic" />
|
|
370
|
+
</BestRouteContainer>
|
|
371
|
+
)}
|
|
372
|
+
{showBestRoute &&
|
|
373
|
+
!fetchingBestRoute &&
|
|
374
|
+
bestRouteData?.result?.swaps?.length ? (
|
|
375
|
+
<BestRouteContainer>
|
|
376
|
+
<BestRoute
|
|
377
|
+
type="basic"
|
|
378
|
+
recommended={true}
|
|
379
|
+
input={{
|
|
380
|
+
value: numberToString(inputAmount, MIN_DECIMAL, MAX_DECIMAL),
|
|
381
|
+
usdValue: numberToString(inputUsdValue),
|
|
382
|
+
}}
|
|
383
|
+
output={{
|
|
384
|
+
value: numberToString(outputAmount),
|
|
385
|
+
usdValue: numberToString(outputUsdValue),
|
|
386
|
+
}}
|
|
387
|
+
steps={getBestRouteSteps(bestRouteData.result.swaps)}
|
|
388
|
+
percentageChange={numberToString(
|
|
389
|
+
percentageChange,
|
|
390
|
+
MIN_DECIMAL,
|
|
391
|
+
TWO_DECIMAL
|
|
392
|
+
)}
|
|
393
|
+
totalFee={numberToString(totalFeeInUsd, MIN_DECIMAL, TWO_DECIMAL)}
|
|
394
|
+
totalTime={secondsToString(totalArrivalTime(bestRoute))}
|
|
395
|
+
/>
|
|
396
|
+
</BestRouteContainer>
|
|
397
|
+
) : showBestRoute && !fetchingBestRoute ? (
|
|
398
|
+
<>
|
|
399
|
+
<Divider size={20} />
|
|
400
|
+
<NoRoutes
|
|
401
|
+
diagnosisMessage={bestRouteData?.diagnosisMessages?.[0]}
|
|
402
|
+
fetch={refetchBestRoute}
|
|
403
|
+
error={!!bestRouteError}
|
|
404
|
+
/>
|
|
405
|
+
</>
|
|
406
|
+
) : null}
|
|
407
|
+
</Container>
|
|
408
|
+
{!fetchingBestRoute && (
|
|
409
|
+
<RouteErrors
|
|
410
|
+
openModal={openWarningModal}
|
|
411
|
+
onToggle={setOpenWarningModal}
|
|
412
|
+
totalFeeInUsd={totalFeeInUsd}
|
|
413
|
+
outputUsdValue={outputUsdValue}
|
|
414
|
+
inputUsdValue={inputUsdValue}
|
|
415
|
+
percentageChange={percentageChange}
|
|
416
|
+
highValueLoss={highValueLoss}
|
|
417
|
+
priceImpactCanNotBeComputed={
|
|
418
|
+
priceImpactInputCanNotBeComputed ||
|
|
419
|
+
priceImpactOutputCanNotBeComputed
|
|
420
|
+
}
|
|
421
|
+
/>
|
|
422
|
+
)}
|
|
423
|
+
</Layout>
|
|
190
424
|
);
|
|
191
425
|
}
|