@rango-dev/widget-embedded 0.17.1-next.2 → 0.17.1-next.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/QueueManager.d.ts +5 -2
- package/dist/QueueManager.d.ts.map +1 -1
- package/dist/components/AppRouter.d.ts +0 -2
- package/dist/components/AppRouter.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts +1 -6
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +1 -3
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +1 -3
- 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 +1 -4
- package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -1
- package/dist/components/Layout/Layout.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/NoResult/NoResult.d.ts +4 -0
- package/dist/components/NoResult/NoResult.d.ts.map +1 -0
- package/dist/components/NoResult/NoResult.helpers.d.ts +4 -0
- package/dist/components/NoResult/NoResult.helpers.d.ts.map +1 -0
- package/dist/components/{NoRoutes/NoRoutes.styles.d.ts → NoResult/NoResult.styles.d.ts} +1 -1
- package/dist/components/{NoRoutes/NoRoutes.styles.d.ts.map → NoResult/NoResult.styles.d.ts.map} +1 -1
- package/dist/components/{NoRoutes/NoRoutes.types.d.ts → NoResult/NoResult.types.d.ts} +3 -3
- package/dist/components/NoResult/NoResult.types.d.ts.map +1 -0
- package/dist/components/NoResult/index.d.ts +2 -0
- package/dist/components/NoResult/index.d.ts.map +1 -0
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts +4 -0
- package/dist/components/Quote/Quote.d.ts.map +1 -0
- package/dist/components/Quote/Quote.styles.d.ts +1588 -0
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -0
- package/dist/components/Quote/Quote.types.d.ts +21 -0
- package/dist/components/Quote/Quote.types.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSkeleton.d.ts +4 -0
- package/dist/components/Quote/QuoteSkeleton.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSkeleton.styles.d.ts +319 -0
- package/dist/components/Quote/QuoteSkeleton.styles.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSkeleton.types.d.ts +6 -0
- package/dist/components/Quote/QuoteSkeleton.types.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSummary.d.ts +11 -0
- package/dist/components/Quote/QuoteSummary.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts +158 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -0
- package/dist/components/Quote/index.d.ts +4 -0
- package/dist/components/Quote/index.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts +11 -0
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts +4 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts +4 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts +9 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -0
- package/dist/components/{RouteErrors/RouteErrors.styles.d.ts → QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts} +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +23 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +11 -0
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +11 -0
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/index.d.ts +2 -0
- package/dist/components/QuoteWarningsAndErrors/index.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
- 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.styles.d.ts.map +1 -1
- package/dist/components/UpdateUrl.d.ts +1 -6
- 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 +1 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/messages.d.ts +1 -1
- package/dist/constants/navigationRoutes.d.ts +1 -2
- package/dist/constants/navigationRoutes.d.ts.map +1 -1
- package/dist/constants/searchParams.d.ts +2 -1
- 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/containers/App/App.d.ts +3 -0
- package/dist/containers/App/App.d.ts.map +1 -0
- package/dist/containers/App/App.styles.d.ts +158 -0
- package/dist/containers/App/App.styles.d.ts.map +1 -0
- package/dist/containers/App/index.d.ts +2 -0
- package/dist/containers/App/index.d.ts.map +1 -0
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts +4 -0
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -0
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +788 -0
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -0
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +20 -0
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -0
- package/dist/containers/QuoteInfo/index.d.ts +2 -0
- package/dist/containers/QuoteInfo/index.d.ts.map +1 -0
- package/dist/containers/Wallets/Wallets.d.ts +6 -0
- package/dist/containers/Wallets/Wallets.d.ts.map +1 -0
- package/dist/containers/Wallets/Wallets.types.d.ts +11 -0
- package/dist/containers/Wallets/Wallets.types.d.ts.map +1 -0
- package/dist/containers/Wallets/index.d.ts +2 -0
- package/dist/containers/Wallets/index.d.ts.map +1 -0
- package/dist/containers/Widget/Widget.d.ts +5 -0
- package/dist/containers/Widget/Widget.d.ts.map +1 -0
- package/dist/containers/Widget/Widget.types.d.ts +5 -0
- package/dist/containers/Widget/Widget.types.d.ts.map +1 -0
- package/dist/containers/Widget/index.d.ts +3 -0
- package/dist/containers/Widget/index.d.ts.map +1 -0
- package/dist/containers/WidgetInfo/WidgetInfo.d.ts +6 -0
- package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -0
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +14 -0
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -0
- package/dist/containers/WidgetInfo/index.d.ts +2 -0
- package/dist/containers/WidgetInfo/index.d.ts.map +1 -0
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts +5 -0
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -0
- package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts +7 -0
- package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts.map +1 -0
- package/dist/containers/WidgetProvider/index.d.ts +2 -0
- package/dist/containers/WidgetProvider/index.d.ts.map +1 -0
- package/dist/hooks/useConfirmSwap/index.d.ts +2 -0
- package/dist/hooks/useConfirmSwap/index.d.ts.map +1 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts +3 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +19 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -0
- package/dist/hooks/{useConfirmSwap.d.ts → useConfirmSwap/useConfirmSwap.types.d.ts} +5 -7
- package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +1 -0
- package/dist/hooks/{useFetchBestRoute.d.ts → useFetchQuote.d.ts} +3 -3
- package/dist/hooks/useFetchQuote.d.ts.map +1 -0
- package/dist/hooks/useForceAutoConnect.d.ts +2 -0
- package/dist/hooks/useForceAutoConnect.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 +1 -3
- 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 +5 -7
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts +1 -0
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts +5 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts.map +1 -1
- package/dist/hooks/useSwapInput.d.ts +4 -2
- package/dist/hooks/useSwapInput.d.ts.map +1 -1
- package/dist/hooks/useSyncStoresWithConfig.d.ts +1 -2
- package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts.map +1 -1
- package/dist/index.d.ts +13 -5
- 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 +1 -6
- 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 +1 -2
- 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 +1 -6
- 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 +1 -8
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/AppStore.d.ts +11 -0
- package/dist/store/AppStore.d.ts.map +1 -0
- package/dist/store/app.d.ts +5 -23
- package/dist/store/app.d.ts.map +1 -1
- package/dist/store/{bestRoute.d.ts → quote.d.ts} +39 -27
- package/dist/store/quote.d.ts.map +1 -0
- package/dist/store/settings.d.ts +3 -2
- package/dist/store/settings.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts +3 -2
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/slices/data.d.ts +3 -0
- package/dist/store/slices/data.d.ts.map +1 -1
- package/dist/store/wallets.d.ts +5 -4
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +19 -5
- 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/quote.d.ts +82 -0
- package/dist/types/quote.d.ts.map +1 -0
- package/dist/types/swap.d.ts +3 -13
- package/dist/types/swap.d.ts.map +1 -1
- package/dist/utils/colors.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +1 -0
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +2 -1
- 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/{routing.d.ts → quote.d.ts} +16 -12
- package/dist/utils/quote.d.ts.map +1 -0
- package/dist/utils/settings.d.ts +3 -2
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +34 -23
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +2 -2
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/QueueManager.tsx +18 -17
- package/src/components/AppRouter.tsx +8 -32
- package/src/components/AppRoutes.tsx +57 -69
- package/src/components/BlockchainList/BlockchainList.tsx +4 -4
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +7 -7
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +2 -64
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +39 -45
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +1 -3
- package/src/components/ConfirmWalletsModal/WalletList.tsx +6 -5
- package/src/components/ConfirmWalletsModal/WalletList.type.ts +1 -4
- package/src/components/Layout/Layout.tsx +10 -7
- package/src/components/Layout/Layout.types.ts +2 -2
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +3 -3
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +6 -6
- package/src/components/{NoRoutes/NoRoutes.helper.ts → NoResult/NoResult.helpers.ts} +23 -16
- package/src/components/{NoRoutes/NoRoutes.styles.ts → NoResult/NoResult.styles.ts} +2 -0
- package/src/components/{NoRoutes/NoRoutes.tsx → NoResult/NoResult.tsx} +10 -12
- package/src/components/{NoRoutes/NoRoutes.types.ts → NoResult/NoResult.types.ts} +3 -2
- package/src/components/NoResult/index.ts +1 -0
- package/src/components/NotificationContent/NotificationContent.tsx +5 -3
- package/src/components/Quote/Quote.styles.ts +239 -0
- package/src/components/Quote/Quote.tsx +413 -0
- package/src/components/Quote/Quote.types.ts +15 -0
- package/src/components/Quote/QuoteSkeleton.styles.ts +110 -0
- package/src/components/Quote/QuoteSkeleton.tsx +108 -0
- package/src/components/Quote/QuoteSkeleton.types.ts +5 -0
- package/src/components/Quote/QuoteSummary.styles.ts +15 -0
- package/src/components/Quote/QuoteSummary.tsx +46 -0
- package/src/components/Quote/index.ts +3 -0
- package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +107 -0
- package/src/components/{RouteErrors/RouteErrorsModalItem.tsx → QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx} +4 -4
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +74 -0
- package/src/components/{RouteErrors/RouteErrors.styles.ts → QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts} +8 -1
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +103 -0
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +25 -0
- package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +77 -0
- package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +38 -0
- package/src/components/QuoteWarningsAndErrors/index.ts +1 -0
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +0 -4
- package/src/components/SwapDetails/SwapDetails.tsx +17 -24
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +4 -3
- package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +2 -2
- package/src/components/SwapsGroup/SwapsGroup.styles.ts +8 -1
- package/src/components/SwapsGroup/SwapsGroup.tsx +0 -2
- package/src/components/SwitchFromAndTo.tsx +2 -2
- package/src/components/TokenList/TokenList.styles.ts +14 -2
- package/src/components/TokenList/TokenList.tsx +6 -7
- package/src/components/UpdateUrl.tsx +36 -29
- package/src/components/WidgetEvents.tsx +4 -2
- package/src/constants/errors.ts +17 -15
- package/src/constants/index.ts +1 -0
- package/src/constants/messages.ts +1 -1
- package/src/constants/navigationRoutes.ts +7 -8
- package/src/constants/searchParams.ts +1 -0
- package/src/constants/warnings.ts +7 -7
- package/src/containers/App/App.styles.ts +18 -0
- package/src/containers/App/App.tsx +55 -0
- package/src/containers/App/index.ts +1 -0
- package/src/containers/QuoteInfo/QuoteInfo.styles.ts +31 -0
- package/src/containers/QuoteInfo/QuoteInfo.tsx +98 -0
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +20 -0
- package/src/containers/QuoteInfo/index.ts +1 -0
- package/src/{Wallets.tsx → containers/Wallets/Wallets.tsx} +40 -32
- package/src/containers/Wallets/Wallets.types.ts +12 -0
- package/src/containers/Wallets/index.ts +1 -0
- package/src/containers/Widget/Widget.tsx +19 -0
- package/src/containers/Widget/Widget.types.ts +5 -0
- package/src/containers/Widget/index.ts +2 -0
- package/src/containers/WidgetInfo/WidgetInfo.tsx +47 -0
- package/src/containers/WidgetInfo/WidgetInfo.types.ts +14 -0
- package/src/containers/WidgetInfo/index.ts +1 -0
- package/src/containers/WidgetProvider/WidgetProvider.tsx +28 -0
- package/src/containers/WidgetProvider/WidgetProvider.types.ts +7 -0
- package/src/containers/WidgetProvider/index.ts +1 -0
- package/src/hooks/useConfirmSwap/index.ts +1 -0
- package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +172 -0
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +137 -0
- package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +19 -0
- package/src/hooks/{useFetchBestRoute.ts → useFetchQuote.ts} +3 -3
- package/src/hooks/useForceAutoConnect.ts +27 -0
- package/src/hooks/useLanguage.ts +2 -2
- package/src/hooks/useNavigateBack.ts +3 -52
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -1
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.ts +37 -7
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +60 -0
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +78 -3
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.ts +13 -4
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.ts +6 -1
- package/src/hooks/useSwapInput.ts +139 -46
- package/src/hooks/useSyncStoresWithConfig.ts +22 -19
- package/src/hooks/useWalletList.ts +3 -5
- package/src/index.ts +14 -3
- package/src/pages/ConfirmSwapPage.tsx +95 -248
- package/src/pages/HistoryPage.tsx +1 -5
- package/src/pages/Home.tsx +75 -270
- package/src/pages/LanguagePage.tsx +0 -5
- package/src/pages/LiquiditySourcePage.tsx +22 -35
- package/src/pages/SelectBlockchainPage.tsx +31 -24
- package/src/pages/SelectSwapItemsPage.tsx +9 -23
- package/src/pages/SettingsPage.tsx +8 -15
- package/src/pages/SwapDetailsPage.tsx +6 -7
- package/src/pages/ThemePage.tsx +0 -4
- package/src/pages/WalletsPage.tsx +4 -15
- package/src/services/httpService.ts +1 -1
- package/src/store/AppStore.tsx +35 -0
- package/src/store/app.ts +18 -6
- package/src/store/{bestRoute.ts → quote.ts} +68 -60
- package/src/store/settings.ts +7 -4
- package/src/store/slices/config.ts +25 -15
- package/src/store/slices/data.ts +64 -29
- package/src/store/wallets.ts +12 -8
- package/src/types/config.ts +20 -5
- package/src/types/index.ts +1 -1
- package/src/types/quote.ts +107 -0
- package/src/types/swap.ts +3 -12
- package/src/utils/colors.ts +2 -1
- package/src/utils/configs.ts +2 -1
- package/src/utils/meta.ts +8 -1
- package/src/utils/numbers.ts +1 -1
- package/src/utils/quote.ts +338 -0
- package/src/utils/settings.ts +8 -7
- package/src/utils/swap.ts +153 -116
- package/src/utils/wallets.ts +29 -17
- package/dist/Wallets.d.ts +0 -17
- package/dist/Wallets.d.ts.map +0 -1
- package/dist/Widget.d.ts +0 -9
- package/dist/Widget.d.ts.map +0 -1
- package/dist/components/NoRoutes/NoRoutes.d.ts +0 -4
- package/dist/components/NoRoutes/NoRoutes.d.ts.map +0 -1
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts +0 -3
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +0 -1
- package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +0 -1
- package/dist/components/NoRoutes/index.d.ts +0 -2
- package/dist/components/NoRoutes/index.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrors.d.ts +0 -4
- package/dist/components/RouteErrors/RouteErrors.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrors.types.d.ts +0 -24
- package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts +0 -4
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +0 -4
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +0 -1
- package/dist/components/RouteErrors/index.d.ts +0 -2
- package/dist/components/RouteErrors/index.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap.d.ts.map +0 -1
- package/dist/hooks/useFetchBestRoute.d.ts.map +0 -1
- package/dist/store/bestRoute.d.ts.map +0 -1
- package/dist/store/meta.d.ts +0 -23
- package/dist/store/meta.d.ts.map +0 -1
- package/dist/types/routing.d.ts +0 -65
- package/dist/types/routing.d.ts.map +0 -1
- package/dist/utils/routing.d.ts.map +0 -1
- package/src/Widget.tsx +0 -119
- package/src/components/NoRoutes/index.ts +0 -1
- package/src/components/RouteErrors/RouteErrors.tsx +0 -79
- package/src/components/RouteErrors/RouteErrors.types.ts +0 -29
- package/src/components/RouteErrors/RouteErrorsModal.tsx +0 -129
- package/src/components/RouteErrors/index.ts +0 -1
- package/src/hooks/useConfirmSwap.ts +0 -303
- package/src/store/meta.ts +0 -39
- package/src/types/routing.ts +0 -77
- package/src/utils/routing.ts +0 -321
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '@rango-dev/ui';
|
|
12
12
|
import React, { useEffect, useState } from 'react';
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import { useAppStore } from '../../store/AppStore';
|
|
15
15
|
|
|
16
16
|
import { filterBlockchains } from './BlockchainList.helpers';
|
|
17
17
|
import { Container, List } from './BlockchainList.styles';
|
|
@@ -20,7 +20,7 @@ import { LoadingBlockchainList } from './LoadingBlockchainList';
|
|
|
20
20
|
export function BlockchainList(props: PropTypes) {
|
|
21
21
|
const { list, searchedFor, onChange, blockchainCategory } = props;
|
|
22
22
|
const [blockchains, setBlockchains] = useState<BlockchainMeta[]>(list);
|
|
23
|
-
const
|
|
23
|
+
const { fetchStatus } = useAppStore();
|
|
24
24
|
|
|
25
25
|
useEffect(() => {
|
|
26
26
|
setBlockchains([
|
|
@@ -66,8 +66,8 @@ export function BlockchainList(props: PropTypes) {
|
|
|
66
66
|
{i18n.t('Select Blockchain')}
|
|
67
67
|
</Typography>
|
|
68
68
|
<Divider size={4} />
|
|
69
|
-
{
|
|
70
|
-
{
|
|
69
|
+
{fetchStatus === 'loading' && <LoadingBlockchainList />}
|
|
70
|
+
{fetchStatus === 'success' && renderList()}
|
|
71
71
|
</Container>
|
|
72
72
|
);
|
|
73
73
|
}
|
|
@@ -13,8 +13,8 @@ import React from 'react';
|
|
|
13
13
|
|
|
14
14
|
import { BLOCKCHAIN_LIST_SIZE } from '../../constants/configs';
|
|
15
15
|
import { usePrepareBlockchainList } from '../../hooks/usePrepareBlockchainList';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { useAppStore } from '../../store/AppStore';
|
|
17
|
+
import { useQuoteStore } from '../../store/quote';
|
|
18
18
|
|
|
19
19
|
import { Container } from './BlockchainsSection.styles';
|
|
20
20
|
|
|
@@ -27,9 +27,9 @@ export function BlockchainsSection(props: PropTypes) {
|
|
|
27
27
|
selected: blockchain?.name,
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
const
|
|
31
|
-
const resetToBlockchain =
|
|
32
|
-
const resetFromBlockchain =
|
|
30
|
+
const { fetchStatus } = useAppStore();
|
|
31
|
+
const resetToBlockchain = useQuoteStore.use.resetToBlockchain();
|
|
32
|
+
const resetFromBlockchain = useQuoteStore.use.resetFromBlockchain();
|
|
33
33
|
const hasMoreItemsInList = blockchainsList.more.length > 0;
|
|
34
34
|
/**
|
|
35
35
|
* When only one item is left on list, we will not show the `More` button and will show the item itself instead.
|
|
@@ -45,11 +45,11 @@ export function BlockchainsSection(props: PropTypes) {
|
|
|
45
45
|
</Typography>
|
|
46
46
|
<Divider size={12} />
|
|
47
47
|
<Container>
|
|
48
|
-
{
|
|
48
|
+
{fetchStatus === 'loading' &&
|
|
49
49
|
Array.from(Array(NUMBER_OF_LOADING), (e) => (
|
|
50
50
|
<Skeleton key={e} variant="rounded" height={50} />
|
|
51
51
|
))}
|
|
52
|
-
{
|
|
52
|
+
{fetchStatus === 'success' && (
|
|
53
53
|
<>
|
|
54
54
|
<BlockchainsChip
|
|
55
55
|
selected={!blockchain}
|
|
@@ -1,71 +1,9 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
-
import type { Step } from '@rango-dev/ui/dist/widget/ui/src/components/BestRoute/BestRoute.types';
|
|
3
1
|
import type { BestRouteResponse, BlockchainMeta } from 'rango-sdk';
|
|
4
2
|
|
|
5
|
-
|
|
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[] {
|
|
3
|
+
export function getRequiredWallets(quote: BestRouteResponse | null): string[] {
|
|
66
4
|
const wallets: string[] = [];
|
|
67
5
|
|
|
68
|
-
|
|
6
|
+
quote?.result?.swaps.forEach((swap) => {
|
|
69
7
|
const currentStepFromBlockchain = swap.from.blockchain;
|
|
70
8
|
const currentStepToBlockchain = swap.to.blockchain;
|
|
71
9
|
let lastAddedWallet = wallets[wallets.length - 1];
|
|
@@ -18,12 +18,12 @@ 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 {
|
|
25
|
-
import { useMetaStore } from '../../store/meta';
|
|
21
|
+
import { getQuoteErrorMessage } from '../../constants/errors';
|
|
22
|
+
import { getQuoteUpdateWarningMessage } from '../../constants/warnings';
|
|
23
|
+
import { useAppStore } from '../../store/AppStore';
|
|
24
|
+
import { useQuoteStore } from '../../store/quote';
|
|
26
25
|
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';
|
|
@@ -50,23 +50,24 @@ const NUMBER_OF_WALLETS_TO_DISPLAY = 2;
|
|
|
50
50
|
|
|
51
51
|
export function ConfirmWalletsModal(props: PropTypes) {
|
|
52
52
|
//TODO: move component's logics to a custom hook
|
|
53
|
-
const { open, onClose, onCancel, onCheckBalance,
|
|
54
|
-
const
|
|
53
|
+
const { open, onClose, onCancel, onCheckBalance, loading } = props;
|
|
54
|
+
const config = useAppStore().config;
|
|
55
|
+
const blockchains = useAppStore().blockchains();
|
|
55
56
|
const {
|
|
56
|
-
|
|
57
|
-
setSelectedWallets:
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
quote,
|
|
58
|
+
setSelectedWallets: selectQuoteWallets,
|
|
59
|
+
quoteWalletsConfirmed: quoteWalletsConfirmed,
|
|
60
|
+
setQuoteWalletConfirmed: setQuoteWalletConfirmed,
|
|
60
61
|
customDestination,
|
|
61
62
|
setCustomDestination,
|
|
62
|
-
} =
|
|
63
|
+
} = useQuoteStore();
|
|
63
64
|
const { connectedWallets, selectWallets } = useWalletsStore();
|
|
64
65
|
|
|
65
66
|
const [showMoreWalletFor, setShowMoreWalletFor] = useState('');
|
|
66
67
|
const [balanceWarnings, setBalanceWarnings] = useState<string[]>([]);
|
|
67
68
|
const [error, setError] = useState('');
|
|
68
|
-
const [
|
|
69
|
-
ConfirmSwapWarnings['
|
|
69
|
+
const [quoteWarning, setQuoteWarning] = useState<
|
|
70
|
+
ConfirmSwapWarnings['quoteUpdate'] | null
|
|
70
71
|
>(null);
|
|
71
72
|
const [destination, setDestination] = useState(customDestination);
|
|
72
73
|
const [showCustomDestination, setShowCustomDestination] = useState(
|
|
@@ -74,22 +75,15 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
74
75
|
);
|
|
75
76
|
const customDestinationRef = useRef<HTMLDivElement | null>(null);
|
|
76
77
|
|
|
77
|
-
const requiredWallets = getRequiredWallets(
|
|
78
|
-
const customDestinationEnabled =
|
|
79
|
-
typeof config?.customDestination === 'undefined'
|
|
80
|
-
? true
|
|
81
|
-
: config.customDestination;
|
|
78
|
+
const requiredWallets = getRequiredWallets(quote);
|
|
82
79
|
|
|
83
80
|
const lastStepToBlockchain = blockchains.find(
|
|
84
81
|
(blockchain) =>
|
|
85
82
|
blockchain.name ===
|
|
86
|
-
|
|
87
|
-
.blockchain
|
|
83
|
+
quote?.result?.swaps[quote?.result?.swaps.length - 1].to.blockchain
|
|
88
84
|
);
|
|
89
85
|
const isWalletRequiredFor = (blockchain: string) =>
|
|
90
|
-
!!
|
|
91
|
-
(swap) => swap.from.blockchain === blockchain
|
|
92
|
-
);
|
|
86
|
+
!!quote?.result?.swaps.find((swap) => swap.from.blockchain === blockchain);
|
|
93
87
|
|
|
94
88
|
const [selectableWallets, setSelectableWallets] = useState<ConnectedWallet[]>(
|
|
95
89
|
connectedWallets.filter((connectedWallet) => {
|
|
@@ -175,16 +169,16 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
175
169
|
(wallet) => wallet.selected
|
|
176
170
|
);
|
|
177
171
|
selectWallets(lastSelectedWallets);
|
|
178
|
-
|
|
172
|
+
selectQuoteWallets(lastSelectedWallets);
|
|
179
173
|
setCustomDestination(destination);
|
|
180
|
-
|
|
174
|
+
setQuoteWalletConfirmed(true);
|
|
181
175
|
onClose();
|
|
182
176
|
};
|
|
183
177
|
|
|
184
178
|
const onConfirmWallets = async () => {
|
|
185
179
|
setBalanceWarnings([]);
|
|
186
180
|
setError('');
|
|
187
|
-
|
|
181
|
+
setQuoteWarning(null);
|
|
188
182
|
const selectedWallets = connectedWallets.filter((connectedWallet) =>
|
|
189
183
|
selectableWallets.find(
|
|
190
184
|
(selectableWallet) =>
|
|
@@ -201,11 +195,11 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
201
195
|
if (warnings?.balance?.messages) {
|
|
202
196
|
setBalanceWarnings(warnings.balance.messages);
|
|
203
197
|
}
|
|
204
|
-
if (warnings?.
|
|
205
|
-
|
|
198
|
+
if (warnings?.quoteUpdate) {
|
|
199
|
+
setQuoteWarning(warnings.quoteUpdate);
|
|
206
200
|
}
|
|
207
201
|
if (result.error) {
|
|
208
|
-
setError(
|
|
202
|
+
setError(getQuoteErrorMessage(result.error));
|
|
209
203
|
}
|
|
210
204
|
|
|
211
205
|
if (!result.error && (!warnings?.balance?.messages.length || 0 > 0)) {
|
|
@@ -249,8 +243,9 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
249
243
|
<Modal
|
|
250
244
|
open={open}
|
|
251
245
|
onClose={() => {
|
|
252
|
-
if (!
|
|
253
|
-
|
|
246
|
+
if (!quoteWalletsConfirmed) {
|
|
247
|
+
const home = '../';
|
|
248
|
+
navigate(home, { replace: true });
|
|
254
249
|
}
|
|
255
250
|
onClose();
|
|
256
251
|
}}
|
|
@@ -265,7 +260,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
265
260
|
loading,
|
|
266
261
|
showCustomDestination,
|
|
267
262
|
destination,
|
|
268
|
-
|
|
263
|
+
quote,
|
|
269
264
|
selectableWallets,
|
|
270
265
|
lastStepToBlockchain
|
|
271
266
|
)}
|
|
@@ -291,7 +286,12 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
291
286
|
<Typography variant="headline" size="small">
|
|
292
287
|
{i18n.t({
|
|
293
288
|
id: 'Your {blockchainName} wallets',
|
|
294
|
-
values: {
|
|
289
|
+
values: {
|
|
290
|
+
blockchainName: getBlockchainShortNameFor(
|
|
291
|
+
showMoreWalletFor,
|
|
292
|
+
blockchains
|
|
293
|
+
),
|
|
294
|
+
},
|
|
295
295
|
})}
|
|
296
296
|
</Typography>
|
|
297
297
|
</ShowMoreHeader>
|
|
@@ -323,9 +323,6 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
323
323
|
chain={showMoreWalletFor}
|
|
324
324
|
isSelected={isSelected}
|
|
325
325
|
selectWallet={onChange}
|
|
326
|
-
multiWallets={config?.multiWallets ?? true}
|
|
327
|
-
supportedWallets={config?.wallets ?? []}
|
|
328
|
-
config={config}
|
|
329
326
|
onShowMore={setShowMoreWalletFor.bind(null, showMoreWalletFor)}
|
|
330
327
|
/>
|
|
331
328
|
</div>
|
|
@@ -339,12 +336,12 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
339
336
|
<Divider size={12} />
|
|
340
337
|
</>
|
|
341
338
|
)}
|
|
342
|
-
{
|
|
339
|
+
{quoteWarning && (
|
|
343
340
|
<>
|
|
344
341
|
<Alert
|
|
345
342
|
variant="alarm"
|
|
346
343
|
type="warning"
|
|
347
|
-
title={
|
|
344
|
+
title={getQuoteUpdateWarningMessage(quoteWarning)}
|
|
348
345
|
/>
|
|
349
346
|
<Divider size={12} />
|
|
350
347
|
</>
|
|
@@ -364,7 +361,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
364
361
|
<Typography variant="title" size="xmedium">
|
|
365
362
|
{i18n.t({
|
|
366
363
|
id: 'Your {blockchainName} wallets',
|
|
367
|
-
values: { blockchainName: blockchain?.
|
|
364
|
+
values: { blockchainName: blockchain?.shortName },
|
|
368
365
|
})}
|
|
369
366
|
</Typography>
|
|
370
367
|
<Typography
|
|
@@ -373,7 +370,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
373
370
|
size="medium">
|
|
374
371
|
{i18n.t({
|
|
375
372
|
id: 'You need to connect a {blockchainName} wallet.',
|
|
376
|
-
values: { blockchainName: blockchain?.
|
|
373
|
+
values: { blockchainName: blockchain?.shortName },
|
|
377
374
|
})}
|
|
378
375
|
</Typography>
|
|
379
376
|
</Title>
|
|
@@ -383,9 +380,6 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
383
380
|
chain={requiredWallet}
|
|
384
381
|
isSelected={isSelected}
|
|
385
382
|
selectWallet={onChange}
|
|
386
|
-
multiWallets={config?.multiWallets ?? true}
|
|
387
|
-
supportedWallets={config?.wallets ?? []}
|
|
388
|
-
config={config}
|
|
389
383
|
limit={NUMBER_OF_WALLETS_TO_DISPLAY}
|
|
390
384
|
onShowMore={() =>
|
|
391
385
|
setShowMoreWalletFor(blockchain?.name ?? '')
|
|
@@ -393,7 +387,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
393
387
|
/>
|
|
394
388
|
</ListContainer>
|
|
395
389
|
{!isLastWallet && <Divider size={32} />}
|
|
396
|
-
{isLastWallet &&
|
|
390
|
+
{isLastWallet && config?.customDestination && (
|
|
397
391
|
<CustomDestination>
|
|
398
392
|
<CollapsibleRoot
|
|
399
393
|
ref={customDestinationRef}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ConfirmSwap } from '../../hooks/useConfirmSwap';
|
|
1
|
+
import type { ConfirmSwap } from '../../hooks/useConfirmSwap/useConfirmSwap.types';
|
|
3
2
|
|
|
4
3
|
export type PropTypes = {
|
|
5
4
|
open: boolean;
|
|
6
5
|
onClose: () => void;
|
|
7
6
|
onCancel: () => void;
|
|
8
7
|
onCheckBalance: ConfirmSwap['fetch'];
|
|
9
|
-
config?: WidgetConfig;
|
|
10
8
|
loading: boolean;
|
|
11
9
|
};
|
|
@@ -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 { useAppStore } from '../../store/AppStore';
|
|
27
27
|
import { useWalletsStore } from '../../store/wallets';
|
|
28
28
|
import { getBlockchainDisplayNameFor } from '../../utils/meta';
|
|
29
29
|
import {
|
|
@@ -41,10 +41,11 @@ import {
|
|
|
41
41
|
} from './WalletList.styles';
|
|
42
42
|
|
|
43
43
|
export function WalletList(props: PropTypes) {
|
|
44
|
-
const {
|
|
44
|
+
const { chain, isSelected, selectWallet, limit, onShowMore } = props;
|
|
45
|
+
const { config } = useAppStore();
|
|
45
46
|
|
|
46
47
|
const connectedWallets = useWalletsStore.use.connectedWallets();
|
|
47
|
-
const { blockchains } =
|
|
48
|
+
const { blockchains } = useAppStore();
|
|
48
49
|
const [openWalletStateModal, setOpenWalletStateModal] =
|
|
49
50
|
useState<WalletType>('');
|
|
50
51
|
const [experimentalChainWallet, setExperimentalChainWallet] =
|
|
@@ -137,7 +138,7 @@ export function WalletList(props: PropTypes) {
|
|
|
137
138
|
});
|
|
138
139
|
const conciseAddress = address ? getConciseAddress(address) : '';
|
|
139
140
|
|
|
140
|
-
const experimentalChain = isExperimentalChain(blockchains, chain);
|
|
141
|
+
const experimentalChain = isExperimentalChain(blockchains(), chain);
|
|
141
142
|
|
|
142
143
|
const experimentalChainNotAdded = !connectedWallets.find(
|
|
143
144
|
(connectedWallet) =>
|
|
@@ -180,7 +181,7 @@ export function WalletList(props: PropTypes) {
|
|
|
180
181
|
experimentalChainWallet?.chain
|
|
181
182
|
? getBlockchainDisplayNameFor(
|
|
182
183
|
experimentalChainWallet.chain,
|
|
183
|
-
blockchains
|
|
184
|
+
blockchains()
|
|
184
185
|
)
|
|
185
186
|
: undefined;
|
|
186
187
|
return (
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import type { Wallet
|
|
1
|
+
import type { Wallet } from '../../types';
|
|
2
2
|
|
|
3
3
|
export type PropTypes = {
|
|
4
4
|
chain: string;
|
|
5
|
-
supportedWallets: WidgetConfig['wallets'];
|
|
6
5
|
isSelected: (walletType: string, chain: string) => boolean;
|
|
7
6
|
selectWallet: (wallet: Wallet) => void;
|
|
8
|
-
multiWallets: boolean;
|
|
9
|
-
config?: WidgetConfig;
|
|
10
7
|
limit?: number;
|
|
11
8
|
onShowMore: () => void;
|
|
12
9
|
};
|
|
@@ -3,9 +3,8 @@ import type { PropsWithChildren } from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { BottomLogo, Divider, Header } from '@rango-dev/ui';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import { useNavigate } from 'react-router-dom';
|
|
7
6
|
|
|
8
|
-
import {
|
|
7
|
+
import { useNavigateBack } from '../../hooks/useNavigateBack';
|
|
9
8
|
import { useUiStore } from '../../store/ui';
|
|
10
9
|
import { useWalletsStore } from '../../store/wallets';
|
|
11
10
|
import { getContainer } from '../../utils/common';
|
|
@@ -26,22 +25,26 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
|
|
|
26
25
|
|
|
27
26
|
const connectWalletsButtonDisabled =
|
|
28
27
|
useUiStore.use.connectWalletsButtonDisabled();
|
|
29
|
-
const
|
|
28
|
+
const navigateBack = useNavigateBack();
|
|
30
29
|
|
|
31
30
|
const onConnectWallet = () => {
|
|
32
|
-
if (!connectWalletsButtonDisabled) {
|
|
33
|
-
|
|
31
|
+
if (!connectWalletsButtonDisabled && header.onWallet) {
|
|
32
|
+
header.onWallet();
|
|
34
33
|
}
|
|
35
34
|
};
|
|
35
|
+
|
|
36
|
+
const showBackButton =
|
|
37
|
+
typeof header.hasBackButton === 'undefined' || header.hasBackButton;
|
|
38
|
+
|
|
36
39
|
return (
|
|
37
40
|
<Container ref={ref} fixedHeight={fixedHeight} id="swap-box">
|
|
38
41
|
<Header
|
|
39
|
-
prefix={<>{
|
|
42
|
+
prefix={<>{showBackButton && <BackButton onClick={navigateBack} />}</>}
|
|
40
43
|
title={header.title}
|
|
41
44
|
suffix={
|
|
42
45
|
<>
|
|
43
46
|
{header.suffix}
|
|
44
|
-
{header.
|
|
47
|
+
{header.onWallet && (
|
|
45
48
|
<WalletButton
|
|
46
49
|
container={getContainer()}
|
|
47
50
|
onClick={onConnectWallet}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export interface PropTypes {
|
|
2
2
|
header: {
|
|
3
3
|
title: string;
|
|
4
|
-
|
|
4
|
+
onWallet?: () => void;
|
|
5
5
|
hasSettings?: boolean;
|
|
6
6
|
suffix?: React.ReactNode;
|
|
7
|
-
|
|
7
|
+
hasBackButton?: boolean;
|
|
8
8
|
onCancel?: () => void;
|
|
9
9
|
};
|
|
10
10
|
hasLogo?: boolean;
|
|
@@ -10,11 +10,11 @@ export const Container = styled('div', {
|
|
|
10
10
|
display: 'flex',
|
|
11
11
|
},
|
|
12
12
|
|
|
13
|
-
'.
|
|
13
|
+
'.quote-summary': {
|
|
14
14
|
padding: '$15 $0',
|
|
15
15
|
},
|
|
16
16
|
|
|
17
|
-
'.
|
|
17
|
+
'.quote-summary-item': {
|
|
18
18
|
display: 'flex',
|
|
19
19
|
justifyContent: 'space-between',
|
|
20
20
|
alignItems: 'center',
|
|
@@ -26,7 +26,7 @@ export const Container = styled('div', {
|
|
|
26
26
|
alignItems: 'center',
|
|
27
27
|
},
|
|
28
28
|
|
|
29
|
-
'.
|
|
29
|
+
'.quote-summary-separator': {
|
|
30
30
|
width: '0px',
|
|
31
31
|
height: '$16',
|
|
32
32
|
borderLeft: '1px solid $neutral400',
|
|
@@ -6,8 +6,8 @@ import { Container, StepSeparator } from './LoadingSwapDetails.styles';
|
|
|
6
6
|
import { LoadingSwapDetailStep } from './LoadingSwapDetailStep';
|
|
7
7
|
|
|
8
8
|
export function LoadingSwapDetails() {
|
|
9
|
-
const
|
|
10
|
-
<div className="
|
|
9
|
+
const quoteSummary = (
|
|
10
|
+
<div className="quote-summary-item">
|
|
11
11
|
<div className="token-amount">
|
|
12
12
|
<ChainToken loading size="medium" chainImage="" tokenImage="" />
|
|
13
13
|
<Divider size={8} direction="horizontal" />
|
|
@@ -27,10 +27,10 @@ export function LoadingSwapDetails() {
|
|
|
27
27
|
<Skeleton width={60} height={10} variant="rounded" />
|
|
28
28
|
</div>
|
|
29
29
|
|
|
30
|
-
<div className="
|
|
31
|
-
{
|
|
32
|
-
<div className="
|
|
33
|
-
{
|
|
30
|
+
<div className="quote-summary">
|
|
31
|
+
{quoteSummary}
|
|
32
|
+
<div className="quote-summary-separator"></div>
|
|
33
|
+
{quoteSummary}
|
|
34
34
|
</div>
|
|
35
35
|
|
|
36
36
|
<div className="swaps-steps">
|
|
@@ -1,37 +1,32 @@
|
|
|
1
|
-
import type { Info } from './
|
|
1
|
+
import type { Info } from './NoResult.types';
|
|
2
2
|
|
|
3
3
|
import { i18n } from '@lingui/core';
|
|
4
4
|
|
|
5
5
|
import { errorMessages } from '../../constants/errors';
|
|
6
|
+
import {
|
|
7
|
+
type NoResultError,
|
|
8
|
+
QuoteErrorType,
|
|
9
|
+
type QuoteRequestFailed,
|
|
10
|
+
} from '../../types';
|
|
6
11
|
|
|
7
12
|
export function makeInfo(
|
|
8
|
-
|
|
13
|
+
error: NoResultError | QuoteRequestFailed | null,
|
|
9
14
|
disabledLiquiditySources: string[],
|
|
10
|
-
hasError: boolean,
|
|
11
15
|
toggleAllLiquiditySources: (shouldReset: boolean) => void,
|
|
12
|
-
|
|
16
|
+
refetchQuote: () => void
|
|
13
17
|
): Info {
|
|
14
|
-
if (
|
|
18
|
+
if (error?.type === QuoteErrorType.REQUEST_FAILED) {
|
|
15
19
|
return {
|
|
16
20
|
alert: {
|
|
17
21
|
type: 'warning',
|
|
18
22
|
text: errorMessages().genericServerError,
|
|
19
23
|
action: {
|
|
20
|
-
onClick:
|
|
24
|
+
onClick: refetchQuote,
|
|
21
25
|
title: i18n.t('Retry'),
|
|
22
26
|
},
|
|
23
27
|
},
|
|
24
28
|
description: '',
|
|
25
29
|
};
|
|
26
|
-
} else if (diagnosisMessage) {
|
|
27
|
-
return {
|
|
28
|
-
alert: {
|
|
29
|
-
type: 'error',
|
|
30
|
-
text: diagnosisMessage,
|
|
31
|
-
action: null,
|
|
32
|
-
},
|
|
33
|
-
description: '',
|
|
34
|
-
};
|
|
35
30
|
} else if (disabledLiquiditySources.length) {
|
|
36
31
|
return {
|
|
37
32
|
alert: {
|
|
@@ -44,9 +39,21 @@ export function makeInfo(
|
|
|
44
39
|
},
|
|
45
40
|
description: errorMessages().liquiditySourcesError.description,
|
|
46
41
|
};
|
|
42
|
+
} else if (
|
|
43
|
+
error?.type === QuoteErrorType.NO_RESULT &&
|
|
44
|
+
error.diagnosisMessage
|
|
45
|
+
) {
|
|
46
|
+
return {
|
|
47
|
+
alert: {
|
|
48
|
+
type: 'error',
|
|
49
|
+
text: error.diagnosisMessage,
|
|
50
|
+
action: null,
|
|
51
|
+
},
|
|
52
|
+
description: '',
|
|
53
|
+
};
|
|
47
54
|
}
|
|
48
55
|
return {
|
|
49
56
|
alert: null,
|
|
50
|
-
description: errorMessages().
|
|
57
|
+
description: errorMessages().noResultError.description,
|
|
51
58
|
};
|
|
52
59
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PropTypes } from './
|
|
1
|
+
import type { PropTypes } from './NoResult.types';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
Alert,
|
|
@@ -11,27 +11,25 @@ import {
|
|
|
11
11
|
import React from 'react';
|
|
12
12
|
|
|
13
13
|
import { errorMessages } from '../../constants/errors';
|
|
14
|
-
import {
|
|
14
|
+
import { useAppStore } from '../../store/AppStore';
|
|
15
15
|
import { useSettingsStore } from '../../store/settings';
|
|
16
16
|
|
|
17
|
-
import { makeInfo } from './
|
|
18
|
-
import { Container, Footer, PrefixIcon } from './
|
|
17
|
+
import { makeInfo } from './NoResult.helpers';
|
|
18
|
+
import { Container, Footer, PrefixIcon } from './NoResult.styles';
|
|
19
19
|
|
|
20
|
-
export function
|
|
21
|
-
const {
|
|
20
|
+
export function NoResult(props: PropTypes) {
|
|
21
|
+
const { fetch, error } = props;
|
|
22
22
|
const disabledLiquiditySources =
|
|
23
23
|
useSettingsStore.use.disabledLiquiditySources();
|
|
24
|
-
const loadingMetaStatus = useMetaStore.use.loadingStatus();
|
|
25
24
|
const toggleAllLiquiditySources =
|
|
26
25
|
useSettingsStore.use.toggleAllLiquiditySources();
|
|
27
26
|
|
|
28
|
-
const
|
|
27
|
+
const swappers = useAppStore().swappers();
|
|
29
28
|
|
|
30
29
|
const info = makeInfo(
|
|
31
|
-
|
|
30
|
+
error,
|
|
32
31
|
disabledLiquiditySources,
|
|
33
|
-
|
|
34
|
-
toggleAllLiquiditySources,
|
|
32
|
+
() => toggleAllLiquiditySources(swappers, true),
|
|
35
33
|
fetch
|
|
36
34
|
);
|
|
37
35
|
|
|
@@ -40,7 +38,7 @@ export function NoRoutes(props: PropTypes) {
|
|
|
40
38
|
<NoRouteIcon size={24} color="gray" />
|
|
41
39
|
<Divider size={4} />
|
|
42
40
|
<Typography variant="title" size="small">
|
|
43
|
-
{errorMessages().
|
|
41
|
+
{errorMessages().noResultError.title}
|
|
44
42
|
</Typography>
|
|
45
43
|
{!!info.description && (
|
|
46
44
|
<Typography
|