@rango-dev/widget-embedded 0.12.1-next.0 → 0.12.1-next.10
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 -25
- 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 +21 -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
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import type { SwapDetailsProps } from './SwapDetails.types';
|
|
2
|
+
import type { ModalState } from '../SwapDetailsModal';
|
|
3
|
+
|
|
4
|
+
import { i18n } from '@lingui/core';
|
|
5
|
+
import {
|
|
6
|
+
getCurrentBlockchainOfOrNull,
|
|
7
|
+
getCurrentStep,
|
|
8
|
+
getRelatedWalletOrNull,
|
|
9
|
+
PendingSwapNetworkStatus,
|
|
10
|
+
} from '@rango-dev/queue-manager-rango-preset';
|
|
11
|
+
import {
|
|
12
|
+
Button,
|
|
13
|
+
CopyIcon,
|
|
14
|
+
Divider,
|
|
15
|
+
IconButton,
|
|
16
|
+
RouteCost,
|
|
17
|
+
StepDetails,
|
|
18
|
+
TokenAmount,
|
|
19
|
+
Typography,
|
|
20
|
+
useCopyToClipboard,
|
|
21
|
+
} from '@rango-dev/ui';
|
|
22
|
+
import { useWallets } from '@rango-dev/wallets-react';
|
|
23
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
24
|
+
import { useNavigate } from 'react-router-dom';
|
|
25
|
+
|
|
26
|
+
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
27
|
+
import { useNavigateBack } from '../../hooks/useNavigateBack';
|
|
28
|
+
import { useBestRouteStore } from '../../store/bestRoute';
|
|
29
|
+
import { useMetaStore } from '../../store/meta';
|
|
30
|
+
import { numberToString } from '../../utils/numbers';
|
|
31
|
+
import {
|
|
32
|
+
getLastConvertedTokenInFailedSwap,
|
|
33
|
+
getPercentageChange,
|
|
34
|
+
getSwapMessages,
|
|
35
|
+
shouldRetrySwap,
|
|
36
|
+
} from '../../utils/swap';
|
|
37
|
+
import { getSwapDate } from '../../utils/time';
|
|
38
|
+
import { getConciseAddress, getUsdPrice } from '../../utils/wallets';
|
|
39
|
+
import { SuffixContainer } from '../HeaderButtons/HeaderButtons.styles';
|
|
40
|
+
import { Layout } from '../Layout';
|
|
41
|
+
import {
|
|
42
|
+
SwapDetailsCompleteModal,
|
|
43
|
+
SwapDetailsModal,
|
|
44
|
+
} from '../SwapDetailsModal';
|
|
45
|
+
|
|
46
|
+
import {
|
|
47
|
+
AMOUNT_DECIMALS,
|
|
48
|
+
getPriceImpactWarningLevel,
|
|
49
|
+
getSteps,
|
|
50
|
+
getStepState,
|
|
51
|
+
MIN_DECIMALS,
|
|
52
|
+
PERCENT_DECIMALS,
|
|
53
|
+
RESET_INTERVAL,
|
|
54
|
+
SECONDS,
|
|
55
|
+
} from './SwapDetails.helpers';
|
|
56
|
+
import {
|
|
57
|
+
Container,
|
|
58
|
+
HeaderDetails,
|
|
59
|
+
Separator,
|
|
60
|
+
StepsList,
|
|
61
|
+
} from './SwapDetails.styles';
|
|
62
|
+
|
|
63
|
+
export function SwapDetails(props: SwapDetailsProps) {
|
|
64
|
+
const { swap, requestId, onDelete, onCancel: onCancelProps } = props;
|
|
65
|
+
const { tokens } = useMetaStore.use.meta();
|
|
66
|
+
const { canSwitchNetworkTo, connect, getWalletInfo } = useWallets();
|
|
67
|
+
const retry = useBestRouteStore.use.retry();
|
|
68
|
+
const navigate = useNavigate();
|
|
69
|
+
const { navigateBackFrom } = useNavigateBack();
|
|
70
|
+
const listRef = useRef(null);
|
|
71
|
+
const [_, handleCopy] = useCopyToClipboard(RESET_INTERVAL);
|
|
72
|
+
const [modalState, setModalState] = useState<ModalState>(null);
|
|
73
|
+
const [showCompletedModal, setShowCompletedModal] = useState<
|
|
74
|
+
'success' | 'failed' | null
|
|
75
|
+
>(null);
|
|
76
|
+
|
|
77
|
+
const onCancel = () => {
|
|
78
|
+
onCancelProps();
|
|
79
|
+
setModalState(null);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const currentStep = getCurrentStep(swap);
|
|
83
|
+
const currentStepNetworkStatus = currentStep?.networkStatus;
|
|
84
|
+
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (swap.status === 'success' || swap.status === 'failed') {
|
|
87
|
+
setShowCompletedModal(swap.status);
|
|
88
|
+
}
|
|
89
|
+
}, [swap.status]);
|
|
90
|
+
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (showSwitchNetwork) {
|
|
93
|
+
setModalState(PendingSwapNetworkStatus.WaitingForNetworkChange);
|
|
94
|
+
} else if (
|
|
95
|
+
currentStepNetworkStatus ===
|
|
96
|
+
PendingSwapNetworkStatus.WaitingForConnectingWallet ||
|
|
97
|
+
currentStepNetworkStatus === PendingSwapNetworkStatus.NetworkChanged
|
|
98
|
+
) {
|
|
99
|
+
setModalState(currentStepNetworkStatus);
|
|
100
|
+
} else {
|
|
101
|
+
setModalState(null);
|
|
102
|
+
}
|
|
103
|
+
}, [currentStepNetworkStatus]);
|
|
104
|
+
|
|
105
|
+
const lastConvertedTokenInFailedSwap =
|
|
106
|
+
getLastConvertedTokenInFailedSwap(swap);
|
|
107
|
+
|
|
108
|
+
const currentStepBlockchain = currentStep
|
|
109
|
+
? getCurrentBlockchainOfOrNull(swap, currentStep)
|
|
110
|
+
: null;
|
|
111
|
+
const currentStepWallet = currentStep
|
|
112
|
+
? getRelatedWalletOrNull(swap, currentStep)
|
|
113
|
+
: null;
|
|
114
|
+
|
|
115
|
+
const swapDate = getSwapDate(swap);
|
|
116
|
+
const shouldRetry = shouldRetrySwap(swap);
|
|
117
|
+
|
|
118
|
+
const isMobileWallet = (walletType: string): boolean =>
|
|
119
|
+
!!getWalletInfo(walletType)?.mobileWallet;
|
|
120
|
+
|
|
121
|
+
const showSwitchNetwork =
|
|
122
|
+
currentStepNetworkStatus ===
|
|
123
|
+
PendingSwapNetworkStatus.WaitingForNetworkChange &&
|
|
124
|
+
!!currentStepBlockchain &&
|
|
125
|
+
!!currentStepWallet?.walletType &&
|
|
126
|
+
(isMobileWallet(currentStepWallet.walletType) ||
|
|
127
|
+
canSwitchNetworkTo(currentStepWallet.walletType, currentStepBlockchain));
|
|
128
|
+
|
|
129
|
+
const switchNetwork = showSwitchNetwork
|
|
130
|
+
? connect.bind(null, currentStepWallet.walletType, currentStepBlockchain)
|
|
131
|
+
: undefined;
|
|
132
|
+
|
|
133
|
+
const stepMessage = getSwapMessages(swap, currentStep);
|
|
134
|
+
const steps = getSteps({
|
|
135
|
+
swap,
|
|
136
|
+
switchNetwork,
|
|
137
|
+
showNetworkModal: currentStepNetworkStatus,
|
|
138
|
+
setNetworkModal: setModalState,
|
|
139
|
+
message: stepMessage,
|
|
140
|
+
});
|
|
141
|
+
const numberOfSteps = steps.length;
|
|
142
|
+
const [firstStep, lastStep] = [swap.steps[0], swap.steps[numberOfSteps - 1]];
|
|
143
|
+
const outputAmount =
|
|
144
|
+
lastStep.outputAmount || lastStep.expectedOutputAmountHumanReadable;
|
|
145
|
+
const percentageChange =
|
|
146
|
+
swap.inputAmount && outputAmount
|
|
147
|
+
? getPercentageChange(swap.inputAmount, outputAmount)
|
|
148
|
+
: null;
|
|
149
|
+
|
|
150
|
+
const totalFee = swap.steps.reduce(
|
|
151
|
+
(totalFee, steps) => totalFee + parseFloat(steps.feeInUsd || ''),
|
|
152
|
+
0
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
const totalTime = swap.steps.reduce(
|
|
156
|
+
(totalTime, step) => totalTime + (step.estimatedTimeInSeconds || 0),
|
|
157
|
+
0
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
const minutes = Math.floor(totalTime / SECONDS);
|
|
161
|
+
|
|
162
|
+
const diagnosisUrl = swap.steps.find(
|
|
163
|
+
(step) => step.diagnosisUrl
|
|
164
|
+
)?.diagnosisUrl;
|
|
165
|
+
|
|
166
|
+
const outputUsdValue = numberToString(
|
|
167
|
+
String(
|
|
168
|
+
parseFloat(numberToString(outputAmount, MIN_DECIMALS, AMOUNT_DECIMALS)) *
|
|
169
|
+
(getUsdPrice(
|
|
170
|
+
lastStep.toBlockchain,
|
|
171
|
+
lastStep.toSymbol,
|
|
172
|
+
lastStep.toSymbolAddress,
|
|
173
|
+
tokens
|
|
174
|
+
) || 0)
|
|
175
|
+
),
|
|
176
|
+
MIN_DECIMALS,
|
|
177
|
+
AMOUNT_DECIMALS
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
const completeModalDesc =
|
|
181
|
+
showCompletedModal === 'success'
|
|
182
|
+
? `You have recieved ${numberToString(
|
|
183
|
+
outputAmount,
|
|
184
|
+
MIN_DECIMALS,
|
|
185
|
+
AMOUNT_DECIMALS
|
|
186
|
+
)} ${
|
|
187
|
+
steps[numberOfSteps - 1].to.token.displayName
|
|
188
|
+
} in ${getConciseAddress(
|
|
189
|
+
swap.wallets[steps[numberOfSteps - 1].to.chain.displayName]
|
|
190
|
+
?.address || ''
|
|
191
|
+
)} wallet on ${steps[numberOfSteps - 1].to.chain.displayName} chain.`
|
|
192
|
+
: `${i18n.t('Transaction was not sent.')} ${
|
|
193
|
+
lastConvertedTokenInFailedSwap
|
|
194
|
+
? `${lastConvertedTokenInFailedSwap.outputAmount} ${lastConvertedTokenInFailedSwap.symbol} on ${lastConvertedTokenInFailedSwap.blockchain} remain in your wallet`
|
|
195
|
+
: ''
|
|
196
|
+
}`;
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<Layout
|
|
200
|
+
noPadding
|
|
201
|
+
header={{
|
|
202
|
+
title: i18n.t('Swap and Bridge'),
|
|
203
|
+
onBack: navigateBackFrom.bind(null, navigationRoutes.swapDetails),
|
|
204
|
+
onCancel:
|
|
205
|
+
swap.status === 'running' ? () => setModalState('cancel') : undefined,
|
|
206
|
+
suffix: swap.status !== 'running' && (
|
|
207
|
+
<SuffixContainer>
|
|
208
|
+
<Button
|
|
209
|
+
variant="ghost"
|
|
210
|
+
type="error"
|
|
211
|
+
size="xsmall"
|
|
212
|
+
onClick={() => setModalState('delete')}>
|
|
213
|
+
<Typography size="medium" variant="label" color="error">
|
|
214
|
+
{i18n.t('Delete')}
|
|
215
|
+
</Typography>
|
|
216
|
+
</Button>
|
|
217
|
+
</SuffixContainer>
|
|
218
|
+
),
|
|
219
|
+
}}
|
|
220
|
+
footer={
|
|
221
|
+
shouldRetry &&
|
|
222
|
+
!showCompletedModal && (
|
|
223
|
+
<Button
|
|
224
|
+
fullWidth
|
|
225
|
+
variant="contained"
|
|
226
|
+
type="primary"
|
|
227
|
+
size="large"
|
|
228
|
+
onClick={() => {
|
|
229
|
+
retry(swap);
|
|
230
|
+
setTimeout(() => {
|
|
231
|
+
navigate(navigationRoutes.home);
|
|
232
|
+
}, 0);
|
|
233
|
+
}}>
|
|
234
|
+
{i18n.t('Try again')}
|
|
235
|
+
</Button>
|
|
236
|
+
)
|
|
237
|
+
}>
|
|
238
|
+
<Container>
|
|
239
|
+
<HeaderDetails>
|
|
240
|
+
<div className="row">
|
|
241
|
+
<Typography variant="label" size="large" color="neutral900">
|
|
242
|
+
{`${i18n.t('Request ID')}:`}
|
|
243
|
+
</Typography>
|
|
244
|
+
<div className="request-id">
|
|
245
|
+
<Typography variant="label" size="small" color="neutral900">
|
|
246
|
+
{requestId}
|
|
247
|
+
</Typography>
|
|
248
|
+
<IconButton
|
|
249
|
+
variant="ghost"
|
|
250
|
+
onClick={handleCopy.bind(null, requestId || '')}>
|
|
251
|
+
<CopyIcon size={16} color="gray" />
|
|
252
|
+
</IconButton>
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
<div className="row">
|
|
256
|
+
<Typography variant="label" size="large" color="neutral900">
|
|
257
|
+
{`${i18n.t('Created at')}:`}
|
|
258
|
+
</Typography>
|
|
259
|
+
<Typography variant="label" size="small" color="neutral900">
|
|
260
|
+
{swapDate}
|
|
261
|
+
</Typography>
|
|
262
|
+
</div>
|
|
263
|
+
</HeaderDetails>
|
|
264
|
+
<div className="output">
|
|
265
|
+
<RouteCost
|
|
266
|
+
fee={numberToString(
|
|
267
|
+
String(totalFee),
|
|
268
|
+
AMOUNT_DECIMALS,
|
|
269
|
+
AMOUNT_DECIMALS
|
|
270
|
+
)}
|
|
271
|
+
time={minutes}
|
|
272
|
+
steps={numberOfSteps}
|
|
273
|
+
/>
|
|
274
|
+
<TokenAmount
|
|
275
|
+
direction="horizontal"
|
|
276
|
+
type="input"
|
|
277
|
+
price={{
|
|
278
|
+
value: numberToString(
|
|
279
|
+
swap.inputAmount,
|
|
280
|
+
AMOUNT_DECIMALS,
|
|
281
|
+
AMOUNT_DECIMALS
|
|
282
|
+
),
|
|
283
|
+
usdValue: numberToString(
|
|
284
|
+
String(
|
|
285
|
+
parseFloat(swap.inputAmount) *
|
|
286
|
+
(getUsdPrice(
|
|
287
|
+
firstStep.fromBlockchain,
|
|
288
|
+
firstStep.fromSymbol,
|
|
289
|
+
firstStep.fromSymbolAddress,
|
|
290
|
+
tokens
|
|
291
|
+
) || 0)
|
|
292
|
+
),
|
|
293
|
+
MIN_DECIMALS,
|
|
294
|
+
AMOUNT_DECIMALS
|
|
295
|
+
),
|
|
296
|
+
}}
|
|
297
|
+
token={{
|
|
298
|
+
displayName: steps[0].from.token.displayName,
|
|
299
|
+
image: steps[0].from.token.image,
|
|
300
|
+
}}
|
|
301
|
+
chain={{ image: steps[0].from.chain.image }}
|
|
302
|
+
/>
|
|
303
|
+
<Separator />
|
|
304
|
+
<TokenAmount
|
|
305
|
+
direction="horizontal"
|
|
306
|
+
type="output"
|
|
307
|
+
price={{
|
|
308
|
+
value: numberToString(
|
|
309
|
+
outputAmount,
|
|
310
|
+
MIN_DECIMALS,
|
|
311
|
+
AMOUNT_DECIMALS
|
|
312
|
+
),
|
|
313
|
+
usdValue: outputUsdValue,
|
|
314
|
+
}}
|
|
315
|
+
token={{
|
|
316
|
+
displayName: steps[numberOfSteps - 1].to.token.displayName,
|
|
317
|
+
image: steps[numberOfSteps - 1].to.token.image,
|
|
318
|
+
}}
|
|
319
|
+
chain={{ image: steps[numberOfSteps - 1].to.chain.image }}
|
|
320
|
+
percentageChange={numberToString(
|
|
321
|
+
percentageChange,
|
|
322
|
+
PERCENT_DECIMALS,
|
|
323
|
+
PERCENT_DECIMALS
|
|
324
|
+
)}
|
|
325
|
+
warningLevel={getPriceImpactWarningLevel(percentageChange)}
|
|
326
|
+
/>
|
|
327
|
+
</div>
|
|
328
|
+
<div className="title-steps">
|
|
329
|
+
<Typography variant="title" size="small">
|
|
330
|
+
{i18n.t('Swaps steps')}
|
|
331
|
+
</Typography>
|
|
332
|
+
</div>
|
|
333
|
+
<Divider size={8} />
|
|
334
|
+
<StepsList ref={listRef}>
|
|
335
|
+
{steps.map((step, index) => {
|
|
336
|
+
const key = index;
|
|
337
|
+
const state = getStepState(swap.steps[index]);
|
|
338
|
+
const isFocused =
|
|
339
|
+
state === 'error' ||
|
|
340
|
+
state === 'in-progress' ||
|
|
341
|
+
state === 'warning' ||
|
|
342
|
+
(state === 'completed' && index === steps.length - 1);
|
|
343
|
+
return (
|
|
344
|
+
<StepDetails
|
|
345
|
+
key={key}
|
|
346
|
+
step={step}
|
|
347
|
+
type="route-progress"
|
|
348
|
+
ref={listRef}
|
|
349
|
+
state={state}
|
|
350
|
+
hasSeparator={index !== 0}
|
|
351
|
+
tabIndex={key}
|
|
352
|
+
isFocused={isFocused}
|
|
353
|
+
/>
|
|
354
|
+
);
|
|
355
|
+
})}
|
|
356
|
+
</StepsList>
|
|
357
|
+
</Container>
|
|
358
|
+
<SwapDetailsModal
|
|
359
|
+
state={modalState}
|
|
360
|
+
onClose={() => setModalState(null)}
|
|
361
|
+
onCancel={onCancel}
|
|
362
|
+
onDelete={onDelete}
|
|
363
|
+
message={stepMessage.detailedMessage.content}
|
|
364
|
+
currentStepWallet={currentStepWallet}
|
|
365
|
+
/>
|
|
366
|
+
<SwapDetailsCompleteModal
|
|
367
|
+
open={!!showCompletedModal}
|
|
368
|
+
diagnosisUrl={diagnosisUrl}
|
|
369
|
+
onClose={() => setShowCompletedModal(null)}
|
|
370
|
+
status={showCompletedModal}
|
|
371
|
+
priceValue={numberToString(outputAmount, MIN_DECIMALS, AMOUNT_DECIMALS)}
|
|
372
|
+
usdValue={outputUsdValue}
|
|
373
|
+
percentageChange={numberToString(
|
|
374
|
+
percentageChange,
|
|
375
|
+
PERCENT_DECIMALS,
|
|
376
|
+
PERCENT_DECIMALS
|
|
377
|
+
)}
|
|
378
|
+
token={{
|
|
379
|
+
displayName: steps[numberOfSteps - 1].to.token.displayName,
|
|
380
|
+
image: steps[numberOfSteps - 1].to.token.image,
|
|
381
|
+
}}
|
|
382
|
+
chain={{ image: steps[numberOfSteps - 1].to.chain.image }}
|
|
383
|
+
description={completeModalDesc}
|
|
384
|
+
/>
|
|
385
|
+
</Layout>
|
|
386
|
+
);
|
|
387
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PendingSwap } from 'rango-types';
|
|
2
|
+
|
|
3
|
+
export interface SwapDetailsProps {
|
|
4
|
+
swap: PendingSwap;
|
|
5
|
+
requestId: string;
|
|
6
|
+
onDelete: () => void;
|
|
7
|
+
onCancel: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface SwapDetailsPlaceholderPropTypes {
|
|
10
|
+
requestId: string;
|
|
11
|
+
loading: boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SwapDetails } from './SwapDetails';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { FailedAlertsProps } from './SwapDetailsAlerts.types';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Alert,
|
|
5
|
+
ChevronDownIcon,
|
|
6
|
+
ChevronUpIcon,
|
|
7
|
+
IconButton,
|
|
8
|
+
} from '@rango-dev/ui';
|
|
9
|
+
import React, { useState } from 'react';
|
|
10
|
+
|
|
11
|
+
export function FailedAlert(props: FailedAlertsProps) {
|
|
12
|
+
const { message } = props;
|
|
13
|
+
const [showContentError, setShowContentError] = useState(false);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Alert
|
|
17
|
+
type="error"
|
|
18
|
+
title={message.shortMessage}
|
|
19
|
+
action={
|
|
20
|
+
message.detailedMessage.content && (
|
|
21
|
+
<IconButton
|
|
22
|
+
onClick={() => setShowContentError((prev) => !prev)}
|
|
23
|
+
variant="ghost"
|
|
24
|
+
size="xsmall">
|
|
25
|
+
{showContentError ? (
|
|
26
|
+
<ChevronUpIcon size={12} color="gray" />
|
|
27
|
+
) : (
|
|
28
|
+
<ChevronDownIcon size={12} color="gray" />
|
|
29
|
+
)}
|
|
30
|
+
</IconButton>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
footer={showContentError ? message.detailedMessage.content : undefined}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { WaningAlertsProps } from './SwapDetailsAlerts.types';
|
|
2
|
+
|
|
3
|
+
import { i18n } from '@lingui/core';
|
|
4
|
+
import { PendingSwapNetworkStatus } from '@rango-dev/queue-manager-rango-preset';
|
|
5
|
+
import { Alert, Button } from '@rango-dev/ui';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
export function WarningAlert(props: WaningAlertsProps) {
|
|
9
|
+
const { switchNetwork, setNetworkModal, message, showNetworkModal } = props;
|
|
10
|
+
if (!!switchNetwork) {
|
|
11
|
+
return (
|
|
12
|
+
<Alert
|
|
13
|
+
type="warning"
|
|
14
|
+
title={message.shortMessage}
|
|
15
|
+
action={
|
|
16
|
+
<Button
|
|
17
|
+
size="xxsmall"
|
|
18
|
+
type="warning"
|
|
19
|
+
onClick={() => {
|
|
20
|
+
setNetworkModal(PendingSwapNetworkStatus.WaitingForNetworkChange);
|
|
21
|
+
switchNetwork().catch((e) => {
|
|
22
|
+
console.log(e);
|
|
23
|
+
});
|
|
24
|
+
}}>
|
|
25
|
+
{i18n.t('Change')}
|
|
26
|
+
</Button>
|
|
27
|
+
}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
if (
|
|
32
|
+
showNetworkModal === PendingSwapNetworkStatus.WaitingForConnectingWallet
|
|
33
|
+
) {
|
|
34
|
+
return (
|
|
35
|
+
<Alert
|
|
36
|
+
type="warning"
|
|
37
|
+
title={message.shortMessage}
|
|
38
|
+
action={
|
|
39
|
+
<Button
|
|
40
|
+
size="xxsmall"
|
|
41
|
+
type="warning"
|
|
42
|
+
onClick={() => {
|
|
43
|
+
setNetworkModal(
|
|
44
|
+
PendingSwapNetworkStatus.WaitingForConnectingWallet
|
|
45
|
+
);
|
|
46
|
+
}}>
|
|
47
|
+
{i18n.t('Connect')}
|
|
48
|
+
</Button>
|
|
49
|
+
}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return <Alert type="warning" title={message.shortMessage} />;
|
|
55
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { SwapAlertsProps } from './SwapDetailsAlerts.types';
|
|
2
|
+
|
|
3
|
+
import { i18n } from '@lingui/core';
|
|
4
|
+
import { Alert, IconButton, LinkIcon } from '@rango-dev/ui';
|
|
5
|
+
import React, { Fragment } from 'react';
|
|
6
|
+
|
|
7
|
+
import { isNetworkStatusInWarningState } from '../../utils/swap';
|
|
8
|
+
|
|
9
|
+
import { FailedAlert } from './SwapDetailsAlerts.Failed';
|
|
10
|
+
import { Alerts } from './SwapDetailsAlerts.styles';
|
|
11
|
+
import { WarningAlert } from './SwapDetailsAlerts.Warning';
|
|
12
|
+
|
|
13
|
+
export function SwapDetailsAlerts(props: SwapAlertsProps) {
|
|
14
|
+
const {
|
|
15
|
+
switchNetwork,
|
|
16
|
+
showNetworkModal,
|
|
17
|
+
setNetworkModal,
|
|
18
|
+
message,
|
|
19
|
+
step,
|
|
20
|
+
hasAlreadyProceededToSign,
|
|
21
|
+
} = props;
|
|
22
|
+
|
|
23
|
+
const hasWarning = isNetworkStatusInWarningState(step);
|
|
24
|
+
const waitingForApproval =
|
|
25
|
+
step.status === 'waitingForApproval' && !hasWarning;
|
|
26
|
+
const inProgress = step.status === 'running' && !hasWarning;
|
|
27
|
+
return (
|
|
28
|
+
<Alerts>
|
|
29
|
+
{step.explorerUrl?.map((explorerUrl, index, urls) => {
|
|
30
|
+
const key = index + explorerUrl.url;
|
|
31
|
+
const lastUrl = index === urls.length - 1;
|
|
32
|
+
const loading = (lastUrl && inProgress) || waitingForApproval;
|
|
33
|
+
const error = lastUrl && step.status === 'failed';
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Fragment key={key}>
|
|
37
|
+
<Alert
|
|
38
|
+
type={(loading && 'loading') || (error && 'error') || 'success'}
|
|
39
|
+
title={
|
|
40
|
+
!explorerUrl.description
|
|
41
|
+
? i18n.t('View transaction')
|
|
42
|
+
: `${explorerUrl.description} Tx`
|
|
43
|
+
}
|
|
44
|
+
action={
|
|
45
|
+
explorerUrl.url && (
|
|
46
|
+
<IconButton
|
|
47
|
+
variant="ghost"
|
|
48
|
+
size="xsmall"
|
|
49
|
+
onClick={() => window.open(explorerUrl.url, '_blank')}>
|
|
50
|
+
<LinkIcon size={16} />
|
|
51
|
+
</IconButton>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
/>
|
|
55
|
+
</Fragment>
|
|
56
|
+
);
|
|
57
|
+
})}
|
|
58
|
+
{((inProgress && !hasAlreadyProceededToSign) ||
|
|
59
|
+
(waitingForApproval && !step.explorerUrl?.length)) && (
|
|
60
|
+
<Alert type="loading" title={message.shortMessage} />
|
|
61
|
+
)}
|
|
62
|
+
{step.status !== 'failed' && hasWarning && (
|
|
63
|
+
<WarningAlert
|
|
64
|
+
switchNetwork={switchNetwork}
|
|
65
|
+
showNetworkModal={showNetworkModal}
|
|
66
|
+
setNetworkModal={setNetworkModal}
|
|
67
|
+
message={message}
|
|
68
|
+
/>
|
|
69
|
+
)}
|
|
70
|
+
|
|
71
|
+
{step.status === 'failed' && <FailedAlert message={message} />}
|
|
72
|
+
</Alerts>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { getSwapMessages } from '../../utils/swap';
|
|
2
|
+
import type { ModalState } from '../SwapDetailsModal';
|
|
3
|
+
import type { ConnectResult } from '@rango-dev/wallets-react';
|
|
4
|
+
import type {
|
|
5
|
+
PendingSwap,
|
|
6
|
+
PendingSwapNetworkStatus,
|
|
7
|
+
PendingSwapStep,
|
|
8
|
+
} from 'rango-types';
|
|
9
|
+
|
|
10
|
+
export interface SwapAlertsProps extends WaningAlertsProps {
|
|
11
|
+
step: PendingSwapStep;
|
|
12
|
+
hasAlreadyProceededToSign?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface WaningAlertsProps extends FailedAlertsProps {
|
|
16
|
+
switchNetwork: (() => Promise<ConnectResult>) | undefined;
|
|
17
|
+
showNetworkModal: PendingSwapNetworkStatus | null | undefined;
|
|
18
|
+
setNetworkModal: (network: ModalState) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface FailedAlertsProps {
|
|
22
|
+
message: ReturnType<typeof getSwapMessages>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type GetStep = { swap: PendingSwap } & Omit<
|
|
26
|
+
SwapAlertsProps,
|
|
27
|
+
'step' | 'hasAlreadyProceededToSign'
|
|
28
|
+
>;
|