@rango-dev/widget-embedded 0.19.0 → 0.19.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -4
- 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/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +1 -3
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +690 -61
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +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/HeaderButtons/HomeButtons.d.ts.map +1 -1
- package/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
- package/dist/components/Layout/Layout.types.d.ts +2 -2
- package/dist/components/Layout/Layout.types.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +1727 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.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 +2217 -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/QuoteSummary.d.ts +11 -0
- package/dist/components/Quote/QuoteSummary.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts +315 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -0
- package/dist/components/Quote/index.d.ts +3 -0
- package/dist/components/Quote/index.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.d.ts +4 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +633 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts +6 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts +4 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +1571 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts +6 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.d.ts +4 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +786 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts +4 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/index.d.ts +4 -0
- package/dist/components/QuoteSkeleton/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/Slippage/Slippage.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.styles.d.ts +158 -0
- package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +1 -1
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +628 -0
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +157 -0
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.helpers.d.ts +2 -2
- package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.styles.d.ts +1100 -1
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.types.d.ts +4 -9
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
- package/dist/components/TokenList/index.d.ts +0 -1
- package/dist/components/TokenList/index.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.helpers.d.ts +20 -0
- package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts.map +1 -0
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +21 -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/useTheme.d.ts +1 -1
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts.map +1 -1
- package/dist/index.d.ts +21 -8
- 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 +47 -0
- package/dist/store/AppStore.d.ts.map +1 -0
- package/dist/store/app.d.ts +41 -22
- package/dist/store/app.d.ts.map +1 -1
- package/dist/store/notification.d.ts +4 -3
- package/dist/store/notification.d.ts.map +1 -1
- package/dist/store/quote.d.ts +89 -0
- package/dist/store/quote.d.ts.map +1 -0
- 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 +5 -2
- package/dist/store/slices/data.d.ts.map +1 -1
- package/dist/store/slices/settings.d.ts +39 -0
- package/dist/store/slices/settings.d.ts.map +1 -0
- package/dist/store/ui.d.ts +2 -1
- package/dist/store/ui.d.ts.map +1 -1
- package/dist/store/wallets.d.ts +14 -9
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +41 -8
- 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 +4 -14
- package/dist/types/swap.d.ts.map +1 -1
- package/dist/types/wallets.d.ts +15 -1
- package/dist/types/wallets.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/providers.d.ts +2 -2
- package/dist/utils/providers.d.ts.map +1 -1
- package/dist/utils/queue.d.ts +2 -2
- package/dist/utils/queue.d.ts.map +1 -1
- package/dist/utils/quote.d.ts +32 -0
- package/dist/utils/quote.d.ts.map +1 -0
- package/dist/utils/settings.d.ts +6 -2
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +35 -24
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/time.d.ts +1 -1
- package/dist/utils/time.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +9 -10
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +12 -10
- 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.styles.ts +2 -2
- package/src/components/BlockchainList/BlockchainList.tsx +4 -4
- package/src/components/BlockchainsSection/BlockchainsSection.styles.ts +1 -1
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +26 -17
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +2 -64
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +29 -10
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +43 -47
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +1 -3
- package/src/components/ConfirmWalletsModal/WalletList.tsx +9 -8
- package/src/components/ConfirmWalletsModal/WalletList.type.ts +1 -4
- package/src/components/HeaderButtons/HomeButtons.tsx +28 -18
- package/src/components/Layout/Layout.styles.ts +2 -0
- package/src/components/Layout/Layout.tsx +20 -7
- package/src/components/Layout/Layout.types.ts +2 -2
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +65 -61
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +28 -34
- 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} +12 -17
- 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 +250 -0
- package/src/components/Quote/Quote.tsx +414 -0
- package/src/components/Quote/Quote.types.ts +15 -0
- package/src/components/Quote/QuoteSummary.styles.ts +16 -0
- package/src/components/Quote/QuoteSummary.tsx +46 -0
- package/src/components/Quote/index.ts +2 -0
- package/src/components/QuoteSkeleton/QuoteSkeleton.styles.ts +42 -0
- package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +30 -0
- package/src/components/QuoteSkeleton/QuoteSkeleton.types.ts +5 -0
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.styles.ts +57 -0
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.tsx +76 -0
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.types.ts +6 -0
- package/src/components/QuoteSkeleton/StepSkeleton.styles.ts +33 -0
- package/src/components/QuoteSkeleton/StepSkeleton.tsx +44 -0
- package/src/components/QuoteSkeleton/StepSkeleton.types.ts +1 -0
- package/src/components/QuoteSkeleton/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/Slippage/Slippage.styles.ts +15 -5
- package/src/components/Slippage/Slippage.tsx +11 -10
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +5 -8
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.styles.ts +36 -33
- package/src/components/SwapDetails/SwapDetails.tsx +41 -56
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.tsx +1 -1
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +4 -3
- package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +2 -2
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +14 -8
- package/src/components/SwapDetailsModal/SwapDetailsModal.helpers.tsx +1 -1
- package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +1 -1
- package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +1 -1
- package/src/components/SwapsGroup/SwapsGroup.styles.ts +10 -1
- package/src/components/SwapsGroup/SwapsGroup.tsx +3 -5
- package/src/components/SwitchFromAndTo.tsx +2 -2
- package/src/components/TokenList/TokenList.helpers.ts +2 -2
- package/src/components/TokenList/TokenList.styles.ts +74 -38
- package/src/components/TokenList/TokenList.tsx +35 -26
- package/src/components/TokenList/TokenList.types.ts +4 -10
- package/src/components/TokenList/index.ts +0 -1
- package/src/components/UpdateUrl.tsx +35 -30
- 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 +52 -0
- package/src/containers/App/index.ts +1 -0
- package/src/containers/QuoteInfo/QuoteInfo.styles.ts +31 -0
- package/src/containers/QuoteInfo/QuoteInfo.tsx +99 -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} +48 -34
- 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.helpers.ts +64 -0
- package/src/containers/WidgetInfo/WidgetInfo.tsx +62 -0
- package/src/containers/WidgetInfo/WidgetInfo.types.ts +21 -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 +4 -5
- 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 +15 -6
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.ts +6 -1
- package/src/hooks/useSwapInput.ts +141 -48
- package/src/hooks/useSyncStoresWithConfig.ts +40 -24
- package/src/hooks/useTheme.ts +4 -5
- package/src/hooks/useWalletList.ts +3 -5
- package/src/index.ts +50 -5
- package/src/pages/ConfirmSwapPage.tsx +117 -266
- package/src/pages/HistoryPage.tsx +2 -7
- package/src/pages/Home.tsx +88 -303
- package/src/pages/LanguagePage.tsx +0 -5
- package/src/pages/LiquiditySourcePage.tsx +24 -37
- package/src/pages/SelectBlockchainPage.tsx +31 -24
- package/src/pages/SelectSwapItemsPage.tsx +18 -31
- package/src/pages/SettingsPage.tsx +32 -27
- package/src/pages/SwapDetailsPage.tsx +6 -7
- package/src/pages/ThemePage.tsx +2 -7
- package/src/pages/WalletsPage.tsx +9 -19
- package/src/services/httpService.ts +1 -1
- package/src/store/AppStore.tsx +41 -0
- package/src/store/app.ts +44 -6
- package/src/store/{bestRoute.ts → quote.ts} +71 -64
- package/src/store/slices/config.ts +26 -15
- package/src/store/slices/data.ts +74 -35
- package/src/store/slices/settings.ts +168 -0
- package/src/store/wallets.ts +68 -37
- package/src/types/config.ts +53 -8
- package/src/types/index.ts +1 -1
- package/src/types/quote.ts +107 -0
- package/src/types/swap.ts +4 -13
- package/src/types/wallets.ts +18 -1
- package/src/utils/colors.ts +2 -1
- package/src/utils/configs.ts +2 -1
- package/src/utils/date.ts +1 -1
- package/src/utils/meta.ts +8 -1
- package/src/utils/numbers.ts +1 -1
- package/src/utils/providers.ts +8 -5
- package/src/utils/queue.ts +2 -2
- package/src/utils/quote.ts +338 -0
- package/src/utils/settings.ts +17 -10
- package/src/utils/swap.ts +154 -120
- package/src/utils/time.ts +1 -1
- package/src/utils/wallets.ts +156 -161
- 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/LoadingSwapDetails/LoadingSwapDetailStep.d.ts +0 -4
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts.map +0 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +0 -4
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.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 +0 -77
- 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/store/settings.d.ts +0 -81
- package/dist/store/settings.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 +0 -28
- package/dist/utils/routing.d.ts.map +0 -1
- package/src/Widget.tsx +0 -119
- package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +0 -41
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +0 -3
- 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/store/settings.ts +0 -158
- package/src/types/routing.ts +0 -77
- package/src/utils/routing.ts +0 -321
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { PendingSwap } from '
|
|
2
|
-
import type { PendingSwapStep } from 'rango-types';
|
|
1
|
+
import type { PendingSwap, PendingSwapStep } from 'rango-types';
|
|
3
2
|
|
|
4
3
|
import { i18n } from '@lingui/core';
|
|
5
4
|
import { useManager } from '@rango-dev/queue-manager-react';
|
|
@@ -11,8 +10,6 @@ import { Layout } from '../components/Layout';
|
|
|
11
10
|
import { SearchInput } from '../components/SearchInput';
|
|
12
11
|
import { SwapsGroup } from '../components/SwapsGroup';
|
|
13
12
|
import { NotFoundContainer } from '../components/SwapsGroup/SwapsGroup.styles';
|
|
14
|
-
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
15
|
-
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
16
13
|
import { useUiStore } from '../store/ui';
|
|
17
14
|
import { groupSwapsByDate } from '../utils/date';
|
|
18
15
|
import { containsText } from '../utils/numbers';
|
|
@@ -51,7 +48,6 @@ const isStepContainsText = (steps: PendingSwapStep[], value: string) => {
|
|
|
51
48
|
export function HistoryPage() {
|
|
52
49
|
const setSelectedSwap = useUiStore.use.setSelectedSwap();
|
|
53
50
|
const navigate = useNavigate();
|
|
54
|
-
const { navigateBackFrom } = useNavigateBack();
|
|
55
51
|
const { manager, state } = useManager();
|
|
56
52
|
const list: PendingSwap[] = getPendingSwaps(manager).map(({ swap }) => swap);
|
|
57
53
|
const [searchedFor, setSearchedFor] = useState<string>('');
|
|
@@ -78,7 +74,6 @@ export function HistoryPage() {
|
|
|
78
74
|
return (
|
|
79
75
|
<Layout
|
|
80
76
|
header={{
|
|
81
|
-
onBack: navigateBackFrom.bind(null, navigationRoutes.swaps),
|
|
82
77
|
title: i18n.t('History'),
|
|
83
78
|
}}>
|
|
84
79
|
<Container>
|
|
@@ -108,7 +103,7 @@ export function HistoryPage() {
|
|
|
108
103
|
list={filteredList}
|
|
109
104
|
onSwapClick={(requestId) => {
|
|
110
105
|
setSelectedSwap(requestId);
|
|
111
|
-
navigate(
|
|
106
|
+
navigate(requestId);
|
|
112
107
|
}}
|
|
113
108
|
groupBy={groupSwapsByDate}
|
|
114
109
|
isLoading={loading}
|
package/src/pages/Home.tsx
CHANGED
|
@@ -1,32 +1,14 @@
|
|
|
1
|
-
import type { SwapResult } from 'rango-sdk';
|
|
2
|
-
|
|
3
1
|
import { i18n } from '@lingui/core';
|
|
4
|
-
import {
|
|
5
|
-
Alert,
|
|
6
|
-
BestRoute,
|
|
7
|
-
BestRouteSkeleton,
|
|
8
|
-
Button,
|
|
9
|
-
Divider,
|
|
10
|
-
styled,
|
|
11
|
-
SwapInput,
|
|
12
|
-
Typography,
|
|
13
|
-
WarningIcon,
|
|
14
|
-
} from '@rango-dev/ui';
|
|
2
|
+
import { Button, styled, SwapInput, WarningIcon } from '@rango-dev/ui';
|
|
15
3
|
import React, { useEffect, useRef, useState } from 'react';
|
|
16
4
|
import { useNavigate } from 'react-router-dom';
|
|
17
5
|
|
|
18
6
|
import { HomeButtons } from '../components/HeaderButtons';
|
|
19
7
|
import { Layout } from '../components/Layout';
|
|
20
|
-
import { NoRoutes } from '../components/NoRoutes';
|
|
21
|
-
import { RouteErrors } from '../components/RouteErrors';
|
|
22
8
|
import { SwitchFromAndToButton } from '../components/SwitchFromAndTo';
|
|
23
9
|
import { errorMessages } from '../constants/errors';
|
|
24
10
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
25
11
|
import {
|
|
26
|
-
BALANCE_MAX_DECIMALS,
|
|
27
|
-
BALANCE_MIN_DECIMALS,
|
|
28
|
-
GAS_FEE_MAX_DECIMALS,
|
|
29
|
-
GAS_FEE_MIN_DECIMALS,
|
|
30
12
|
PERCENTAGE_CHANGE_MAX_DECIMALS,
|
|
31
13
|
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
32
14
|
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
@@ -34,36 +16,24 @@ import {
|
|
|
34
16
|
USD_VALUE_MAX_DECIMALS,
|
|
35
17
|
USD_VALUE_MIN_DECIMALS,
|
|
36
18
|
} from '../constants/routing';
|
|
19
|
+
import { QuoteInfo } from '../containers/QuoteInfo';
|
|
37
20
|
import { useSwapInput } from '../hooks/useSwapInput';
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
21
|
+
import { useAppStore } from '../store/AppStore';
|
|
22
|
+
import { useQuoteStore } from '../store/quote';
|
|
40
23
|
import { useUiStore } from '../store/ui';
|
|
41
24
|
import { useWalletsStore } from '../store/wallets';
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
numberToString,
|
|
47
|
-
secondsToString,
|
|
48
|
-
totalArrivalTime,
|
|
49
|
-
} from '../utils/numbers';
|
|
50
|
-
import { getFormattedBestRoute, getPriceImpactLevel } from '../utils/routing';
|
|
51
|
-
import {
|
|
52
|
-
canComputePriceImpact,
|
|
53
|
-
getOutputRatio,
|
|
54
|
-
getPercentageChange,
|
|
55
|
-
getSwapButtonState,
|
|
56
|
-
getTotalFeeInUsd,
|
|
57
|
-
hasLimitError,
|
|
58
|
-
LimitErrorMessage,
|
|
59
|
-
outputRatioHasWarning,
|
|
60
|
-
} from '../utils/swap';
|
|
61
|
-
import { getBalanceFromWallet } from '../utils/wallets';
|
|
25
|
+
import { numberToString } from '../utils/numbers';
|
|
26
|
+
import { getPriceImpact, getPriceImpactLevel } from '../utils/quote';
|
|
27
|
+
import { canComputePriceImpact, getSwapButtonState } from '../utils/swap';
|
|
28
|
+
import { formatBalance, isFetchingBalance } from '../utils/wallets';
|
|
62
29
|
|
|
63
30
|
const Container = styled('div', {
|
|
64
31
|
display: 'flex',
|
|
65
32
|
flexDirection: 'column',
|
|
66
33
|
overflowY: 'visible',
|
|
34
|
+
'& .quote__container': {
|
|
35
|
+
paddingTop: '$2',
|
|
36
|
+
},
|
|
67
37
|
});
|
|
68
38
|
|
|
69
39
|
const FromContainer = styled('div', {
|
|
@@ -76,27 +46,13 @@ const InputsContainer = styled('div', {
|
|
|
76
46
|
gap: 5,
|
|
77
47
|
alignSelf: 'stretch',
|
|
78
48
|
});
|
|
79
|
-
|
|
80
|
-
const BestRouteContainer = styled('div', {
|
|
81
|
-
width: '100%',
|
|
82
|
-
paddingTop: '$2',
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
const FooterStepAlarm = styled('div', {
|
|
86
|
-
paddingBottom: '$15',
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
const FooterAlert = styled('div', {
|
|
90
|
-
width: '100%',
|
|
91
|
-
display: 'flex',
|
|
92
|
-
});
|
|
93
|
-
|
|
94
49
|
export function Home() {
|
|
95
50
|
const navigate = useNavigate();
|
|
96
51
|
const {
|
|
97
|
-
fetch:
|
|
98
|
-
loading:
|
|
99
|
-
error:
|
|
52
|
+
fetch: fetchQuote,
|
|
53
|
+
loading: fetchingQuote,
|
|
54
|
+
error: quoteError,
|
|
55
|
+
warning: quoteWarning,
|
|
100
56
|
} = useSwapInput();
|
|
101
57
|
const {
|
|
102
58
|
fromToken,
|
|
@@ -108,175 +64,66 @@ export function Home() {
|
|
|
108
64
|
inputUsdValue,
|
|
109
65
|
outputAmount,
|
|
110
66
|
outputUsdValue,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
67
|
+
quote,
|
|
68
|
+
resetQuoteWallets,
|
|
69
|
+
setQuoteWarningsConfirmed,
|
|
70
|
+
} = useQuoteStore();
|
|
114
71
|
|
|
115
|
-
const
|
|
116
|
-
meta: { tokens, blockchains },
|
|
117
|
-
loadingStatus: loadingMetaStatus,
|
|
118
|
-
} = useMetaStore();
|
|
72
|
+
const fetchMetaStatus = useAppStore().fetchStatus;
|
|
119
73
|
|
|
120
|
-
const connectedWallets = useWalletsStore
|
|
74
|
+
const { connectedWallets, getBalanceFor } = useWalletsStore();
|
|
121
75
|
const setCurrentPage = useUiStore.use.setCurrentPage();
|
|
122
|
-
const [
|
|
123
|
-
const {
|
|
124
|
-
fromAmountRangeError,
|
|
125
|
-
swap: swapHasError,
|
|
126
|
-
recommendation,
|
|
127
|
-
} = LimitErrorMessage(bestRoute);
|
|
76
|
+
const [showQuoteWarningModal, setShowQuoteWarningModal] = useState(false);
|
|
128
77
|
const layoutRef = useRef<HTMLDivElement>(null);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
(!!bestRoute || fetchingBestRoute || !!bestRouteError);
|
|
78
|
+
const fetchingBalance =
|
|
79
|
+
!!fromBlockchain &&
|
|
80
|
+
isFetchingBalance(connectedWallets, fromBlockchain.name);
|
|
133
81
|
|
|
134
82
|
const needsToWarnEthOnPath = false;
|
|
135
83
|
|
|
136
|
-
const outToInRatio = getOutputRatio(inputUsdValue, outputUsdValue);
|
|
137
|
-
const highValueLoss = outputRatioHasWarning(inputUsdValue, outToInRatio);
|
|
138
|
-
|
|
139
84
|
const priceImpactInputCanNotBeComputed = !canComputePriceImpact(
|
|
140
|
-
|
|
85
|
+
quote,
|
|
141
86
|
inputAmount,
|
|
142
87
|
inputUsdValue
|
|
143
88
|
);
|
|
144
89
|
|
|
145
90
|
const priceImpactOutputCanNotBeComputed = !canComputePriceImpact(
|
|
146
|
-
|
|
91
|
+
quote,
|
|
147
92
|
inputAmount,
|
|
148
93
|
outputUsdValue
|
|
149
94
|
);
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
95
|
+
|
|
96
|
+
const swapButtonState = getSwapButtonState({
|
|
97
|
+
fetchMetaStatus,
|
|
98
|
+
fetchingQuote,
|
|
99
|
+
inputAmount,
|
|
100
|
+
quote,
|
|
101
|
+
anyWalletConnected: connectedWallets.length > 0,
|
|
102
|
+
error: quoteError,
|
|
103
|
+
warning: quoteWarning,
|
|
158
104
|
needsToWarnEthOnPath,
|
|
159
|
-
|
|
160
|
-
);
|
|
105
|
+
});
|
|
161
106
|
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
connectedWallets,
|
|
167
|
-
fromBlockchain?.name,
|
|
168
|
-
fromToken?.symbol,
|
|
169
|
-
fromToken?.address
|
|
170
|
-
)?.amount || '0',
|
|
171
|
-
BALANCE_MIN_DECIMALS,
|
|
172
|
-
BALANCE_MAX_DECIMALS
|
|
173
|
-
)
|
|
174
|
-
: '0';
|
|
107
|
+
const fromTokenBalance = fromToken ? getBalanceFor(fromToken) : null;
|
|
108
|
+
|
|
109
|
+
const fromTokenFormattedBalance =
|
|
110
|
+
formatBalance(fromTokenBalance)?.amount ?? '0';
|
|
175
111
|
|
|
176
112
|
const tokenBalanceReal =
|
|
177
113
|
!!fromBlockchain && !!fromToken
|
|
178
|
-
? numberToString(
|
|
179
|
-
getBalanceFromWallet(
|
|
180
|
-
connectedWallets,
|
|
181
|
-
fromBlockchain?.name,
|
|
182
|
-
fromToken?.symbol,
|
|
183
|
-
fromToken?.address
|
|
184
|
-
)?.amount || '0',
|
|
185
|
-
getBalanceFromWallet(
|
|
186
|
-
connectedWallets,
|
|
187
|
-
fromBlockchain?.name,
|
|
188
|
-
fromToken?.symbol,
|
|
189
|
-
fromToken?.address
|
|
190
|
-
)?.decimal
|
|
191
|
-
)
|
|
114
|
+
? numberToString(fromTokenBalance?.amount, fromTokenBalance?.decimals)
|
|
192
115
|
: '0';
|
|
193
116
|
|
|
194
117
|
useEffect(() => {
|
|
195
118
|
setCurrentPage(navigationRoutes.home);
|
|
196
|
-
|
|
119
|
+
resetQuoteWallets();
|
|
197
120
|
return setCurrentPage.bind(null, '');
|
|
198
121
|
}, []);
|
|
199
122
|
|
|
200
123
|
const percentageChange =
|
|
201
124
|
!inputUsdValue || !outputUsdValue || !outputUsdValue.gt(0)
|
|
202
125
|
? null
|
|
203
|
-
:
|
|
204
|
-
inputUsdValue.toNumber(),
|
|
205
|
-
outputUsdValue.toNumber()
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
const getBestRouteSteps = (swaps: SwapResult[]) => {
|
|
209
|
-
return swaps.map((swap, index) => ({
|
|
210
|
-
swapper: { displayName: swap.swapperId, image: swap.swapperLogo },
|
|
211
|
-
from: {
|
|
212
|
-
token: { displayName: swap.from.symbol, image: swap.from.logo },
|
|
213
|
-
chain: {
|
|
214
|
-
displayName:
|
|
215
|
-
getBlockchainShortNameFor(swap.from.blockchain, blockchains) ?? '',
|
|
216
|
-
image: swap.from.blockchainLogo,
|
|
217
|
-
},
|
|
218
|
-
price: {
|
|
219
|
-
value:
|
|
220
|
-
index === 0
|
|
221
|
-
? numberToString(
|
|
222
|
-
inputAmount,
|
|
223
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
224
|
-
TOKEN_AMOUNT_MAX_DECIMALS
|
|
225
|
-
)
|
|
226
|
-
: swap.fromAmount,
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
to: {
|
|
230
|
-
token: { displayName: swap.to.symbol, image: swap.to.logo },
|
|
231
|
-
chain: {
|
|
232
|
-
displayName:
|
|
233
|
-
getBlockchainShortNameFor(swap.to.blockchain, blockchains) ?? '',
|
|
234
|
-
image: swap.to.blockchainLogo,
|
|
235
|
-
},
|
|
236
|
-
price: {
|
|
237
|
-
value: swap.toAmount,
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
alerts:
|
|
241
|
-
swap.swapperId === swapHasError?.swapperId ? (
|
|
242
|
-
<FooterStepAlarm>
|
|
243
|
-
<Alert
|
|
244
|
-
type="error"
|
|
245
|
-
title={recommendation}
|
|
246
|
-
footer={
|
|
247
|
-
<FooterAlert>
|
|
248
|
-
<Typography size="xsmall" variant="body" color="neutral700">
|
|
249
|
-
{fromAmountRangeError}
|
|
250
|
-
</Typography>
|
|
251
|
-
<Divider direction="horizontal" size={8} />
|
|
252
|
-
<Typography size="xsmall" variant="body" color="neutral700">
|
|
253
|
-
|
|
|
254
|
-
</Typography>
|
|
255
|
-
<Divider direction="horizontal" size={8} />
|
|
256
|
-
<Typography size="xsmall" variant="body" color="neutral700">
|
|
257
|
-
{i18n.t({
|
|
258
|
-
id: 'Yours: {amount} {symbol}',
|
|
259
|
-
values: {
|
|
260
|
-
amount: numberToString(
|
|
261
|
-
swapHasError?.fromAmount || null,
|
|
262
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
263
|
-
TOKEN_AMOUNT_MAX_DECIMALS
|
|
264
|
-
),
|
|
265
|
-
symbol: swap?.from.symbol,
|
|
266
|
-
},
|
|
267
|
-
})}
|
|
268
|
-
</Typography>
|
|
269
|
-
</FooterAlert>
|
|
270
|
-
}
|
|
271
|
-
/>
|
|
272
|
-
</FooterStepAlarm>
|
|
273
|
-
) : undefined,
|
|
274
|
-
}));
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
const totalFeeInUsd = getTotalFeeInUsd(bestRoute, tokens);
|
|
278
|
-
|
|
279
|
-
const bestRouteData = getFormattedBestRoute(bestRoute);
|
|
126
|
+
: getPriceImpact(inputUsdValue.toString(), outputUsdValue.toString());
|
|
280
127
|
|
|
281
128
|
return (
|
|
282
129
|
<Layout
|
|
@@ -289,15 +136,14 @@ export function Home() {
|
|
|
289
136
|
size="large"
|
|
290
137
|
disabled={swapButtonState.disabled}
|
|
291
138
|
prefix={
|
|
292
|
-
|
|
293
|
-
swapButtonState.hasWarning && <WarningIcon />
|
|
139
|
+
swapButtonState.action === 'confirm-warning' && <WarningIcon />
|
|
294
140
|
}
|
|
295
141
|
fullWidth
|
|
296
142
|
onClick={() => {
|
|
297
|
-
if (swapButtonState.
|
|
143
|
+
if (swapButtonState.action === 'connect-wallet') {
|
|
298
144
|
navigate(navigationRoutes.wallets);
|
|
299
|
-
} else if (swapButtonState.
|
|
300
|
-
|
|
145
|
+
} else if (swapButtonState.action === 'confirm-warning') {
|
|
146
|
+
setShowQuoteWarningModal(true);
|
|
301
147
|
} else {
|
|
302
148
|
navigate(navigationRoutes.confirmSwap);
|
|
303
149
|
}
|
|
@@ -306,14 +152,15 @@ export function Home() {
|
|
|
306
152
|
</Button>
|
|
307
153
|
}
|
|
308
154
|
header={{
|
|
309
|
-
|
|
155
|
+
onWallet: () => {
|
|
156
|
+
navigate(navigationRoutes.wallets);
|
|
157
|
+
},
|
|
158
|
+
hasBackButton: false,
|
|
310
159
|
title: i18n.t('Swap'),
|
|
311
160
|
suffix: (
|
|
312
161
|
<HomeButtons
|
|
313
162
|
layoutRef={layoutRef.current}
|
|
314
|
-
onClickRefresh={
|
|
315
|
-
!!bestRoute || bestRouteError ? refetchBestRoute : undefined
|
|
316
|
-
}
|
|
163
|
+
onClickRefresh={!!quote || quoteError ? fetchQuote : undefined}
|
|
317
164
|
onClickHistory={() => navigate(navigationRoutes.swaps)}
|
|
318
165
|
onClickSettings={() => navigate(navigationRoutes.settings)}
|
|
319
166
|
/>
|
|
@@ -326,7 +173,7 @@ export function Home() {
|
|
|
326
173
|
label={i18n.t('From')}
|
|
327
174
|
mode="From"
|
|
328
175
|
onInputChange={setInputAmount}
|
|
329
|
-
balance={
|
|
176
|
+
balance={fromTokenFormattedBalance}
|
|
330
177
|
chain={{
|
|
331
178
|
displayName: fromBlockchain?.displayName || '',
|
|
332
179
|
image: fromBlockchain?.logo || '',
|
|
@@ -335,7 +182,7 @@ export function Home() {
|
|
|
335
182
|
displayName: fromToken?.symbol || '',
|
|
336
183
|
image: fromToken?.image || '',
|
|
337
184
|
}}
|
|
338
|
-
onClickToken={() => navigate(
|
|
185
|
+
onClickToken={() => navigate(navigationRoutes.fromSwap)}
|
|
339
186
|
price={{
|
|
340
187
|
value: inputAmount,
|
|
341
188
|
usdValue: priceImpactInputCanNotBeComputed
|
|
@@ -349,10 +196,11 @@ export function Home() {
|
|
|
349
196
|
? errorMessages().unknownPriceError.impactTitle
|
|
350
197
|
: undefined,
|
|
351
198
|
}}
|
|
352
|
-
disabled={
|
|
353
|
-
loading={
|
|
199
|
+
disabled={fetchMetaStatus === 'failed'}
|
|
200
|
+
loading={fetchMetaStatus === 'loading'}
|
|
201
|
+
loadingBalance={fetchingBalance}
|
|
354
202
|
onSelectMaxBalance={() => {
|
|
355
|
-
if (
|
|
203
|
+
if (fromTokenFormattedBalance !== '0') {
|
|
356
204
|
setInputAmount(tokenBalanceReal.split(',').join(''));
|
|
357
205
|
}
|
|
358
206
|
}}
|
|
@@ -360,9 +208,10 @@ export function Home() {
|
|
|
360
208
|
<SwitchFromAndToButton />
|
|
361
209
|
</FromContainer>
|
|
362
210
|
<SwapInput
|
|
363
|
-
sharpBottomStyle={!!
|
|
211
|
+
sharpBottomStyle={!!quote?.result || fetchingQuote}
|
|
364
212
|
label={i18n.t('To')}
|
|
365
213
|
mode="To"
|
|
214
|
+
fetchingQuote={fetchingQuote}
|
|
366
215
|
chain={{
|
|
367
216
|
displayName: toBlockchain?.displayName || '',
|
|
368
217
|
image: toBlockchain?.logo || '',
|
|
@@ -371,18 +220,12 @@ export function Home() {
|
|
|
371
220
|
displayName: toToken?.symbol || '',
|
|
372
221
|
image: toToken?.image || '',
|
|
373
222
|
}}
|
|
374
|
-
percentageChange={
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
379
|
-
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
380
|
-
)
|
|
381
|
-
: null
|
|
382
|
-
}
|
|
383
|
-
warningLevel={getPriceImpactLevel(
|
|
384
|
-
percentageChange?.toNumber() ?? 0
|
|
223
|
+
percentageChange={numberToString(
|
|
224
|
+
getPriceImpact(inputUsdValue, outputUsdValue),
|
|
225
|
+
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
226
|
+
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
385
227
|
)}
|
|
228
|
+
warningLevel={getPriceImpactLevel(percentageChange ?? 0)}
|
|
386
229
|
price={{
|
|
387
230
|
value: numberToString(
|
|
388
231
|
outputAmount,
|
|
@@ -400,89 +243,31 @@ export function Home() {
|
|
|
400
243
|
? errorMessages().unknownPriceError.impactTitle
|
|
401
244
|
: undefined,
|
|
402
245
|
}}
|
|
403
|
-
onClickToken={() => navigate(
|
|
404
|
-
disabled={
|
|
405
|
-
loading={
|
|
246
|
+
onClickToken={() => navigate(navigationRoutes.toSwap)}
|
|
247
|
+
disabled={fetchMetaStatus === 'failed'}
|
|
248
|
+
loading={fetchMetaStatus === 'loading'}
|
|
406
249
|
/>
|
|
407
250
|
</InputsContainer>
|
|
408
|
-
|
|
409
|
-
<
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
usdValue: numberToString(
|
|
428
|
-
inputUsdValue,
|
|
429
|
-
USD_VALUE_MIN_DECIMALS,
|
|
430
|
-
USD_VALUE_MAX_DECIMALS
|
|
431
|
-
),
|
|
432
|
-
}}
|
|
433
|
-
output={{
|
|
434
|
-
value: numberToString(
|
|
435
|
-
outputAmount,
|
|
436
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
437
|
-
TOKEN_AMOUNT_MAX_DECIMALS
|
|
438
|
-
),
|
|
439
|
-
usdValue: numberToString(
|
|
440
|
-
outputUsdValue,
|
|
441
|
-
USD_VALUE_MIN_DECIMALS,
|
|
442
|
-
USD_VALUE_MAX_DECIMALS
|
|
443
|
-
),
|
|
444
|
-
}}
|
|
445
|
-
steps={getBestRouteSteps(bestRouteData.result.swaps)}
|
|
446
|
-
percentageChange={numberToString(
|
|
447
|
-
percentageChange,
|
|
448
|
-
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
449
|
-
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
450
|
-
)}
|
|
451
|
-
totalFee={numberToString(
|
|
452
|
-
totalFeeInUsd,
|
|
453
|
-
GAS_FEE_MIN_DECIMALS,
|
|
454
|
-
GAS_FEE_MAX_DECIMALS
|
|
455
|
-
)}
|
|
456
|
-
totalTime={secondsToString(
|
|
457
|
-
totalArrivalTime(bestRoute?.result?.swaps)
|
|
458
|
-
)}
|
|
459
|
-
/>
|
|
460
|
-
</BestRouteContainer>
|
|
461
|
-
) : showBestRoute && !fetchingBestRoute ? (
|
|
462
|
-
<>
|
|
463
|
-
<Divider size={20} />
|
|
464
|
-
<NoRoutes
|
|
465
|
-
diagnosisMessage={bestRouteData?.diagnosisMessages?.[0]}
|
|
466
|
-
fetch={refetchBestRoute}
|
|
467
|
-
error={!!bestRouteError}
|
|
468
|
-
/>
|
|
469
|
-
</>
|
|
470
|
-
) : null}
|
|
251
|
+
<div className="quote__container">
|
|
252
|
+
<QuoteInfo
|
|
253
|
+
quote={quote}
|
|
254
|
+
loading={fetchingQuote}
|
|
255
|
+
error={quoteError}
|
|
256
|
+
warning={quoteWarning}
|
|
257
|
+
type="basic"
|
|
258
|
+
refetchQuote={fetchQuote}
|
|
259
|
+
showWarningModal={showQuoteWarningModal}
|
|
260
|
+
onOpenWarningModal={() => setShowQuoteWarningModal(true)}
|
|
261
|
+
onCloseWarningModal={() => setShowQuoteWarningModal(false)}
|
|
262
|
+
onConfirmWarningModal={() => {
|
|
263
|
+
setShowQuoteWarningModal(false);
|
|
264
|
+
setQuoteWarningsConfirmed(true);
|
|
265
|
+
navigate(navigationRoutes.confirmSwap);
|
|
266
|
+
}}
|
|
267
|
+
onChangeSettings={() => navigate(navigationRoutes.settings)}
|
|
268
|
+
/>
|
|
269
|
+
</div>
|
|
471
270
|
</Container>
|
|
472
|
-
<RouteErrors
|
|
473
|
-
openModal={openWarningModal}
|
|
474
|
-
onToggle={setOpenWarningModal}
|
|
475
|
-
totalFeeInUsd={totalFeeInUsd}
|
|
476
|
-
outputUsdValue={outputUsdValue}
|
|
477
|
-
inputUsdValue={inputUsdValue}
|
|
478
|
-
percentageChange={percentageChange}
|
|
479
|
-
highValueLoss={highValueLoss}
|
|
480
|
-
priceImpactCanNotBeComputed={
|
|
481
|
-
priceImpactInputCanNotBeComputed || priceImpactOutputCanNotBeComputed
|
|
482
|
-
}
|
|
483
|
-
loading={fetchingBestRoute || loadingMetaStatus === 'loading'}
|
|
484
|
-
extraSpace={!!bestRoute?.result || !bestRoute}
|
|
485
|
-
/>
|
|
486
271
|
</Layout>
|
|
487
272
|
);
|
|
488
273
|
}
|
|
@@ -10,13 +10,9 @@ import React from 'react';
|
|
|
10
10
|
|
|
11
11
|
import { Layout } from '../components/Layout';
|
|
12
12
|
import { SettingsContainer } from '../components/SettingsContainer';
|
|
13
|
-
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
14
13
|
import { useLanguage } from '../hooks/useLanguage';
|
|
15
|
-
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
16
14
|
|
|
17
15
|
export function LanguagePage() {
|
|
18
|
-
const { navigateBackFrom } = useNavigateBack();
|
|
19
|
-
|
|
20
16
|
const { activeLanguage, changeLanguage, languages } = useLanguage();
|
|
21
17
|
|
|
22
18
|
const languageList = languages.map((languageItem) => {
|
|
@@ -38,7 +34,6 @@ export function LanguagePage() {
|
|
|
38
34
|
return (
|
|
39
35
|
<Layout
|
|
40
36
|
header={{
|
|
41
|
-
onBack: navigateBackFrom.bind(null, navigationRoutes.settings),
|
|
42
37
|
title: i18n.t('Language'),
|
|
43
38
|
}}>
|
|
44
39
|
<SettingsContainer>
|