@rango-dev/widget-embedded 0.12.1-next.1 → 0.12.1-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Wallets.d.ts +4 -3
- package/dist/Wallets.d.ts.map +1 -1
- package/dist/Widget.d.ts +3 -2
- package/dist/Widget.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts +1 -1
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.d.ts +4 -0
- package/dist/components/BlockchainList/BlockchainList.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts +4 -0
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts +297 -0
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.types.d.ts +8 -0
- package/dist/components/BlockchainList/BlockchainList.types.d.ts.map +1 -0
- package/dist/components/BlockchainList/LoadingBlockchainList.d.ts +3 -0
- package/dist/components/BlockchainList/LoadingBlockchainList.d.ts.map +1 -0
- package/dist/components/BlockchainList/index.d.ts +2 -0
- package/dist/components/BlockchainList/index.d.ts.map +1 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.d.ts +5 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.d.ts.map +1 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts +151 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts.map +1 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts +6 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts.map +1 -0
- package/dist/components/BlockchainsChip/index.d.ts +2 -0
- package/dist/components/BlockchainsChip/index.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts +3 -0
- package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.d.ts +4 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +149 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.types.d.ts +9 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.types.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/index.d.ts +2 -0
- package/dist/components/BlockchainsSection/index.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +6 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +2522 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts +4 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +11 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts +4 -0
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +445 -0
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +12 -0
- package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -0
- package/dist/components/HeaderButtons/BackButton.d.ts +5 -0
- package/dist/components/HeaderButtons/BackButton.d.ts.map +1 -0
- package/dist/components/HeaderButtons/CancelButton.d.ts +5 -0
- package/dist/components/HeaderButtons/CancelButton.d.ts.map +1 -0
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +875 -0
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -0
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +12 -0
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -0
- package/dist/components/HeaderButtons/HomeButtons.d.ts +4 -0
- package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -0
- package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts +3 -0
- package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts.map +1 -0
- package/dist/components/HeaderButtons/WalletButton.d.ts +5 -0
- package/dist/components/HeaderButtons/WalletButton.d.ts.map +1 -0
- package/dist/components/HeaderButtons/index.d.ts +5 -0
- package/dist/components/HeaderButtons/index.d.ts.map +1 -0
- package/dist/components/Layout/Layout.d.ts +7 -0
- package/dist/components/Layout/Layout.d.ts.map +1 -0
- package/dist/components/Layout/Layout.styles.d.ts +449 -0
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -0
- package/dist/components/Layout/Layout.types.d.ts +17 -0
- package/dist/components/Layout/Layout.types.d.ts.map +1 -0
- package/dist/components/Layout/index.d.ts +2 -0
- package/dist/components/Layout/index.d.ts.map +1 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.d.ts +3 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.d.ts.map +1 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +150 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -0
- package/dist/components/LoadingLiquiditySourceList/index.d.ts +2 -0
- package/dist/components/LoadingLiquiditySourceList/index.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.d.ts +4 -0
- package/dist/components/NoRoutes/NoRoutes.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts +3 -0
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.styles.d.ts +445 -0
- package/dist/components/NoRoutes/NoRoutes.styles.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.types.d.ts +20 -0
- package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +1 -0
- package/dist/components/NoRoutes/index.d.ts +2 -0
- package/dist/components/NoRoutes/index.d.ts.map +1 -0
- package/dist/components/NotificationContent/NotificationContent.d.ts +3 -0
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -0
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts +593 -0
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -0
- package/dist/components/NotificationContent/NotificationNotFound.d.ts +3 -0
- package/dist/components/NotificationContent/NotificationNotFound.d.ts.map +1 -0
- package/dist/components/NotificationContent/index.d.ts +2 -0
- package/dist/components/NotificationContent/index.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrors.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts +593 -0
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrors.types.d.ts +22 -0
- package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +1 -0
- package/dist/components/RouteErrors/index.d.ts +2 -0
- package/dist/components/RouteErrors/index.d.ts.map +1 -0
- package/dist/components/SearchInput/SearchInput.d.ts +4 -0
- package/dist/components/SearchInput/SearchInput.d.ts.map +1 -0
- package/dist/components/SearchInput/SearchInput.styles.d.ts +149 -0
- package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -0
- package/dist/components/SearchInput/SearchInput.types.d.ts +10 -0
- package/dist/components/SearchInput/SearchInput.types.d.ts.map +1 -0
- package/dist/components/SearchInput/index.d.ts +2 -0
- package/dist/components/SearchInput/index.d.ts.map +1 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts +4 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts.map +1 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts +4 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts.map +1 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts +445 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts.map +1 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts +12 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts.map +1 -0
- package/dist/components/SelectableCategoryList/index.d.ts +2 -0
- package/dist/components/SelectableCategoryList/index.d.ts.map +1 -0
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +741 -0
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -0
- package/dist/components/SettingsContainer/index.d.ts +2 -0
- package/dist/components/SettingsContainer/index.d.ts.map +1 -0
- package/dist/components/Slippage/Slippage.d.ts +3 -0
- package/dist/components/Slippage/Slippage.d.ts.map +1 -0
- package/dist/components/Slippage/Slippage.styles.d.ts +593 -0
- package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -0
- package/dist/components/Slippage/SlippageTooltipContent.d.ts +3 -0
- package/dist/components/Slippage/SlippageTooltipContent.d.ts.map +1 -0
- package/dist/components/Slippage/index.d.ts +2 -0
- package/dist/components/Slippage/index.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts +4 -0
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.d.ts +4 -0
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +15 -0
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +1037 -0
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.types.d.ts +12 -0
- package/dist/components/SwapDetails/SwapDetails.types.d.ts.map +1 -0
- package/dist/components/SwapDetails/index.d.ts +2 -0
- package/dist/components/SwapDetails/index.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.d.ts +4 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.d.ts +4 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts +4 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +149 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +20 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/index.d.ts +3 -0
- package/dist/components/SwapDetailsAlerts/index.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Cancel.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Cancel.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Delete.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Delete.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +149 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +45 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/index.d.ts +4 -0
- package/dist/components/SwapDetailsModal/index.d.ts.map +1 -0
- package/dist/components/SwapsGroup/SwapsGroup.d.ts +4 -0
- package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -0
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +593 -0
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -0
- package/dist/components/SwapsGroup/SwapsGroup.types.d.ts +12 -0
- package/dist/components/SwapsGroup/SwapsGroup.types.d.ts.map +1 -0
- package/dist/components/SwapsGroup/index.d.ts +2 -0
- package/dist/components/SwapsGroup/index.d.ts.map +1 -0
- package/dist/components/SwitchFromAndTo.d.ts +1 -1
- package/dist/components/SwitchFromAndTo.d.ts.map +1 -1
- package/dist/components/TokenList/LoadingTokenList.d.ts +4 -0
- package/dist/components/TokenList/LoadingTokenList.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.d.ts +4 -0
- package/dist/components/TokenList/TokenList.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.helpers.d.ts +3 -0
- package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.styles.d.ts +1334 -0
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.types.d.ts +40 -0
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -0
- package/dist/components/TokenList/index.d.ts +3 -0
- package/dist/components/TokenList/index.d.ts.map +1 -0
- package/dist/components/UpdateUrl.d.ts.map +1 -1
- package/dist/components/WalletModal/WalletModal.d.ts +4 -0
- package/dist/components/WalletModal/WalletModal.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModal.types.d.ts +10 -0
- package/dist/components/WalletModal/WalletModal.types.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModalContent.d.ts +4 -0
- package/dist/components/WalletModal/WalletModalContent.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts +593 -0
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -0
- package/dist/components/WalletModal/index.d.ts +2 -0
- package/dist/components/WalletModal/index.d.ts.map +1 -0
- package/dist/components/WidgetEvents.d.ts.map +1 -1
- package/dist/constants/errors.d.ts +29 -0
- package/dist/constants/errors.d.ts.map +1 -1
- package/dist/constants/messages.d.ts +7 -0
- package/dist/constants/messages.d.ts.map +1 -0
- package/dist/constants/navigationRoutes.d.ts +8 -4
- package/dist/constants/navigationRoutes.d.ts.map +1 -1
- package/dist/constants/routing.d.ts +3 -0
- package/dist/constants/routing.d.ts.map +1 -0
- package/dist/constants/searchParams.d.ts +2 -2
- package/dist/constants/searchParams.d.ts.map +1 -1
- package/dist/constants/swapSettings.d.ts.map +1 -1
- package/dist/constants/wallets.d.ts +3 -0
- package/dist/constants/wallets.d.ts.map +1 -0
- package/dist/constants/warnings.d.ts +3 -0
- package/dist/constants/warnings.d.ts.map +1 -0
- package/dist/hooks/useConfirmSwap.d.ts +14 -6
- package/dist/hooks/useConfirmSwap.d.ts.map +1 -1
- package/dist/hooks/useFetchBestRoute.d.ts +9 -0
- package/dist/hooks/useFetchBestRoute.d.ts.map +1 -0
- package/dist/hooks/useNavigateBack.d.ts.map +1 -1
- package/dist/hooks/useSwapInput.d.ts +12 -0
- package/dist/hooks/useSwapInput.d.ts.map +1 -0
- package/dist/hooks/useTheme.d.ts +3 -26
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts +20 -0
- package/dist/hooks/useWalletList.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts +6 -3
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/HistoryPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/LanguagePage.d.ts +3 -0
- package/dist/pages/LanguagePage.d.ts.map +1 -0
- package/dist/pages/LiquiditySourcePage.d.ts +8 -0
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -0
- package/dist/pages/SelectBlockchainPage.d.ts +8 -0
- package/dist/pages/SelectBlockchainPage.d.ts.map +1 -0
- package/dist/pages/SelectSwapItemsPage.d.ts +11 -0
- package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -0
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
- package/dist/pages/ThemePage.d.ts +3 -0
- package/dist/pages/ThemePage.d.ts.map +1 -0
- package/dist/pages/WalletsPage.d.ts +4 -2
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/bestRoute.d.ts +32 -19
- package/dist/store/bestRoute.d.ts.map +1 -1
- package/dist/store/meta.d.ts +10 -3
- package/dist/store/meta.d.ts.map +1 -1
- package/dist/store/notification.d.ts +38 -0
- package/dist/store/notification.d.ts.map +1 -0
- package/dist/store/settings.d.ts +2 -2
- package/dist/store/settings.d.ts.map +1 -1
- package/dist/store/ui.d.ts +0 -2
- package/dist/store/ui.d.ts.map +1 -1
- package/dist/store/wallets.d.ts +14 -12
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +8 -6
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/notification.d.ts +22 -0
- package/dist/types/notification.d.ts.map +1 -0
- package/dist/types/routing.d.ts +30 -23
- package/dist/types/routing.d.ts.map +1 -1
- package/dist/types/swap.d.ts +8 -1
- package/dist/types/swap.d.ts.map +1 -1
- package/dist/utils/common.d.ts +5 -0
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/date.d.ts +1 -1
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +3 -0
- package/dist/utils/meta.d.ts.map +1 -0
- package/dist/utils/numbers.d.ts +2 -1
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/routing.d.ts +5 -5
- package/dist/utils/routing.d.ts.map +1 -1
- package/dist/utils/settings.d.ts +10 -0
- package/dist/utils/settings.d.ts.map +1 -0
- package/dist/utils/swap.d.ts +28 -13
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +20 -14
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/Wallets.tsx +23 -17
- package/src/Widget.tsx +21 -27
- package/src/components/AppRoutes.tsx +54 -19
- package/src/components/BlockchainList/BlockchainList.helpers.ts +37 -0
- package/src/components/BlockchainList/BlockchainList.styles.ts +18 -0
- package/src/components/BlockchainList/BlockchainList.tsx +76 -0
- package/src/components/BlockchainList/BlockchainList.types.ts +8 -0
- package/src/components/BlockchainList/LoadingBlockchainList.tsx +20 -0
- package/src/components/BlockchainList/index.ts +1 -0
- package/src/components/BlockchainsChip/BlockchainsChip.styles.ts +30 -0
- package/src/components/BlockchainsChip/BlockchainsChip.tsx +15 -0
- package/src/components/BlockchainsChip/BlockchainsChip.types.ts +4 -0
- package/src/components/BlockchainsChip/index.ts +1 -0
- package/src/components/BlockchainsSection/BlockchainSection.helpers.ts +20 -0
- package/src/components/BlockchainsSection/BlockchainsSection.styles.ts +7 -0
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +100 -0
- package/src/components/BlockchainsSection/BlockchainsSection.types.ts +9 -0
- package/src/components/BlockchainsSection/index.ts +1 -0
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +64 -0
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +169 -0
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +451 -0
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +11 -0
- package/src/components/ConfirmWalletsModal/WalletList.styles.ts +34 -0
- package/src/components/ConfirmWalletsModal/WalletList.tsx +250 -0
- package/src/components/ConfirmWalletsModal/WalletList.type.ts +12 -0
- package/src/components/HeaderButtons/BackButton.tsx +16 -0
- package/src/components/HeaderButtons/CancelButton.tsx +21 -0
- package/src/components/HeaderButtons/HeaderButtons.styles.ts +40 -0
- package/src/components/HeaderButtons/HeaderButtons.types.ts +11 -0
- package/src/components/HeaderButtons/HomeButtons.tsx +68 -0
- package/src/components/HeaderButtons/UnreadNotificationsBadge.tsx +21 -0
- package/src/components/HeaderButtons/WalletButton.tsx +20 -0
- package/src/components/HeaderButtons/index.ts +4 -0
- package/src/components/Layout/Layout.styles.ts +51 -0
- package/src/components/Layout/Layout.tsx +89 -0
- package/src/components/Layout/Layout.types.ts +20 -0
- package/src/components/Layout/index.ts +1 -0
- package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.ts +5 -0
- package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.tsx +23 -0
- package/src/components/LoadingLiquiditySourceList/index.ts +1 -0
- package/src/components/NoRoutes/NoRoutes.helper.ts +50 -0
- package/src/components/NoRoutes/NoRoutes.styles.ts +15 -0
- package/src/components/NoRoutes/NoRoutes.tsx +81 -0
- package/src/components/NoRoutes/NoRoutes.types.ts +21 -0
- package/src/components/NoRoutes/index.ts +1 -0
- package/src/components/NotificationContent/NotificationContent.styles.ts +34 -0
- package/src/components/NotificationContent/NotificationContent.tsx +112 -0
- package/src/components/NotificationContent/NotificationNotFound.tsx +17 -0
- package/src/components/NotificationContent/index.ts +1 -0
- package/src/components/RouteErrors/RouteErrors.styles.ts +27 -0
- package/src/components/RouteErrors/RouteErrors.tsx +68 -0
- package/src/components/RouteErrors/RouteErrors.types.ts +27 -0
- package/src/components/RouteErrors/RouteErrorsModal.tsx +101 -0
- package/src/components/RouteErrors/RouteErrorsModalItem.tsx +24 -0
- package/src/components/RouteErrors/index.ts +1 -0
- package/src/components/SearchInput/SearchInput.styles.ts +9 -0
- package/src/components/SearchInput/SearchInput.tsx +51 -0
- package/src/components/SearchInput/SearchInput.types.ts +10 -0
- package/src/components/SearchInput/index.ts +1 -0
- package/src/components/SelectableCategoryList/SelectableCategoryList.helpers.ts +20 -0
- package/src/components/SelectableCategoryList/SelectableCategoryList.styles.ts +21 -0
- package/src/components/SelectableCategoryList/SelectableCategoryList.tsx +79 -0
- package/src/components/SelectableCategoryList/SelectableCategoryList.types.ts +12 -0
- package/src/components/SelectableCategoryList/index.ts +1 -0
- package/src/components/SettingsContainer/SettingsContainer.style.ts +33 -0
- package/src/components/SettingsContainer/index.ts +7 -0
- package/src/components/Slippage/Slippage.styles.ts +24 -0
- package/src/components/Slippage/Slippage.tsx +90 -0
- package/src/components/Slippage/SlippageTooltipContent.tsx +23 -0
- package/src/components/Slippage/index.ts +1 -0
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +43 -0
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +102 -0
- package/src/components/SwapDetails/SwapDetails.styles.ts +76 -0
- package/src/components/SwapDetails/SwapDetails.tsx +387 -0
- package/src/components/SwapDetails/SwapDetails.types.ts +12 -0
- package/src/components/SwapDetails/index.ts +1 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.tsx +36 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.tsx +55 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.ts +7 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.tsx +74 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +28 -0
- package/src/components/SwapDetailsAlerts/index.ts +2 -0
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +101 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +34 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.Delete.tsx +34 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +35 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.helpers.tsx +22 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.styles.ts +6 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +42 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +53 -0
- package/src/components/SwapDetailsModal/index.ts +3 -0
- package/src/components/SwapsGroup/SwapsGroup.styles.ts +26 -0
- package/src/components/SwapsGroup/SwapsGroup.tsx +125 -0
- package/src/components/SwapsGroup/SwapsGroup.types.ts +13 -0
- package/src/components/SwapsGroup/index.ts +1 -0
- package/src/components/SwitchFromAndTo.tsx +24 -8
- package/src/components/TokenList/LoadingTokenList.tsx +34 -0
- package/src/components/TokenList/TokenList.helpers.ts +13 -0
- package/src/components/TokenList/TokenList.styles.ts +115 -0
- package/src/components/TokenList/TokenList.tsx +269 -0
- package/src/components/TokenList/TokenList.types.ts +47 -0
- package/src/components/TokenList/index.ts +2 -0
- package/src/components/UpdateUrl.tsx +40 -22
- package/src/components/WalletModal/WalletModal.tsx +20 -0
- package/src/components/WalletModal/WalletModal.types.ts +11 -0
- package/src/components/WalletModal/WalletModalContent.styles.ts +44 -0
- package/src/components/WalletModal/WalletModalContent.tsx +54 -0
- package/src/components/WalletModal/index.ts +1 -0
- package/src/components/WidgetEvents.tsx +30 -4
- package/src/constants/errors.ts +56 -1
- package/src/constants/messages.ts +8 -0
- package/src/constants/navigationRoutes.ts +8 -4
- package/src/constants/routing.ts +2 -0
- package/src/constants/searchParams.ts +2 -2
- package/src/constants/swapSettings.ts +5 -1
- package/src/constants/wallets.ts +3 -0
- package/src/constants/warnings.ts +26 -0
- package/src/hooks/useConfirmSwap.ts +251 -220
- package/src/hooks/useFetchBestRoute.ts +38 -0
- package/src/hooks/useNavigateBack.ts +15 -9
- package/src/hooks/useSwapInput.ts +102 -0
- package/src/hooks/useTheme.ts +59 -60
- package/src/hooks/useWalletList.ts +125 -0
- package/src/pages/ConfirmSwapPage.tsx +470 -228
- package/src/pages/HistoryPage.tsx +104 -15
- package/src/pages/Home.tsx +345 -111
- package/src/pages/LanguagePage.tsx +83 -0
- package/src/pages/LiquiditySourcePage.tsx +160 -0
- package/src/pages/SelectBlockchainPage.tsx +77 -0
- package/src/pages/SelectSwapItemsPage.tsx +153 -0
- package/src/pages/SettingsPage.tsx +144 -72
- package/src/pages/SwapDetailsPage.tsx +35 -143
- package/src/pages/ThemePage.tsx +96 -0
- package/src/pages/WalletsPage.tsx +73 -124
- package/src/store/bestRoute.ts +85 -180
- package/src/store/meta.ts +23 -3
- package/src/store/notification.ts +77 -0
- package/src/store/settings.ts +20 -13
- package/src/store/ui.ts +1 -5
- package/src/store/wallets.ts +92 -76
- package/src/types/config.ts +9 -7
- package/src/types/notification.ts +33 -0
- package/src/types/routing.ts +29 -28
- package/src/types/swap.ts +9 -1
- package/src/utils/common.ts +53 -3
- package/src/utils/date.ts +15 -18
- package/src/utils/meta.ts +9 -0
- package/src/utils/numbers.ts +63 -18
- package/src/utils/routing.ts +30 -14
- package/src/utils/settings.ts +57 -0
- package/src/utils/swap.ts +166 -95
- package/src/utils/wallets.ts +159 -110
- package/dist/components/ConfirmSwapErrors.d.ts +0 -4
- package/dist/components/ConfirmSwapErrors.d.ts.map +0 -1
- package/dist/components/ConfirmSwapWarnings.d.ts +0 -3
- package/dist/components/ConfirmSwapWarnings.d.ts.map +0 -1
- package/dist/components/Layout.d.ts +0 -7
- package/dist/components/Layout.d.ts.map +0 -1
- package/dist/pages/LiquiditySourcesPage.d.ts +0 -7
- package/dist/pages/LiquiditySourcesPage.d.ts.map +0 -1
- package/dist/pages/SelectChainPage.d.ts +0 -8
- package/dist/pages/SelectChainPage.d.ts.map +0 -1
- package/dist/pages/SelectTokenPage.d.ts +0 -15
- package/dist/pages/SelectTokenPage.d.ts.map +0 -1
- package/src/components/ConfirmSwapErrors.tsx +0 -34
- package/src/components/ConfirmSwapWarnings.tsx +0 -22
- package/src/components/Layout.tsx +0 -105
- package/src/pages/LiquiditySourcesPage.tsx +0 -63
- package/src/pages/SelectChainPage.tsx +0 -42
- package/src/pages/SelectTokenPage.tsx +0 -64
package/src/utils/swap.ts
CHANGED
|
@@ -1,26 +1,35 @@
|
|
|
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 { useMetaStore } from '../store/meta';
|
|
27
|
+
import { ButtonState } from '../types';
|
|
28
|
+
|
|
29
|
+
import { removeDuplicateFrom } from './common';
|
|
12
30
|
import { numberToString } from './numbers';
|
|
13
|
-
import { WalletType } from '@rango-dev/wallets-shared';
|
|
14
31
|
import { getRequiredBalanceOfWallet } from './routing';
|
|
15
32
|
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
33
|
|
|
25
34
|
export function getOutputRatio(
|
|
26
35
|
inputUsdValue: BigNumber | null,
|
|
@@ -31,8 +40,9 @@ export function getOutputRatio(
|
|
|
31
40
|
!outputUsdValue ||
|
|
32
41
|
inputUsdValue.lte(ZERO) ||
|
|
33
42
|
outputUsdValue.lte(ZERO)
|
|
34
|
-
)
|
|
43
|
+
) {
|
|
35
44
|
return 0;
|
|
45
|
+
}
|
|
36
46
|
return outputUsdValue.div(inputUsdValue).minus(1).multipliedBy(100);
|
|
37
47
|
}
|
|
38
48
|
|
|
@@ -61,9 +71,8 @@ export function hasLimitError(bestRoute: BestRouteResponse | null): boolean {
|
|
|
61
71
|
const isExclusive = swap.fromAmountRestrictionType === 'EXCLUSIVE';
|
|
62
72
|
if (isExclusive) {
|
|
63
73
|
return minimum?.gte(swap.fromAmount) || maximum?.lte(swap.fromAmount);
|
|
64
|
-
} else {
|
|
65
|
-
return minimum?.gt(swap.fromAmount) || maximum?.lt(swap.fromAmount);
|
|
66
74
|
}
|
|
75
|
+
return minimum?.gt(swap.fromAmount) || maximum?.lt(swap.fromAmount);
|
|
67
76
|
}).length > 0
|
|
68
77
|
);
|
|
69
78
|
}
|
|
@@ -73,8 +82,9 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
|
73
82
|
fromAmountRangeError: string;
|
|
74
83
|
recommendation: string;
|
|
75
84
|
} {
|
|
76
|
-
if (!bestRoute)
|
|
85
|
+
if (!bestRoute) {
|
|
77
86
|
return { swap: null, fromAmountRangeError: '', recommendation: '' };
|
|
87
|
+
}
|
|
78
88
|
const swap = (bestRoute?.result?.swaps || []).filter((swap) => {
|
|
79
89
|
const minimum = !!swap.fromAmountMinValue
|
|
80
90
|
? new BigNumber(swap.fromAmountMinValue)
|
|
@@ -85,12 +95,12 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
|
85
95
|
const isExclusive = swap.fromAmountRestrictionType === 'EXCLUSIVE';
|
|
86
96
|
if (isExclusive) {
|
|
87
97
|
return minimum?.gte(swap.fromAmount) || maximum?.lte(swap.fromAmount);
|
|
88
|
-
} else {
|
|
89
|
-
return minimum?.gt(swap.fromAmount) || maximum?.lt(swap.fromAmount);
|
|
90
98
|
}
|
|
99
|
+
return minimum?.gt(swap.fromAmount) || maximum?.lt(swap.fromAmount);
|
|
91
100
|
})[0];
|
|
92
|
-
if (!swap)
|
|
101
|
+
if (!swap) {
|
|
93
102
|
return { swap: null, fromAmountRangeError: '', recommendation: '' };
|
|
103
|
+
}
|
|
94
104
|
const minimum = !!swap.fromAmountMinValue
|
|
95
105
|
? new BigNumber(swap.fromAmountMinValue)
|
|
96
106
|
: null;
|
|
@@ -105,24 +115,24 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
|
105
115
|
fromAmountRangeError = `Required: >= ${numberToString(minimum)} ${
|
|
106
116
|
swap.from.symbol
|
|
107
117
|
}`;
|
|
108
|
-
recommendation =
|
|
118
|
+
recommendation = errorMessages.bridgeLimitErrors.increaseAmount;
|
|
109
119
|
} else if (isExclusive && !!minimum && minimum.gte(swap.fromAmount)) {
|
|
110
120
|
fromAmountRangeError = `Required: > ${numberToString(minimum)} ${
|
|
111
121
|
swap.from.symbol
|
|
112
122
|
}`;
|
|
113
|
-
recommendation =
|
|
123
|
+
recommendation = errorMessages.bridgeLimitErrors.increaseAmount;
|
|
114
124
|
}
|
|
115
125
|
|
|
116
126
|
if (!isExclusive && !!maximum && maximum.lt(swap.fromAmount)) {
|
|
117
127
|
fromAmountRangeError = `Required: <= ${numberToString(maximum)} ${
|
|
118
128
|
swap.from.symbol
|
|
119
129
|
}`;
|
|
120
|
-
recommendation =
|
|
130
|
+
recommendation = errorMessages.bridgeLimitErrors.decreaseAmount;
|
|
121
131
|
} else if (isExclusive && !!maximum && maximum.lte(swap.fromAmount)) {
|
|
122
132
|
fromAmountRangeError = `Required: < ${numberToString(maximum)} ${
|
|
123
133
|
swap.from.symbol
|
|
124
134
|
}`;
|
|
125
|
-
recommendation =
|
|
135
|
+
recommendation = errorMessages.bridgeLimitErrors.decreaseAmount;
|
|
126
136
|
}
|
|
127
137
|
|
|
128
138
|
return { swap, fromAmountRangeError, recommendation };
|
|
@@ -139,46 +149,62 @@ export function getSwapButtonState(
|
|
|
139
149
|
needsToWarnEthOnPath: boolean,
|
|
140
150
|
inputAmount: string
|
|
141
151
|
): SwapButtonState {
|
|
142
|
-
if (loadingMetaStatus !== 'success')
|
|
143
|
-
return {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
152
|
+
if (loadingMetaStatus !== 'success') {
|
|
153
|
+
return {
|
|
154
|
+
title: swapButtonTitles.connectWallet,
|
|
155
|
+
state: ButtonState.WAITFORCONNECTING,
|
|
156
|
+
disabled: true,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
if (connectedWallets.length == 0) {
|
|
160
|
+
return {
|
|
161
|
+
title: swapButtonTitles.connectWallet,
|
|
162
|
+
state: ButtonState.WAITFORCONNECTING,
|
|
163
|
+
disabled: false,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
if (
|
|
167
|
+
loading ||
|
|
168
|
+
!bestRoute ||
|
|
169
|
+
!bestRoute.result ||
|
|
170
|
+
hasLimitError ||
|
|
171
|
+
!inputAmount ||
|
|
172
|
+
inputAmount === '0'
|
|
173
|
+
) {
|
|
174
|
+
return {
|
|
175
|
+
title: swapButtonTitles.swap,
|
|
176
|
+
disabled: true,
|
|
177
|
+
state: ButtonState.SWAP,
|
|
178
|
+
};
|
|
179
|
+
} else if (highValueLoss || priceImpactCanNotBeComputed) {
|
|
157
180
|
return {
|
|
158
|
-
title:
|
|
181
|
+
title: swapButtonTitles.swapAnyway,
|
|
159
182
|
disabled: false,
|
|
160
183
|
hasWarning: true,
|
|
184
|
+
state: ButtonState.NEEDTOCONFIRM,
|
|
161
185
|
};
|
|
162
|
-
else if (needsToWarnEthOnPath)
|
|
186
|
+
} else if (needsToWarnEthOnPath) {
|
|
163
187
|
return {
|
|
164
|
-
title:
|
|
188
|
+
title: swapButtonTitles.ethRouteWarning,
|
|
165
189
|
disabled: false,
|
|
166
190
|
hasWarning: true,
|
|
191
|
+
state: ButtonState.WARNING,
|
|
167
192
|
};
|
|
168
|
-
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
title: swapButtonTitles.swap,
|
|
196
|
+
disabled: false,
|
|
197
|
+
state: ButtonState.SWAP,
|
|
198
|
+
};
|
|
169
199
|
}
|
|
170
200
|
|
|
171
201
|
export function canComputePriceImpact(
|
|
172
202
|
bestRoute: BestRouteResponse | null,
|
|
173
203
|
inputAmount: string,
|
|
174
|
-
|
|
175
|
-
outputUsdValue: BigNumber | null
|
|
204
|
+
usdValue: BigNumber | null
|
|
176
205
|
) {
|
|
177
206
|
return !(
|
|
178
|
-
(!
|
|
179
|
-
!outputUsdValue ||
|
|
180
|
-
inputUsdValue.lte(ZERO) ||
|
|
181
|
-
outputUsdValue.lte(ZERO)) &&
|
|
207
|
+
(!usdValue || usdValue.lte(ZERO)) &&
|
|
182
208
|
!!bestRoute?.result &&
|
|
183
209
|
!!inputAmount &&
|
|
184
210
|
inputAmount !== '0' &&
|
|
@@ -194,11 +220,13 @@ export function requiredWallets(route: BestRouteResponse | null) {
|
|
|
194
220
|
const currentStepFromBlockchain = swap.from.blockchain;
|
|
195
221
|
const currentStepToBlockchain = swap.to.blockchain;
|
|
196
222
|
let lastAddedWallet = wallets[wallets.length - 1];
|
|
197
|
-
if (currentStepFromBlockchain != lastAddedWallet)
|
|
223
|
+
if (currentStepFromBlockchain != lastAddedWallet) {
|
|
198
224
|
wallets.push(currentStepFromBlockchain);
|
|
225
|
+
}
|
|
199
226
|
lastAddedWallet = wallets[wallets.length - 1];
|
|
200
|
-
if (currentStepToBlockchain != lastAddedWallet)
|
|
227
|
+
if (currentStepToBlockchain != lastAddedWallet) {
|
|
201
228
|
wallets.push(currentStepToBlockchain);
|
|
229
|
+
}
|
|
202
230
|
});
|
|
203
231
|
return wallets;
|
|
204
232
|
}
|
|
@@ -225,7 +253,9 @@ export function getUsdFeeOfStep(
|
|
|
225
253
|
let totalFeeInUsd = ZERO;
|
|
226
254
|
for (let i = 0; i < step.fee.length; i++) {
|
|
227
255
|
const fee = step.fee[i];
|
|
228
|
-
if (fee.expenseType === 'DECREASE_FROM_OUTPUT')
|
|
256
|
+
if (fee.expenseType === 'DECREASE_FROM_OUTPUT') {
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
229
259
|
|
|
230
260
|
const unitPrice = getUsdPrice(
|
|
231
261
|
fee.asset.blockchain,
|
|
@@ -255,7 +285,9 @@ export function getTotalFeeInUsd(
|
|
|
255
285
|
}
|
|
256
286
|
|
|
257
287
|
export function hasHighFee(totalFeeInUsd: BigNumber | null) {
|
|
258
|
-
if (!totalFeeInUsd)
|
|
288
|
+
if (!totalFeeInUsd) {
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
259
291
|
return !totalFeeInUsd.lt(new BigNumber(30));
|
|
260
292
|
}
|
|
261
293
|
|
|
@@ -284,7 +316,9 @@ export function hasProperSlippage(
|
|
|
284
316
|
userSlippage: string,
|
|
285
317
|
minRequiredSlippage: string | null
|
|
286
318
|
) {
|
|
287
|
-
if (!minRequiredSlippage)
|
|
319
|
+
if (!minRequiredSlippage) {
|
|
320
|
+
return true;
|
|
321
|
+
}
|
|
288
322
|
return parseFloat(userSlippage) >= parseFloat(minRequiredSlippage);
|
|
289
323
|
}
|
|
290
324
|
|
|
@@ -294,16 +328,22 @@ export function hasEnoughBalance(
|
|
|
294
328
|
) {
|
|
295
329
|
const fee = route.validationStatus;
|
|
296
330
|
|
|
297
|
-
if (fee === null || fee.length === 0)
|
|
331
|
+
if (fee === null || fee.length === 0) {
|
|
332
|
+
return true;
|
|
333
|
+
}
|
|
298
334
|
|
|
299
335
|
for (const wallet of selectedWallets) {
|
|
300
336
|
const requiredAssets = getRequiredBalanceOfWallet(wallet, fee);
|
|
301
|
-
if (!requiredAssets)
|
|
337
|
+
if (!requiredAssets) {
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
302
340
|
|
|
303
341
|
const enoughBalanceInWallet = requiredAssets
|
|
304
342
|
.map((asset) => asset.ok)
|
|
305
343
|
.reduce((previous, current) => previous && current);
|
|
306
|
-
if (!enoughBalanceInWallet)
|
|
344
|
+
if (!enoughBalanceInWallet) {
|
|
345
|
+
return false;
|
|
346
|
+
}
|
|
307
347
|
}
|
|
308
348
|
|
|
309
349
|
return true;
|
|
@@ -321,21 +361,35 @@ export function hasEnoughBalanceAndProperSlippage(
|
|
|
321
361
|
);
|
|
322
362
|
}
|
|
323
363
|
|
|
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
|
|
364
|
+
export function createBestRouteRequestBody(params: {
|
|
365
|
+
fromToken: Token;
|
|
366
|
+
toToken: Token;
|
|
367
|
+
inputAmount: string;
|
|
368
|
+
wallets?: Wallet[];
|
|
369
|
+
selectedWallets?: Wallet[];
|
|
370
|
+
disabledLiquiditySources: string[];
|
|
371
|
+
slippage: number;
|
|
372
|
+
affiliateRef: string | null;
|
|
373
|
+
affiliatePercent: number | null;
|
|
374
|
+
affiliateWallets: { [key: string]: string } | null;
|
|
375
|
+
initialRoute?: BestRouteResponse;
|
|
376
|
+
destination?: string;
|
|
377
|
+
}): BestRouteRequest {
|
|
378
|
+
const {
|
|
379
|
+
fromToken,
|
|
380
|
+
toToken,
|
|
381
|
+
inputAmount,
|
|
382
|
+
wallets,
|
|
383
|
+
selectedWallets,
|
|
384
|
+
disabledLiquiditySources,
|
|
385
|
+
slippage,
|
|
386
|
+
affiliateRef,
|
|
387
|
+
affiliatePercent,
|
|
388
|
+
affiliateWallets,
|
|
389
|
+
initialRoute,
|
|
390
|
+
destination,
|
|
391
|
+
} = params;
|
|
392
|
+
const selectedWalletsMap = selectedWallets?.reduce(
|
|
339
393
|
(
|
|
340
394
|
selectedWalletsMap: BestRouteRequest['selectedWallets'],
|
|
341
395
|
selectedWallet
|
|
@@ -348,16 +402,18 @@ export function createBestRouteRequestBody(
|
|
|
348
402
|
|
|
349
403
|
const connectedWallets: BestRouteRequest['connectedWallets'] = [];
|
|
350
404
|
|
|
351
|
-
wallets
|
|
405
|
+
wallets?.forEach((wallet) => {
|
|
352
406
|
const chainAndAccounts = connectedWallets.find(
|
|
353
407
|
(connectedWallet) => connectedWallet.blockchain === wallet.chain
|
|
354
408
|
);
|
|
355
|
-
if (!!chainAndAccounts)
|
|
356
|
-
|
|
409
|
+
if (!!chainAndAccounts) {
|
|
410
|
+
chainAndAccounts.addresses.push(wallet.address);
|
|
411
|
+
} else {
|
|
357
412
|
connectedWallets.push({
|
|
358
413
|
blockchain: wallet.chain,
|
|
359
414
|
addresses: [wallet.address],
|
|
360
415
|
});
|
|
416
|
+
}
|
|
361
417
|
});
|
|
362
418
|
|
|
363
419
|
const checkPrerequisites = !!initialRoute;
|
|
@@ -398,11 +454,13 @@ export function createBestRouteRequestBody(
|
|
|
398
454
|
symbol: toToken.symbol,
|
|
399
455
|
},
|
|
400
456
|
connectedWallets,
|
|
401
|
-
|
|
402
|
-
selectedWallets: selectedWalletsMap,
|
|
403
|
-
swapperGroups: disabledLiquiditySources,
|
|
404
|
-
swappersGroupsExclude: true,
|
|
457
|
+
selectedWallets: selectedWalletsMap ?? {},
|
|
405
458
|
slippage: slippage.toString(),
|
|
459
|
+
...(destination && { destination: destination }),
|
|
460
|
+
...(disabledLiquiditySources.length > 0 && {
|
|
461
|
+
swapperGroups: disabledLiquiditySources,
|
|
462
|
+
swappersGroupsExclude: true,
|
|
463
|
+
}),
|
|
406
464
|
...(checkPrerequisites && { blockchains: filteredBlockchains }),
|
|
407
465
|
};
|
|
408
466
|
|
|
@@ -437,7 +495,9 @@ export function getPercentageChange(
|
|
|
437
495
|
oldValue: string | number | null,
|
|
438
496
|
newValue: string | number | null
|
|
439
497
|
) {
|
|
440
|
-
if (!oldValue || !newValue)
|
|
498
|
+
if (!oldValue || !newValue) {
|
|
499
|
+
return null;
|
|
500
|
+
}
|
|
441
501
|
return new BigNumber(newValue)
|
|
442
502
|
.div(new BigNumber(oldValue))
|
|
443
503
|
.minus(1)
|
|
@@ -450,12 +510,16 @@ export function isOutputAmountChangedALot(
|
|
|
450
510
|
) {
|
|
451
511
|
const oldOutputAmount = getRouteOutputAmount(oldRoute);
|
|
452
512
|
const newOutputAmount = getRouteOutputAmount(newRoute);
|
|
453
|
-
if (!oldOutputAmount || !newOutputAmount)
|
|
513
|
+
if (!oldOutputAmount || !newOutputAmount) {
|
|
514
|
+
return false;
|
|
515
|
+
}
|
|
454
516
|
const percentageChange = getPercentageChange(
|
|
455
517
|
oldOutputAmount,
|
|
456
518
|
newOutputAmount
|
|
457
519
|
);
|
|
458
|
-
if (!percentageChange)
|
|
520
|
+
if (!percentageChange) {
|
|
521
|
+
return true;
|
|
522
|
+
}
|
|
459
523
|
|
|
460
524
|
return percentageChange.toNumber() <= -1;
|
|
461
525
|
}
|
|
@@ -489,10 +553,15 @@ export function getBalanceWarnings(
|
|
|
489
553
|
8
|
|
490
554
|
);
|
|
491
555
|
let reason = '';
|
|
492
|
-
if (asset.reason === 'FEE')
|
|
493
|
-
|
|
494
|
-
|
|
556
|
+
if (asset.reason === 'FEE') {
|
|
557
|
+
reason = ' for network fee';
|
|
558
|
+
}
|
|
559
|
+
if (asset.reason === 'INPUT_ASSET') {
|
|
560
|
+
reason = ' for swap';
|
|
561
|
+
}
|
|
562
|
+
if (asset.reason === 'FEE_AND_INPUT_ASSET') {
|
|
495
563
|
reason = ' for input and network fee';
|
|
564
|
+
}
|
|
496
565
|
const warningMessage = `Needs ≈ ${requiredAmount} ${symbol}${reason}, but you have ${currentAmount} ${symbol} in your ${asset.asset.blockchain} wallet.`;
|
|
497
566
|
return warningMessage;
|
|
498
567
|
});
|
|
@@ -538,6 +607,7 @@ export function getSwapMessages(
|
|
|
538
607
|
if (networkWarningState) {
|
|
539
608
|
message = pendingSwap.networkStatusExtraMessage || '';
|
|
540
609
|
detailedMessage = pendingSwap.networkStatusExtraMessageDetail || '';
|
|
610
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
|
|
541
611
|
switch (currentStep?.networkStatus) {
|
|
542
612
|
case PendingSwapNetworkStatus.WaitingForConnectingWallet:
|
|
543
613
|
message = message || 'Waiting for connecting wallet';
|
|
@@ -548,6 +618,9 @@ export function getSwapMessages(
|
|
|
548
618
|
case PendingSwapNetworkStatus.WaitingForNetworkChange:
|
|
549
619
|
message = message || 'Waiting for changing wallet network';
|
|
550
620
|
break;
|
|
621
|
+
default:
|
|
622
|
+
message = message || '';
|
|
623
|
+
break;
|
|
551
624
|
}
|
|
552
625
|
}
|
|
553
626
|
detailedMessage = detailedMessage || '';
|
|
@@ -603,24 +676,22 @@ export function isValidCustomDestination(
|
|
|
603
676
|
|
|
604
677
|
export function confirmSwapDisabled(
|
|
605
678
|
fetching: boolean,
|
|
606
|
-
|
|
679
|
+
showCustomDestination: boolean,
|
|
607
680
|
customDestination: string,
|
|
608
681
|
bestRoute: BestRouteResponse | null,
|
|
609
|
-
selectedWallets:
|
|
682
|
+
selectedWallets: { walletType: string; chain: string }[],
|
|
683
|
+
lastStepToBlockchain?: BlockchainMeta
|
|
610
684
|
) {
|
|
611
685
|
return (
|
|
612
686
|
fetching ||
|
|
613
|
-
(!
|
|
687
|
+
(!showCustomDestination &&
|
|
614
688
|
!requiredWallets(bestRoute).every((chain) =>
|
|
615
689
|
selectedWallets.map((wallet) => wallet.chain).includes(chain)
|
|
616
690
|
)) ||
|
|
617
|
-
(!!
|
|
618
|
-
(!!
|
|
691
|
+
(!!showCustomDestination && !customDestination) ||
|
|
692
|
+
(!!showCustomDestination &&
|
|
619
693
|
!!customDestination &&
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
.every((chain) =>
|
|
623
|
-
selectedWallets.map((wallet) => wallet.chain).includes(chain)
|
|
624
|
-
))
|
|
694
|
+
lastStepToBlockchain &&
|
|
695
|
+
!isValidAddress(lastStepToBlockchain, customDestination))
|
|
625
696
|
);
|
|
626
697
|
}
|