@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
|
@@ -31,6 +31,7 @@ export function makeAlerts(
|
|
|
31
31
|
if (warningLevel === 'high') {
|
|
32
32
|
alertInfo.alertType = 'error';
|
|
33
33
|
}
|
|
34
|
+
alertInfo.action = null;
|
|
34
35
|
alertInfo.title = errorMessages().highValueLossError.title;
|
|
35
36
|
}
|
|
36
37
|
if (warning.type === QuoteWarningType.UNKNOWN_PRICE) {
|
|
@@ -38,14 +39,15 @@ export function makeAlerts(
|
|
|
38
39
|
}
|
|
39
40
|
if (warning.type === QuoteWarningType.INSUFFICIENT_SLIPPAGE) {
|
|
40
41
|
alertInfo.title = i18n.t({
|
|
41
|
-
id: '
|
|
42
|
+
id: 'We recommend you to increase slippage to at least {minRequiredSlippage} for this route.',
|
|
42
43
|
values: {
|
|
43
44
|
minRequiredSlippage: warning.minRequiredSlippage,
|
|
44
45
|
},
|
|
45
46
|
});
|
|
47
|
+
alertInfo.action = 'change-settings';
|
|
46
48
|
}
|
|
47
49
|
if (warning.type === QuoteWarningType.HIGH_SLIPPAGE) {
|
|
48
|
-
alertInfo.title = i18n.t('Caution, your slippage is high');
|
|
50
|
+
alertInfo.title = i18n.t('Caution, your slippage is high.');
|
|
49
51
|
}
|
|
50
52
|
return alertInfo;
|
|
51
53
|
}
|
|
@@ -53,11 +55,16 @@ export function makeAlerts(
|
|
|
53
55
|
alertInfo.alertType = 'error';
|
|
54
56
|
if (error.type === QuoteErrorType.BRIDGE_LIMIT) {
|
|
55
57
|
alertInfo.title = error.recommendation;
|
|
56
|
-
alertInfo.action =
|
|
58
|
+
alertInfo.action = 'show-info';
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
if (error.type === QuoteErrorType.INSUFFICIENT_SLIPPAGE) {
|
|
60
|
-
alertInfo.title =
|
|
62
|
+
alertInfo.title = i18n.t({
|
|
63
|
+
id: 'You need to increase slippage to at least {minRequiredSlippage} for this route.',
|
|
64
|
+
values: {
|
|
65
|
+
minRequiredSlippage: error.minRequiredSlippage,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
61
68
|
alertInfo.action = 'change-settings';
|
|
62
69
|
}
|
|
63
70
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { styled } from '@rango-dev/ui';
|
|
1
|
+
import { darkTheme, styled } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
3
|
export const Alerts = styled('div', {
|
|
4
4
|
width: '100%',
|
|
@@ -19,6 +19,13 @@ export const Item = styled('div', {
|
|
|
19
19
|
justifyContent: 'space-between',
|
|
20
20
|
alignItems: 'center',
|
|
21
21
|
width: '100%',
|
|
22
|
+
'._title': {
|
|
23
|
+
$$color: '$colors$neutral600',
|
|
24
|
+
[`.${darkTheme} &`]: {
|
|
25
|
+
$$color: '$colors$neutral700',
|
|
26
|
+
},
|
|
27
|
+
color: '$$color',
|
|
28
|
+
},
|
|
22
29
|
});
|
|
23
30
|
|
|
24
31
|
export const Action = styled('div', {
|
|
@@ -3,9 +3,7 @@ import type { PropTypes } from './QuoteWarningsAndErrors.types';
|
|
|
3
3
|
import { i18n } from '@lingui/core';
|
|
4
4
|
import { Alert, Button, InfoIcon } from '@rango-dev/ui';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import { useNavigate } from 'react-router-dom';
|
|
7
6
|
|
|
8
|
-
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
9
7
|
import { QuoteErrorType, QuoteWarningType } from '../../types';
|
|
10
8
|
import { NoResult } from '../NoResult';
|
|
11
9
|
|
|
@@ -24,10 +22,9 @@ export function QuoteWarningsAndErrors(props: PropTypes) {
|
|
|
24
22
|
onOpenWarningModal,
|
|
25
23
|
onCloseWarningModal,
|
|
26
24
|
onConfirmWarningModal,
|
|
25
|
+
onChangeSettings,
|
|
27
26
|
} = props;
|
|
28
27
|
|
|
29
|
-
const navigate = useNavigate();
|
|
30
|
-
|
|
31
28
|
const warningModalHandlers = {
|
|
32
29
|
open: showWarningModal,
|
|
33
30
|
onClose: onCloseWarningModal,
|
|
@@ -58,20 +55,23 @@ export function QuoteWarningsAndErrors(props: PropTypes) {
|
|
|
58
55
|
title={alertInfo.title}
|
|
59
56
|
type={alertInfo.alertType}
|
|
60
57
|
variant="alarm"
|
|
61
|
-
action
|
|
62
|
-
|
|
58
|
+
{...(alertInfo.action === 'show-info' && {
|
|
59
|
+
action: (
|
|
63
60
|
<Action onClick={onOpenWarningModal}>
|
|
64
61
|
<InfoIcon size={12} color="gray" />
|
|
65
62
|
</Action>
|
|
66
|
-
)
|
|
63
|
+
),
|
|
64
|
+
})}
|
|
65
|
+
{...(alertInfo.action === 'change-settings' && {
|
|
66
|
+
action: (
|
|
67
67
|
<Button
|
|
68
|
-
size="
|
|
69
|
-
type={
|
|
70
|
-
onClick={
|
|
71
|
-
{i18n.t('Change
|
|
68
|
+
size="xxsmall"
|
|
69
|
+
type={alertInfo.alertType}
|
|
70
|
+
onClick={onChangeSettings}>
|
|
71
|
+
{i18n.t('Change')}
|
|
72
72
|
</Button>
|
|
73
|
-
)
|
|
74
|
-
}
|
|
73
|
+
),
|
|
74
|
+
})}
|
|
75
75
|
/>
|
|
76
76
|
</Alerts>
|
|
77
77
|
)}
|
|
@@ -9,7 +9,7 @@ import React from 'react';
|
|
|
9
9
|
import { useNavigate } from 'react-router-dom';
|
|
10
10
|
|
|
11
11
|
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
12
|
-
import {
|
|
12
|
+
import { useAppStore } from '../../store/AppStore';
|
|
13
13
|
import { QuoteWarningType } from '../../types';
|
|
14
14
|
import { getContainer } from '../../utils/common';
|
|
15
15
|
|
|
@@ -21,7 +21,7 @@ type PropsTypes = {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export function SlippageWarningModal(props: PropsTypes) {
|
|
24
|
-
const { customSlippage, slippage } =
|
|
24
|
+
const { customSlippage, slippage } = useAppStore();
|
|
25
25
|
const { open, onClose, onConfirm, warning } = props;
|
|
26
26
|
const navigate = useNavigate();
|
|
27
27
|
const userSlippage = customSlippage ?? slippage;
|
|
@@ -33,7 +33,7 @@ export function SlippageWarningModal(props: PropsTypes) {
|
|
|
33
33
|
<Button
|
|
34
34
|
size="small"
|
|
35
35
|
variant="ghost"
|
|
36
|
-
onClick={() => navigate('
|
|
36
|
+
onClick={() => navigate('../' + navigationRoutes.settings)}>
|
|
37
37
|
<Typography variant="label" size="medium" color="$neutral900">
|
|
38
38
|
{i18n.t('Change settings')}
|
|
39
39
|
</Typography>
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { styled } from '@rango-dev/ui';
|
|
1
|
+
import { Chip, styled, TextField } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
3
|
export const BaseContainer = styled('div', {
|
|
4
4
|
paddingTop: '$5',
|
|
5
|
-
|
|
5
|
+
padding: '$10 $5',
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
export const SlippageChipsContainer = styled('div', {
|
|
9
9
|
display: 'flex',
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
flexWrap: 'wrap',
|
|
11
|
+
gap: '$10',
|
|
12
|
+
[`& ${TextField}`]: {
|
|
13
|
+
flex: '1 1 0',
|
|
14
|
+
maxWidth: '127px',
|
|
15
|
+
minWidth: '85px',
|
|
16
|
+
},
|
|
12
17
|
});
|
|
13
18
|
|
|
14
19
|
export const Head = styled('div', {
|
|
@@ -19,6 +24,11 @@ export const Head = styled('div', {
|
|
|
19
24
|
});
|
|
20
25
|
|
|
21
26
|
export const SlippageTooltipContainer = styled('div', {
|
|
22
|
-
maxWidth: '
|
|
27
|
+
maxWidth: '280px',
|
|
23
28
|
padding: '$10',
|
|
24
29
|
});
|
|
30
|
+
|
|
31
|
+
export const SlippageChip = styled(Chip, {
|
|
32
|
+
width: '61px',
|
|
33
|
+
flexShrink: 0,
|
|
34
|
+
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { i18n } from '@lingui/core';
|
|
2
2
|
import {
|
|
3
|
-
Chip,
|
|
4
3
|
Divider,
|
|
5
4
|
InfoIcon,
|
|
6
5
|
TextField,
|
|
@@ -14,17 +13,20 @@ import {
|
|
|
14
13
|
MIN_SLIPPGAE,
|
|
15
14
|
SLIPPAGES,
|
|
16
15
|
} from '../../constants/swapSettings';
|
|
17
|
-
import {
|
|
16
|
+
import { useAppStore } from '../../store/AppStore';
|
|
18
17
|
import { getContainer } from '../../utils/common';
|
|
19
18
|
|
|
20
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
BaseContainer,
|
|
21
|
+
Head,
|
|
22
|
+
SlippageChip,
|
|
23
|
+
SlippageChipsContainer,
|
|
24
|
+
} from './Slippage.styles';
|
|
21
25
|
import { SlippageTooltipContent } from './SlippageTooltipContent';
|
|
22
26
|
|
|
23
27
|
export function Slippage() {
|
|
24
|
-
const slippage =
|
|
25
|
-
|
|
26
|
-
const customSlippage = useSettingsStore.use.customSlippage();
|
|
27
|
-
const setCustomSlippage = useSettingsStore.use.setCustomSlippage();
|
|
28
|
+
const { slippage, setSlippage, customSlippage, setCustomSlippage } =
|
|
29
|
+
useAppStore();
|
|
28
30
|
|
|
29
31
|
return (
|
|
30
32
|
<BaseContainer>
|
|
@@ -36,6 +38,7 @@ export function Slippage() {
|
|
|
36
38
|
<Tooltip
|
|
37
39
|
container={getContainer()}
|
|
38
40
|
side="top"
|
|
41
|
+
sideOffset={4}
|
|
39
42
|
content={<SlippageTooltipContent />}>
|
|
40
43
|
<InfoIcon color="gray" />
|
|
41
44
|
</Tooltip>
|
|
@@ -45,8 +48,7 @@ export function Slippage() {
|
|
|
45
48
|
const key = `slippage-${index}`;
|
|
46
49
|
return (
|
|
47
50
|
<>
|
|
48
|
-
<
|
|
49
|
-
style={{ width: '64px', flexShrink: 0 }}
|
|
51
|
+
<SlippageChip
|
|
50
52
|
key={key}
|
|
51
53
|
onClick={() => {
|
|
52
54
|
if (customSlippage) {
|
|
@@ -57,7 +59,6 @@ export function Slippage() {
|
|
|
57
59
|
selected={!customSlippage && slippageItem === slippage}
|
|
58
60
|
label={`${slippageItem.toString()}%`}
|
|
59
61
|
/>
|
|
60
|
-
<Divider direction="horizontal" size={8} />
|
|
61
62
|
</>
|
|
62
63
|
);
|
|
63
64
|
})}
|
|
@@ -10,8 +10,6 @@ import {
|
|
|
10
10
|
} from '@rango-dev/ui';
|
|
11
11
|
import React from 'react';
|
|
12
12
|
|
|
13
|
-
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
14
|
-
import { useNavigateBack } from '../../hooks/useNavigateBack';
|
|
15
13
|
import { SuffixContainer } from '../HeaderButtons/HeaderButtons.styles';
|
|
16
14
|
import { Layout } from '../Layout';
|
|
17
15
|
import { LoadingSwapDetails } from '../LoadingSwapDetails';
|
|
@@ -20,28 +18,27 @@ import {
|
|
|
20
18
|
Container,
|
|
21
19
|
HeaderDetails,
|
|
22
20
|
PlaceholderContainer,
|
|
21
|
+
requestIdStyles,
|
|
22
|
+
rowStyles,
|
|
23
23
|
} from './SwapDetails.styles';
|
|
24
24
|
|
|
25
25
|
export function SwapDetailsPlaceholder(props: SwapDetailsPlaceholderPropTypes) {
|
|
26
26
|
const { requestId, showSkeleton } = props;
|
|
27
|
-
const { navigateBackFrom } = useNavigateBack();
|
|
28
|
-
|
|
29
27
|
return (
|
|
30
28
|
<Layout
|
|
31
29
|
noPadding
|
|
32
30
|
header={{
|
|
33
31
|
title: i18n.t('Swap and Bridge'),
|
|
34
|
-
onBack: () => navigateBackFrom(navigationRoutes.swapDetails),
|
|
35
32
|
suffix: <SuffixContainer />,
|
|
36
33
|
}}>
|
|
37
34
|
{showSkeleton && (
|
|
38
35
|
<Container>
|
|
39
36
|
<HeaderDetails>
|
|
40
|
-
<div className=
|
|
37
|
+
<div className={rowStyles()}>
|
|
41
38
|
<Typography variant="label" size="large" color="neutral700">
|
|
42
39
|
{`${i18n.t('Request ID')}:`}
|
|
43
40
|
</Typography>
|
|
44
|
-
<div className=
|
|
41
|
+
<div className={requestIdStyles()}>
|
|
45
42
|
<Typography variant="label" size="small" color="neutral700">
|
|
46
43
|
<Skeleton width={60} height={10} variant="rounded" />
|
|
47
44
|
</Typography>
|
|
@@ -50,7 +47,7 @@ export function SwapDetailsPlaceholder(props: SwapDetailsPlaceholderPropTypes) {
|
|
|
50
47
|
</IconButton>
|
|
51
48
|
</div>
|
|
52
49
|
</div>
|
|
53
|
-
<div className=
|
|
50
|
+
<div className={rowStyles()}>
|
|
54
51
|
<Typography variant="label" size="large" color="neutral700">
|
|
55
52
|
{`${i18n.t('Created at')}:`}
|
|
56
53
|
</Typography>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GetStep } from '../SwapDetailsAlerts';
|
|
2
|
-
import type { PendingSwapStep } from '@rango-dev/queue-manager-rango-preset';
|
|
3
2
|
import type { Step, StepDetailsProps } from '@rango-dev/ui';
|
|
3
|
+
import type { PendingSwapStep } from 'rango-types';
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { darkTheme, styled } from '@rango-dev/ui';
|
|
1
|
+
import { css, darkTheme, styled } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
3
|
export const Container = styled('div', {
|
|
4
4
|
display: 'flex',
|
|
@@ -7,38 +7,6 @@ export const Container = styled('div', {
|
|
|
7
7
|
alignItems: 'center',
|
|
8
8
|
height: '0',
|
|
9
9
|
flexGrow: 1,
|
|
10
|
-
'& .row': {
|
|
11
|
-
display: 'flex',
|
|
12
|
-
width: '100%',
|
|
13
|
-
justifyContent: 'space-between',
|
|
14
|
-
alignItems: 'center',
|
|
15
|
-
padding: '$10 $20',
|
|
16
|
-
borderBottom: '1px solid',
|
|
17
|
-
$$color: '$colors$neutral300',
|
|
18
|
-
[`.${darkTheme} &`]: {
|
|
19
|
-
$$color: '$colors$neutral400',
|
|
20
|
-
},
|
|
21
|
-
borderColor: '$$color',
|
|
22
|
-
color: '$neutral500',
|
|
23
|
-
},
|
|
24
|
-
'& .request-id': {
|
|
25
|
-
display: 'flex',
|
|
26
|
-
justifyContent: 'center',
|
|
27
|
-
alignItems: 'center',
|
|
28
|
-
height: '$24',
|
|
29
|
-
},
|
|
30
|
-
'& .output': {
|
|
31
|
-
display: 'flex',
|
|
32
|
-
width: '100%',
|
|
33
|
-
padding: '$15 $20 $20',
|
|
34
|
-
flexDirection: 'column',
|
|
35
|
-
alignItems: 'start',
|
|
36
|
-
},
|
|
37
|
-
'& .title-steps': {
|
|
38
|
-
textAlign: 'left',
|
|
39
|
-
width: '100%',
|
|
40
|
-
padding: '0 $20 $10',
|
|
41
|
-
},
|
|
42
10
|
});
|
|
43
11
|
|
|
44
12
|
export const HeaderDetails = styled('div', {
|
|
@@ -70,3 +38,38 @@ export const LoaderContainer = styled('div', {
|
|
|
70
38
|
paddingTop: '33%',
|
|
71
39
|
flex: 1,
|
|
72
40
|
});
|
|
41
|
+
|
|
42
|
+
export const rowStyles = css({
|
|
43
|
+
display: 'flex',
|
|
44
|
+
width: '100%',
|
|
45
|
+
justifyContent: 'space-between',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
padding: '$10 $20',
|
|
48
|
+
borderBottom: '1px solid',
|
|
49
|
+
$$color: '$colors$neutral300',
|
|
50
|
+
[`.${darkTheme} &`]: {
|
|
51
|
+
$$color: '$colors$neutral400',
|
|
52
|
+
},
|
|
53
|
+
borderColor: '$$color',
|
|
54
|
+
color: '$neutral500',
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export const requestIdStyles = css({
|
|
58
|
+
display: 'flex',
|
|
59
|
+
justifyContent: 'center',
|
|
60
|
+
alignItems: 'center',
|
|
61
|
+
height: '$24',
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export const outputStyles = css({
|
|
65
|
+
display: 'flex',
|
|
66
|
+
width: '100%',
|
|
67
|
+
padding: '$15 $20 $20',
|
|
68
|
+
flexDirection: 'column',
|
|
69
|
+
alignItems: 'start',
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export const titleStepsStyles = css({
|
|
73
|
+
width: '100%',
|
|
74
|
+
padding: '0 $20 $10',
|
|
75
|
+
});
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
getCurrentBlockchainOfOrNull,
|
|
7
7
|
getCurrentStep,
|
|
8
8
|
getRelatedWalletOrNull,
|
|
9
|
-
PendingSwapNetworkStatus,
|
|
10
9
|
} from '@rango-dev/queue-manager-rango-preset';
|
|
11
10
|
import {
|
|
12
11
|
Button,
|
|
@@ -19,10 +18,10 @@ import {
|
|
|
19
18
|
useCopyToClipboard,
|
|
20
19
|
} from '@rango-dev/ui';
|
|
21
20
|
import { useWallets } from '@rango-dev/wallets-react';
|
|
21
|
+
import { PendingSwapNetworkStatus } from 'rango-types';
|
|
22
22
|
import React, { useEffect, useRef, useState } from 'react';
|
|
23
23
|
import { useNavigate } from 'react-router-dom';
|
|
24
24
|
|
|
25
|
-
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
26
25
|
import {
|
|
27
26
|
GAS_FEE_MAX_DECIMALS,
|
|
28
27
|
GAS_FEE_MIN_DECIMALS,
|
|
@@ -33,7 +32,6 @@ import {
|
|
|
33
32
|
USD_VALUE_MAX_DECIMALS,
|
|
34
33
|
USD_VALUE_MIN_DECIMALS,
|
|
35
34
|
} from '../../constants/routing';
|
|
36
|
-
import { useNavigateBack } from '../../hooks/useNavigateBack';
|
|
37
35
|
import { useAppStore } from '../../store/AppStore';
|
|
38
36
|
import { useNotificationStore } from '../../store/notification';
|
|
39
37
|
import { useQuoteStore } from '../../store/quote';
|
|
@@ -49,7 +47,7 @@ import {
|
|
|
49
47
|
shouldRetrySwap,
|
|
50
48
|
} from '../../utils/swap';
|
|
51
49
|
import { getSwapDate } from '../../utils/time';
|
|
52
|
-
import { getConciseAddress
|
|
50
|
+
import { getConciseAddress } from '../../utils/wallets';
|
|
53
51
|
import { SuffixContainer } from '../HeaderButtons/HeaderButtons.styles';
|
|
54
52
|
import { Layout } from '../Layout';
|
|
55
53
|
import { QuoteSummary } from '../Quote';
|
|
@@ -59,7 +57,15 @@ import {
|
|
|
59
57
|
} from '../SwapDetailsModal';
|
|
60
58
|
|
|
61
59
|
import { getSteps, getStepState, RESET_INTERVAL } from './SwapDetails.helpers';
|
|
62
|
-
import {
|
|
60
|
+
import {
|
|
61
|
+
Container,
|
|
62
|
+
HeaderDetails,
|
|
63
|
+
outputStyles,
|
|
64
|
+
requestIdStyles,
|
|
65
|
+
rowStyles,
|
|
66
|
+
StepsList,
|
|
67
|
+
titleStepsStyles,
|
|
68
|
+
} from './SwapDetails.styles';
|
|
63
69
|
|
|
64
70
|
export function SwapDetails(props: SwapDetailsProps) {
|
|
65
71
|
const { swap, requestId, onDelete, onCancel: onCancelProps } = props;
|
|
@@ -68,7 +74,6 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
68
74
|
const tokens = useAppStore().tokens();
|
|
69
75
|
const retry = useQuoteStore.use.retry();
|
|
70
76
|
const navigate = useNavigate();
|
|
71
|
-
const { navigateBackFrom } = useNavigateBack();
|
|
72
77
|
const [_, handleCopy] = useCopyToClipboard(RESET_INTERVAL);
|
|
73
78
|
const listRef = useRef<HTMLDivElement | null>(null);
|
|
74
79
|
const [modalState, setModalState] = useState<ModalState>(null);
|
|
@@ -166,35 +171,19 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
166
171
|
)?.diagnosisUrl;
|
|
167
172
|
|
|
168
173
|
const outputUsdValue = numberToString(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
) *
|
|
177
|
-
(getUsdPrice(
|
|
178
|
-
lastStep.toBlockchain,
|
|
179
|
-
lastStep.toSymbol,
|
|
180
|
-
lastStep.toSymbolAddress,
|
|
181
|
-
tokens
|
|
182
|
-
) || 0)
|
|
183
|
-
),
|
|
174
|
+
parseFloat(
|
|
175
|
+
numberToString(
|
|
176
|
+
outputAmount,
|
|
177
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
178
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
179
|
+
)
|
|
180
|
+
) * (lastStep.toUsdPrice || 0),
|
|
184
181
|
USD_VALUE_MIN_DECIMALS,
|
|
185
182
|
USD_VALUE_MAX_DECIMALS
|
|
186
183
|
);
|
|
187
184
|
|
|
188
185
|
const inputUsdValue = numberToString(
|
|
189
|
-
|
|
190
|
-
parseFloat(swap.inputAmount) *
|
|
191
|
-
(getUsdPrice(
|
|
192
|
-
firstStep.fromBlockchain,
|
|
193
|
-
firstStep.fromSymbol,
|
|
194
|
-
firstStep.fromSymbolAddress,
|
|
195
|
-
tokens
|
|
196
|
-
) || 0)
|
|
197
|
-
),
|
|
186
|
+
parseFloat(swap.inputAmount) * (firstStep.fromUsdPrice || 0),
|
|
198
187
|
USD_VALUE_MIN_DECIMALS,
|
|
199
188
|
USD_VALUE_MAX_DECIMALS
|
|
200
189
|
);
|
|
@@ -237,7 +226,6 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
237
226
|
noPadding
|
|
238
227
|
header={{
|
|
239
228
|
title: i18n.t('Swap and Bridge'),
|
|
240
|
-
onBack: () => navigateBackFrom(navigationRoutes.swapDetails),
|
|
241
229
|
onCancel:
|
|
242
230
|
swap.status === 'running' ? () => setModalState('cancel') : undefined,
|
|
243
231
|
suffix: swap.status !== 'running' && (
|
|
@@ -265,7 +253,8 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
265
253
|
onClick={() => {
|
|
266
254
|
retry(swap, { blockchains: blockchains, tokens: tokens });
|
|
267
255
|
setTimeout(() => {
|
|
268
|
-
|
|
256
|
+
const home = '../../';
|
|
257
|
+
navigate(home);
|
|
269
258
|
}, 0);
|
|
270
259
|
}}>
|
|
271
260
|
{i18n.t('Try again')}
|
|
@@ -274,11 +263,11 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
274
263
|
}>
|
|
275
264
|
<Container>
|
|
276
265
|
<HeaderDetails>
|
|
277
|
-
<div className=
|
|
266
|
+
<div className={rowStyles()}>
|
|
278
267
|
<Typography variant="label" size="large" color="neutral700">
|
|
279
268
|
{`${i18n.t('Request ID')}:`}
|
|
280
269
|
</Typography>
|
|
281
|
-
<div className=
|
|
270
|
+
<div className={requestIdStyles()}>
|
|
282
271
|
<Typography variant="label" size="small" color="neutral700">
|
|
283
272
|
{requestId}
|
|
284
273
|
</Typography>
|
|
@@ -289,7 +278,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
289
278
|
</IconButton>
|
|
290
279
|
</div>
|
|
291
280
|
</div>
|
|
292
|
-
<div className=
|
|
281
|
+
<div className={rowStyles()}>
|
|
293
282
|
<Typography variant="label" size="large" color="neutral700">
|
|
294
283
|
{`${i18n.t('Created at')}:`}
|
|
295
284
|
</Typography>
|
|
@@ -299,7 +288,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
299
288
|
</div>
|
|
300
289
|
</HeaderDetails>
|
|
301
290
|
|
|
302
|
-
<div className=
|
|
291
|
+
<div className={outputStyles()}>
|
|
303
292
|
<QuoteCost
|
|
304
293
|
fee={numberToString(
|
|
305
294
|
String(totalFee),
|
|
@@ -347,14 +336,14 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
347
336
|
},
|
|
348
337
|
}}
|
|
349
338
|
percentageChange={numberToString(
|
|
350
|
-
|
|
339
|
+
percentageChange,
|
|
351
340
|
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
352
341
|
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
353
342
|
)}
|
|
354
343
|
warningLevel={getPriceImpactLevel(percentageChange ?? 0)}
|
|
355
344
|
/>
|
|
356
345
|
</div>
|
|
357
|
-
<div className=
|
|
346
|
+
<div className={titleStepsStyles()}>
|
|
358
347
|
<Typography variant="title" size="small">
|
|
359
348
|
{i18n.t('Swaps steps')}
|
|
360
349
|
</Typography>
|
|
@@ -405,7 +394,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
405
394
|
)}
|
|
406
395
|
usdValue={outputUsdValue}
|
|
407
396
|
percentageChange={numberToString(
|
|
408
|
-
|
|
397
|
+
percentageChange,
|
|
409
398
|
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
410
399
|
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
411
400
|
)}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { WaningAlertsProps } from './SwapDetailsAlerts.types';
|
|
2
2
|
|
|
3
3
|
import { i18n } from '@lingui/core';
|
|
4
|
-
import { PendingSwapNetworkStatus } from '@rango-dev/queue-manager-rango-preset';
|
|
5
4
|
import { Alert, Button } from '@rango-dev/ui';
|
|
5
|
+
import { PendingSwapNetworkStatus } from 'rango-types';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
export function WarningAlert(props: WaningAlertsProps) {
|
|
@@ -12,8 +12,6 @@ import {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { useNavigate } from 'react-router-dom';
|
|
14
14
|
|
|
15
|
-
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
16
|
-
|
|
17
15
|
export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
|
|
18
16
|
const {
|
|
19
17
|
open,
|
|
@@ -70,7 +68,10 @@ export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
|
|
|
70
68
|
variant="contained"
|
|
71
69
|
type="primary"
|
|
72
70
|
size="large"
|
|
73
|
-
onClick={() =>
|
|
71
|
+
onClick={() => {
|
|
72
|
+
const home = '../../';
|
|
73
|
+
navigate(home);
|
|
74
|
+
}}>
|
|
74
75
|
<Typography variant="title" size="medium" color="neutral100">
|
|
75
76
|
{i18n.t('Done')}
|
|
76
77
|
</Typography>
|
|
@@ -10,8 +10,8 @@ export const CancelContent = ({ onCancel, onClose }: CancelContentProps) => {
|
|
|
10
10
|
<Divider size={20} />
|
|
11
11
|
<MessageBox
|
|
12
12
|
type="error"
|
|
13
|
-
title={i18n.t('
|
|
14
|
-
description={i18n.t('Are you sure you want to
|
|
13
|
+
title={i18n.t('Cancel Swap')}
|
|
14
|
+
description={i18n.t('Are you sure you want to cancel this swap?')}
|
|
15
15
|
/>
|
|
16
16
|
<Divider size={32} />
|
|
17
17
|
<Button
|
|
@@ -1,30 +1,36 @@
|
|
|
1
1
|
import type { WalletStateContentProps } from './SwapDetailsModal.types';
|
|
2
2
|
|
|
3
|
-
import { MessageBox, Wallet
|
|
3
|
+
import { MessageBox, Wallet } from '@rango-dev/ui';
|
|
4
4
|
import { useWallets } from '@rango-dev/wallets-react';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { getContainer } from '../../utils/common';
|
|
8
|
+
import { mapStatusToWalletState } from '../../utils/wallets';
|
|
8
9
|
|
|
9
10
|
import { WalletContainer } from './SwapDetailsModal.styles';
|
|
10
11
|
|
|
11
12
|
export const WalletStateContent = (props: WalletStateContentProps) => {
|
|
12
13
|
const { type, title, currentStepWallet, message, showWalletButton } = props;
|
|
13
|
-
const { connect, getWalletInfo, state
|
|
14
|
+
const { connect, getWalletInfo, state } = useWallets();
|
|
14
15
|
const walletType = currentStepWallet?.walletType;
|
|
15
|
-
const
|
|
16
|
-
|
|
16
|
+
const walletState = walletType
|
|
17
|
+
? mapStatusToWalletState(state(walletType))
|
|
18
|
+
: null;
|
|
19
|
+
const walletInfo = walletType ? getWalletInfo(walletType) : null;
|
|
20
|
+
const shouldShowWallet =
|
|
21
|
+
showWalletButton && !!walletType && !!walletState && !!walletInfo;
|
|
17
22
|
return (
|
|
18
23
|
<>
|
|
19
24
|
<MessageBox type={type} title={title} description={message} />
|
|
20
|
-
{
|
|
25
|
+
{shouldShowWallet && (
|
|
21
26
|
<WalletContainer>
|
|
22
27
|
<Wallet
|
|
23
28
|
container={getContainer()}
|
|
24
|
-
title={
|
|
25
|
-
image={
|
|
29
|
+
title={walletInfo.name}
|
|
30
|
+
image={walletInfo.img}
|
|
26
31
|
type={walletType}
|
|
27
|
-
state={
|
|
32
|
+
state={walletState}
|
|
33
|
+
link={walletInfo.installLink}
|
|
28
34
|
onClick={async () => connect(walletType)}
|
|
29
35
|
/>
|
|
30
36
|
</WalletContainer>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ModalNetworkValueTypes } from './SwapDetailsModal.types';
|
|
2
2
|
|
|
3
3
|
import { i18n } from '@lingui/core';
|
|
4
|
-
import { PendingSwapNetworkStatus } from '
|
|
4
|
+
import { PendingSwapNetworkStatus } from 'rango-types';
|
|
5
5
|
|
|
6
6
|
export const modalNetworkValues: Record<
|
|
7
7
|
Exclude<PendingSwapNetworkStatus, PendingSwapNetworkStatus.WaitingForQueue>,
|