@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
package/src/utils/swap.ts
CHANGED
|
@@ -1,26 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
+
import type { LoadingStatus } from '../store/meta';
|
|
3
|
+
import type { ConnectedWallet } from '../store/wallets';
|
|
4
|
+
import type { ConvertedToken, SwapButtonState, Wallet } from '../types';
|
|
5
|
+
import type {
|
|
6
|
+
PendingSwap,
|
|
7
|
+
PendingSwapStep,
|
|
8
|
+
} from '@rango-dev/queue-manager-rango-preset';
|
|
9
|
+
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
10
|
+
import type {
|
|
3
11
|
BestRouteRequest,
|
|
4
12
|
BestRouteResponse,
|
|
13
|
+
BlockchainMeta,
|
|
5
14
|
RecommendedSlippage,
|
|
6
15
|
SwapResult,
|
|
7
16
|
Token,
|
|
8
17
|
} from 'rango-sdk';
|
|
9
|
-
|
|
10
|
-
import {
|
|
18
|
+
|
|
19
|
+
import { PendingSwapNetworkStatus } from '@rango-dev/queue-manager-rango-preset';
|
|
20
|
+
import BigNumber from 'bignumber.js';
|
|
21
|
+
|
|
22
|
+
import { isValidAddress } from '../components/ConfirmWalletsModal/ConfirmWallets.helpers';
|
|
23
|
+
import { errorMessages } from '../constants/errors';
|
|
24
|
+
import { swapButtonTitles } from '../constants/messages';
|
|
11
25
|
import { ZERO } from '../constants/numbers';
|
|
26
|
+
import {
|
|
27
|
+
BALANCE_MAX_DECIMALS,
|
|
28
|
+
BALANCE_MIN_DECIMALS,
|
|
29
|
+
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
30
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
31
|
+
} from '../constants/routing';
|
|
32
|
+
import { useMetaStore } from '../store/meta';
|
|
33
|
+
import { ButtonState } from '../types';
|
|
34
|
+
|
|
35
|
+
import { removeDuplicateFrom } from './common';
|
|
12
36
|
import { numberToString } from './numbers';
|
|
13
|
-
import { WalletType } from '@rango-dev/wallets-shared';
|
|
14
37
|
import { getRequiredBalanceOfWallet } from './routing';
|
|
15
38
|
import { getRequiredChains } from './wallets';
|
|
16
|
-
import { LoadingStatus, useMetaStore } from '../store/meta';
|
|
17
|
-
import { ConvertedToken, SwapButtonState, Wallet } from '../types';
|
|
18
|
-
import {
|
|
19
|
-
PendingSwapNetworkStatus,
|
|
20
|
-
PendingSwapStep,
|
|
21
|
-
} from '@rango-dev/queue-manager-rango-preset';
|
|
22
|
-
import { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
23
|
-
import { removeDuplicateFrom } from './common';
|
|
24
39
|
|
|
25
40
|
export function getOutputRatio(
|
|
26
41
|
inputUsdValue: BigNumber | null,
|
|
@@ -31,8 +46,9 @@ export function getOutputRatio(
|
|
|
31
46
|
!outputUsdValue ||
|
|
32
47
|
inputUsdValue.lte(ZERO) ||
|
|
33
48
|
outputUsdValue.lte(ZERO)
|
|
34
|
-
)
|
|
49
|
+
) {
|
|
35
50
|
return 0;
|
|
51
|
+
}
|
|
36
52
|
return outputUsdValue.div(inputUsdValue).minus(1).multipliedBy(100);
|
|
37
53
|
}
|
|
38
54
|
|
|
@@ -61,9 +77,8 @@ export function hasLimitError(bestRoute: BestRouteResponse | null): boolean {
|
|
|
61
77
|
const isExclusive = swap.fromAmountRestrictionType === 'EXCLUSIVE';
|
|
62
78
|
if (isExclusive) {
|
|
63
79
|
return minimum?.gte(swap.fromAmount) || maximum?.lte(swap.fromAmount);
|
|
64
|
-
} else {
|
|
65
|
-
return minimum?.gt(swap.fromAmount) || maximum?.lt(swap.fromAmount);
|
|
66
80
|
}
|
|
81
|
+
return minimum?.gt(swap.fromAmount) || maximum?.lt(swap.fromAmount);
|
|
67
82
|
}).length > 0
|
|
68
83
|
);
|
|
69
84
|
}
|
|
@@ -73,8 +88,9 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
|
73
88
|
fromAmountRangeError: string;
|
|
74
89
|
recommendation: string;
|
|
75
90
|
} {
|
|
76
|
-
if (!bestRoute)
|
|
91
|
+
if (!bestRoute) {
|
|
77
92
|
return { swap: null, fromAmountRangeError: '', recommendation: '' };
|
|
93
|
+
}
|
|
78
94
|
const swap = (bestRoute?.result?.swaps || []).filter((swap) => {
|
|
79
95
|
const minimum = !!swap.fromAmountMinValue
|
|
80
96
|
? new BigNumber(swap.fromAmountMinValue)
|
|
@@ -85,12 +101,12 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
|
85
101
|
const isExclusive = swap.fromAmountRestrictionType === 'EXCLUSIVE';
|
|
86
102
|
if (isExclusive) {
|
|
87
103
|
return minimum?.gte(swap.fromAmount) || maximum?.lte(swap.fromAmount);
|
|
88
|
-
} else {
|
|
89
|
-
return minimum?.gt(swap.fromAmount) || maximum?.lt(swap.fromAmount);
|
|
90
104
|
}
|
|
105
|
+
return minimum?.gt(swap.fromAmount) || maximum?.lt(swap.fromAmount);
|
|
91
106
|
})[0];
|
|
92
|
-
if (!swap)
|
|
107
|
+
if (!swap) {
|
|
93
108
|
return { swap: null, fromAmountRangeError: '', recommendation: '' };
|
|
109
|
+
}
|
|
94
110
|
const minimum = !!swap.fromAmountMinValue
|
|
95
111
|
? new BigNumber(swap.fromAmountMinValue)
|
|
96
112
|
: null;
|
|
@@ -102,27 +118,35 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
|
102
118
|
let fromAmountRangeError = '';
|
|
103
119
|
let recommendation = '';
|
|
104
120
|
if (!isExclusive && !!minimum && minimum.gt(swap.fromAmount)) {
|
|
105
|
-
fromAmountRangeError = `Required: >= ${numberToString(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
121
|
+
fromAmountRangeError = `Required: >= ${numberToString(
|
|
122
|
+
minimum,
|
|
123
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
124
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
125
|
+
)} ${swap.from.symbol}`;
|
|
126
|
+
recommendation = errorMessages.bridgeLimitErrors.increaseAmount;
|
|
109
127
|
} else if (isExclusive && !!minimum && minimum.gte(swap.fromAmount)) {
|
|
110
|
-
fromAmountRangeError = `Required: > ${numberToString(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
128
|
+
fromAmountRangeError = `Required: > ${numberToString(
|
|
129
|
+
minimum,
|
|
130
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
131
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
132
|
+
)} ${swap.from.symbol}`;
|
|
133
|
+
recommendation = errorMessages.bridgeLimitErrors.increaseAmount;
|
|
114
134
|
}
|
|
115
135
|
|
|
116
136
|
if (!isExclusive && !!maximum && maximum.lt(swap.fromAmount)) {
|
|
117
|
-
fromAmountRangeError = `Required: <= ${numberToString(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
137
|
+
fromAmountRangeError = `Required: <= ${numberToString(
|
|
138
|
+
maximum,
|
|
139
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
140
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
141
|
+
)} ${swap.from.symbol}`;
|
|
142
|
+
recommendation = errorMessages.bridgeLimitErrors.decreaseAmount;
|
|
121
143
|
} else if (isExclusive && !!maximum && maximum.lte(swap.fromAmount)) {
|
|
122
|
-
fromAmountRangeError = `Required: < ${numberToString(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
144
|
+
fromAmountRangeError = `Required: < ${numberToString(
|
|
145
|
+
maximum,
|
|
146
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
147
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
148
|
+
)} ${swap.from.symbol}`;
|
|
149
|
+
recommendation = errorMessages.bridgeLimitErrors.decreaseAmount;
|
|
126
150
|
}
|
|
127
151
|
|
|
128
152
|
return { swap, fromAmountRangeError, recommendation };
|
|
@@ -139,46 +163,62 @@ export function getSwapButtonState(
|
|
|
139
163
|
needsToWarnEthOnPath: boolean,
|
|
140
164
|
inputAmount: string
|
|
141
165
|
): SwapButtonState {
|
|
142
|
-
if (loadingMetaStatus !== 'success')
|
|
143
|
-
return {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
else if (!bestRoute || !bestRoute.result)
|
|
151
|
-
return { title: `${i18n.t('Swap')}`, disabled: true };
|
|
152
|
-
else if (hasLimitError)
|
|
153
|
-
return { title: `${i18n.t('Limit Error')}`, disabled: true };
|
|
154
|
-
else if (highValueLoss)
|
|
155
|
-
return { title: `${i18n.t('Price impact is too high!')}`, disabled: true };
|
|
156
|
-
else if (priceImpactCanNotBeComputed)
|
|
166
|
+
if (loadingMetaStatus !== 'success') {
|
|
167
|
+
return {
|
|
168
|
+
title: swapButtonTitles.connectWallet,
|
|
169
|
+
state: ButtonState.WAITFORCONNECTING,
|
|
170
|
+
disabled: true,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
if (connectedWallets.length == 0) {
|
|
157
174
|
return {
|
|
158
|
-
title:
|
|
175
|
+
title: swapButtonTitles.connectWallet,
|
|
176
|
+
state: ButtonState.WAITFORCONNECTING,
|
|
177
|
+
disabled: false,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
if (
|
|
181
|
+
loading ||
|
|
182
|
+
!bestRoute ||
|
|
183
|
+
!bestRoute.result ||
|
|
184
|
+
hasLimitError ||
|
|
185
|
+
!inputAmount ||
|
|
186
|
+
inputAmount === '0'
|
|
187
|
+
) {
|
|
188
|
+
return {
|
|
189
|
+
title: swapButtonTitles.swap,
|
|
190
|
+
disabled: true,
|
|
191
|
+
state: ButtonState.SWAP,
|
|
192
|
+
};
|
|
193
|
+
} else if (highValueLoss || priceImpactCanNotBeComputed) {
|
|
194
|
+
return {
|
|
195
|
+
title: swapButtonTitles.swapAnyway,
|
|
159
196
|
disabled: false,
|
|
160
197
|
hasWarning: true,
|
|
198
|
+
state: ButtonState.NEEDTOCONFIRM,
|
|
161
199
|
};
|
|
162
|
-
else if (needsToWarnEthOnPath)
|
|
200
|
+
} else if (needsToWarnEthOnPath) {
|
|
163
201
|
return {
|
|
164
|
-
title:
|
|
202
|
+
title: swapButtonTitles.ethRouteWarning,
|
|
165
203
|
disabled: false,
|
|
166
204
|
hasWarning: true,
|
|
205
|
+
state: ButtonState.WARNING,
|
|
167
206
|
};
|
|
168
|
-
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
title: swapButtonTitles.swap,
|
|
210
|
+
disabled: false,
|
|
211
|
+
state: ButtonState.SWAP,
|
|
212
|
+
};
|
|
169
213
|
}
|
|
170
214
|
|
|
171
215
|
export function canComputePriceImpact(
|
|
172
216
|
bestRoute: BestRouteResponse | null,
|
|
173
217
|
inputAmount: string,
|
|
174
|
-
|
|
175
|
-
outputUsdValue: BigNumber | null
|
|
218
|
+
usdValue: BigNumber | null
|
|
176
219
|
) {
|
|
177
220
|
return !(
|
|
178
|
-
(!
|
|
179
|
-
!outputUsdValue ||
|
|
180
|
-
inputUsdValue.lte(ZERO) ||
|
|
181
|
-
outputUsdValue.lte(ZERO)) &&
|
|
221
|
+
(!usdValue || usdValue.lte(ZERO)) &&
|
|
182
222
|
!!bestRoute?.result &&
|
|
183
223
|
!!inputAmount &&
|
|
184
224
|
inputAmount !== '0' &&
|
|
@@ -194,11 +234,13 @@ export function requiredWallets(route: BestRouteResponse | null) {
|
|
|
194
234
|
const currentStepFromBlockchain = swap.from.blockchain;
|
|
195
235
|
const currentStepToBlockchain = swap.to.blockchain;
|
|
196
236
|
let lastAddedWallet = wallets[wallets.length - 1];
|
|
197
|
-
if (currentStepFromBlockchain != lastAddedWallet)
|
|
237
|
+
if (currentStepFromBlockchain != lastAddedWallet) {
|
|
198
238
|
wallets.push(currentStepFromBlockchain);
|
|
239
|
+
}
|
|
199
240
|
lastAddedWallet = wallets[wallets.length - 1];
|
|
200
|
-
if (currentStepToBlockchain != lastAddedWallet)
|
|
241
|
+
if (currentStepToBlockchain != lastAddedWallet) {
|
|
201
242
|
wallets.push(currentStepToBlockchain);
|
|
243
|
+
}
|
|
202
244
|
});
|
|
203
245
|
return wallets;
|
|
204
246
|
}
|
|
@@ -225,7 +267,9 @@ export function getUsdFeeOfStep(
|
|
|
225
267
|
let totalFeeInUsd = ZERO;
|
|
226
268
|
for (let i = 0; i < step.fee.length; i++) {
|
|
227
269
|
const fee = step.fee[i];
|
|
228
|
-
if (fee.expenseType === 'DECREASE_FROM_OUTPUT')
|
|
270
|
+
if (fee.expenseType === 'DECREASE_FROM_OUTPUT') {
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
229
273
|
|
|
230
274
|
const unitPrice = getUsdPrice(
|
|
231
275
|
fee.asset.blockchain,
|
|
@@ -255,7 +299,9 @@ export function getTotalFeeInUsd(
|
|
|
255
299
|
}
|
|
256
300
|
|
|
257
301
|
export function hasHighFee(totalFeeInUsd: BigNumber | null) {
|
|
258
|
-
if (!totalFeeInUsd)
|
|
302
|
+
if (!totalFeeInUsd) {
|
|
303
|
+
return false;
|
|
304
|
+
}
|
|
259
305
|
return !totalFeeInUsd.lt(new BigNumber(30));
|
|
260
306
|
}
|
|
261
307
|
|
|
@@ -284,7 +330,9 @@ export function hasProperSlippage(
|
|
|
284
330
|
userSlippage: string,
|
|
285
331
|
minRequiredSlippage: string | null
|
|
286
332
|
) {
|
|
287
|
-
if (!minRequiredSlippage)
|
|
333
|
+
if (!minRequiredSlippage) {
|
|
334
|
+
return true;
|
|
335
|
+
}
|
|
288
336
|
return parseFloat(userSlippage) >= parseFloat(minRequiredSlippage);
|
|
289
337
|
}
|
|
290
338
|
|
|
@@ -294,16 +342,22 @@ export function hasEnoughBalance(
|
|
|
294
342
|
) {
|
|
295
343
|
const fee = route.validationStatus;
|
|
296
344
|
|
|
297
|
-
if (fee === null || fee.length === 0)
|
|
345
|
+
if (fee === null || fee.length === 0) {
|
|
346
|
+
return true;
|
|
347
|
+
}
|
|
298
348
|
|
|
299
349
|
for (const wallet of selectedWallets) {
|
|
300
350
|
const requiredAssets = getRequiredBalanceOfWallet(wallet, fee);
|
|
301
|
-
if (!requiredAssets)
|
|
351
|
+
if (!requiredAssets) {
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
302
354
|
|
|
303
355
|
const enoughBalanceInWallet = requiredAssets
|
|
304
356
|
.map((asset) => asset.ok)
|
|
305
357
|
.reduce((previous, current) => previous && current);
|
|
306
|
-
if (!enoughBalanceInWallet)
|
|
358
|
+
if (!enoughBalanceInWallet) {
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
307
361
|
}
|
|
308
362
|
|
|
309
363
|
return true;
|
|
@@ -321,21 +375,35 @@ export function hasEnoughBalanceAndProperSlippage(
|
|
|
321
375
|
);
|
|
322
376
|
}
|
|
323
377
|
|
|
324
|
-
export function createBestRouteRequestBody(
|
|
325
|
-
fromToken: Token
|
|
326
|
-
toToken: Token
|
|
327
|
-
inputAmount: string
|
|
328
|
-
wallets
|
|
329
|
-
selectedWallets
|
|
330
|
-
disabledLiquiditySources: string[]
|
|
331
|
-
slippage: number
|
|
332
|
-
affiliateRef: string | null
|
|
333
|
-
affiliatePercent: number | null
|
|
334
|
-
affiliateWallets: { [key: string]: string } | null
|
|
335
|
-
initialRoute?: BestRouteResponse
|
|
336
|
-
destination?: string
|
|
337
|
-
): BestRouteRequest {
|
|
338
|
-
const
|
|
378
|
+
export function createBestRouteRequestBody(params: {
|
|
379
|
+
fromToken: Token;
|
|
380
|
+
toToken: Token;
|
|
381
|
+
inputAmount: string;
|
|
382
|
+
wallets?: Wallet[];
|
|
383
|
+
selectedWallets?: Wallet[];
|
|
384
|
+
disabledLiquiditySources: string[];
|
|
385
|
+
slippage: number;
|
|
386
|
+
affiliateRef: string | null;
|
|
387
|
+
affiliatePercent: number | null;
|
|
388
|
+
affiliateWallets: { [key: string]: string } | null;
|
|
389
|
+
initialRoute?: BestRouteResponse;
|
|
390
|
+
destination?: string;
|
|
391
|
+
}): BestRouteRequest {
|
|
392
|
+
const {
|
|
393
|
+
fromToken,
|
|
394
|
+
toToken,
|
|
395
|
+
inputAmount,
|
|
396
|
+
wallets,
|
|
397
|
+
selectedWallets,
|
|
398
|
+
disabledLiquiditySources,
|
|
399
|
+
slippage,
|
|
400
|
+
affiliateRef,
|
|
401
|
+
affiliatePercent,
|
|
402
|
+
affiliateWallets,
|
|
403
|
+
initialRoute,
|
|
404
|
+
destination,
|
|
405
|
+
} = params;
|
|
406
|
+
const selectedWalletsMap = selectedWallets?.reduce(
|
|
339
407
|
(
|
|
340
408
|
selectedWalletsMap: BestRouteRequest['selectedWallets'],
|
|
341
409
|
selectedWallet
|
|
@@ -348,16 +416,18 @@ export function createBestRouteRequestBody(
|
|
|
348
416
|
|
|
349
417
|
const connectedWallets: BestRouteRequest['connectedWallets'] = [];
|
|
350
418
|
|
|
351
|
-
wallets
|
|
419
|
+
wallets?.forEach((wallet) => {
|
|
352
420
|
const chainAndAccounts = connectedWallets.find(
|
|
353
421
|
(connectedWallet) => connectedWallet.blockchain === wallet.chain
|
|
354
422
|
);
|
|
355
|
-
if (!!chainAndAccounts)
|
|
356
|
-
|
|
423
|
+
if (!!chainAndAccounts) {
|
|
424
|
+
chainAndAccounts.addresses.push(wallet.address);
|
|
425
|
+
} else {
|
|
357
426
|
connectedWallets.push({
|
|
358
427
|
blockchain: wallet.chain,
|
|
359
428
|
addresses: [wallet.address],
|
|
360
429
|
});
|
|
430
|
+
}
|
|
361
431
|
});
|
|
362
432
|
|
|
363
433
|
const checkPrerequisites = !!initialRoute;
|
|
@@ -398,11 +468,13 @@ export function createBestRouteRequestBody(
|
|
|
398
468
|
symbol: toToken.symbol,
|
|
399
469
|
},
|
|
400
470
|
connectedWallets,
|
|
401
|
-
|
|
402
|
-
selectedWallets: selectedWalletsMap,
|
|
403
|
-
swapperGroups: disabledLiquiditySources,
|
|
404
|
-
swappersGroupsExclude: true,
|
|
471
|
+
selectedWallets: selectedWalletsMap ?? {},
|
|
405
472
|
slippage: slippage.toString(),
|
|
473
|
+
...(destination && { destination: destination }),
|
|
474
|
+
...(disabledLiquiditySources.length > 0 && {
|
|
475
|
+
swapperGroups: disabledLiquiditySources,
|
|
476
|
+
swappersGroupsExclude: true,
|
|
477
|
+
}),
|
|
406
478
|
...(checkPrerequisites && { blockchains: filteredBlockchains }),
|
|
407
479
|
};
|
|
408
480
|
|
|
@@ -434,12 +506,14 @@ export function getRouteOutputAmount(route: BestRouteResponse | null) {
|
|
|
434
506
|
}
|
|
435
507
|
|
|
436
508
|
export function getPercentageChange(
|
|
437
|
-
|
|
438
|
-
|
|
509
|
+
inputUsdValue: string | number | null,
|
|
510
|
+
outputUsdValue: string | number | null
|
|
439
511
|
) {
|
|
440
|
-
if (!
|
|
441
|
-
|
|
442
|
-
|
|
512
|
+
if (!inputUsdValue || !outputUsdValue) {
|
|
513
|
+
return null;
|
|
514
|
+
}
|
|
515
|
+
return new BigNumber(outputUsdValue)
|
|
516
|
+
.div(new BigNumber(inputUsdValue))
|
|
443
517
|
.minus(1)
|
|
444
518
|
.multipliedBy(100);
|
|
445
519
|
}
|
|
@@ -450,12 +524,16 @@ export function isOutputAmountChangedALot(
|
|
|
450
524
|
) {
|
|
451
525
|
const oldOutputAmount = getRouteOutputAmount(oldRoute);
|
|
452
526
|
const newOutputAmount = getRouteOutputAmount(newRoute);
|
|
453
|
-
if (!oldOutputAmount || !newOutputAmount)
|
|
527
|
+
if (!oldOutputAmount || !newOutputAmount) {
|
|
528
|
+
return false;
|
|
529
|
+
}
|
|
454
530
|
const percentageChange = getPercentageChange(
|
|
455
531
|
oldOutputAmount,
|
|
456
532
|
newOutputAmount
|
|
457
533
|
);
|
|
458
|
-
if (!percentageChange)
|
|
534
|
+
if (!percentageChange) {
|
|
535
|
+
return true;
|
|
536
|
+
}
|
|
459
537
|
|
|
460
538
|
return percentageChange.toNumber() <= -1;
|
|
461
539
|
}
|
|
@@ -480,19 +558,26 @@ export function getBalanceWarnings(
|
|
|
480
558
|
new BigNumber(asset.currentAmount.amount).shiftedBy(
|
|
481
559
|
-asset.currentAmount.decimals
|
|
482
560
|
),
|
|
483
|
-
|
|
561
|
+
BALANCE_MIN_DECIMALS,
|
|
562
|
+
BALANCE_MAX_DECIMALS
|
|
484
563
|
);
|
|
485
564
|
const requiredAmount = numberToString(
|
|
486
565
|
new BigNumber(asset.requiredAmount.amount).shiftedBy(
|
|
487
566
|
-asset.requiredAmount.decimals
|
|
488
567
|
),
|
|
489
|
-
|
|
568
|
+
BALANCE_MIN_DECIMALS,
|
|
569
|
+
BALANCE_MAX_DECIMALS
|
|
490
570
|
);
|
|
491
571
|
let reason = '';
|
|
492
|
-
if (asset.reason === 'FEE')
|
|
493
|
-
|
|
494
|
-
|
|
572
|
+
if (asset.reason === 'FEE') {
|
|
573
|
+
reason = ' for network fee';
|
|
574
|
+
}
|
|
575
|
+
if (asset.reason === 'INPUT_ASSET') {
|
|
576
|
+
reason = ' for swap';
|
|
577
|
+
}
|
|
578
|
+
if (asset.reason === 'FEE_AND_INPUT_ASSET') {
|
|
495
579
|
reason = ' for input and network fee';
|
|
580
|
+
}
|
|
496
581
|
const warningMessage = `Needs ≈ ${requiredAmount} ${symbol}${reason}, but you have ${currentAmount} ${symbol} in your ${asset.asset.blockchain} wallet.`;
|
|
497
582
|
return warningMessage;
|
|
498
583
|
});
|
|
@@ -538,6 +623,7 @@ export function getSwapMessages(
|
|
|
538
623
|
if (networkWarningState) {
|
|
539
624
|
message = pendingSwap.networkStatusExtraMessage || '';
|
|
540
625
|
detailedMessage = pendingSwap.networkStatusExtraMessageDetail || '';
|
|
626
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
|
|
541
627
|
switch (currentStep?.networkStatus) {
|
|
542
628
|
case PendingSwapNetworkStatus.WaitingForConnectingWallet:
|
|
543
629
|
message = message || 'Waiting for connecting wallet';
|
|
@@ -548,6 +634,9 @@ export function getSwapMessages(
|
|
|
548
634
|
case PendingSwapNetworkStatus.WaitingForNetworkChange:
|
|
549
635
|
message = message || 'Waiting for changing wallet network';
|
|
550
636
|
break;
|
|
637
|
+
default:
|
|
638
|
+
message = message || '';
|
|
639
|
+
break;
|
|
551
640
|
}
|
|
552
641
|
}
|
|
553
642
|
detailedMessage = detailedMessage || '';
|
|
@@ -603,24 +692,22 @@ export function isValidCustomDestination(
|
|
|
603
692
|
|
|
604
693
|
export function confirmSwapDisabled(
|
|
605
694
|
fetching: boolean,
|
|
606
|
-
|
|
695
|
+
showCustomDestination: boolean,
|
|
607
696
|
customDestination: string,
|
|
608
697
|
bestRoute: BestRouteResponse | null,
|
|
609
|
-
selectedWallets:
|
|
698
|
+
selectedWallets: { walletType: string; chain: string }[],
|
|
699
|
+
lastStepToBlockchain?: BlockchainMeta
|
|
610
700
|
) {
|
|
611
701
|
return (
|
|
612
702
|
fetching ||
|
|
613
|
-
(!
|
|
703
|
+
(!showCustomDestination &&
|
|
614
704
|
!requiredWallets(bestRoute).every((chain) =>
|
|
615
705
|
selectedWallets.map((wallet) => wallet.chain).includes(chain)
|
|
616
706
|
)) ||
|
|
617
|
-
(!!
|
|
618
|
-
(!!
|
|
707
|
+
(!!showCustomDestination && !customDestination) ||
|
|
708
|
+
(!!showCustomDestination &&
|
|
619
709
|
!!customDestination &&
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
.every((chain) =>
|
|
623
|
-
selectedWallets.map((wallet) => wallet.chain).includes(chain)
|
|
624
|
-
))
|
|
710
|
+
lastStepToBlockchain &&
|
|
711
|
+
!isValidAddress(lastStepToBlockchain, customDestination))
|
|
625
712
|
);
|
|
626
713
|
}
|