@rango-dev/widget-embedded 0.17.1-next.8 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +116 -0
- package/dist/QueueManager.d.ts +3 -1
- package/dist/QueueManager.d.ts.map +1 -1
- package/dist/components/AppRouter.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.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/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.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/Quote.styles.d.ts +793 -5
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.types.d.ts +0 -1
- package/dist/components/Quote/Quote.types.d.ts.map +1 -1
- package/dist/components/Quote/QuoteSummary.styles.d.ts +157 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -1
- package/dist/components/Quote/index.d.ts +0 -1
- package/dist/components/Quote/index.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.d.ts.map +1 -0
- package/dist/components/{Quote → QuoteSkeleton}/QuoteSkeleton.styles.d.ts +314 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -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/QuoteWarningsAndErrors.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -1
- 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.map +1 -1
- 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/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/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.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +316 -0
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +3 -0
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
- 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/useConfirmSwap.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +6 -3
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +1 -1
- 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 +3 -5
- 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.map +1 -1
- package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
- package/dist/hooks/useTheme.d.ts +1 -1
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/index.d.ts +20 -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.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.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.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.map +1 -1
- package/dist/store/AppStore.d.ts +37 -1
- package/dist/store/AppStore.d.ts.map +1 -1
- package/dist/store/app.d.ts +39 -2
- 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 +9 -9
- package/dist/store/quote.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/slices/data.d.ts +2 -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 +9 -5
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +36 -3
- package/dist/types/config.d.ts.map +1 -1
- 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/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 +1 -1
- package/dist/utils/quote.d.ts.map +1 -1
- package/dist/utils/settings.d.ts +4 -1
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +13 -5
- 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 +7 -8
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +12 -10
- package/src/QueueManager.tsx +4 -3
- package/src/components/AppRouter.tsx +5 -27
- package/src/components/AppRoutes.tsx +54 -33
- package/src/components/BlockchainList/BlockchainList.styles.ts +2 -2
- package/src/components/BlockchainsSection/BlockchainsSection.styles.ts +1 -1
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +19 -10
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +29 -10
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +15 -7
- package/src/components/ConfirmWalletsModal/WalletList.tsx +3 -3
- 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/NoResult/NoResult.helpers.ts +12 -12
- package/src/components/NoResult/NoResult.tsx +2 -5
- package/src/components/NotificationContent/NotificationContent.tsx +2 -1
- package/src/components/Quote/Quote.styles.ts +49 -12
- package/src/components/Quote/Quote.tsx +107 -38
- package/src/components/Quote/Quote.types.ts +0 -1
- package/src/components/Quote/QuoteSummary.styles.ts +9 -8
- package/src/components/Quote/QuoteSummary.tsx +2 -2
- package/src/components/Quote/index.ts +0 -1
- package/src/components/QuoteSkeleton/QuoteSkeleton.styles.ts +42 -0
- package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +30 -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/QuoteErrorsModalItem.tsx +1 -1
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +11 -4
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +8 -1
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +13 -13
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +1 -0
- package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +3 -3
- 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 +28 -39
- 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/TokenList/TokenList.helpers.ts +2 -2
- package/src/components/TokenList/TokenList.styles.ts +74 -38
- package/src/components/TokenList/TokenList.tsx +30 -20
- package/src/components/TokenList/TokenList.types.ts +4 -10
- package/src/components/TokenList/index.ts +0 -1
- package/src/components/UpdateUrl.tsx +4 -5
- package/src/constants/errors.ts +9 -5
- package/src/constants/index.ts +1 -0
- package/src/constants/navigationRoutes.ts +7 -8
- package/src/constants/searchParams.ts +1 -0
- 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 +17 -1
- package/src/containers/QuoteInfo/QuoteInfo.tsx +46 -44
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +3 -0
- package/src/{Wallets.tsx → containers/Wallets/Wallets.tsx} +25 -31
- 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/useConfirmSwap.helpers.ts +15 -11
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +21 -20
- package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +1 -1
- 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 +86 -28
- package/src/hooks/useSyncStoresWithConfig.ts +18 -5
- package/src/hooks/useTheme.ts +4 -5
- package/src/index.ts +53 -5
- package/src/pages/ConfirmSwapPage.tsx +61 -33
- package/src/pages/HistoryPage.tsx +2 -7
- package/src/pages/Home.tsx +55 -81
- package/src/pages/LanguagePage.tsx +0 -5
- package/src/pages/LiquiditySourcePage.tsx +3 -7
- package/src/pages/SelectBlockchainPage.tsx +26 -18
- package/src/pages/SelectSwapItemsPage.tsx +13 -26
- package/src/pages/SettingsPage.tsx +26 -17
- package/src/pages/SwapDetailsPage.tsx +3 -4
- package/src/pages/ThemePage.tsx +2 -7
- package/src/pages/WalletsPage.tsx +5 -8
- package/src/services/httpService.ts +1 -1
- package/src/store/AppStore.tsx +7 -1
- package/src/store/app.ts +31 -5
- package/src/store/quote.ts +3 -4
- package/src/store/slices/config.ts +1 -0
- package/src/store/slices/data.ts +10 -6
- package/src/store/slices/settings.ts +168 -0
- package/src/store/wallets.ts +57 -29
- package/src/types/config.ts +48 -3
- 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/providers.ts +8 -5
- package/src/utils/queue.ts +2 -2
- package/src/utils/quote.ts +7 -7
- package/src/utils/settings.ts +11 -5
- package/src/utils/swap.ts +46 -40
- package/src/utils/time.ts +1 -1
- package/src/utils/wallets.ts +127 -144
- package/dist/Wallets.d.ts +0 -18
- 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/Quote/QuoteSkeleton.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSkeleton.styles.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSkeleton.types.d.ts.map +0 -1
- package/dist/store/settings.d.ts +0 -82
- package/dist/store/settings.d.ts.map +0 -1
- package/src/Widget.tsx +0 -106
- package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +0 -41
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +0 -3
- package/src/components/Quote/QuoteSkeleton.styles.ts +0 -110
- package/src/components/Quote/QuoteSkeleton.tsx +0 -108
- package/src/store/settings.ts +0 -161
- /package/dist/components/{Quote → QuoteSkeleton}/QuoteSkeleton.d.ts +0 -0
- /package/dist/components/{Quote → QuoteSkeleton}/QuoteSkeleton.types.d.ts +0 -0
- /package/src/components/{Quote → QuoteSkeleton}/QuoteSkeleton.types.ts +0 -0
package/src/hooks/useTheme.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
-
import type { WidgetTheme } from '../types';
|
|
3
|
-
|
|
4
2
|
import {
|
|
5
3
|
createTheme,
|
|
6
4
|
darkTheme as defaultDarkTheme,
|
|
@@ -8,7 +6,8 @@ import {
|
|
|
8
6
|
} from '@rango-dev/ui';
|
|
9
7
|
import { useEffect, useState } from 'react';
|
|
10
8
|
|
|
11
|
-
import {
|
|
9
|
+
import { useAppStore } from '../store/AppStore';
|
|
10
|
+
import { type WidgetTheme } from '../types';
|
|
12
11
|
import {
|
|
13
12
|
DEFAULT_FONT_FAMILY,
|
|
14
13
|
DEFAULT_PRIMARY_RADIUS,
|
|
@@ -26,8 +25,8 @@ export function useTheme(props: WidgetTheme) {
|
|
|
26
25
|
} = props;
|
|
27
26
|
|
|
28
27
|
const [OSTheme, setOSTheme] = useState('light');
|
|
29
|
-
|
|
30
|
-
const setTheme =
|
|
28
|
+
|
|
29
|
+
const { setTheme, theme } = useAppStore();
|
|
31
30
|
|
|
32
31
|
const { dark, light } = customizedThemeTokens(colors);
|
|
33
32
|
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { WidgetProps } from './containers/Widget';
|
|
2
|
+
import type { ConnectedWallet } from './store/wallets';
|
|
1
3
|
import type {
|
|
2
4
|
BlockchainAndTokenConfig,
|
|
3
5
|
WidgetColors,
|
|
@@ -5,10 +7,12 @@ import type {
|
|
|
5
7
|
WidgetConfig,
|
|
6
8
|
WidgetTheme,
|
|
7
9
|
} from './types';
|
|
8
|
-
import type { WidgetProps } from './Widget';
|
|
9
10
|
import type {
|
|
11
|
+
EventSeverity,
|
|
12
|
+
PendingSwapWithQueueID,
|
|
10
13
|
Route,
|
|
11
14
|
RouteEvent,
|
|
15
|
+
RouteExecutionEvents,
|
|
12
16
|
RouteFailedEvent,
|
|
13
17
|
RouteStartedEvent,
|
|
14
18
|
RouteSucceededEvent,
|
|
@@ -27,7 +31,16 @@ import type {
|
|
|
27
31
|
EventHandler as HandleWalletsUpdate,
|
|
28
32
|
ProviderInterface,
|
|
29
33
|
} from '@rango-dev/wallets-react';
|
|
30
|
-
import type {
|
|
34
|
+
import type {
|
|
35
|
+
WalletInfo,
|
|
36
|
+
WalletState,
|
|
37
|
+
WalletType,
|
|
38
|
+
} from '@rango-dev/wallets-shared';
|
|
39
|
+
import type {
|
|
40
|
+
PendingSwap,
|
|
41
|
+
PendingSwapNetworkStatus,
|
|
42
|
+
PendingSwapStep,
|
|
43
|
+
} from 'rango-types';
|
|
31
44
|
|
|
32
45
|
import {
|
|
33
46
|
MainEvents,
|
|
@@ -37,10 +50,18 @@ import {
|
|
|
37
50
|
StepExecutionEventStatus,
|
|
38
51
|
useEvents as useWidgetEvents,
|
|
39
52
|
} from '@rango-dev/queue-manager-rango-preset';
|
|
40
|
-
import {
|
|
53
|
+
import {
|
|
54
|
+
readAccountAddress,
|
|
55
|
+
useWallets,
|
|
56
|
+
Events as WalletEvents,
|
|
57
|
+
} from '@rango-dev/wallets-react';
|
|
58
|
+
import { Networks, WalletTypes } from '@rango-dev/wallets-shared';
|
|
41
59
|
|
|
42
|
-
import { WidgetWallets } from './Wallets';
|
|
43
|
-
import { Widget } from './Widget';
|
|
60
|
+
import { WidgetWallets } from './containers/Wallets';
|
|
61
|
+
import { Widget } from './containers/Widget';
|
|
62
|
+
import { useWidget } from './containers/WidgetInfo';
|
|
63
|
+
import { WidgetProvider } from './containers/WidgetProvider';
|
|
64
|
+
import { customizedThemeTokens } from './utils/ui';
|
|
44
65
|
|
|
45
66
|
export type {
|
|
46
67
|
WidgetConfig,
|
|
@@ -67,15 +88,42 @@ export type {
|
|
|
67
88
|
StepApprovalTxSucceededEvent,
|
|
68
89
|
StepOutputRevealedEvent,
|
|
69
90
|
HandleWalletsUpdate,
|
|
91
|
+
ConnectedWallet,
|
|
70
92
|
};
|
|
71
93
|
export {
|
|
72
94
|
Widget,
|
|
95
|
+
/**
|
|
96
|
+
* @deprecated Use `WidgetProvider` instead. This component will be removed in future versions.
|
|
97
|
+
*/
|
|
73
98
|
WidgetWallets,
|
|
99
|
+
WidgetProvider,
|
|
100
|
+
useWidget,
|
|
74
101
|
useWallets,
|
|
75
102
|
useWidgetEvents,
|
|
103
|
+
customizedThemeTokens,
|
|
76
104
|
MainEvents,
|
|
77
105
|
RouteEventType,
|
|
78
106
|
StepEventType,
|
|
79
107
|
StepExecutionEventStatus,
|
|
80
108
|
StepExecutionBlockedEventStatus,
|
|
81
109
|
};
|
|
110
|
+
|
|
111
|
+
// Internal type exports for Rango
|
|
112
|
+
export type {
|
|
113
|
+
WalletState,
|
|
114
|
+
WalletInfo,
|
|
115
|
+
PendingSwap,
|
|
116
|
+
PendingSwapWithQueueID,
|
|
117
|
+
PendingSwapStep,
|
|
118
|
+
RouteExecutionEvents,
|
|
119
|
+
EventSeverity,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// Internal function and enum exports for Rango
|
|
123
|
+
export {
|
|
124
|
+
readAccountAddress,
|
|
125
|
+
Networks,
|
|
126
|
+
WalletEvents,
|
|
127
|
+
WalletTypes,
|
|
128
|
+
PendingSwapNetworkStatus,
|
|
129
|
+
};
|
|
@@ -9,6 +9,7 @@ import { useManager } from '@rango-dev/queue-manager-react';
|
|
|
9
9
|
import {
|
|
10
10
|
Alert,
|
|
11
11
|
Button,
|
|
12
|
+
css,
|
|
12
13
|
Divider,
|
|
13
14
|
IconButton,
|
|
14
15
|
RefreshIcon,
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
Typography,
|
|
19
20
|
WalletIcon,
|
|
20
21
|
} from '@rango-dev/ui';
|
|
21
|
-
import React, { useEffect, useState } from 'react';
|
|
22
|
+
import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
22
23
|
import { flushSync } from 'react-dom';
|
|
23
24
|
import { useNavigate } from 'react-router-dom';
|
|
24
25
|
|
|
@@ -30,6 +31,7 @@ import { navigationRoutes } from '../constants/navigationRoutes';
|
|
|
30
31
|
import { getQuoteUpdateWarningMessage } from '../constants/warnings';
|
|
31
32
|
import { QuoteInfo } from '../containers/QuoteInfo';
|
|
32
33
|
import { useConfirmSwap } from '../hooks/useConfirmSwap';
|
|
34
|
+
import { useAppStore } from '../store/AppStore';
|
|
33
35
|
import { useQuoteStore } from '../store/quote';
|
|
34
36
|
import { useUiStore } from '../store/ui';
|
|
35
37
|
import { useWalletsStore } from '../store/wallets';
|
|
@@ -39,18 +41,9 @@ import { getContainer } from '../utils/common';
|
|
|
39
41
|
const Container = styled('div', {
|
|
40
42
|
position: 'relative',
|
|
41
43
|
width: '100%',
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
alignItems: 'center',
|
|
46
|
-
paddingBottom: '$10',
|
|
47
|
-
},
|
|
48
|
-
'& .icon': {
|
|
49
|
-
width: '$24',
|
|
50
|
-
height: '$24',
|
|
51
|
-
display: 'flex',
|
|
52
|
-
justifyContent: 'center',
|
|
53
|
-
alignItems: 'center',
|
|
44
|
+
|
|
45
|
+
'& .quote-update__alert': {
|
|
46
|
+
paddingTop: '$10',
|
|
54
47
|
},
|
|
55
48
|
});
|
|
56
49
|
|
|
@@ -58,16 +51,31 @@ const Buttons = styled('div', {
|
|
|
58
51
|
width: '100%',
|
|
59
52
|
display: 'flex',
|
|
60
53
|
justifyContent: 'space-between',
|
|
61
|
-
'& .confirm-button': {
|
|
62
|
-
flexGrow: 1,
|
|
63
|
-
paddingRight: '$10',
|
|
64
|
-
},
|
|
65
54
|
[`& ${IconButton}`]: {
|
|
66
55
|
width: '$48',
|
|
67
56
|
height: '$48',
|
|
68
57
|
},
|
|
69
58
|
});
|
|
70
59
|
|
|
60
|
+
const confirmBtnStyles = css({
|
|
61
|
+
flexGrow: 1,
|
|
62
|
+
paddingRight: '$10',
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const iconStyles = css({
|
|
66
|
+
width: '$24',
|
|
67
|
+
height: '$24',
|
|
68
|
+
display: 'flex',
|
|
69
|
+
justifyContent: 'center',
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const descriptionStyles = css({
|
|
74
|
+
display: 'flex',
|
|
75
|
+
justifyContent: 'space-between',
|
|
76
|
+
alignItems: 'center',
|
|
77
|
+
});
|
|
78
|
+
|
|
71
79
|
export function ConfirmSwapPage() {
|
|
72
80
|
//TODO: move component's logics to a custom hook
|
|
73
81
|
const {
|
|
@@ -86,6 +94,8 @@ export function ConfirmSwapPage() {
|
|
|
86
94
|
const showWalletsOnInit = !quoteWalletsConfirmed;
|
|
87
95
|
const [showWallets, setShowWallets] = useState(false);
|
|
88
96
|
const setSelectedSwap = useUiStore.use.setSelectedSwap();
|
|
97
|
+
const disabledLiquiditySources = useAppStore().disabledLiquiditySources;
|
|
98
|
+
const prevDisabledLiquiditySources = useRef(disabledLiquiditySources);
|
|
89
99
|
const { manager } = useManager();
|
|
90
100
|
const {
|
|
91
101
|
fetch: confirmSwap,
|
|
@@ -119,12 +129,11 @@ export function ConfirmSwapPage() {
|
|
|
119
129
|
{ id: confirmSwapResult.swap.requestId }
|
|
120
130
|
);
|
|
121
131
|
setSelectedSwap(confirmSwapResult.swap.requestId);
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
);
|
|
132
|
+
|
|
133
|
+
const swap_url = `../${navigationRoutes.swaps}/${confirmSwapResult.swap.requestId}`;
|
|
134
|
+
navigate(swap_url, {
|
|
135
|
+
replace: true,
|
|
136
|
+
});
|
|
128
137
|
setTimeout(() => {
|
|
129
138
|
setInputAmount('');
|
|
130
139
|
}, 0);
|
|
@@ -152,13 +161,23 @@ export function ConfirmSwapPage() {
|
|
|
152
161
|
swap: null,
|
|
153
162
|
warnings: null,
|
|
154
163
|
});
|
|
155
|
-
confirmSwap({ selectedWallets })
|
|
164
|
+
confirmSwap({ selectedWallets, customDestination })
|
|
156
165
|
.then((res) => {
|
|
157
166
|
setConfirmSwapResult(res);
|
|
158
167
|
})
|
|
159
168
|
.catch((error) => console.error(error));
|
|
160
169
|
};
|
|
161
170
|
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
const disabledLiquiditySourceReset =
|
|
173
|
+
!!prevDisabledLiquiditySources.current.length &&
|
|
174
|
+
!disabledLiquiditySources.length;
|
|
175
|
+
if (disabledLiquiditySourceReset) {
|
|
176
|
+
void onRefresh();
|
|
177
|
+
}
|
|
178
|
+
prevDisabledLiquiditySources.current = disabledLiquiditySources;
|
|
179
|
+
}, [disabledLiquiditySources.length]);
|
|
180
|
+
|
|
162
181
|
useEffect(() => {
|
|
163
182
|
if (showWalletsOnInit) {
|
|
164
183
|
cancelFetch();
|
|
@@ -238,12 +257,20 @@ export function ConfirmSwapPage() {
|
|
|
238
257
|
connectedWallets.length,
|
|
239
258
|
]);
|
|
240
259
|
|
|
260
|
+
useLayoutEffect(() => {
|
|
261
|
+
if (!quote) {
|
|
262
|
+
navigate(`../`);
|
|
263
|
+
}
|
|
264
|
+
}, []);
|
|
265
|
+
|
|
241
266
|
return (
|
|
242
267
|
<Layout
|
|
243
268
|
header={{
|
|
244
269
|
title: i18n.t('Confirm Swap'),
|
|
245
|
-
|
|
246
|
-
|
|
270
|
+
onWallet: () => {
|
|
271
|
+
const wallets_url = `../${navigationRoutes.wallets}`;
|
|
272
|
+
navigate(wallets_url);
|
|
273
|
+
},
|
|
247
274
|
suffix: (
|
|
248
275
|
<Tooltip
|
|
249
276
|
container={getContainer()}
|
|
@@ -252,7 +279,7 @@ export function ConfirmSwapPage() {
|
|
|
252
279
|
<HeaderButton
|
|
253
280
|
size="small"
|
|
254
281
|
variant="ghost"
|
|
255
|
-
onClick={() => navigate('
|
|
282
|
+
onClick={() => navigate('../' + navigationRoutes.settings)}>
|
|
256
283
|
<SettingsIcon size={18} color="black" />
|
|
257
284
|
</HeaderButton>
|
|
258
285
|
</Tooltip>
|
|
@@ -260,7 +287,7 @@ export function ConfirmSwapPage() {
|
|
|
260
287
|
}}
|
|
261
288
|
footer={
|
|
262
289
|
<Buttons>
|
|
263
|
-
<div className=
|
|
290
|
+
<div className={confirmBtnStyles()}>
|
|
264
291
|
<Button
|
|
265
292
|
variant="contained"
|
|
266
293
|
type="primary"
|
|
@@ -293,7 +320,7 @@ export function ConfirmSwapPage() {
|
|
|
293
320
|
)}
|
|
294
321
|
|
|
295
322
|
<Container>
|
|
296
|
-
<div className=
|
|
323
|
+
<div className={descriptionStyles()}>
|
|
297
324
|
<Typography variant="title" size="small">
|
|
298
325
|
{i18n.t('You get')}
|
|
299
326
|
</Typography>
|
|
@@ -302,7 +329,7 @@ export function ConfirmSwapPage() {
|
|
|
302
329
|
variant="ghost"
|
|
303
330
|
disabled={fetchingConfirmationQuote}
|
|
304
331
|
onClick={onRefresh}>
|
|
305
|
-
<div className=
|
|
332
|
+
<div className={iconStyles()}>
|
|
306
333
|
<RefreshIcon size={16} />
|
|
307
334
|
</div>
|
|
308
335
|
</Button>
|
|
@@ -314,7 +341,7 @@ export function ConfirmSwapPage() {
|
|
|
314
341
|
</>
|
|
315
342
|
)}
|
|
316
343
|
{confirmSwapResult.warnings?.quoteUpdate && (
|
|
317
|
-
|
|
344
|
+
<div className="quote-update__alert">
|
|
318
345
|
<Alert
|
|
319
346
|
variant="alarm"
|
|
320
347
|
type="warning"
|
|
@@ -325,13 +352,13 @@ export function ConfirmSwapPage() {
|
|
|
325
352
|
)
|
|
326
353
|
}
|
|
327
354
|
/>
|
|
328
|
-
|
|
329
|
-
</>
|
|
355
|
+
</div>
|
|
330
356
|
)}
|
|
331
357
|
<QuoteInfo
|
|
332
358
|
quote={quote}
|
|
333
359
|
type="swap-preview"
|
|
334
360
|
expanded={true}
|
|
361
|
+
alertPosition="top"
|
|
335
362
|
error={confirmSwapResult.error}
|
|
336
363
|
loading={fetchingConfirmationQuote}
|
|
337
364
|
warning={confirmSwapResult.warnings?.quote ?? null}
|
|
@@ -343,6 +370,7 @@ export function ConfirmSwapPage() {
|
|
|
343
370
|
setShowQuoteWarningModal(false);
|
|
344
371
|
await addNewSwap();
|
|
345
372
|
}}
|
|
373
|
+
onChangeSettings={() => navigate('../' + navigationRoutes.settings)}
|
|
346
374
|
/>
|
|
347
375
|
</Container>
|
|
348
376
|
</Layout>
|
|
@@ -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(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
|
@@ -9,8 +9,6 @@ import { SwitchFromAndToButton } from '../components/SwitchFromAndTo';
|
|
|
9
9
|
import { errorMessages } from '../constants/errors';
|
|
10
10
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
11
11
|
import {
|
|
12
|
-
BALANCE_MAX_DECIMALS,
|
|
13
|
-
BALANCE_MIN_DECIMALS,
|
|
14
12
|
PERCENTAGE_CHANGE_MAX_DECIMALS,
|
|
15
13
|
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
16
14
|
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
@@ -24,23 +22,18 @@ import { useAppStore } from '../store/AppStore';
|
|
|
24
22
|
import { useQuoteStore } from '../store/quote';
|
|
25
23
|
import { useUiStore } from '../store/ui';
|
|
26
24
|
import { useWalletsStore } from '../store/wallets';
|
|
27
|
-
import { ButtonState } from '../types';
|
|
28
25
|
import { numberToString } from '../utils/numbers';
|
|
29
26
|
import { getPriceImpact, getPriceImpactLevel } from '../utils/quote';
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
getOutputRatio,
|
|
33
|
-
getPercentageChange,
|
|
34
|
-
getSwapButtonState,
|
|
35
|
-
hasHighValueLoss,
|
|
36
|
-
hasLimitError,
|
|
37
|
-
} from '../utils/swap';
|
|
38
|
-
import { getBalanceFromWallet } from '../utils/wallets';
|
|
27
|
+
import { canComputePriceImpact, getSwapButtonState } from '../utils/swap';
|
|
28
|
+
import { formatBalance, isFetchingBalance } from '../utils/wallets';
|
|
39
29
|
|
|
40
30
|
const Container = styled('div', {
|
|
41
31
|
display: 'flex',
|
|
42
32
|
flexDirection: 'column',
|
|
43
33
|
overflowY: 'visible',
|
|
34
|
+
'& .quote__container': {
|
|
35
|
+
paddingTop: '$2',
|
|
36
|
+
},
|
|
44
37
|
});
|
|
45
38
|
|
|
46
39
|
const FromContainer = styled('div', {
|
|
@@ -78,16 +71,16 @@ export function Home() {
|
|
|
78
71
|
|
|
79
72
|
const fetchMetaStatus = useAppStore().fetchStatus;
|
|
80
73
|
|
|
81
|
-
const connectedWallets = useWalletsStore
|
|
74
|
+
const { connectedWallets, getBalanceFor } = useWalletsStore();
|
|
82
75
|
const setCurrentPage = useUiStore.use.setCurrentPage();
|
|
83
76
|
const [showQuoteWarningModal, setShowQuoteWarningModal] = useState(false);
|
|
84
77
|
const layoutRef = useRef<HTMLDivElement>(null);
|
|
78
|
+
const fetchingBalance =
|
|
79
|
+
!!fromBlockchain &&
|
|
80
|
+
isFetchingBalance(connectedWallets, fromBlockchain.name);
|
|
85
81
|
|
|
86
82
|
const needsToWarnEthOnPath = false;
|
|
87
83
|
|
|
88
|
-
const outToInRatio = getOutputRatio(inputUsdValue, outputUsdValue);
|
|
89
|
-
const highValueLoss = hasHighValueLoss(inputUsdValue, outToInRatio);
|
|
90
|
-
|
|
91
84
|
const priceImpactInputCanNotBeComputed = !canComputePriceImpact(
|
|
92
85
|
quote,
|
|
93
86
|
inputAmount,
|
|
@@ -99,48 +92,26 @@ export function Home() {
|
|
|
99
92
|
inputAmount,
|
|
100
93
|
outputUsdValue
|
|
101
94
|
);
|
|
102
|
-
|
|
95
|
+
|
|
96
|
+
const swapButtonState = getSwapButtonState({
|
|
103
97
|
fetchMetaStatus,
|
|
104
|
-
connectedWallets,
|
|
105
98
|
fetchingQuote,
|
|
99
|
+
inputAmount,
|
|
106
100
|
quote,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
anyWalletConnected: connectedWallets.length > 0,
|
|
102
|
+
error: quoteError,
|
|
103
|
+
warning: quoteWarning,
|
|
110
104
|
needsToWarnEthOnPath,
|
|
111
|
-
|
|
112
|
-
);
|
|
105
|
+
});
|
|
113
106
|
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
connectedWallets,
|
|
119
|
-
fromBlockchain?.name,
|
|
120
|
-
fromToken?.symbol,
|
|
121
|
-
fromToken?.address
|
|
122
|
-
)?.amount || '0',
|
|
123
|
-
BALANCE_MIN_DECIMALS,
|
|
124
|
-
BALANCE_MAX_DECIMALS
|
|
125
|
-
)
|
|
126
|
-
: '0';
|
|
107
|
+
const fromTokenBalance = fromToken ? getBalanceFor(fromToken) : null;
|
|
108
|
+
|
|
109
|
+
const fromTokenFormattedBalance =
|
|
110
|
+
formatBalance(fromTokenBalance)?.amount ?? '0';
|
|
127
111
|
|
|
128
112
|
const tokenBalanceReal =
|
|
129
113
|
!!fromBlockchain && !!fromToken
|
|
130
|
-
? numberToString(
|
|
131
|
-
getBalanceFromWallet(
|
|
132
|
-
connectedWallets,
|
|
133
|
-
fromBlockchain?.name,
|
|
134
|
-
fromToken?.symbol,
|
|
135
|
-
fromToken?.address
|
|
136
|
-
)?.amount || '0',
|
|
137
|
-
getBalanceFromWallet(
|
|
138
|
-
connectedWallets,
|
|
139
|
-
fromBlockchain?.name,
|
|
140
|
-
fromToken?.symbol,
|
|
141
|
-
fromToken?.address
|
|
142
|
-
)?.decimal
|
|
143
|
-
)
|
|
114
|
+
? numberToString(fromTokenBalance?.amount, fromTokenBalance?.decimals)
|
|
144
115
|
: '0';
|
|
145
116
|
|
|
146
117
|
useEffect(() => {
|
|
@@ -152,10 +123,8 @@ export function Home() {
|
|
|
152
123
|
const percentageChange =
|
|
153
124
|
!inputUsdValue || !outputUsdValue || !outputUsdValue.gt(0)
|
|
154
125
|
? null
|
|
155
|
-
:
|
|
156
|
-
|
|
157
|
-
outputUsdValue.toString()
|
|
158
|
-
);
|
|
126
|
+
: getPriceImpact(inputUsdValue.toString(), outputUsdValue.toString());
|
|
127
|
+
|
|
159
128
|
return (
|
|
160
129
|
<Layout
|
|
161
130
|
ref={layoutRef}
|
|
@@ -167,14 +136,13 @@ export function Home() {
|
|
|
167
136
|
size="large"
|
|
168
137
|
disabled={swapButtonState.disabled}
|
|
169
138
|
prefix={
|
|
170
|
-
|
|
171
|
-
swapButtonState.hasWarning && <WarningIcon />
|
|
139
|
+
swapButtonState.action === 'confirm-warning' && <WarningIcon />
|
|
172
140
|
}
|
|
173
141
|
fullWidth
|
|
174
142
|
onClick={() => {
|
|
175
|
-
if (swapButtonState.
|
|
143
|
+
if (swapButtonState.action === 'connect-wallet') {
|
|
176
144
|
navigate(navigationRoutes.wallets);
|
|
177
|
-
} else if (
|
|
145
|
+
} else if (swapButtonState.action === 'confirm-warning') {
|
|
178
146
|
setShowQuoteWarningModal(true);
|
|
179
147
|
} else {
|
|
180
148
|
navigate(navigationRoutes.confirmSwap);
|
|
@@ -184,7 +152,10 @@ export function Home() {
|
|
|
184
152
|
</Button>
|
|
185
153
|
}
|
|
186
154
|
header={{
|
|
187
|
-
|
|
155
|
+
onWallet: () => {
|
|
156
|
+
navigate(navigationRoutes.wallets);
|
|
157
|
+
},
|
|
158
|
+
hasBackButton: false,
|
|
188
159
|
title: i18n.t('Swap'),
|
|
189
160
|
suffix: (
|
|
190
161
|
<HomeButtons
|
|
@@ -200,11 +171,9 @@ export function Home() {
|
|
|
200
171
|
<FromContainer>
|
|
201
172
|
<SwapInput
|
|
202
173
|
label={i18n.t('From')}
|
|
203
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
204
|
-
//@ts-ignore
|
|
205
174
|
mode="From"
|
|
206
175
|
onInputChange={setInputAmount}
|
|
207
|
-
balance={
|
|
176
|
+
balance={fromTokenFormattedBalance}
|
|
208
177
|
chain={{
|
|
209
178
|
displayName: fromBlockchain?.displayName || '',
|
|
210
179
|
image: fromBlockchain?.logo || '',
|
|
@@ -213,7 +182,7 @@ export function Home() {
|
|
|
213
182
|
displayName: fromToken?.symbol || '',
|
|
214
183
|
image: fromToken?.image || '',
|
|
215
184
|
}}
|
|
216
|
-
onClickToken={() => navigate(
|
|
185
|
+
onClickToken={() => navigate(navigationRoutes.fromSwap)}
|
|
217
186
|
price={{
|
|
218
187
|
value: inputAmount,
|
|
219
188
|
usdValue: priceImpactInputCanNotBeComputed
|
|
@@ -229,8 +198,9 @@ export function Home() {
|
|
|
229
198
|
}}
|
|
230
199
|
disabled={fetchMetaStatus === 'failed'}
|
|
231
200
|
loading={fetchMetaStatus === 'loading'}
|
|
201
|
+
loadingBalance={fetchingBalance}
|
|
232
202
|
onSelectMaxBalance={() => {
|
|
233
|
-
if (
|
|
203
|
+
if (fromTokenFormattedBalance !== '0') {
|
|
234
204
|
setInputAmount(tokenBalanceReal.split(',').join(''));
|
|
235
205
|
}
|
|
236
206
|
}}
|
|
@@ -241,6 +211,7 @@ export function Home() {
|
|
|
241
211
|
sharpBottomStyle={!!quote?.result || fetchingQuote}
|
|
242
212
|
label={i18n.t('To')}
|
|
243
213
|
mode="To"
|
|
214
|
+
fetchingQuote={fetchingQuote}
|
|
244
215
|
chain={{
|
|
245
216
|
displayName: toBlockchain?.displayName || '',
|
|
246
217
|
image: toBlockchain?.logo || '',
|
|
@@ -272,27 +243,30 @@ export function Home() {
|
|
|
272
243
|
? errorMessages().unknownPriceError.impactTitle
|
|
273
244
|
: undefined,
|
|
274
245
|
}}
|
|
275
|
-
onClickToken={() => navigate(
|
|
246
|
+
onClickToken={() => navigate(navigationRoutes.toSwap)}
|
|
276
247
|
disabled={fetchMetaStatus === 'failed'}
|
|
277
248
|
loading={fetchMetaStatus === 'loading'}
|
|
278
249
|
/>
|
|
279
250
|
</InputsContainer>
|
|
280
|
-
<
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
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>
|
|
296
270
|
</Container>
|
|
297
271
|
</Layout>
|
|
298
272
|
);
|
|
@@ -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(navigationRoutes.settings),
|
|
42
37
|
title: i18n.t('Language'),
|
|
43
38
|
}}>
|
|
44
39
|
<SettingsContainer>
|