@rango-dev/widget-embedded 0.12.1-next.2 → 0.12.1-next.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Wallets.d.ts +4 -3
- package/dist/Wallets.d.ts.map +1 -1
- package/dist/Widget.d.ts +3 -2
- package/dist/Widget.d.ts.map +1 -1
- package/dist/components/AppRouter.d.ts +3 -2
- package/dist/components/AppRouter.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts +1 -1
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.d.ts +4 -0
- package/dist/components/BlockchainList/BlockchainList.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts +4 -0
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts +307 -0
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -0
- package/dist/components/BlockchainList/BlockchainList.types.d.ts +8 -0
- package/dist/components/BlockchainList/BlockchainList.types.d.ts.map +1 -0
- package/dist/components/BlockchainList/LoadingBlockchainList.d.ts +3 -0
- package/dist/components/BlockchainList/LoadingBlockchainList.d.ts.map +1 -0
- package/dist/components/BlockchainList/index.d.ts +2 -0
- package/dist/components/BlockchainList/index.d.ts.map +1 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.d.ts +5 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.d.ts.map +1 -0
- package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts +156 -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 +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 +2597 -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 +895 -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 +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/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 +460 -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 +766 -0
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -0
- package/dist/components/SettingsContainer/index.d.ts +2 -0
- package/dist/components/SettingsContainer/index.d.ts.map +1 -0
- package/dist/components/Slippage/Slippage.d.ts +3 -0
- package/dist/components/Slippage/Slippage.d.ts.map +1 -0
- package/dist/components/Slippage/Slippage.styles.d.ts +613 -0
- package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -0
- package/dist/components/Slippage/SlippageTooltipContent.d.ts +3 -0
- package/dist/components/Slippage/SlippageTooltipContent.d.ts.map +1 -0
- package/dist/components/Slippage/index.d.ts +2 -0
- package/dist/components/Slippage/index.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts +4 -0
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.d.ts +4 -0
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +8 -0
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +919 -0
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.types.d.ts +12 -0
- package/dist/components/SwapDetails/SwapDetails.types.d.ts.map +1 -0
- package/dist/components/SwapDetails/index.d.ts +2 -0
- package/dist/components/SwapDetails/index.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.d.ts +4 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.d.ts +4 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts +4 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +154 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +20 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -0
- package/dist/components/SwapDetailsAlerts/index.d.ts +3 -0
- package/dist/components/SwapDetailsAlerts/index.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Cancel.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Cancel.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Delete.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Delete.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +154 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +46 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/index.d.ts +4 -0
- package/dist/components/SwapDetailsModal/index.d.ts.map +1 -0
- package/dist/components/SwapsGroup/SwapsGroup.d.ts +4 -0
- package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -0
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +613 -0
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -0
- package/dist/components/SwapsGroup/SwapsGroup.types.d.ts +12 -0
- package/dist/components/SwapsGroup/SwapsGroup.types.d.ts.map +1 -0
- package/dist/components/SwapsGroup/index.d.ts +2 -0
- package/dist/components/SwapsGroup/index.d.ts.map +1 -0
- package/dist/components/SwitchFromAndTo.d.ts +1 -1
- package/dist/components/SwitchFromAndTo.d.ts.map +1 -1
- package/dist/components/TokenList/LoadingTokenList.d.ts +4 -0
- package/dist/components/TokenList/LoadingTokenList.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.d.ts +4 -0
- package/dist/components/TokenList/TokenList.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.helpers.d.ts +3 -0
- package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.styles.d.ts +1532 -0
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -0
- package/dist/components/TokenList/TokenList.types.d.ts +41 -0
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -0
- package/dist/components/TokenList/index.d.ts +3 -0
- package/dist/components/TokenList/index.d.ts.map +1 -0
- package/dist/components/UpdateUrl.d.ts.map +1 -1
- package/dist/components/WalletModal/WalletModal.d.ts +4 -0
- package/dist/components/WalletModal/WalletModal.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModal.types.d.ts +10 -0
- package/dist/components/WalletModal/WalletModal.types.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModalContent.d.ts +4 -0
- package/dist/components/WalletModal/WalletModalContent.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts +613 -0
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -0
- package/dist/components/WalletModal/index.d.ts +2 -0
- package/dist/components/WalletModal/index.d.ts.map +1 -0
- package/dist/components/WidgetEvents.d.ts.map +1 -1
- package/dist/constants/errors.d.ts +29 -0
- package/dist/constants/errors.d.ts.map +1 -1
- package/dist/constants/messages.d.ts +7 -0
- package/dist/constants/messages.d.ts.map +1 -0
- package/dist/constants/navigationRoutes.d.ts +8 -4
- package/dist/constants/navigationRoutes.d.ts.map +1 -1
- package/dist/constants/routing.d.ts +13 -0
- package/dist/constants/routing.d.ts.map +1 -0
- package/dist/constants/searchParams.d.ts +2 -2
- package/dist/constants/searchParams.d.ts.map +1 -1
- package/dist/constants/swapSettings.d.ts.map +1 -1
- package/dist/constants/wallets.d.ts +3 -0
- package/dist/constants/wallets.d.ts.map +1 -0
- package/dist/constants/warnings.d.ts +3 -0
- package/dist/constants/warnings.d.ts.map +1 -0
- package/dist/globalStyles.d.ts +1 -1
- package/dist/globalStyles.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap.d.ts +14 -6
- package/dist/hooks/useConfirmSwap.d.ts.map +1 -1
- package/dist/hooks/useFetchBestRoute.d.ts +9 -0
- package/dist/hooks/useFetchBestRoute.d.ts.map +1 -0
- package/dist/hooks/useNavigateBack.d.ts.map +1 -1
- package/dist/hooks/useSwapInput.d.ts +12 -0
- package/dist/hooks/useSwapInput.d.ts.map +1 -0
- package/dist/hooks/useTheme.d.ts +3 -29
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts +20 -0
- package/dist/hooks/useWalletList.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts +6 -3
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/HistoryPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/LanguagePage.d.ts +3 -0
- package/dist/pages/LanguagePage.d.ts.map +1 -0
- package/dist/pages/LiquiditySourcePage.d.ts +8 -0
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -0
- package/dist/pages/SelectBlockchainPage.d.ts +8 -0
- package/dist/pages/SelectBlockchainPage.d.ts.map +1 -0
- package/dist/pages/SelectSwapItemsPage.d.ts +11 -0
- package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -0
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
- package/dist/pages/ThemePage.d.ts +3 -0
- package/dist/pages/ThemePage.d.ts.map +1 -0
- package/dist/pages/WalletsPage.d.ts +4 -2
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/bestRoute.d.ts +32 -19
- package/dist/store/bestRoute.d.ts.map +1 -1
- package/dist/store/meta.d.ts +10 -3
- package/dist/store/meta.d.ts.map +1 -1
- package/dist/store/notification.d.ts +38 -0
- package/dist/store/notification.d.ts.map +1 -0
- package/dist/store/settings.d.ts +2 -2
- package/dist/store/settings.d.ts.map +1 -1
- package/dist/store/ui.d.ts +0 -2
- package/dist/store/ui.d.ts.map +1 -1
- package/dist/store/wallets.d.ts +14 -12
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +11 -6
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/notification.d.ts +22 -0
- package/dist/types/notification.d.ts.map +1 -0
- package/dist/types/routing.d.ts +30 -23
- package/dist/types/routing.d.ts.map +1 -1
- package/dist/types/swap.d.ts +8 -1
- package/dist/types/swap.d.ts.map +1 -1
- package/dist/utils/common.d.ts +5 -0
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +2 -0
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/date.d.ts +1 -1
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +3 -0
- package/dist/utils/meta.d.ts.map +1 -0
- package/dist/utils/numbers.d.ts +2 -1
- 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/wallets.d.ts +20 -14
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/Wallets.tsx +23 -17
- package/src/Widget.tsx +88 -28
- package/src/components/AppRouter.tsx +36 -6
- package/src/components/AppRoutes.tsx +54 -19
- package/src/components/BlockchainList/BlockchainList.helpers.ts +37 -0
- package/src/components/BlockchainList/BlockchainList.styles.ts +19 -0
- package/src/components/BlockchainList/BlockchainList.tsx +73 -0
- package/src/components/BlockchainList/BlockchainList.types.ts +8 -0
- package/src/components/BlockchainList/LoadingBlockchainList.tsx +20 -0
- package/src/components/BlockchainList/index.ts +1 -0
- package/src/components/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 +86 -0
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +169 -0
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +460 -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 +20 -0
- package/src/components/HeaderButtons/WalletButton.tsx +20 -0
- package/src/components/HeaderButtons/index.ts +4 -0
- package/src/components/Layout/Layout.styles.ts +50 -0
- package/src/components/Layout/Layout.tsx +72 -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 +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 +107 -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 +128 -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 +79 -0
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +85 -0
- package/src/components/SwapDetails/SwapDetails.styles.ts +68 -0
- package/src/components/SwapDetails/SwapDetails.tsx +419 -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 +31 -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 +125 -0
- package/src/components/SwapsGroup/SwapsGroup.types.ts +13 -0
- package/src/components/SwapsGroup/index.ts +1 -0
- package/src/components/SwitchFromAndTo.tsx +23 -41
- package/src/components/TokenList/LoadingTokenList.tsx +34 -0
- package/src/components/TokenList/TokenList.helpers.ts +13 -0
- package/src/components/TokenList/TokenList.styles.ts +121 -0
- package/src/components/TokenList/TokenList.tsx +271 -0
- package/src/components/TokenList/TokenList.types.ts +48 -0
- package/src/components/TokenList/index.ts +2 -0
- package/src/components/UpdateUrl.tsx +40 -22
- package/src/components/WalletModal/WalletModal.tsx +20 -0
- package/src/components/WalletModal/WalletModal.types.ts +11 -0
- package/src/components/WalletModal/WalletModalContent.styles.ts +44 -0
- package/src/components/WalletModal/WalletModalContent.tsx +54 -0
- package/src/components/WalletModal/index.ts +1 -0
- package/src/components/WidgetEvents.tsx +37 -5
- package/src/constants/errors.ts +56 -1
- package/src/constants/messages.ts +8 -0
- package/src/constants/navigationRoutes.ts +8 -4
- package/src/constants/routing.ts +17 -0
- package/src/constants/searchParams.ts +2 -2
- package/src/constants/swapSettings.ts +5 -1
- package/src/constants/wallets.ts +3 -0
- package/src/constants/warnings.ts +26 -0
- package/src/globalStyles.ts +1 -4
- package/src/hooks/useConfirmSwap.ts +251 -220
- package/src/hooks/useFetchBestRoute.ts +38 -0
- package/src/hooks/useNavigateBack.ts +25 -9
- package/src/hooks/useSwapInput.ts +116 -0
- package/src/hooks/useTheme.ts +35 -74
- package/src/hooks/useWalletList.ts +125 -0
- package/src/pages/ConfirmSwapPage.tsx +492 -228
- package/src/pages/HistoryPage.tsx +104 -15
- package/src/pages/Home.tsx +392 -110
- 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 +169 -0
- package/src/pages/SettingsPage.tsx +144 -72
- package/src/pages/SwapDetailsPage.tsx +40 -141
- 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 +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 +53 -3
- package/src/utils/configs.ts +3 -0
- package/src/utils/date.ts +15 -18
- package/src/utils/meta.ts +9 -0
- package/src/utils/numbers.ts +63 -18
- package/src/utils/routing.ts +105 -27
- package/src/utils/settings.ts +57 -0
- package/src/utils/swap.ts +200 -113
- package/src/utils/wallets.ts +165 -116
- package/dist/components/ConfirmSwapErrors.d.ts +0 -4
- package/dist/components/ConfirmSwapErrors.d.ts.map +0 -1
- package/dist/components/ConfirmSwapWarnings.d.ts +0 -3
- package/dist/components/ConfirmSwapWarnings.d.ts.map +0 -1
- package/dist/components/Layout.d.ts +0 -7
- package/dist/components/Layout.d.ts.map +0 -1
- package/dist/pages/LiquiditySourcesPage.d.ts +0 -7
- package/dist/pages/LiquiditySourcesPage.d.ts.map +0 -1
- package/dist/pages/SelectChainPage.d.ts +0 -8
- package/dist/pages/SelectChainPage.d.ts.map +0 -1
- package/dist/pages/SelectTokenPage.d.ts +0 -15
- package/dist/pages/SelectTokenPage.d.ts.map +0 -1
- package/src/components/ConfirmSwapErrors.tsx +0 -34
- package/src/components/ConfirmSwapWarnings.tsx +0 -22
- package/src/components/Layout.tsx +0 -105
- package/src/pages/LiquiditySourcesPage.tsx +0 -63
- package/src/pages/SelectChainPage.tsx +0 -42
- package/src/pages/SelectTokenPage.tsx +0 -64
package/src/store/bestRoute.ts
CHANGED
|
@@ -1,28 +1,25 @@
|
|
|
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 {
|
|
15
|
-
import {
|
|
9
|
+
|
|
10
|
+
import { ZERO } from '../constants/numbers';
|
|
11
|
+
import { isPositiveNumber } from '../utils/numbers';
|
|
12
|
+
import { getBestRouteToTokenUsdPrice } from '../utils/routing';
|
|
13
|
+
import { calcOutputUsdValue } from '../utils/swap';
|
|
16
14
|
import {
|
|
17
15
|
getDefaultToken,
|
|
18
16
|
getSortedTokens,
|
|
19
17
|
tokensAreEqual,
|
|
20
18
|
} from '../utils/wallets';
|
|
19
|
+
|
|
20
|
+
import { useMetaStore } from './meta';
|
|
21
|
+
import createSelectors from './selectors';
|
|
21
22
|
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';
|
|
25
|
-
import { isPositiveNumber } from '../utils/numbers';
|
|
26
23
|
|
|
27
24
|
const getUsdValue = (token: Token | null, amount: string): BigNumber | null =>
|
|
28
25
|
token?.usdPrice
|
|
@@ -30,54 +27,68 @@ const getUsdValue = (token: Token | null, amount: string): BigNumber | null =>
|
|
|
30
27
|
: null;
|
|
31
28
|
|
|
32
29
|
export interface RouteState {
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
fromBlockchain: BlockchainMeta | null;
|
|
31
|
+
toBlockchain: BlockchainMeta | null;
|
|
35
32
|
inputAmount: string;
|
|
36
33
|
inputUsdValue: BigNumber | null;
|
|
37
34
|
outputAmount: BigNumber | null;
|
|
38
35
|
outputUsdValue: BigNumber | null;
|
|
39
36
|
fromToken: TokenWithBalance | null;
|
|
40
37
|
toToken: TokenWithBalance | null;
|
|
41
|
-
|
|
42
|
-
error: string;
|
|
38
|
+
routeWalletsConfirmed: boolean;
|
|
43
39
|
sourceTokens: Token[];
|
|
44
40
|
destinationTokens: Token[];
|
|
41
|
+
selectedWallets: Wallet[];
|
|
45
42
|
resetRoute: () => void;
|
|
46
|
-
|
|
43
|
+
resetToBlockchain: () => void;
|
|
44
|
+
resetFromBlockchain: () => void;
|
|
45
|
+
setFromBlockchain: (
|
|
47
46
|
chain: BlockchainMeta | null,
|
|
48
47
|
setDefaultToken?: boolean
|
|
49
48
|
) => void;
|
|
50
|
-
|
|
49
|
+
setToBlockchain: (
|
|
50
|
+
chian: BlockchainMeta | null,
|
|
51
|
+
setDefaultToken?: boolean
|
|
52
|
+
) => void;
|
|
53
|
+
|
|
51
54
|
setFromToken: (token: Token | null) => void;
|
|
52
55
|
setToToken: (token: Token | null) => void;
|
|
53
56
|
setInputAmount: (amount: string) => void;
|
|
54
57
|
bestRoute: BestRouteResponse | null;
|
|
55
|
-
|
|
58
|
+
setRoute: (bestRoute: BestRouteResponse | null) => void;
|
|
56
59
|
retry: (pendingSwap: PendingSwap) => void;
|
|
57
60
|
switchFromAndTo: () => void;
|
|
61
|
+
setRouteWalletConfirmed: (flag: boolean) => void;
|
|
62
|
+
setSelectedWallets: (wallets: Wallet[]) => void;
|
|
63
|
+
customDestination: string;
|
|
64
|
+
setCustomDestination: (address: string) => void;
|
|
65
|
+
resetRouteWallets: () => void;
|
|
58
66
|
}
|
|
59
67
|
|
|
60
68
|
export const useBestRouteStore = createSelectors(
|
|
61
69
|
create<RouteState>()(
|
|
62
70
|
subscribeWithSelector((set) => ({
|
|
63
|
-
|
|
71
|
+
fromBlockchain: null,
|
|
64
72
|
fromToken: null,
|
|
65
73
|
inputAmount: '',
|
|
66
74
|
outputAmount: null,
|
|
67
75
|
inputUsdValue: new BigNumber(0),
|
|
68
76
|
outputUsdValue: new BigNumber(0),
|
|
69
|
-
|
|
77
|
+
toBlockchain: null,
|
|
70
78
|
toToken: null,
|
|
71
79
|
bestRoute: null,
|
|
72
|
-
|
|
73
|
-
error: '',
|
|
80
|
+
routeWalletsConfirmed: false,
|
|
74
81
|
sourceTokens: [],
|
|
75
82
|
destinationTokens: [],
|
|
76
|
-
|
|
83
|
+
selectedWallets: [],
|
|
84
|
+
customDestination: '',
|
|
85
|
+
setRoute: (bestRoute) =>
|
|
77
86
|
set((state) => {
|
|
78
87
|
let outputAmount: BigNumber | null = null;
|
|
79
88
|
let outputUsdValue: BigNumber = ZERO;
|
|
80
|
-
if (!isPositiveNumber(state.inputAmount))
|
|
89
|
+
if (!isPositiveNumber(state.inputAmount)) {
|
|
90
|
+
return {};
|
|
91
|
+
}
|
|
81
92
|
if (!!bestRoute) {
|
|
82
93
|
outputAmount = !!bestRoute.result?.outputAmount
|
|
83
94
|
? new BigNumber(bestRoute.result?.outputAmount)
|
|
@@ -97,15 +108,15 @@ export const useBestRouteStore = createSelectors(
|
|
|
97
108
|
}),
|
|
98
109
|
resetRoute: () =>
|
|
99
110
|
set(() => ({
|
|
100
|
-
loading: true,
|
|
101
|
-
error: '',
|
|
102
111
|
bestRoute: null,
|
|
103
112
|
outputAmount: null,
|
|
104
113
|
outputUsdValue: new BigNumber(0),
|
|
105
114
|
})),
|
|
106
|
-
|
|
115
|
+
setFromBlockchain: (chain, setDefaultToken) => {
|
|
107
116
|
set((state) => {
|
|
108
|
-
if (state.
|
|
117
|
+
if (state.fromBlockchain?.name === chain?.name) {
|
|
118
|
+
return {};
|
|
119
|
+
}
|
|
109
120
|
const tokens = useMetaStore.getState().meta.tokens;
|
|
110
121
|
const connectedWallets = useWalletsStore.getState().connectedWallets;
|
|
111
122
|
const sortedTokens = getSortedTokens(
|
|
@@ -116,7 +127,7 @@ export const useBestRouteStore = createSelectors(
|
|
|
116
127
|
);
|
|
117
128
|
const fromToken = getDefaultToken(sortedTokens, state.toToken);
|
|
118
129
|
return {
|
|
119
|
-
|
|
130
|
+
fromBlockchain: chain,
|
|
120
131
|
sourceTokens: sortedTokens,
|
|
121
132
|
...(setDefaultToken && {
|
|
122
133
|
fromToken,
|
|
@@ -134,9 +145,11 @@ export const useBestRouteStore = createSelectors(
|
|
|
134
145
|
inputUsdValue: getUsdValue(token, state.inputAmount),
|
|
135
146
|
}),
|
|
136
147
|
})),
|
|
137
|
-
|
|
148
|
+
setToBlockchain: (chain, setDefaultToken) => {
|
|
138
149
|
set((state) => {
|
|
139
|
-
if (state.
|
|
150
|
+
if (state.toBlockchain?.name === chain?.name) {
|
|
151
|
+
return {};
|
|
152
|
+
}
|
|
140
153
|
const tokens = useMetaStore.getState().meta.tokens;
|
|
141
154
|
const connectedWallets = useWalletsStore.getState().connectedWallets;
|
|
142
155
|
const sortedTokens = getSortedTokens(
|
|
@@ -147,7 +160,7 @@ export const useBestRouteStore = createSelectors(
|
|
|
147
160
|
);
|
|
148
161
|
|
|
149
162
|
return {
|
|
150
|
-
|
|
163
|
+
toBlockchain: chain,
|
|
151
164
|
destinationTokens: sortedTokens,
|
|
152
165
|
...(setDefaultToken && {
|
|
153
166
|
toToken: getDefaultToken(sortedTokens, state.fromToken),
|
|
@@ -166,7 +179,6 @@ export const useBestRouteStore = createSelectors(
|
|
|
166
179
|
outputAmount: new BigNumber(0),
|
|
167
180
|
outputUsdValue: new BigNumber(0),
|
|
168
181
|
bestRoute: null,
|
|
169
|
-
error: '',
|
|
170
182
|
}),
|
|
171
183
|
...(!!state.fromToken && {
|
|
172
184
|
inputUsdValue: getUsdValue(state.fromToken, amount),
|
|
@@ -181,15 +193,17 @@ export const useBestRouteStore = createSelectors(
|
|
|
181
193
|
? pendingSwap.steps.findIndex((s) => s.status === 'failed')
|
|
182
194
|
: null;
|
|
183
195
|
|
|
184
|
-
if (failedIndex === null || failedIndex < 0)
|
|
196
|
+
if (failedIndex === null || failedIndex < 0) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
185
199
|
|
|
186
200
|
const firstStep = pendingSwap.steps[0];
|
|
187
201
|
const lastStep = pendingSwap.steps[pendingSwap.steps.length - 1];
|
|
188
|
-
const
|
|
202
|
+
const fromBlockchain =
|
|
189
203
|
blockchains.find(
|
|
190
204
|
(blockchain) => blockchain.name === firstStep.fromBlockchain
|
|
191
205
|
) || null;
|
|
192
|
-
const
|
|
206
|
+
const toBlockchain =
|
|
193
207
|
blockchains.find(
|
|
194
208
|
(blockchain) => blockchain.name === lastStep.toBlockchain
|
|
195
209
|
) || null;
|
|
@@ -210,39 +224,37 @@ export const useBestRouteStore = createSelectors(
|
|
|
210
224
|
})
|
|
211
225
|
);
|
|
212
226
|
const sortedSourceTokens = getSortedTokens(
|
|
213
|
-
|
|
227
|
+
fromBlockchain,
|
|
214
228
|
tokens,
|
|
215
229
|
connectedWallets,
|
|
216
230
|
[]
|
|
217
231
|
);
|
|
218
232
|
const sortedDestinationTokens = getSortedTokens(
|
|
219
|
-
|
|
233
|
+
toBlockchain,
|
|
220
234
|
tokens,
|
|
221
235
|
connectedWallets,
|
|
222
236
|
[]
|
|
223
237
|
);
|
|
224
238
|
const inputAmount = pendingSwap.inputAmount;
|
|
225
239
|
set({
|
|
226
|
-
|
|
240
|
+
fromBlockchain,
|
|
227
241
|
fromToken,
|
|
228
242
|
inputAmount,
|
|
229
243
|
outputAmount: null,
|
|
230
244
|
inputUsdValue: getUsdValue(fromToken || null, inputAmount),
|
|
231
245
|
outputUsdValue: new BigNumber(0),
|
|
232
|
-
|
|
246
|
+
toBlockchain,
|
|
233
247
|
toToken,
|
|
234
248
|
bestRoute: null,
|
|
235
|
-
loading: false,
|
|
236
|
-
error: '',
|
|
237
249
|
sourceTokens: sortedSourceTokens,
|
|
238
250
|
destinationTokens: sortedDestinationTokens,
|
|
239
251
|
});
|
|
240
252
|
},
|
|
241
253
|
switchFromAndTo: () =>
|
|
242
254
|
set((state) => ({
|
|
243
|
-
|
|
255
|
+
fromBlockchain: state.toBlockchain,
|
|
244
256
|
fromToken: state.toToken,
|
|
245
|
-
|
|
257
|
+
toBlockchain: state.fromBlockchain,
|
|
246
258
|
toToken: state.fromToken,
|
|
247
259
|
sourceTokens: state.destinationTokens,
|
|
248
260
|
destinationTokens: state.sourceTokens,
|
|
@@ -252,136 +264,29 @@ export const useBestRouteStore = createSelectors(
|
|
|
252
264
|
state.outputAmount?.toString() || ''
|
|
253
265
|
),
|
|
254
266
|
})),
|
|
267
|
+
|
|
268
|
+
resetFromBlockchain: () =>
|
|
269
|
+
set(() => ({
|
|
270
|
+
fromBlockchain: null,
|
|
271
|
+
sourceTokens: [],
|
|
272
|
+
})),
|
|
273
|
+
resetToBlockchain: () =>
|
|
274
|
+
set(() => ({
|
|
275
|
+
toBlockchain: null,
|
|
276
|
+
destinationTokens: [],
|
|
277
|
+
})),
|
|
278
|
+
setRouteWalletConfirmed: (flag) =>
|
|
279
|
+
set({
|
|
280
|
+
routeWalletsConfirmed: flag,
|
|
281
|
+
}),
|
|
282
|
+
setSelectedWallets: (wallets) => set({ selectedWallets: wallets }),
|
|
283
|
+
setCustomDestination: (address) => set({ customDestination: address }),
|
|
284
|
+
resetRouteWallets: () =>
|
|
285
|
+
set({
|
|
286
|
+
routeWalletsConfirmed: false,
|
|
287
|
+
selectedWallets: [],
|
|
288
|
+
customDestination: '',
|
|
289
|
+
}),
|
|
255
290
|
}))
|
|
256
291
|
)
|
|
257
292
|
);
|
|
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,21 +1,41 @@
|
|
|
1
|
+
import type { TokenWithBalance } from '../components/TokenList';
|
|
2
|
+
import type { MetaResponse } from 'rango-sdk';
|
|
3
|
+
|
|
1
4
|
import { create } from 'zustand';
|
|
2
|
-
|
|
5
|
+
|
|
3
6
|
import { httpService } from '../services/httpService';
|
|
4
|
-
import createSelectors from './selectors';
|
|
5
7
|
import { removeDuplicateFrom } from '../utils/common';
|
|
8
|
+
import { getTokensWithBalance, sortTokens } from '../utils/wallets';
|
|
9
|
+
|
|
10
|
+
import createSelectors from './selectors';
|
|
11
|
+
import { useWalletsStore } from './wallets';
|
|
6
12
|
|
|
7
13
|
export type LoadingStatus = 'loading' | 'success' | 'failed';
|
|
8
14
|
|
|
9
15
|
export interface MetaState {
|
|
10
|
-
meta: MetaResponse;
|
|
16
|
+
meta: MetaResponse & { tokens: TokenWithBalance[] };
|
|
11
17
|
loadingStatus: LoadingStatus;
|
|
12
18
|
fetchMeta: () => Promise<void>;
|
|
19
|
+
setTokensWithBalance: () => void;
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
export const useMetaStore = createSelectors(
|
|
16
23
|
create<MetaState>()((set) => ({
|
|
17
24
|
meta: { blockchains: [], popularTokens: [], swappers: [], tokens: [] },
|
|
18
25
|
loadingStatus: 'loading',
|
|
26
|
+
setTokensWithBalance: () => {
|
|
27
|
+
const connectedWallets = useWalletsStore.getState().connectedWallets;
|
|
28
|
+
|
|
29
|
+
set((state) => ({
|
|
30
|
+
...state,
|
|
31
|
+
meta: {
|
|
32
|
+
...state.meta,
|
|
33
|
+
tokens: sortTokens(
|
|
34
|
+
getTokensWithBalance(state.meta.tokens, connectedWallets)
|
|
35
|
+
),
|
|
36
|
+
},
|
|
37
|
+
}));
|
|
38
|
+
},
|
|
19
39
|
fetchMeta: async () => {
|
|
20
40
|
try {
|
|
21
41
|
const response = await httpService().getAllMetadata();
|
|
@@ -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(() => ({
|
package/src/store/ui.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { create } from 'zustand';
|
|
2
|
+
|
|
2
3
|
import createSelectors from './selectors';
|
|
3
4
|
|
|
4
5
|
interface UiState {
|
|
5
6
|
connectWalletsButtonDisabled: boolean;
|
|
6
7
|
selectedSwapRequestId: string | null;
|
|
7
8
|
currentPage: string;
|
|
8
|
-
toggleConnectWalletsButton: () => void;
|
|
9
9
|
setSelectedSwap: (requestId: string | null) => void;
|
|
10
10
|
setCurrentPage: (path: string) => void;
|
|
11
11
|
}
|
|
@@ -15,10 +15,6 @@ export const useUiStore = createSelectors(
|
|
|
15
15
|
connectWalletsButtonDisabled: false,
|
|
16
16
|
selectedSwapRequestId: null,
|
|
17
17
|
currentPage: '',
|
|
18
|
-
toggleConnectWalletsButton: () =>
|
|
19
|
-
set((state) => ({
|
|
20
|
-
connectWalletsButtonDisabled: !state.connectWalletsButtonDisabled,
|
|
21
|
-
})),
|
|
22
18
|
setSelectedSwap: (requestId) => set({ selectedSwapRequestId: requestId }),
|
|
23
19
|
setCurrentPage: (path) => set({ currentPage: path }),
|
|
24
20
|
}))
|