@rango-dev/widget-embedded 0.12.1-next.3 → 0.12.1-next.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Wallets.d.ts +4 -3
- package/dist/Wallets.d.ts.map +1 -1
- package/dist/Widget.d.ts +3 -2
- package/dist/Widget.d.ts.map +1 -1
- package/dist/components/AppRouter.d.ts +5 -2
- package/dist/components/AppRouter.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts +1 -1
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.d.ts +4 -0
- package/dist/components/BlockchainList/BlockchainList.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts +4 -0
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts +307 -0
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.types.d.ts +8 -0
- package/dist/components/BlockchainList/BlockchainList.types.d.ts.map +1 -0
- package/dist/components/BlockchainList/LoadingBlockchainList.d.ts +3 -0
- package/dist/components/BlockchainList/LoadingBlockchainList.d.ts.map +1 -0
- package/dist/components/BlockchainList/index.d.ts +2 -0
- package/dist/components/BlockchainList/index.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.d.ts +4 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +154 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.types.d.ts +9 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.types.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/index.d.ts +2 -0
- package/dist/components/BlockchainsSection/index.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +6 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +2599 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts +4 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +11 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts +4 -0
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +460 -0
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +12 -0
- package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -0
- package/dist/components/HeaderButtons/BackButton.d.ts +5 -0
- package/dist/components/HeaderButtons/BackButton.d.ts.map +1 -0
- package/dist/components/HeaderButtons/CancelButton.d.ts +5 -0
- package/dist/components/HeaderButtons/CancelButton.d.ts.map +1 -0
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +616 -0
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -0
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +13 -0
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -0
- package/dist/components/HeaderButtons/HomeButtons.d.ts +4 -0
- package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -0
- package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts +3 -0
- package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts.map +1 -0
- package/dist/components/HeaderButtons/WalletButton.d.ts +5 -0
- package/dist/components/HeaderButtons/WalletButton.d.ts.map +1 -0
- package/dist/components/HeaderButtons/index.d.ts +5 -0
- package/dist/components/HeaderButtons/index.d.ts.map +1 -0
- package/dist/components/Layout/Layout.d.ts +7 -0
- package/dist/components/Layout/Layout.d.ts.map +1 -0
- package/dist/components/Layout/Layout.styles.d.ts +464 -0
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -0
- package/dist/components/Layout/Layout.types.d.ts +17 -0
- package/dist/components/Layout/Layout.types.d.ts.map +1 -0
- package/dist/components/Layout/index.d.ts +2 -0
- package/dist/components/Layout/index.d.ts.map +1 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.d.ts +3 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.d.ts.map +1 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +155 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -0
- package/dist/components/LoadingLiquiditySourceList/index.d.ts +2 -0
- package/dist/components/LoadingLiquiditySourceList/index.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts +4 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts +3 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +460 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +4 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/index.d.ts +2 -0
- package/dist/components/LoadingSwapDetails/index.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.d.ts +4 -0
- package/dist/components/NoRoutes/NoRoutes.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts +3 -0
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.styles.d.ts +460 -0
- package/dist/components/NoRoutes/NoRoutes.styles.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.types.d.ts +20 -0
- package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +1 -0
- package/dist/components/NoRoutes/index.d.ts +2 -0
- package/dist/components/NoRoutes/index.d.ts.map +1 -0
- package/dist/components/NotificationContent/NotificationContent.d.ts +3 -0
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -0
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts +613 -0
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -0
- package/dist/components/NotificationContent/NotificationNotFound.d.ts +3 -0
- package/dist/components/NotificationContent/NotificationNotFound.d.ts.map +1 -0
- package/dist/components/NotificationContent/index.d.ts +2 -0
- package/dist/components/NotificationContent/index.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrors.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts +613 -0
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrors.types.d.ts +24 -0
- package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +1 -0
- package/dist/components/RouteErrors/index.d.ts +2 -0
- package/dist/components/RouteErrors/index.d.ts.map +1 -0
- package/dist/components/SearchInput/SearchInput.d.ts +4 -0
- package/dist/components/SearchInput/SearchInput.d.ts.map +1 -0
- package/dist/components/SearchInput/SearchInput.styles.d.ts +154 -0
- package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -0
- package/dist/components/SearchInput/SearchInput.types.d.ts +10 -0
- package/dist/components/SearchInput/SearchInput.types.d.ts.map +1 -0
- package/dist/components/SearchInput/index.d.ts +2 -0
- package/dist/components/SearchInput/index.d.ts.map +1 -0
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +613 -0
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -0
- package/dist/components/SettingsContainer/index.d.ts +2 -0
- package/dist/components/SettingsContainer/index.d.ts.map +1 -0
- package/dist/components/Slippage/Slippage.d.ts +3 -0
- package/dist/components/Slippage/Slippage.d.ts.map +1 -0
- package/dist/components/Slippage/Slippage.styles.d.ts +613 -0
- package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -0
- package/dist/components/Slippage/SlippageTooltipContent.d.ts +3 -0
- package/dist/components/Slippage/SlippageTooltipContent.d.ts.map +1 -0
- package/dist/components/Slippage/index.d.ts +2 -0
- package/dist/components/Slippage/index.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts +4 -0
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.d.ts +4 -0
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +8 -0
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +919 -0
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.types.d.ts +12 -0
- package/dist/components/SwapDetails/SwapDetails.types.d.ts.map +1 -0
- package/dist/components/SwapDetails/index.d.ts +2 -0
- package/dist/components/SwapDetails/index.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.d.ts +4 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.d.ts +4 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts +4 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +154 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +20 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/index.d.ts +3 -0
- package/dist/components/SwapDetailsAlerts/index.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Cancel.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Cancel.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Delete.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Delete.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +154 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +46 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/index.d.ts +4 -0
- package/dist/components/SwapDetailsModal/index.d.ts.map +1 -0
- package/dist/components/SwapsGroup/SwapsGroup.d.ts +4 -0
- package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -0
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +613 -0
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -0
- package/dist/components/SwapsGroup/SwapsGroup.types.d.ts +12 -0
- package/dist/components/SwapsGroup/SwapsGroup.types.d.ts.map +1 -0
- package/dist/components/SwapsGroup/index.d.ts +2 -0
- package/dist/components/SwapsGroup/index.d.ts.map +1 -0
- package/dist/components/SwitchFromAndTo.d.ts +1 -1
- package/dist/components/SwitchFromAndTo.d.ts.map +1 -1
- package/dist/components/TokenList/LoadingTokenList.d.ts +4 -0
- package/dist/components/TokenList/LoadingTokenList.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.d.ts +4 -0
- package/dist/components/TokenList/TokenList.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.helpers.d.ts +3 -0
- package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.styles.d.ts +1532 -0
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.types.d.ts +40 -0
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -0
- package/dist/components/TokenList/index.d.ts +3 -0
- package/dist/components/TokenList/index.d.ts.map +1 -0
- package/dist/components/UpdateUrl.d.ts +6 -1
- package/dist/components/UpdateUrl.d.ts.map +1 -1
- package/dist/components/WalletModal/WalletModal.d.ts +4 -0
- package/dist/components/WalletModal/WalletModal.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModal.types.d.ts +10 -0
- package/dist/components/WalletModal/WalletModal.types.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModalContent.d.ts +4 -0
- package/dist/components/WalletModal/WalletModalContent.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts +613 -0
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -0
- package/dist/components/WalletModal/index.d.ts +2 -0
- package/dist/components/WalletModal/index.d.ts.map +1 -0
- package/dist/components/WidgetEvents.d.ts.map +1 -1
- package/dist/constants/errors.d.ts +29 -0
- package/dist/constants/errors.d.ts.map +1 -1
- package/dist/constants/messages.d.ts +7 -0
- package/dist/constants/messages.d.ts.map +1 -0
- package/dist/constants/navigationRoutes.d.ts +8 -4
- package/dist/constants/navigationRoutes.d.ts.map +1 -1
- package/dist/constants/routing.d.ts +13 -0
- package/dist/constants/routing.d.ts.map +1 -0
- package/dist/constants/searchParams.d.ts +2 -2
- package/dist/constants/searchParams.d.ts.map +1 -1
- package/dist/constants/swapSettings.d.ts.map +1 -1
- package/dist/constants/wallets.d.ts +3 -0
- package/dist/constants/wallets.d.ts.map +1 -0
- package/dist/constants/warnings.d.ts +3 -0
- package/dist/constants/warnings.d.ts.map +1 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/globalStyles.d.ts +1 -1
- package/dist/globalStyles.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap.d.ts +14 -6
- package/dist/hooks/useConfirmSwap.d.ts.map +1 -1
- package/dist/hooks/useFetchBestRoute.d.ts +9 -0
- package/dist/hooks/useFetchBestRoute.d.ts.map +1 -0
- package/dist/hooks/useNavigateBack.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList.d.ts +18 -0
- package/dist/hooks/usePrepareBlockchainList.d.ts.map +1 -0
- package/dist/hooks/useSwapInput.d.ts +12 -0
- package/dist/hooks/useSwapInput.d.ts.map +1 -0
- package/dist/hooks/useSyncStoresWithConfig.d.ts +3 -0
- package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -0
- package/dist/hooks/useTheme.d.ts +3 -29
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts +20 -0
- package/dist/hooks/useWalletList.d.ts.map +1 -0
- package/dist/hooks/useWalletProviders.d.ts +3 -3
- package/dist/hooks/useWalletProviders.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts +6 -3
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/HistoryPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/LanguagePage.d.ts +3 -0
- package/dist/pages/LanguagePage.d.ts.map +1 -0
- package/dist/pages/LiquiditySourcePage.d.ts +8 -0
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -0
- package/dist/pages/SelectBlockchainPage.d.ts +7 -0
- package/dist/pages/SelectBlockchainPage.d.ts.map +1 -0
- package/dist/pages/SelectSwapItemsPage.d.ts +7 -0
- package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -0
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
- package/dist/pages/ThemePage.d.ts +3 -0
- package/dist/pages/ThemePage.d.ts.map +1 -0
- package/dist/pages/WalletsPage.d.ts +4 -2
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/services/httpService.d.ts +0 -1
- package/dist/services/httpService.d.ts.map +1 -1
- package/dist/store/app.d.ts +26 -0
- package/dist/store/app.d.ts.map +1 -0
- package/dist/store/bestRoute.d.ts +32 -23
- package/dist/store/bestRoute.d.ts.map +1 -1
- package/dist/store/meta.d.ts +8 -3
- package/dist/store/meta.d.ts.map +1 -1
- package/dist/store/notification.d.ts +38 -0
- package/dist/store/notification.d.ts.map +1 -0
- package/dist/store/settings.d.ts +2 -2
- package/dist/store/settings.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts +8 -0
- package/dist/store/slices/config.d.ts.map +1 -0
- package/dist/store/slices/data.d.ts +26 -0
- package/dist/store/slices/data.d.ts.map +1 -0
- package/dist/store/ui.d.ts +0 -2
- package/dist/store/ui.d.ts.map +1 -1
- package/dist/store/wallets.d.ts +14 -12
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +11 -6
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/notification.d.ts +22 -0
- package/dist/types/notification.d.ts.map +1 -0
- package/dist/types/routing.d.ts +30 -23
- package/dist/types/routing.d.ts.map +1 -1
- package/dist/types/swap.d.ts +8 -1
- package/dist/types/swap.d.ts.map +1 -1
- package/dist/utils/common.d.ts +6 -0
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +5 -0
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/date.d.ts +1 -1
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +3 -0
- package/dist/utils/meta.d.ts.map +1 -0
- package/dist/utils/numbers.d.ts +5 -2
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/routing.d.ts +10 -7
- package/dist/utils/routing.d.ts.map +1 -1
- package/dist/utils/settings.d.ts +10 -0
- package/dist/utils/settings.d.ts.map +1 -0
- package/dist/utils/swap.d.ts +29 -14
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/time.d.ts +2 -2
- package/dist/utils/time.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +21 -15
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/Wallets.tsx +23 -17
- package/src/Widget.tsx +43 -30
- package/src/components/AppRouter.tsx +38 -7
- package/src/components/AppRoutes.tsx +40 -29
- package/src/components/BlockchainList/BlockchainList.helpers.ts +37 -0
- package/src/components/BlockchainList/BlockchainList.styles.ts +19 -0
- package/src/components/BlockchainList/BlockchainList.tsx +73 -0
- package/src/components/BlockchainList/BlockchainList.types.ts +8 -0
- package/src/components/BlockchainList/LoadingBlockchainList.tsx +20 -0
- package/src/components/BlockchainList/index.ts +1 -0
- package/src/components/BlockchainsSection/BlockchainsSection.styles.ts +7 -0
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +83 -0
- package/src/components/BlockchainsSection/BlockchainsSection.types.ts +9 -0
- package/src/components/BlockchainsSection/index.ts +1 -0
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +86 -0
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +210 -0
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +494 -0
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +11 -0
- package/src/components/ConfirmWalletsModal/WalletList.styles.ts +34 -0
- package/src/components/ConfirmWalletsModal/WalletList.tsx +294 -0
- package/src/components/ConfirmWalletsModal/WalletList.type.ts +12 -0
- package/src/components/HeaderButtons/BackButton.tsx +16 -0
- package/src/components/HeaderButtons/CancelButton.tsx +21 -0
- package/src/components/HeaderButtons/HeaderButtons.styles.ts +40 -0
- package/src/components/HeaderButtons/HeaderButtons.types.ts +12 -0
- package/src/components/HeaderButtons/HomeButtons.tsx +81 -0
- package/src/components/HeaderButtons/UnreadNotificationsBadge.tsx +20 -0
- package/src/components/HeaderButtons/WalletButton.tsx +23 -0
- package/src/components/HeaderButtons/index.ts +4 -0
- package/src/components/Layout/Layout.styles.ts +53 -0
- package/src/components/Layout/Layout.tsx +74 -0
- package/src/components/Layout/Layout.types.ts +20 -0
- package/src/components/Layout/index.ts +1 -0
- package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.ts +5 -0
- package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.tsx +23 -0
- package/src/components/LoadingLiquiditySourceList/index.ts +1 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +41 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +78 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +53 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +3 -0
- package/src/components/LoadingSwapDetails/index.ts +1 -0
- package/src/components/NoRoutes/NoRoutes.helper.ts +52 -0
- package/src/components/NoRoutes/NoRoutes.styles.ts +15 -0
- package/src/components/NoRoutes/NoRoutes.tsx +81 -0
- package/src/components/NoRoutes/NoRoutes.types.ts +21 -0
- package/src/components/NoRoutes/index.ts +1 -0
- package/src/components/NotificationContent/NotificationContent.styles.ts +34 -0
- package/src/components/NotificationContent/NotificationContent.tsx +108 -0
- package/src/components/NotificationContent/NotificationNotFound.tsx +17 -0
- package/src/components/NotificationContent/index.ts +1 -0
- package/src/components/RouteErrors/RouteErrors.styles.ts +28 -0
- package/src/components/RouteErrors/RouteErrors.tsx +79 -0
- package/src/components/RouteErrors/RouteErrors.types.ts +29 -0
- package/src/components/RouteErrors/RouteErrorsModal.tsx +129 -0
- package/src/components/RouteErrors/RouteErrorsModalItem.tsx +24 -0
- package/src/components/RouteErrors/index.ts +1 -0
- package/src/components/SearchInput/SearchInput.styles.ts +9 -0
- package/src/components/SearchInput/SearchInput.tsx +51 -0
- package/src/components/SearchInput/SearchInput.types.ts +10 -0
- package/src/components/SearchInput/index.ts +1 -0
- package/src/components/SettingsContainer/SettingsContainer.style.ts +27 -0
- package/src/components/SettingsContainer/index.ts +6 -0
- package/src/components/Slippage/Slippage.styles.ts +24 -0
- package/src/components/Slippage/Slippage.tsx +94 -0
- package/src/components/Slippage/SlippageTooltipContent.tsx +23 -0
- package/src/components/Slippage/index.ts +1 -0
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +79 -0
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +85 -0
- package/src/components/SwapDetails/SwapDetails.styles.ts +72 -0
- package/src/components/SwapDetails/SwapDetails.tsx +428 -0
- package/src/components/SwapDetails/SwapDetails.types.ts +12 -0
- package/src/components/SwapDetails/index.ts +1 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.tsx +36 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.tsx +55 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.ts +7 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.tsx +74 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +28 -0
- package/src/components/SwapDetailsAlerts/index.ts +2 -0
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +101 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +34 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.Delete.tsx +34 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +34 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.helpers.tsx +22 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.styles.ts +6 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +45 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +54 -0
- package/src/components/SwapDetailsModal/index.ts +3 -0
- package/src/components/SwapsGroup/SwapsGroup.styles.ts +26 -0
- package/src/components/SwapsGroup/SwapsGroup.tsx +126 -0
- package/src/components/SwapsGroup/SwapsGroup.types.ts +13 -0
- package/src/components/SwapsGroup/index.ts +1 -0
- package/src/components/SwitchFromAndTo.tsx +23 -41
- package/src/components/TokenList/LoadingTokenList.tsx +34 -0
- package/src/components/TokenList/TokenList.helpers.ts +11 -0
- package/src/components/TokenList/TokenList.styles.ts +121 -0
- package/src/components/TokenList/TokenList.tsx +275 -0
- package/src/components/TokenList/TokenList.types.ts +47 -0
- package/src/components/TokenList/index.ts +2 -0
- package/src/components/UpdateUrl.tsx +47 -23
- package/src/components/WalletModal/WalletModal.tsx +20 -0
- package/src/components/WalletModal/WalletModal.types.ts +11 -0
- package/src/components/WalletModal/WalletModalContent.styles.ts +44 -0
- package/src/components/WalletModal/WalletModalContent.tsx +54 -0
- package/src/components/WalletModal/index.ts +1 -0
- package/src/components/WidgetEvents.tsx +37 -5
- package/src/constants/errors.ts +56 -1
- package/src/constants/messages.ts +8 -0
- package/src/constants/navigationRoutes.ts +8 -4
- package/src/constants/routing.ts +17 -0
- package/src/constants/searchParams.ts +2 -2
- package/src/constants/swapSettings.ts +5 -1
- package/src/constants/wallets.ts +3 -0
- package/src/constants/warnings.ts +26 -0
- package/src/constants.ts +1 -0
- package/src/globalStyles.ts +1 -4
- package/src/hooks/useConfirmSwap.ts +251 -220
- package/src/hooks/useFetchBestRoute.ts +38 -0
- package/src/hooks/useNavigateBack.ts +25 -9
- package/src/hooks/usePrepareBlockchainList.ts +122 -0
- package/src/hooks/useSwapInput.ts +116 -0
- package/src/hooks/useSyncStoresWithConfig.ts +102 -0
- package/src/hooks/useTheme.ts +35 -74
- package/src/hooks/useWalletList.ts +125 -0
- package/src/hooks/useWalletProviders.ts +7 -7
- package/src/pages/ConfirmSwapPage.tsx +499 -228
- package/src/pages/HistoryPage.tsx +104 -15
- package/src/pages/Home.tsx +405 -110
- package/src/pages/LanguagePage.tsx +83 -0
- package/src/pages/LiquiditySourcePage.tsx +159 -0
- package/src/pages/SelectBlockchainPage.tsx +76 -0
- package/src/pages/SelectSwapItemsPage.tsx +131 -0
- package/src/pages/SettingsPage.tsx +165 -72
- package/src/pages/SwapDetailsPage.tsx +40 -141
- package/src/pages/ThemePage.tsx +96 -0
- package/src/pages/WalletsPage.tsx +79 -124
- package/src/services/httpService.ts +4 -5
- package/src/store/app.ts +15 -0
- package/src/store/bestRoute.ts +118 -239
- package/src/store/meta.ts +16 -14
- package/src/store/notification.ts +77 -0
- package/src/store/settings.ts +20 -13
- package/src/store/slices/config.ts +26 -0
- package/src/store/slices/data.ts +203 -0
- package/src/store/ui.ts +1 -5
- package/src/store/wallets.ts +92 -103
- package/src/types/config.ts +12 -7
- package/src/types/notification.ts +33 -0
- package/src/types/routing.ts +29 -28
- package/src/types/swap.ts +9 -1
- package/src/utils/common.ts +56 -3
- package/src/utils/configs.ts +8 -2
- package/src/utils/date.ts +15 -18
- package/src/utils/meta.ts +9 -0
- package/src/utils/numbers.ts +66 -20
- package/src/utils/routing.ts +105 -27
- package/src/utils/settings.ts +57 -0
- package/src/utils/swap.ts +244 -117
- package/src/utils/time.ts +69 -36
- package/src/utils/wallets.ts +195 -126
- package/dist/components/ConfirmSwapErrors.d.ts +0 -4
- package/dist/components/ConfirmSwapErrors.d.ts.map +0 -1
- package/dist/components/ConfirmSwapWarnings.d.ts +0 -3
- package/dist/components/ConfirmSwapWarnings.d.ts.map +0 -1
- package/dist/components/Layout.d.ts +0 -7
- package/dist/components/Layout.d.ts.map +0 -1
- package/dist/pages/LiquiditySourcesPage.d.ts +0 -7
- package/dist/pages/LiquiditySourcesPage.d.ts.map +0 -1
- package/dist/pages/SelectChainPage.d.ts +0 -8
- package/dist/pages/SelectChainPage.d.ts.map +0 -1
- package/dist/pages/SelectTokenPage.d.ts +0 -15
- package/dist/pages/SelectTokenPage.d.ts.map +0 -1
- package/src/components/ConfirmSwapErrors.tsx +0 -34
- package/src/components/ConfirmSwapWarnings.tsx +0 -22
- package/src/components/Layout.tsx +0 -105
- package/src/pages/LiquiditySourcesPage.tsx +0 -63
- package/src/pages/SelectChainPage.tsx +0 -42
- package/src/pages/SelectTokenPage.tsx +0 -64
package/src/Widget.tsx
CHANGED
|
@@ -1,30 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from 'react';
|
|
1
|
+
import type { WidgetConfig } from './types';
|
|
2
|
+
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
3
|
+
import type { PropsWithChildren } from 'react';
|
|
4
|
+
|
|
5
|
+
import { I18nManager, styled } from '@rango-dev/ui';
|
|
6
|
+
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
7
|
+
|
|
9
8
|
import { AppRouter } from './components/AppRouter';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { AppRoutes } from './components/AppRoutes';
|
|
10
|
+
import { WidgetEvents } from './components/WidgetEvents';
|
|
12
11
|
import { globalFont } from './globalStyles';
|
|
13
12
|
import { useTheme } from './hooks/useTheme';
|
|
14
|
-
import { WidgetConfig } from './types';
|
|
15
13
|
import QueueManager from './QueueManager';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
14
|
+
import { useAppStore } from './store/app';
|
|
15
|
+
import { useNotificationStore } from './store/notification';
|
|
16
|
+
import { useSettingsStore } from './store/settings';
|
|
18
17
|
import { initConfig } from './utils/configs';
|
|
19
18
|
import { WidgetContext, WidgetWallets } from './Wallets';
|
|
20
|
-
import { WidgetEvents } from './components/WidgetEvents';
|
|
21
|
-
import { useSettingsStore } from './store/settings';
|
|
22
19
|
|
|
23
20
|
const MainContainer = styled('div', {
|
|
24
21
|
width: '100%',
|
|
25
22
|
display: 'flex',
|
|
26
23
|
justifyContent: 'center',
|
|
27
24
|
alignItems: 'center',
|
|
25
|
+
fontFamily: '$widget',
|
|
26
|
+
boxSizing: 'border-box',
|
|
27
|
+
'& *, *::before, *::after': {
|
|
28
|
+
boxSizing: 'inherit',
|
|
29
|
+
listStyleType: 'none',
|
|
30
|
+
},
|
|
31
|
+
'& *:focus-visible': {
|
|
32
|
+
outline: '1px $info500 solid',
|
|
33
|
+
transition: 'none',
|
|
34
|
+
},
|
|
28
35
|
});
|
|
29
36
|
|
|
30
37
|
export type WidgetProps = {
|
|
@@ -33,13 +40,12 @@ export type WidgetProps = {
|
|
|
33
40
|
|
|
34
41
|
export function Main(props: PropsWithChildren<WidgetProps>) {
|
|
35
42
|
const { config } = props;
|
|
36
|
-
globalFont(
|
|
43
|
+
globalFont();
|
|
37
44
|
|
|
38
45
|
const { activeTheme } = useTheme(config?.theme || {});
|
|
39
46
|
const [lastConnectedWalletWithNetwork, setLastConnectedWalletWithNetwork] =
|
|
40
47
|
useState<string>('');
|
|
41
48
|
const [disconnectedWallet, setDisconnectedWallet] = useState<WalletType>();
|
|
42
|
-
const currentPage = useUiStore.use.currentPage();
|
|
43
49
|
const widgetContext = useContext(WidgetContext);
|
|
44
50
|
|
|
45
51
|
useMemo(() => {
|
|
@@ -51,7 +57,8 @@ export function Main(props: PropsWithChildren<WidgetProps>) {
|
|
|
51
57
|
}, [config]);
|
|
52
58
|
|
|
53
59
|
useEffect(() => {
|
|
54
|
-
useSettingsStore.persist.rehydrate();
|
|
60
|
+
void useSettingsStore.persist.rehydrate();
|
|
61
|
+
void useNotificationStore.persist.rehydrate();
|
|
55
62
|
widgetContext.onConnectWallet(setLastConnectedWalletWithNetwork);
|
|
56
63
|
}, []);
|
|
57
64
|
|
|
@@ -60,16 +67,15 @@ export function Main(props: PropsWithChildren<WidgetProps>) {
|
|
|
60
67
|
<MainContainer id="swap-container" className={activeTheme}>
|
|
61
68
|
<QueueManager>
|
|
62
69
|
<WidgetEvents />
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
</SwapContainer>
|
|
70
|
+
<AppRouter
|
|
71
|
+
config={config}
|
|
72
|
+
lastConnectedWallet={lastConnectedWalletWithNetwork}
|
|
73
|
+
disconnectedWallet={disconnectedWallet}
|
|
74
|
+
clearDisconnectedWallet={() => {
|
|
75
|
+
setDisconnectedWallet(undefined);
|
|
76
|
+
}}>
|
|
77
|
+
<AppRoutes config={config} />
|
|
78
|
+
</AppRouter>
|
|
73
79
|
</QueueManager>
|
|
74
80
|
</MainContainer>
|
|
75
81
|
</I18nManager>
|
|
@@ -77,12 +83,19 @@ export function Main(props: PropsWithChildren<WidgetProps>) {
|
|
|
77
83
|
}
|
|
78
84
|
|
|
79
85
|
export function Widget(props: PropsWithChildren<WidgetProps>) {
|
|
86
|
+
const { updateConfig, config } = useAppStore();
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (props.config) {
|
|
89
|
+
updateConfig(props.config);
|
|
90
|
+
}
|
|
91
|
+
}, [props.config]);
|
|
92
|
+
|
|
80
93
|
if (!props.config?.externalWallets) {
|
|
81
94
|
return (
|
|
82
95
|
<WidgetWallets
|
|
83
|
-
providers={
|
|
96
|
+
providers={config?.wallets}
|
|
84
97
|
options={{
|
|
85
|
-
walletConnectProjectId:
|
|
98
|
+
walletConnectProjectId: config?.walletConnectProjectId,
|
|
86
99
|
}}>
|
|
87
100
|
<Main {...props} />
|
|
88
101
|
</WidgetWallets>
|
|
@@ -1,11 +1,41 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import type { WidgetConfig } from '../types';
|
|
2
|
+
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
3
|
+
import type { PropsWithChildren } from 'react';
|
|
4
|
+
|
|
3
5
|
import { useQueueManager } from '@rango-dev/queue-manager-rango-preset';
|
|
4
|
-
import { WalletType } from '@rango-dev/wallets-shared';
|
|
5
|
-
import { UpdateUrl } from './UpdateUrl';
|
|
6
|
-
import { useMetaStore } from '../store/meta';
|
|
7
6
|
import { useWallets } from '@rango-dev/wallets-react';
|
|
8
7
|
import { isEvmBlockchain } from 'rango-types';
|
|
8
|
+
import React, { useEffect, useRef } from 'react';
|
|
9
|
+
import { MemoryRouter, useInRouterContext } from 'react-router';
|
|
10
|
+
import { useLocation, useNavigate } from 'react-router-dom';
|
|
11
|
+
|
|
12
|
+
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
13
|
+
import { Home } from '../pages/Home';
|
|
14
|
+
import { useMetaStore } from '../store/meta';
|
|
15
|
+
|
|
16
|
+
import { UpdateUrl } from './UpdateUrl';
|
|
17
|
+
|
|
18
|
+
function Route(props: PropsWithChildren) {
|
|
19
|
+
const location = useLocation();
|
|
20
|
+
const navigate = useNavigate();
|
|
21
|
+
const firstRender = useRef(true);
|
|
22
|
+
const paths = location.pathname.split('/');
|
|
23
|
+
const pathMatched = paths[paths.length - 1] === navigationRoutes.confirmSwap;
|
|
24
|
+
const shouldRedirectToMainPage = pathMatched && firstRender.current;
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (shouldRedirectToMainPage) {
|
|
28
|
+
navigate('.');
|
|
29
|
+
}
|
|
30
|
+
firstRender.current = false;
|
|
31
|
+
}, []);
|
|
32
|
+
|
|
33
|
+
if (shouldRedirectToMainPage) {
|
|
34
|
+
return <Home />;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return <> {props.children}</>;
|
|
38
|
+
}
|
|
9
39
|
|
|
10
40
|
export function AppRouter({
|
|
11
41
|
children,
|
|
@@ -14,9 +44,10 @@ export function AppRouter({
|
|
|
14
44
|
lastConnectedWallet: string;
|
|
15
45
|
disconnectedWallet: WalletType | undefined;
|
|
16
46
|
clearDisconnectedWallet: () => void;
|
|
47
|
+
config: WidgetConfig | undefined;
|
|
17
48
|
}) {
|
|
18
49
|
const isRouterInContext = useInRouterContext();
|
|
19
|
-
const Router = isRouterInContext ?
|
|
50
|
+
const Router = isRouterInContext ? Route : MemoryRouter;
|
|
20
51
|
const { blockchains } = useMetaStore.use.meta();
|
|
21
52
|
const { canSwitchNetworkTo } = useWallets();
|
|
22
53
|
|
|
@@ -33,7 +64,7 @@ export function AppRouter({
|
|
|
33
64
|
return (
|
|
34
65
|
<>
|
|
35
66
|
<Router>{children}</Router>
|
|
36
|
-
{isRouterInContext && <UpdateUrl />}
|
|
67
|
+
{isRouterInContext && <UpdateUrl config={props.config} />}
|
|
37
68
|
</>
|
|
38
69
|
);
|
|
39
70
|
}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
+
import type { WidgetConfig } from '../types';
|
|
2
|
+
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import { useRoutes } from 'react-router-dom';
|
|
5
|
+
|
|
3
6
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
4
7
|
import { ConfirmSwapPage } from '../pages/ConfirmSwapPage';
|
|
5
8
|
import { HistoryPage } from '../pages/HistoryPage';
|
|
6
9
|
import { Home } from '../pages/Home';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
+
import { LanguagePage } from '../pages/LanguagePage';
|
|
11
|
+
import { LiquiditySourcePage } from '../pages/LiquiditySourcePage';
|
|
12
|
+
import { SelectBlockchainPage } from '../pages/SelectBlockchainPage';
|
|
13
|
+
import { SelectSwapItemsPage } from '../pages/SelectSwapItemsPage';
|
|
10
14
|
import { SettingsPage } from '../pages/SettingsPage';
|
|
11
|
-
import { WalletsPage } from '../pages/WalletsPage';
|
|
12
15
|
import { SwapDetailsPage } from '../pages/SwapDetailsPage';
|
|
13
|
-
import {
|
|
16
|
+
import { ThemePage } from '../pages/ThemePage';
|
|
17
|
+
import { WalletsPage } from '../pages/WalletsPage';
|
|
14
18
|
|
|
15
19
|
const getAbsolutePath = (path: string) => path.replace('/', '');
|
|
16
20
|
|
|
@@ -27,31 +31,20 @@ export function AppRoutes(props: PropTypes) {
|
|
|
27
31
|
element: <Home />,
|
|
28
32
|
},
|
|
29
33
|
{
|
|
30
|
-
path: navigationRoutes.
|
|
31
|
-
element:
|
|
32
|
-
<SelectChainPage
|
|
33
|
-
type="from"
|
|
34
|
-
supportedChains={config?.from?.blockchains}
|
|
35
|
-
/>
|
|
36
|
-
),
|
|
34
|
+
path: navigationRoutes.fromSwap,
|
|
35
|
+
element: <SelectSwapItemsPage type="source" />,
|
|
37
36
|
},
|
|
38
37
|
{
|
|
39
|
-
path: navigationRoutes.
|
|
40
|
-
element:
|
|
41
|
-
<SelectChainPage type="to" supportedChains={config?.to?.blockchains} />
|
|
42
|
-
),
|
|
38
|
+
path: navigationRoutes.toSwap,
|
|
39
|
+
element: <SelectSwapItemsPage type="destination" />,
|
|
43
40
|
},
|
|
44
41
|
{
|
|
45
|
-
path: navigationRoutes.
|
|
46
|
-
element:
|
|
47
|
-
<SelectTokenPage type="from" supportedTokens={config?.from?.tokens} />
|
|
48
|
-
),
|
|
42
|
+
path: navigationRoutes.fromBlockchain,
|
|
43
|
+
element: <SelectBlockchainPage type="source" />,
|
|
49
44
|
},
|
|
50
45
|
{
|
|
51
|
-
path: navigationRoutes.
|
|
52
|
-
element:
|
|
53
|
-
<SelectTokenPage type="to" supportedTokens={config?.to?.tokens} />
|
|
54
|
-
),
|
|
46
|
+
path: navigationRoutes.toBlockchain,
|
|
47
|
+
element: <SelectBlockchainPage type="destination" />,
|
|
55
48
|
},
|
|
56
49
|
{
|
|
57
50
|
path: navigationRoutes.settings,
|
|
@@ -63,9 +56,29 @@ export function AppRoutes(props: PropTypes) {
|
|
|
63
56
|
),
|
|
64
57
|
},
|
|
65
58
|
{
|
|
66
|
-
path: navigationRoutes.
|
|
59
|
+
path: navigationRoutes.themes,
|
|
60
|
+
element: <ThemePage />,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
path: navigationRoutes.languages,
|
|
64
|
+
element: <LanguagePage />,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
path: navigationRoutes.exchanges,
|
|
67
68
|
element: (
|
|
68
|
-
<LiquiditySourcePage
|
|
69
|
+
<LiquiditySourcePage
|
|
70
|
+
sourceType="Exchanges"
|
|
71
|
+
supportedSwappers={config?.liquiditySources}
|
|
72
|
+
/>
|
|
73
|
+
),
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
path: navigationRoutes.bridges,
|
|
77
|
+
element: (
|
|
78
|
+
<LiquiditySourcePage
|
|
79
|
+
sourceType="Bridges"
|
|
80
|
+
supportedSwappers={config?.liquiditySources}
|
|
81
|
+
/>
|
|
69
82
|
),
|
|
70
83
|
},
|
|
71
84
|
{ path: navigationRoutes.swaps, element: <HistoryPage /> },
|
|
@@ -89,9 +102,7 @@ export function AppRoutes(props: PropTypes) {
|
|
|
89
102
|
},
|
|
90
103
|
{
|
|
91
104
|
path: getAbsolutePath(navigationRoutes.confirmSwap),
|
|
92
|
-
element:
|
|
93
|
-
<ConfirmSwapPage customDestinationEnabled={config?.customDestination} />
|
|
94
|
-
),
|
|
105
|
+
element: <ConfirmSwapPage config={config} />,
|
|
95
106
|
},
|
|
96
107
|
]);
|
|
97
108
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BlockchainCategories } from '@rango-dev/ui';
|
|
2
|
+
import { type BlockchainMeta, TransactionType } from 'rango-sdk';
|
|
3
|
+
|
|
4
|
+
import { containsText } from '../../utils/common';
|
|
5
|
+
|
|
6
|
+
export const filterByType = (
|
|
7
|
+
blockchain: BlockchainMeta,
|
|
8
|
+
type: string
|
|
9
|
+
): boolean => {
|
|
10
|
+
switch (type) {
|
|
11
|
+
case BlockchainCategories.ALL:
|
|
12
|
+
return true;
|
|
13
|
+
case BlockchainCategories.UTXO:
|
|
14
|
+
return blockchain.type === TransactionType.TRANSFER;
|
|
15
|
+
case BlockchainCategories.OTHER:
|
|
16
|
+
return (
|
|
17
|
+
blockchain.type !== TransactionType.TRANSFER &&
|
|
18
|
+
blockchain.type !== TransactionType.COSMOS &&
|
|
19
|
+
blockchain.type !== TransactionType.EVM
|
|
20
|
+
);
|
|
21
|
+
default:
|
|
22
|
+
return blockchain.type === type;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const filterBlockchains = (
|
|
27
|
+
list: BlockchainMeta[],
|
|
28
|
+
searchedFor: string,
|
|
29
|
+
blockchainType: string
|
|
30
|
+
) =>
|
|
31
|
+
list
|
|
32
|
+
.filter((blockchain) => filterByType(blockchain, blockchainType))
|
|
33
|
+
.filter(
|
|
34
|
+
(blockchain) =>
|
|
35
|
+
containsText(blockchain.name, searchedFor) ||
|
|
36
|
+
containsText(blockchain.displayName, searchedFor)
|
|
37
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { styled } from '@rango-dev/ui';
|
|
2
|
+
|
|
3
|
+
export const Container = styled('div', {
|
|
4
|
+
display: 'flex',
|
|
5
|
+
flexDirection: 'column',
|
|
6
|
+
overflow: 'hidden',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const List = styled('ul', {
|
|
10
|
+
padding: 0,
|
|
11
|
+
margin: 0,
|
|
12
|
+
listStyle: 'none',
|
|
13
|
+
overflowY: 'auto',
|
|
14
|
+
paddingRight: '$5',
|
|
15
|
+
'.image-container': {
|
|
16
|
+
borderRadius: '$xm',
|
|
17
|
+
overflow: 'hidden',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { PropTypes } from './BlockchainList.types';
|
|
2
|
+
import type { BlockchainMeta } from 'rango-sdk';
|
|
3
|
+
|
|
4
|
+
import { i18n } from '@lingui/core';
|
|
5
|
+
import {
|
|
6
|
+
Divider,
|
|
7
|
+
Image,
|
|
8
|
+
ListItemButton,
|
|
9
|
+
NotFound,
|
|
10
|
+
Typography,
|
|
11
|
+
} from '@rango-dev/ui';
|
|
12
|
+
import React, { useEffect, useState } from 'react';
|
|
13
|
+
|
|
14
|
+
import { useMetaStore } from '../../store/meta';
|
|
15
|
+
|
|
16
|
+
import { filterBlockchains } from './BlockchainList.helpers';
|
|
17
|
+
import { Container, List } from './BlockchainList.styles';
|
|
18
|
+
import { LoadingBlockchainList } from './LoadingBlockchainList';
|
|
19
|
+
|
|
20
|
+
export function BlockchainList(props: PropTypes) {
|
|
21
|
+
const { list, searchedFor, onChange, blockchainCategory } = props;
|
|
22
|
+
const [blockchains, setBlockchains] = useState<BlockchainMeta[]>(list);
|
|
23
|
+
const loadingStatus = useMetaStore.use.loadingStatus();
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setBlockchains([
|
|
27
|
+
...filterBlockchains(list, searchedFor, blockchainCategory),
|
|
28
|
+
]);
|
|
29
|
+
}, [list, searchedFor, blockchainCategory]);
|
|
30
|
+
|
|
31
|
+
const renderList = () => {
|
|
32
|
+
if (!blockchains.length && !!searchedFor) {
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
<Divider size={32} />
|
|
36
|
+
<NotFound
|
|
37
|
+
title={i18n.t('No results found')}
|
|
38
|
+
description={i18n.t('Try using different keywords')}
|
|
39
|
+
/>
|
|
40
|
+
</>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return (
|
|
44
|
+
<List key={`${blockchainCategory}-${searchedFor}`}>
|
|
45
|
+
{blockchains.map((item) => (
|
|
46
|
+
<ListItemButton
|
|
47
|
+
key={`${item.name}-${item.chainId}`}
|
|
48
|
+
hasDivider
|
|
49
|
+
onClick={() => onChange(item)}
|
|
50
|
+
start={<Image src={item.logo} size={30} />}
|
|
51
|
+
title={
|
|
52
|
+
<Typography variant="title" size="medium">
|
|
53
|
+
{item.displayName}
|
|
54
|
+
</Typography>
|
|
55
|
+
}
|
|
56
|
+
id={item.chainId as string}
|
|
57
|
+
/>
|
|
58
|
+
))}
|
|
59
|
+
</List>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<Container>
|
|
65
|
+
<Typography variant="label" size="large">
|
|
66
|
+
{i18n.t('Select Blockchain')}
|
|
67
|
+
</Typography>
|
|
68
|
+
<Divider size={4} />
|
|
69
|
+
{loadingStatus === 'loading' && <LoadingBlockchainList />}
|
|
70
|
+
{loadingStatus === 'success' && renderList()}
|
|
71
|
+
</Container>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ListItem, Skeleton } from '@rango-dev/ui';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { List } from './BlockchainList.styles';
|
|
5
|
+
|
|
6
|
+
const ITEM_SKELETON_COUNT = 20;
|
|
7
|
+
export function LoadingBlockchainList() {
|
|
8
|
+
return (
|
|
9
|
+
<List>
|
|
10
|
+
{Array.from(Array(ITEM_SKELETON_COUNT), (e) => (
|
|
11
|
+
<ListItem
|
|
12
|
+
key={e}
|
|
13
|
+
hasDivider
|
|
14
|
+
start={<Skeleton variant="circular" width={35} height={35} />}
|
|
15
|
+
title={<Skeleton variant="text" size="large" width={90} />}
|
|
16
|
+
/>
|
|
17
|
+
))}
|
|
18
|
+
</List>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BlockchainList } from './BlockchainList';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
+
import type { PropTypes } from './BlockchainsSection.types';
|
|
3
|
+
|
|
4
|
+
import { i18n } from '@lingui/core';
|
|
5
|
+
import {
|
|
6
|
+
BlockchainsChip,
|
|
7
|
+
Divider,
|
|
8
|
+
Image,
|
|
9
|
+
Skeleton,
|
|
10
|
+
Typography,
|
|
11
|
+
} from '@rango-dev/ui';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
|
|
14
|
+
import { usePrepareBlockchainList } from '../../hooks/usePrepareBlockchainList';
|
|
15
|
+
import { useBestRouteStore } from '../../store/bestRoute';
|
|
16
|
+
import { useMetaStore } from '../../store/meta';
|
|
17
|
+
|
|
18
|
+
import { Container } from './BlockchainsSection.styles';
|
|
19
|
+
|
|
20
|
+
const LIST_SIZE = 10;
|
|
21
|
+
const NUMBER_OF_LOADING = 12;
|
|
22
|
+
|
|
23
|
+
export function BlockchainsSection(props: PropTypes) {
|
|
24
|
+
const { blockchains, type, blockchain, onChange, onMoreClick } = props;
|
|
25
|
+
const blockchainsList = usePrepareBlockchainList(blockchains, {
|
|
26
|
+
limit: LIST_SIZE,
|
|
27
|
+
selected: blockchain?.name,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const loadingStatus = useMetaStore.use.loadingStatus();
|
|
31
|
+
const resetToBlockchain = useBestRouteStore.use.resetToBlockchain();
|
|
32
|
+
const resetFromBlockchain = useBestRouteStore.use.resetFromBlockchain();
|
|
33
|
+
return (
|
|
34
|
+
<div>
|
|
35
|
+
<Divider size={12} />
|
|
36
|
+
<Typography variant="label" size="large">
|
|
37
|
+
{i18n.t('Select Blockchain')}
|
|
38
|
+
</Typography>
|
|
39
|
+
<Divider size={12} />
|
|
40
|
+
<Container>
|
|
41
|
+
{loadingStatus === 'loading' &&
|
|
42
|
+
Array.from(Array(NUMBER_OF_LOADING), (e) => (
|
|
43
|
+
<Skeleton key={e} variant="rounded" height={50} />
|
|
44
|
+
))}
|
|
45
|
+
{loadingStatus === 'success' && (
|
|
46
|
+
<>
|
|
47
|
+
<BlockchainsChip
|
|
48
|
+
selected={!blockchain}
|
|
49
|
+
onClick={() => {
|
|
50
|
+
if (type === 'from') {
|
|
51
|
+
resetFromBlockchain();
|
|
52
|
+
} else {
|
|
53
|
+
resetToBlockchain();
|
|
54
|
+
}
|
|
55
|
+
}}>
|
|
56
|
+
<Typography variant="body" size="xsmall" color="secondary500">
|
|
57
|
+
{i18n.t('All')}
|
|
58
|
+
</Typography>
|
|
59
|
+
</BlockchainsChip>
|
|
60
|
+
{blockchainsList.list.map((item) => (
|
|
61
|
+
<BlockchainsChip
|
|
62
|
+
key={item.chainId}
|
|
63
|
+
selected={!!blockchain && blockchain.chainId === item.chainId}
|
|
64
|
+
onClick={() => onChange(item)}>
|
|
65
|
+
<Image src={item.logo} size={30} />
|
|
66
|
+
</BlockchainsChip>
|
|
67
|
+
))}
|
|
68
|
+
|
|
69
|
+
{blockchainsList.more.length ? (
|
|
70
|
+
<BlockchainsChip onClick={onMoreClick}>
|
|
71
|
+
<Typography variant="body" size="xsmall" color="secondary500">
|
|
72
|
+
{i18n._('More +{count}', {
|
|
73
|
+
count: blockchainsList.more.length,
|
|
74
|
+
})}
|
|
75
|
+
</Typography>
|
|
76
|
+
</BlockchainsChip>
|
|
77
|
+
) : null}
|
|
78
|
+
</>
|
|
79
|
+
)}
|
|
80
|
+
</Container>
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BlockchainsSection } from './BlockchainsSection';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
+
import type { Step } from '@rango-dev/ui/dist/widget/ui/src/components/BestRoute/BestRoute.types';
|
|
3
|
+
import type { BestRouteResponse, BlockchainMeta } from 'rango-sdk';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
7
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
8
|
+
USD_VALUE_MAX_DECIMALS,
|
|
9
|
+
USD_VALUE_MIN_DECIMALS,
|
|
10
|
+
} from '../../constants/routing';
|
|
11
|
+
import { numberToString } from '../../utils/numbers';
|
|
12
|
+
|
|
13
|
+
export function formatBestRoute(
|
|
14
|
+
bestRoute: BestRouteResponse
|
|
15
|
+
): Step[] | undefined {
|
|
16
|
+
return bestRoute.result?.swaps.map((swap) => {
|
|
17
|
+
return {
|
|
18
|
+
swapper: { displayName: swap.swapperId, image: swap.swapperLogo },
|
|
19
|
+
from: {
|
|
20
|
+
token: { displayName: swap.from.symbol, image: swap.from.logo },
|
|
21
|
+
chain: {
|
|
22
|
+
displayName: swap.from.blockchain,
|
|
23
|
+
image: swap.from.blockchainLogo,
|
|
24
|
+
},
|
|
25
|
+
price: {
|
|
26
|
+
value: numberToString(
|
|
27
|
+
swap.fromAmount,
|
|
28
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
29
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
30
|
+
),
|
|
31
|
+
usdValue: numberToString(
|
|
32
|
+
swap.from.usdPrice?.toString(),
|
|
33
|
+
USD_VALUE_MIN_DECIMALS,
|
|
34
|
+
USD_VALUE_MAX_DECIMALS
|
|
35
|
+
),
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
to: {
|
|
39
|
+
token: { displayName: swap.to.symbol, image: swap.to.logo },
|
|
40
|
+
chain: {
|
|
41
|
+
displayName: swap.to.blockchain,
|
|
42
|
+
image: swap.to.blockchainLogo,
|
|
43
|
+
},
|
|
44
|
+
price: {
|
|
45
|
+
value: numberToString(
|
|
46
|
+
swap.toAmount,
|
|
47
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
48
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
49
|
+
),
|
|
50
|
+
usdValue: numberToString(
|
|
51
|
+
swap.to.usdPrice?.toString(),
|
|
52
|
+
USD_VALUE_MIN_DECIMALS,
|
|
53
|
+
USD_VALUE_MAX_DECIMALS
|
|
54
|
+
),
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function getRequiredWallets(route: BestRouteResponse | null): string[] {
|
|
62
|
+
const wallets: string[] = [];
|
|
63
|
+
|
|
64
|
+
route?.result?.swaps.forEach((swap) => {
|
|
65
|
+
const currentStepFromBlockchain = swap.from.blockchain;
|
|
66
|
+
const currentStepToBlockchain = swap.to.blockchain;
|
|
67
|
+
let lastAddedWallet = wallets[wallets.length - 1];
|
|
68
|
+
if (currentStepFromBlockchain != lastAddedWallet) {
|
|
69
|
+
wallets.push(currentStepFromBlockchain);
|
|
70
|
+
}
|
|
71
|
+
lastAddedWallet = wallets[wallets.length - 1];
|
|
72
|
+
if (currentStepToBlockchain != lastAddedWallet) {
|
|
73
|
+
wallets.push(currentStepToBlockchain);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
return wallets;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function isValidAddress(
|
|
80
|
+
chain: BlockchainMeta,
|
|
81
|
+
address: string
|
|
82
|
+
): boolean {
|
|
83
|
+
const regex = chain.addressPatterns;
|
|
84
|
+
const valid = regex.filter((r) => new RegExp(r).test(address)).length > 0;
|
|
85
|
+
return valid;
|
|
86
|
+
}
|