@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/store/bestRoute.ts
CHANGED
|
@@ -1,28 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { TokenWithBalance } from '../components/TokenList';
|
|
2
|
+
import type { Wallet } from '../types';
|
|
3
|
+
import type { PendingSwap } from '@rango-dev/queue-manager-rango-preset/dist/shared';
|
|
4
|
+
import type { BestRouteResponse, BlockchainMeta, Token } from 'rango-sdk';
|
|
5
|
+
|
|
4
6
|
import BigNumber from 'bignumber.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
getBestRouteToTokenUsdPrice,
|
|
8
|
-
isRouteParametersChanged,
|
|
9
|
-
} from '../utils/routing';
|
|
10
|
-
import createSelectors from './selectors';
|
|
7
|
+
import { create } from 'zustand';
|
|
11
8
|
import { subscribeWithSelector } from 'zustand/middleware';
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
import { calcOutputUsdValue, createBestRouteRequestBody } from '../utils/swap';
|
|
15
|
-
import { useMetaStore } from './meta';
|
|
16
|
-
import {
|
|
17
|
-
getDefaultToken,
|
|
18
|
-
getSortedTokens,
|
|
19
|
-
tokensAreEqual,
|
|
20
|
-
} from '../utils/wallets';
|
|
21
|
-
import { useWalletsStore } from './wallets';
|
|
22
|
-
import { TokenWithBalance } from '../pages/SelectTokenPage';
|
|
23
|
-
import { PendingSwap } from '@rango-dev/queue-manager-rango-preset/dist/shared';
|
|
24
|
-
import { debounce } from '../utils/common';
|
|
9
|
+
|
|
10
|
+
import { ZERO } from '../constants/numbers';
|
|
25
11
|
import { isPositiveNumber } from '../utils/numbers';
|
|
12
|
+
import { getBestRouteToTokenUsdPrice } from '../utils/routing';
|
|
13
|
+
import { calcOutputUsdValue } from '../utils/swap';
|
|
14
|
+
import { tokensAreEqual } from '../utils/wallets';
|
|
15
|
+
|
|
16
|
+
import { useMetaStore } from './meta';
|
|
17
|
+
import createSelectors from './selectors';
|
|
26
18
|
|
|
27
19
|
const getUsdValue = (token: Token | null, amount: string): BigNumber | null =>
|
|
28
20
|
token?.usdPrice
|
|
@@ -30,54 +22,58 @@ const getUsdValue = (token: Token | null, amount: string): BigNumber | null =>
|
|
|
30
22
|
: null;
|
|
31
23
|
|
|
32
24
|
export interface RouteState {
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
fromBlockchain: BlockchainMeta | null;
|
|
26
|
+
toBlockchain: BlockchainMeta | null;
|
|
35
27
|
inputAmount: string;
|
|
36
28
|
inputUsdValue: BigNumber | null;
|
|
37
29
|
outputAmount: BigNumber | null;
|
|
38
30
|
outputUsdValue: BigNumber | null;
|
|
39
31
|
fromToken: TokenWithBalance | null;
|
|
40
32
|
toToken: TokenWithBalance | null;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
sourceTokens: Token[];
|
|
44
|
-
destinationTokens: Token[];
|
|
33
|
+
routeWalletsConfirmed: boolean;
|
|
34
|
+
selectedWallets: Wallet[];
|
|
45
35
|
resetRoute: () => void;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
) => void;
|
|
50
|
-
|
|
36
|
+
resetToBlockchain: () => void;
|
|
37
|
+
resetFromBlockchain: () => void;
|
|
38
|
+
setFromBlockchain: (chain: BlockchainMeta | null) => void;
|
|
39
|
+
setToBlockchain: (chian: BlockchainMeta | null) => void;
|
|
40
|
+
|
|
51
41
|
setFromToken: (token: Token | null) => void;
|
|
52
42
|
setToToken: (token: Token | null) => void;
|
|
53
43
|
setInputAmount: (amount: string) => void;
|
|
54
44
|
bestRoute: BestRouteResponse | null;
|
|
55
|
-
|
|
45
|
+
setRoute: (bestRoute: BestRouteResponse | null) => void;
|
|
56
46
|
retry: (pendingSwap: PendingSwap) => void;
|
|
57
47
|
switchFromAndTo: () => void;
|
|
48
|
+
setRouteWalletConfirmed: (flag: boolean) => void;
|
|
49
|
+
setSelectedWallets: (wallets: Wallet[]) => void;
|
|
50
|
+
customDestination: string;
|
|
51
|
+
setCustomDestination: (address: string) => void;
|
|
52
|
+
resetRouteWallets: () => void;
|
|
58
53
|
}
|
|
59
54
|
|
|
60
55
|
export const useBestRouteStore = createSelectors(
|
|
61
56
|
create<RouteState>()(
|
|
62
57
|
subscribeWithSelector((set) => ({
|
|
63
|
-
|
|
58
|
+
fromBlockchain: null,
|
|
64
59
|
fromToken: null,
|
|
65
60
|
inputAmount: '',
|
|
66
61
|
outputAmount: null,
|
|
67
62
|
inputUsdValue: new BigNumber(0),
|
|
68
63
|
outputUsdValue: new BigNumber(0),
|
|
69
|
-
|
|
64
|
+
toBlockchain: null,
|
|
70
65
|
toToken: null,
|
|
71
66
|
bestRoute: null,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
setBestRoute: (bestRoute) =>
|
|
67
|
+
routeWalletsConfirmed: false,
|
|
68
|
+
selectedWallets: [],
|
|
69
|
+
customDestination: '',
|
|
70
|
+
setRoute: (bestRoute) =>
|
|
77
71
|
set((state) => {
|
|
78
72
|
let outputAmount: BigNumber | null = null;
|
|
79
73
|
let outputUsdValue: BigNumber = ZERO;
|
|
80
|
-
if (!isPositiveNumber(state.inputAmount))
|
|
74
|
+
if (!isPositiveNumber(state.inputAmount)) {
|
|
75
|
+
return {};
|
|
76
|
+
}
|
|
81
77
|
if (!!bestRoute) {
|
|
82
78
|
outputAmount = !!bestRoute.result?.outputAmount
|
|
83
79
|
? new BigNumber(bestRoute.result?.outputAmount)
|
|
@@ -97,68 +93,69 @@ export const useBestRouteStore = createSelectors(
|
|
|
97
93
|
}),
|
|
98
94
|
resetRoute: () =>
|
|
99
95
|
set(() => ({
|
|
100
|
-
loading: true,
|
|
101
|
-
error: '',
|
|
102
96
|
bestRoute: null,
|
|
103
97
|
outputAmount: null,
|
|
104
98
|
outputUsdValue: new BigNumber(0),
|
|
105
99
|
})),
|
|
106
|
-
|
|
100
|
+
setFromBlockchain: (chain) => {
|
|
107
101
|
set((state) => {
|
|
108
|
-
if (state.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
chain,
|
|
113
|
-
tokens,
|
|
114
|
-
connectedWallets,
|
|
115
|
-
state.destinationTokens
|
|
116
|
-
);
|
|
117
|
-
const fromToken = getDefaultToken(sortedTokens, state.toToken);
|
|
102
|
+
if (state.fromBlockchain?.name === chain?.name) {
|
|
103
|
+
return {};
|
|
104
|
+
}
|
|
105
|
+
|
|
118
106
|
return {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
fromToken,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
inputUsdValue: getUsdValue(fromToken, state.inputAmount),
|
|
107
|
+
fromBlockchain: chain,
|
|
108
|
+
...(state.fromToken && {
|
|
109
|
+
bestRoute: null,
|
|
110
|
+
fromToken: null,
|
|
111
|
+
outputAmount: null,
|
|
112
|
+
outputUsdValue: null,
|
|
126
113
|
}),
|
|
127
114
|
};
|
|
128
115
|
});
|
|
129
116
|
},
|
|
130
|
-
setFromToken: (token) =>
|
|
131
|
-
|
|
117
|
+
setFromToken: (token) => {
|
|
118
|
+
const { blockchains } = useMetaStore.getState().meta;
|
|
119
|
+
const fromBlockchain =
|
|
120
|
+
blockchains.find(
|
|
121
|
+
(blockchain) => blockchain.name === token?.blockchain
|
|
122
|
+
) ?? null;
|
|
123
|
+
return set((state) => ({
|
|
132
124
|
fromToken: token,
|
|
125
|
+
fromBlockchain,
|
|
133
126
|
...(!!state.inputAmount && {
|
|
134
127
|
inputUsdValue: getUsdValue(token, state.inputAmount),
|
|
135
128
|
}),
|
|
136
|
-
}))
|
|
137
|
-
|
|
129
|
+
}));
|
|
130
|
+
},
|
|
131
|
+
setToBlockchain: (chain) => {
|
|
138
132
|
set((state) => {
|
|
139
|
-
if (state.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const sortedTokens = getSortedTokens(
|
|
143
|
-
chain,
|
|
144
|
-
tokens,
|
|
145
|
-
connectedWallets,
|
|
146
|
-
state.destinationTokens
|
|
147
|
-
);
|
|
133
|
+
if (state.toBlockchain?.name === chain?.name) {
|
|
134
|
+
return {};
|
|
135
|
+
}
|
|
148
136
|
|
|
149
137
|
return {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
toToken:
|
|
138
|
+
toBlockchain: chain,
|
|
139
|
+
...(state.toToken && {
|
|
140
|
+
bestRoute: null,
|
|
141
|
+
toToken: null,
|
|
142
|
+
outputAmount: null,
|
|
143
|
+
outputUsdValue: null,
|
|
154
144
|
}),
|
|
155
145
|
};
|
|
156
146
|
});
|
|
157
147
|
},
|
|
158
|
-
setToToken: (token) =>
|
|
159
|
-
|
|
148
|
+
setToToken: (token) => {
|
|
149
|
+
const { blockchains } = useMetaStore.getState().meta;
|
|
150
|
+
const toBlockchain =
|
|
151
|
+
blockchains.find(
|
|
152
|
+
(blockchain) => blockchain.name === token?.blockchain
|
|
153
|
+
) ?? null;
|
|
154
|
+
return set(() => ({
|
|
160
155
|
toToken: token,
|
|
161
|
-
|
|
156
|
+
toBlockchain,
|
|
157
|
+
}));
|
|
158
|
+
},
|
|
162
159
|
setInputAmount: (amount) => {
|
|
163
160
|
set((state) => ({
|
|
164
161
|
inputAmount: amount,
|
|
@@ -166,7 +163,6 @@ export const useBestRouteStore = createSelectors(
|
|
|
166
163
|
outputAmount: new BigNumber(0),
|
|
167
164
|
outputUsdValue: new BigNumber(0),
|
|
168
165
|
bestRoute: null,
|
|
169
|
-
error: '',
|
|
170
166
|
}),
|
|
171
167
|
...(!!state.fromToken && {
|
|
172
168
|
inputUsdValue: getUsdValue(state.fromToken, amount),
|
|
@@ -175,21 +171,22 @@ export const useBestRouteStore = createSelectors(
|
|
|
175
171
|
},
|
|
176
172
|
retry: (pendingSwap) => {
|
|
177
173
|
const { tokens, blockchains } = useMetaStore.getState().meta;
|
|
178
|
-
const connectedWallets = useWalletsStore.getState().connectedWallets;
|
|
179
174
|
const failedIndex =
|
|
180
175
|
pendingSwap.status === 'failed'
|
|
181
176
|
? pendingSwap.steps.findIndex((s) => s.status === 'failed')
|
|
182
177
|
: null;
|
|
183
178
|
|
|
184
|
-
if (failedIndex === null || failedIndex < 0)
|
|
179
|
+
if (failedIndex === null || failedIndex < 0) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
185
182
|
|
|
186
183
|
const firstStep = pendingSwap.steps[0];
|
|
187
184
|
const lastStep = pendingSwap.steps[pendingSwap.steps.length - 1];
|
|
188
|
-
const
|
|
185
|
+
const fromBlockchain =
|
|
189
186
|
blockchains.find(
|
|
190
187
|
(blockchain) => blockchain.name === firstStep.fromBlockchain
|
|
191
188
|
) || null;
|
|
192
|
-
const
|
|
189
|
+
const toBlockchain =
|
|
193
190
|
blockchains.find(
|
|
194
191
|
(blockchain) => blockchain.name === lastStep.toBlockchain
|
|
195
192
|
) || null;
|
|
@@ -209,179 +206,61 @@ export const useBestRouteStore = createSelectors(
|
|
|
209
206
|
address: lastStep.toSymbolAddress,
|
|
210
207
|
})
|
|
211
208
|
);
|
|
212
|
-
|
|
213
|
-
fromChain,
|
|
214
|
-
tokens,
|
|
215
|
-
connectedWallets,
|
|
216
|
-
[]
|
|
217
|
-
);
|
|
218
|
-
const sortedDestinationTokens = getSortedTokens(
|
|
219
|
-
toChain,
|
|
220
|
-
tokens,
|
|
221
|
-
connectedWallets,
|
|
222
|
-
[]
|
|
223
|
-
);
|
|
209
|
+
|
|
224
210
|
const inputAmount = pendingSwap.inputAmount;
|
|
225
211
|
set({
|
|
226
|
-
|
|
212
|
+
fromBlockchain,
|
|
227
213
|
fromToken,
|
|
228
214
|
inputAmount,
|
|
229
215
|
outputAmount: null,
|
|
230
216
|
inputUsdValue: getUsdValue(fromToken || null, inputAmount),
|
|
231
217
|
outputUsdValue: new BigNumber(0),
|
|
232
|
-
|
|
218
|
+
toBlockchain,
|
|
233
219
|
toToken,
|
|
234
220
|
bestRoute: null,
|
|
235
|
-
loading: false,
|
|
236
|
-
error: '',
|
|
237
|
-
sourceTokens: sortedSourceTokens,
|
|
238
|
-
destinationTokens: sortedDestinationTokens,
|
|
239
221
|
});
|
|
240
222
|
},
|
|
241
223
|
switchFromAndTo: () =>
|
|
242
224
|
set((state) => ({
|
|
243
|
-
|
|
225
|
+
fromBlockchain: state.toBlockchain,
|
|
244
226
|
fromToken: state.toToken,
|
|
245
|
-
|
|
227
|
+
toBlockchain: state.fromBlockchain,
|
|
246
228
|
toToken: state.fromToken,
|
|
247
|
-
sourceTokens: state.destinationTokens,
|
|
248
|
-
destinationTokens: state.sourceTokens,
|
|
249
229
|
inputAmount: state.outputAmount?.toString() || '',
|
|
250
230
|
inputUsdValue: getUsdValue(
|
|
251
231
|
state.toToken,
|
|
252
232
|
state.outputAmount?.toString() || ''
|
|
253
233
|
),
|
|
254
234
|
})),
|
|
235
|
+
|
|
236
|
+
resetFromBlockchain: () =>
|
|
237
|
+
set(() => ({
|
|
238
|
+
fromToken: null,
|
|
239
|
+
fromBlockchain: null,
|
|
240
|
+
outputAmount: null,
|
|
241
|
+
outputUsdValue: null,
|
|
242
|
+
bestRoute: null,
|
|
243
|
+
})),
|
|
244
|
+
resetToBlockchain: () =>
|
|
245
|
+
set(() => ({
|
|
246
|
+
toToken: null,
|
|
247
|
+
toBlockchain: null,
|
|
248
|
+
outputAmount: null,
|
|
249
|
+
outputUsdValue: null,
|
|
250
|
+
bestRoute: null,
|
|
251
|
+
})),
|
|
252
|
+
setRouteWalletConfirmed: (flag) =>
|
|
253
|
+
set({
|
|
254
|
+
routeWalletsConfirmed: flag,
|
|
255
|
+
}),
|
|
256
|
+
setSelectedWallets: (wallets) => set({ selectedWallets: wallets }),
|
|
257
|
+
setCustomDestination: (address) => set({ customDestination: address }),
|
|
258
|
+
resetRouteWallets: () =>
|
|
259
|
+
set({
|
|
260
|
+
routeWalletsConfirmed: false,
|
|
261
|
+
selectedWallets: [],
|
|
262
|
+
customDestination: '',
|
|
263
|
+
}),
|
|
255
264
|
}))
|
|
256
265
|
)
|
|
257
266
|
);
|
|
258
|
-
|
|
259
|
-
const bestRoute = (
|
|
260
|
-
bestRouteStore: typeof useBestRouteStore,
|
|
261
|
-
settingsStore: typeof useSettingsStore
|
|
262
|
-
) => {
|
|
263
|
-
let abortController: AbortController | null = null;
|
|
264
|
-
const fetchBestRoute = () => {
|
|
265
|
-
const { fromToken, toToken, inputAmount, resetRoute } =
|
|
266
|
-
bestRouteStore.getState();
|
|
267
|
-
const {
|
|
268
|
-
slippage,
|
|
269
|
-
customSlippage,
|
|
270
|
-
disabledLiquiditySources,
|
|
271
|
-
affiliateRef,
|
|
272
|
-
affiliatePercent,
|
|
273
|
-
affiliateWallets,
|
|
274
|
-
} = settingsStore.getState();
|
|
275
|
-
if (!fromToken || !toToken || !isPositiveNumber(inputAmount)) return;
|
|
276
|
-
abortController?.abort();
|
|
277
|
-
abortController = new AbortController();
|
|
278
|
-
const userSlippage = !!customSlippage ? customSlippage : slippage;
|
|
279
|
-
const requestBody = createBestRouteRequestBody(
|
|
280
|
-
fromToken,
|
|
281
|
-
toToken,
|
|
282
|
-
inputAmount,
|
|
283
|
-
[],
|
|
284
|
-
[],
|
|
285
|
-
disabledLiquiditySources,
|
|
286
|
-
userSlippage,
|
|
287
|
-
affiliateRef,
|
|
288
|
-
affiliatePercent,
|
|
289
|
-
affiliateWallets
|
|
290
|
-
);
|
|
291
|
-
|
|
292
|
-
if (!bestRouteStore.getState().loading) {
|
|
293
|
-
resetRoute();
|
|
294
|
-
}
|
|
295
|
-
httpService()
|
|
296
|
-
.getBestRoute(requestBody, {
|
|
297
|
-
signal: abortController.signal,
|
|
298
|
-
})
|
|
299
|
-
.then((res) => {
|
|
300
|
-
const { setBestRoute } = bestRouteStore.getState();
|
|
301
|
-
setBestRoute(res);
|
|
302
|
-
bestRouteStore.setState({ loading: false });
|
|
303
|
-
abortController = null;
|
|
304
|
-
})
|
|
305
|
-
.catch((error) => {
|
|
306
|
-
if (error.code === 'ERR_CANCELED') return;
|
|
307
|
-
bestRouteStore.setState({
|
|
308
|
-
error: error.message,
|
|
309
|
-
loading: false,
|
|
310
|
-
});
|
|
311
|
-
});
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
const debouncedFetchBestRoute = debounce(fetchBestRoute, 600);
|
|
315
|
-
|
|
316
|
-
const bestRouteParamsListener = () => {
|
|
317
|
-
const { fromToken, toToken, inputAmount, inputUsdValue, resetRoute } =
|
|
318
|
-
useBestRouteStore.getState();
|
|
319
|
-
if (!isPositiveNumber(inputAmount) || inputUsdValue?.eq(0))
|
|
320
|
-
return bestRouteStore.setState({ loading: false });
|
|
321
|
-
|
|
322
|
-
if (tokensAreEqual(fromToken, toToken))
|
|
323
|
-
return bestRouteStore.setState({
|
|
324
|
-
loading: false,
|
|
325
|
-
bestRoute: null,
|
|
326
|
-
outputAmount: new BigNumber(inputAmount),
|
|
327
|
-
outputUsdValue: inputUsdValue,
|
|
328
|
-
});
|
|
329
|
-
|
|
330
|
-
if (!bestRouteStore.getState().loading) resetRoute();
|
|
331
|
-
debouncedFetchBestRoute();
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
useBestRouteStore.subscribe(
|
|
335
|
-
(state) => ({
|
|
336
|
-
fromChain: state.fromChain,
|
|
337
|
-
fromToken: state.fromToken,
|
|
338
|
-
toChain: state.toChain,
|
|
339
|
-
toToken: state.toToken,
|
|
340
|
-
inputAmount: state.inputAmount,
|
|
341
|
-
}),
|
|
342
|
-
bestRouteParamsListener,
|
|
343
|
-
{
|
|
344
|
-
equalityFn: (prevState, currentState) => {
|
|
345
|
-
if (
|
|
346
|
-
isRouteParametersChanged({
|
|
347
|
-
store: 'bestRoute',
|
|
348
|
-
prevState,
|
|
349
|
-
currentState,
|
|
350
|
-
})
|
|
351
|
-
)
|
|
352
|
-
return false;
|
|
353
|
-
else return true;
|
|
354
|
-
},
|
|
355
|
-
}
|
|
356
|
-
);
|
|
357
|
-
|
|
358
|
-
useSettingsStore.subscribe(
|
|
359
|
-
(state) => ({
|
|
360
|
-
slippage: state.slippage,
|
|
361
|
-
customSlippage: state.customSlippage,
|
|
362
|
-
disabledLiquiditySources: state.disabledLiquiditySources,
|
|
363
|
-
infiniteApprove: state.infiniteApprove,
|
|
364
|
-
}),
|
|
365
|
-
bestRouteParamsListener,
|
|
366
|
-
{
|
|
367
|
-
equalityFn: (prevState, currentState) => {
|
|
368
|
-
if (
|
|
369
|
-
isRouteParametersChanged({
|
|
370
|
-
store: 'settings',
|
|
371
|
-
prevState,
|
|
372
|
-
currentState,
|
|
373
|
-
})
|
|
374
|
-
)
|
|
375
|
-
return false;
|
|
376
|
-
else return true;
|
|
377
|
-
},
|
|
378
|
-
}
|
|
379
|
-
);
|
|
380
|
-
|
|
381
|
-
return { fetchBestRoute };
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
export const { fetchBestRoute } = bestRoute(
|
|
385
|
-
useBestRouteStore,
|
|
386
|
-
useSettingsStore
|
|
387
|
-
);
|
package/src/store/meta.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import type { TokenWithBalance } from '../components/TokenList';
|
|
2
|
+
import type { MetaResponse } from 'rango-sdk';
|
|
3
|
+
|
|
1
4
|
import { create } from 'zustand';
|
|
2
|
-
|
|
3
|
-
import {
|
|
5
|
+
|
|
6
|
+
import { useAppStore } from './app';
|
|
4
7
|
import createSelectors from './selectors';
|
|
5
|
-
import { removeDuplicateFrom } from '../utils/common';
|
|
6
8
|
|
|
7
9
|
export type LoadingStatus = 'loading' | 'success' | 'failed';
|
|
8
10
|
|
|
9
11
|
export interface MetaState {
|
|
10
|
-
meta: MetaResponse;
|
|
12
|
+
meta: MetaResponse & { tokens: TokenWithBalance[] };
|
|
11
13
|
loadingStatus: LoadingStatus;
|
|
12
14
|
fetchMeta: () => Promise<void>;
|
|
13
15
|
}
|
|
@@ -18,16 +20,16 @@ export const useMetaStore = createSelectors(
|
|
|
18
20
|
loadingStatus: 'loading',
|
|
19
21
|
fetchMeta: async () => {
|
|
20
22
|
try {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
await useAppStore.getState().fetch();
|
|
24
|
+
|
|
25
|
+
const state = useAppStore.getState();
|
|
26
|
+
const response: MetaResponse = {
|
|
27
|
+
blockchains: state.blockchains(),
|
|
28
|
+
tokens: state.tokens(),
|
|
29
|
+
popularTokens: state._popularTokens,
|
|
30
|
+
swappers: state._swappers,
|
|
31
|
+
};
|
|
32
|
+
|
|
31
33
|
set({ meta: response, loadingStatus: 'success' });
|
|
32
34
|
} catch (error) {
|
|
33
35
|
set({ loadingStatus: 'failed' });
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Notification } from '../types/notification';
|
|
2
|
+
import type {
|
|
3
|
+
Route,
|
|
4
|
+
RouteEvent,
|
|
5
|
+
StepEvent,
|
|
6
|
+
} from '@rango-dev/queue-manager-rango-preset';
|
|
7
|
+
|
|
8
|
+
import { create } from 'zustand';
|
|
9
|
+
import { persist, subscribeWithSelector } from 'zustand/middleware';
|
|
10
|
+
|
|
11
|
+
import createSelectors from './selectors';
|
|
12
|
+
|
|
13
|
+
export interface NotificationState {
|
|
14
|
+
notifications: Notification[];
|
|
15
|
+
setNotification: (event: RouteEvent | StepEvent, route: Route) => void;
|
|
16
|
+
setAsRead: (requestId: Notification['requestId']) => void;
|
|
17
|
+
getUnreadNotifications: () => Notification[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const useNotificationStore = createSelectors(
|
|
21
|
+
create<NotificationState>()(
|
|
22
|
+
persist(
|
|
23
|
+
subscribeWithSelector((set, get) => ({
|
|
24
|
+
notifications: [],
|
|
25
|
+
setNotification: (event, route) => {
|
|
26
|
+
const fromStep = route.steps[0];
|
|
27
|
+
const toStep = route.steps[route.steps.length - 1];
|
|
28
|
+
|
|
29
|
+
const notification: Notification = {
|
|
30
|
+
event,
|
|
31
|
+
creationTime: Date.now(),
|
|
32
|
+
read: false,
|
|
33
|
+
requestId: route.requestId,
|
|
34
|
+
route: {
|
|
35
|
+
from: {
|
|
36
|
+
blockchain: fromStep.fromBlockchain,
|
|
37
|
+
tokenAddress: fromStep.fromSymbolAddress,
|
|
38
|
+
tokenSymbol: fromStep.fromSymbol,
|
|
39
|
+
},
|
|
40
|
+
to: {
|
|
41
|
+
blockchain: toStep.toBlockchain,
|
|
42
|
+
tokenSymbol: toStep.toSymbol,
|
|
43
|
+
tokenAddress: toStep.toSymbolAddress,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const excludedList = get().notifications.filter(
|
|
49
|
+
(notificationItem) => notificationItem.requestId !== route.requestId
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
set(() => ({
|
|
53
|
+
notifications: [...excludedList, notification],
|
|
54
|
+
}));
|
|
55
|
+
},
|
|
56
|
+
setAsRead: (requestId) => {
|
|
57
|
+
set((state) => ({
|
|
58
|
+
notifications: state.notifications.map((notificationItem) =>
|
|
59
|
+
notificationItem.requestId === requestId
|
|
60
|
+
? { ...notificationItem, read: true }
|
|
61
|
+
: notificationItem
|
|
62
|
+
),
|
|
63
|
+
}));
|
|
64
|
+
},
|
|
65
|
+
getUnreadNotifications: () => {
|
|
66
|
+
return get().notifications.filter(
|
|
67
|
+
(notificationItem) => !notificationItem.read
|
|
68
|
+
);
|
|
69
|
+
},
|
|
70
|
+
})),
|
|
71
|
+
{
|
|
72
|
+
name: 'notification',
|
|
73
|
+
skipHydration: true,
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
)
|
|
77
|
+
);
|
package/src/store/settings.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { create } from 'zustand';
|
|
2
2
|
import { persist, subscribeWithSelector } from 'zustand/middleware';
|
|
3
|
+
|
|
3
4
|
import { DEFAULT_SLIPPAGE } from '../constants/swapSettings';
|
|
4
5
|
import { removeDuplicateFrom } from '../utils/common';
|
|
6
|
+
|
|
5
7
|
import { useMetaStore } from './meta';
|
|
6
8
|
import createSelectors from './selectors';
|
|
7
9
|
|
|
@@ -21,7 +23,7 @@ export interface SettingsState {
|
|
|
21
23
|
toggleInfiniteApprove: () => void;
|
|
22
24
|
toggleLiquiditySource: (name: string) => void;
|
|
23
25
|
setTheme: (theme: Theme) => void;
|
|
24
|
-
toggleAllLiquiditySources: () => void;
|
|
26
|
+
toggleAllLiquiditySources: (shouldReset?: boolean) => void;
|
|
25
27
|
setAffiliateRef: (affiliateRef: string | null) => void;
|
|
26
28
|
setAffiliatePercent: (affiliatePercent: number | null) => void;
|
|
27
29
|
setAffiliateWallets: (
|
|
@@ -62,20 +64,25 @@ export const useSettingsStore = createSelectors(
|
|
|
62
64
|
set(() => ({
|
|
63
65
|
affiliateWallets,
|
|
64
66
|
})),
|
|
65
|
-
toggleAllLiquiditySources: () =>
|
|
67
|
+
toggleAllLiquiditySources: (shouldReset?: boolean) =>
|
|
66
68
|
set((state) => {
|
|
69
|
+
if (shouldReset) {
|
|
70
|
+
return { disabledLiquiditySources: [] };
|
|
71
|
+
}
|
|
67
72
|
const { swappers } = useMetaStore.getState().meta;
|
|
68
73
|
const swappersGroup = removeDuplicateFrom(
|
|
69
74
|
swappers.map((swapper) => swapper.swapperGroup)
|
|
70
75
|
);
|
|
71
76
|
|
|
72
|
-
if (
|
|
77
|
+
if (
|
|
78
|
+
swappersGroup.length === state.disabledLiquiditySources.length
|
|
79
|
+
) {
|
|
73
80
|
return { disabledLiquiditySources: [] };
|
|
74
|
-
else {
|
|
75
|
-
return {
|
|
76
|
-
disabledLiquiditySources: swappersGroup,
|
|
77
|
-
};
|
|
78
81
|
}
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
disabledLiquiditySources: swappersGroup,
|
|
85
|
+
};
|
|
79
86
|
}),
|
|
80
87
|
toggleInfiniteApprove: () =>
|
|
81
88
|
set((state) => ({
|
|
@@ -83,17 +90,17 @@ export const useSettingsStore = createSelectors(
|
|
|
83
90
|
})),
|
|
84
91
|
toggleLiquiditySource: (name) =>
|
|
85
92
|
set((state) => {
|
|
86
|
-
if (state.disabledLiquiditySources.includes(name))
|
|
93
|
+
if (state.disabledLiquiditySources.includes(name)) {
|
|
87
94
|
return {
|
|
88
95
|
disabledLiquiditySources: state.disabledLiquiditySources.filter(
|
|
89
96
|
(liquiditySource) => liquiditySource != name
|
|
90
97
|
),
|
|
91
98
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
disabledLiquiditySources:
|
|
102
|
+
state.disabledLiquiditySources.concat(name),
|
|
103
|
+
};
|
|
97
104
|
}),
|
|
98
105
|
setTheme: (theme) =>
|
|
99
106
|
set(() => ({
|