@rango-dev/widget-embedded 0.12.1-next.3 → 0.12.1-next.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Wallets.d.ts +4 -3
- package/dist/Wallets.d.ts.map +1 -1
- package/dist/Widget.d.ts +3 -2
- package/dist/Widget.d.ts.map +1 -1
- package/dist/components/AppRouter.d.ts +3 -2
- package/dist/components/AppRouter.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts +1 -1
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.d.ts +4 -0
- package/dist/components/BlockchainList/BlockchainList.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts +4 -0
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts +307 -0
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.types.d.ts +8 -0
- package/dist/components/BlockchainList/BlockchainList.types.d.ts.map +1 -0
- package/dist/components/BlockchainList/LoadingBlockchainList.d.ts +3 -0
- package/dist/components/BlockchainList/LoadingBlockchainList.d.ts.map +1 -0
- package/dist/components/BlockchainList/index.d.ts +2 -0
- package/dist/components/BlockchainList/index.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts +3 -0
- package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.d.ts +4 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +154 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.types.d.ts +9 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.types.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/index.d.ts +2 -0
- package/dist/components/BlockchainsSection/index.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +6 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +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 +41 -0
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -0
- package/dist/components/TokenList/index.d.ts +3 -0
- package/dist/components/TokenList/index.d.ts.map +1 -0
- package/dist/components/UpdateUrl.d.ts.map +1 -1
- package/dist/components/WalletModal/WalletModal.d.ts +4 -0
- package/dist/components/WalletModal/WalletModal.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModal.types.d.ts +10 -0
- package/dist/components/WalletModal/WalletModal.types.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModalContent.d.ts +4 -0
- package/dist/components/WalletModal/WalletModalContent.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts +613 -0
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -0
- package/dist/components/WalletModal/index.d.ts +2 -0
- package/dist/components/WalletModal/index.d.ts.map +1 -0
- package/dist/components/WidgetEvents.d.ts.map +1 -1
- package/dist/constants/errors.d.ts +29 -0
- package/dist/constants/errors.d.ts.map +1 -1
- package/dist/constants/messages.d.ts +7 -0
- package/dist/constants/messages.d.ts.map +1 -0
- package/dist/constants/navigationRoutes.d.ts +8 -4
- package/dist/constants/navigationRoutes.d.ts.map +1 -1
- package/dist/constants/routing.d.ts +13 -0
- package/dist/constants/routing.d.ts.map +1 -0
- package/dist/constants/searchParams.d.ts +2 -2
- package/dist/constants/searchParams.d.ts.map +1 -1
- package/dist/constants/swapSettings.d.ts.map +1 -1
- package/dist/constants/wallets.d.ts +3 -0
- package/dist/constants/wallets.d.ts.map +1 -0
- package/dist/constants/warnings.d.ts +3 -0
- package/dist/constants/warnings.d.ts.map +1 -0
- package/dist/globalStyles.d.ts +1 -1
- package/dist/globalStyles.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap.d.ts +14 -6
- package/dist/hooks/useConfirmSwap.d.ts.map +1 -1
- package/dist/hooks/useFetchBestRoute.d.ts +9 -0
- package/dist/hooks/useFetchBestRoute.d.ts.map +1 -0
- package/dist/hooks/useNavigateBack.d.ts.map +1 -1
- package/dist/hooks/useSwapInput.d.ts +12 -0
- package/dist/hooks/useSwapInput.d.ts.map +1 -0
- package/dist/hooks/useTheme.d.ts +3 -29
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts +20 -0
- package/dist/hooks/useWalletList.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts +6 -3
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/HistoryPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/LanguagePage.d.ts +3 -0
- package/dist/pages/LanguagePage.d.ts.map +1 -0
- package/dist/pages/LiquiditySourcePage.d.ts +8 -0
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -0
- package/dist/pages/SelectBlockchainPage.d.ts +8 -0
- package/dist/pages/SelectBlockchainPage.d.ts.map +1 -0
- package/dist/pages/SelectSwapItemsPage.d.ts +11 -0
- package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -0
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
- package/dist/pages/ThemePage.d.ts +3 -0
- package/dist/pages/ThemePage.d.ts.map +1 -0
- package/dist/pages/WalletsPage.d.ts +4 -2
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/bestRoute.d.ts +32 -19
- package/dist/store/bestRoute.d.ts.map +1 -1
- package/dist/store/meta.d.ts +10 -3
- package/dist/store/meta.d.ts.map +1 -1
- package/dist/store/notification.d.ts +38 -0
- package/dist/store/notification.d.ts.map +1 -0
- package/dist/store/settings.d.ts +2 -2
- package/dist/store/settings.d.ts.map +1 -1
- package/dist/store/ui.d.ts +0 -2
- package/dist/store/ui.d.ts.map +1 -1
- package/dist/store/wallets.d.ts +14 -12
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +11 -6
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/notification.d.ts +22 -0
- package/dist/types/notification.d.ts.map +1 -0
- package/dist/types/routing.d.ts +30 -23
- package/dist/types/routing.d.ts.map +1 -1
- package/dist/types/swap.d.ts +8 -1
- package/dist/types/swap.d.ts.map +1 -1
- package/dist/utils/common.d.ts +6 -0
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +2 -0
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/date.d.ts +1 -1
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +3 -0
- package/dist/utils/meta.d.ts.map +1 -0
- package/dist/utils/numbers.d.ts +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 +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 +92 -28
- package/src/components/AppRouter.tsx +35 -6
- package/src/components/AppRoutes.tsx +54 -19
- package/src/components/BlockchainList/BlockchainList.helpers.ts +37 -0
- package/src/components/BlockchainList/BlockchainList.styles.ts +19 -0
- package/src/components/BlockchainList/BlockchainList.tsx +73 -0
- package/src/components/BlockchainList/BlockchainList.types.ts +8 -0
- package/src/components/BlockchainList/LoadingBlockchainList.tsx +20 -0
- package/src/components/BlockchainList/index.ts +1 -0
- package/src/components/BlockchainsSection/BlockchainSection.helpers.ts +20 -0
- package/src/components/BlockchainsSection/BlockchainsSection.styles.ts +7 -0
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +105 -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 +13 -0
- package/src/components/TokenList/TokenList.styles.ts +121 -0
- package/src/components/TokenList/TokenList.tsx +271 -0
- package/src/components/TokenList/TokenList.types.ts +48 -0
- package/src/components/TokenList/index.ts +2 -0
- package/src/components/UpdateUrl.tsx +40 -22
- package/src/components/WalletModal/WalletModal.tsx +20 -0
- package/src/components/WalletModal/WalletModal.types.ts +11 -0
- package/src/components/WalletModal/WalletModalContent.styles.ts +44 -0
- package/src/components/WalletModal/WalletModalContent.tsx +54 -0
- package/src/components/WalletModal/index.ts +1 -0
- package/src/components/WidgetEvents.tsx +37 -5
- package/src/constants/errors.ts +56 -1
- package/src/constants/messages.ts +8 -0
- package/src/constants/navigationRoutes.ts +8 -4
- package/src/constants/routing.ts +17 -0
- package/src/constants/searchParams.ts +2 -2
- package/src/constants/swapSettings.ts +5 -1
- package/src/constants/wallets.ts +3 -0
- package/src/constants/warnings.ts +26 -0
- package/src/globalStyles.ts +1 -4
- package/src/hooks/useConfirmSwap.ts +251 -220
- package/src/hooks/useFetchBestRoute.ts +38 -0
- package/src/hooks/useNavigateBack.ts +25 -9
- package/src/hooks/useSwapInput.ts +116 -0
- package/src/hooks/useTheme.ts +35 -74
- package/src/hooks/useWalletList.ts +125 -0
- package/src/pages/ConfirmSwapPage.tsx +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 +81 -0
- package/src/pages/SelectSwapItemsPage.tsx +169 -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/store/bestRoute.ts +85 -180
- package/src/store/meta.ts +23 -3
- package/src/store/notification.ts +77 -0
- package/src/store/settings.ts +20 -13
- package/src/store/ui.ts +1 -5
- package/src/store/wallets.ts +92 -76
- package/src/types/config.ts +12 -7
- package/src/types/notification.ts +33 -0
- package/src/types/routing.ts +29 -28
- package/src/types/swap.ts +9 -1
- package/src/utils/common.ts +56 -3
- package/src/utils/configs.ts +3 -0
- package/src/utils/date.ts +15 -18
- package/src/utils/meta.ts +9 -0
- package/src/utils/numbers.ts +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 +165 -116
- package/dist/components/ConfirmSwapErrors.d.ts +0 -4
- package/dist/components/ConfirmSwapErrors.d.ts.map +0 -1
- package/dist/components/ConfirmSwapWarnings.d.ts +0 -3
- package/dist/components/ConfirmSwapWarnings.d.ts.map +0 -1
- package/dist/components/Layout.d.ts +0 -7
- package/dist/components/Layout.d.ts.map +0 -1
- package/dist/pages/LiquiditySourcesPage.d.ts +0 -7
- package/dist/pages/LiquiditySourcesPage.d.ts.map +0 -1
- package/dist/pages/SelectChainPage.d.ts +0 -8
- package/dist/pages/SelectChainPage.d.ts.map +0 -1
- package/dist/pages/SelectTokenPage.d.ts +0 -15
- package/dist/pages/SelectTokenPage.d.ts.map +0 -1
- package/src/components/ConfirmSwapErrors.tsx +0 -34
- package/src/components/ConfirmSwapWarnings.tsx +0 -22
- package/src/components/Layout.tsx +0 -105
- package/src/pages/LiquiditySourcesPage.tsx +0 -63
- package/src/pages/SelectChainPage.tsx +0 -42
- package/src/pages/SelectTokenPage.tsx +0 -64
package/src/utils/wallets.ts
CHANGED
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { TokenWithBalance } from '../components/TokenList';
|
|
2
|
+
import type { ConnectedWallet, TokenBalance } from '../store/wallets';
|
|
3
|
+
import type { Wallet } from '../types';
|
|
4
|
+
import type { WalletInfo as ModalWalletInfo } from '@rango-dev/ui';
|
|
5
|
+
import type {
|
|
5
6
|
Network,
|
|
7
|
+
WalletInfo,
|
|
6
8
|
WalletState,
|
|
7
9
|
WalletType,
|
|
8
|
-
detectInstallLink,
|
|
9
|
-
WalletInfo,
|
|
10
10
|
WalletTypes,
|
|
11
|
-
Networks,
|
|
12
11
|
} from '@rango-dev/wallets-shared';
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
WalletInfo as ModalWalletInfo,
|
|
16
|
-
WalletState as WalletStatus,
|
|
17
|
-
SelectableWallet,
|
|
18
|
-
} from '@rango-dev/ui';
|
|
19
|
-
import {
|
|
12
|
+
import type {
|
|
20
13
|
BestRouteResponse,
|
|
21
14
|
BlockchainMeta,
|
|
22
15
|
Token,
|
|
23
16
|
WalletDetail,
|
|
24
17
|
} from 'rango-sdk';
|
|
25
|
-
|
|
18
|
+
|
|
19
|
+
import { WalletState as WalletStatus } from '@rango-dev/ui';
|
|
26
20
|
import { readAccountAddress } from '@rango-dev/wallets-react';
|
|
27
|
-
import {
|
|
28
|
-
|
|
21
|
+
import {
|
|
22
|
+
detectInstallLink,
|
|
23
|
+
getCosmosExperimentalChainInfo,
|
|
24
|
+
isEvmAddress,
|
|
25
|
+
KEPLR_COMPATIBLE_WALLETS,
|
|
26
|
+
Networks,
|
|
27
|
+
} from '@rango-dev/wallets-shared';
|
|
29
28
|
import BigNumber from 'bignumber.js';
|
|
30
|
-
import {
|
|
29
|
+
import { isCosmosBlockchain } from 'rango-types';
|
|
30
|
+
|
|
31
31
|
import { ZERO } from '../constants/numbers';
|
|
32
|
-
import {
|
|
32
|
+
import { EXCLUDED_WALLETS } from '../constants/wallets';
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
import { numberToString } from './numbers';
|
|
35
|
+
|
|
36
|
+
export function mapStatusToWalletState(state: WalletState): WalletStatus {
|
|
35
37
|
switch (true) {
|
|
36
38
|
case state.connected:
|
|
37
39
|
return WalletStatus.CONNECTED;
|
|
@@ -44,40 +46,44 @@ export function getStateWallet(state: WalletState): WalletStatus {
|
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
export
|
|
48
|
-
|
|
49
|
-
export function getlistWallet(
|
|
49
|
+
export function mapWalletTypesToWalletInfo(
|
|
50
50
|
getState: (type: WalletType) => WalletState,
|
|
51
51
|
getWalletInfo: (type: WalletType) => WalletInfo,
|
|
52
|
-
list: WalletType[]
|
|
52
|
+
list: WalletType[],
|
|
53
|
+
chain?: string
|
|
53
54
|
): ModalWalletInfo[] {
|
|
54
55
|
return list
|
|
55
|
-
.filter((wallet) => !
|
|
56
|
+
.filter((wallet) => !EXCLUDED_WALLETS.includes(wallet as WalletTypes))
|
|
57
|
+
.filter((wallet) => {
|
|
58
|
+
if (chain) {
|
|
59
|
+
const { supportedChains } = getWalletInfo(wallet);
|
|
60
|
+
return !!supportedChains.find(
|
|
61
|
+
(supportedChain) => supportedChain.name === chain
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
})
|
|
56
66
|
.map((type) => {
|
|
57
|
-
const {
|
|
58
|
-
|
|
59
|
-
img: image,
|
|
60
|
-
installLink,
|
|
61
|
-
showOnMobile,
|
|
62
|
-
} = getWalletInfo(type);
|
|
63
|
-
const state = getStateWallet(getState(type));
|
|
67
|
+
const { name, img: image, installLink } = getWalletInfo(type);
|
|
68
|
+
const state = mapStatusToWalletState(getState(type));
|
|
64
69
|
return {
|
|
65
|
-
name,
|
|
70
|
+
title: name,
|
|
66
71
|
image,
|
|
67
|
-
|
|
72
|
+
link: detectInstallLink(installLink),
|
|
68
73
|
state,
|
|
69
74
|
type,
|
|
70
|
-
showOnMobile: typeof showOnMobile === 'undefined' ? false : true,
|
|
71
75
|
};
|
|
72
76
|
});
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
export function walletAndSupportedChainsNames(
|
|
76
|
-
|
|
80
|
+
supportedBlockchains: BlockchainMeta[]
|
|
77
81
|
): Network[] | null {
|
|
78
|
-
if (!
|
|
82
|
+
if (!supportedBlockchains) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
79
85
|
let walletAndSupportedChainsNames: Network[] = [];
|
|
80
|
-
walletAndSupportedChainsNames =
|
|
86
|
+
walletAndSupportedChainsNames = supportedBlockchains.map(
|
|
81
87
|
(blockchainMeta) => blockchainMeta.name
|
|
82
88
|
);
|
|
83
89
|
|
|
@@ -107,42 +113,54 @@ export function prepareAccountsForWalletStore(
|
|
|
107
113
|
}
|
|
108
114
|
}
|
|
109
115
|
|
|
110
|
-
const
|
|
116
|
+
const supportedBlockchains = supportedChainNames || [];
|
|
111
117
|
|
|
112
118
|
accounts.forEach((account) => {
|
|
113
119
|
const { address, network } = readAccountAddress(account);
|
|
114
120
|
|
|
115
|
-
const hasLimitation =
|
|
116
|
-
const isSupported =
|
|
121
|
+
const hasLimitation = supportedBlockchains.length > 0;
|
|
122
|
+
const isSupported = supportedBlockchains.includes(network);
|
|
117
123
|
const isUnknown = network === Networks.Unknown;
|
|
118
124
|
const notSupportedNetworkByWallet =
|
|
119
125
|
hasLimitation && !isSupported && !isUnknown;
|
|
120
126
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
127
|
+
/*
|
|
128
|
+
* Here we check given `network` is not supported by wallet
|
|
129
|
+
* And also the network is known.
|
|
130
|
+
*/
|
|
131
|
+
if (notSupportedNetworkByWallet) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
124
134
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
135
|
+
/*
|
|
136
|
+
* In some cases we can handle unknown network by checking its address
|
|
137
|
+
* pattern and act on it.
|
|
138
|
+
* Example: showing our evm compatible network when the unknown network is evm.
|
|
139
|
+
* Otherwise, we stop executing this function.
|
|
140
|
+
*/
|
|
141
|
+
const isUnknownAndEvmBased =
|
|
130
142
|
network === Networks.Unknown && isEvmAddress(address);
|
|
131
|
-
if (isUnknown && !
|
|
143
|
+
if (isUnknown && !isUnknownAndEvmBased) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
132
146
|
|
|
133
147
|
const isEvmBasedChain = evmBasedChains.includes(network);
|
|
134
148
|
|
|
135
149
|
// If it's an evm network, we will add the address to all the evm chains.
|
|
136
|
-
if (isEvmBasedChain ||
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
150
|
+
if (isEvmBasedChain || isUnknownAndEvmBased) {
|
|
151
|
+
/*
|
|
152
|
+
* all evm chains are not supported in wallets, so we are adding
|
|
153
|
+
* only to those that are supported by wallet.
|
|
154
|
+
*/
|
|
155
|
+
const evmChainsSupportedByWallet = supportedBlockchains.filter((chain) =>
|
|
140
156
|
evmBasedChains.includes(chain)
|
|
141
157
|
);
|
|
142
158
|
|
|
143
159
|
evmChainsSupportedByWallet.forEach((network) => {
|
|
144
|
-
|
|
145
|
-
|
|
160
|
+
/*
|
|
161
|
+
* EVM addresses are not case sensitive.
|
|
162
|
+
* Some wallets like Binance-chain return some letters in uppercase which produces bugs in our wallet state.
|
|
163
|
+
*/
|
|
146
164
|
addAccount(network, address.toLowerCase());
|
|
147
165
|
});
|
|
148
166
|
} else {
|
|
@@ -187,10 +205,9 @@ type Blockchain = { name: string; accounts: ConnectedWallet[] };
|
|
|
187
205
|
|
|
188
206
|
export function getSelectableWallets(
|
|
189
207
|
connectedWallets: ConnectedWallet[],
|
|
190
|
-
selectedWallets: Wallet[],
|
|
191
208
|
getWalletInfo: (type: WalletType) => WalletInfo,
|
|
192
209
|
destinationChain?: string
|
|
193
|
-
):
|
|
210
|
+
): Wallet[] {
|
|
194
211
|
const selectableWallets = connectedWallets.map(
|
|
195
212
|
(connectedWallet: ConnectedWallet) => {
|
|
196
213
|
return {
|
|
@@ -202,11 +219,7 @@ export function getSelectableWallets(
|
|
|
202
219
|
selected:
|
|
203
220
|
destinationChain === connectedWallet.chain
|
|
204
221
|
? false
|
|
205
|
-
:
|
|
206
|
-
(selectedWallet) =>
|
|
207
|
-
selectedWallet.chain === connectedWallet.chain &&
|
|
208
|
-
selectedWallet.walletType === connectedWallet.walletType
|
|
209
|
-
),
|
|
222
|
+
: connectedWallet.selected,
|
|
210
223
|
};
|
|
211
224
|
}
|
|
212
225
|
);
|
|
@@ -220,12 +233,16 @@ export function getBalanceFromWallet(
|
|
|
220
233
|
symbol: string,
|
|
221
234
|
address: string | null
|
|
222
235
|
): TokenBalance | null {
|
|
223
|
-
if (connectedWallets.length === 0)
|
|
236
|
+
if (connectedWallets.length === 0) {
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
224
239
|
|
|
225
240
|
const selectedChainWallets = connectedWallets.filter(
|
|
226
241
|
(wallet) => wallet.chain === chain
|
|
227
242
|
);
|
|
228
|
-
if (selectedChainWallets.length === 0)
|
|
243
|
+
if (selectedChainWallets.length === 0) {
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
229
246
|
|
|
230
247
|
return (
|
|
231
248
|
selectedChainWallets
|
|
@@ -259,44 +276,31 @@ export function isAccountAndWalletMatched(
|
|
|
259
276
|
}
|
|
260
277
|
|
|
261
278
|
export function makeBalanceFor(
|
|
262
|
-
|
|
263
|
-
retrivedBalance: WalletDetail,
|
|
279
|
+
retrievedBalance: WalletDetail,
|
|
264
280
|
tokens: Token[]
|
|
265
|
-
):
|
|
266
|
-
const {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
.shiftedBy(-tokenBalance.amount.decimals)
|
|
289
|
-
.toFixed(),
|
|
290
|
-
logo: '',
|
|
291
|
-
usdPrice:
|
|
292
|
-
getUsdPrice(
|
|
293
|
-
chain,
|
|
294
|
-
tokenBalance.asset.symbol,
|
|
295
|
-
tokenBalance.asset.address,
|
|
296
|
-
tokens
|
|
297
|
-
) || null,
|
|
298
|
-
})) || [],
|
|
299
|
-
};
|
|
281
|
+
): TokenBalance[] {
|
|
282
|
+
const { blockChain: chain, balances = [] } = retrievedBalance;
|
|
283
|
+
return (
|
|
284
|
+
balances?.map((tokenBalance) => ({
|
|
285
|
+
chain,
|
|
286
|
+
symbol: tokenBalance.asset.symbol,
|
|
287
|
+
ticker: tokenBalance.asset.symbol,
|
|
288
|
+
address: tokenBalance.asset.address || null,
|
|
289
|
+
rawAmount: tokenBalance.amount.amount,
|
|
290
|
+
decimal: tokenBalance.amount.decimals,
|
|
291
|
+
amount: new BigNumber(tokenBalance.amount.amount)
|
|
292
|
+
.shiftedBy(-tokenBalance.amount.decimals)
|
|
293
|
+
.toFixed(),
|
|
294
|
+
logo: '',
|
|
295
|
+
usdPrice:
|
|
296
|
+
getUsdPrice(
|
|
297
|
+
chain,
|
|
298
|
+
tokenBalance.asset.symbol,
|
|
299
|
+
tokenBalance.asset.address,
|
|
300
|
+
tokens
|
|
301
|
+
) || null,
|
|
302
|
+
})) || []
|
|
303
|
+
);
|
|
300
304
|
}
|
|
301
305
|
|
|
302
306
|
export function resetConnectedWalletState(
|
|
@@ -307,10 +311,11 @@ export function resetConnectedWalletState(
|
|
|
307
311
|
|
|
308
312
|
export const calculateWalletUsdValue = (connectedWallet: ConnectedWallet[]) => {
|
|
309
313
|
const uniqueAccountAddresses = new Set<string | null>();
|
|
310
|
-
const
|
|
314
|
+
const uniqueBalance: ConnectedWallet[] = connectedWallet?.reduce(
|
|
311
315
|
(acc: ConnectedWallet[], current: ConnectedWallet) => {
|
|
312
316
|
return acc.findIndex(
|
|
313
317
|
(i) => i.address === current.address && i.chain === current.chain
|
|
318
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
314
319
|
) === -1
|
|
315
320
|
? [...acc, current]
|
|
316
321
|
: acc;
|
|
@@ -318,7 +323,7 @@ export const calculateWalletUsdValue = (connectedWallet: ConnectedWallet[]) => {
|
|
|
318
323
|
[]
|
|
319
324
|
);
|
|
320
325
|
|
|
321
|
-
const modifiedWalletBlockchains =
|
|
326
|
+
const modifiedWalletBlockchains = uniqueBalance?.map((chain) => {
|
|
322
327
|
const modifiedWalletBlockchain: Blockchain = {
|
|
323
328
|
name: chain.chain,
|
|
324
329
|
accounts: [],
|
|
@@ -327,8 +332,9 @@ export const calculateWalletUsdValue = (connectedWallet: ConnectedWallet[]) => {
|
|
|
327
332
|
uniqueAccountAddresses.add(chain.address);
|
|
328
333
|
}
|
|
329
334
|
uniqueAccountAddresses.forEach((accountAddress) => {
|
|
330
|
-
if (chain.address === accountAddress)
|
|
335
|
+
if (chain.address === accountAddress) {
|
|
331
336
|
modifiedWalletBlockchain.accounts.push(chain);
|
|
337
|
+
}
|
|
332
338
|
});
|
|
333
339
|
return modifiedWalletBlockchain;
|
|
334
340
|
});
|
|
@@ -342,10 +348,10 @@ export const calculateWalletUsdValue = (connectedWallet: ConnectedWallet[]) => {
|
|
|
342
348
|
?.reduce((a, b) => a.plus(b), ZERO) || ZERO
|
|
343
349
|
).toString();
|
|
344
350
|
|
|
345
|
-
return
|
|
351
|
+
return numberWithThousandSeparator(total);
|
|
346
352
|
};
|
|
347
353
|
|
|
348
|
-
function
|
|
354
|
+
function numberWithThousandSeparator(number: string | number): string {
|
|
349
355
|
const parts = number.toString().split('.');
|
|
350
356
|
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
351
357
|
return parts.join('.');
|
|
@@ -398,11 +404,14 @@ export const isExperimentalChain = (
|
|
|
398
404
|
.map(([, blockchainMeta]) => blockchainMeta)
|
|
399
405
|
.filter(isCosmosBlockchain)
|
|
400
406
|
);
|
|
401
|
-
return
|
|
407
|
+
return (
|
|
408
|
+
cosmosExperimentalChainInfo &&
|
|
409
|
+
cosmosExperimentalChainInfo[wallet]?.experimental
|
|
410
|
+
);
|
|
402
411
|
};
|
|
403
412
|
|
|
404
413
|
export const getKeplrCompatibleConnectedWallets = (
|
|
405
|
-
selectableWallets:
|
|
414
|
+
selectableWallets: Wallet[]
|
|
406
415
|
): WalletType[] => {
|
|
407
416
|
const connectedWalletTypes = new Set(
|
|
408
417
|
selectableWallets.map((wallet) => {
|
|
@@ -419,6 +428,7 @@ export function getTokensWithBalance(
|
|
|
419
428
|
tokens: TokenWithBalance[],
|
|
420
429
|
connectedWallets: ConnectedWallet[]
|
|
421
430
|
): TokenWithBalance[] {
|
|
431
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
422
432
|
return tokens.map(({ balance, ...otherProps }) => {
|
|
423
433
|
const tokenAmount = numberToString(
|
|
424
434
|
new BigNumber(
|
|
@@ -432,7 +442,7 @@ export function getTokensWithBalance(
|
|
|
432
442
|
);
|
|
433
443
|
|
|
434
444
|
let tokenUsdValue = '';
|
|
435
|
-
if (otherProps.usdPrice)
|
|
445
|
+
if (otherProps.usdPrice) {
|
|
436
446
|
tokenUsdValue = numberToString(
|
|
437
447
|
new BigNumber(
|
|
438
448
|
getBalanceFromWallet(
|
|
@@ -443,6 +453,7 @@ export function getTokensWithBalance(
|
|
|
443
453
|
)?.amount || ZERO
|
|
444
454
|
).multipliedBy(otherProps.usdPrice)
|
|
445
455
|
);
|
|
456
|
+
}
|
|
446
457
|
|
|
447
458
|
return {
|
|
448
459
|
...otherProps,
|
|
@@ -459,8 +470,11 @@ export function getSortedTokens(
|
|
|
459
470
|
connectedWallets: ConnectedWallet[],
|
|
460
471
|
otherChainTokens: TokenWithBalance[]
|
|
461
472
|
): TokenWithBalance[] {
|
|
462
|
-
const
|
|
463
|
-
|
|
473
|
+
const fromChainEqualsToToBlockchain =
|
|
474
|
+
chain?.name === otherChainTokens[0]?.name;
|
|
475
|
+
if (fromChainEqualsToToBlockchain) {
|
|
476
|
+
return otherChainTokens;
|
|
477
|
+
}
|
|
464
478
|
const filteredTokens = tokens.filter(
|
|
465
479
|
(token) => token.blockchain === chain?.name
|
|
466
480
|
);
|
|
@@ -485,13 +499,17 @@ export function getDefaultToken(
|
|
|
485
499
|
let selectedToken: TokenWithBalance;
|
|
486
500
|
const firstToken = sortedTokens[0];
|
|
487
501
|
const secondToken = sortedTokens[1];
|
|
488
|
-
if (sortedTokens.length === 1)
|
|
489
|
-
|
|
490
|
-
else
|
|
502
|
+
if (sortedTokens.length === 1) {
|
|
503
|
+
selectedToken = firstToken;
|
|
504
|
+
} else if (tokensAreEqual(firstToken, otherToken)) {
|
|
505
|
+
selectedToken = secondToken;
|
|
506
|
+
} else {
|
|
507
|
+
selectedToken = firstToken;
|
|
508
|
+
}
|
|
491
509
|
return selectedToken;
|
|
492
510
|
}
|
|
493
511
|
|
|
494
|
-
export function
|
|
512
|
+
export function sortWalletsBasedOnConnectionState(
|
|
495
513
|
wallets: ModalWalletInfo[]
|
|
496
514
|
): ModalWalletInfo[] {
|
|
497
515
|
return wallets.sort(
|
|
@@ -508,3 +526,34 @@ export function sortWalletsBasedOnState(
|
|
|
508
526
|
)
|
|
509
527
|
);
|
|
510
528
|
}
|
|
529
|
+
|
|
530
|
+
export function getConciseAddress(
|
|
531
|
+
address: string,
|
|
532
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
533
|
+
maxChars = 8,
|
|
534
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
535
|
+
ellipsisLength = 3
|
|
536
|
+
): string {
|
|
537
|
+
if (address.length < 2 * maxChars + ellipsisLength) {
|
|
538
|
+
return address;
|
|
539
|
+
}
|
|
540
|
+
const start = address.slice(0, maxChars);
|
|
541
|
+
const end = address.slice(-maxChars);
|
|
542
|
+
return `${start}${'.'.repeat(ellipsisLength)}${end}`;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
export function getAddress({
|
|
546
|
+
chain,
|
|
547
|
+
connectedWallets,
|
|
548
|
+
walletType,
|
|
549
|
+
}: {
|
|
550
|
+
connectedWallets: ConnectedWallet[];
|
|
551
|
+
walletType: string;
|
|
552
|
+
chain: string;
|
|
553
|
+
}): string | undefined {
|
|
554
|
+
return connectedWallets.find(
|
|
555
|
+
(connectedWallet) =>
|
|
556
|
+
connectedWallet.walletType === walletType &&
|
|
557
|
+
connectedWallet.chain === chain
|
|
558
|
+
)?.address;
|
|
559
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmSwapErrors.d.ts","sourceRoot":"","sources":["../../src/components/ConfirmSwapErrors.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAyB,MAAM,UAAU,CAAC;AAInE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,EAAE,kCA2B3D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmSwapWarnings.d.ts","sourceRoot":"","sources":["../../src/components/ConfirmSwapWarnings.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,IAAI,uBAAuB,EAC/C,MAAM,UAAU,CAAC;AAElB,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,uBAAuB,EAAE,YAgBtE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../src/components/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAczC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKxC,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,wBAAgB,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,WAAW,qBAiF7C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LiquiditySourcesPage.d.ts","sourceRoot":"","sources":["../../src/pages/LiquiditySourcesPage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,UAAU,SAAS;IACjB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AACD,wBAAgB,mBAAmB,CAAC,EAAE,iBAAiB,EAAE,EAAE,SAAS,qBAoDnE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectChainPage.d.ts","sourceRoot":"","sources":["../../src/pages/SelectChainPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,qBA6B/C"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Asset, Token } from 'rango-sdk';
|
|
3
|
-
interface PropTypes {
|
|
4
|
-
type: 'from' | 'to';
|
|
5
|
-
supportedTokens?: Asset[];
|
|
6
|
-
}
|
|
7
|
-
export interface TokenWithBalance extends Token {
|
|
8
|
-
balance?: {
|
|
9
|
-
amount: string;
|
|
10
|
-
usdValue: string;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export declare function SelectTokenPage(props: PropTypes): React.JSX.Element;
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=SelectTokenPage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectTokenPage.d.ts","sourceRoot":"","sources":["../../src/pages/SelectTokenPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAMzC,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,eAAe,CAAC,EAAE,KAAK,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAiB,SAAQ,KAAK;IAC7C,OAAO,CAAC,EAAE;QACR,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,qBA0C/C"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BalanceErrors, MinRequiredSlippage } from '@rango-dev/ui';
|
|
3
|
-
import { ConfirmSwapError, ConfirmSwapErrorTypes } from '../types';
|
|
4
|
-
import { useNavigate } from 'react-router-dom';
|
|
5
|
-
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
6
|
-
|
|
7
|
-
export function ConfirmSwapErrors(errors: ConfirmSwapError[]) {
|
|
8
|
-
const navigate = useNavigate();
|
|
9
|
-
|
|
10
|
-
return errors.flatMap((error) => {
|
|
11
|
-
switch (error.type) {
|
|
12
|
-
case ConfirmSwapErrorTypes.NO_ROUTE:
|
|
13
|
-
return 'No routes found. Please try again later.';
|
|
14
|
-
case ConfirmSwapErrorTypes.REQUEST_FAILED:
|
|
15
|
-
return `Failed to confirm swap ${
|
|
16
|
-
error.status ? `'status': ${error.status})` : ''
|
|
17
|
-
}, please try again.`;
|
|
18
|
-
|
|
19
|
-
case ConfirmSwapErrorTypes.ROUTE_UPDATED_WITH_HIGH_VALUE_LOSS:
|
|
20
|
-
return 'Route updated and price impact is too high, try again later!';
|
|
21
|
-
case ConfirmSwapErrorTypes.INSUFFICIENT_SLIPPAGE:
|
|
22
|
-
return (
|
|
23
|
-
<MinRequiredSlippage
|
|
24
|
-
minRequiredSlippage={error.minRequiredSlippage}
|
|
25
|
-
changeSlippage={() => navigate('/' + navigationRoutes.settings)}
|
|
26
|
-
/>
|
|
27
|
-
);
|
|
28
|
-
case ConfirmSwapErrorTypes.INSUFFICIENT_BALANCE:
|
|
29
|
-
return <BalanceErrors messages={error.messages} />;
|
|
30
|
-
default:
|
|
31
|
-
return [];
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConfirmSwapWarningTypes,
|
|
3
|
-
ConfirmSwapWarnings as ConfirmSwapWarningsType,
|
|
4
|
-
} from '../types';
|
|
5
|
-
|
|
6
|
-
export function ConfirmSwapWarnings(warnings: ConfirmSwapWarningsType[]) {
|
|
7
|
-
return warnings.flatMap((warning) => {
|
|
8
|
-
switch (warning.type) {
|
|
9
|
-
case ConfirmSwapWarningTypes.ROUTE_UPDATED:
|
|
10
|
-
return 'Route has been updated.';
|
|
11
|
-
case ConfirmSwapWarningTypes.ROUTE_AND_OUTPUT_AMOUNT_UPDATED:
|
|
12
|
-
return `Output amount changed to ${warning.newOutputAmount} (${warning.percentageChange}% change).`;
|
|
13
|
-
|
|
14
|
-
case ConfirmSwapWarningTypes.ROUTE_SWAPPERS_UPDATED:
|
|
15
|
-
return 'Route swappers has been updated.';
|
|
16
|
-
case ConfirmSwapWarningTypes.ROUTE_COINS_UPDATED:
|
|
17
|
-
return 'Route internal coins has been updated.';
|
|
18
|
-
default:
|
|
19
|
-
return [];
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|