@rango-dev/widget-embedded 0.18.0 → 0.19.0
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/CHANGELOG.md +1 -113
- package/dist/QueueManager.d.ts +2 -5
- package/dist/QueueManager.d.ts.map +1 -1
- package/dist/Wallets.d.ts +17 -0
- package/dist/Wallets.d.ts.map +1 -0
- package/dist/Widget.d.ts +9 -0
- package/dist/Widget.d.ts.map +1 -0
- package/dist/components/AppRouter.d.ts +2 -0
- package/dist/components/AppRouter.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts +6 -1
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +3 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +62 -691
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +3 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +4 -1
- package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
- package/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
- package/dist/components/Layout/Layout.types.d.ts +2 -2
- package/dist/components/Layout/Layout.types.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +0 -1727
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +4 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.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/{NoResult/NoResult.styles.d.ts → NoRoutes/NoRoutes.styles.d.ts} +1 -1
- package/dist/components/{NoResult/NoResult.styles.d.ts.map → NoRoutes/NoRoutes.styles.d.ts.map} +1 -1
- package/dist/components/{NoResult/NoResult.types.d.ts → NoRoutes/NoRoutes.types.d.ts} +3 -3
- 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.map +1 -1
- package/dist/components/RouteErrors/RouteErrors.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -0
- package/dist/components/{QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts → RouteErrors/RouteErrors.styles.d.ts} +1 -1
- 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/Slippage/Slippage.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.styles.d.ts +0 -158
- package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +1 -1
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +0 -628
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +0 -157
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.helpers.d.ts +2 -2
- package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.styles.d.ts +1 -1100
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.types.d.ts +9 -4
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
- package/dist/components/TokenList/index.d.ts +1 -0
- package/dist/components/TokenList/index.d.ts.map +1 -1
- package/dist/components/UpdateUrl.d.ts +6 -1
- package/dist/components/UpdateUrl.d.ts.map +1 -1
- package/dist/components/WidgetEvents.d.ts.map +1 -1
- package/dist/constants/errors.d.ts +4 -4
- package/dist/constants/errors.d.ts.map +1 -1
- package/dist/constants/index.d.ts +0 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/messages.d.ts +1 -1
- package/dist/constants/navigationRoutes.d.ts +2 -1
- package/dist/constants/navigationRoutes.d.ts.map +1 -1
- package/dist/constants/searchParams.d.ts +1 -2
- package/dist/constants/searchParams.d.ts.map +1 -1
- package/dist/constants/warnings.d.ts +2 -2
- package/dist/constants/warnings.d.ts.map +1 -1
- package/dist/hooks/{useConfirmSwap/useConfirmSwap.types.d.ts → useConfirmSwap.d.ts} +7 -5
- package/dist/hooks/useConfirmSwap.d.ts.map +1 -0
- package/dist/hooks/{useFetchQuote.d.ts → useFetchBestRoute.d.ts} +3 -3
- package/dist/hooks/useFetchBestRoute.d.ts.map +1 -0
- package/dist/hooks/useLanguage.d.ts +1 -1
- package/dist/hooks/useLanguage.d.ts.map +1 -1
- package/dist/hooks/useNavigateBack.d.ts +3 -1
- package/dist/hooks/useNavigateBack.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.d.ts +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts +2 -2
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +7 -5
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts +0 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts +1 -5
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts.map +1 -1
- package/dist/hooks/useSwapInput.d.ts +2 -4
- package/dist/hooks/useSwapInput.d.ts.map +1 -1
- package/dist/hooks/useSyncStoresWithConfig.d.ts +2 -1
- package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
- package/dist/hooks/useTheme.d.ts +1 -1
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts.map +1 -1
- package/dist/index.d.ts +8 -20
- package/dist/index.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 -1
- 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.map +1 -1
- package/dist/pages/LiquiditySourcePage.d.ts +2 -1
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
- package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
- package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts +6 -1
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
- package/dist/pages/ThemePage.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts +8 -1
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/app.d.ts +22 -41
- package/dist/store/app.d.ts.map +1 -1
- package/dist/store/bestRoute.d.ts +77 -0
- package/dist/store/bestRoute.d.ts.map +1 -0
- package/dist/store/meta.d.ts +23 -0
- package/dist/store/meta.d.ts.map +1 -0
- package/dist/store/notification.d.ts +3 -4
- package/dist/store/notification.d.ts.map +1 -1
- package/dist/store/settings.d.ts +81 -0
- package/dist/store/settings.d.ts.map +1 -0
- package/dist/store/slices/config.d.ts +2 -3
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/slices/data.d.ts +2 -5
- package/dist/store/slices/data.d.ts.map +1 -1
- package/dist/store/ui.d.ts +1 -2
- package/dist/store/ui.d.ts.map +1 -1
- package/dist/store/wallets.d.ts +9 -14
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +8 -41
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/routing.d.ts +65 -0
- package/dist/types/routing.d.ts.map +1 -0
- package/dist/types/swap.d.ts +14 -4
- package/dist/types/swap.d.ts.map +1 -1
- package/dist/types/wallets.d.ts +1 -15
- package/dist/types/wallets.d.ts.map +1 -1
- package/dist/utils/colors.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +0 -1
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +1 -2
- package/dist/utils/meta.d.ts.map +1 -1
- package/dist/utils/numbers.d.ts +1 -1
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/providers.d.ts +2 -2
- package/dist/utils/providers.d.ts.map +1 -1
- package/dist/utils/queue.d.ts +2 -2
- package/dist/utils/queue.d.ts.map +1 -1
- package/dist/utils/routing.d.ts +28 -0
- package/dist/utils/routing.d.ts.map +1 -0
- package/dist/utils/settings.d.ts +2 -6
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +24 -35
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/time.d.ts +1 -1
- package/dist/utils/time.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +10 -9
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +10 -12
- package/src/QueueManager.tsx +17 -18
- package/src/{containers/Wallets/Wallets.tsx → Wallets.tsx} +34 -48
- package/src/Widget.tsx +119 -0
- package/src/components/AppRouter.tsx +32 -8
- package/src/components/AppRoutes.tsx +69 -57
- package/src/components/BlockchainList/BlockchainList.styles.ts +2 -2
- package/src/components/BlockchainList/BlockchainList.tsx +4 -4
- package/src/components/BlockchainsSection/BlockchainsSection.styles.ts +1 -1
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +17 -26
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +64 -2
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +10 -29
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +47 -43
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +3 -1
- package/src/components/ConfirmWalletsModal/WalletList.tsx +8 -9
- package/src/components/ConfirmWalletsModal/WalletList.type.ts +4 -1
- package/src/components/HeaderButtons/HomeButtons.tsx +18 -28
- package/src/components/Layout/Layout.styles.ts +0 -2
- package/src/components/Layout/Layout.tsx +7 -20
- package/src/components/Layout/Layout.types.ts +2 -2
- package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +41 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +61 -65
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +34 -28
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +3 -0
- package/src/components/{NoResult/NoResult.helpers.ts → NoRoutes/NoRoutes.helper.ts} +16 -23
- package/src/components/{NoResult/NoResult.styles.ts → NoRoutes/NoRoutes.styles.ts} +0 -2
- package/src/components/{NoResult/NoResult.tsx → NoRoutes/NoRoutes.tsx} +17 -12
- package/src/components/{NoResult/NoResult.types.ts → NoRoutes/NoRoutes.types.ts} +2 -3
- package/src/components/NoRoutes/index.ts +1 -0
- package/src/components/NotificationContent/NotificationContent.tsx +3 -5
- package/src/components/{QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts → RouteErrors/RouteErrors.styles.ts} +1 -8
- 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/{QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx → RouteErrors/RouteErrorsModalItem.tsx} +4 -4
- package/src/components/RouteErrors/index.ts +1 -0
- package/src/components/Slippage/Slippage.styles.ts +5 -15
- package/src/components/Slippage/Slippage.tsx +10 -11
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +8 -5
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.styles.ts +33 -36
- package/src/components/SwapDetails/SwapDetails.tsx +56 -41
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.tsx +1 -1
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +3 -4
- package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +2 -2
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +8 -14
- package/src/components/SwapDetailsModal/SwapDetailsModal.helpers.tsx +1 -1
- package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +1 -1
- package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +1 -1
- package/src/components/SwapsGroup/SwapsGroup.styles.ts +1 -10
- package/src/components/SwapsGroup/SwapsGroup.tsx +5 -3
- package/src/components/SwitchFromAndTo.tsx +2 -2
- package/src/components/TokenList/TokenList.helpers.ts +2 -2
- package/src/components/TokenList/TokenList.styles.ts +38 -74
- package/src/components/TokenList/TokenList.tsx +26 -35
- package/src/components/TokenList/TokenList.types.ts +10 -4
- package/src/components/TokenList/index.ts +1 -0
- package/src/components/UpdateUrl.tsx +30 -35
- package/src/components/WidgetEvents.tsx +2 -4
- package/src/constants/errors.ts +15 -17
- package/src/constants/index.ts +0 -1
- package/src/constants/messages.ts +1 -1
- package/src/constants/navigationRoutes.ts +8 -7
- package/src/constants/searchParams.ts +0 -1
- package/src/constants/warnings.ts +7 -7
- package/src/hooks/useConfirmSwap.ts +303 -0
- package/src/hooks/{useFetchQuote.ts → useFetchBestRoute.ts} +3 -3
- package/src/hooks/useLanguage.ts +5 -4
- package/src/hooks/useNavigateBack.ts +52 -3
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -1
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.ts +7 -37
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +0 -60
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +3 -78
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.ts +6 -15
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.ts +1 -6
- package/src/hooks/useSwapInput.ts +48 -141
- package/src/hooks/useSyncStoresWithConfig.ts +24 -40
- package/src/hooks/useTheme.ts +5 -4
- package/src/hooks/useWalletList.ts +5 -3
- package/src/index.ts +5 -53
- package/src/pages/ConfirmSwapPage.tsx +266 -117
- package/src/pages/HistoryPage.tsx +7 -2
- package/src/pages/Home.tsx +303 -88
- package/src/pages/LanguagePage.tsx +5 -0
- package/src/pages/LiquiditySourcePage.tsx +37 -24
- package/src/pages/SelectBlockchainPage.tsx +24 -31
- package/src/pages/SelectSwapItemsPage.tsx +31 -18
- package/src/pages/SettingsPage.tsx +27 -32
- package/src/pages/SwapDetailsPage.tsx +7 -6
- package/src/pages/ThemePage.tsx +7 -2
- package/src/pages/WalletsPage.tsx +19 -9
- package/src/services/httpService.ts +1 -1
- package/src/store/app.ts +6 -44
- package/src/store/{quote.ts → bestRoute.ts} +64 -71
- package/src/store/meta.ts +39 -0
- package/src/store/settings.ts +158 -0
- package/src/store/slices/config.ts +15 -26
- package/src/store/slices/data.ts +35 -74
- package/src/store/wallets.ts +37 -68
- package/src/types/config.ts +8 -53
- package/src/types/index.ts +1 -1
- package/src/types/routing.ts +77 -0
- package/src/types/swap.ts +13 -4
- package/src/types/wallets.ts +1 -18
- package/src/utils/colors.ts +1 -2
- package/src/utils/configs.ts +1 -2
- package/src/utils/date.ts +1 -1
- package/src/utils/meta.ts +1 -8
- package/src/utils/numbers.ts +1 -1
- package/src/utils/providers.ts +5 -8
- package/src/utils/queue.ts +2 -2
- package/src/utils/routing.ts +321 -0
- package/src/utils/settings.ts +10 -17
- package/src/utils/swap.ts +120 -154
- package/src/utils/time.ts +1 -1
- package/src/utils/wallets.ts +161 -156
- package/dist/components/NoResult/NoResult.d.ts +0 -4
- package/dist/components/NoResult/NoResult.d.ts.map +0 -1
- package/dist/components/NoResult/NoResult.helpers.d.ts +0 -4
- package/dist/components/NoResult/NoResult.helpers.d.ts.map +0 -1
- package/dist/components/NoResult/NoResult.types.d.ts.map +0 -1
- package/dist/components/NoResult/index.d.ts +0 -2
- package/dist/components/NoResult/index.d.ts.map +0 -1
- package/dist/components/Quote/Quote.d.ts +0 -4
- package/dist/components/Quote/Quote.d.ts.map +0 -1
- package/dist/components/Quote/Quote.styles.d.ts +0 -2217
- package/dist/components/Quote/Quote.styles.d.ts.map +0 -1
- package/dist/components/Quote/Quote.types.d.ts +0 -21
- package/dist/components/Quote/Quote.types.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSummary.d.ts +0 -11
- package/dist/components/Quote/QuoteSummary.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSummary.styles.d.ts +0 -315
- package/dist/components/Quote/QuoteSummary.styles.d.ts.map +0 -1
- package/dist/components/Quote/index.d.ts +0 -3
- package/dist/components/Quote/index.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.d.ts +0 -4
- package/dist/components/QuoteSkeleton/QuoteSkeleton.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +0 -633
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts +0 -6
- package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts +0 -4
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +0 -1571
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts +0 -6
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/StepSkeleton.d.ts +0 -4
- package/dist/components/QuoteSkeleton/StepSkeleton.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +0 -786
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts +0 -4
- package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/index.d.ts +0 -4
- package/dist/components/QuoteSkeleton/index.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts +0 -11
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts +0 -4
- package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts +0 -4
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts +0 -9
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +0 -23
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +0 -11
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +0 -11
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/index.d.ts +0 -2
- package/dist/components/QuoteWarningsAndErrors/index.d.ts.map +0 -1
- package/dist/containers/App/App.d.ts +0 -3
- package/dist/containers/App/App.d.ts.map +0 -1
- package/dist/containers/App/App.styles.d.ts +0 -158
- package/dist/containers/App/App.styles.d.ts.map +0 -1
- package/dist/containers/App/index.d.ts +0 -2
- package/dist/containers/App/index.d.ts.map +0 -1
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts +0 -4
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +0 -1
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +0 -788
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +0 -1
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +0 -20
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +0 -1
- package/dist/containers/QuoteInfo/index.d.ts +0 -2
- package/dist/containers/QuoteInfo/index.d.ts.map +0 -1
- package/dist/containers/Wallets/Wallets.d.ts +0 -6
- package/dist/containers/Wallets/Wallets.d.ts.map +0 -1
- package/dist/containers/Wallets/Wallets.types.d.ts +0 -11
- package/dist/containers/Wallets/Wallets.types.d.ts.map +0 -1
- package/dist/containers/Wallets/index.d.ts +0 -2
- package/dist/containers/Wallets/index.d.ts.map +0 -1
- package/dist/containers/Widget/Widget.d.ts +0 -5
- package/dist/containers/Widget/Widget.d.ts.map +0 -1
- package/dist/containers/Widget/Widget.types.d.ts +0 -5
- package/dist/containers/Widget/Widget.types.d.ts.map +0 -1
- package/dist/containers/Widget/index.d.ts +0 -3
- package/dist/containers/Widget/index.d.ts.map +0 -1
- package/dist/containers/WidgetInfo/WidgetInfo.d.ts +0 -6
- package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +0 -1
- package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts +0 -20
- package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts.map +0 -1
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +0 -21
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +0 -1
- package/dist/containers/WidgetInfo/index.d.ts +0 -2
- package/dist/containers/WidgetInfo/index.d.ts.map +0 -1
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts +0 -5
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +0 -1
- package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts +0 -7
- package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts.map +0 -1
- package/dist/containers/WidgetProvider/index.d.ts +0 -2
- package/dist/containers/WidgetProvider/index.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap/index.d.ts +0 -2
- package/dist/hooks/useConfirmSwap/index.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts +0 -3
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +0 -19
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +0 -1
- package/dist/hooks/useFetchQuote.d.ts.map +0 -1
- package/dist/hooks/useForceAutoConnect.d.ts +0 -2
- package/dist/hooks/useForceAutoConnect.d.ts.map +0 -1
- package/dist/store/AppStore.d.ts +0 -47
- package/dist/store/AppStore.d.ts.map +0 -1
- package/dist/store/quote.d.ts +0 -89
- package/dist/store/quote.d.ts.map +0 -1
- package/dist/store/slices/settings.d.ts +0 -39
- package/dist/store/slices/settings.d.ts.map +0 -1
- package/dist/types/quote.d.ts +0 -82
- package/dist/types/quote.d.ts.map +0 -1
- package/dist/utils/quote.d.ts +0 -32
- package/dist/utils/quote.d.ts.map +0 -1
- package/src/components/NoResult/index.ts +0 -1
- package/src/components/Quote/Quote.styles.ts +0 -249
- package/src/components/Quote/Quote.tsx +0 -414
- package/src/components/Quote/Quote.types.ts +0 -15
- package/src/components/Quote/QuoteSummary.styles.ts +0 -16
- package/src/components/Quote/QuoteSummary.tsx +0 -46
- package/src/components/Quote/index.ts +0 -2
- package/src/components/QuoteSkeleton/QuoteSkeleton.styles.ts +0 -42
- package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +0 -30
- package/src/components/QuoteSkeleton/QuoteSkeleton.types.ts +0 -5
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.styles.ts +0 -57
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.tsx +0 -76
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.types.ts +0 -6
- package/src/components/QuoteSkeleton/StepSkeleton.styles.ts +0 -33
- package/src/components/QuoteSkeleton/StepSkeleton.tsx +0 -44
- package/src/components/QuoteSkeleton/StepSkeleton.types.ts +0 -1
- package/src/components/QuoteSkeleton/index.ts +0 -3
- package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +0 -107
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +0 -74
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +0 -103
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +0 -25
- package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +0 -77
- package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +0 -38
- package/src/components/QuoteWarningsAndErrors/index.ts +0 -1
- package/src/containers/App/App.styles.ts +0 -18
- package/src/containers/App/App.tsx +0 -52
- package/src/containers/App/index.ts +0 -1
- package/src/containers/QuoteInfo/QuoteInfo.styles.ts +0 -31
- package/src/containers/QuoteInfo/QuoteInfo.tsx +0 -99
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +0 -20
- package/src/containers/QuoteInfo/index.ts +0 -1
- package/src/containers/Wallets/Wallets.types.ts +0 -12
- package/src/containers/Wallets/index.ts +0 -1
- package/src/containers/Widget/Widget.tsx +0 -19
- package/src/containers/Widget/Widget.types.ts +0 -5
- package/src/containers/Widget/index.ts +0 -2
- package/src/containers/WidgetInfo/WidgetInfo.helpers.ts +0 -64
- package/src/containers/WidgetInfo/WidgetInfo.tsx +0 -62
- package/src/containers/WidgetInfo/WidgetInfo.types.ts +0 -21
- package/src/containers/WidgetInfo/index.ts +0 -1
- package/src/containers/WidgetProvider/WidgetProvider.tsx +0 -28
- package/src/containers/WidgetProvider/WidgetProvider.types.ts +0 -7
- package/src/containers/WidgetProvider/index.ts +0 -1
- package/src/hooks/useConfirmSwap/index.ts +0 -1
- package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +0 -172
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +0 -137
- package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +0 -19
- package/src/hooks/useForceAutoConnect.ts +0 -27
- package/src/store/AppStore.tsx +0 -41
- package/src/store/slices/settings.ts +0 -168
- package/src/types/quote.ts +0 -107
- package/src/utils/quote.ts +0 -338
|
@@ -7,18 +7,16 @@ import {
|
|
|
7
7
|
Divider,
|
|
8
8
|
Image,
|
|
9
9
|
Skeleton,
|
|
10
|
-
Tooltip,
|
|
11
10
|
Typography,
|
|
12
11
|
} from '@rango-dev/ui';
|
|
13
12
|
import React from 'react';
|
|
14
13
|
|
|
15
14
|
import { BLOCKCHAIN_LIST_SIZE } from '../../constants/configs';
|
|
16
15
|
import { usePrepareBlockchainList } from '../../hooks/usePrepareBlockchainList';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { getContainer } from '../../utils/common';
|
|
16
|
+
import { useBestRouteStore } from '../../store/bestRoute';
|
|
17
|
+
import { useMetaStore } from '../../store/meta';
|
|
20
18
|
|
|
21
|
-
import {
|
|
19
|
+
import { Container } from './BlockchainsSection.styles';
|
|
22
20
|
|
|
23
21
|
const NUMBER_OF_LOADING = 12;
|
|
24
22
|
|
|
@@ -29,9 +27,9 @@ export function BlockchainsSection(props: PropTypes) {
|
|
|
29
27
|
selected: blockchain?.name,
|
|
30
28
|
});
|
|
31
29
|
|
|
32
|
-
const
|
|
33
|
-
const resetToBlockchain =
|
|
34
|
-
const resetFromBlockchain =
|
|
30
|
+
const loadingStatus = useMetaStore.use.loadingStatus();
|
|
31
|
+
const resetToBlockchain = useBestRouteStore.use.resetToBlockchain();
|
|
32
|
+
const resetFromBlockchain = useBestRouteStore.use.resetFromBlockchain();
|
|
35
33
|
const hasMoreItemsInList = blockchainsList.more.length > 0;
|
|
36
34
|
/**
|
|
37
35
|
* When only one item is left on list, we will not show the `More` button and will show the item itself instead.
|
|
@@ -40,18 +38,18 @@ export function BlockchainsSection(props: PropTypes) {
|
|
|
40
38
|
const showMoreButton = !onlyOneItemInList && hasMoreItemsInList;
|
|
41
39
|
|
|
42
40
|
return (
|
|
43
|
-
|
|
41
|
+
<div>
|
|
44
42
|
<Divider size={12} />
|
|
45
43
|
<Typography variant="label" size="large">
|
|
46
44
|
{i18n.t('Select Blockchain')}
|
|
47
45
|
</Typography>
|
|
48
46
|
<Divider size={12} />
|
|
49
|
-
<
|
|
50
|
-
{
|
|
47
|
+
<Container>
|
|
48
|
+
{loadingStatus === 'loading' &&
|
|
51
49
|
Array.from(Array(NUMBER_OF_LOADING), (e) => (
|
|
52
50
|
<Skeleton key={e} variant="rounded" height={50} />
|
|
53
51
|
))}
|
|
54
|
-
{
|
|
52
|
+
{loadingStatus === 'success' && (
|
|
55
53
|
<>
|
|
56
54
|
<BlockchainsChip
|
|
57
55
|
selected={!blockchain}
|
|
@@ -67,19 +65,12 @@ export function BlockchainsSection(props: PropTypes) {
|
|
|
67
65
|
</Typography>
|
|
68
66
|
</BlockchainsChip>
|
|
69
67
|
{blockchainsList.list.map((item) => (
|
|
70
|
-
<
|
|
68
|
+
<BlockchainsChip
|
|
71
69
|
key={item.name}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
<BlockchainsChip
|
|
77
|
-
key={item.name}
|
|
78
|
-
selected={!!blockchain && blockchain.name === item.name}
|
|
79
|
-
onClick={() => onChange(item)}>
|
|
80
|
-
<Image src={item.logo} size={30} />
|
|
81
|
-
</BlockchainsChip>
|
|
82
|
-
</Tooltip>
|
|
70
|
+
selected={!!blockchain && blockchain.name === item.name}
|
|
71
|
+
onClick={() => onChange(item)}>
|
|
72
|
+
<Image src={item.logo} size={30} />
|
|
73
|
+
</BlockchainsChip>
|
|
83
74
|
))}
|
|
84
75
|
|
|
85
76
|
{onlyOneItemInList ? (
|
|
@@ -105,7 +96,7 @@ export function BlockchainsSection(props: PropTypes) {
|
|
|
105
96
|
) : null}
|
|
106
97
|
</>
|
|
107
98
|
)}
|
|
108
|
-
</
|
|
109
|
-
|
|
99
|
+
</Container>
|
|
100
|
+
</div>
|
|
110
101
|
);
|
|
111
102
|
}
|
|
@@ -1,9 +1,71 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
+
import type { Step } from '@rango-dev/ui/dist/widget/ui/src/components/BestRoute/BestRoute.types';
|
|
1
3
|
import type { BestRouteResponse, BlockchainMeta } from 'rango-sdk';
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
import {
|
|
6
|
+
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
7
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
8
|
+
USD_VALUE_MAX_DECIMALS,
|
|
9
|
+
USD_VALUE_MIN_DECIMALS,
|
|
10
|
+
} from '../../constants/routing';
|
|
11
|
+
import { getBlockchainShortNameFor } from '../../utils/meta';
|
|
12
|
+
import { numberToString } from '../../utils/numbers';
|
|
13
|
+
|
|
14
|
+
export function formatBestRoute(
|
|
15
|
+
bestRoute: BestRouteResponse,
|
|
16
|
+
blockchains: BlockchainMeta[]
|
|
17
|
+
): Step[] | undefined {
|
|
18
|
+
return bestRoute.result?.swaps.map((swap) => {
|
|
19
|
+
return {
|
|
20
|
+
swapper: { displayName: swap.swapperId, image: swap.swapperLogo },
|
|
21
|
+
from: {
|
|
22
|
+
token: { displayName: swap.from.symbol, image: swap.from.logo },
|
|
23
|
+
chain: {
|
|
24
|
+
displayName:
|
|
25
|
+
getBlockchainShortNameFor(swap.from.blockchain, blockchains) ?? '',
|
|
26
|
+
image: swap.from.blockchainLogo,
|
|
27
|
+
},
|
|
28
|
+
price: {
|
|
29
|
+
value: numberToString(
|
|
30
|
+
swap.fromAmount,
|
|
31
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
32
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
33
|
+
),
|
|
34
|
+
usdValue: numberToString(
|
|
35
|
+
swap.from.usdPrice?.toString(),
|
|
36
|
+
USD_VALUE_MIN_DECIMALS,
|
|
37
|
+
USD_VALUE_MAX_DECIMALS
|
|
38
|
+
),
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
to: {
|
|
42
|
+
token: { displayName: swap.to.symbol, image: swap.to.logo },
|
|
43
|
+
chain: {
|
|
44
|
+
displayName:
|
|
45
|
+
getBlockchainShortNameFor(swap.to.blockchain, blockchains) ?? '',
|
|
46
|
+
image: swap.to.blockchainLogo,
|
|
47
|
+
},
|
|
48
|
+
price: {
|
|
49
|
+
value: numberToString(
|
|
50
|
+
swap.toAmount,
|
|
51
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
52
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
53
|
+
),
|
|
54
|
+
usdValue: numberToString(
|
|
55
|
+
swap.to.usdPrice?.toString(),
|
|
56
|
+
USD_VALUE_MIN_DECIMALS,
|
|
57
|
+
USD_VALUE_MAX_DECIMALS
|
|
58
|
+
),
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function getRequiredWallets(route: BestRouteResponse | null): string[] {
|
|
4
66
|
const wallets: string[] = [];
|
|
5
67
|
|
|
6
|
-
|
|
68
|
+
route?.result?.swaps.forEach((swap) => {
|
|
7
69
|
const currentStepFromBlockchain = swap.from.blockchain;
|
|
8
70
|
const currentStepToBlockchain = swap.to.blockchain;
|
|
9
71
|
let lastAddedWallet = wallets[wallets.length - 1];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as Collapsible from '@radix-ui/react-collapsible';
|
|
2
2
|
import {
|
|
3
3
|
Button,
|
|
4
|
-
css,
|
|
5
4
|
darkTheme,
|
|
6
5
|
IconButton,
|
|
7
6
|
keyframes,
|
|
@@ -37,13 +36,10 @@ export const Title = styled('div', {
|
|
|
37
36
|
});
|
|
38
37
|
|
|
39
38
|
export const ListContainer = styled('div', {
|
|
40
|
-
display: '
|
|
41
|
-
justifyContent: 'space-evenly',
|
|
42
|
-
alignItems: 'center',
|
|
39
|
+
display: 'grid',
|
|
43
40
|
gap: '$10',
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
height: '100%',
|
|
41
|
+
gridTemplateColumns: ' repeat(3, minmax(0, 1fr))',
|
|
42
|
+
alignContent: 'baseline',
|
|
47
43
|
});
|
|
48
44
|
|
|
49
45
|
export const WalletButton = styled('button', {
|
|
@@ -88,12 +84,6 @@ export const WalletButton = styled('button', {
|
|
|
88
84
|
},
|
|
89
85
|
},
|
|
90
86
|
});
|
|
91
|
-
|
|
92
|
-
export const ShowMoreWallets = styled(WalletButton, {
|
|
93
|
-
alignSelf: 'stretch',
|
|
94
|
-
minHeight: '93px',
|
|
95
|
-
});
|
|
96
|
-
|
|
97
87
|
export const Trigger = styled(Collapsible.Trigger, {
|
|
98
88
|
padding: '$0',
|
|
99
89
|
border: 'none',
|
|
@@ -120,16 +110,12 @@ export const NavigateBack = styled(IconButton, {
|
|
|
120
110
|
|
|
121
111
|
export const WalletsContainer = styled('div', {
|
|
122
112
|
paddingTop: '$20',
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
gap: '$10',
|
|
130
|
-
flexWrap: 'wrap',
|
|
131
|
-
paddingTop: '$5',
|
|
132
|
-
height: '100%',
|
|
113
|
+
'& .wallets-list': {
|
|
114
|
+
display: 'grid',
|
|
115
|
+
gap: '$10',
|
|
116
|
+
gridTemplateColumns: ' repeat(3, minmax(0, 1fr))',
|
|
117
|
+
alignContent: 'baseline',
|
|
118
|
+
},
|
|
133
119
|
});
|
|
134
120
|
|
|
135
121
|
export const CollapsibleRoot = styled(Collapsible.Root, {
|
|
@@ -179,15 +165,12 @@ export const CustomDestination = styled('div', {
|
|
|
179
165
|
padding: '$10 $0',
|
|
180
166
|
'& .button__content': {
|
|
181
167
|
display: 'flex',
|
|
168
|
+
justifyContent: 'center',
|
|
182
169
|
alignItems: 'center',
|
|
183
170
|
},
|
|
184
171
|
'& .alarms': { paddingTop: '5px' },
|
|
185
172
|
});
|
|
186
173
|
|
|
187
|
-
export const alarmsStyles = css({
|
|
188
|
-
paddingTop: '5px',
|
|
189
|
-
});
|
|
190
|
-
|
|
191
174
|
export const ExpandedIcon = styled('div', {
|
|
192
175
|
transition: `all ${EXPANDABLE_TRANSITION_DURATION}ms ease`,
|
|
193
176
|
variants: {
|
|
@@ -207,12 +190,10 @@ export const ConfirmButton = styled('div', {
|
|
|
207
190
|
});
|
|
208
191
|
|
|
209
192
|
export const StyledTextField = styled(TextField, {
|
|
210
|
-
backgroundColor: '$neutral100',
|
|
211
193
|
padding: '$0 $15 $15 $15',
|
|
212
194
|
});
|
|
213
195
|
|
|
214
196
|
export const CollapsibleContent = styled(Collapsible.Content, {
|
|
215
|
-
backgroundColor: '$neutral100',
|
|
216
197
|
overflow: 'hidden',
|
|
217
198
|
variants: {
|
|
218
199
|
open: {
|
|
@@ -18,17 +18,16 @@ import {
|
|
|
18
18
|
import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
19
19
|
import { useNavigate } from 'react-router-dom';
|
|
20
20
|
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
21
|
+
import { getConfirmSwapErrorMessage } from '../../constants/errors';
|
|
22
|
+
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
23
|
+
import { getRouteWarningMessage } from '../../constants/warnings';
|
|
24
|
+
import { useBestRouteStore } from '../../store/bestRoute';
|
|
25
|
+
import { useMetaStore } from '../../store/meta';
|
|
25
26
|
import { useWalletsStore } from '../../store/wallets';
|
|
26
|
-
import { getBlockchainShortNameFor } from '../../utils/meta';
|
|
27
27
|
import { confirmSwapDisabled } from '../../utils/swap';
|
|
28
28
|
|
|
29
29
|
import { getRequiredWallets, isValidAddress } from './ConfirmWallets.helpers';
|
|
30
30
|
import {
|
|
31
|
-
alarmsStyles,
|
|
32
31
|
CollapsibleContent,
|
|
33
32
|
CollapsibleRoot,
|
|
34
33
|
ConfirmButton,
|
|
@@ -44,7 +43,6 @@ import {
|
|
|
44
43
|
Trigger,
|
|
45
44
|
Wallets,
|
|
46
45
|
WalletsContainer,
|
|
47
|
-
walletsListStyles,
|
|
48
46
|
} from './ConfirmWallets.styles';
|
|
49
47
|
import { WalletList } from './WalletList';
|
|
50
48
|
|
|
@@ -52,24 +50,23 @@ const NUMBER_OF_WALLETS_TO_DISPLAY = 2;
|
|
|
52
50
|
|
|
53
51
|
export function ConfirmWalletsModal(props: PropTypes) {
|
|
54
52
|
//TODO: move component's logics to a custom hook
|
|
55
|
-
const { open, onClose, onCancel, onCheckBalance, loading } = props;
|
|
56
|
-
const
|
|
57
|
-
const blockchains = useAppStore().blockchains();
|
|
53
|
+
const { open, onClose, onCancel, onCheckBalance, config, loading } = props;
|
|
54
|
+
const { blockchains } = useMetaStore.use.meta();
|
|
58
55
|
const {
|
|
59
|
-
|
|
60
|
-
setSelectedWallets:
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
bestRoute,
|
|
57
|
+
setSelectedWallets: selectRouteWallets,
|
|
58
|
+
routeWalletsConfirmed,
|
|
59
|
+
setRouteWalletConfirmed,
|
|
63
60
|
customDestination,
|
|
64
61
|
setCustomDestination,
|
|
65
|
-
} =
|
|
62
|
+
} = useBestRouteStore();
|
|
66
63
|
const { connectedWallets, selectWallets } = useWalletsStore();
|
|
67
64
|
|
|
68
65
|
const [showMoreWalletFor, setShowMoreWalletFor] = useState('');
|
|
69
66
|
const [balanceWarnings, setBalanceWarnings] = useState<string[]>([]);
|
|
70
67
|
const [error, setError] = useState('');
|
|
71
|
-
const [
|
|
72
|
-
ConfirmSwapWarnings['
|
|
68
|
+
const [routeWarning, setRouteWarning] = useState<
|
|
69
|
+
ConfirmSwapWarnings['route'] | null
|
|
73
70
|
>(null);
|
|
74
71
|
const [destination, setDestination] = useState(customDestination);
|
|
75
72
|
const [showCustomDestination, setShowCustomDestination] = useState(
|
|
@@ -77,15 +74,22 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
77
74
|
);
|
|
78
75
|
const customDestinationRef = useRef<HTMLDivElement | null>(null);
|
|
79
76
|
|
|
80
|
-
const requiredWallets = getRequiredWallets(
|
|
77
|
+
const requiredWallets = getRequiredWallets(bestRoute);
|
|
78
|
+
const customDestinationEnabled =
|
|
79
|
+
typeof config?.customDestination === 'undefined'
|
|
80
|
+
? true
|
|
81
|
+
: config.customDestination;
|
|
81
82
|
|
|
82
83
|
const lastStepToBlockchain = blockchains.find(
|
|
83
84
|
(blockchain) =>
|
|
84
85
|
blockchain.name ===
|
|
85
|
-
|
|
86
|
+
bestRoute?.result?.swaps[bestRoute?.result?.swaps.length - 1].to
|
|
87
|
+
.blockchain
|
|
86
88
|
);
|
|
87
89
|
const isWalletRequiredFor = (blockchain: string) =>
|
|
88
|
-
!!
|
|
90
|
+
!!bestRoute?.result?.swaps.find(
|
|
91
|
+
(swap) => swap.from.blockchain === blockchain
|
|
92
|
+
);
|
|
89
93
|
|
|
90
94
|
const [selectableWallets, setSelectableWallets] = useState<ConnectedWallet[]>(
|
|
91
95
|
connectedWallets.filter((connectedWallet) => {
|
|
@@ -171,16 +175,16 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
171
175
|
(wallet) => wallet.selected
|
|
172
176
|
);
|
|
173
177
|
selectWallets(lastSelectedWallets);
|
|
174
|
-
|
|
178
|
+
selectRouteWallets(lastSelectedWallets);
|
|
175
179
|
setCustomDestination(destination);
|
|
176
|
-
|
|
180
|
+
setRouteWalletConfirmed(true);
|
|
177
181
|
onClose();
|
|
178
182
|
};
|
|
179
183
|
|
|
180
184
|
const onConfirmWallets = async () => {
|
|
181
185
|
setBalanceWarnings([]);
|
|
182
186
|
setError('');
|
|
183
|
-
|
|
187
|
+
setRouteWarning(null);
|
|
184
188
|
const selectedWallets = connectedWallets.filter((connectedWallet) =>
|
|
185
189
|
selectableWallets.find(
|
|
186
190
|
(selectableWallet) =>
|
|
@@ -197,11 +201,11 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
197
201
|
if (warnings?.balance?.messages) {
|
|
198
202
|
setBalanceWarnings(warnings.balance.messages);
|
|
199
203
|
}
|
|
200
|
-
if (warnings?.
|
|
201
|
-
|
|
204
|
+
if (warnings?.route) {
|
|
205
|
+
setRouteWarning(warnings.route);
|
|
202
206
|
}
|
|
203
207
|
if (result.error) {
|
|
204
|
-
setError(
|
|
208
|
+
setError(getConfirmSwapErrorMessage(result.error));
|
|
205
209
|
}
|
|
206
210
|
|
|
207
211
|
if (!result.error && (!warnings?.balance?.messages.length || 0 > 0)) {
|
|
@@ -245,9 +249,8 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
245
249
|
<Modal
|
|
246
250
|
open={open}
|
|
247
251
|
onClose={() => {
|
|
248
|
-
if (!
|
|
249
|
-
|
|
250
|
-
navigate(home, { replace: true });
|
|
252
|
+
if (!routeWalletsConfirmed) {
|
|
253
|
+
navigate(navigationRoutes.home, { replace: true });
|
|
251
254
|
}
|
|
252
255
|
onClose();
|
|
253
256
|
}}
|
|
@@ -262,7 +265,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
262
265
|
loading,
|
|
263
266
|
showCustomDestination,
|
|
264
267
|
destination,
|
|
265
|
-
|
|
268
|
+
bestRoute,
|
|
266
269
|
selectableWallets,
|
|
267
270
|
lastStepToBlockchain
|
|
268
271
|
)}
|
|
@@ -288,12 +291,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
288
291
|
<Typography variant="headline" size="small">
|
|
289
292
|
{i18n.t({
|
|
290
293
|
id: 'Your {blockchainName} wallets',
|
|
291
|
-
values: {
|
|
292
|
-
blockchainName: getBlockchainShortNameFor(
|
|
293
|
-
showMoreWalletFor,
|
|
294
|
-
blockchains
|
|
295
|
-
),
|
|
296
|
-
},
|
|
294
|
+
values: { blockchainName: showMoreWalletFor },
|
|
297
295
|
})}
|
|
298
296
|
</Typography>
|
|
299
297
|
</ShowMoreHeader>
|
|
@@ -320,11 +318,14 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
320
318
|
</Modal>
|
|
321
319
|
{showMoreWalletFor && (
|
|
322
320
|
<WalletsContainer>
|
|
323
|
-
<div className=
|
|
321
|
+
<div className="wallets-list">
|
|
324
322
|
<WalletList
|
|
325
323
|
chain={showMoreWalletFor}
|
|
326
324
|
isSelected={isSelected}
|
|
327
325
|
selectWallet={onChange}
|
|
326
|
+
multiWallets={config?.multiWallets ?? true}
|
|
327
|
+
supportedWallets={config?.wallets ?? []}
|
|
328
|
+
config={config}
|
|
328
329
|
onShowMore={setShowMoreWalletFor.bind(null, showMoreWalletFor)}
|
|
329
330
|
/>
|
|
330
331
|
</div>
|
|
@@ -338,12 +339,12 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
338
339
|
<Divider size={12} />
|
|
339
340
|
</>
|
|
340
341
|
)}
|
|
341
|
-
{
|
|
342
|
+
{routeWarning && (
|
|
342
343
|
<>
|
|
343
344
|
<Alert
|
|
344
345
|
variant="alarm"
|
|
345
346
|
type="warning"
|
|
346
|
-
title={
|
|
347
|
+
title={getRouteWarningMessage(routeWarning)}
|
|
347
348
|
/>
|
|
348
349
|
<Divider size={12} />
|
|
349
350
|
</>
|
|
@@ -363,7 +364,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
363
364
|
<Typography variant="title" size="xmedium">
|
|
364
365
|
{i18n.t({
|
|
365
366
|
id: 'Your {blockchainName} wallets',
|
|
366
|
-
values: { blockchainName: blockchain?.
|
|
367
|
+
values: { blockchainName: blockchain?.displayName },
|
|
367
368
|
})}
|
|
368
369
|
</Typography>
|
|
369
370
|
<Typography
|
|
@@ -372,7 +373,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
372
373
|
size="medium">
|
|
373
374
|
{i18n.t({
|
|
374
375
|
id: 'You need to connect a {blockchainName} wallet.',
|
|
375
|
-
values: { blockchainName: blockchain?.
|
|
376
|
+
values: { blockchainName: blockchain?.displayName },
|
|
376
377
|
})}
|
|
377
378
|
</Typography>
|
|
378
379
|
</Title>
|
|
@@ -382,6 +383,9 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
382
383
|
chain={requiredWallet}
|
|
383
384
|
isSelected={isSelected}
|
|
384
385
|
selectWallet={onChange}
|
|
386
|
+
multiWallets={config?.multiWallets ?? true}
|
|
387
|
+
supportedWallets={config?.wallets ?? []}
|
|
388
|
+
config={config}
|
|
385
389
|
limit={NUMBER_OF_WALLETS_TO_DISPLAY}
|
|
386
390
|
onShowMore={() =>
|
|
387
391
|
setShowMoreWalletFor(blockchain?.name ?? '')
|
|
@@ -389,7 +393,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
389
393
|
/>
|
|
390
394
|
</ListContainer>
|
|
391
395
|
{!isLastWallet && <Divider size={32} />}
|
|
392
|
-
{isLastWallet &&
|
|
396
|
+
{isLastWallet && customDestinationEnabled && (
|
|
393
397
|
<CustomDestination>
|
|
394
398
|
<CollapsibleRoot
|
|
395
399
|
ref={customDestinationRef}
|
|
@@ -460,7 +464,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
460
464
|
</CollapsibleContent>
|
|
461
465
|
</CollapsibleRoot>
|
|
462
466
|
{isAddressMatched && (
|
|
463
|
-
<div className=
|
|
467
|
+
<div className="alarms">
|
|
464
468
|
<Alert
|
|
465
469
|
variant="alarm"
|
|
466
470
|
type="error"
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { WidgetConfig } from '../..';
|
|
2
|
+
import type { ConfirmSwap } from '../../hooks/useConfirmSwap';
|
|
2
3
|
|
|
3
4
|
export type PropTypes = {
|
|
4
5
|
open: boolean;
|
|
5
6
|
onClose: () => void;
|
|
6
7
|
onCancel: () => void;
|
|
7
8
|
onCheckBalance: ConfirmSwap['fetch'];
|
|
9
|
+
config?: WidgetConfig;
|
|
8
10
|
loading: boolean;
|
|
9
11
|
};
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
TIME_TO_CLOSE_MODAL,
|
|
24
24
|
TIME_TO_IGNORE_MODAL,
|
|
25
25
|
} from '../../pages/WalletsPage';
|
|
26
|
-
import {
|
|
26
|
+
import { useMetaStore } from '../../store/meta';
|
|
27
27
|
import { useWalletsStore } from '../../store/wallets';
|
|
28
28
|
import { getBlockchainDisplayNameFor } from '../../utils/meta';
|
|
29
29
|
import {
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
} from '../../utils/wallets';
|
|
34
34
|
import { WalletModal } from '../WalletModal';
|
|
35
35
|
|
|
36
|
-
import {
|
|
36
|
+
import { WalletButton } from './ConfirmWallets.styles';
|
|
37
37
|
import {
|
|
38
38
|
LogoContainer,
|
|
39
39
|
Spinner,
|
|
@@ -41,11 +41,10 @@ import {
|
|
|
41
41
|
} from './WalletList.styles';
|
|
42
42
|
|
|
43
43
|
export function WalletList(props: PropTypes) {
|
|
44
|
-
const { chain, isSelected, selectWallet, limit, onShowMore } = props;
|
|
45
|
-
const { config } = useAppStore();
|
|
44
|
+
const { config, chain, isSelected, selectWallet, limit, onShowMore } = props;
|
|
46
45
|
|
|
47
46
|
const connectedWallets = useWalletsStore.use.connectedWallets();
|
|
48
|
-
const { blockchains } =
|
|
47
|
+
const { blockchains } = useMetaStore.use.meta();
|
|
49
48
|
const [openWalletStateModal, setOpenWalletStateModal] =
|
|
50
49
|
useState<WalletType>('');
|
|
51
50
|
const [experimentalChainWallet, setExperimentalChainWallet] =
|
|
@@ -138,7 +137,7 @@ export function WalletList(props: PropTypes) {
|
|
|
138
137
|
});
|
|
139
138
|
const conciseAddress = address ? getConciseAddress(address) : '';
|
|
140
139
|
|
|
141
|
-
const experimentalChain = isExperimentalChain(blockchains
|
|
140
|
+
const experimentalChain = isExperimentalChain(blockchains, chain);
|
|
142
141
|
|
|
143
142
|
const experimentalChainNotAdded = !connectedWallets.find(
|
|
144
143
|
(connectedWallet) =>
|
|
@@ -181,7 +180,7 @@ export function WalletList(props: PropTypes) {
|
|
|
181
180
|
experimentalChainWallet?.chain
|
|
182
181
|
? getBlockchainDisplayNameFor(
|
|
183
182
|
experimentalChainWallet.chain,
|
|
184
|
-
blockchains
|
|
183
|
+
blockchains
|
|
185
184
|
)
|
|
186
185
|
: undefined;
|
|
187
186
|
return (
|
|
@@ -292,14 +291,14 @@ export function WalletList(props: PropTypes) {
|
|
|
292
291
|
);
|
|
293
292
|
})}
|
|
294
293
|
{shouldShowMoreWallets && (
|
|
295
|
-
<
|
|
294
|
+
<WalletButton selected={false} onClick={onShowMore.bind(null)}>
|
|
296
295
|
<Typography variant="label" size="medium">
|
|
297
296
|
{i18n.t('Show more wallets')}
|
|
298
297
|
<Typography variant="label" size="medium" color="$primary">
|
|
299
298
|
+{numberOfSupportedWallets - (limit ?? 0)}
|
|
300
299
|
</Typography>
|
|
301
300
|
</Typography>
|
|
302
|
-
</
|
|
301
|
+
</WalletButton>
|
|
303
302
|
)}
|
|
304
303
|
</>
|
|
305
304
|
);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type { Wallet } from '../../types';
|
|
1
|
+
import type { Wallet, WidgetConfig } from '../../types';
|
|
2
2
|
|
|
3
3
|
export type PropTypes = {
|
|
4
4
|
chain: string;
|
|
5
|
+
supportedWallets: WidgetConfig['wallets'];
|
|
5
6
|
isSelected: (walletType: string, chain: string) => boolean;
|
|
6
7
|
selectWallet: (wallet: Wallet) => void;
|
|
8
|
+
multiWallets: boolean;
|
|
9
|
+
config?: WidgetConfig;
|
|
7
10
|
limit?: number;
|
|
8
11
|
onShowMore: () => void;
|
|
9
12
|
};
|
|
@@ -11,9 +11,7 @@ import {
|
|
|
11
11
|
} from '@rango-dev/ui';
|
|
12
12
|
import React from 'react';
|
|
13
13
|
|
|
14
|
-
import { useAppStore } from '../../store/AppStore';
|
|
15
14
|
import { getContainer } from '../../utils/common';
|
|
16
|
-
import { isFeatureHidden } from '../../utils/settings';
|
|
17
15
|
import { NotificationContent } from '../NotificationContent';
|
|
18
16
|
|
|
19
17
|
import { HeaderButton } from './HeaderButtons.styles';
|
|
@@ -28,12 +26,6 @@ export function HomeButtons(props: HomeButtonsPropTypes) {
|
|
|
28
26
|
onClickNotifications,
|
|
29
27
|
} = props;
|
|
30
28
|
|
|
31
|
-
const {
|
|
32
|
-
config: { features },
|
|
33
|
-
} = useAppStore();
|
|
34
|
-
|
|
35
|
-
const isNotificationsHidden = isFeatureHidden('notification', features);
|
|
36
|
-
|
|
37
29
|
return (
|
|
38
30
|
<>
|
|
39
31
|
<Tooltip
|
|
@@ -49,27 +41,25 @@ export function HomeButtons(props: HomeButtonsPropTypes) {
|
|
|
49
41
|
</HeaderButton>
|
|
50
42
|
</Tooltip>
|
|
51
43
|
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
<Tooltip
|
|
45
|
+
container={getContainer()}
|
|
46
|
+
side="top"
|
|
47
|
+
content={i18n.t('Notifications')}>
|
|
48
|
+
<Popover
|
|
49
|
+
align="center"
|
|
50
|
+
collisionBoundary={layoutRef}
|
|
51
|
+
collisionPadding={{ right: 20, left: 20 }}
|
|
54
52
|
container={getContainer()}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
variant="ghost"
|
|
66
|
-
onClick={onClickNotifications}>
|
|
67
|
-
<NotificationsIcon size={18} color="black" />
|
|
68
|
-
<UnreadNotificationsBadge />
|
|
69
|
-
</HeaderButton>
|
|
70
|
-
</Popover>
|
|
71
|
-
</Tooltip>
|
|
72
|
-
)}
|
|
53
|
+
content={<NotificationContent />}>
|
|
54
|
+
<HeaderButton
|
|
55
|
+
size="small"
|
|
56
|
+
variant="ghost"
|
|
57
|
+
onClick={onClickNotifications}>
|
|
58
|
+
<NotificationsIcon size={18} color="black" />
|
|
59
|
+
<UnreadNotificationsBadge />
|
|
60
|
+
</HeaderButton>
|
|
61
|
+
</Popover>
|
|
62
|
+
</Tooltip>
|
|
73
63
|
<Tooltip
|
|
74
64
|
container={getContainer()}
|
|
75
65
|
side="top"
|
|
@@ -8,10 +8,8 @@ export const Container = styled('div', {
|
|
|
8
8
|
overflow: 'hidden !important',
|
|
9
9
|
boxShadow: '15px 15px 15px 0px rgba(0, 0, 0, 0.05)',
|
|
10
10
|
width: '95vw',
|
|
11
|
-
minWidth: '300px',
|
|
12
11
|
maxWidth: '390px',
|
|
13
12
|
maxHeight: '700px',
|
|
14
|
-
textAlign: 'left',
|
|
15
13
|
$$color: '$colors$neutral100',
|
|
16
14
|
[`.${darkTheme} &`]: {
|
|
17
15
|
$$color: '$colors$neutral300',
|