@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
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { WidgetConfig } from '../../types';
|
|
2
|
+
import type { StateCreator } from 'zustand';
|
|
3
|
+
|
|
4
|
+
const initConfig: WidgetConfig = { apiKey: '' };
|
|
5
|
+
|
|
6
|
+
export type ConfigSlice = {
|
|
7
|
+
config: WidgetConfig;
|
|
8
|
+
|
|
9
|
+
updateConfig: (config: WidgetConfig) => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const createConfigSlice: StateCreator<ConfigSlice> = (set, get) => ({
|
|
13
|
+
config: initConfig,
|
|
14
|
+
|
|
15
|
+
// Actions
|
|
16
|
+
updateConfig: (nextConfig: WidgetConfig) => {
|
|
17
|
+
const currentConfig = get().config;
|
|
18
|
+
|
|
19
|
+
set({
|
|
20
|
+
config: {
|
|
21
|
+
...currentConfig,
|
|
22
|
+
...nextConfig,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
// We keep all the received data from server in this slice
|
|
2
|
+
|
|
3
|
+
import type { ConfigSlice } from './config';
|
|
4
|
+
import type { BlockchainMeta, SwapperMeta, Token } from 'rango-sdk';
|
|
5
|
+
import type { StateCreator } from 'zustand';
|
|
6
|
+
|
|
7
|
+
import { httpService as sdk } from '../../services/httpService';
|
|
8
|
+
import { containsText } from '../../utils/common';
|
|
9
|
+
import { tokensAreEqual } from '../../utils/wallets';
|
|
10
|
+
|
|
11
|
+
type BlockchainOptions = {
|
|
12
|
+
type?: 'source' | 'destination';
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type TokenOptions = {
|
|
16
|
+
type?: 'source' | 'destination';
|
|
17
|
+
// filter by an specific blockchain
|
|
18
|
+
blockchain?: string;
|
|
19
|
+
searchFor?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export interface DataSlice {
|
|
23
|
+
_blockchains: BlockchainMeta[];
|
|
24
|
+
_tokens: Token[];
|
|
25
|
+
_popularTokens: Token[];
|
|
26
|
+
_swappers: SwapperMeta[];
|
|
27
|
+
|
|
28
|
+
blockchains: (options?: BlockchainOptions) => BlockchainMeta[];
|
|
29
|
+
tokens: (options?: TokenOptions) => Token[];
|
|
30
|
+
isTokenPinned: (token: Token) => boolean;
|
|
31
|
+
|
|
32
|
+
fetch: () => Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const createDataSlice: StateCreator<
|
|
36
|
+
DataSlice & ConfigSlice,
|
|
37
|
+
[],
|
|
38
|
+
[],
|
|
39
|
+
DataSlice
|
|
40
|
+
> = (set, get) => ({
|
|
41
|
+
// State
|
|
42
|
+
_blockchains: [],
|
|
43
|
+
_tokens: [],
|
|
44
|
+
_popularTokens: [],
|
|
45
|
+
_swappers: [],
|
|
46
|
+
|
|
47
|
+
// Selectors
|
|
48
|
+
blockchains: (options) => {
|
|
49
|
+
const blockchainsFromState = get()._blockchains;
|
|
50
|
+
|
|
51
|
+
if (!options || !options?.type) {
|
|
52
|
+
return blockchainsFromState;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const config = get().config;
|
|
56
|
+
const supportedBlockchainsFromConfig =
|
|
57
|
+
(options.type === 'source'
|
|
58
|
+
? config.from?.blockchains
|
|
59
|
+
: config.to?.blockchains) ?? [];
|
|
60
|
+
|
|
61
|
+
const list = blockchainsFromState.filter((blockchain) => {
|
|
62
|
+
if (
|
|
63
|
+
supportedBlockchainsFromConfig.length > 0 &&
|
|
64
|
+
!supportedBlockchainsFromConfig.includes(blockchain.name)
|
|
65
|
+
) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return true;
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
return list;
|
|
73
|
+
},
|
|
74
|
+
tokens: (options) => {
|
|
75
|
+
const tokensFromState = get()._tokens;
|
|
76
|
+
|
|
77
|
+
if (!options || !options?.type) {
|
|
78
|
+
return tokensFromState;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const config = get().config;
|
|
82
|
+
const supportedTokensFromConfig =
|
|
83
|
+
(options.type === 'source' ? config.from?.tokens : config.to?.tokens) ??
|
|
84
|
+
[];
|
|
85
|
+
const blockchains = get().blockchains({
|
|
86
|
+
type: options.type,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const list = tokensFromState
|
|
90
|
+
.filter((token) => {
|
|
91
|
+
// If there is a list of tokens in config, we only keep them.
|
|
92
|
+
if (
|
|
93
|
+
supportedTokensFromConfig.length > 0 &&
|
|
94
|
+
!supportedTokensFromConfig.some((asset) => {
|
|
95
|
+
return tokensAreEqual(asset, token);
|
|
96
|
+
})
|
|
97
|
+
) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// If a specific blockchain has passed, we only keep that blockchain's tokens.
|
|
102
|
+
if (!!options.blockchain && token.blockchain !== options.blockchain) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Check only available blockchains
|
|
107
|
+
if (
|
|
108
|
+
!blockchains.some((blockchain) => {
|
|
109
|
+
return blockchain.name === token.blockchain;
|
|
110
|
+
})
|
|
111
|
+
) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Search functionality
|
|
116
|
+
if (options.searchFor) {
|
|
117
|
+
if (
|
|
118
|
+
containsText(token.symbol, options.searchFor) ||
|
|
119
|
+
containsText(token.address || '', options.searchFor) ||
|
|
120
|
+
containsText(token.name || '', options.searchFor)
|
|
121
|
+
) {
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return true;
|
|
129
|
+
})
|
|
130
|
+
.sort((a, b) => {
|
|
131
|
+
// Check pinned tokens
|
|
132
|
+
if (get().isTokenPinned(a)) {
|
|
133
|
+
return -1;
|
|
134
|
+
}
|
|
135
|
+
if (get().isTokenPinned(b)) {
|
|
136
|
+
return 1;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Check secondary coins
|
|
140
|
+
if (a.isSecondaryCoin) {
|
|
141
|
+
return 1;
|
|
142
|
+
}
|
|
143
|
+
if (b.isSecondaryCoin) {
|
|
144
|
+
return -1;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Check it has an address or not.
|
|
148
|
+
if (!a.address && b.address) {
|
|
149
|
+
return -1;
|
|
150
|
+
}
|
|
151
|
+
if (a.address && !b.address) {
|
|
152
|
+
return 1;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return 0;
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
return list;
|
|
159
|
+
},
|
|
160
|
+
isTokenPinned: (token) => {
|
|
161
|
+
const pinned = !!get().config.pinnedTokens?.some((pinnedToken) =>
|
|
162
|
+
tokensAreEqual(pinnedToken, token)
|
|
163
|
+
);
|
|
164
|
+
return pinned;
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
// Actions
|
|
168
|
+
fetch: async () => {
|
|
169
|
+
const response = await sdk().getAllMetadata();
|
|
170
|
+
|
|
171
|
+
const blockchains: BlockchainMeta[] = [];
|
|
172
|
+
const tokens: Token[] = [];
|
|
173
|
+
const popularTokens: Token[] = response.popularTokens;
|
|
174
|
+
const swappers: SwapperMeta[] = response.swappers;
|
|
175
|
+
|
|
176
|
+
const blockchainsWithAtLeastOneToken = new Set();
|
|
177
|
+
|
|
178
|
+
response.tokens.forEach((token) => {
|
|
179
|
+
blockchainsWithAtLeastOneToken.add(token.blockchain);
|
|
180
|
+
|
|
181
|
+
tokens.push(token);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
response.blockchains.forEach((blockchain) => {
|
|
185
|
+
if (
|
|
186
|
+
blockchain.enabled &&
|
|
187
|
+
blockchainsWithAtLeastOneToken.has(blockchain.name)
|
|
188
|
+
) {
|
|
189
|
+
blockchains.push(blockchain);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// Sort
|
|
194
|
+
blockchains.sort((a, b) => a.sort - b.sort);
|
|
195
|
+
|
|
196
|
+
set({
|
|
197
|
+
_blockchains: blockchains,
|
|
198
|
+
_tokens: tokens,
|
|
199
|
+
_popularTokens: popularTokens,
|
|
200
|
+
_swappers: swappers,
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
});
|
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
|
}))
|
package/src/store/wallets.ts
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { WalletType } from '@rango-dev/wallets-shared';
|
|
1
|
+
import type { Wallet } from '../types';
|
|
2
|
+
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
3
|
+
|
|
3
4
|
import { create } from 'zustand';
|
|
4
5
|
import { subscribeWithSelector } from 'zustand/middleware';
|
|
5
|
-
|
|
6
|
+
|
|
6
7
|
import { httpService } from '../services/httpService';
|
|
7
8
|
import {
|
|
8
|
-
getRequiredChains,
|
|
9
|
-
getTokensWithBalance,
|
|
10
9
|
isAccountAndWalletMatched,
|
|
11
10
|
makeBalanceFor,
|
|
12
11
|
resetConnectedWalletState,
|
|
13
|
-
sortTokens,
|
|
14
12
|
} from '../utils/wallets';
|
|
15
|
-
|
|
13
|
+
|
|
16
14
|
import { useMetaStore } from './meta';
|
|
17
15
|
import createSelectors from './selectors';
|
|
18
|
-
import { Wallet } from '../types';
|
|
19
16
|
|
|
20
17
|
export type TokenBalance = {
|
|
21
18
|
chain: string;
|
|
@@ -31,100 +28,107 @@ export type TokenBalance = {
|
|
|
31
28
|
|
|
32
29
|
export interface ConnectedWallet extends Wallet {
|
|
33
30
|
balances: TokenBalance[] | null;
|
|
31
|
+
explorerUrl: string | null;
|
|
32
|
+
selected: boolean;
|
|
34
33
|
loading: boolean;
|
|
35
34
|
error: boolean;
|
|
36
|
-
explorerUrl: string | null;
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
interface WalletsStore {
|
|
40
38
|
connectedWallets: ConnectedWallet[];
|
|
41
|
-
selectedWallets: Wallet[];
|
|
42
39
|
customDestination: string;
|
|
40
|
+
loading: boolean;
|
|
43
41
|
connectWallet: (accounts: Wallet[]) => void;
|
|
44
42
|
disconnectWallet: (walletType: WalletType) => void;
|
|
45
|
-
|
|
46
|
-
setSelectedWallet: (wallet: SelectableWallet) => void;
|
|
43
|
+
selectWallets: (wallets: { walletType: string; chain: string }[]) => void;
|
|
47
44
|
clearConnectedWallet: () => void;
|
|
48
45
|
getWalletsDetails: (accounts: Wallet[], shouldRetry?: boolean) => void;
|
|
49
|
-
setCustomDestination: (customDestination: string) => void;
|
|
50
46
|
}
|
|
51
47
|
|
|
52
48
|
export const useWalletsStore = createSelectors(
|
|
53
49
|
create<WalletsStore>()(
|
|
54
50
|
subscribeWithSelector((set, get) => ({
|
|
55
51
|
connectedWallets: [],
|
|
56
|
-
selectedWallets: [],
|
|
57
52
|
customDestination: '',
|
|
53
|
+
loading: false,
|
|
58
54
|
connectWallet: (accounts) => {
|
|
59
55
|
const getWalletsDetails = get().getWalletsDetails;
|
|
60
56
|
set((state) => ({
|
|
57
|
+
loading: true,
|
|
61
58
|
connectedWallets: state.connectedWallets
|
|
62
59
|
.filter((wallet) => wallet.walletType !== accounts[0].walletType)
|
|
63
60
|
.concat(
|
|
64
|
-
accounts.map((account) =>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
61
|
+
accounts.map((account) => {
|
|
62
|
+
const shouldMarkWalletAsSelected = !state.connectedWallets.find(
|
|
63
|
+
(connectedWallet) =>
|
|
64
|
+
connectedWallet.chain === account.chain &&
|
|
65
|
+
connectedWallet.selected
|
|
66
|
+
);
|
|
67
|
+
return {
|
|
68
|
+
balances: [],
|
|
69
|
+
address: account.address,
|
|
70
|
+
chain: account.chain,
|
|
71
|
+
explorerUrl: null,
|
|
72
|
+
walletType: account.walletType,
|
|
73
|
+
selected: shouldMarkWalletAsSelected,
|
|
74
|
+
loading: true,
|
|
75
|
+
error: false,
|
|
76
|
+
};
|
|
77
|
+
})
|
|
73
78
|
),
|
|
74
79
|
}));
|
|
75
80
|
getWalletsDetails(accounts);
|
|
76
81
|
},
|
|
77
82
|
disconnectWallet: (walletType) => {
|
|
78
|
-
set((state) => ({
|
|
79
|
-
connectedWallets: state.connectedWallets.filter(
|
|
80
|
-
(balance) => balance.walletType !== walletType
|
|
81
|
-
),
|
|
82
|
-
selectedWallets: state.selectedWallets.filter(
|
|
83
|
-
(wallet) => wallet.walletType != walletType
|
|
84
|
-
),
|
|
85
|
-
}));
|
|
86
|
-
},
|
|
87
|
-
initSelectedWallets: () =>
|
|
88
83
|
set((state) => {
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
(wallet) => wallet.chain === chain
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
if (!anyWalletSelected) {
|
|
100
|
-
const firstWalletWithMatchedChain = connectedWallets.find(
|
|
101
|
-
(wallet) => wallet.chain === chain
|
|
102
|
-
);
|
|
103
|
-
if (!!firstWalletWithMatchedChain)
|
|
104
|
-
selectedWallets.push({
|
|
105
|
-
address: firstWalletWithMatchedChain.address,
|
|
106
|
-
chain: firstWalletWithMatchedChain.chain,
|
|
107
|
-
walletType: firstWalletWithMatchedChain.walletType,
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
});
|
|
84
|
+
const selectedWallets = state.connectedWallets
|
|
85
|
+
.filter(
|
|
86
|
+
(connectedWallet) =>
|
|
87
|
+
connectedWallet.selected &&
|
|
88
|
+
connectedWallet.walletType !== walletType
|
|
89
|
+
)
|
|
90
|
+
.map((selectedWallet) => selectedWallet.chain);
|
|
111
91
|
return {
|
|
112
|
-
|
|
92
|
+
connectedWallets: state.connectedWallets
|
|
93
|
+
.filter(
|
|
94
|
+
(connectedWallet) => connectedWallet.walletType !== walletType
|
|
95
|
+
)
|
|
96
|
+
.map((connectedWallet) => {
|
|
97
|
+
const anyWalletSelectedForBlockchain = selectedWallets.includes(
|
|
98
|
+
connectedWallet.chain
|
|
99
|
+
);
|
|
100
|
+
if (anyWalletSelectedForBlockchain) {
|
|
101
|
+
return connectedWallet;
|
|
102
|
+
}
|
|
103
|
+
selectedWallets.push(connectedWallet.chain);
|
|
104
|
+
return { ...connectedWallet, selected: true };
|
|
105
|
+
}),
|
|
113
106
|
};
|
|
114
|
-
})
|
|
115
|
-
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
selectWallets: (wallets) =>
|
|
116
110
|
set((state) => ({
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
111
|
+
connectedWallets: state.connectedWallets.map((connectedWallet) => {
|
|
112
|
+
const walletSelected = !!wallets.find(
|
|
113
|
+
(wallet) =>
|
|
114
|
+
wallet.chain === connectedWallet.chain &&
|
|
115
|
+
wallet.walletType !== connectedWallet.walletType &&
|
|
116
|
+
connectedWallet.selected
|
|
117
|
+
);
|
|
118
|
+
const walletNotSelected = !!wallets.find(
|
|
119
|
+
(wallet) =>
|
|
120
|
+
wallet.chain === connectedWallet.chain &&
|
|
121
|
+
wallet.walletType === connectedWallet.walletType &&
|
|
122
|
+
!connectedWallet.selected
|
|
123
|
+
);
|
|
124
|
+
if (walletSelected) {
|
|
125
|
+
return { ...connectedWallet, selected: false };
|
|
126
|
+
} else if (walletNotSelected) {
|
|
127
|
+
return { ...connectedWallet, selected: true };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return connectedWallet;
|
|
131
|
+
}),
|
|
128
132
|
})),
|
|
129
133
|
clearConnectedWallet: () =>
|
|
130
134
|
set(() => ({
|
|
@@ -135,6 +139,7 @@ export const useWalletsStore = createSelectors(
|
|
|
135
139
|
const getWalletsDetails = get().getWalletsDetails;
|
|
136
140
|
const { tokens } = useMetaStore.getState().meta;
|
|
137
141
|
set((state) => ({
|
|
142
|
+
loading: true,
|
|
138
143
|
connectedWallets: state.connectedWallets.map((wallet) => {
|
|
139
144
|
return accounts.find((account) =>
|
|
140
145
|
isAccountAndWalletMatched(account, wallet)
|
|
@@ -149,39 +154,46 @@ export const useWalletsStore = createSelectors(
|
|
|
149
154
|
blockchain: chain,
|
|
150
155
|
}));
|
|
151
156
|
const response = await httpService().getWalletsDetails(data);
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
157
|
+
const retrievedBalance = response.wallets;
|
|
158
|
+
if (retrievedBalance) {
|
|
154
159
|
set((state) => ({
|
|
160
|
+
loading: false,
|
|
155
161
|
connectedWallets: state.connectedWallets.map(
|
|
156
162
|
(connectedWallet) => {
|
|
157
163
|
const matchedAccount = accounts.find((account) =>
|
|
158
164
|
isAccountAndWalletMatched(account, connectedWallet)
|
|
159
165
|
);
|
|
160
|
-
const
|
|
166
|
+
const retrievedBalanceAccount = retrievedBalance.find(
|
|
161
167
|
(balance) =>
|
|
162
168
|
balance.address === connectedWallet.address &&
|
|
163
169
|
balance.blockChain === connectedWallet.chain
|
|
164
170
|
);
|
|
165
171
|
if (
|
|
166
|
-
|
|
172
|
+
retrievedBalanceAccount?.failed &&
|
|
167
173
|
matchedAccount &&
|
|
168
174
|
shouldRetry
|
|
169
175
|
) {
|
|
170
176
|
getWalletsDetails([matchedAccount], false);
|
|
171
177
|
}
|
|
172
|
-
return matchedAccount &&
|
|
173
|
-
?
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
+
return matchedAccount && retrievedBalanceAccount
|
|
179
|
+
? {
|
|
180
|
+
...connectedWallet,
|
|
181
|
+
explorerUrl: retrievedBalanceAccount.explorerUrl,
|
|
182
|
+
balances: makeBalanceFor(
|
|
183
|
+
retrievedBalanceAccount,
|
|
184
|
+
tokens
|
|
185
|
+
),
|
|
186
|
+
}
|
|
178
187
|
: connectedWallet;
|
|
179
188
|
}
|
|
180
189
|
),
|
|
181
190
|
}));
|
|
182
|
-
} else
|
|
191
|
+
} else {
|
|
192
|
+
throw new Error('Wallet not found');
|
|
193
|
+
}
|
|
183
194
|
} catch (error) {
|
|
184
195
|
set((state) => ({
|
|
196
|
+
loading: false,
|
|
185
197
|
connectedWallets: state.connectedWallets.map((balance) => {
|
|
186
198
|
return accounts.find((account) =>
|
|
187
199
|
isAccountAndWalletMatched(account, balance)
|
|
@@ -196,28 +208,5 @@ export const useWalletsStore = createSelectors(
|
|
|
196
208
|
)
|
|
197
209
|
);
|
|
198
210
|
|
|
199
|
-
useWalletsStore.subscribe(
|
|
200
|
-
(state) => state.connectedWallets,
|
|
201
|
-
(connectedWallets) => {
|
|
202
|
-
useBestRouteStore.setState(({ sourceTokens, destinationTokens }) => {
|
|
203
|
-
const sourceTokensWithBalance = getTokensWithBalance(
|
|
204
|
-
sourceTokens,
|
|
205
|
-
connectedWallets
|
|
206
|
-
);
|
|
207
|
-
const destinationTokensWithBalance = getTokensWithBalance(
|
|
208
|
-
destinationTokens,
|
|
209
|
-
connectedWallets
|
|
210
|
-
);
|
|
211
|
-
return {
|
|
212
|
-
sourceTokens: sortTokens(sourceTokensWithBalance),
|
|
213
|
-
destinationTokens: sortTokens(destinationTokensWithBalance),
|
|
214
|
-
};
|
|
215
|
-
});
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
equalityFn: shallow,
|
|
219
|
-
}
|
|
220
|
-
);
|
|
221
|
-
|
|
222
211
|
export const fetchingBalanceSelector = (state: WalletsStore) =>
|
|
223
212
|
!!state.connectedWallets.find((wallet) => wallet.loading);
|
package/src/types/config.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { Language } from '@rango-dev/ui';
|
|
2
|
+
import type { ProviderInterface } from '@rango-dev/wallets-react';
|
|
3
|
+
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
4
|
+
import type { Asset } from 'rango-sdk';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The above type defines a set of optional color properties for a widget.
|
|
@@ -13,7 +13,7 @@ import { Language } from '@rango-dev/ui';
|
|
|
13
13
|
* @property {string} warning
|
|
14
14
|
* @property {string} surface
|
|
15
15
|
* @property {string} neutral
|
|
16
|
-
|
|
16
|
+
*
|
|
17
17
|
*/
|
|
18
18
|
export type WidgetColors = {
|
|
19
19
|
background?: string;
|
|
@@ -38,6 +38,8 @@ export type WidgetColors = {
|
|
|
38
38
|
* border color
|
|
39
39
|
* @property {number} borderRadius - `borderRadius` is a property of the `WidgetTheme` type that
|
|
40
40
|
* specifies the radius of the corners of a widget.
|
|
41
|
+
* @property {number} secondaryBorderRadius - `secondaryBorderRadius` is a property of the `WidgetTheme` type that
|
|
42
|
+
* specifies the radius of the buttons of a widget.
|
|
41
43
|
* @property {number} width - The `width` property is a number that represents the width of the widget.
|
|
42
44
|
* @property {number} height - The `height` property is a number that specifies the height of the widget.
|
|
43
45
|
* @property {boolean} singleTheme - The `singleTheme` property is a boolean that specifies the theme is support dark and light or only light.
|
|
@@ -47,6 +49,7 @@ export type WidgetTheme = {
|
|
|
47
49
|
fontFamily?: string;
|
|
48
50
|
colors?: { light: WidgetColors; dark: WidgetColors };
|
|
49
51
|
borderRadius?: number;
|
|
52
|
+
secondaryBorderRadius?: number;
|
|
50
53
|
width?: number;
|
|
51
54
|
height?: number;
|
|
52
55
|
singleTheme?: boolean;
|
|
@@ -93,7 +96,7 @@ export type BlockchainAndTokenConfig = {
|
|
|
93
96
|
* and theme.
|
|
94
97
|
*
|
|
95
98
|
* @property {string} apiKey - The API key used to communicate with Rango API
|
|
96
|
-
* @property {WidgeAffiliate} affiliate - If you want to charge users fee per transaction, you should
|
|
99
|
+
* @property {WidgeAffiliate} affiliate - If you want to charge users fee per transaction, you should
|
|
97
100
|
* pass `WidgetAffiliate` including affiliateRef, affiliatePercent, and affiliateWallets.
|
|
98
101
|
* @property {number} amount - The default input amount.
|
|
99
102
|
* @property {BlockchainAndTokenConfig} from - The `from` property is an optional property of type
|
|
@@ -121,7 +124,8 @@ export type BlockchainAndTokenConfig = {
|
|
|
121
124
|
* that defines the various properties of the theme, such as colors, fonts, and others.
|
|
122
125
|
* @property {boolean} externalWallets
|
|
123
126
|
* If `externalWallets` is `true`, you should add `WidgetWallets` to your app.
|
|
124
|
-
|
|
127
|
+
* @property {Asset} pinnedTokens - The `pinnedTokens` property is an optional array of `Asset` objects that
|
|
128
|
+
* you could use to pin tokens of your choice to the top of the token list.
|
|
125
129
|
*/
|
|
126
130
|
export type WidgetConfig = {
|
|
127
131
|
apiKey: string;
|
|
@@ -137,4 +141,5 @@ export type WidgetConfig = {
|
|
|
137
141
|
language?: Language;
|
|
138
142
|
theme?: WidgetTheme;
|
|
139
143
|
externalWallets?: boolean;
|
|
144
|
+
pinnedTokens?: Asset[];
|
|
140
145
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type Route,
|
|
3
|
+
type RouteEvent,
|
|
4
|
+
type Step,
|
|
5
|
+
type StepEvent,
|
|
6
|
+
StepExecutionBlockedEventStatus,
|
|
7
|
+
} from '@rango-dev/queue-manager-rango-preset';
|
|
8
|
+
|
|
9
|
+
type NotificationRoute = {
|
|
10
|
+
from: {
|
|
11
|
+
blockchain: Step['fromBlockchain'];
|
|
12
|
+
tokenSymbol: Step['fromSymbol'];
|
|
13
|
+
tokenAddress: Step['fromSymbolAddress'];
|
|
14
|
+
};
|
|
15
|
+
to: {
|
|
16
|
+
blockchain: Step['toBlockchain'];
|
|
17
|
+
tokenSymbol: Step['toSymbol'];
|
|
18
|
+
tokenAddress: Step['toSymbolAddress'];
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type Notification = Pick<Route, 'requestId'> & {
|
|
23
|
+
event: RouteEvent | StepEvent;
|
|
24
|
+
creationTime: number;
|
|
25
|
+
read: boolean;
|
|
26
|
+
route: NotificationRoute;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const validBlockedStatuses: StepExecutionBlockedEventStatus[] = [
|
|
30
|
+
StepExecutionBlockedEventStatus.WAITING_FOR_CHANGE_WALLET_ACCOUNT,
|
|
31
|
+
StepExecutionBlockedEventStatus.WAITING_FOR_NETWORK_CHANGE,
|
|
32
|
+
StepExecutionBlockedEventStatus.WAITING_FOR_WALLET_CONNECT,
|
|
33
|
+
];
|