@rango-dev/widget-embedded 0.12.1-next.2 → 0.12.1-next.21
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/AppRouter.d.ts +3 -2
- package/dist/components/AppRouter.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 +307 -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 +156 -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 +154 -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 +2597 -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 +460 -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 +895 -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 +464 -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 +155 -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/LoadingSwapDetails/LoadingSwapDetailStep.d.ts +4 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts +3 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +460 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +4 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/index.d.ts +2 -0
- package/dist/components/LoadingSwapDetails/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 +460 -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 +613 -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 +613 -0
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrors.types.d.ts +24 -0
- package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +1 -0
- package/dist/components/RouteErrors/index.d.ts +2 -0
- package/dist/components/RouteErrors/index.d.ts.map +1 -0
- package/dist/components/SearchInput/SearchInput.d.ts +4 -0
- package/dist/components/SearchInput/SearchInput.d.ts.map +1 -0
- package/dist/components/SearchInput/SearchInput.styles.d.ts +154 -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 +460 -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 +766 -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 +613 -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 +8 -0
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +919 -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 +154 -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 +154 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +46 -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 +613 -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 +1532 -0
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.types.d.ts +41 -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 +613 -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 +13 -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/globalStyles.d.ts +1 -1
- package/dist/globalStyles.d.ts.map +1 -1
- 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 -29
- 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 +11 -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/configs.d.ts +2 -0
- package/dist/utils/configs.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 +10 -7
- 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 +29 -14
- 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 +88 -28
- package/src/components/AppRouter.tsx +36 -6
- package/src/components/AppRoutes.tsx +54 -19
- package/src/components/BlockchainList/BlockchainList.helpers.ts +37 -0
- package/src/components/BlockchainList/BlockchainList.styles.ts +19 -0
- package/src/components/BlockchainList/BlockchainList.tsx +73 -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 +86 -0
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +169 -0
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +460 -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 +20 -0
- package/src/components/HeaderButtons/WalletButton.tsx +20 -0
- package/src/components/HeaderButtons/index.ts +4 -0
- package/src/components/Layout/Layout.styles.ts +50 -0
- package/src/components/Layout/Layout.tsx +72 -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/LoadingSwapDetails/LoadingSwapDetailStep.tsx +41 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +78 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +53 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +3 -0
- package/src/components/LoadingSwapDetails/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 +107 -0
- package/src/components/NotificationContent/NotificationNotFound.tsx +17 -0
- package/src/components/NotificationContent/index.ts +1 -0
- package/src/components/RouteErrors/RouteErrors.styles.ts +28 -0
- package/src/components/RouteErrors/RouteErrors.tsx +79 -0
- package/src/components/RouteErrors/RouteErrors.types.ts +29 -0
- package/src/components/RouteErrors/RouteErrorsModal.tsx +128 -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 +79 -0
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +85 -0
- package/src/components/SwapDetails/SwapDetails.styles.ts +68 -0
- package/src/components/SwapDetails/SwapDetails.tsx +419 -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 +31 -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 +45 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +54 -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 +23 -41
- package/src/components/TokenList/LoadingTokenList.tsx +34 -0
- package/src/components/TokenList/TokenList.helpers.ts +13 -0
- package/src/components/TokenList/TokenList.styles.ts +121 -0
- package/src/components/TokenList/TokenList.tsx +271 -0
- package/src/components/TokenList/TokenList.types.ts +48 -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 +37 -5
- 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 +17 -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/globalStyles.ts +1 -4
- package/src/hooks/useConfirmSwap.ts +251 -220
- package/src/hooks/useFetchBestRoute.ts +38 -0
- package/src/hooks/useNavigateBack.ts +25 -9
- package/src/hooks/useSwapInput.ts +116 -0
- package/src/hooks/useTheme.ts +35 -74
- package/src/hooks/useWalletList.ts +125 -0
- package/src/pages/ConfirmSwapPage.tsx +492 -228
- package/src/pages/HistoryPage.tsx +104 -15
- package/src/pages/Home.tsx +392 -110
- 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 +169 -0
- package/src/pages/SettingsPage.tsx +144 -72
- package/src/pages/SwapDetailsPage.tsx +40 -141
- 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 +12 -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/configs.ts +3 -0
- 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 +105 -27
- package/src/utils/settings.ts +57 -0
- package/src/utils/swap.ts +200 -113
- package/src/utils/wallets.ts +165 -116
- 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,265 +1,529 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
+
import type {
|
|
3
|
+
ConfirmSwap,
|
|
4
|
+
ConfirmSwapFetchResult,
|
|
5
|
+
} from '../hooks/useConfirmSwap';
|
|
6
|
+
import type { WidgetConfig } from '../types';
|
|
7
|
+
|
|
6
8
|
import { i18n } from '@lingui/core';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
getKeplrCompatibleConnectedWallets,
|
|
10
|
-
getRequiredChains,
|
|
11
|
-
getSelectableWallets,
|
|
12
|
-
isExperimentalChain,
|
|
13
|
-
} from '../utils/wallets';
|
|
14
|
-
import {
|
|
15
|
-
confirmSwapDisabled,
|
|
16
|
-
getPercentageChange,
|
|
17
|
-
getTotalFeeInUsd,
|
|
18
|
-
isValidCustomDestination,
|
|
19
|
-
} from '../utils/swap';
|
|
20
|
-
import { numberToString } from '../utils/numbers';
|
|
21
|
-
import { useMetaStore } from '../store/meta';
|
|
22
|
-
import { WalletType } from '@rango-dev/wallets-shared';
|
|
23
|
-
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
9
|
+
import { useManager } from '@rango-dev/queue-manager-react';
|
|
24
10
|
import {
|
|
11
|
+
Alert,
|
|
12
|
+
BestRoute,
|
|
13
|
+
BestRouteSkeleton,
|
|
14
|
+
Button,
|
|
25
15
|
Divider,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
IconButton,
|
|
17
|
+
MessageBox,
|
|
18
|
+
Modal,
|
|
19
|
+
RefreshIcon,
|
|
20
|
+
SettingsIcon,
|
|
21
|
+
styled,
|
|
22
|
+
Tooltip,
|
|
23
|
+
Typography,
|
|
24
|
+
WalletIcon,
|
|
32
25
|
} from '@rango-dev/ui';
|
|
33
|
-
import {
|
|
26
|
+
import React, { useEffect, useState } from 'react';
|
|
27
|
+
import { flushSync } from 'react-dom';
|
|
28
|
+
import { useNavigate } from 'react-router-dom';
|
|
29
|
+
|
|
30
|
+
import {
|
|
31
|
+
formatBestRoute,
|
|
32
|
+
getRequiredWallets,
|
|
33
|
+
} from '../components/ConfirmWalletsModal/ConfirmWallets.helpers';
|
|
34
|
+
import { ConfirmWalletsModal } from '../components/ConfirmWalletsModal/ConfirmWalletsModal';
|
|
35
|
+
import { HeaderButton } from '../components/HeaderButtons/HeaderButtons.styles';
|
|
36
|
+
import { Layout } from '../components/Layout';
|
|
37
|
+
import { NoRoutes } from '../components/NoRoutes';
|
|
38
|
+
import { getConfirmSwapErrorMessage } from '../constants/errors';
|
|
39
|
+
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
40
|
+
import {
|
|
41
|
+
GAS_FEE_MAX_DECIMALS,
|
|
42
|
+
GAS_FEE_MIN_DECIMALS,
|
|
43
|
+
PERCENTAGE_CHANGE_MAX_DECIMALS,
|
|
44
|
+
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
45
|
+
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
46
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
47
|
+
USD_VALUE_MAX_DECIMALS,
|
|
48
|
+
USD_VALUE_MIN_DECIMALS,
|
|
49
|
+
} from '../constants/routing';
|
|
50
|
+
import { getRouteWarningMessage } from '../constants/warnings';
|
|
34
51
|
import { useConfirmSwap } from '../hooks/useConfirmSwap';
|
|
52
|
+
import { useBestRouteStore } from '../store/bestRoute';
|
|
53
|
+
import { useMetaStore } from '../store/meta';
|
|
35
54
|
import { useSettingsStore } from '../store/settings';
|
|
36
55
|
import { useUiStore } from '../store/ui';
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
56
|
+
import { useWalletsStore } from '../store/wallets';
|
|
57
|
+
import {
|
|
58
|
+
ConfirmSwapErrorTypes,
|
|
59
|
+
RouteWarningType,
|
|
60
|
+
SlippageWarningType,
|
|
61
|
+
} from '../types';
|
|
62
|
+
import {
|
|
63
|
+
numberToString,
|
|
64
|
+
secondsToString,
|
|
65
|
+
totalArrivalTime,
|
|
66
|
+
} from '../utils/numbers';
|
|
67
|
+
import { getPriceImpactLevel } from '../utils/routing';
|
|
68
|
+
import { getPercentageChange, getTotalFeeInUsd } from '../utils/swap';
|
|
69
|
+
|
|
70
|
+
const Container = styled('div', {
|
|
71
|
+
position: 'relative',
|
|
72
|
+
width: '100%',
|
|
73
|
+
'& .description': {
|
|
74
|
+
display: 'flex',
|
|
75
|
+
justifyContent: 'space-between',
|
|
76
|
+
alignItems: 'center',
|
|
77
|
+
paddingBottom: '$10',
|
|
78
|
+
},
|
|
79
|
+
'& .icon': {
|
|
80
|
+
width: '$24',
|
|
81
|
+
height: '$24',
|
|
82
|
+
display: 'flex',
|
|
83
|
+
justifyContent: 'center',
|
|
84
|
+
alignItems: 'center',
|
|
85
|
+
},
|
|
86
|
+
});
|
|
42
87
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
88
|
+
const Buttons = styled('div', {
|
|
89
|
+
width: '100%',
|
|
90
|
+
display: 'flex',
|
|
91
|
+
justifyContent: 'space-between',
|
|
92
|
+
'& .confirm-button': {
|
|
93
|
+
flexGrow: 1,
|
|
94
|
+
paddingRight: '$10',
|
|
95
|
+
},
|
|
96
|
+
[`& ${IconButton}`]: {
|
|
97
|
+
width: '$48',
|
|
98
|
+
height: '$48',
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
type PropTypes = {
|
|
103
|
+
config?: WidgetConfig;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export function ConfirmSwapPage(props: PropTypes) {
|
|
107
|
+
//TODO: move component's logics to a custom hook
|
|
108
|
+
const { config } = props;
|
|
109
|
+
const {
|
|
110
|
+
bestRoute,
|
|
111
|
+
inputAmount,
|
|
112
|
+
outputAmount,
|
|
113
|
+
inputUsdValue,
|
|
114
|
+
outputUsdValue,
|
|
115
|
+
setInputAmount,
|
|
116
|
+
selectedWallets,
|
|
117
|
+
routeWalletsConfirmed,
|
|
118
|
+
setRouteWalletConfirmed,
|
|
119
|
+
customDestination,
|
|
120
|
+
} = useBestRouteStore();
|
|
48
121
|
const navigate = useNavigate();
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
const
|
|
122
|
+
const [dbErrorMessage, setDbErrorMessage] = useState<string>('');
|
|
123
|
+
const [showSlippageWarning, setShowSlippageWarning] = useState(false);
|
|
124
|
+
|
|
125
|
+
const { connectedWallets } = useWalletsStore();
|
|
126
|
+
const showWalletsOnInit = !routeWalletsConfirmed;
|
|
127
|
+
const [showWallets, setShowWallets] = useState(false);
|
|
53
128
|
const setSelectedSwap = useUiStore.use.setSelectedSwap();
|
|
54
|
-
const {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const customDestination = useWalletsStore.use.customDestination();
|
|
59
|
-
const setCustomDestination = useWalletsStore.use.setCustomDestination();
|
|
60
|
-
const initSelectedWallets = useWalletsStore.use.initSelectedWallets();
|
|
61
|
-
const setSelectedWallet = useWalletsStore.use.setSelectedWallet();
|
|
129
|
+
const {
|
|
130
|
+
meta: { tokens },
|
|
131
|
+
loadingStatus: loadingMetaStatus,
|
|
132
|
+
} = useMetaStore();
|
|
62
133
|
const slippage = useSettingsStore.use.slippage();
|
|
63
134
|
const customSlippage = useSettingsStore.use.customSlippage();
|
|
64
|
-
const inputUsdValue = useBestRouteStore.use.inputUsdValue();
|
|
65
|
-
const outputUsdValue = useBestRouteStore.use.outputUsdValue();
|
|
66
|
-
const setInputAmount = useBestRouteStore.use.setInputAmount();
|
|
67
|
-
const [dbErrorMessage, setDbErrorMessage] = useState<string>('');
|
|
68
|
-
const bestRouteloadingStatus = getBestRouteStatus(
|
|
69
|
-
fetchingBestRoute,
|
|
70
|
-
!!fetchingBestRouteError
|
|
71
|
-
);
|
|
72
|
-
const [destinationChain, setDestinationChain] = useState<string>('');
|
|
73
|
-
|
|
74
135
|
const { manager } = useManager();
|
|
136
|
+
const selectedSlippage = customSlippage || slippage;
|
|
75
137
|
const {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
confirmSwap,
|
|
138
|
+
fetch: confirmSwap,
|
|
139
|
+
loading: fetchingConfirmationRoute,
|
|
140
|
+
cancelFetch,
|
|
80
141
|
} = useConfirmSwap();
|
|
142
|
+
const [confirmSwapResult, setConfirmSwapResult] =
|
|
143
|
+
useState<ConfirmSwapFetchResult>({
|
|
144
|
+
swap: null,
|
|
145
|
+
error: null,
|
|
146
|
+
warnings: null,
|
|
147
|
+
});
|
|
148
|
+
const showSkeleton =
|
|
149
|
+
fetchingConfirmationRoute || loadingMetaStatus === 'loading';
|
|
150
|
+
const showNoRouteFound =
|
|
151
|
+
!fetchingConfirmationRoute &&
|
|
152
|
+
confirmSwapResult.error &&
|
|
153
|
+
[
|
|
154
|
+
ConfirmSwapErrorTypes.NO_ROUTE,
|
|
155
|
+
ConfirmSwapErrorTypes.REQUEST_FAILED,
|
|
156
|
+
].includes(confirmSwapResult.error.type);
|
|
157
|
+
const showBestRoute =
|
|
158
|
+
!showNoRouteFound &&
|
|
159
|
+
!fetchingConfirmationRoute &&
|
|
160
|
+
bestRoute &&
|
|
161
|
+
bestRoute.result;
|
|
81
162
|
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
163
|
+
const totalFeeInUsd = getTotalFeeInUsd(bestRoute, tokens);
|
|
164
|
+
const percentageChange = numberToString(
|
|
165
|
+
getPercentageChange(
|
|
166
|
+
inputUsdValue?.toNumber() ?? 0,
|
|
167
|
+
outputUsdValue?.toNumber() ?? 0
|
|
168
|
+
),
|
|
169
|
+
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
170
|
+
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
86
171
|
);
|
|
87
172
|
|
|
88
|
-
const
|
|
173
|
+
const warningLevel = getPriceImpactLevel(parseFloat(percentageChange));
|
|
174
|
+
|
|
175
|
+
const onConfirmSwap: ConfirmSwap['fetch'] = async ({
|
|
176
|
+
selectedWallets,
|
|
177
|
+
customDestination,
|
|
178
|
+
}) => {
|
|
179
|
+
const result = await confirmSwap?.({ selectedWallets, customDestination });
|
|
180
|
+
setConfirmSwapResult(result);
|
|
181
|
+
return result;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const addNewSwap = async () => {
|
|
185
|
+
if (confirmSwapResult.swap && routeWalletsConfirmed) {
|
|
186
|
+
try {
|
|
187
|
+
await manager?.create(
|
|
188
|
+
'swap',
|
|
189
|
+
{ swapDetails: confirmSwapResult.swap },
|
|
190
|
+
{ id: confirmSwapResult.swap.requestId }
|
|
191
|
+
);
|
|
192
|
+
setSelectedSwap(confirmSwapResult.swap.requestId);
|
|
193
|
+
navigate(
|
|
194
|
+
'/' + navigationRoutes.swaps + `/${confirmSwapResult.swap.requestId}`,
|
|
195
|
+
{
|
|
196
|
+
replace: true,
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
setTimeout(() => {
|
|
200
|
+
setInputAmount('');
|
|
201
|
+
}, 0);
|
|
202
|
+
} catch (e) {
|
|
203
|
+
setDbErrorMessage('Error: ' + (e as any)?.message);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const onConfirm = async () => {
|
|
209
|
+
await addNewSwap();
|
|
210
|
+
};
|
|
89
211
|
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
212
|
+
const onStartConfirmSwap = async () => {
|
|
213
|
+
if (confirmSwapResult?.warnings?.slippage) {
|
|
214
|
+
setShowSlippageWarning(true);
|
|
215
|
+
} else {
|
|
216
|
+
await onConfirm();
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
const onRefresh = async () => {
|
|
221
|
+
setConfirmSwapResult({
|
|
222
|
+
error: null,
|
|
223
|
+
swap: null,
|
|
224
|
+
warnings: null,
|
|
225
|
+
});
|
|
226
|
+
confirmSwap({ selectedWallets })
|
|
227
|
+
.then((res) => {
|
|
228
|
+
setConfirmSwapResult(res);
|
|
229
|
+
})
|
|
230
|
+
.catch((error) => console.error(error));
|
|
231
|
+
};
|
|
93
232
|
|
|
94
|
-
const fromAmount = numberToString(firstStep?.fromAmount, 4, 6);
|
|
95
|
-
const toAmount = numberToString(lastStep?.toAmount, 4, 6);
|
|
96
233
|
useEffect(() => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
234
|
+
if (showWalletsOnInit) {
|
|
235
|
+
cancelFetch();
|
|
236
|
+
}
|
|
237
|
+
}, [showWalletsOnInit]);
|
|
238
|
+
|
|
239
|
+
useEffect(() => {
|
|
240
|
+
if (showWalletsOnInit) {
|
|
241
|
+
setShowWallets(showWalletsOnInit);
|
|
242
|
+
}
|
|
243
|
+
}, [showWalletsOnInit]);
|
|
244
|
+
|
|
245
|
+
useEffect(() => {
|
|
246
|
+
if (!showWalletsOnInit) {
|
|
247
|
+
confirmSwap({ selectedWallets, customDestination })
|
|
248
|
+
.then((result) => setConfirmSwapResult(result))
|
|
249
|
+
.catch((error) => console.error(error));
|
|
100
250
|
}
|
|
101
251
|
}, []);
|
|
102
|
-
const lastStepToBlockchain =
|
|
103
|
-
bestRoute?.result?.swaps[bestRoute?.result?.swaps.length - 1].to.blockchain;
|
|
104
|
-
const isWalletRequired = !!bestRoute?.result?.swaps.find(
|
|
105
|
-
(swap) => swap.from.blockchain === lastStepToBlockchain
|
|
106
|
-
);
|
|
107
252
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
253
|
+
useEffect(() => {
|
|
254
|
+
const routeChanged =
|
|
255
|
+
confirmSwapResult.warnings?.route?.type &&
|
|
256
|
+
Object.values(RouteWarningType).includes(
|
|
257
|
+
confirmSwapResult.warnings?.route?.type
|
|
258
|
+
);
|
|
114
259
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
260
|
+
const selectedWalletDisconnected =
|
|
261
|
+
selectedWallets.length < 1 ||
|
|
262
|
+
!selectedWallets.every((selectedWallet) =>
|
|
263
|
+
connectedWallets.find(
|
|
264
|
+
(connectedWallet) =>
|
|
265
|
+
selectedWallet.address === connectedWallet.address &&
|
|
266
|
+
selectedWallet.walletType === connectedWallet.walletType &&
|
|
267
|
+
selectedWallet.chain === connectedWallet.chain
|
|
268
|
+
)
|
|
269
|
+
);
|
|
121
270
|
|
|
122
|
-
|
|
271
|
+
let routeWalletsChanged = false;
|
|
123
272
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
273
|
+
if (routeChanged) {
|
|
274
|
+
let requiredWallets = getRequiredWallets(bestRoute);
|
|
275
|
+
|
|
276
|
+
const lastStepToBlockchain =
|
|
277
|
+
bestRoute?.result?.swaps[bestRoute.result.swaps.length - 1].to
|
|
278
|
+
.blockchain;
|
|
279
|
+
|
|
280
|
+
const isLastWalletRequired = !!bestRoute?.result?.swaps.find(
|
|
281
|
+
(swap) => swap.from.blockchain === lastStepToBlockchain
|
|
282
|
+
);
|
|
283
|
+
|
|
284
|
+
if (!isLastWalletRequired) {
|
|
285
|
+
requiredWallets = requiredWallets.slice(
|
|
286
|
+
-requiredWallets.length,
|
|
287
|
+
requiredWallets.length - 1
|
|
130
288
|
);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const allRequiredWalletsSelected = requiredWallets.every(
|
|
292
|
+
(requiredWallet) =>
|
|
293
|
+
selectedWallets.find(
|
|
294
|
+
(selectedWallet) => selectedWallet.chain === requiredWallet
|
|
295
|
+
)
|
|
296
|
+
);
|
|
297
|
+
|
|
298
|
+
if (!allRequiredWalletsSelected) {
|
|
299
|
+
routeWalletsChanged = true;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (bestRoute && (selectedWalletDisconnected || routeWalletsChanged)) {
|
|
304
|
+
queueMicrotask(() => flushSync(setShowWallets.bind(null, true)));
|
|
305
|
+
setRouteWalletConfirmed(false);
|
|
306
|
+
}
|
|
307
|
+
}, [
|
|
308
|
+
confirmSwapResult.warnings?.route,
|
|
309
|
+
selectedWallets.length,
|
|
310
|
+
connectedWallets.length,
|
|
311
|
+
]);
|
|
131
312
|
|
|
132
313
|
return (
|
|
133
|
-
<
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
'swap',
|
|
149
|
-
{ swapDetails: swap },
|
|
150
|
-
{ id: swap.requestId }
|
|
151
|
-
);
|
|
152
|
-
setSelectedSwap(swap.requestId);
|
|
153
|
-
navigate('/' + navigationRoutes.swaps + `/${swap.requestId}`, {
|
|
154
|
-
replace: true,
|
|
155
|
-
});
|
|
156
|
-
setTimeout(() => {
|
|
157
|
-
setInputAmount('');
|
|
158
|
-
}, 0);
|
|
159
|
-
} catch (e) {
|
|
160
|
-
setDbErrorMessage('Error: ' + (e as any)?.message);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
});
|
|
314
|
+
<Layout
|
|
315
|
+
header={{
|
|
316
|
+
title: 'Confirm Swap',
|
|
317
|
+
onBack: navigate.bind(null, -1),
|
|
318
|
+
hasConnectWallet: true,
|
|
319
|
+
suffix: (
|
|
320
|
+
<Tooltip side="bottom" content={i18n.t('Settings')}>
|
|
321
|
+
<HeaderButton
|
|
322
|
+
size="small"
|
|
323
|
+
variant="ghost"
|
|
324
|
+
onClick={() => navigate('/' + navigationRoutes.settings)}>
|
|
325
|
+
<SettingsIcon size={18} color="black" />
|
|
326
|
+
</HeaderButton>
|
|
327
|
+
</Tooltip>
|
|
328
|
+
),
|
|
164
329
|
}}
|
|
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
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
330
|
+
footer={
|
|
331
|
+
<Buttons>
|
|
332
|
+
<div className="confirm-button">
|
|
333
|
+
<Button
|
|
334
|
+
variant="contained"
|
|
335
|
+
type="primary"
|
|
336
|
+
size="large"
|
|
337
|
+
fullWidth
|
|
338
|
+
loading={fetchingConfirmationRoute}
|
|
339
|
+
disabled={!!confirmSwapResult.error}
|
|
340
|
+
onClick={onStartConfirmSwap}>
|
|
341
|
+
Start Swap
|
|
342
|
+
</Button>
|
|
343
|
+
</div>
|
|
344
|
+
<IconButton
|
|
345
|
+
variant="contained"
|
|
346
|
+
type="primary"
|
|
347
|
+
size="large"
|
|
348
|
+
loading={fetchingConfirmationRoute}
|
|
349
|
+
onClick={setShowWallets.bind(null, true)}>
|
|
350
|
+
<WalletIcon size={24} />
|
|
351
|
+
</IconButton>
|
|
352
|
+
</Buttons>
|
|
353
|
+
}>
|
|
354
|
+
<Modal
|
|
355
|
+
anchor="bottom"
|
|
356
|
+
open={showSlippageWarning}
|
|
357
|
+
prefix={
|
|
358
|
+
<Button
|
|
359
|
+
size="small"
|
|
360
|
+
variant="ghost"
|
|
361
|
+
onClick={() => navigate('/' + navigationRoutes.settings)}>
|
|
362
|
+
<Typography variant="label" size="medium" color="$neutral900">
|
|
363
|
+
Change settings
|
|
364
|
+
</Typography>
|
|
365
|
+
</Button>
|
|
366
|
+
}
|
|
367
|
+
container={document.querySelector('#swap-box') as HTMLDivElement}
|
|
368
|
+
onClose={setShowSlippageWarning.bind(null, (prevState) => !prevState)}>
|
|
369
|
+
{confirmSwapResult.warnings?.slippage && (
|
|
370
|
+
<MessageBox
|
|
371
|
+
type="warning"
|
|
372
|
+
title={
|
|
373
|
+
confirmSwapResult.warnings.slippage.type ===
|
|
374
|
+
SlippageWarningType.HIGH_SLIPPAGE
|
|
375
|
+
? 'High slippage'
|
|
376
|
+
: 'Low slippage'
|
|
201
377
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
378
|
+
description={
|
|
379
|
+
confirmSwapResult.warnings.slippage.type ===
|
|
380
|
+
SlippageWarningType.HIGH_SLIPPAGE
|
|
381
|
+
? i18n.t(
|
|
382
|
+
'highSlippage',
|
|
383
|
+
{ selectedSlippage },
|
|
384
|
+
{
|
|
385
|
+
message:
|
|
386
|
+
' Caution, your slippage is high (={selectedSlippage}). Your trade may be front run.',
|
|
387
|
+
}
|
|
388
|
+
)
|
|
389
|
+
: i18n.t(
|
|
390
|
+
'increaseSlippage',
|
|
391
|
+
|
|
392
|
+
{
|
|
393
|
+
minRequiredSlippage:
|
|
394
|
+
confirmSwapResult.warnings.slippage.slippage,
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
message:
|
|
398
|
+
'We recommend you to increase slippage to at least {minRequiredSlippage} for this route.',
|
|
399
|
+
}
|
|
400
|
+
)
|
|
401
|
+
}>
|
|
402
|
+
<Divider size={18} />
|
|
403
|
+
<Divider size={32} />
|
|
404
|
+
<Button
|
|
405
|
+
size="large"
|
|
406
|
+
type="primary"
|
|
407
|
+
variant="contained"
|
|
408
|
+
fullWidth
|
|
409
|
+
onClick={onConfirm}>
|
|
410
|
+
Confirm anyway
|
|
411
|
+
</Button>
|
|
412
|
+
</MessageBox>
|
|
413
|
+
)}
|
|
414
|
+
</Modal>
|
|
415
|
+
{showWallets && (
|
|
416
|
+
<ConfirmWalletsModal
|
|
417
|
+
open={showWallets}
|
|
418
|
+
onClose={() => setShowWallets(false)}
|
|
419
|
+
onCancel={cancelFetch}
|
|
420
|
+
loading={fetchingConfirmationRoute}
|
|
421
|
+
onCheckBalance={onConfirmSwap}
|
|
422
|
+
config={config}
|
|
423
|
+
/>
|
|
424
|
+
)}
|
|
425
|
+
|
|
426
|
+
<Container>
|
|
427
|
+
<div className="description">
|
|
428
|
+
<Typography variant="title" size="small">
|
|
429
|
+
You get
|
|
430
|
+
</Typography>
|
|
431
|
+
<Button
|
|
432
|
+
style={{ padding: '0' }}
|
|
433
|
+
variant="ghost"
|
|
434
|
+
disabled={fetchingConfirmationRoute}
|
|
435
|
+
onClick={onRefresh}>
|
|
436
|
+
<div className="icon">
|
|
437
|
+
<RefreshIcon size={16} />
|
|
438
|
+
</div>
|
|
439
|
+
</Button>
|
|
440
|
+
</div>
|
|
441
|
+
{dbErrorMessage && (
|
|
442
|
+
<>
|
|
443
|
+
<Alert type="error" variant="alarm" title={dbErrorMessage} />
|
|
444
|
+
<Divider size={12} />
|
|
445
|
+
</>
|
|
446
|
+
)}
|
|
447
|
+
{confirmSwapResult.warnings?.route && (
|
|
448
|
+
<>
|
|
449
|
+
<Alert
|
|
450
|
+
variant="alarm"
|
|
451
|
+
type="warning"
|
|
452
|
+
title={getRouteWarningMessage(confirmSwapResult.warnings.route)}
|
|
453
|
+
/>
|
|
454
|
+
<Divider size={12} />
|
|
455
|
+
</>
|
|
456
|
+
)}
|
|
457
|
+
{showSkeleton && <BestRouteSkeleton type="swap-preview" expanded />}
|
|
458
|
+
{showBestRoute && (
|
|
459
|
+
<BestRoute
|
|
460
|
+
expanded={true}
|
|
461
|
+
steps={formatBestRoute(bestRoute) ?? []}
|
|
462
|
+
input={{
|
|
463
|
+
value: numberToString(
|
|
464
|
+
inputAmount,
|
|
465
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
466
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
467
|
+
),
|
|
468
|
+
usdValue: numberToString(
|
|
469
|
+
inputUsdValue,
|
|
470
|
+
USD_VALUE_MIN_DECIMALS,
|
|
471
|
+
USD_VALUE_MAX_DECIMALS
|
|
472
|
+
),
|
|
208
473
|
}}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
474
|
+
output={{
|
|
475
|
+
value: numberToString(
|
|
476
|
+
outputAmount,
|
|
477
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
478
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
479
|
+
),
|
|
480
|
+
usdValue: numberToString(
|
|
481
|
+
outputUsdValue,
|
|
482
|
+
USD_VALUE_MIN_DECIMALS,
|
|
483
|
+
USD_VALUE_MAX_DECIMALS
|
|
484
|
+
),
|
|
212
485
|
}}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
percentageChange={
|
|
222
|
-
|
|
223
|
-
<PercentageChange
|
|
224
|
-
percentageChange={numberToString(percentageChange, 0, 2)}
|
|
225
|
-
showPercentageChange={!!percentageChange?.lt(0)}
|
|
226
|
-
/>
|
|
227
|
-
)
|
|
228
|
-
}
|
|
229
|
-
/>
|
|
230
|
-
</>
|
|
231
|
-
}
|
|
232
|
-
previewRoutes={
|
|
233
|
-
<RoutesOverview
|
|
234
|
-
routes={bestRoute}
|
|
235
|
-
totalFee={numberToString(totalFeeInUsd, 0, 2)}
|
|
236
|
-
/>
|
|
237
|
-
}
|
|
238
|
-
loading={fetchingConfirmedRoute}
|
|
239
|
-
errors={
|
|
240
|
-
dbErrorMessage
|
|
241
|
-
? [dbErrorMessage, ...ConfirmSwapErrors(errors)]
|
|
242
|
-
: ConfirmSwapErrors(errors)
|
|
243
|
-
}
|
|
244
|
-
warnings={ConfirmSwapWarnings(warnings)}
|
|
245
|
-
extraMessages={
|
|
246
|
-
<>
|
|
247
|
-
{loadingMetaStatus === 'failed' && <LoadingFailedAlert />}
|
|
248
|
-
{loadingMetaStatus === 'failed' && showHighSlippageWarning && (
|
|
249
|
-
<Divider />
|
|
250
|
-
)}
|
|
251
|
-
<HighSlippageWarning
|
|
252
|
-
selectedSlippage={selectedSlippage}
|
|
253
|
-
highSlippage={selectedSlippage >= HIGH_SLIPPAGE}
|
|
254
|
-
changeSlippage={() => navigate('/' + navigationRoutes.settings)}
|
|
486
|
+
totalFee={numberToString(
|
|
487
|
+
totalFeeInUsd,
|
|
488
|
+
GAS_FEE_MIN_DECIMALS,
|
|
489
|
+
GAS_FEE_MAX_DECIMALS
|
|
490
|
+
)}
|
|
491
|
+
totalTime={secondsToString(totalArrivalTime(bestRoute))}
|
|
492
|
+
recommended={true}
|
|
493
|
+
type="swap-preview"
|
|
494
|
+
percentageChange={percentageChange}
|
|
495
|
+
warningLevel={warningLevel}
|
|
255
496
|
/>
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
497
|
+
)}
|
|
498
|
+
{showNoRouteFound && (
|
|
499
|
+
<>
|
|
500
|
+
<Divider size={12} />
|
|
501
|
+
<NoRoutes
|
|
502
|
+
diagnosisMessage={
|
|
503
|
+
confirmSwapResult.error?.type === ConfirmSwapErrorTypes.NO_ROUTE
|
|
504
|
+
? confirmSwapResult.error.diagnosisMessage
|
|
505
|
+
: undefined
|
|
506
|
+
}
|
|
507
|
+
error={
|
|
508
|
+
confirmSwapResult.error?.type ===
|
|
509
|
+
ConfirmSwapErrorTypes.REQUEST_FAILED
|
|
510
|
+
}
|
|
511
|
+
fetch={onRefresh}
|
|
512
|
+
/>
|
|
513
|
+
</>
|
|
514
|
+
)}
|
|
515
|
+
{confirmSwapResult.error?.type ===
|
|
516
|
+
ConfirmSwapErrorTypes.ROUTE_UPDATED_WITH_HIGH_VALUE_LOSS && (
|
|
517
|
+
<>
|
|
518
|
+
<Alert
|
|
519
|
+
variant="alarm"
|
|
520
|
+
type="error"
|
|
521
|
+
title={getConfirmSwapErrorMessage(confirmSwapResult.error)}
|
|
522
|
+
/>
|
|
523
|
+
<Divider size={12} />
|
|
524
|
+
</>
|
|
525
|
+
)}
|
|
526
|
+
</Container>
|
|
527
|
+
</Layout>
|
|
264
528
|
);
|
|
265
529
|
}
|