@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/types/routing.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
/* eslint-disable @typescript-eslint/prefer-enum-initializers */
|
|
2
|
+
import type { RouteState } from '../store/bestRoute';
|
|
3
|
+
import type { SettingsState } from '../store/settings';
|
|
3
4
|
|
|
4
5
|
interface BestRouteStoreParams {
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
fromBlockchain?: RouteState['fromBlockchain'];
|
|
7
|
+
toBlockchain?: RouteState['toBlockchain'];
|
|
7
8
|
fromToken?: RouteState['fromToken'];
|
|
8
9
|
toToken?: RouteState['toToken'];
|
|
9
10
|
inputAmount?: RouteState['inputAmount'];
|
|
@@ -32,45 +33,45 @@ export enum ConfirmSwapErrorTypes {
|
|
|
32
33
|
NO_ROUTE,
|
|
33
34
|
ROUTE_UPDATED_WITH_HIGH_VALUE_LOSS,
|
|
34
35
|
REQUEST_FAILED,
|
|
35
|
-
|
|
36
|
-
INSUFFICIENT_BALANCE,
|
|
36
|
+
REQUEST_CANCELED,
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export type ConfirmSwapError =
|
|
40
40
|
| {
|
|
41
|
-
type: ConfirmSwapErrorTypes.
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
| {
|
|
45
|
-
type: ConfirmSwapErrorTypes.INSUFFICIENT_SLIPPAGE;
|
|
46
|
-
minRequiredSlippage: string | null;
|
|
41
|
+
type: ConfirmSwapErrorTypes.NO_ROUTE;
|
|
42
|
+
diagnosisMessage?: string;
|
|
47
43
|
}
|
|
48
|
-
| { type: ConfirmSwapErrorTypes.INSUFFICIENT_BALANCE; messages: string[] }
|
|
49
44
|
| {
|
|
50
|
-
type: Exclude<
|
|
51
|
-
ConfirmSwapErrorTypes,
|
|
52
|
-
| ConfirmSwapErrorTypes.REQUEST_FAILED
|
|
53
|
-
| ConfirmSwapErrorTypes.INSUFFICIENT_SLIPPAGE
|
|
54
|
-
| ConfirmSwapErrorTypes.INSUFFICIENT_BALANCE
|
|
55
|
-
>;
|
|
45
|
+
type: Exclude<ConfirmSwapErrorTypes, ConfirmSwapErrorTypes.NO_ROUTE>;
|
|
56
46
|
};
|
|
57
47
|
|
|
58
|
-
export
|
|
48
|
+
export enum RouteWarningType {
|
|
49
|
+
ROUTE_UPDATED,
|
|
50
|
+
ROUTE_SWAPPERS_UPDATED,
|
|
51
|
+
ROUTE_COINS_UPDATED,
|
|
52
|
+
ROUTE_AND_OUTPUT_AMOUNT_UPDATED,
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type RouteWarning =
|
|
59
56
|
| {
|
|
60
|
-
type:
|
|
57
|
+
type: RouteWarningType.ROUTE_AND_OUTPUT_AMOUNT_UPDATED;
|
|
61
58
|
newOutputAmount: string;
|
|
62
59
|
percentageChange: string;
|
|
63
60
|
}
|
|
64
61
|
| {
|
|
65
62
|
type: Exclude<
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
RouteWarningType,
|
|
64
|
+
RouteWarningType.ROUTE_AND_OUTPUT_AMOUNT_UPDATED
|
|
68
65
|
>;
|
|
69
66
|
};
|
|
70
67
|
|
|
71
|
-
export enum
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
ROUTE_COINS_UPDATED,
|
|
75
|
-
ROUTE_AND_OUTPUT_AMOUNT_UPDATED,
|
|
68
|
+
export enum SlippageWarningType {
|
|
69
|
+
INSUFFICIENT_SLIPPAGE,
|
|
70
|
+
HIGH_SLIPPAGE,
|
|
76
71
|
}
|
|
72
|
+
|
|
73
|
+
export type ConfirmSwapWarnings = {
|
|
74
|
+
route: RouteWarning | null;
|
|
75
|
+
balance: { messages: string[] } | null;
|
|
76
|
+
slippage: { type: SlippageWarningType; slippage: string | null } | null;
|
|
77
|
+
};
|
package/src/types/swap.ts
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import { SwapSavedSettings } from 'rango-types/lib';
|
|
1
|
+
import type { SwapSavedSettings } from 'rango-types/lib';
|
|
2
2
|
|
|
3
3
|
export type PendingSwapSettings = Omit<
|
|
4
4
|
SwapSavedSettings,
|
|
5
5
|
'disabledSwappersIds'
|
|
6
6
|
>;
|
|
7
7
|
|
|
8
|
+
export enum ButtonState {
|
|
9
|
+
WAITFORCONNECTING = 'waitForConnecting',
|
|
10
|
+
SWAP = 'swap',
|
|
11
|
+
NEEDTOCONFIRM = 'needToConfirm',
|
|
12
|
+
WARNING = 'warning',
|
|
13
|
+
}
|
|
14
|
+
|
|
8
15
|
export type SwapButtonState = (
|
|
9
16
|
| { disabled: true }
|
|
10
17
|
| { disabled: false; hasWarning?: boolean }
|
|
11
18
|
) & {
|
|
12
19
|
title: string;
|
|
20
|
+
state: ButtonState;
|
|
13
21
|
};
|
|
14
22
|
|
|
15
23
|
export type ConvertedToken = {
|
package/src/utils/common.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
1
2
|
export function removeDuplicateFrom<T>(array: T[]): T[] {
|
|
2
3
|
return Array.from(new Set(array));
|
|
3
4
|
}
|
|
@@ -10,9 +11,7 @@ export function areEqual(
|
|
|
10
11
|
array1.length === array2.length && array1.every((v, i) => v === array2[i])
|
|
11
12
|
);
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
16
15
|
export function debounce(fn: Function, time: number) {
|
|
17
16
|
let timeoutId: ReturnType<typeof setTimeout> | null;
|
|
18
17
|
return wrapper;
|
|
@@ -27,4 +26,58 @@ export function debounce(fn: Function, time: number) {
|
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
28
|
|
|
29
|
+
export function containsText(text: string, searchText: string): boolean {
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
31
|
+
return text.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const colorShade = (col: string, amt: number) => {
|
|
35
|
+
col = col.replace(/^#/, '');
|
|
36
|
+
if (col.length === 3) {
|
|
37
|
+
col = col[0] + col[0] + col[1] + col[1] + col[2] + col[2];
|
|
38
|
+
}
|
|
39
|
+
let [r, g, b]: any = col.match(/.{2}/g);
|
|
40
|
+
[r, g, b] = [
|
|
41
|
+
parseInt(r, 16) + amt,
|
|
42
|
+
parseInt(g, 16) + amt,
|
|
43
|
+
parseInt(b, 16) + amt,
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
r = Math.max(Math.min(255, r), 0).toString(16);
|
|
47
|
+
g = Math.max(Math.min(255, g), 0).toString(16);
|
|
48
|
+
b = Math.max(Math.min(255, b), 0).toString(16);
|
|
49
|
+
|
|
50
|
+
const rr = (r.length < 2 ? '0' : '') + r;
|
|
51
|
+
const gg = (g.length < 2 ? '0' : '') + g;
|
|
52
|
+
const bb = (b.length < 2 ? '0' : '') + b;
|
|
53
|
+
|
|
54
|
+
return `#${rr}${gg}${bb}`;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const generateRangeColors = (name: string, color: string) => {
|
|
58
|
+
let colors = { [name]: color };
|
|
59
|
+
for (let i = 1; i < 10; i++) {
|
|
60
|
+
if (i < 5) {
|
|
61
|
+
colors = {
|
|
62
|
+
...colors,
|
|
63
|
+
[name + i * 100]: colorShade(color, (5 - i) * 32),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (i === 5) {
|
|
67
|
+
colors = {
|
|
68
|
+
...colors,
|
|
69
|
+
[name + i * 100]: color,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (i > 5) {
|
|
73
|
+
colors = {
|
|
74
|
+
...colors,
|
|
75
|
+
[name + i * 100]: colorShade(color, -((i - 5) * 32)),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return colors;
|
|
80
|
+
};
|
|
30
81
|
|
|
82
|
+
export const getContainer = () =>
|
|
83
|
+
document.getElementById('swap-box') as HTMLElement;
|
package/src/utils/configs.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { RANGO_PUBLIC_API_KEY } from '../constants';
|
|
2
|
+
|
|
1
3
|
export interface Configs {
|
|
2
4
|
API_KEY: string;
|
|
3
5
|
}
|
|
4
6
|
|
|
5
|
-
const RANGO_PUBLIC_API_KEY = 'c6381a79-2817-4602-83bf-6a641a409e32';
|
|
6
|
-
|
|
7
7
|
let configs: Configs = {
|
|
8
8
|
API_KEY: RANGO_PUBLIC_API_KEY,
|
|
9
9
|
};
|
|
@@ -18,6 +18,9 @@ export function setConfig(name: keyof Configs, value: any) {
|
|
|
18
18
|
return value;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Getting new configs from params and reset the value of global `configs` with provided param.
|
|
23
|
+
*/
|
|
21
24
|
export function initConfig(nextConfigs: Configs) {
|
|
22
25
|
let clonedConfigs;
|
|
23
26
|
if (typeof structuredClone === 'function') {
|
|
@@ -28,3 +31,6 @@ export function initConfig(nextConfigs: Configs) {
|
|
|
28
31
|
configs = clonedConfigs;
|
|
29
32
|
return configs;
|
|
30
33
|
}
|
|
34
|
+
|
|
35
|
+
export const DEFAULT_PRIMARY_RADIUS = 20;
|
|
36
|
+
export const DEFAULT_SECONDARY_RADIUS = 25;
|
package/src/utils/date.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { GroupBy } from '../components/SwapsGroup/SwapsGroup.types';
|
|
2
|
+
import type { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
3
|
+
|
|
2
4
|
import dayjs from 'dayjs';
|
|
3
|
-
import { GroupBy } from '@rango-dev/ui';
|
|
4
5
|
|
|
5
|
-
export const groupSwapsByDate: GroupBy = swaps => {
|
|
6
|
+
export const groupSwapsByDate: GroupBy = (swaps) => {
|
|
6
7
|
const output: Map<
|
|
7
8
|
string,
|
|
8
9
|
{
|
|
@@ -17,24 +18,17 @@ export const groupSwapsByDate: GroupBy = swaps => {
|
|
|
17
18
|
swaps: [],
|
|
18
19
|
},
|
|
19
20
|
],
|
|
20
|
-
[
|
|
21
|
-
'week',
|
|
22
|
-
{
|
|
23
|
-
title: 'This week',
|
|
24
|
-
swaps: [],
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
21
|
[
|
|
28
22
|
'month',
|
|
29
23
|
{
|
|
30
|
-
title: '
|
|
24
|
+
title: 'Last month',
|
|
31
25
|
swaps: [],
|
|
32
26
|
},
|
|
33
27
|
],
|
|
34
28
|
[
|
|
35
29
|
'year',
|
|
36
30
|
{
|
|
37
|
-
title: '
|
|
31
|
+
title: 'Last year',
|
|
38
32
|
swaps: [],
|
|
39
33
|
},
|
|
40
34
|
],
|
|
@@ -48,14 +42,17 @@ export const groupSwapsByDate: GroupBy = swaps => {
|
|
|
48
42
|
]);
|
|
49
43
|
|
|
50
44
|
const now = dayjs();
|
|
51
|
-
swaps.forEach(swap => {
|
|
45
|
+
swaps.forEach((swap) => {
|
|
52
46
|
const swapDate = dayjs(Number(swap.creationTime));
|
|
53
|
-
if (now.isSame(swapDate, 'day'))
|
|
54
|
-
|
|
55
|
-
else if (now.isSame(swapDate, 'month'))
|
|
47
|
+
if (now.isSame(swapDate, 'day')) {
|
|
48
|
+
output.get('today')?.swaps.push(swap);
|
|
49
|
+
} else if (now.isSame(swapDate, 'month')) {
|
|
56
50
|
output.get('month')?.swaps.push(swap);
|
|
57
|
-
else if (now.isSame(swapDate, 'year'))
|
|
58
|
-
|
|
51
|
+
} else if (now.isSame(swapDate, 'year')) {
|
|
52
|
+
output.get('year')?.swaps.push(swap);
|
|
53
|
+
} else {
|
|
54
|
+
output.get('history')?.swaps.push(swap);
|
|
55
|
+
}
|
|
59
56
|
});
|
|
60
57
|
|
|
61
58
|
return Array.from(output.values());
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BlockchainMeta } from 'rango-sdk';
|
|
2
|
+
|
|
3
|
+
export function getBlockchainDisplayNameFor(
|
|
4
|
+
blockchainName: string,
|
|
5
|
+
blockchains: BlockchainMeta[]
|
|
6
|
+
): string | undefined {
|
|
7
|
+
return blockchains.find((blockchain) => blockchain.name === blockchainName)
|
|
8
|
+
?.displayName;
|
|
9
|
+
}
|
package/src/utils/numbers.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
+
|
|
3
|
+
import type { BestRouteResponse } from 'rango-sdk';
|
|
4
|
+
|
|
1
5
|
import { BigNumber } from 'bignumber.js';
|
|
2
|
-
import { BestRouteResponse } from 'rango-sdk';
|
|
3
6
|
|
|
4
7
|
export const percentToString = (p: number, fractions = 0): string =>
|
|
5
8
|
(p * 100).toFixed(fractions);
|
|
@@ -17,8 +20,12 @@ export const numberToString = (
|
|
|
17
20
|
minDecimals: number | null = null,
|
|
18
21
|
maxDecimals: number | null = null
|
|
19
22
|
): string => {
|
|
20
|
-
if (number === null || number === undefined)
|
|
21
|
-
|
|
23
|
+
if (number === null || number === undefined) {
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
if (number === '') {
|
|
27
|
+
return '';
|
|
28
|
+
}
|
|
22
29
|
const n = new BigNumber(number);
|
|
23
30
|
const roundingMode = 1;
|
|
24
31
|
let maxI = 1000;
|
|
@@ -29,8 +36,10 @@ export const numberToString = (
|
|
|
29
36
|
}
|
|
30
37
|
}
|
|
31
38
|
|
|
32
|
-
if (n.gte(10000))
|
|
33
|
-
|
|
39
|
+
if (n.gte(10000)) {
|
|
40
|
+
return n.toFormat(0, roundingMode);
|
|
41
|
+
}
|
|
42
|
+
if (n.gte(1000)) {
|
|
34
43
|
return n.toFormat(
|
|
35
44
|
Math.min(
|
|
36
45
|
maxI,
|
|
@@ -38,7 +47,8 @@ export const numberToString = (
|
|
|
38
47
|
),
|
|
39
48
|
roundingMode
|
|
40
49
|
);
|
|
41
|
-
|
|
50
|
+
}
|
|
51
|
+
if (n.gte(100)) {
|
|
42
52
|
return n.toFormat(
|
|
43
53
|
Math.min(
|
|
44
54
|
maxI,
|
|
@@ -46,7 +56,8 @@ export const numberToString = (
|
|
|
46
56
|
),
|
|
47
57
|
roundingMode
|
|
48
58
|
);
|
|
49
|
-
|
|
59
|
+
}
|
|
60
|
+
if (n.gte(1)) {
|
|
50
61
|
return n.toFormat(
|
|
51
62
|
Math.min(
|
|
52
63
|
maxI,
|
|
@@ -54,7 +65,8 @@ export const numberToString = (
|
|
|
54
65
|
),
|
|
55
66
|
roundingMode
|
|
56
67
|
);
|
|
57
|
-
|
|
68
|
+
}
|
|
69
|
+
if (n.gte(0.01)) {
|
|
58
70
|
return n.toFormat(
|
|
59
71
|
Math.min(
|
|
60
72
|
maxI,
|
|
@@ -62,8 +74,9 @@ export const numberToString = (
|
|
|
62
74
|
),
|
|
63
75
|
roundingMode
|
|
64
76
|
);
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
}
|
|
78
|
+
for (let i = minDecimals || 4; i < 17; i++) {
|
|
79
|
+
if (n.gte(Math.pow(10, -i))) {
|
|
67
80
|
return n.toFormat(
|
|
68
81
|
Math.min(
|
|
69
82
|
maxI,
|
|
@@ -71,7 +84,11 @@ export const numberToString = (
|
|
|
71
84
|
),
|
|
72
85
|
roundingMode
|
|
73
86
|
);
|
|
74
|
-
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (n.isEqualTo(0)) {
|
|
90
|
+
return '0';
|
|
91
|
+
}
|
|
75
92
|
|
|
76
93
|
return n.toFormat(
|
|
77
94
|
Math.min(maxI, Math.min(maxDecimals || 100, Math.max(minDecimals || 0, 8))),
|
|
@@ -94,18 +111,32 @@ export const uint8ArrayToHex = (buffer: Uint8Array): string => {
|
|
|
94
111
|
};
|
|
95
112
|
|
|
96
113
|
export function dollarToConciseString(num: number | undefined): string {
|
|
97
|
-
if (!num)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (num <
|
|
101
|
-
|
|
102
|
-
|
|
114
|
+
if (!num) {
|
|
115
|
+
return '-';
|
|
116
|
+
}
|
|
117
|
+
if (num < 1) {
|
|
118
|
+
return ' < 1$';
|
|
119
|
+
}
|
|
120
|
+
if (num < 1000) {
|
|
121
|
+
return numberToString(new BigNumber(num)) + '$';
|
|
122
|
+
}
|
|
123
|
+
if (num < 10_000) {
|
|
124
|
+
return parseInt((num / 100).toString()) / 10 + 'K';
|
|
125
|
+
}
|
|
126
|
+
if (num < 1_000_000) {
|
|
127
|
+
return parseInt((num / 1000).toString()) + 'K';
|
|
128
|
+
}
|
|
129
|
+
if (num < 100_000_000) {
|
|
130
|
+
return parseInt((num / 100000).toString()) / 10 + 'M';
|
|
131
|
+
}
|
|
103
132
|
return parseInt((num / 1000000).toString()) + 'M';
|
|
104
133
|
}
|
|
105
134
|
|
|
106
135
|
export function removeExtraDecimals(num: string, maxDecimals: number): string {
|
|
107
136
|
try {
|
|
108
|
-
if (!num.includes('.'))
|
|
137
|
+
if (!num.includes('.')) {
|
|
138
|
+
return num;
|
|
139
|
+
}
|
|
109
140
|
const [b, f] = num.split('.');
|
|
110
141
|
if (f && f.length > maxDecimals) {
|
|
111
142
|
return `${b}.${f.substring(0, maxDecimals)}`;
|
|
@@ -116,8 +147,9 @@ export function removeExtraDecimals(num: string, maxDecimals: number): string {
|
|
|
116
147
|
}
|
|
117
148
|
}
|
|
118
149
|
|
|
119
|
-
export const totalArrivalTime = (
|
|
120
|
-
data
|
|
150
|
+
export const totalArrivalTime = (
|
|
151
|
+
data: { estimatedTimeInSeconds: number | null }[] | undefined
|
|
152
|
+
) => data?.reduce((a, b) => a + (b.estimatedTimeInSeconds ?? 0), 0) || 0;
|
|
121
153
|
|
|
122
154
|
export const rawFees = (data: BestRouteResponse): string =>
|
|
123
155
|
(
|
|
@@ -134,3 +166,17 @@ export const containsText = (text: string, searchText: string) =>
|
|
|
134
166
|
export const isPositiveNumber = (text?: string) =>
|
|
135
167
|
!!text && parseFloat(text) > 0;
|
|
136
168
|
10;
|
|
169
|
+
|
|
170
|
+
export function limitDecimalPlaces(
|
|
171
|
+
numberString: string,
|
|
172
|
+
maxDecimalPlaces = 4
|
|
173
|
+
): string {
|
|
174
|
+
const number = parseFloat(numberString);
|
|
175
|
+
if (isNaN(number)) {
|
|
176
|
+
return numberString;
|
|
177
|
+
} // Return the original string if it's not a valid number
|
|
178
|
+
|
|
179
|
+
const multiplier = Math.pow(10, maxDecimalPlaces);
|
|
180
|
+
const roundedNumber = Math.round(number * multiplier) / multiplier;
|
|
181
|
+
return roundedNumber.toString();
|
|
182
|
+
}
|
package/src/utils/routing.ts
CHANGED
|
@@ -1,29 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
+
import type { BestRouteEqualityParams, Wallet } from '../types';
|
|
3
|
+
import type { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
4
|
+
import type { PriceImpactWarningLevel } from '@rango-dev/ui';
|
|
5
|
+
import type {
|
|
2
6
|
SimulationAssetAndAmount,
|
|
3
7
|
SimulationValidationStatus,
|
|
4
8
|
} from '@rango-dev/ui/dist/widget/ui/src/types/swaps';
|
|
9
|
+
import type {
|
|
10
|
+
Asset,
|
|
11
|
+
BestRouteResponse,
|
|
12
|
+
BlockchainMeta,
|
|
13
|
+
Token,
|
|
14
|
+
} from 'rango-sdk';
|
|
15
|
+
|
|
5
16
|
import BigNumber from 'bignumber.js';
|
|
6
|
-
|
|
17
|
+
|
|
18
|
+
import {
|
|
19
|
+
GAS_FEE_MAX_DECIMALS,
|
|
20
|
+
GAS_FEE_MIN_DECIMALS,
|
|
21
|
+
HIGHT_PRICE_IMPACT,
|
|
22
|
+
LOW_PRICE_IMPACT,
|
|
23
|
+
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
24
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
25
|
+
} from '../constants/routing';
|
|
26
|
+
|
|
7
27
|
import { areEqual } from './common';
|
|
8
|
-
import { BestRouteEqualityParams, Wallet } from '../types';
|
|
9
28
|
import { numberToString } from './numbers';
|
|
10
|
-
import { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
11
29
|
|
|
12
30
|
export function searchParamsToToken(
|
|
13
31
|
tokens: Token[],
|
|
14
32
|
searchParams: string | null,
|
|
15
33
|
chain: BlockchainMeta | null
|
|
16
34
|
): Token | null {
|
|
17
|
-
if (!chain)
|
|
35
|
+
if (!chain) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
18
38
|
return (
|
|
19
39
|
tokens.find((token) => {
|
|
20
40
|
const symbolAndAddress = searchParams?.split('--');
|
|
21
|
-
if (symbolAndAddress?.length === 1)
|
|
41
|
+
if (symbolAndAddress?.length === 1) {
|
|
22
42
|
return (
|
|
23
43
|
token.symbol === symbolAndAddress[0] &&
|
|
24
44
|
token.address === null &&
|
|
25
45
|
token.blockchain === chain.name
|
|
26
46
|
);
|
|
47
|
+
}
|
|
27
48
|
return (
|
|
28
49
|
token.symbol === symbolAndAddress?.[0] &&
|
|
29
50
|
token.address === symbolAndAddress?.[1] &&
|
|
@@ -98,14 +119,18 @@ export function getRequiredBalanceOfWallet(
|
|
|
98
119
|
selectedWallet: Wallet,
|
|
99
120
|
fee: SimulationValidationStatus[] | null
|
|
100
121
|
): SimulationAssetAndAmount[] | null {
|
|
101
|
-
if (fee === null)
|
|
122
|
+
if (fee === null) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
102
125
|
const relatedFeeStatus = fee
|
|
103
126
|
?.find((item) => item.blockchain === selectedWallet.chain)
|
|
104
127
|
?.wallets.find(
|
|
105
128
|
(wallet) =>
|
|
106
129
|
wallet.address?.toLowerCase() === selectedWallet.address.toLowerCase()
|
|
107
130
|
);
|
|
108
|
-
if (!relatedFeeStatus)
|
|
131
|
+
if (!relatedFeeStatus) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
109
134
|
return relatedFeeStatus.requiredAssets;
|
|
110
135
|
}
|
|
111
136
|
|
|
@@ -115,8 +140,8 @@ export function isRouteParametersChanged(params: BestRouteEqualityParams) {
|
|
|
115
140
|
return (
|
|
116
141
|
!!currentState.fromToken &&
|
|
117
142
|
!!currentState.toToken &&
|
|
118
|
-
(prevState.
|
|
119
|
-
prevState.
|
|
143
|
+
(prevState.fromBlockchain?.name !== currentState.fromBlockchain?.name ||
|
|
144
|
+
prevState.toBlockchain?.name !== currentState.toBlockchain?.name ||
|
|
120
145
|
prevState.fromToken?.symbol !== currentState.fromToken?.symbol ||
|
|
121
146
|
prevState.toToken?.symbol !== currentState.toToken?.symbol ||
|
|
122
147
|
prevState.fromToken?.blockchain !== prevState.fromToken?.blockchain ||
|
|
@@ -139,47 +164,100 @@ export function isRouteParametersChanged(params: BestRouteEqualityParams) {
|
|
|
139
164
|
return false;
|
|
140
165
|
}
|
|
141
166
|
|
|
142
|
-
export function
|
|
167
|
+
export function getFormattedBestRoute(
|
|
143
168
|
bestRoute: BestRouteResponse | null
|
|
144
169
|
): BestRouteResponse | null {
|
|
145
|
-
if (!bestRoute)
|
|
170
|
+
if (!bestRoute) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
146
173
|
|
|
147
|
-
const
|
|
174
|
+
const formattedSwaps = (bestRoute.result?.swaps || []).map((swap) => ({
|
|
148
175
|
...swap,
|
|
149
|
-
fromAmount: numberToString(
|
|
150
|
-
|
|
176
|
+
fromAmount: numberToString(
|
|
177
|
+
swap.fromAmount,
|
|
178
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
179
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
180
|
+
),
|
|
181
|
+
toAmount: numberToString(
|
|
182
|
+
swap.toAmount,
|
|
183
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
184
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
185
|
+
),
|
|
151
186
|
}));
|
|
152
187
|
|
|
153
188
|
return {
|
|
154
189
|
...bestRoute,
|
|
155
190
|
...(bestRoute.result && {
|
|
156
|
-
result: { ...bestRoute.result, swaps:
|
|
191
|
+
result: { ...bestRoute.result, swaps: formattedSwaps },
|
|
157
192
|
}),
|
|
158
193
|
};
|
|
159
194
|
}
|
|
160
195
|
|
|
161
|
-
export function
|
|
162
|
-
const
|
|
196
|
+
export function getFormattedPendingSwap(pendingSwap: PendingSwap): PendingSwap {
|
|
197
|
+
const formattedSteps = pendingSwap.steps.map((step) => ({
|
|
163
198
|
...step,
|
|
164
|
-
feeInUsd: numberToString(
|
|
165
|
-
|
|
199
|
+
feeInUsd: numberToString(
|
|
200
|
+
step.feeInUsd,
|
|
201
|
+
GAS_FEE_MIN_DECIMALS,
|
|
202
|
+
GAS_FEE_MAX_DECIMALS
|
|
203
|
+
),
|
|
204
|
+
outputAmount: numberToString(
|
|
205
|
+
step.outputAmount,
|
|
206
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
207
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
208
|
+
),
|
|
166
209
|
expectedOutputAmountHumanReadable: numberToString(
|
|
167
210
|
step.expectedOutputAmountHumanReadable,
|
|
168
|
-
|
|
169
|
-
|
|
211
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
212
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
170
213
|
),
|
|
171
214
|
}));
|
|
172
215
|
|
|
173
216
|
return {
|
|
174
217
|
...pendingSwap,
|
|
175
|
-
inputAmount: numberToString(
|
|
176
|
-
|
|
218
|
+
inputAmount: numberToString(
|
|
219
|
+
pendingSwap.inputAmount,
|
|
220
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
221
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
222
|
+
),
|
|
223
|
+
steps: formattedSteps,
|
|
177
224
|
};
|
|
178
225
|
}
|
|
179
226
|
|
|
180
227
|
//todo: refactor bestRoute store and add loadingStatus
|
|
181
228
|
export const getBestRouteStatus = (loading: boolean, error: boolean) => {
|
|
182
|
-
if (loading)
|
|
183
|
-
|
|
184
|
-
|
|
229
|
+
if (loading) {
|
|
230
|
+
return 'loading';
|
|
231
|
+
}
|
|
232
|
+
if (error) {
|
|
233
|
+
return 'failed';
|
|
234
|
+
}
|
|
235
|
+
return 'success';
|
|
185
236
|
};
|
|
237
|
+
|
|
238
|
+
export function getPriceImpactLevel(
|
|
239
|
+
priceImpact: number
|
|
240
|
+
): PriceImpactWarningLevel {
|
|
241
|
+
let warningLevel: PriceImpactWarningLevel = undefined;
|
|
242
|
+
if (priceImpact <= LOW_PRICE_IMPACT && priceImpact > HIGHT_PRICE_IMPACT) {
|
|
243
|
+
warningLevel = 'low';
|
|
244
|
+
} else if (priceImpact <= HIGHT_PRICE_IMPACT) {
|
|
245
|
+
warningLevel = 'high';
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return warningLevel;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export function findCommonTokens<T extends Asset[], R extends Asset[]>(
|
|
252
|
+
listA: T,
|
|
253
|
+
listB: R
|
|
254
|
+
) {
|
|
255
|
+
const tokenToString = (token: Asset): string =>
|
|
256
|
+
`${token.symbol}-${token.blockchain}-${token.address ?? ''}`;
|
|
257
|
+
|
|
258
|
+
const set = new Set();
|
|
259
|
+
|
|
260
|
+
listA.forEach((token) => set.add(tokenToString(token)));
|
|
261
|
+
|
|
262
|
+
return listB.filter((token) => set.has(tokenToString(token))) as R;
|
|
263
|
+
}
|