@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
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
HighSlippageWarning,
|
|
3
|
+
InsufficientSlippageWarning,
|
|
4
|
+
} from '../../types';
|
|
5
|
+
|
|
6
|
+
import { i18n } from '@lingui/core';
|
|
7
|
+
import { Button, Divider, MessageBox, Modal, Typography } from '@rango-dev/ui';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { useNavigate } from 'react-router-dom';
|
|
10
|
+
|
|
11
|
+
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
12
|
+
import { useSettingsStore } from '../../store/settings';
|
|
13
|
+
import { QuoteWarningType } from '../../types';
|
|
14
|
+
import { getContainer } from '../../utils/common';
|
|
15
|
+
|
|
16
|
+
type PropsTypes = {
|
|
17
|
+
open: boolean;
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
onConfirm: () => void;
|
|
20
|
+
warning: InsufficientSlippageWarning | HighSlippageWarning;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export function SlippageWarningModal(props: PropsTypes) {
|
|
24
|
+
const { customSlippage, slippage } = useSettingsStore();
|
|
25
|
+
const { open, onClose, onConfirm, warning } = props;
|
|
26
|
+
const navigate = useNavigate();
|
|
27
|
+
const userSlippage = customSlippage ?? slippage;
|
|
28
|
+
return (
|
|
29
|
+
<Modal
|
|
30
|
+
anchor="bottom"
|
|
31
|
+
open={open}
|
|
32
|
+
prefix={
|
|
33
|
+
<Button
|
|
34
|
+
size="small"
|
|
35
|
+
variant="ghost"
|
|
36
|
+
onClick={() => navigate('../' + navigationRoutes.settings)}>
|
|
37
|
+
<Typography variant="label" size="medium" color="$neutral900">
|
|
38
|
+
{i18n.t('Change settings')}
|
|
39
|
+
</Typography>
|
|
40
|
+
</Button>
|
|
41
|
+
}
|
|
42
|
+
container={getContainer()}
|
|
43
|
+
onClose={onClose}>
|
|
44
|
+
<MessageBox
|
|
45
|
+
type="warning"
|
|
46
|
+
title={
|
|
47
|
+
warning.type === QuoteWarningType.HIGH_SLIPPAGE
|
|
48
|
+
? i18n.t('High slippage')
|
|
49
|
+
: i18n.t('Low slippage')
|
|
50
|
+
}
|
|
51
|
+
description={
|
|
52
|
+
warning.type === QuoteWarningType.HIGH_SLIPPAGE
|
|
53
|
+
? i18n.t({
|
|
54
|
+
id: ' Caution, your slippage is high (={userSlippage}). Your trade may be front run.',
|
|
55
|
+
values: { userSlippage },
|
|
56
|
+
})
|
|
57
|
+
: i18n.t({
|
|
58
|
+
id: 'We recommend you to increase slippage to at least {minRequiredSlippage} for this route.',
|
|
59
|
+
values: {
|
|
60
|
+
minRequiredSlippage: warning.minRequiredSlippage,
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
}>
|
|
64
|
+
<Divider size={18} />
|
|
65
|
+
<Divider size={32} />
|
|
66
|
+
<Button
|
|
67
|
+
size="large"
|
|
68
|
+
type="primary"
|
|
69
|
+
variant="contained"
|
|
70
|
+
fullWidth
|
|
71
|
+
onClick={onConfirm}>
|
|
72
|
+
{i18n.t('Confirm anyway')}
|
|
73
|
+
</Button>
|
|
74
|
+
</MessageBox>
|
|
75
|
+
</Modal>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { UnknownPriceWarning } from '../../types';
|
|
2
|
+
|
|
3
|
+
import { Button, Divider, MessageBox, Modal, WarningIcon } from '@rango-dev/ui';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import { errorMessages } from '../../constants/errors';
|
|
7
|
+
import { getContainer } from '../../utils/common';
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
open: boolean;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
onConfirm: () => void;
|
|
13
|
+
warning: UnknownPriceWarning;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function UnknownPriceWarningModal(props: Props) {
|
|
17
|
+
const { open, onClose, onConfirm } = props;
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Modal open={open} onClose={onClose} container={getContainer()}>
|
|
21
|
+
<MessageBox
|
|
22
|
+
type="warning"
|
|
23
|
+
title={errorMessages().unknownPriceError.impactTitle}
|
|
24
|
+
description={errorMessages().unknownPriceError.description}
|
|
25
|
+
/>
|
|
26
|
+
|
|
27
|
+
<Divider size={32} />
|
|
28
|
+
<Button
|
|
29
|
+
type="primary"
|
|
30
|
+
size="large"
|
|
31
|
+
prefix={<WarningIcon />}
|
|
32
|
+
fullWidth
|
|
33
|
+
onClick={onConfirm}>
|
|
34
|
+
{errorMessages().unknownPriceError.confirmMessage}
|
|
35
|
+
</Button>
|
|
36
|
+
</Modal>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { QuoteWarningsAndErrors } from './QuoteWarningsAndErrors';
|
|
@@ -10,8 +10,6 @@ import {
|
|
|
10
10
|
} from '@rango-dev/ui';
|
|
11
11
|
import React from 'react';
|
|
12
12
|
|
|
13
|
-
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
14
|
-
import { useNavigateBack } from '../../hooks/useNavigateBack';
|
|
15
13
|
import { SuffixContainer } from '../HeaderButtons/HeaderButtons.styles';
|
|
16
14
|
import { Layout } from '../Layout';
|
|
17
15
|
import { LoadingSwapDetails } from '../LoadingSwapDetails';
|
|
@@ -24,14 +22,12 @@ import {
|
|
|
24
22
|
|
|
25
23
|
export function SwapDetailsPlaceholder(props: SwapDetailsPlaceholderPropTypes) {
|
|
26
24
|
const { requestId, showSkeleton } = props;
|
|
27
|
-
const { navigateBackFrom } = useNavigateBack();
|
|
28
25
|
|
|
29
26
|
return (
|
|
30
27
|
<Layout
|
|
31
28
|
noPadding
|
|
32
29
|
header={{
|
|
33
30
|
title: i18n.t('Swap and Bridge'),
|
|
34
|
-
onBack: navigateBackFrom.bind(null, navigationRoutes.swapDetails),
|
|
35
31
|
suffix: <SuffixContainer />,
|
|
36
32
|
}}>
|
|
37
33
|
{showSkeleton && (
|
|
@@ -13,8 +13,7 @@ import {
|
|
|
13
13
|
CopyIcon,
|
|
14
14
|
Divider,
|
|
15
15
|
IconButton,
|
|
16
|
-
|
|
17
|
-
RouteSummary,
|
|
16
|
+
QuoteCost,
|
|
18
17
|
StepDetails,
|
|
19
18
|
Typography,
|
|
20
19
|
useCopyToClipboard,
|
|
@@ -23,7 +22,6 @@ import { useWallets } from '@rango-dev/wallets-react';
|
|
|
23
22
|
import React, { useEffect, useRef, useState } from 'react';
|
|
24
23
|
import { useNavigate } from 'react-router-dom';
|
|
25
24
|
|
|
26
|
-
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
27
25
|
import {
|
|
28
26
|
GAS_FEE_MAX_DECIMALS,
|
|
29
27
|
GAS_FEE_MIN_DECIMALS,
|
|
@@ -34,19 +32,17 @@ import {
|
|
|
34
32
|
USD_VALUE_MAX_DECIMALS,
|
|
35
33
|
USD_VALUE_MIN_DECIMALS,
|
|
36
34
|
} from '../../constants/routing';
|
|
37
|
-
import {
|
|
38
|
-
import { useBestRouteStore } from '../../store/bestRoute';
|
|
39
|
-
import { useMetaStore } from '../../store/meta';
|
|
35
|
+
import { useAppStore } from '../../store/AppStore';
|
|
40
36
|
import { useNotificationStore } from '../../store/notification';
|
|
37
|
+
import { useQuoteStore } from '../../store/quote';
|
|
41
38
|
import {
|
|
42
39
|
numberToString,
|
|
43
40
|
secondsToString,
|
|
44
41
|
totalArrivalTime,
|
|
45
42
|
} from '../../utils/numbers';
|
|
46
|
-
import { getPriceImpactLevel } from '../../utils/
|
|
43
|
+
import { getPriceImpact, getPriceImpactLevel } from '../../utils/quote';
|
|
47
44
|
import {
|
|
48
45
|
getLastConvertedTokenInFailedSwap,
|
|
49
|
-
getPercentageChange,
|
|
50
46
|
getSwapMessages,
|
|
51
47
|
shouldRetrySwap,
|
|
52
48
|
} from '../../utils/swap';
|
|
@@ -54,6 +50,7 @@ import { getSwapDate } from '../../utils/time';
|
|
|
54
50
|
import { getConciseAddress, getUsdPrice } from '../../utils/wallets';
|
|
55
51
|
import { SuffixContainer } from '../HeaderButtons/HeaderButtons.styles';
|
|
56
52
|
import { Layout } from '../Layout';
|
|
53
|
+
import { QuoteSummary } from '../Quote';
|
|
57
54
|
import {
|
|
58
55
|
SwapDetailsCompleteModal,
|
|
59
56
|
SwapDetailsModal,
|
|
@@ -65,18 +62,16 @@ import { Container, HeaderDetails, StepsList } from './SwapDetails.styles';
|
|
|
65
62
|
export function SwapDetails(props: SwapDetailsProps) {
|
|
66
63
|
const { swap, requestId, onDelete, onCancel: onCancelProps } = props;
|
|
67
64
|
const { canSwitchNetworkTo, connect, getWalletInfo } = useWallets();
|
|
68
|
-
const
|
|
65
|
+
const blockchains = useAppStore().blockchains();
|
|
66
|
+
const tokens = useAppStore().tokens();
|
|
67
|
+
const retry = useQuoteStore.use.retry();
|
|
69
68
|
const navigate = useNavigate();
|
|
70
|
-
const { navigateBackFrom } = useNavigateBack();
|
|
71
69
|
const [_, handleCopy] = useCopyToClipboard(RESET_INTERVAL);
|
|
72
70
|
const listRef = useRef<HTMLDivElement | null>(null);
|
|
73
71
|
const [modalState, setModalState] = useState<ModalState>(null);
|
|
74
72
|
const [showCompletedModal, setShowCompletedModal] = useState<
|
|
75
73
|
'success' | 'failed' | null
|
|
76
74
|
>(null);
|
|
77
|
-
const {
|
|
78
|
-
meta: { tokens, blockchains },
|
|
79
|
-
} = useMetaStore();
|
|
80
75
|
|
|
81
76
|
const onCancel = () => {
|
|
82
77
|
onCancelProps();
|
|
@@ -151,7 +146,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
151
146
|
showNetworkModal: currentStepNetworkStatus,
|
|
152
147
|
setNetworkModal: setModalState,
|
|
153
148
|
message: stepMessage,
|
|
154
|
-
blockchains,
|
|
149
|
+
blockchains: blockchains,
|
|
155
150
|
});
|
|
156
151
|
const numberOfSteps = steps.length;
|
|
157
152
|
const [firstStep, lastStep] = [swap.steps[0], swap.steps[numberOfSteps - 1]];
|
|
@@ -201,7 +196,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
201
196
|
USD_VALUE_MAX_DECIMALS
|
|
202
197
|
);
|
|
203
198
|
|
|
204
|
-
const percentageChange =
|
|
199
|
+
const percentageChange = getPriceImpact(inputUsdValue, outputUsdValue);
|
|
205
200
|
|
|
206
201
|
const completeModalDesc =
|
|
207
202
|
swap.status === 'success'
|
|
@@ -239,7 +234,6 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
239
234
|
noPadding
|
|
240
235
|
header={{
|
|
241
236
|
title: i18n.t('Swap and Bridge'),
|
|
242
|
-
onBack: navigateBackFrom.bind(null, navigationRoutes.swapDetails),
|
|
243
237
|
onCancel:
|
|
244
238
|
swap.status === 'running' ? () => setModalState('cancel') : undefined,
|
|
245
239
|
suffix: swap.status !== 'running' && (
|
|
@@ -265,9 +259,10 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
265
259
|
type="primary"
|
|
266
260
|
size="large"
|
|
267
261
|
onClick={() => {
|
|
268
|
-
retry(swap);
|
|
262
|
+
retry(swap, { blockchains: blockchains, tokens: tokens });
|
|
269
263
|
setTimeout(() => {
|
|
270
|
-
|
|
264
|
+
const home = '../../';
|
|
265
|
+
navigate(home);
|
|
271
266
|
}, 0);
|
|
272
267
|
}}>
|
|
273
268
|
{i18n.t('Try again')}
|
|
@@ -302,7 +297,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
302
297
|
</HeaderDetails>
|
|
303
298
|
|
|
304
299
|
<div className="output">
|
|
305
|
-
<
|
|
300
|
+
<QuoteCost
|
|
306
301
|
fee={numberToString(
|
|
307
302
|
String(totalFee),
|
|
308
303
|
GAS_FEE_MIN_DECIMALS,
|
|
@@ -311,7 +306,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
311
306
|
time={secondsToString(totalArrivalTime(swap.steps))}
|
|
312
307
|
steps={numberOfSteps}
|
|
313
308
|
/>
|
|
314
|
-
<
|
|
309
|
+
<QuoteSummary
|
|
315
310
|
from={{
|
|
316
311
|
price: {
|
|
317
312
|
value: numberToString(
|
|
@@ -353,9 +348,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
353
348
|
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
354
349
|
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
355
350
|
)}
|
|
356
|
-
warningLevel={getPriceImpactLevel(
|
|
357
|
-
percentageChange?.toNumber() ?? 0
|
|
358
|
-
)}
|
|
351
|
+
warningLevel={getPriceImpactLevel(percentageChange ?? 0)}
|
|
359
352
|
/>
|
|
360
353
|
</div>
|
|
361
354
|
<div className="title-steps">
|
|
@@ -377,7 +370,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
377
370
|
<StepDetails
|
|
378
371
|
key={key}
|
|
379
372
|
step={step}
|
|
380
|
-
type="
|
|
373
|
+
type="swap-progress"
|
|
381
374
|
ref={listRef}
|
|
382
375
|
state={state}
|
|
383
376
|
hasSeparator={index !== 0}
|
|
@@ -12,8 +12,6 @@ import {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { useNavigate } from 'react-router-dom';
|
|
14
14
|
|
|
15
|
-
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
16
|
-
|
|
17
15
|
export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
|
|
18
16
|
const {
|
|
19
17
|
open,
|
|
@@ -70,7 +68,10 @@ export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
|
|
|
70
68
|
variant="contained"
|
|
71
69
|
type="primary"
|
|
72
70
|
size="large"
|
|
73
|
-
onClick={() =>
|
|
71
|
+
onClick={() => {
|
|
72
|
+
const home = '../../';
|
|
73
|
+
navigate(home);
|
|
74
|
+
}}>
|
|
74
75
|
<Typography variant="title" size="medium" color="neutral100">
|
|
75
76
|
{i18n.t('Done')}
|
|
76
77
|
</Typography>
|
|
@@ -10,8 +10,8 @@ export const CancelContent = ({ onCancel, onClose }: CancelContentProps) => {
|
|
|
10
10
|
<Divider size={20} />
|
|
11
11
|
<MessageBox
|
|
12
12
|
type="error"
|
|
13
|
-
title={i18n.t('
|
|
14
|
-
description={i18n.t('Are you sure you want to
|
|
13
|
+
title={i18n.t('Cancel Swap')}
|
|
14
|
+
description={i18n.t('Are you sure you want to cancel this swap?')}
|
|
15
15
|
/>
|
|
16
16
|
<Divider size={32} />
|
|
17
17
|
<Button
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import { styled } from '@rango-dev/ui';
|
|
1
|
+
import { darkTheme, styled } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
3
|
export const Group = styled('div', {
|
|
4
4
|
width: '100%',
|
|
5
5
|
display: 'flex',
|
|
6
6
|
flexDirection: 'column',
|
|
7
|
+
'.group-title': {
|
|
8
|
+
$$color: '$colors$neutral600',
|
|
9
|
+
[`.${darkTheme} &`]: {
|
|
10
|
+
$$color: '$colors$neutral700',
|
|
11
|
+
},
|
|
12
|
+
color: '$$color',
|
|
13
|
+
},
|
|
7
14
|
});
|
|
8
15
|
|
|
9
16
|
export const Time = styled('div', {
|
|
@@ -34,7 +34,6 @@ export function SwapsGroup(props: PropTypes) {
|
|
|
34
34
|
<Typography
|
|
35
35
|
variant="label"
|
|
36
36
|
size="medium"
|
|
37
|
-
color="neutral600"
|
|
38
37
|
className="group-title">
|
|
39
38
|
{i18n.t(group.title)}
|
|
40
39
|
</Typography>
|
|
@@ -68,7 +67,6 @@ export function SwapsGroup(props: PropTypes) {
|
|
|
68
67
|
<Typography
|
|
69
68
|
variant="label"
|
|
70
69
|
size="medium"
|
|
71
|
-
color="neutral600"
|
|
72
70
|
className="group-title">
|
|
73
71
|
{i18n.t(group.title)}
|
|
74
72
|
</Typography>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReverseIcon, styled } from '@rango-dev/ui';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { useQuoteStore } from '../store/quote';
|
|
5
5
|
|
|
6
6
|
const SwitchButtonContainer = styled('div', {
|
|
7
7
|
position: 'absolute',
|
|
@@ -27,7 +27,7 @@ const StyledButton = styled('div', {
|
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
export function SwitchFromAndToButton() {
|
|
30
|
-
const switchFromAndTo =
|
|
30
|
+
const switchFromAndTo = useQuoteStore.use.switchFromAndTo();
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<SwitchButtonContainer>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { styled, Typography } from '@rango-dev/ui';
|
|
1
|
+
import { darkTheme, styled, Typography } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
3
|
export const Container = styled('div', {
|
|
4
4
|
display: 'flex',
|
|
@@ -40,7 +40,11 @@ export const List = styled('ul', {
|
|
|
40
40
|
'& a': {
|
|
41
41
|
fontSize: '$12',
|
|
42
42
|
lineHeight: '$16',
|
|
43
|
-
color: '$neutral600',
|
|
43
|
+
$$color: '$colors$neutral600',
|
|
44
|
+
[`.${darkTheme} &`]: {
|
|
45
|
+
$$color: '$colors$neutral700',
|
|
46
|
+
},
|
|
47
|
+
color: '$$color',
|
|
44
48
|
textDecoration: 'none',
|
|
45
49
|
},
|
|
46
50
|
},
|
|
@@ -92,6 +96,14 @@ export const TagTitle = styled(Typography, {});
|
|
|
92
96
|
|
|
93
97
|
export const BalanceContainer = styled('div', {
|
|
94
98
|
textAlign: 'right',
|
|
99
|
+
|
|
100
|
+
'.usd-value': {
|
|
101
|
+
$$color: '$colors$neutral600',
|
|
102
|
+
[`.${darkTheme} &`]: {
|
|
103
|
+
$$color: '$colors$neutral700',
|
|
104
|
+
},
|
|
105
|
+
color: '$$color',
|
|
106
|
+
},
|
|
95
107
|
});
|
|
96
108
|
|
|
97
109
|
export const End = styled('ul', {
|
|
@@ -21,8 +21,7 @@ import {
|
|
|
21
21
|
} from '@rango-dev/ui';
|
|
22
22
|
import React, { forwardRef, useEffect, useState } from 'react';
|
|
23
23
|
|
|
24
|
-
import { useAppStore } from '../../store/
|
|
25
|
-
import { useMetaStore } from '../../store/meta';
|
|
24
|
+
import { useAppStore } from '../../store/AppStore';
|
|
26
25
|
import { useWalletsStore } from '../../store/wallets';
|
|
27
26
|
import { generateRangeColors } from '../../utils/colors';
|
|
28
27
|
|
|
@@ -87,10 +86,10 @@ export function TokenList(props: PropTypes) {
|
|
|
87
86
|
const { list, searchedFor = '', onChange, selectedBlockchain } = props;
|
|
88
87
|
|
|
89
88
|
const [tokens, setTokens] = useState<TokenWithBalance[]>(list);
|
|
90
|
-
const
|
|
89
|
+
const fetchStatus = useAppStore().fetchStatus;
|
|
90
|
+
const blockchains = useAppStore().blockchains();
|
|
91
91
|
const [hasNextPage, setHasNextPage] = useState<boolean>(true);
|
|
92
92
|
const loadingWallet = useWalletsStore.use.loading();
|
|
93
|
-
const { blockchains } = useMetaStore.use.meta();
|
|
94
93
|
const { isTokenPinned } = useAppStore();
|
|
95
94
|
|
|
96
95
|
// eslint-disable-next-line react/display-name
|
|
@@ -239,7 +238,7 @@ export function TokenList(props: PropTypes) {
|
|
|
239
238
|
{token.balance?.usdValue && (
|
|
240
239
|
<Typography
|
|
241
240
|
variant="body"
|
|
242
|
-
|
|
241
|
+
className="usd-value"
|
|
243
242
|
size="xsmall">
|
|
244
243
|
{`$${token.balance?.usdValue}`}
|
|
245
244
|
</Typography>
|
|
@@ -268,8 +267,8 @@ export function TokenList(props: PropTypes) {
|
|
|
268
267
|
{i18n.t('Select Token')}
|
|
269
268
|
</Typography>
|
|
270
269
|
<Divider size={4} />
|
|
271
|
-
{
|
|
272
|
-
{
|
|
270
|
+
{fetchStatus === 'loading' && <LoadingTokenList size={PAGE_SIZE} />}
|
|
271
|
+
{fetchStatus === 'success' && <List>{renderList()}</List>}
|
|
273
272
|
</Container>
|
|
274
273
|
);
|
|
275
274
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { WidgetConfig } from '../types';
|
|
2
|
-
|
|
3
1
|
import { useEffect, useRef } from 'react';
|
|
4
2
|
import {
|
|
5
3
|
createSearchParams,
|
|
@@ -10,33 +8,32 @@ import {
|
|
|
10
8
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
11
9
|
import { SearchParams } from '../constants/searchParams';
|
|
12
10
|
import { useSyncStoresWithConfig } from '../hooks/useSyncStoresWithConfig';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
11
|
+
import { useAppStore } from '../store/AppStore';
|
|
12
|
+
import { useQuoteStore } from '../store/quote';
|
|
15
13
|
import { useUiStore } from '../store/ui';
|
|
16
|
-
import { searchParamsToToken } from '../utils/
|
|
17
|
-
|
|
18
|
-
type Props = { config: WidgetConfig | undefined };
|
|
14
|
+
import { searchParamsToToken } from '../utils/quote';
|
|
19
15
|
|
|
20
|
-
export function UpdateUrl(
|
|
16
|
+
export function UpdateUrl() {
|
|
21
17
|
const firstRender = useRef(true);
|
|
22
18
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
23
19
|
const location = useLocation();
|
|
24
20
|
const firstRenderSearchParams = useRef(location.search);
|
|
25
21
|
const searchParamsRef = useRef<Record<string, string>>({});
|
|
26
|
-
const fromBlockchain =
|
|
27
|
-
const toBlockchain =
|
|
28
|
-
const fromToken =
|
|
29
|
-
const toToken =
|
|
30
|
-
const setFromBlockchain =
|
|
31
|
-
const setFromToken =
|
|
32
|
-
const setToBlockchain =
|
|
33
|
-
const setToToken =
|
|
34
|
-
const inputAmount =
|
|
35
|
-
const setInputAmount =
|
|
36
|
-
const
|
|
37
|
-
const
|
|
22
|
+
const fromBlockchain = useQuoteStore.use.fromBlockchain();
|
|
23
|
+
const toBlockchain = useQuoteStore.use.toBlockchain();
|
|
24
|
+
const fromToken = useQuoteStore.use.fromToken();
|
|
25
|
+
const toToken = useQuoteStore.use.toToken();
|
|
26
|
+
const setFromBlockchain = useQuoteStore.use.setFromBlockchain();
|
|
27
|
+
const setFromToken = useQuoteStore.use.setFromToken();
|
|
28
|
+
const setToBlockchain = useQuoteStore.use.setToBlockchain();
|
|
29
|
+
const setToToken = useQuoteStore.use.setToToken();
|
|
30
|
+
const inputAmount = useQuoteStore.use.inputAmount();
|
|
31
|
+
const setInputAmount = useQuoteStore.use.setInputAmount();
|
|
32
|
+
const fetchMetaStatus = useAppStore().fetchStatus;
|
|
33
|
+
const blockchains = useAppStore().blockchains();
|
|
34
|
+
const tokens = useAppStore().tokens();
|
|
38
35
|
const setSelectedSwap = useUiStore.use.setSelectedSwap();
|
|
39
|
-
useSyncStoresWithConfig(
|
|
36
|
+
useSyncStoresWithConfig();
|
|
40
37
|
|
|
41
38
|
useEffect(() => {
|
|
42
39
|
const params: Record<string, string> = {};
|
|
@@ -60,7 +57,8 @@ export function UpdateUrl(props: Props) {
|
|
|
60
57
|
toChainString = '',
|
|
61
58
|
toTokenString = '',
|
|
62
59
|
fromAmount = '';
|
|
63
|
-
|
|
60
|
+
const autoConnect = searchParamsRef.current[SearchParams.AUTO_CONNECT];
|
|
61
|
+
if (fetchMetaStatus !== 'success') {
|
|
64
62
|
fromChainString = searchParamsRef.current[SearchParams.FROM_CHAIN];
|
|
65
63
|
fromTokenString = searchParamsRef.current[SearchParams.FROM_TOKEN];
|
|
66
64
|
toChainString = searchParamsRef.current[SearchParams.TO_CHAIN];
|
|
@@ -68,9 +66,6 @@ export function UpdateUrl(props: Props) {
|
|
|
68
66
|
fromAmount =
|
|
69
67
|
searchParamsRef.current[SearchParams.FROM_AMOUNT] || inputAmount;
|
|
70
68
|
} else {
|
|
71
|
-
if (location.state === 'redirect') {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
69
|
fromChainString = fromBlockchain?.name || '';
|
|
75
70
|
fromTokenString =
|
|
76
71
|
(fromToken?.symbol || '') +
|
|
@@ -94,6 +89,9 @@ export function UpdateUrl(props: Props) {
|
|
|
94
89
|
...(fromAmount && {
|
|
95
90
|
[SearchParams.FROM_AMOUNT]: fromAmount.toString(),
|
|
96
91
|
}),
|
|
92
|
+
...(autoConnect && {
|
|
93
|
+
[SearchParams.AUTO_CONNECT]: autoConnect,
|
|
94
|
+
}),
|
|
97
95
|
},
|
|
98
96
|
{ replace: true }
|
|
99
97
|
);
|
|
@@ -109,7 +107,7 @@ export function UpdateUrl(props: Props) {
|
|
|
109
107
|
]);
|
|
110
108
|
|
|
111
109
|
useEffect(() => {
|
|
112
|
-
if (
|
|
110
|
+
if (fetchMetaStatus === 'success') {
|
|
113
111
|
const fromChainString = searchParams.get(SearchParams.FROM_CHAIN);
|
|
114
112
|
const fromTokenString = searchParams.get(SearchParams.FROM_TOKEN);
|
|
115
113
|
const toChainString = searchParams.get(SearchParams.TO_CHAIN);
|
|
@@ -134,20 +132,29 @@ export function UpdateUrl(props: Props) {
|
|
|
134
132
|
if (!!fromBlockchain) {
|
|
135
133
|
setFromBlockchain(fromBlockchain);
|
|
136
134
|
if (!!fromToken) {
|
|
137
|
-
setFromToken(
|
|
135
|
+
setFromToken({
|
|
136
|
+
token: fromToken,
|
|
137
|
+
meta: {
|
|
138
|
+
blockchains: blockchains,
|
|
139
|
+
tokens: tokens,
|
|
140
|
+
},
|
|
141
|
+
});
|
|
138
142
|
}
|
|
139
143
|
}
|
|
140
144
|
if (!!toBlockchain) {
|
|
141
145
|
setToBlockchain(toBlockchain);
|
|
142
146
|
if (!!toToken) {
|
|
143
|
-
setToToken(
|
|
147
|
+
setToToken({
|
|
148
|
+
token: toToken,
|
|
149
|
+
meta: { blockchains: blockchains, tokens: tokens },
|
|
150
|
+
});
|
|
144
151
|
}
|
|
145
152
|
}
|
|
146
153
|
if (fromAmount) {
|
|
147
154
|
setInputAmount(fromAmount);
|
|
148
155
|
}
|
|
149
156
|
}
|
|
150
|
-
}, [
|
|
157
|
+
}, [fetchMetaStatus]);
|
|
151
158
|
|
|
152
159
|
return null;
|
|
153
160
|
}
|
|
@@ -8,11 +8,13 @@ import {
|
|
|
8
8
|
} from '@rango-dev/queue-manager-rango-preset';
|
|
9
9
|
import { useEffect } from 'react';
|
|
10
10
|
|
|
11
|
+
import { useAppStore } from '../store/AppStore';
|
|
11
12
|
import { useNotificationStore } from '../store/notification';
|
|
12
13
|
import { useWalletsStore } from '../store/wallets';
|
|
13
14
|
import { validBlockedStatuses } from '../types/notification';
|
|
14
15
|
|
|
15
16
|
export function WidgetEvents() {
|
|
17
|
+
const tokens = useAppStore().tokens();
|
|
16
18
|
const connectedWallets = useWalletsStore.use.connectedWallets();
|
|
17
19
|
const getWalletsDetails = useWalletsStore.use.getWalletsDetails();
|
|
18
20
|
const setNotification = useNotificationStore.use.setNotification();
|
|
@@ -38,8 +40,8 @@ export function WidgetEvents() {
|
|
|
38
40
|
(wallet) => wallet.chain === step?.toBlockchain
|
|
39
41
|
);
|
|
40
42
|
|
|
41
|
-
fromAccount && getWalletsDetails([fromAccount]);
|
|
42
|
-
toAccount && getWalletsDetails([toAccount]);
|
|
43
|
+
fromAccount && getWalletsDetails([fromAccount], tokens);
|
|
44
|
+
toAccount && getWalletsDetails([toAccount], tokens);
|
|
43
45
|
}
|
|
44
46
|
if (
|
|
45
47
|
(event.type === StepEventType.TX_EXECUTION_BLOCKED &&
|