@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 @@
|
|
|
1
|
+
export { NoResult } from './NoResult';
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { useNavigate } from 'react-router-dom';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
14
|
+
import { useAppStore } from '../../store/AppStore';
|
|
14
15
|
import { useNotificationStore } from '../../store/notification';
|
|
15
16
|
import { useUiStore } from '../../store/ui';
|
|
16
17
|
|
|
@@ -26,14 +27,15 @@ export function NotificationContent() {
|
|
|
26
27
|
const { getUnreadNotifications } = useNotificationStore();
|
|
27
28
|
|
|
28
29
|
const notifications: Notification[] = getUnreadNotifications();
|
|
29
|
-
const
|
|
30
|
+
const blockchains = useAppStore().blockchains();
|
|
31
|
+
const tokens = useAppStore().tokens();
|
|
30
32
|
const sortedNotification = notifications
|
|
31
33
|
.sort((a, b) => b.creationTime - a.creationTime)
|
|
32
34
|
.slice(0, MAX_NOTIFICATIONS_DISPLAYED);
|
|
33
35
|
|
|
34
36
|
const handleOnClick = (requestId: Notification['requestId']) => {
|
|
35
37
|
setSelectedSwap(requestId);
|
|
36
|
-
navigate(
|
|
38
|
+
navigate(`${navigationRoutes.swaps}/${requestId}`);
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
return (
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import * as Collapsible from '@radix-ui/react-collapsible';
|
|
2
|
+
import { darkTheme, Image, styled } from '@rango-dev/ui';
|
|
3
|
+
|
|
4
|
+
import { CollapsibleContent } from '../ConfirmWalletsModal/ConfirmWallets.styles';
|
|
5
|
+
|
|
6
|
+
export const EXPANDABLE_QUOTE_TRANSITION_DURATION = 300;
|
|
7
|
+
|
|
8
|
+
export const QuoteContainer = styled(Collapsible.Root, {
|
|
9
|
+
display: 'flex',
|
|
10
|
+
flexDirection: 'column',
|
|
11
|
+
alignItems: 'start',
|
|
12
|
+
overflowX: 'auto',
|
|
13
|
+
overflowY: 'hidden',
|
|
14
|
+
width: '100%',
|
|
15
|
+
borderRadius: '$xm',
|
|
16
|
+
cursor: 'default',
|
|
17
|
+
variants: {
|
|
18
|
+
recommended: {
|
|
19
|
+
true: {
|
|
20
|
+
$$color: '$colors$info300',
|
|
21
|
+
[`.${darkTheme} &`]: {
|
|
22
|
+
$$color: '$colors$secondary800',
|
|
23
|
+
},
|
|
24
|
+
backgroundColor: '$$color',
|
|
25
|
+
},
|
|
26
|
+
false: {
|
|
27
|
+
$$color: '$colors$neutral400',
|
|
28
|
+
[`.${darkTheme} &`]: {
|
|
29
|
+
$$color: '$colors$neutral200',
|
|
30
|
+
},
|
|
31
|
+
backgroundColor: '$$color',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
'& .steps-details': {
|
|
36
|
+
padding: '$10 $15',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export const SummaryContainer = styled('div', {
|
|
41
|
+
borderRadius: '$xm',
|
|
42
|
+
display: 'flex',
|
|
43
|
+
flexDirection: 'column',
|
|
44
|
+
alignItems: 'start',
|
|
45
|
+
justifyContent: 'space-between',
|
|
46
|
+
color: '$foreground',
|
|
47
|
+
cursor: 'pointer',
|
|
48
|
+
boxSizing: 'border-box',
|
|
49
|
+
position: 'relative',
|
|
50
|
+
variants: {
|
|
51
|
+
recommended: {
|
|
52
|
+
true: {
|
|
53
|
+
$$color: '$colors$info100',
|
|
54
|
+
[`.${darkTheme} &`]: {
|
|
55
|
+
$$color: '$colors$secondary600',
|
|
56
|
+
},
|
|
57
|
+
backgroundColor: '$$color',
|
|
58
|
+
'&:hover': {
|
|
59
|
+
backgroundColor: '$$color',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
false: {
|
|
63
|
+
$$color: '$colors$neutral200',
|
|
64
|
+
[`.${darkTheme} &`]: {
|
|
65
|
+
$$color: '$colors$neutral500',
|
|
66
|
+
},
|
|
67
|
+
backgroundColor: '$$color',
|
|
68
|
+
'&:hover': {
|
|
69
|
+
backgroundColor: '$$color',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
basic: { true: { borderTopRightRadius: '0', borderTopLeftRadius: '0' } },
|
|
74
|
+
listItem: {
|
|
75
|
+
true: {},
|
|
76
|
+
false: {},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
compoundVariants: [
|
|
81
|
+
{
|
|
82
|
+
listItem: true,
|
|
83
|
+
recommended: true,
|
|
84
|
+
css: {
|
|
85
|
+
'&:hover': {
|
|
86
|
+
$$color: '$colors$secondary200',
|
|
87
|
+
[`.${darkTheme} &`]: {
|
|
88
|
+
$$color: '$colors$secondary700',
|
|
89
|
+
},
|
|
90
|
+
backgroundColor: '$$color',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
listItem: true,
|
|
96
|
+
recommended: false,
|
|
97
|
+
css: {
|
|
98
|
+
'&:hover': {
|
|
99
|
+
$$color: '$colors$neutral300',
|
|
100
|
+
[`.${darkTheme} &`]: {
|
|
101
|
+
$$color: '$colors$neutral400',
|
|
102
|
+
},
|
|
103
|
+
backgroundColor: '$$color',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
'& .summary': {
|
|
109
|
+
width: '100%',
|
|
110
|
+
padding: '$15 $15 $10 $15',
|
|
111
|
+
cursor: 'default',
|
|
112
|
+
},
|
|
113
|
+
'& .basic-info': {
|
|
114
|
+
paddingTop: '$10',
|
|
115
|
+
display: 'flex',
|
|
116
|
+
alignItems: 'center',
|
|
117
|
+
'.usd-value': {
|
|
118
|
+
$$color: '$colors$neutral600',
|
|
119
|
+
[`.${darkTheme} &`]: {
|
|
120
|
+
$$color: '$colors$neutral700',
|
|
121
|
+
},
|
|
122
|
+
color: '$$color',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
export const Chains = styled(Collapsible.Trigger, {
|
|
128
|
+
display: 'flex',
|
|
129
|
+
width: '100%',
|
|
130
|
+
justifyContent: 'space-between',
|
|
131
|
+
alignItems: 'center',
|
|
132
|
+
height: '$36',
|
|
133
|
+
padding: '$10 $15',
|
|
134
|
+
boxSizing: 'border-box',
|
|
135
|
+
cursor: 'pointer',
|
|
136
|
+
border: 'none',
|
|
137
|
+
outline: 'none',
|
|
138
|
+
backgroundColor: 'transparent',
|
|
139
|
+
variants: {
|
|
140
|
+
error: {
|
|
141
|
+
true: {
|
|
142
|
+
[`& ${Image}`]: {
|
|
143
|
+
border: '1px $warning500 solid',
|
|
144
|
+
borderRadius: '100%',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
false: {
|
|
148
|
+
[`& ${Image}`]: {
|
|
149
|
+
border: '1px transparent solid',
|
|
150
|
+
borderRadius: '100%',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
recommended: {
|
|
155
|
+
true: {
|
|
156
|
+
$$color: '$colors$info300',
|
|
157
|
+
[`.${darkTheme} &`]: {
|
|
158
|
+
$$color: '$colors$secondary800',
|
|
159
|
+
},
|
|
160
|
+
backgroundColor: '$$color',
|
|
161
|
+
},
|
|
162
|
+
false: {
|
|
163
|
+
$$color: '$colors$neutral400',
|
|
164
|
+
[`.${darkTheme} &`]: {
|
|
165
|
+
$$color: '$colors$neutral200',
|
|
166
|
+
},
|
|
167
|
+
backgroundColor: '$$color',
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
'& div:nth-child(1)': { display: 'flex' },
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
export const ChainImageContainer = styled('div', {
|
|
175
|
+
width: '18px',
|
|
176
|
+
height: '18px',
|
|
177
|
+
borderRadius: '100%',
|
|
178
|
+
border: '1.5px transparent solid',
|
|
179
|
+
display: 'flex',
|
|
180
|
+
justifyContent: 'center',
|
|
181
|
+
alignItems: 'center',
|
|
182
|
+
variants: {
|
|
183
|
+
state: {
|
|
184
|
+
error: {
|
|
185
|
+
borderColor: '$error500',
|
|
186
|
+
},
|
|
187
|
+
warning: { borderColor: '$warning500' },
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
export const Content = styled(CollapsibleContent, {
|
|
193
|
+
width: '100%',
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
export const IconContainer = styled('div', {
|
|
197
|
+
display: 'flex',
|
|
198
|
+
justifyContent: 'center',
|
|
199
|
+
alignItems: 'center',
|
|
200
|
+
padding: '$2',
|
|
201
|
+
transition: `all ${EXPANDABLE_QUOTE_TRANSITION_DURATION}ms ease`,
|
|
202
|
+
variants: {
|
|
203
|
+
orientation: {
|
|
204
|
+
down: {
|
|
205
|
+
transform: 'rotate(0)',
|
|
206
|
+
},
|
|
207
|
+
up: {
|
|
208
|
+
transform: 'rotate(180deg)',
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
export const Separator = styled('div', {
|
|
215
|
+
height: '$12',
|
|
216
|
+
marginLeft: '$10',
|
|
217
|
+
marginRight: '$10',
|
|
218
|
+
borderLeft: '1px solid $foreground',
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
export const HorizontalSeparator = styled('div', {
|
|
222
|
+
display: 'flex',
|
|
223
|
+
justifyContent: 'center',
|
|
224
|
+
margin: '0 $15',
|
|
225
|
+
borderTop: '1px solid',
|
|
226
|
+
$$color: '$colors$neutral300',
|
|
227
|
+
[`.${darkTheme} &`]: {
|
|
228
|
+
$$color: '$colors$neutral400',
|
|
229
|
+
},
|
|
230
|
+
borderColor: '$$color',
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
export const FrameIcon = styled('div', {
|
|
234
|
+
width: '$16',
|
|
235
|
+
height: '$16',
|
|
236
|
+
justifyContent: 'center',
|
|
237
|
+
alignItems: 'center',
|
|
238
|
+
display: 'flex',
|
|
239
|
+
});
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
import type { QuoteProps } from './Quote.types';
|
|
2
|
+
import type { Step } from '@rango-dev/ui';
|
|
3
|
+
import type { SwapResult } from 'rango-sdk';
|
|
4
|
+
|
|
5
|
+
import { i18n } from '@lingui/core';
|
|
6
|
+
import {
|
|
7
|
+
Alert,
|
|
8
|
+
ChevronDownIcon,
|
|
9
|
+
ChevronRightIcon,
|
|
10
|
+
Divider,
|
|
11
|
+
Image,
|
|
12
|
+
InfoIcon,
|
|
13
|
+
QuoteCost,
|
|
14
|
+
StepDetails,
|
|
15
|
+
TokenAmount,
|
|
16
|
+
Tooltip,
|
|
17
|
+
Typography,
|
|
18
|
+
} from '@rango-dev/ui';
|
|
19
|
+
import React, { useLayoutEffect, useRef, useState } from 'react';
|
|
20
|
+
|
|
21
|
+
import {
|
|
22
|
+
GAS_FEE_MAX_DECIMALS,
|
|
23
|
+
GAS_FEE_MIN_DECIMALS,
|
|
24
|
+
PERCENTAGE_CHANGE_MAX_DECIMALS,
|
|
25
|
+
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
26
|
+
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
27
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
28
|
+
USD_VALUE_MAX_DECIMALS,
|
|
29
|
+
USD_VALUE_MIN_DECIMALS,
|
|
30
|
+
} from '../../constants/routing';
|
|
31
|
+
import {
|
|
32
|
+
FooterAlert,
|
|
33
|
+
FooterStepAlarm,
|
|
34
|
+
} from '../../containers/QuoteInfo/QuoteInfo.styles';
|
|
35
|
+
import { useAppStore } from '../../store/AppStore';
|
|
36
|
+
import { QuoteErrorType, QuoteWarningType } from '../../types';
|
|
37
|
+
import { getContainer } from '../../utils/common';
|
|
38
|
+
import {
|
|
39
|
+
getBlockchainShortNameFor,
|
|
40
|
+
getSwapperDisplayName,
|
|
41
|
+
} from '../../utils/meta';
|
|
42
|
+
import {
|
|
43
|
+
numberToString,
|
|
44
|
+
secondsToString,
|
|
45
|
+
totalArrivalTime,
|
|
46
|
+
} from '../../utils/numbers';
|
|
47
|
+
import { getPriceImpact, getPriceImpactLevel } from '../../utils/quote';
|
|
48
|
+
import { getTotalFeeInUsd } from '../../utils/swap';
|
|
49
|
+
|
|
50
|
+
import {
|
|
51
|
+
ChainImageContainer,
|
|
52
|
+
Chains,
|
|
53
|
+
Content,
|
|
54
|
+
EXPANDABLE_QUOTE_TRANSITION_DURATION,
|
|
55
|
+
FrameIcon,
|
|
56
|
+
HorizontalSeparator,
|
|
57
|
+
IconContainer,
|
|
58
|
+
QuoteContainer,
|
|
59
|
+
SummaryContainer,
|
|
60
|
+
} from './Quote.styles';
|
|
61
|
+
import { QuoteSummary } from './QuoteSummary';
|
|
62
|
+
|
|
63
|
+
export function Quote(props: QuoteProps) {
|
|
64
|
+
const {
|
|
65
|
+
quote,
|
|
66
|
+
input,
|
|
67
|
+
output,
|
|
68
|
+
error,
|
|
69
|
+
warning,
|
|
70
|
+
type,
|
|
71
|
+
recommended = true,
|
|
72
|
+
} = props;
|
|
73
|
+
const tokens = useAppStore().tokens();
|
|
74
|
+
const blockchains = useAppStore().blockchains();
|
|
75
|
+
const swappers = useAppStore().swappers();
|
|
76
|
+
|
|
77
|
+
const [expanded, setExpanded] = useState(props.expanded);
|
|
78
|
+
const quoteRef = useRef<HTMLButtonElement | null>(null);
|
|
79
|
+
const prevExpanded = useRef(expanded);
|
|
80
|
+
const totalFee = numberToString(
|
|
81
|
+
getTotalFeeInUsd(quote.result?.swaps ?? [], tokens),
|
|
82
|
+
GAS_FEE_MIN_DECIMALS,
|
|
83
|
+
GAS_FEE_MAX_DECIMALS
|
|
84
|
+
);
|
|
85
|
+
const totalTime = secondsToString(totalArrivalTime(quote.result?.swaps));
|
|
86
|
+
const roundedInput = numberToString(
|
|
87
|
+
input.value,
|
|
88
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
89
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
90
|
+
);
|
|
91
|
+
const roundedOutput = numberToString(
|
|
92
|
+
output.value,
|
|
93
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
94
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
95
|
+
);
|
|
96
|
+
const roundedOutputUsdValue = output.usdValue
|
|
97
|
+
? numberToString(
|
|
98
|
+
output.usdValue,
|
|
99
|
+
USD_VALUE_MIN_DECIMALS,
|
|
100
|
+
USD_VALUE_MAX_DECIMALS
|
|
101
|
+
)
|
|
102
|
+
: '';
|
|
103
|
+
const priceImpact = getPriceImpact(input.usdValue, output.usdValue ?? null);
|
|
104
|
+
const percentageChange = numberToString(
|
|
105
|
+
priceImpact,
|
|
106
|
+
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
107
|
+
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
108
|
+
);
|
|
109
|
+
const priceImpactWarningLevel = getPriceImpactLevel(priceImpact ?? 0);
|
|
110
|
+
|
|
111
|
+
const getQuoteSteps = (swaps: SwapResult[]): Step[] => {
|
|
112
|
+
return swaps.map((swap, index) => {
|
|
113
|
+
let stepState: 'error' | 'warning' | undefined = undefined;
|
|
114
|
+
const stepHasError =
|
|
115
|
+
(error?.type === QuoteErrorType.BRIDGE_LIMIT &&
|
|
116
|
+
error.swap.swapperId === swap.swapperId) ||
|
|
117
|
+
(error?.type === QuoteErrorType.INSUFFICIENT_SLIPPAGE &&
|
|
118
|
+
error.recommendedSlippages?.has(index));
|
|
119
|
+
const stepHasWarning =
|
|
120
|
+
warning?.type === QuoteWarningType.INSUFFICIENT_SLIPPAGE &&
|
|
121
|
+
warning.recommendedSlippages?.has(index);
|
|
122
|
+
|
|
123
|
+
if (stepHasError) {
|
|
124
|
+
stepState = 'error';
|
|
125
|
+
} else if (stepHasWarning) {
|
|
126
|
+
stepState = 'warning';
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
swapper: {
|
|
131
|
+
displayName: getSwapperDisplayName(swap.swapperId, swappers),
|
|
132
|
+
image: swap.swapperLogo,
|
|
133
|
+
},
|
|
134
|
+
from: {
|
|
135
|
+
token: { displayName: swap.from.symbol, image: swap.from.logo },
|
|
136
|
+
chain: {
|
|
137
|
+
displayName: getBlockchainShortNameFor(
|
|
138
|
+
swap.from.blockchain,
|
|
139
|
+
blockchains
|
|
140
|
+
),
|
|
141
|
+
image: swap.from.blockchainLogo,
|
|
142
|
+
},
|
|
143
|
+
price: {
|
|
144
|
+
value:
|
|
145
|
+
index === 0
|
|
146
|
+
? numberToString(
|
|
147
|
+
input.value,
|
|
148
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
149
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
150
|
+
)
|
|
151
|
+
: numberToString(
|
|
152
|
+
swap.fromAmount,
|
|
153
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
154
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
155
|
+
),
|
|
156
|
+
usdValue: numberToString(
|
|
157
|
+
(swap.from.usdPrice ?? 0) * parseFloat(swap.fromAmount),
|
|
158
|
+
USD_VALUE_MIN_DECIMALS,
|
|
159
|
+
USD_VALUE_MAX_DECIMALS
|
|
160
|
+
),
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
to: {
|
|
164
|
+
token: { displayName: swap.to.symbol, image: swap.to.logo },
|
|
165
|
+
chain: {
|
|
166
|
+
displayName: getBlockchainShortNameFor(
|
|
167
|
+
swap.to.blockchain,
|
|
168
|
+
blockchains
|
|
169
|
+
),
|
|
170
|
+
image: swap.to.blockchainLogo,
|
|
171
|
+
},
|
|
172
|
+
price: {
|
|
173
|
+
value: numberToString(
|
|
174
|
+
swap.toAmount,
|
|
175
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
176
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
177
|
+
),
|
|
178
|
+
usdValue: numberToString(
|
|
179
|
+
(swap.to.usdPrice ?? 0) * parseFloat(swap.toAmount),
|
|
180
|
+
USD_VALUE_MIN_DECIMALS,
|
|
181
|
+
USD_VALUE_MAX_DECIMALS
|
|
182
|
+
),
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
state: stepState,
|
|
186
|
+
alerts:
|
|
187
|
+
stepHasError || stepHasWarning ? (
|
|
188
|
+
<FooterStepAlarm>
|
|
189
|
+
<Alert
|
|
190
|
+
type={stepHasError ? 'error' : 'warning'}
|
|
191
|
+
title={
|
|
192
|
+
error?.type === QuoteErrorType.BRIDGE_LIMIT
|
|
193
|
+
? error?.recommendation
|
|
194
|
+
: i18n.t('Slippage Error:')
|
|
195
|
+
}
|
|
196
|
+
footer={
|
|
197
|
+
<FooterAlert>
|
|
198
|
+
{error?.type === QuoteErrorType.BRIDGE_LIMIT && (
|
|
199
|
+
<>
|
|
200
|
+
<Typography
|
|
201
|
+
size="xsmall"
|
|
202
|
+
variant="body"
|
|
203
|
+
color="neutral900">
|
|
204
|
+
{error.fromAmountRangeError}
|
|
205
|
+
</Typography>
|
|
206
|
+
<Divider direction="horizontal" size={8} />
|
|
207
|
+
<Typography
|
|
208
|
+
size="xsmall"
|
|
209
|
+
variant="body"
|
|
210
|
+
color="neutral900">
|
|
211
|
+
|
|
|
212
|
+
</Typography>
|
|
213
|
+
<Divider direction="horizontal" size={8} />
|
|
214
|
+
<Typography
|
|
215
|
+
size="xsmall"
|
|
216
|
+
variant="body"
|
|
217
|
+
color="neutral900">
|
|
218
|
+
{i18n.t({
|
|
219
|
+
id: 'Yours: {amount} {symbol}',
|
|
220
|
+
values: {
|
|
221
|
+
amount: numberToString(
|
|
222
|
+
swap.fromAmount,
|
|
223
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
224
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
225
|
+
),
|
|
226
|
+
symbol: swap?.from.symbol,
|
|
227
|
+
},
|
|
228
|
+
})}
|
|
229
|
+
</Typography>
|
|
230
|
+
</>
|
|
231
|
+
)}
|
|
232
|
+
{(error?.type === QuoteErrorType.INSUFFICIENT_SLIPPAGE ||
|
|
233
|
+
warning?.type ===
|
|
234
|
+
QuoteWarningType.INSUFFICIENT_SLIPPAGE) && (
|
|
235
|
+
<Typography
|
|
236
|
+
size="xsmall"
|
|
237
|
+
variant="body"
|
|
238
|
+
color="neutral900">
|
|
239
|
+
{i18n.t({
|
|
240
|
+
id: 'Minimum required slippage is {minRequiredSlippage}',
|
|
241
|
+
values: {
|
|
242
|
+
...(error?.type ===
|
|
243
|
+
QuoteErrorType.INSUFFICIENT_SLIPPAGE && {
|
|
244
|
+
minRequiredSlippage:
|
|
245
|
+
error.recommendedSlippages?.get(index),
|
|
246
|
+
}),
|
|
247
|
+
...(warning?.type ===
|
|
248
|
+
QuoteWarningType.INSUFFICIENT_SLIPPAGE && {
|
|
249
|
+
minRequiredSlippage:
|
|
250
|
+
warning.recommendedSlippages?.get(index),
|
|
251
|
+
}),
|
|
252
|
+
},
|
|
253
|
+
})}
|
|
254
|
+
</Typography>
|
|
255
|
+
)}
|
|
256
|
+
</FooterAlert>
|
|
257
|
+
}
|
|
258
|
+
/>
|
|
259
|
+
</FooterStepAlarm>
|
|
260
|
+
) : undefined,
|
|
261
|
+
};
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
const steps = getQuoteSteps(quote.result?.swaps ?? []);
|
|
265
|
+
const numberOfSteps = steps.length;
|
|
266
|
+
const tooltipContainer = getContainer();
|
|
267
|
+
|
|
268
|
+
useLayoutEffect(() => {
|
|
269
|
+
if (expanded && !prevExpanded.current && quoteRef.current) {
|
|
270
|
+
setTimeout(() => {
|
|
271
|
+
quoteRef?.current?.scrollIntoView({ behavior: 'smooth' });
|
|
272
|
+
}, EXPANDABLE_QUOTE_TRANSITION_DURATION);
|
|
273
|
+
}
|
|
274
|
+
prevExpanded.current = expanded;
|
|
275
|
+
}, [expanded, prevExpanded]);
|
|
276
|
+
|
|
277
|
+
return (
|
|
278
|
+
<>
|
|
279
|
+
<SummaryContainer
|
|
280
|
+
recommended={recommended}
|
|
281
|
+
listItem={type === 'list-item'}
|
|
282
|
+
basic={type === 'basic'}>
|
|
283
|
+
<div className="summary">
|
|
284
|
+
<QuoteCost fee={totalFee} time={totalTime} steps={numberOfSteps} />
|
|
285
|
+
{type === 'basic' && (
|
|
286
|
+
<div className="basic-info">
|
|
287
|
+
<FrameIcon>
|
|
288
|
+
<InfoIcon size={12} color="gray" />
|
|
289
|
+
</FrameIcon>
|
|
290
|
+
<Typography
|
|
291
|
+
size="small"
|
|
292
|
+
variant="body"
|
|
293
|
+
style={{ letterSpacing: 0.4 }}>
|
|
294
|
+
{`${roundedInput} ${
|
|
295
|
+
steps[0].from.token.displayName
|
|
296
|
+
} = ${roundedOutput} ${
|
|
297
|
+
steps[steps.length - 1].to.token.displayName
|
|
298
|
+
}`}
|
|
299
|
+
</Typography>
|
|
300
|
+
<Typography
|
|
301
|
+
color="$neutral600"
|
|
302
|
+
ml={2}
|
|
303
|
+
size="xsmall"
|
|
304
|
+
variant="body">
|
|
305
|
+
{`($${roundedOutputUsdValue})`}
|
|
306
|
+
</Typography>
|
|
307
|
+
</div>
|
|
308
|
+
)}
|
|
309
|
+
{type === 'list-item' && (
|
|
310
|
+
<TokenAmount
|
|
311
|
+
type="output"
|
|
312
|
+
direction="vertical"
|
|
313
|
+
price={{ value: roundedOutput, usdValue: roundedOutputUsdValue }}
|
|
314
|
+
token={{
|
|
315
|
+
displayName: steps[numberOfSteps - 1].to.token.displayName,
|
|
316
|
+
image: steps[numberOfSteps - 1].to.token.image,
|
|
317
|
+
}}
|
|
318
|
+
chain={{ image: steps[numberOfSteps - 1].to.chain.image }}
|
|
319
|
+
percentageChange={percentageChange}
|
|
320
|
+
warningLevel={priceImpactWarningLevel}
|
|
321
|
+
/>
|
|
322
|
+
)}
|
|
323
|
+
{type === 'swap-preview' && (
|
|
324
|
+
<>
|
|
325
|
+
<QuoteSummary
|
|
326
|
+
from={steps[0].from}
|
|
327
|
+
to={steps[numberOfSteps - 1].to}
|
|
328
|
+
percentageChange={percentageChange}
|
|
329
|
+
warningLevel={priceImpactWarningLevel}
|
|
330
|
+
/>
|
|
331
|
+
<Divider size={4} />
|
|
332
|
+
</>
|
|
333
|
+
)}
|
|
334
|
+
</div>
|
|
335
|
+
<QuoteContainer
|
|
336
|
+
recommended={recommended}
|
|
337
|
+
open={expanded}
|
|
338
|
+
onOpenChange={setExpanded}>
|
|
339
|
+
<Chains
|
|
340
|
+
ref={(ref) => (quoteRef.current = ref)}
|
|
341
|
+
recommended={recommended}
|
|
342
|
+
onClick={() => setExpanded((prevState) => !prevState)}>
|
|
343
|
+
<div>
|
|
344
|
+
{steps.map((step, index) => {
|
|
345
|
+
const key = `item-${index}`;
|
|
346
|
+
const arrow = (
|
|
347
|
+
<IconContainer>
|
|
348
|
+
<ChevronRightIcon
|
|
349
|
+
size={12}
|
|
350
|
+
color="black"
|
|
351
|
+
{...(step.state && {
|
|
352
|
+
color: step.state === 'error' ? 'error' : 'warning',
|
|
353
|
+
})}
|
|
354
|
+
/>
|
|
355
|
+
</IconContainer>
|
|
356
|
+
);
|
|
357
|
+
return (
|
|
358
|
+
<React.Fragment key={key}>
|
|
359
|
+
<Tooltip
|
|
360
|
+
container={tooltipContainer}
|
|
361
|
+
side="bottom"
|
|
362
|
+
sideOffset={4}
|
|
363
|
+
content={step.from.chain.displayName}>
|
|
364
|
+
<ChainImageContainer
|
|
365
|
+
state={step.state || steps[index - 1]?.state}>
|
|
366
|
+
<Image src={step.from.chain.image} size={16} />
|
|
367
|
+
</ChainImageContainer>
|
|
368
|
+
</Tooltip>
|
|
369
|
+
{index === numberOfSteps - 1 && (
|
|
370
|
+
<>
|
|
371
|
+
{arrow}
|
|
372
|
+
<Tooltip
|
|
373
|
+
container={tooltipContainer}
|
|
374
|
+
side="bottom"
|
|
375
|
+
sideOffset={4}
|
|
376
|
+
content={step.to.chain.displayName}>
|
|
377
|
+
<ChainImageContainer state={step.state}>
|
|
378
|
+
<Image src={step.to.chain.image} size={16} />
|
|
379
|
+
</ChainImageContainer>
|
|
380
|
+
</Tooltip>
|
|
381
|
+
</>
|
|
382
|
+
)}
|
|
383
|
+
{index !== numberOfSteps - 1 && <>{arrow}</>}
|
|
384
|
+
</React.Fragment>
|
|
385
|
+
);
|
|
386
|
+
})}
|
|
387
|
+
</div>
|
|
388
|
+
<IconContainer orientation={expanded ? 'up' : 'down'}>
|
|
389
|
+
<ChevronDownIcon size={12} color="black" />
|
|
390
|
+
</IconContainer>
|
|
391
|
+
</Chains>
|
|
392
|
+
<Content open={expanded}>
|
|
393
|
+
<HorizontalSeparator />
|
|
394
|
+
<div className="steps-details">
|
|
395
|
+
{steps.map((step, index) => {
|
|
396
|
+
const key = `item-${index}`;
|
|
397
|
+
return (
|
|
398
|
+
<StepDetails
|
|
399
|
+
type="quote-details"
|
|
400
|
+
key={key}
|
|
401
|
+
step={step}
|
|
402
|
+
hasSeparator={index !== steps.length - 1}
|
|
403
|
+
state={step.state}
|
|
404
|
+
/>
|
|
405
|
+
);
|
|
406
|
+
})}
|
|
407
|
+
</div>
|
|
408
|
+
</Content>
|
|
409
|
+
</QuoteContainer>
|
|
410
|
+
</SummaryContainer>
|
|
411
|
+
</>
|
|
412
|
+
);
|
|
413
|
+
}
|