@rango-dev/widget-embedded 0.12.1-next.7 → 0.12.1-next.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Wallets.d.ts +4 -3
- package/dist/Wallets.d.ts.map +1 -1
- package/dist/Widget.d.ts +3 -2
- package/dist/Widget.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts +1 -1
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.d.ts +4 -0
- package/dist/components/BlockchainList/BlockchainList.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts +4 -0
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts +297 -0
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.types.d.ts +8 -0
- package/dist/components/BlockchainList/BlockchainList.types.d.ts.map +1 -0
- package/dist/components/BlockchainList/LoadingBlockchainList.d.ts +3 -0
- package/dist/components/BlockchainList/LoadingBlockchainList.d.ts.map +1 -0
- package/dist/components/BlockchainList/index.d.ts +2 -0
- package/dist/components/BlockchainList/index.d.ts.map +1 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.d.ts +5 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.d.ts.map +1 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts +151 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts.map +1 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts +6 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts.map +1 -0
- package/dist/components/BlockchainsChip/index.d.ts +2 -0
- package/dist/components/BlockchainsChip/index.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts +3 -0
- package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.d.ts +4 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +149 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.types.d.ts +9 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.types.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/index.d.ts +2 -0
- package/dist/components/BlockchainsSection/index.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +6 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +2522 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts +4 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +11 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts +4 -0
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +445 -0
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -0
- package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +12 -0
- package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -0
- package/dist/components/HeaderButtons/BackButton.d.ts +5 -0
- package/dist/components/HeaderButtons/BackButton.d.ts.map +1 -0
- package/dist/components/HeaderButtons/CancelButton.d.ts +5 -0
- package/dist/components/HeaderButtons/CancelButton.d.ts.map +1 -0
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +875 -0
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -0
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +12 -0
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -0
- package/dist/components/HeaderButtons/HomeButtons.d.ts +4 -0
- package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -0
- package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts +3 -0
- package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts.map +1 -0
- package/dist/components/HeaderButtons/WalletButton.d.ts +5 -0
- package/dist/components/HeaderButtons/WalletButton.d.ts.map +1 -0
- package/dist/components/HeaderButtons/index.d.ts +5 -0
- package/dist/components/HeaderButtons/index.d.ts.map +1 -0
- package/dist/components/Layout/Layout.d.ts +7 -0
- package/dist/components/Layout/Layout.d.ts.map +1 -0
- package/dist/components/Layout/Layout.styles.d.ts +449 -0
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -0
- package/dist/components/Layout/Layout.types.d.ts +17 -0
- package/dist/components/Layout/Layout.types.d.ts.map +1 -0
- package/dist/components/Layout/index.d.ts +2 -0
- package/dist/components/Layout/index.d.ts.map +1 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.d.ts +3 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.d.ts.map +1 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +150 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -0
- package/dist/components/LoadingLiquiditySourceList/index.d.ts +2 -0
- package/dist/components/LoadingLiquiditySourceList/index.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.d.ts +4 -0
- package/dist/components/NoRoutes/NoRoutes.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts +3 -0
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.styles.d.ts +445 -0
- package/dist/components/NoRoutes/NoRoutes.styles.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.types.d.ts +20 -0
- package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +1 -0
- package/dist/components/NoRoutes/index.d.ts +2 -0
- package/dist/components/NoRoutes/index.d.ts.map +1 -0
- package/dist/components/NotificationContent/NotificationContent.d.ts +3 -0
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -0
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts +593 -0
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -0
- package/dist/components/NotificationContent/NotificationNotFound.d.ts +3 -0
- package/dist/components/NotificationContent/NotificationNotFound.d.ts.map +1 -0
- package/dist/components/NotificationContent/index.d.ts +2 -0
- package/dist/components/NotificationContent/index.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrors.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts +593 -0
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrors.types.d.ts +22 -0
- package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +1 -0
- package/dist/components/RouteErrors/index.d.ts +2 -0
- package/dist/components/RouteErrors/index.d.ts.map +1 -0
- package/dist/components/SearchInput/SearchInput.d.ts +4 -0
- package/dist/components/SearchInput/SearchInput.d.ts.map +1 -0
- package/dist/components/SearchInput/SearchInput.styles.d.ts +149 -0
- package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -0
- package/dist/components/SearchInput/SearchInput.types.d.ts +10 -0
- package/dist/components/SearchInput/SearchInput.types.d.ts.map +1 -0
- package/dist/components/SearchInput/index.d.ts +2 -0
- package/dist/components/SearchInput/index.d.ts.map +1 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts +4 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts.map +1 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts +4 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts.map +1 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts +445 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts.map +1 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts +12 -0
- package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts.map +1 -0
- package/dist/components/SelectableCategoryList/index.d.ts +2 -0
- package/dist/components/SelectableCategoryList/index.d.ts.map +1 -0
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +741 -0
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -0
- package/dist/components/SettingsContainer/index.d.ts +2 -0
- package/dist/components/SettingsContainer/index.d.ts.map +1 -0
- package/dist/components/Slippage/Slippage.d.ts +3 -0
- package/dist/components/Slippage/Slippage.d.ts.map +1 -0
- package/dist/components/Slippage/Slippage.styles.d.ts +593 -0
- package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -0
- package/dist/components/Slippage/SlippageTooltipContent.d.ts +3 -0
- package/dist/components/Slippage/SlippageTooltipContent.d.ts.map +1 -0
- package/dist/components/Slippage/index.d.ts +2 -0
- package/dist/components/Slippage/index.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts +4 -0
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.d.ts +4 -0
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +15 -0
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +1037 -0
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.types.d.ts +12 -0
- package/dist/components/SwapDetails/SwapDetails.types.d.ts.map +1 -0
- package/dist/components/SwapDetails/index.d.ts +2 -0
- package/dist/components/SwapDetails/index.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.d.ts +4 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.d.ts +4 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts +4 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +149 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +20 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/index.d.ts +3 -0
- package/dist/components/SwapDetailsAlerts/index.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Cancel.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Cancel.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Delete.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Delete.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +149 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +45 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/index.d.ts +4 -0
- package/dist/components/SwapDetailsModal/index.d.ts.map +1 -0
- package/dist/components/SwapsGroup/SwapsGroup.d.ts +4 -0
- package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -0
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +593 -0
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -0
- package/dist/components/SwapsGroup/SwapsGroup.types.d.ts +12 -0
- package/dist/components/SwapsGroup/SwapsGroup.types.d.ts.map +1 -0
- package/dist/components/SwapsGroup/index.d.ts +2 -0
- package/dist/components/SwapsGroup/index.d.ts.map +1 -0
- package/dist/components/SwitchFromAndTo.d.ts +1 -1
- package/dist/components/SwitchFromAndTo.d.ts.map +1 -1
- package/dist/components/TokenList/LoadingTokenList.d.ts +4 -0
- package/dist/components/TokenList/LoadingTokenList.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.d.ts +4 -0
- package/dist/components/TokenList/TokenList.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.helpers.d.ts +3 -0
- package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.styles.d.ts +1334 -0
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.types.d.ts +40 -0
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -0
- package/dist/components/TokenList/index.d.ts +3 -0
- package/dist/components/TokenList/index.d.ts.map +1 -0
- package/dist/components/UpdateUrl.d.ts.map +1 -1
- package/dist/components/WalletModal/WalletModal.d.ts +4 -0
- package/dist/components/WalletModal/WalletModal.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModal.types.d.ts +10 -0
- package/dist/components/WalletModal/WalletModal.types.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModalContent.d.ts +4 -0
- package/dist/components/WalletModal/WalletModalContent.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts +593 -0
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -0
- package/dist/components/WalletModal/index.d.ts +2 -0
- package/dist/components/WalletModal/index.d.ts.map +1 -0
- package/dist/components/WidgetEvents.d.ts.map +1 -1
- package/dist/constants/errors.d.ts +29 -0
- package/dist/constants/errors.d.ts.map +1 -1
- package/dist/constants/messages.d.ts +7 -0
- package/dist/constants/messages.d.ts.map +1 -0
- package/dist/constants/navigationRoutes.d.ts +8 -4
- package/dist/constants/navigationRoutes.d.ts.map +1 -1
- package/dist/constants/routing.d.ts +3 -0
- package/dist/constants/routing.d.ts.map +1 -0
- package/dist/constants/searchParams.d.ts +2 -2
- package/dist/constants/searchParams.d.ts.map +1 -1
- package/dist/constants/swapSettings.d.ts.map +1 -1
- package/dist/constants/wallets.d.ts +3 -0
- package/dist/constants/wallets.d.ts.map +1 -0
- package/dist/constants/warnings.d.ts +3 -0
- package/dist/constants/warnings.d.ts.map +1 -0
- package/dist/hooks/useConfirmSwap.d.ts +14 -6
- package/dist/hooks/useConfirmSwap.d.ts.map +1 -1
- package/dist/hooks/useFetchBestRoute.d.ts +9 -0
- package/dist/hooks/useFetchBestRoute.d.ts.map +1 -0
- package/dist/hooks/useNavigateBack.d.ts.map +1 -1
- package/dist/hooks/useSwapInput.d.ts +12 -0
- package/dist/hooks/useSwapInput.d.ts.map +1 -0
- package/dist/hooks/useTheme.d.ts +3 -26
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts +20 -0
- package/dist/hooks/useWalletList.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts +6 -3
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/HistoryPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/LanguagePage.d.ts +3 -0
- package/dist/pages/LanguagePage.d.ts.map +1 -0
- package/dist/pages/LiquiditySourcePage.d.ts +8 -0
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -0
- package/dist/pages/SelectBlockchainPage.d.ts +8 -0
- package/dist/pages/SelectBlockchainPage.d.ts.map +1 -0
- package/dist/pages/SelectSwapItemsPage.d.ts +11 -0
- package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -0
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
- package/dist/pages/ThemePage.d.ts +3 -0
- package/dist/pages/ThemePage.d.ts.map +1 -0
- package/dist/pages/WalletsPage.d.ts +4 -2
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/bestRoute.d.ts +32 -19
- package/dist/store/bestRoute.d.ts.map +1 -1
- package/dist/store/meta.d.ts +10 -3
- package/dist/store/meta.d.ts.map +1 -1
- package/dist/store/notification.d.ts +38 -0
- package/dist/store/notification.d.ts.map +1 -0
- package/dist/store/settings.d.ts +2 -2
- package/dist/store/settings.d.ts.map +1 -1
- package/dist/store/ui.d.ts +0 -2
- package/dist/store/ui.d.ts.map +1 -1
- package/dist/store/wallets.d.ts +14 -12
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +8 -6
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/notification.d.ts +22 -0
- package/dist/types/notification.d.ts.map +1 -0
- package/dist/types/routing.d.ts +30 -23
- package/dist/types/routing.d.ts.map +1 -1
- package/dist/types/swap.d.ts +8 -1
- package/dist/types/swap.d.ts.map +1 -1
- package/dist/utils/common.d.ts +5 -0
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/date.d.ts +1 -1
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +3 -0
- package/dist/utils/meta.d.ts.map +1 -0
- package/dist/utils/numbers.d.ts +2 -1
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/routing.d.ts +5 -5
- package/dist/utils/routing.d.ts.map +1 -1
- package/dist/utils/settings.d.ts +10 -0
- package/dist/utils/settings.d.ts.map +1 -0
- package/dist/utils/swap.d.ts +28 -13
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +20 -14
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +7 -7
- package/readme.md +1 -1
- package/src/Wallets.tsx +23 -17
- package/src/Widget.tsx +21 -27
- package/src/components/AppRoutes.tsx +54 -19
- package/src/components/BlockchainList/BlockchainList.helpers.ts +37 -0
- package/src/components/BlockchainList/BlockchainList.styles.ts +18 -0
- package/src/components/BlockchainList/BlockchainList.tsx +76 -0
- package/src/components/BlockchainList/BlockchainList.types.ts +8 -0
- package/src/components/BlockchainList/LoadingBlockchainList.tsx +20 -0
- package/src/components/BlockchainList/index.ts +1 -0
- package/src/components/BlockchainsChip/BlockchainsChip.styles.ts +30 -0
- package/src/components/BlockchainsChip/BlockchainsChip.tsx +15 -0
- package/src/components/BlockchainsChip/BlockchainsChip.types.ts +4 -0
- package/src/components/BlockchainsChip/index.ts +1 -0
- package/src/components/BlockchainsSection/BlockchainSection.helpers.ts +20 -0
- package/src/components/BlockchainsSection/BlockchainsSection.styles.ts +7 -0
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +100 -0
- package/src/components/BlockchainsSection/BlockchainsSection.types.ts +9 -0
- package/src/components/BlockchainsSection/index.ts +1 -0
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +64 -0
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +169 -0
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +451 -0
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +11 -0
- package/src/components/ConfirmWalletsModal/WalletList.styles.ts +34 -0
- package/src/components/ConfirmWalletsModal/WalletList.tsx +250 -0
- package/src/components/ConfirmWalletsModal/WalletList.type.ts +12 -0
- package/src/components/HeaderButtons/BackButton.tsx +16 -0
- package/src/components/HeaderButtons/CancelButton.tsx +21 -0
- package/src/components/HeaderButtons/HeaderButtons.styles.ts +40 -0
- package/src/components/HeaderButtons/HeaderButtons.types.ts +11 -0
- package/src/components/HeaderButtons/HomeButtons.tsx +68 -0
- package/src/components/HeaderButtons/UnreadNotificationsBadge.tsx +21 -0
- package/src/components/HeaderButtons/WalletButton.tsx +20 -0
- package/src/components/HeaderButtons/index.ts +4 -0
- package/src/components/Layout/Layout.styles.ts +51 -0
- package/src/components/Layout/Layout.tsx +89 -0
- package/src/components/Layout/Layout.types.ts +20 -0
- package/src/components/Layout/index.ts +1 -0
- package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.ts +5 -0
- package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.tsx +23 -0
- package/src/components/LoadingLiquiditySourceList/index.ts +1 -0
- package/src/components/NoRoutes/NoRoutes.helper.ts +50 -0
- package/src/components/NoRoutes/NoRoutes.styles.ts +15 -0
- package/src/components/NoRoutes/NoRoutes.tsx +81 -0
- package/src/components/NoRoutes/NoRoutes.types.ts +21 -0
- package/src/components/NoRoutes/index.ts +1 -0
- package/src/components/NotificationContent/NotificationContent.styles.ts +34 -0
- package/src/components/NotificationContent/NotificationContent.tsx +112 -0
- package/src/components/NotificationContent/NotificationNotFound.tsx +17 -0
- package/src/components/NotificationContent/index.ts +1 -0
- package/src/components/RouteErrors/RouteErrors.styles.ts +27 -0
- package/src/components/RouteErrors/RouteErrors.tsx +68 -0
- package/src/components/RouteErrors/RouteErrors.types.ts +27 -0
- package/src/components/RouteErrors/RouteErrorsModal.tsx +101 -0
- package/src/components/RouteErrors/RouteErrorsModalItem.tsx +24 -0
- package/src/components/RouteErrors/index.ts +1 -0
- package/src/components/SearchInput/SearchInput.styles.ts +9 -0
- package/src/components/SearchInput/SearchInput.tsx +51 -0
- package/src/components/SearchInput/SearchInput.types.ts +10 -0
- package/src/components/SearchInput/index.ts +1 -0
- package/src/components/SelectableCategoryList/SelectableCategoryList.helpers.ts +20 -0
- package/src/components/SelectableCategoryList/SelectableCategoryList.styles.ts +21 -0
- package/src/components/SelectableCategoryList/SelectableCategoryList.tsx +79 -0
- package/src/components/SelectableCategoryList/SelectableCategoryList.types.ts +12 -0
- package/src/components/SelectableCategoryList/index.ts +1 -0
- package/src/components/SettingsContainer/SettingsContainer.style.ts +33 -0
- package/src/components/SettingsContainer/index.ts +7 -0
- package/src/components/Slippage/Slippage.styles.ts +24 -0
- package/src/components/Slippage/Slippage.tsx +90 -0
- package/src/components/Slippage/SlippageTooltipContent.tsx +23 -0
- package/src/components/Slippage/index.ts +1 -0
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +43 -0
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +102 -0
- package/src/components/SwapDetails/SwapDetails.styles.ts +76 -0
- package/src/components/SwapDetails/SwapDetails.tsx +387 -0
- package/src/components/SwapDetails/SwapDetails.types.ts +12 -0
- package/src/components/SwapDetails/index.ts +1 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.tsx +36 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.tsx +55 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.ts +7 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.tsx +74 -0
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +28 -0
- package/src/components/SwapDetailsAlerts/index.ts +2 -0
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +101 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +34 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.Delete.tsx +34 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +35 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.helpers.tsx +22 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.styles.ts +6 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +42 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +53 -0
- package/src/components/SwapDetailsModal/index.ts +3 -0
- package/src/components/SwapsGroup/SwapsGroup.styles.ts +26 -0
- package/src/components/SwapsGroup/SwapsGroup.tsx +125 -0
- package/src/components/SwapsGroup/SwapsGroup.types.ts +13 -0
- package/src/components/SwapsGroup/index.ts +1 -0
- package/src/components/SwitchFromAndTo.tsx +24 -8
- package/src/components/TokenList/LoadingTokenList.tsx +34 -0
- package/src/components/TokenList/TokenList.helpers.ts +13 -0
- package/src/components/TokenList/TokenList.styles.ts +115 -0
- package/src/components/TokenList/TokenList.tsx +269 -0
- package/src/components/TokenList/TokenList.types.ts +47 -0
- package/src/components/TokenList/index.ts +2 -0
- package/src/components/UpdateUrl.tsx +40 -22
- package/src/components/WalletModal/WalletModal.tsx +20 -0
- package/src/components/WalletModal/WalletModal.types.ts +11 -0
- package/src/components/WalletModal/WalletModalContent.styles.ts +44 -0
- package/src/components/WalletModal/WalletModalContent.tsx +54 -0
- package/src/components/WalletModal/index.ts +1 -0
- package/src/components/WidgetEvents.tsx +30 -4
- package/src/constants/errors.ts +56 -1
- package/src/constants/messages.ts +8 -0
- package/src/constants/navigationRoutes.ts +8 -4
- package/src/constants/routing.ts +2 -0
- package/src/constants/searchParams.ts +2 -2
- package/src/constants/swapSettings.ts +5 -1
- package/src/constants/wallets.ts +3 -0
- package/src/constants/warnings.ts +26 -0
- package/src/hooks/useConfirmSwap.ts +251 -220
- package/src/hooks/useFetchBestRoute.ts +38 -0
- package/src/hooks/useNavigateBack.ts +15 -9
- package/src/hooks/useSwapInput.ts +102 -0
- package/src/hooks/useTheme.ts +59 -60
- package/src/hooks/useWalletList.ts +125 -0
- package/src/pages/ConfirmSwapPage.tsx +470 -228
- package/src/pages/HistoryPage.tsx +104 -15
- package/src/pages/Home.tsx +345 -111
- package/src/pages/LanguagePage.tsx +83 -0
- package/src/pages/LiquiditySourcePage.tsx +160 -0
- package/src/pages/SelectBlockchainPage.tsx +77 -0
- package/src/pages/SelectSwapItemsPage.tsx +153 -0
- package/src/pages/SettingsPage.tsx +144 -72
- package/src/pages/SwapDetailsPage.tsx +35 -143
- package/src/pages/ThemePage.tsx +96 -0
- package/src/pages/WalletsPage.tsx +73 -124
- package/src/store/bestRoute.ts +85 -180
- package/src/store/meta.ts +23 -3
- package/src/store/notification.ts +77 -0
- package/src/store/settings.ts +20 -13
- package/src/store/ui.ts +1 -5
- package/src/store/wallets.ts +92 -76
- package/src/types/config.ts +9 -7
- package/src/types/notification.ts +33 -0
- package/src/types/routing.ts +29 -28
- package/src/types/swap.ts +9 -1
- package/src/utils/common.ts +53 -3
- package/src/utils/date.ts +15 -18
- package/src/utils/meta.ts +9 -0
- package/src/utils/numbers.ts +63 -18
- package/src/utils/routing.ts +30 -14
- package/src/utils/settings.ts +57 -0
- package/src/utils/swap.ts +166 -95
- package/src/utils/wallets.ts +159 -110
- package/dist/components/ConfirmSwapErrors.d.ts +0 -4
- package/dist/components/ConfirmSwapErrors.d.ts.map +0 -1
- package/dist/components/ConfirmSwapWarnings.d.ts +0 -3
- package/dist/components/ConfirmSwapWarnings.d.ts.map +0 -1
- package/dist/components/Layout.d.ts +0 -7
- package/dist/components/Layout.d.ts.map +0 -1
- package/dist/pages/LiquiditySourcesPage.d.ts +0 -7
- package/dist/pages/LiquiditySourcesPage.d.ts.map +0 -1
- package/dist/pages/SelectChainPage.d.ts +0 -8
- package/dist/pages/SelectChainPage.d.ts.map +0 -1
- package/dist/pages/SelectTokenPage.d.ts +0 -15
- package/dist/pages/SelectTokenPage.d.ts.map +0 -1
- package/src/components/ConfirmSwapErrors.tsx +0 -34
- package/src/components/ConfirmSwapWarnings.tsx +0 -22
- package/src/components/Layout.tsx +0 -105
- package/src/pages/LiquiditySourcesPage.tsx +0 -63
- package/src/pages/SelectChainPage.tsx +0 -42
- package/src/pages/SelectTokenPage.tsx +0 -64
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { i18n } from '@lingui/core';
|
|
2
|
+
import {
|
|
3
|
+
List,
|
|
4
|
+
ListItemButton,
|
|
5
|
+
Radio,
|
|
6
|
+
RadioRoot,
|
|
7
|
+
Typography,
|
|
8
|
+
} from '@rango-dev/ui';
|
|
9
|
+
import React, { useState } from 'react';
|
|
10
|
+
|
|
11
|
+
import { Layout } from '../components/Layout';
|
|
12
|
+
import { SettingsContainer } from '../components/SettingsContainer';
|
|
13
|
+
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
14
|
+
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
15
|
+
|
|
16
|
+
enum Languages {
|
|
17
|
+
ENGLISH = 'english',
|
|
18
|
+
FRENCH = 'french',
|
|
19
|
+
SPANISH = 'spanish',
|
|
20
|
+
}
|
|
21
|
+
export function LanguagePage() {
|
|
22
|
+
const { navigateBackFrom } = useNavigateBack();
|
|
23
|
+
const [language, setLanguage] = useState(Languages.ENGLISH);
|
|
24
|
+
|
|
25
|
+
const languageList = [
|
|
26
|
+
{
|
|
27
|
+
id: Languages.ENGLISH,
|
|
28
|
+
value: Languages.ENGLISH,
|
|
29
|
+
title: (
|
|
30
|
+
<Typography variant="title" size="xmedium">
|
|
31
|
+
{i18n.t('English')}
|
|
32
|
+
</Typography>
|
|
33
|
+
),
|
|
34
|
+
onClick: () => setLanguage(Languages.ENGLISH),
|
|
35
|
+
end: <Radio value={Languages.ENGLISH} />,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: Languages.FRENCH,
|
|
39
|
+
value: Languages.FRENCH,
|
|
40
|
+
title: (
|
|
41
|
+
<Typography variant="title" size="xmedium">
|
|
42
|
+
{i18n.t('French')}
|
|
43
|
+
</Typography>
|
|
44
|
+
),
|
|
45
|
+
onClick: () => setLanguage(Languages.FRENCH),
|
|
46
|
+
end: <Radio value={Languages.FRENCH} />,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: Languages.SPANISH,
|
|
50
|
+
value: Languages.SPANISH,
|
|
51
|
+
title: (
|
|
52
|
+
<Typography variant="title" size="xmedium">
|
|
53
|
+
{i18n.t('Spanish')}
|
|
54
|
+
</Typography>
|
|
55
|
+
),
|
|
56
|
+
onClick: () => setLanguage(Languages.SPANISH),
|
|
57
|
+
end: <Radio value={Languages.SPANISH} />,
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Layout
|
|
63
|
+
header={{
|
|
64
|
+
onBack: navigateBackFrom.bind(null, navigationRoutes.settings),
|
|
65
|
+
title: i18n.t('Language'),
|
|
66
|
+
}}>
|
|
67
|
+
<SettingsContainer>
|
|
68
|
+
<RadioRoot value={language}>
|
|
69
|
+
<List
|
|
70
|
+
type={
|
|
71
|
+
<ListItemButton
|
|
72
|
+
title="language"
|
|
73
|
+
id="_"
|
|
74
|
+
onClick={() => console.log()}
|
|
75
|
+
/>
|
|
76
|
+
}
|
|
77
|
+
items={languageList}
|
|
78
|
+
/>
|
|
79
|
+
</RadioRoot>
|
|
80
|
+
</SettingsContainer>
|
|
81
|
+
</Layout>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
LiquiditySourceType,
|
|
3
|
+
UniqueSwappersGroupType,
|
|
4
|
+
} from '../utils/settings';
|
|
5
|
+
|
|
6
|
+
import { i18n } from '@lingui/core';
|
|
7
|
+
import {
|
|
8
|
+
Button,
|
|
9
|
+
Checkbox,
|
|
10
|
+
Image,
|
|
11
|
+
ListItemButton,
|
|
12
|
+
NotFound,
|
|
13
|
+
Typography,
|
|
14
|
+
} from '@rango-dev/ui';
|
|
15
|
+
import React, { useState } from 'react';
|
|
16
|
+
|
|
17
|
+
import { Layout } from '../components/Layout';
|
|
18
|
+
import { LoadingLiquiditySourceList } from '../components/LoadingLiquiditySourceList';
|
|
19
|
+
import { SearchInput } from '../components/SearchInput';
|
|
20
|
+
import {
|
|
21
|
+
LiquiditySourceDivider,
|
|
22
|
+
LiquiditySourceList,
|
|
23
|
+
LiquiditySourceSuffix,
|
|
24
|
+
NotFoundContainer,
|
|
25
|
+
SettingsContainer,
|
|
26
|
+
} from '../components/SettingsContainer';
|
|
27
|
+
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
28
|
+
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
29
|
+
import { useMetaStore } from '../store/meta';
|
|
30
|
+
import { useSettingsStore } from '../store/settings';
|
|
31
|
+
import { containsText } from '../utils/numbers';
|
|
32
|
+
import { getUniqueSwappersGroups } from '../utils/settings';
|
|
33
|
+
|
|
34
|
+
interface PropTypes {
|
|
35
|
+
supportedSwappers?: string[];
|
|
36
|
+
sourceType: 'Exchanges' | 'Bridges';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function LiquiditySourcePage({
|
|
40
|
+
supportedSwappers,
|
|
41
|
+
sourceType,
|
|
42
|
+
}: PropTypes) {
|
|
43
|
+
const [searchedFor, setSearchedFor] = useState<string>('');
|
|
44
|
+
const toggleLiquiditySource = useSettingsStore.use.toggleLiquiditySource();
|
|
45
|
+
const { navigateBackFrom } = useNavigateBack();
|
|
46
|
+
const loadingMetaStatus = useMetaStore.use.loadingStatus();
|
|
47
|
+
|
|
48
|
+
const supportedUniqueSwappersGroups: Array<UniqueSwappersGroupType> =
|
|
49
|
+
getUniqueSwappersGroups(supportedSwappers);
|
|
50
|
+
|
|
51
|
+
const validTypes: Array<LiquiditySourceType> = [];
|
|
52
|
+
if (sourceType === 'Exchanges') {
|
|
53
|
+
validTypes.push('DEX');
|
|
54
|
+
}
|
|
55
|
+
if (sourceType === 'Bridges') {
|
|
56
|
+
validTypes.push('BRIDGE');
|
|
57
|
+
validTypes.push('AGGREGATOR');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const liquiditySources = supportedUniqueSwappersGroups.filter((uniqueItem) =>
|
|
61
|
+
validTypes.includes(uniqueItem.type)
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const hasSelectAll =
|
|
65
|
+
liquiditySources.length ===
|
|
66
|
+
liquiditySources.filter((sourceItem) => sourceItem.selected).length;
|
|
67
|
+
|
|
68
|
+
const toggleAllSources = () => {
|
|
69
|
+
liquiditySources.forEach((sourceItem) => {
|
|
70
|
+
if (hasSelectAll) {
|
|
71
|
+
toggleLiquiditySource(sourceItem.groupTitle);
|
|
72
|
+
} else {
|
|
73
|
+
if (!sourceItem.selected) {
|
|
74
|
+
toggleLiquiditySource(sourceItem.groupTitle);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const list = liquiditySources.map((sourceItem) => {
|
|
81
|
+
const { selected, groupTitle, logo } = sourceItem;
|
|
82
|
+
return {
|
|
83
|
+
start: <Image src={logo} size={22} type="circular" />,
|
|
84
|
+
onClick: () => toggleLiquiditySource(groupTitle),
|
|
85
|
+
end: <Checkbox checked={selected} />,
|
|
86
|
+
title: (
|
|
87
|
+
<Typography variant="title" size="xmedium">
|
|
88
|
+
{i18n.t(groupTitle)}
|
|
89
|
+
</Typography>
|
|
90
|
+
),
|
|
91
|
+
...sourceItem,
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const searchHandler = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
96
|
+
const value = event.target.value;
|
|
97
|
+
setSearchedFor(value);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
let filteredList = list;
|
|
101
|
+
if (searchedFor) {
|
|
102
|
+
filteredList = list.filter((sourceItem) =>
|
|
103
|
+
containsText(sourceItem.groupTitle, searchedFor)
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<Layout
|
|
109
|
+
header={{
|
|
110
|
+
onBack: navigateBackFrom.bind(null, navigationRoutes.settings),
|
|
111
|
+
title: i18n.t(sourceType),
|
|
112
|
+
suffix: (
|
|
113
|
+
<LiquiditySourceSuffix>
|
|
114
|
+
<Button variant="ghost" size="xsmall" onClick={toggleAllSources}>
|
|
115
|
+
{i18n.t(hasSelectAll ? 'Deselect all' : 'Select all')}
|
|
116
|
+
</Button>
|
|
117
|
+
</LiquiditySourceSuffix>
|
|
118
|
+
),
|
|
119
|
+
}}>
|
|
120
|
+
<SettingsContainer>
|
|
121
|
+
<SearchInput
|
|
122
|
+
value={searchedFor}
|
|
123
|
+
setValue={setSearchedFor}
|
|
124
|
+
fullWidth
|
|
125
|
+
color="light"
|
|
126
|
+
variant="contained"
|
|
127
|
+
placeholder={i18n.t('Swap {sourceType}', { sourceType })}
|
|
128
|
+
onChange={searchHandler}
|
|
129
|
+
/>
|
|
130
|
+
{loadingMetaStatus === 'loading' && <LoadingLiquiditySourceList />}
|
|
131
|
+
|
|
132
|
+
{!filteredList.length && !!searchedFor ? (
|
|
133
|
+
<NotFoundContainer>
|
|
134
|
+
<NotFound
|
|
135
|
+
title={i18n.t('No results found')}
|
|
136
|
+
description={i18n.t('Try using different keywords')}
|
|
137
|
+
/>
|
|
138
|
+
</NotFoundContainer>
|
|
139
|
+
) : (
|
|
140
|
+
loadingMetaStatus === 'success' && (
|
|
141
|
+
<LiquiditySourceList>
|
|
142
|
+
{filteredList.map((sourceItem) => {
|
|
143
|
+
return (
|
|
144
|
+
<React.Fragment key={sourceItem.id}>
|
|
145
|
+
<ListItemButton
|
|
146
|
+
style={{ height: '61px' }}
|
|
147
|
+
{...sourceItem}
|
|
148
|
+
selected={false}
|
|
149
|
+
/>
|
|
150
|
+
<LiquiditySourceDivider />
|
|
151
|
+
</React.Fragment>
|
|
152
|
+
);
|
|
153
|
+
})}
|
|
154
|
+
</LiquiditySourceList>
|
|
155
|
+
)
|
|
156
|
+
)}
|
|
157
|
+
</SettingsContainer>
|
|
158
|
+
</Layout>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { i18n } from '@lingui/core';
|
|
2
|
+
import { Divider } from '@rango-dev/ui';
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import { BlockchainList } from '../components/BlockchainList';
|
|
6
|
+
import { Layout } from '../components/Layout';
|
|
7
|
+
import { SearchInput } from '../components/SearchInput';
|
|
8
|
+
import { SelectableCategoryList } from '../components/SelectableCategoryList';
|
|
9
|
+
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
10
|
+
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
11
|
+
import { useBestRouteStore } from '../store/bestRoute';
|
|
12
|
+
import { useMetaStore } from '../store/meta';
|
|
13
|
+
|
|
14
|
+
interface PropTypes {
|
|
15
|
+
type: 'from' | 'to';
|
|
16
|
+
supportedBlockchains?: string[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function SelectBlockchainPage(props: PropTypes) {
|
|
20
|
+
const { type, supportedBlockchains } = props;
|
|
21
|
+
const { navigateBackFrom } = useNavigateBack();
|
|
22
|
+
const [searchedFor, setSearchedFor] = useState<string>('');
|
|
23
|
+
const [blockchainCategory, setBlockchainCategory] = useState<string>('ALL');
|
|
24
|
+
const setToBlockchain = useBestRouteStore.use.setToBlockchain();
|
|
25
|
+
const setFromBlockchain = useBestRouteStore.use.setFromBlockchain();
|
|
26
|
+
|
|
27
|
+
const blockchains = supportedBlockchains
|
|
28
|
+
? useMetaStore.use
|
|
29
|
+
.meta()
|
|
30
|
+
.blockchains.filter((chain) =>
|
|
31
|
+
supportedBlockchains.includes(chain.name)
|
|
32
|
+
)
|
|
33
|
+
: useMetaStore.use.meta().blockchains;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Layout
|
|
37
|
+
header={{
|
|
38
|
+
onBack: navigateBackFrom.bind(
|
|
39
|
+
null,
|
|
40
|
+
navigationRoutes[`${type}Blockchain`]
|
|
41
|
+
),
|
|
42
|
+
title: i18n.t(`Select Blockchain`),
|
|
43
|
+
}}>
|
|
44
|
+
<Divider size={12} />
|
|
45
|
+
<SelectableCategoryList
|
|
46
|
+
setCategory={setBlockchainCategory}
|
|
47
|
+
category={blockchainCategory}
|
|
48
|
+
/>
|
|
49
|
+
<Divider size={24} />
|
|
50
|
+
<SearchInput
|
|
51
|
+
value={searchedFor}
|
|
52
|
+
autoFocus
|
|
53
|
+
placeholder={i18n.t('Search Blockchain')}
|
|
54
|
+
color="light"
|
|
55
|
+
variant="contained"
|
|
56
|
+
size="large"
|
|
57
|
+
setValue={() => setSearchedFor('')}
|
|
58
|
+
onChange={(event) => setSearchedFor(event.target.value)}
|
|
59
|
+
/>
|
|
60
|
+
<Divider size={16} />
|
|
61
|
+
|
|
62
|
+
<BlockchainList
|
|
63
|
+
list={blockchains}
|
|
64
|
+
searchedFor={searchedFor}
|
|
65
|
+
blockchainCategory={blockchainCategory}
|
|
66
|
+
onChange={(blockchain) => {
|
|
67
|
+
if (type === 'from') {
|
|
68
|
+
setFromBlockchain(blockchain, true);
|
|
69
|
+
} else {
|
|
70
|
+
setToBlockchain(blockchain, true);
|
|
71
|
+
}
|
|
72
|
+
navigateBackFrom(navigationRoutes[`${type}Blockchain`]);
|
|
73
|
+
}}
|
|
74
|
+
/>
|
|
75
|
+
</Layout>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
+
import type { Asset } from 'rango-sdk';
|
|
3
|
+
|
|
4
|
+
import { i18n } from '@lingui/core';
|
|
5
|
+
import { Divider } from '@rango-dev/ui';
|
|
6
|
+
import React, { useEffect, useState } from 'react';
|
|
7
|
+
import { useNavigate } from 'react-router-dom';
|
|
8
|
+
|
|
9
|
+
import { BlockchainsSection } from '../components/BlockchainsSection';
|
|
10
|
+
import { Layout } from '../components/Layout';
|
|
11
|
+
import { SearchInput } from '../components/SearchInput';
|
|
12
|
+
import { TokenList } from '../components/TokenList/TokenList';
|
|
13
|
+
import { filterTokens } from '../components/TokenList/TokenList.helpers';
|
|
14
|
+
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
15
|
+
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
16
|
+
import { useBestRouteStore } from '../store/bestRoute';
|
|
17
|
+
import { useMetaStore } from '../store/meta';
|
|
18
|
+
import { useWalletsStore } from '../store/wallets';
|
|
19
|
+
import { tokensAreEqual } from '../utils/wallets';
|
|
20
|
+
|
|
21
|
+
interface PropTypes {
|
|
22
|
+
type: 'from' | 'to';
|
|
23
|
+
supportedBlockchains?: string[];
|
|
24
|
+
supportedTokens?: Asset[];
|
|
25
|
+
pinnedTokens?: Asset[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function SelectSwapItemsPage(props: PropTypes) {
|
|
29
|
+
const { type, supportedBlockchains, supportedTokens, pinnedTokens } = props;
|
|
30
|
+
const navigate = useNavigate();
|
|
31
|
+
const { navigateBackFrom } = useNavigateBack();
|
|
32
|
+
const { tokens } = useMetaStore.use.meta();
|
|
33
|
+
const sourceTokens = useBestRouteStore.use.sourceTokens();
|
|
34
|
+
const destinationTokens = useBestRouteStore.use.destinationTokens();
|
|
35
|
+
const [searchedFor, setSearchedFor] = useState<string>('');
|
|
36
|
+
const setFromToken = useBestRouteStore.use.setFromToken();
|
|
37
|
+
const setToToken = useBestRouteStore.use.setToToken();
|
|
38
|
+
const setToBlockchain = useBestRouteStore.use.setToBlockchain();
|
|
39
|
+
const setFromBlockchain = useBestRouteStore.use.setFromBlockchain();
|
|
40
|
+
const toBlockchain = useBestRouteStore.use.toBlockchain();
|
|
41
|
+
const fromBlockchain = useBestRouteStore.use.fromBlockchain();
|
|
42
|
+
const connectedWallets = useWalletsStore.use.connectedWallets();
|
|
43
|
+
const loadingWallet = useWalletsStore.use.loading();
|
|
44
|
+
const setTokensWithBalance = useMetaStore.use.setTokensWithBalance();
|
|
45
|
+
|
|
46
|
+
const blockchains = supportedBlockchains
|
|
47
|
+
? useMetaStore.use
|
|
48
|
+
.meta()
|
|
49
|
+
.blockchains.filter((chain) =>
|
|
50
|
+
supportedBlockchains.includes(chain.name)
|
|
51
|
+
)
|
|
52
|
+
: useMetaStore.use.meta().blockchains;
|
|
53
|
+
const allTokens = supportedTokens
|
|
54
|
+
? tokens.filter((token) =>
|
|
55
|
+
tokens.some((supportedToken) => tokensAreEqual(supportedToken, token))
|
|
56
|
+
)
|
|
57
|
+
: tokens;
|
|
58
|
+
const supportedSourceTokens = supportedTokens
|
|
59
|
+
? sourceTokens.filter((token) =>
|
|
60
|
+
supportedTokens.some((supportedToken) =>
|
|
61
|
+
tokensAreEqual(supportedToken, token)
|
|
62
|
+
)
|
|
63
|
+
)
|
|
64
|
+
: sourceTokens;
|
|
65
|
+
|
|
66
|
+
const supportedDestinationTokens = supportedTokens
|
|
67
|
+
? destinationTokens.filter((token) =>
|
|
68
|
+
supportedTokens.some((supportedToken) =>
|
|
69
|
+
tokensAreEqual(supportedToken, token)
|
|
70
|
+
)
|
|
71
|
+
)
|
|
72
|
+
: destinationTokens;
|
|
73
|
+
|
|
74
|
+
const tokensByType =
|
|
75
|
+
type === 'from' ? supportedSourceTokens : supportedDestinationTokens;
|
|
76
|
+
|
|
77
|
+
const tokenList = (tokensByType.length ? tokensByType : allTokens).map(
|
|
78
|
+
(token) => ({
|
|
79
|
+
...token,
|
|
80
|
+
pin: pinnedTokens?.some((pinnedToken) =>
|
|
81
|
+
tokensAreEqual(pinnedToken, token)
|
|
82
|
+
),
|
|
83
|
+
})
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (connectedWallets.length && !loadingWallet) {
|
|
88
|
+
setTokensWithBalance();
|
|
89
|
+
}
|
|
90
|
+
}, [connectedWallets, loadingWallet]);
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<Layout
|
|
94
|
+
header={{
|
|
95
|
+
onBack: navigateBackFrom.bind(null, navigationRoutes.home),
|
|
96
|
+
title: i18n.t('Swap {type}', { type }),
|
|
97
|
+
}}>
|
|
98
|
+
<BlockchainsSection
|
|
99
|
+
blockchains={blockchains}
|
|
100
|
+
type={type}
|
|
101
|
+
blockchain={type === 'from' ? fromBlockchain : toBlockchain}
|
|
102
|
+
onMoreClick={() =>
|
|
103
|
+
navigate(
|
|
104
|
+
type === 'from'
|
|
105
|
+
? navigationRoutes.fromBlockchain
|
|
106
|
+
: navigationRoutes.toBlockchain
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
onChange={(blockchain) => {
|
|
110
|
+
{
|
|
111
|
+
if (type === 'from') {
|
|
112
|
+
setFromBlockchain(blockchain, true);
|
|
113
|
+
} else {
|
|
114
|
+
setToBlockchain(blockchain, true);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}}
|
|
118
|
+
/>
|
|
119
|
+
<Divider size={24} />
|
|
120
|
+
<SearchInput
|
|
121
|
+
value={searchedFor}
|
|
122
|
+
autoFocus
|
|
123
|
+
placeholder={i18n.t('Search Token')}
|
|
124
|
+
color="light"
|
|
125
|
+
variant="contained"
|
|
126
|
+
size="large"
|
|
127
|
+
setValue={() => setSearchedFor('')}
|
|
128
|
+
onChange={(event) => setSearchedFor(event.target.value)}
|
|
129
|
+
/>
|
|
130
|
+
<Divider size={16} />
|
|
131
|
+
<TokenList
|
|
132
|
+
list={filterTokens(tokenList, searchedFor)}
|
|
133
|
+
onChange={(token) => {
|
|
134
|
+
const blockchain = blockchains.find(
|
|
135
|
+
(chain) => token.blockchain === chain.name
|
|
136
|
+
);
|
|
137
|
+
if (type === 'from') {
|
|
138
|
+
setFromToken(token);
|
|
139
|
+
if (!!blockchain) {
|
|
140
|
+
setFromBlockchain(blockchain, true);
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
setToToken(token);
|
|
144
|
+
if (!!blockchain) {
|
|
145
|
+
setToBlockchain(blockchain, true);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
navigateBackFrom(navigationRoutes.fromSwap);
|
|
149
|
+
}}
|
|
150
|
+
/>
|
|
151
|
+
</Layout>
|
|
152
|
+
);
|
|
153
|
+
}
|