@rango-dev/widget-embedded 0.12.1-next.3 → 0.12.1-next.31
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 +5 -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/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 +2599 -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 +616 -0
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -0
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +13 -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/SettingsContainer/SettingsContainer.style.d.ts +613 -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 +40 -0
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -0
- package/dist/components/TokenList/index.d.ts +3 -0
- package/dist/components/TokenList/index.d.ts.map +1 -0
- package/dist/components/UpdateUrl.d.ts +6 -1
- 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/constants.d.ts +2 -0
- package/dist/constants.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/usePrepareBlockchainList.d.ts +18 -0
- package/dist/hooks/usePrepareBlockchainList.d.ts.map +1 -0
- package/dist/hooks/useSwapInput.d.ts +12 -0
- package/dist/hooks/useSwapInput.d.ts.map +1 -0
- package/dist/hooks/useSyncStoresWithConfig.d.ts +3 -0
- package/dist/hooks/useSyncStoresWithConfig.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/hooks/useWalletProviders.d.ts +3 -3
- package/dist/hooks/useWalletProviders.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts +6 -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 +7 -0
- package/dist/pages/SelectBlockchainPage.d.ts.map +1 -0
- package/dist/pages/SelectSwapItemsPage.d.ts +7 -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/services/httpService.d.ts +0 -1
- package/dist/services/httpService.d.ts.map +1 -1
- package/dist/store/app.d.ts +26 -0
- package/dist/store/app.d.ts.map +1 -0
- package/dist/store/bestRoute.d.ts +32 -23
- package/dist/store/bestRoute.d.ts.map +1 -1
- package/dist/store/meta.d.ts +8 -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/slices/config.d.ts +8 -0
- package/dist/store/slices/config.d.ts.map +1 -0
- package/dist/store/slices/data.d.ts +26 -0
- package/dist/store/slices/data.d.ts.map +1 -0
- 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 +6 -0
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +5 -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 +5 -2
- 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/time.d.ts +2 -2
- package/dist/utils/time.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +21 -15
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/Wallets.tsx +23 -17
- package/src/Widget.tsx +43 -30
- package/src/components/AppRouter.tsx +38 -7
- package/src/components/AppRoutes.tsx +40 -29
- 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/BlockchainsSection/BlockchainsSection.styles.ts +7 -0
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +83 -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 +210 -0
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +494 -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 +294 -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 +12 -0
- package/src/components/HeaderButtons/HomeButtons.tsx +81 -0
- package/src/components/HeaderButtons/UnreadNotificationsBadge.tsx +20 -0
- package/src/components/HeaderButtons/WalletButton.tsx +23 -0
- package/src/components/HeaderButtons/index.ts +4 -0
- package/src/components/Layout/Layout.styles.ts +53 -0
- package/src/components/Layout/Layout.tsx +74 -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 +52 -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 +108 -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 +129 -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/SettingsContainer/SettingsContainer.style.ts +27 -0
- package/src/components/SettingsContainer/index.ts +6 -0
- package/src/components/Slippage/Slippage.styles.ts +24 -0
- package/src/components/Slippage/Slippage.tsx +94 -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 +72 -0
- package/src/components/SwapDetails/SwapDetails.tsx +428 -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 +34 -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 +126 -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 +11 -0
- package/src/components/TokenList/TokenList.styles.ts +121 -0
- package/src/components/TokenList/TokenList.tsx +275 -0
- package/src/components/TokenList/TokenList.types.ts +47 -0
- package/src/components/TokenList/index.ts +2 -0
- package/src/components/UpdateUrl.tsx +47 -23
- 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/constants.ts +1 -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/usePrepareBlockchainList.ts +122 -0
- package/src/hooks/useSwapInput.ts +116 -0
- package/src/hooks/useSyncStoresWithConfig.ts +102 -0
- package/src/hooks/useTheme.ts +35 -74
- package/src/hooks/useWalletList.ts +125 -0
- package/src/hooks/useWalletProviders.ts +7 -7
- package/src/pages/ConfirmSwapPage.tsx +499 -228
- package/src/pages/HistoryPage.tsx +104 -15
- package/src/pages/Home.tsx +405 -110
- package/src/pages/LanguagePage.tsx +83 -0
- package/src/pages/LiquiditySourcePage.tsx +159 -0
- package/src/pages/SelectBlockchainPage.tsx +76 -0
- package/src/pages/SelectSwapItemsPage.tsx +131 -0
- package/src/pages/SettingsPage.tsx +165 -72
- package/src/pages/SwapDetailsPage.tsx +40 -141
- package/src/pages/ThemePage.tsx +96 -0
- package/src/pages/WalletsPage.tsx +79 -124
- package/src/services/httpService.ts +4 -5
- package/src/store/app.ts +15 -0
- package/src/store/bestRoute.ts +118 -239
- package/src/store/meta.ts +16 -14
- package/src/store/notification.ts +77 -0
- package/src/store/settings.ts +20 -13
- package/src/store/slices/config.ts +26 -0
- package/src/store/slices/data.ts +203 -0
- package/src/store/ui.ts +1 -5
- package/src/store/wallets.ts +92 -103
- 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 +56 -3
- package/src/utils/configs.ts +8 -2
- package/src/utils/date.ts +15 -18
- package/src/utils/meta.ts +9 -0
- package/src/utils/numbers.ts +66 -20
- package/src/utils/routing.ts +105 -27
- package/src/utils/settings.ts +57 -0
- package/src/utils/swap.ts +244 -117
- package/src/utils/time.ts +69 -36
- package/src/utils/wallets.ts +195 -126
- package/dist/components/ConfirmSwapErrors.d.ts +0 -4
- package/dist/components/ConfirmSwapErrors.d.ts.map +0 -1
- package/dist/components/ConfirmSwapWarnings.d.ts +0 -3
- package/dist/components/ConfirmSwapWarnings.d.ts.map +0 -1
- package/dist/components/Layout.d.ts +0 -7
- package/dist/components/Layout.d.ts.map +0 -1
- package/dist/pages/LiquiditySourcesPage.d.ts +0 -7
- package/dist/pages/LiquiditySourcesPage.d.ts.map +0 -1
- package/dist/pages/SelectChainPage.d.ts +0 -8
- package/dist/pages/SelectChainPage.d.ts.map +0 -1
- package/dist/pages/SelectTokenPage.d.ts +0 -15
- package/dist/pages/SelectTokenPage.d.ts.map +0 -1
- package/src/components/ConfirmSwapErrors.tsx +0 -34
- package/src/components/ConfirmSwapWarnings.tsx +0 -22
- package/src/components/Layout.tsx +0 -105
- package/src/pages/LiquiditySourcesPage.tsx +0 -63
- package/src/pages/SelectChainPage.tsx +0 -42
- package/src/pages/SelectTokenPage.tsx +0 -64
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useMetaStore } from '../store/meta';
|
|
2
|
+
import { useSettingsStore } from '../store/settings';
|
|
3
|
+
|
|
4
|
+
import { removeDuplicateFrom } from './common';
|
|
5
|
+
|
|
6
|
+
export type LiquiditySourceType = 'BRIDGE' | 'AGGREGATOR' | 'DEX';
|
|
7
|
+
|
|
8
|
+
export type UniqueSwappersGroupType = {
|
|
9
|
+
id: string;
|
|
10
|
+
groupTitle: string;
|
|
11
|
+
logo: string;
|
|
12
|
+
type: LiquiditySourceType;
|
|
13
|
+
selected: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function getUniqueSwappersGroups(
|
|
17
|
+
supportedSwappers?: string[]
|
|
18
|
+
): UniqueSwappersGroupType[] {
|
|
19
|
+
const swappers = useMetaStore.use.meta().swappers;
|
|
20
|
+
const disabledLiquiditySources =
|
|
21
|
+
useSettingsStore.use.disabledLiquiditySources();
|
|
22
|
+
|
|
23
|
+
const uniqueSupportedSwappersGroups: Array<UniqueSwappersGroupType> = [];
|
|
24
|
+
|
|
25
|
+
const uniqueGroup = removeDuplicateFrom(swappers.map((s) => s.swapperGroup));
|
|
26
|
+
|
|
27
|
+
uniqueGroup.map((uniqueGroupItem) => {
|
|
28
|
+
const swapperItem = swappers.find(
|
|
29
|
+
(swapper) => swapper.swapperGroup === uniqueGroupItem
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
if (swapperItem) {
|
|
33
|
+
let isSupportedSwapper = true;
|
|
34
|
+
if (supportedSwappers) {
|
|
35
|
+
isSupportedSwapper = supportedSwappers.some(
|
|
36
|
+
(supportedItem) => supportedItem === swapperItem.title
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (isSupportedSwapper) {
|
|
41
|
+
swapperItem.types.map((swapperTypeItem) => {
|
|
42
|
+
uniqueSupportedSwappersGroups.push({
|
|
43
|
+
id: swapperItem.swapperGroup,
|
|
44
|
+
groupTitle: swapperItem.swapperGroup,
|
|
45
|
+
logo: swapperItem.logo,
|
|
46
|
+
type: swapperTypeItem,
|
|
47
|
+
selected: !disabledLiquiditySources.includes(
|
|
48
|
+
swapperItem.swapperGroup
|
|
49
|
+
),
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return uniqueSupportedSwappersGroups;
|
|
57
|
+
}
|
package/src/utils/swap.ts
CHANGED
|
@@ -1,26 +1,42 @@
|
|
|
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';
|
|
18
|
+
|
|
9
19
|
import { i18n } from '@lingui/core';
|
|
10
|
-
import {
|
|
20
|
+
import { PendingSwapNetworkStatus } from '@rango-dev/queue-manager-rango-preset';
|
|
21
|
+
import BigNumber from 'bignumber.js';
|
|
22
|
+
|
|
23
|
+
import { isValidAddress } from '../components/ConfirmWalletsModal/ConfirmWallets.helpers';
|
|
24
|
+
import { errorMessages } from '../constants/errors';
|
|
25
|
+
import { swapButtonTitles } from '../constants/messages';
|
|
11
26
|
import { ZERO } from '../constants/numbers';
|
|
27
|
+
import {
|
|
28
|
+
BALANCE_MAX_DECIMALS,
|
|
29
|
+
BALANCE_MIN_DECIMALS,
|
|
30
|
+
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
31
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
32
|
+
} from '../constants/routing';
|
|
33
|
+
import { useMetaStore } from '../store/meta';
|
|
34
|
+
import { ButtonState } from '../types';
|
|
35
|
+
|
|
36
|
+
import { removeDuplicateFrom } from './common';
|
|
12
37
|
import { numberToString } from './numbers';
|
|
13
|
-
import { WalletType } from '@rango-dev/wallets-shared';
|
|
14
38
|
import { getRequiredBalanceOfWallet } from './routing';
|
|
15
39
|
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
40
|
|
|
25
41
|
export function getOutputRatio(
|
|
26
42
|
inputUsdValue: BigNumber | null,
|
|
@@ -31,8 +47,9 @@ export function getOutputRatio(
|
|
|
31
47
|
!outputUsdValue ||
|
|
32
48
|
inputUsdValue.lte(ZERO) ||
|
|
33
49
|
outputUsdValue.lte(ZERO)
|
|
34
|
-
)
|
|
50
|
+
) {
|
|
35
51
|
return 0;
|
|
52
|
+
}
|
|
36
53
|
return outputUsdValue.div(inputUsdValue).minus(1).multipliedBy(100);
|
|
37
54
|
}
|
|
38
55
|
|
|
@@ -61,9 +78,8 @@ export function hasLimitError(bestRoute: BestRouteResponse | null): boolean {
|
|
|
61
78
|
const isExclusive = swap.fromAmountRestrictionType === 'EXCLUSIVE';
|
|
62
79
|
if (isExclusive) {
|
|
63
80
|
return minimum?.gte(swap.fromAmount) || maximum?.lte(swap.fromAmount);
|
|
64
|
-
} else {
|
|
65
|
-
return minimum?.gt(swap.fromAmount) || maximum?.lt(swap.fromAmount);
|
|
66
81
|
}
|
|
82
|
+
return minimum?.gt(swap.fromAmount) || maximum?.lt(swap.fromAmount);
|
|
67
83
|
}).length > 0
|
|
68
84
|
);
|
|
69
85
|
}
|
|
@@ -73,8 +89,9 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
|
73
89
|
fromAmountRangeError: string;
|
|
74
90
|
recommendation: string;
|
|
75
91
|
} {
|
|
76
|
-
if (!bestRoute)
|
|
92
|
+
if (!bestRoute) {
|
|
77
93
|
return { swap: null, fromAmountRangeError: '', recommendation: '' };
|
|
94
|
+
}
|
|
78
95
|
const swap = (bestRoute?.result?.swaps || []).filter((swap) => {
|
|
79
96
|
const minimum = !!swap.fromAmountMinValue
|
|
80
97
|
? new BigNumber(swap.fromAmountMinValue)
|
|
@@ -85,12 +102,12 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
|
85
102
|
const isExclusive = swap.fromAmountRestrictionType === 'EXCLUSIVE';
|
|
86
103
|
if (isExclusive) {
|
|
87
104
|
return minimum?.gte(swap.fromAmount) || maximum?.lte(swap.fromAmount);
|
|
88
|
-
} else {
|
|
89
|
-
return minimum?.gt(swap.fromAmount) || maximum?.lt(swap.fromAmount);
|
|
90
105
|
}
|
|
106
|
+
return minimum?.gt(swap.fromAmount) || maximum?.lt(swap.fromAmount);
|
|
91
107
|
})[0];
|
|
92
|
-
if (!swap)
|
|
108
|
+
if (!swap) {
|
|
93
109
|
return { swap: null, fromAmountRangeError: '', recommendation: '' };
|
|
110
|
+
}
|
|
94
111
|
const minimum = !!swap.fromAmountMinValue
|
|
95
112
|
? new BigNumber(swap.fromAmountMinValue)
|
|
96
113
|
: null;
|
|
@@ -102,27 +119,63 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
|
102
119
|
let fromAmountRangeError = '';
|
|
103
120
|
let recommendation = '';
|
|
104
121
|
if (!isExclusive && !!minimum && minimum.gt(swap.fromAmount)) {
|
|
105
|
-
fromAmountRangeError =
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
122
|
+
fromAmountRangeError = i18n.t({
|
|
123
|
+
id: 'requiredEqualMin',
|
|
124
|
+
message: 'Required: >= {min} {symbol}',
|
|
125
|
+
values: {
|
|
126
|
+
min: numberToString(
|
|
127
|
+
minimum,
|
|
128
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
129
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
130
|
+
),
|
|
131
|
+
symbol: swap.from.symbol,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
recommendation = errorMessages.bridgeLimitErrors.increaseAmount;
|
|
109
135
|
} else if (isExclusive && !!minimum && minimum.gte(swap.fromAmount)) {
|
|
110
|
-
fromAmountRangeError =
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
136
|
+
fromAmountRangeError = i18n.t({
|
|
137
|
+
id: 'requiredMin',
|
|
138
|
+
message: 'Required: > {min} {symbol}',
|
|
139
|
+
values: {
|
|
140
|
+
min: numberToString(
|
|
141
|
+
minimum,
|
|
142
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
143
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
144
|
+
),
|
|
145
|
+
symbol: swap.from.symbol,
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
recommendation = errorMessages.bridgeLimitErrors.increaseAmount;
|
|
114
149
|
}
|
|
115
150
|
|
|
116
151
|
if (!isExclusive && !!maximum && maximum.lt(swap.fromAmount)) {
|
|
117
|
-
fromAmountRangeError =
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
152
|
+
fromAmountRangeError = i18n.t({
|
|
153
|
+
id: 'requiredEqualMax',
|
|
154
|
+
message: 'Required: <= {max} {symbol}',
|
|
155
|
+
values: {
|
|
156
|
+
max: numberToString(
|
|
157
|
+
maximum,
|
|
158
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
159
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
160
|
+
),
|
|
161
|
+
symbol: swap.from.symbol,
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
recommendation = errorMessages.bridgeLimitErrors.decreaseAmount;
|
|
121
165
|
} else if (isExclusive && !!maximum && maximum.lte(swap.fromAmount)) {
|
|
122
|
-
fromAmountRangeError =
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
166
|
+
fromAmountRangeError = i18n.t({
|
|
167
|
+
id: 'requiredMax',
|
|
168
|
+
message: 'Required: < {max} {symbol}',
|
|
169
|
+
values: {
|
|
170
|
+
max: numberToString(
|
|
171
|
+
maximum,
|
|
172
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
173
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
174
|
+
),
|
|
175
|
+
symbol: swap.from.symbol,
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
recommendation = errorMessages.bridgeLimitErrors.decreaseAmount;
|
|
126
179
|
}
|
|
127
180
|
|
|
128
181
|
return { swap, fromAmountRangeError, recommendation };
|
|
@@ -139,46 +192,62 @@ export function getSwapButtonState(
|
|
|
139
192
|
needsToWarnEthOnPath: boolean,
|
|
140
193
|
inputAmount: string
|
|
141
194
|
): 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)
|
|
195
|
+
if (loadingMetaStatus !== 'success') {
|
|
196
|
+
return {
|
|
197
|
+
title: swapButtonTitles.connectWallet,
|
|
198
|
+
state: ButtonState.WAITFORCONNECTING,
|
|
199
|
+
disabled: true,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
if (connectedWallets.length == 0) {
|
|
157
203
|
return {
|
|
158
|
-
title:
|
|
204
|
+
title: swapButtonTitles.connectWallet,
|
|
205
|
+
state: ButtonState.WAITFORCONNECTING,
|
|
206
|
+
disabled: false,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
if (
|
|
210
|
+
loading ||
|
|
211
|
+
!bestRoute ||
|
|
212
|
+
!bestRoute.result ||
|
|
213
|
+
hasLimitError ||
|
|
214
|
+
!inputAmount ||
|
|
215
|
+
inputAmount === '0'
|
|
216
|
+
) {
|
|
217
|
+
return {
|
|
218
|
+
title: swapButtonTitles.swap,
|
|
219
|
+
disabled: true,
|
|
220
|
+
state: ButtonState.SWAP,
|
|
221
|
+
};
|
|
222
|
+
} else if (highValueLoss || priceImpactCanNotBeComputed) {
|
|
223
|
+
return {
|
|
224
|
+
title: swapButtonTitles.swapAnyway,
|
|
159
225
|
disabled: false,
|
|
160
226
|
hasWarning: true,
|
|
227
|
+
state: ButtonState.NEEDTOCONFIRM,
|
|
161
228
|
};
|
|
162
|
-
else if (needsToWarnEthOnPath)
|
|
229
|
+
} else if (needsToWarnEthOnPath) {
|
|
163
230
|
return {
|
|
164
|
-
title:
|
|
231
|
+
title: swapButtonTitles.ethRouteWarning,
|
|
165
232
|
disabled: false,
|
|
166
233
|
hasWarning: true,
|
|
234
|
+
state: ButtonState.WARNING,
|
|
167
235
|
};
|
|
168
|
-
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
238
|
+
title: swapButtonTitles.swap,
|
|
239
|
+
disabled: false,
|
|
240
|
+
state: ButtonState.SWAP,
|
|
241
|
+
};
|
|
169
242
|
}
|
|
170
243
|
|
|
171
244
|
export function canComputePriceImpact(
|
|
172
245
|
bestRoute: BestRouteResponse | null,
|
|
173
246
|
inputAmount: string,
|
|
174
|
-
|
|
175
|
-
outputUsdValue: BigNumber | null
|
|
247
|
+
usdValue: BigNumber | null
|
|
176
248
|
) {
|
|
177
249
|
return !(
|
|
178
|
-
(!
|
|
179
|
-
!outputUsdValue ||
|
|
180
|
-
inputUsdValue.lte(ZERO) ||
|
|
181
|
-
outputUsdValue.lte(ZERO)) &&
|
|
250
|
+
(!usdValue || usdValue.lte(ZERO)) &&
|
|
182
251
|
!!bestRoute?.result &&
|
|
183
252
|
!!inputAmount &&
|
|
184
253
|
inputAmount !== '0' &&
|
|
@@ -194,11 +263,13 @@ export function requiredWallets(route: BestRouteResponse | null) {
|
|
|
194
263
|
const currentStepFromBlockchain = swap.from.blockchain;
|
|
195
264
|
const currentStepToBlockchain = swap.to.blockchain;
|
|
196
265
|
let lastAddedWallet = wallets[wallets.length - 1];
|
|
197
|
-
if (currentStepFromBlockchain != lastAddedWallet)
|
|
266
|
+
if (currentStepFromBlockchain != lastAddedWallet) {
|
|
198
267
|
wallets.push(currentStepFromBlockchain);
|
|
268
|
+
}
|
|
199
269
|
lastAddedWallet = wallets[wallets.length - 1];
|
|
200
|
-
if (currentStepToBlockchain != lastAddedWallet)
|
|
270
|
+
if (currentStepToBlockchain != lastAddedWallet) {
|
|
201
271
|
wallets.push(currentStepToBlockchain);
|
|
272
|
+
}
|
|
202
273
|
});
|
|
203
274
|
return wallets;
|
|
204
275
|
}
|
|
@@ -225,7 +296,9 @@ export function getUsdFeeOfStep(
|
|
|
225
296
|
let totalFeeInUsd = ZERO;
|
|
226
297
|
for (let i = 0; i < step.fee.length; i++) {
|
|
227
298
|
const fee = step.fee[i];
|
|
228
|
-
if (fee.expenseType === 'DECREASE_FROM_OUTPUT')
|
|
299
|
+
if (fee.expenseType === 'DECREASE_FROM_OUTPUT') {
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
229
302
|
|
|
230
303
|
const unitPrice = getUsdPrice(
|
|
231
304
|
fee.asset.blockchain,
|
|
@@ -255,7 +328,9 @@ export function getTotalFeeInUsd(
|
|
|
255
328
|
}
|
|
256
329
|
|
|
257
330
|
export function hasHighFee(totalFeeInUsd: BigNumber | null) {
|
|
258
|
-
if (!totalFeeInUsd)
|
|
331
|
+
if (!totalFeeInUsd) {
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
259
334
|
return !totalFeeInUsd.lt(new BigNumber(30));
|
|
260
335
|
}
|
|
261
336
|
|
|
@@ -284,7 +359,9 @@ export function hasProperSlippage(
|
|
|
284
359
|
userSlippage: string,
|
|
285
360
|
minRequiredSlippage: string | null
|
|
286
361
|
) {
|
|
287
|
-
if (!minRequiredSlippage)
|
|
362
|
+
if (!minRequiredSlippage) {
|
|
363
|
+
return true;
|
|
364
|
+
}
|
|
288
365
|
return parseFloat(userSlippage) >= parseFloat(minRequiredSlippage);
|
|
289
366
|
}
|
|
290
367
|
|
|
@@ -294,16 +371,22 @@ export function hasEnoughBalance(
|
|
|
294
371
|
) {
|
|
295
372
|
const fee = route.validationStatus;
|
|
296
373
|
|
|
297
|
-
if (fee === null || fee.length === 0)
|
|
374
|
+
if (fee === null || fee.length === 0) {
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
298
377
|
|
|
299
378
|
for (const wallet of selectedWallets) {
|
|
300
379
|
const requiredAssets = getRequiredBalanceOfWallet(wallet, fee);
|
|
301
|
-
if (!requiredAssets)
|
|
380
|
+
if (!requiredAssets) {
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
302
383
|
|
|
303
384
|
const enoughBalanceInWallet = requiredAssets
|
|
304
385
|
.map((asset) => asset.ok)
|
|
305
386
|
.reduce((previous, current) => previous && current);
|
|
306
|
-
if (!enoughBalanceInWallet)
|
|
387
|
+
if (!enoughBalanceInWallet) {
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
307
390
|
}
|
|
308
391
|
|
|
309
392
|
return true;
|
|
@@ -321,21 +404,35 @@ export function hasEnoughBalanceAndProperSlippage(
|
|
|
321
404
|
);
|
|
322
405
|
}
|
|
323
406
|
|
|
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
|
|
407
|
+
export function createBestRouteRequestBody(params: {
|
|
408
|
+
fromToken: Token;
|
|
409
|
+
toToken: Token;
|
|
410
|
+
inputAmount: string;
|
|
411
|
+
wallets?: Wallet[];
|
|
412
|
+
selectedWallets?: Wallet[];
|
|
413
|
+
disabledLiquiditySources: string[];
|
|
414
|
+
slippage: number;
|
|
415
|
+
affiliateRef: string | null;
|
|
416
|
+
affiliatePercent: number | null;
|
|
417
|
+
affiliateWallets: { [key: string]: string } | null;
|
|
418
|
+
initialRoute?: BestRouteResponse;
|
|
419
|
+
destination?: string;
|
|
420
|
+
}): BestRouteRequest {
|
|
421
|
+
const {
|
|
422
|
+
fromToken,
|
|
423
|
+
toToken,
|
|
424
|
+
inputAmount,
|
|
425
|
+
wallets,
|
|
426
|
+
selectedWallets,
|
|
427
|
+
disabledLiquiditySources,
|
|
428
|
+
slippage,
|
|
429
|
+
affiliateRef,
|
|
430
|
+
affiliatePercent,
|
|
431
|
+
affiliateWallets,
|
|
432
|
+
initialRoute,
|
|
433
|
+
destination,
|
|
434
|
+
} = params;
|
|
435
|
+
const selectedWalletsMap = selectedWallets?.reduce(
|
|
339
436
|
(
|
|
340
437
|
selectedWalletsMap: BestRouteRequest['selectedWallets'],
|
|
341
438
|
selectedWallet
|
|
@@ -348,16 +445,18 @@ export function createBestRouteRequestBody(
|
|
|
348
445
|
|
|
349
446
|
const connectedWallets: BestRouteRequest['connectedWallets'] = [];
|
|
350
447
|
|
|
351
|
-
wallets
|
|
448
|
+
wallets?.forEach((wallet) => {
|
|
352
449
|
const chainAndAccounts = connectedWallets.find(
|
|
353
450
|
(connectedWallet) => connectedWallet.blockchain === wallet.chain
|
|
354
451
|
);
|
|
355
|
-
if (!!chainAndAccounts)
|
|
356
|
-
|
|
452
|
+
if (!!chainAndAccounts) {
|
|
453
|
+
chainAndAccounts.addresses.push(wallet.address);
|
|
454
|
+
} else {
|
|
357
455
|
connectedWallets.push({
|
|
358
456
|
blockchain: wallet.chain,
|
|
359
457
|
addresses: [wallet.address],
|
|
360
458
|
});
|
|
459
|
+
}
|
|
361
460
|
});
|
|
362
461
|
|
|
363
462
|
const checkPrerequisites = !!initialRoute;
|
|
@@ -398,11 +497,13 @@ export function createBestRouteRequestBody(
|
|
|
398
497
|
symbol: toToken.symbol,
|
|
399
498
|
},
|
|
400
499
|
connectedWallets,
|
|
401
|
-
|
|
402
|
-
selectedWallets: selectedWalletsMap,
|
|
403
|
-
swapperGroups: disabledLiquiditySources,
|
|
404
|
-
swappersGroupsExclude: true,
|
|
500
|
+
selectedWallets: selectedWalletsMap ?? {},
|
|
405
501
|
slippage: slippage.toString(),
|
|
502
|
+
...(destination && { destination: destination }),
|
|
503
|
+
...(disabledLiquiditySources.length > 0 && {
|
|
504
|
+
swapperGroups: disabledLiquiditySources,
|
|
505
|
+
swappersGroupsExclude: true,
|
|
506
|
+
}),
|
|
406
507
|
...(checkPrerequisites && { blockchains: filteredBlockchains }),
|
|
407
508
|
};
|
|
408
509
|
|
|
@@ -434,12 +535,14 @@ export function getRouteOutputAmount(route: BestRouteResponse | null) {
|
|
|
434
535
|
}
|
|
435
536
|
|
|
436
537
|
export function getPercentageChange(
|
|
437
|
-
|
|
438
|
-
|
|
538
|
+
inputUsdValue: string | number | null,
|
|
539
|
+
outputUsdValue: string | number | null
|
|
439
540
|
) {
|
|
440
|
-
if (!
|
|
441
|
-
|
|
442
|
-
|
|
541
|
+
if (!inputUsdValue || !outputUsdValue) {
|
|
542
|
+
return null;
|
|
543
|
+
}
|
|
544
|
+
return new BigNumber(outputUsdValue)
|
|
545
|
+
.div(new BigNumber(inputUsdValue))
|
|
443
546
|
.minus(1)
|
|
444
547
|
.multipliedBy(100);
|
|
445
548
|
}
|
|
@@ -450,12 +553,16 @@ export function isOutputAmountChangedALot(
|
|
|
450
553
|
) {
|
|
451
554
|
const oldOutputAmount = getRouteOutputAmount(oldRoute);
|
|
452
555
|
const newOutputAmount = getRouteOutputAmount(newRoute);
|
|
453
|
-
if (!oldOutputAmount || !newOutputAmount)
|
|
556
|
+
if (!oldOutputAmount || !newOutputAmount) {
|
|
557
|
+
return false;
|
|
558
|
+
}
|
|
454
559
|
const percentageChange = getPercentageChange(
|
|
455
560
|
oldOutputAmount,
|
|
456
561
|
newOutputAmount
|
|
457
562
|
);
|
|
458
|
-
if (!percentageChange)
|
|
563
|
+
if (!percentageChange) {
|
|
564
|
+
return true;
|
|
565
|
+
}
|
|
459
566
|
|
|
460
567
|
return percentageChange.toNumber() <= -1;
|
|
461
568
|
}
|
|
@@ -480,20 +587,37 @@ export function getBalanceWarnings(
|
|
|
480
587
|
new BigNumber(asset.currentAmount.amount).shiftedBy(
|
|
481
588
|
-asset.currentAmount.decimals
|
|
482
589
|
),
|
|
483
|
-
|
|
590
|
+
BALANCE_MIN_DECIMALS,
|
|
591
|
+
BALANCE_MAX_DECIMALS
|
|
484
592
|
);
|
|
485
593
|
const requiredAmount = numberToString(
|
|
486
594
|
new BigNumber(asset.requiredAmount.amount).shiftedBy(
|
|
487
595
|
-asset.requiredAmount.decimals
|
|
488
596
|
),
|
|
489
|
-
|
|
597
|
+
BALANCE_MIN_DECIMALS,
|
|
598
|
+
BALANCE_MAX_DECIMALS
|
|
490
599
|
);
|
|
491
600
|
let reason = '';
|
|
492
|
-
if (asset.reason === 'FEE')
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
601
|
+
if (asset.reason === 'FEE') {
|
|
602
|
+
reason = i18n.t(' for network fee');
|
|
603
|
+
}
|
|
604
|
+
if (asset.reason === 'INPUT_ASSET') {
|
|
605
|
+
reason = i18n.t(' for swap');
|
|
606
|
+
}
|
|
607
|
+
if (asset.reason === 'FEE_AND_INPUT_ASSET') {
|
|
608
|
+
reason = i18n.t(' for input and network fee');
|
|
609
|
+
}
|
|
610
|
+
const warningMessage = i18n.t({
|
|
611
|
+
id: 'balanceWarningMessage',
|
|
612
|
+
message: `Needs ≈ {requiredAmount} {symbol}{reason}, but you have {currentAmount} {symbol} in your {blockchain} wallet.`,
|
|
613
|
+
values: {
|
|
614
|
+
requiredAmount,
|
|
615
|
+
symbol,
|
|
616
|
+
reason,
|
|
617
|
+
currentAmount,
|
|
618
|
+
blockchain: asset.asset.blockchain,
|
|
619
|
+
},
|
|
620
|
+
});
|
|
497
621
|
return warningMessage;
|
|
498
622
|
});
|
|
499
623
|
}
|
|
@@ -538,15 +662,20 @@ export function getSwapMessages(
|
|
|
538
662
|
if (networkWarningState) {
|
|
539
663
|
message = pendingSwap.networkStatusExtraMessage || '';
|
|
540
664
|
detailedMessage = pendingSwap.networkStatusExtraMessageDetail || '';
|
|
665
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
|
|
541
666
|
switch (currentStep?.networkStatus) {
|
|
542
667
|
case PendingSwapNetworkStatus.WaitingForConnectingWallet:
|
|
543
|
-
message = message || 'Waiting for connecting wallet';
|
|
668
|
+
message = message || i18n.t('Waiting for connecting wallet');
|
|
544
669
|
break;
|
|
545
670
|
case PendingSwapNetworkStatus.WaitingForQueue:
|
|
546
|
-
message =
|
|
671
|
+
message =
|
|
672
|
+
message || i18n.t('Waiting for other running tasks to be finished');
|
|
547
673
|
break;
|
|
548
674
|
case PendingSwapNetworkStatus.WaitingForNetworkChange:
|
|
549
|
-
message = message || 'Waiting for changing wallet network';
|
|
675
|
+
message = message || i18n.t('Waiting for changing wallet network');
|
|
676
|
+
break;
|
|
677
|
+
default:
|
|
678
|
+
message = message || '';
|
|
550
679
|
break;
|
|
551
680
|
}
|
|
552
681
|
}
|
|
@@ -603,24 +732,22 @@ export function isValidCustomDestination(
|
|
|
603
732
|
|
|
604
733
|
export function confirmSwapDisabled(
|
|
605
734
|
fetching: boolean,
|
|
606
|
-
|
|
735
|
+
showCustomDestination: boolean,
|
|
607
736
|
customDestination: string,
|
|
608
737
|
bestRoute: BestRouteResponse | null,
|
|
609
|
-
selectedWallets:
|
|
738
|
+
selectedWallets: { walletType: string; chain: string }[],
|
|
739
|
+
lastStepToBlockchain?: BlockchainMeta
|
|
610
740
|
) {
|
|
611
741
|
return (
|
|
612
742
|
fetching ||
|
|
613
|
-
(!
|
|
743
|
+
(!showCustomDestination &&
|
|
614
744
|
!requiredWallets(bestRoute).every((chain) =>
|
|
615
745
|
selectedWallets.map((wallet) => wallet.chain).includes(chain)
|
|
616
746
|
)) ||
|
|
617
|
-
(!!
|
|
618
|
-
(!!
|
|
747
|
+
(!!showCustomDestination && !customDestination) ||
|
|
748
|
+
(!!showCustomDestination &&
|
|
619
749
|
!!customDestination &&
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
.every((chain) =>
|
|
623
|
-
selectedWallets.map((wallet) => wallet.chain).includes(chain)
|
|
624
|
-
))
|
|
750
|
+
lastStepToBlockchain &&
|
|
751
|
+
!isValidAddress(lastStepToBlockchain, customDestination))
|
|
625
752
|
);
|
|
626
753
|
}
|