@rango-dev/widget-embedded 0.20.1-next.8 → 0.21.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/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/BlockchainList/BlockchainList.styles.d.ts +169 -1
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +4 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +514 -1089
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +12 -0
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -1
- package/dist/components/CustomCollapsible/CustomCollapsible.d.ts +5 -0
- package/dist/components/CustomCollapsible/CustomCollapsible.d.ts.map +1 -0
- package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts +654 -0
- package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts.map +1 -0
- package/dist/components/CustomCollapsible/CustomCollapsible.types.d.ts +10 -0
- package/dist/components/CustomCollapsible/CustomCollapsible.types.d.ts.map +1 -0
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +20 -0
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +0 -1
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
- package/dist/components/Layout/Layout.d.ts +2 -3
- package/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/Layout/Layout.helpers.d.ts +2 -0
- package/dist/components/Layout/Layout.helpers.d.ts.map +1 -0
- package/dist/components/Layout/Layout.styles.d.ts +14 -4
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
- package/dist/components/Layout/Layout.types.d.ts +6 -3
- package/dist/components/Layout/Layout.types.d.ts.map +1 -1
- package/dist/components/Layout/PageContainer.d.ts +166 -0
- package/dist/components/Layout/PageContainer.d.ts.map +1 -0
- package/dist/components/Layout/ScrollableArea.d.ts +164 -0
- package/dist/components/Layout/ScrollableArea.d.ts.map +1 -0
- package/dist/components/Layout/index.d.ts +2 -0
- package/dist/components/Layout/index.d.ts.map +1 -1
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +4 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +56 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
- package/dist/components/NoResult/NoResult.styles.d.ts +12 -0
- package/dist/components/NoResult/NoResult.styles.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts +16 -0
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/Quote.styles.d.ts +387 -3
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.types.d.ts +19 -0
- package/dist/components/Quote/Quote.types.d.ts.map +1 -1
- package/dist/components/Quote/QuoteCostDetails.d.ts +4 -0
- package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -0
- package/dist/components/Quote/QuoteCostDetails.styles.d.ts +806 -0
- package/dist/components/Quote/QuoteCostDetails.styles.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSummary.d.ts.map +1 -1
- package/dist/components/Quote/QuoteSummary.styles.d.ts +8 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -1
- package/dist/components/Quote/QuoteTrigger .d.ts +4 -0
- package/dist/components/Quote/QuoteTrigger .d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +16 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +40 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +20 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts +1 -0
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts +16 -0
- 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/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +1 -0
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +1 -0
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +1 -1
- package/dist/components/SearchInput/SearchInput.styles.d.ts +4 -0
- package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +11 -156
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
- package/dist/components/SettingsContainer/index.d.ts +1 -1
- package/dist/components/SettingsContainer/index.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.styles.d.ts +20 -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 +523 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts.map +1 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +4 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +2 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +2 -0
- 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 +20 -0
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.styles.d.ts +68 -0
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts +16 -0
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -1
- package/dist/components/WidgetEvents.d.ts.map +1 -1
- package/dist/components/common/ActivateTabAlert/ActivateTabAlert.d.ts +4 -0
- package/dist/components/common/ActivateTabAlert/ActivateTabAlert.d.ts.map +1 -0
- package/dist/components/common/ActivateTabAlert/ActivateTabAlert.types.d.ts +4 -0
- package/dist/components/common/ActivateTabAlert/ActivateTabAlert.types.d.ts.map +1 -0
- package/dist/components/common/ActivateTabAlert/index.d.ts +2 -0
- package/dist/components/common/ActivateTabAlert/index.d.ts.map +1 -0
- package/dist/components/common/ActivateTabModal/ActivateTabModal.d.ts +4 -0
- package/dist/components/common/ActivateTabModal/ActivateTabModal.d.ts.map +1 -0
- package/dist/components/common/ActivateTabModal/ActivateTabModal.types.d.ts +6 -0
- package/dist/components/common/ActivateTabModal/ActivateTabModal.types.d.ts.map +1 -0
- package/dist/components/common/ActivateTabModal/index.d.ts +2 -0
- package/dist/components/common/ActivateTabModal/index.d.ts.map +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/quote.d.ts +12 -0
- package/dist/constants/quote.d.ts.map +1 -0
- package/dist/constants/searchParams.d.ts +6 -6
- package/dist/constants/searchParams.d.ts.map +1 -1
- package/dist/containers/App/App.d.ts.map +1 -1
- package/dist/containers/App/App.styles.d.ts +4 -0
- package/dist/containers/App/App.styles.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +10 -314
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +0 -7
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
- package/dist/containers/Widget/Widget.d.ts.map +1 -1
- package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -1
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +7 -0
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -1
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -1
- package/dist/hooks/useLanguage.d.ts +2 -1
- package/dist/hooks/useLanguage.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/useSyncUrlAndStore/index.d.ts +2 -0
- package/dist/hooks/useSyncUrlAndStore/index.d.ts.map +1 -0
- package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.d.ts +2 -0
- package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.d.ts.map +1 -0
- package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.helpers.d.ts +4 -0
- package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.helpers.d.ts.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +4 -4
- package/dist/libs/tabManager/index.d.ts +3 -0
- package/dist/libs/tabManager/index.d.ts.map +1 -0
- package/dist/libs/tabManager/tabManager.constants.d.ts +4 -0
- package/dist/libs/tabManager/tabManager.constants.d.ts.map +1 -0
- package/dist/libs/tabManager/tabManager.d.ts +63 -0
- package/dist/libs/tabManager/tabManager.d.ts.map +1 -0
- package/dist/libs/tabManager/tabManager.types.d.ts +29 -0
- package/dist/libs/tabManager/tabManager.types.d.ts.map +1 -0
- 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/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 +2 -2
- package/dist/store/app.d.ts +2 -2
- package/dist/store/slices/settings.d.ts +2 -2
- package/dist/store/slices/settings.d.ts.map +1 -1
- package/dist/store/ui.d.ts +12 -10
- package/dist/store/ui.d.ts.map +1 -1
- package/dist/types/notification.d.ts +1 -2
- package/dist/types/notification.d.ts.map +1 -1
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/quote.d.ts +5 -2
- package/dist/utils/quote.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +5 -1
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/ui.d.ts +2 -0
- package/dist/utils/ui.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/QueueManager.tsx +4 -1
- package/src/components/AppRouter.tsx +1 -8
- package/src/components/AppRoutes.tsx +11 -0
- package/src/components/BlockchainList/BlockchainList.styles.ts +4 -3
- package/src/components/BlockchainList/BlockchainList.tsx +1 -1
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +27 -96
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +25 -40
- package/src/components/ConfirmWalletsModal/WalletList.tsx +3 -0
- package/src/components/CustomCollapsible/CustomCollapsible.styles.ts +75 -0
- package/src/components/CustomCollapsible/CustomCollapsible.tsx +55 -0
- package/src/components/CustomCollapsible/CustomCollapsible.types.ts +10 -0
- package/src/components/HeaderButtons/HeaderButtons.styles.ts +4 -1
- package/src/components/HeaderButtons/HeaderButtons.types.ts +0 -1
- package/src/components/HeaderButtons/HomeButtons.tsx +1 -2
- package/src/components/Layout/Layout.helpers.ts +16 -0
- package/src/components/Layout/Layout.styles.ts +17 -31
- package/src/components/Layout/Layout.tsx +60 -29
- package/src/components/Layout/Layout.types.ts +9 -8
- package/src/components/Layout/PageContainer.tsx +24 -0
- package/src/components/Layout/ScrollableArea.tsx +11 -0
- package/src/components/Layout/index.ts +2 -0
- package/src/components/NotificationContent/NotificationContent.tsx +10 -4
- package/src/components/Quote/Quote.styles.ts +44 -5
- package/src/components/Quote/Quote.tsx +10 -77
- package/src/components/Quote/Quote.types.ts +22 -0
- package/src/components/Quote/QuoteCostDetails.styles.ts +50 -0
- package/src/components/Quote/QuoteCostDetails.tsx +218 -0
- package/src/components/Quote/QuoteSummary.tsx +3 -2
- package/src/components/Quote/QuoteTrigger .tsx +215 -0
- package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +3 -1
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +0 -1
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +3 -1
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +1 -0
- package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +3 -1
- package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +3 -1
- package/src/components/SettingsContainer/SettingsContainer.style.ts +0 -5
- package/src/components/SettingsContainer/index.ts +0 -1
- package/src/components/Slippage/Slippage.tsx +5 -5
- package/src/components/Slippage/SlippageTooltipContent.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +12 -13
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +43 -3
- package/src/components/SwapDetails/SwapDetails.styles.ts +18 -6
- package/src/components/SwapDetails/SwapDetails.tsx +16 -5
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.tsx +13 -7
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +2 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +9 -1
- package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +10 -2
- package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +2 -0
- package/src/components/SwapsGroup/SwapsGroup.tsx +18 -7
- package/src/components/TokenList/TokenList.styles.ts +2 -0
- package/src/components/TokenList/TokenList.tsx +1 -1
- package/src/components/WidgetEvents.tsx +2 -14
- package/src/components/common/ActivateTabAlert/ActivateTabAlert.tsx +26 -0
- package/src/components/common/ActivateTabAlert/ActivateTabAlert.types.ts +3 -0
- package/src/components/common/ActivateTabAlert/index.ts +1 -0
- package/src/components/common/ActivateTabModal/ActivateTabModal.tsx +31 -0
- package/src/components/common/ActivateTabModal/ActivateTabModal.types.ts +5 -0
- package/src/components/common/ActivateTabModal/index.ts +1 -0
- package/src/constants/index.ts +1 -0
- package/src/constants/quote.ts +23 -0
- package/src/constants/searchParams.ts +6 -6
- package/src/containers/App/App.styles.ts +2 -0
- package/src/containers/App/App.tsx +1 -4
- package/src/containers/QuoteInfo/QuoteInfo.styles.ts +0 -15
- package/src/containers/QuoteInfo/QuoteInfo.tsx +30 -77
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +0 -7
- package/src/containers/Wallets/Wallets.tsx +3 -3
- package/src/containers/Widget/Widget.tsx +6 -1
- package/src/containers/WidgetInfo/WidgetInfo.tsx +13 -1
- package/src/containers/WidgetInfo/WidgetInfo.types.ts +7 -0
- package/src/containers/WidgetProvider/WidgetProvider.tsx +2 -1
- package/src/hooks/useLanguage.ts +6 -4
- package/src/hooks/useSwapInput.ts +6 -1
- package/src/hooks/useSyncStoresWithConfig.ts +3 -17
- package/src/hooks/useSyncUrlAndStore/index.ts +1 -0
- package/src/hooks/useSyncUrlAndStore/useSyncUrlAndStore.helpers.ts +35 -0
- package/src/hooks/useSyncUrlAndStore/useSyncUrlAndStore.ts +135 -0
- package/src/index.ts +2 -2
- package/src/libs/tabManager/index.ts +2 -0
- package/src/libs/tabManager/tabManager.constants.ts +3 -0
- package/src/libs/tabManager/tabManager.ts +222 -0
- package/src/libs/tabManager/tabManager.types.ts +28 -0
- package/src/pages/ConfirmSwapPage.tsx +55 -47
- package/src/pages/HistoryPage.tsx +5 -17
- package/src/pages/Home.tsx +47 -43
- package/src/pages/LanguagePage.tsx +3 -4
- package/src/pages/LiquiditySourcePage.tsx +8 -6
- package/src/pages/SelectBlockchainPage.tsx +41 -41
- package/src/pages/SelectSwapItemsPage.tsx +45 -39
- package/src/pages/SettingsPage.tsx +3 -4
- package/src/pages/SwapDetailsPage.tsx +21 -7
- package/src/pages/ThemePage.tsx +3 -4
- package/src/pages/WalletsPage.tsx +15 -13
- package/src/store/slices/settings.ts +3 -3
- package/src/store/ui.ts +39 -11
- package/src/types/notification.ts +0 -7
- package/src/utils/date.ts +5 -4
- package/src/utils/quote.ts +18 -28
- package/src/utils/swap.ts +35 -0
- package/src/utils/ui.ts +20 -0
- package/dist/components/UpdateUrl.d.ts +0 -2
- package/dist/components/UpdateUrl.d.ts.map +0 -1
- package/src/components/UpdateUrl.tsx +0 -158
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
import { styled } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
|
-
export const PositionTopAlerts = styled('div', {
|
|
4
|
-
paddingBottom: '$10',
|
|
5
|
-
});
|
|
6
|
-
|
|
7
3
|
export const QuoteContainer = styled('div', {
|
|
8
4
|
width: '100%',
|
|
9
5
|
'& .position-top__skeleton': {
|
|
10
6
|
paddingTop: '$10',
|
|
11
7
|
},
|
|
12
8
|
});
|
|
13
|
-
|
|
14
|
-
export const SkeletonContainer = styled('div', {
|
|
15
|
-
variants: {
|
|
16
|
-
paddingTop: {
|
|
17
|
-
true: {
|
|
18
|
-
paddingTop: '$10',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
9
|
export const FooterStepAlarm = styled('div', {
|
|
25
10
|
paddingBottom: '$15',
|
|
26
11
|
});
|
|
@@ -1,36 +1,16 @@
|
|
|
1
1
|
import type { PropTypes } from './QuoteInfo.types';
|
|
2
2
|
|
|
3
|
-
import { Divider } from '@rango-dev/ui';
|
|
4
3
|
import React from 'react';
|
|
5
4
|
|
|
6
5
|
import { Quote } from '../../components/Quote';
|
|
7
6
|
import { QuoteSkeleton } from '../../components/QuoteSkeleton';
|
|
8
|
-
import { QuoteWarningsAndErrors } from '../../components/QuoteWarningsAndErrors';
|
|
9
7
|
import { useQuoteStore } from '../../store/quote';
|
|
10
8
|
import { QuoteErrorType } from '../../types';
|
|
11
9
|
|
|
12
|
-
import {
|
|
13
|
-
PositionTopAlerts,
|
|
14
|
-
QuoteContainer,
|
|
15
|
-
SkeletonContainer,
|
|
16
|
-
} from './QuoteInfo.styles';
|
|
10
|
+
import { QuoteContainer } from './QuoteInfo.styles';
|
|
17
11
|
|
|
18
12
|
export function QuoteInfo(props: PropTypes) {
|
|
19
|
-
const {
|
|
20
|
-
quote,
|
|
21
|
-
type,
|
|
22
|
-
loading,
|
|
23
|
-
error,
|
|
24
|
-
warning,
|
|
25
|
-
refetchQuote,
|
|
26
|
-
showWarningModal,
|
|
27
|
-
onOpenWarningModal,
|
|
28
|
-
onCloseWarningModal,
|
|
29
|
-
onConfirmWarningModal,
|
|
30
|
-
onChangeSettings,
|
|
31
|
-
expanded = false,
|
|
32
|
-
alertPosition = 'bottom',
|
|
33
|
-
} = props;
|
|
13
|
+
const { quote, type, loading, error, warning, expanded = false } = props;
|
|
34
14
|
const { inputAmount, inputUsdValue, outputUsdValue, outputAmount } =
|
|
35
15
|
useQuoteStore();
|
|
36
16
|
|
|
@@ -41,59 +21,32 @@ export function QuoteInfo(props: PropTypes) {
|
|
|
41
21
|
|
|
42
22
|
const showQuote = !noResult && quote && quote.result && !loading;
|
|
43
23
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
<Quote
|
|
73
|
-
quote={quote}
|
|
74
|
-
error={error}
|
|
75
|
-
warning={warning}
|
|
76
|
-
type={type}
|
|
77
|
-
expanded={expanded}
|
|
78
|
-
recommended={true}
|
|
79
|
-
input={{
|
|
80
|
-
value: inputAmount,
|
|
81
|
-
usdValue: inputUsdValue?.toString() ?? '',
|
|
82
|
-
}}
|
|
83
|
-
output={{
|
|
84
|
-
value: outputAmount?.toString() ?? '',
|
|
85
|
-
usdValue: outputUsdValue?.toString() ?? '',
|
|
86
|
-
}}
|
|
87
|
-
/>
|
|
88
|
-
</QuoteContainer>
|
|
89
|
-
) : null}
|
|
90
|
-
|
|
91
|
-
{alertPosition === 'bottom' && (
|
|
92
|
-
<>
|
|
93
|
-
{!warning && !error && <Divider size={16} />}
|
|
94
|
-
{quoteWarningsAndErrors}
|
|
95
|
-
</>
|
|
96
|
-
)}
|
|
97
|
-
</>
|
|
98
|
-
);
|
|
24
|
+
if (loading) {
|
|
25
|
+
return (
|
|
26
|
+
<QuoteContainer>
|
|
27
|
+
<QuoteSkeleton type={type} expanded={expanded} />
|
|
28
|
+
</QuoteContainer>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return showQuote ? (
|
|
33
|
+
<QuoteContainer>
|
|
34
|
+
<Quote
|
|
35
|
+
quote={quote}
|
|
36
|
+
error={error}
|
|
37
|
+
warning={warning}
|
|
38
|
+
type={type}
|
|
39
|
+
expanded={expanded}
|
|
40
|
+
recommended={true}
|
|
41
|
+
input={{
|
|
42
|
+
value: inputAmount,
|
|
43
|
+
usdValue: inputUsdValue?.toString() ?? '',
|
|
44
|
+
}}
|
|
45
|
+
output={{
|
|
46
|
+
value: outputAmount?.toString() ?? '',
|
|
47
|
+
usdValue: outputUsdValue?.toString() ?? '',
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
</QuoteContainer>
|
|
51
|
+
) : null;
|
|
99
52
|
}
|
|
@@ -10,11 +10,4 @@ export type PropTypes = {
|
|
|
10
10
|
warning: QuoteWarning | null;
|
|
11
11
|
autoScrollOnExpanding?: boolean;
|
|
12
12
|
expanded?: boolean;
|
|
13
|
-
alertPosition?: 'top' | 'bottom';
|
|
14
|
-
refetchQuote: () => void;
|
|
15
|
-
showWarningModal: boolean;
|
|
16
|
-
onOpenWarningModal: () => void;
|
|
17
|
-
onCloseWarningModal: () => void;
|
|
18
|
-
onConfirmWarningModal: () => void;
|
|
19
|
-
onChangeSettings: () => void;
|
|
20
13
|
};
|
|
@@ -13,9 +13,9 @@ import { Events, Provider } from '@rango-dev/wallets-react';
|
|
|
13
13
|
import { isEvmBlockchain } from 'rango-sdk';
|
|
14
14
|
import React, { createContext, useEffect, useRef, useState } from 'react';
|
|
15
15
|
|
|
16
|
-
import { useSyncStoresWithConfig } from '../../hooks/useSyncStoresWithConfig';
|
|
17
16
|
import { useWalletProviders } from '../../hooks/useWalletProviders';
|
|
18
17
|
import { AppStoreProvider, useAppStore } from '../../store/AppStore';
|
|
18
|
+
import { useUiStore } from '../../store/ui';
|
|
19
19
|
import { useWalletsStore } from '../../store/wallets';
|
|
20
20
|
import {
|
|
21
21
|
prepareAccountsForWalletStore,
|
|
@@ -39,7 +39,6 @@ function Main(props: PropsWithChildren<PropTypes>) {
|
|
|
39
39
|
const { providers } = useWalletProviders(props.config.wallets, walletOptions);
|
|
40
40
|
const { connectWallet, disconnectWallet } = useWalletsStore();
|
|
41
41
|
const onConnectWalletHandler = useRef<OnConnectHandler>();
|
|
42
|
-
useSyncStoresWithConfig();
|
|
43
42
|
|
|
44
43
|
useEffect(() => {
|
|
45
44
|
void fetchMeta().catch(console.log);
|
|
@@ -101,6 +100,7 @@ function Main(props: PropsWithChildren<PropTypes>) {
|
|
|
101
100
|
props.onUpdateState(type, event, value, state, meta);
|
|
102
101
|
}
|
|
103
102
|
};
|
|
103
|
+
const isActiveTab = useUiStore.use.isActiveTab();
|
|
104
104
|
|
|
105
105
|
useEffect(() => {
|
|
106
106
|
if (accounts.length) {
|
|
@@ -120,7 +120,7 @@ function Main(props: PropsWithChildren<PropTypes>) {
|
|
|
120
120
|
allBlockChains={blockchains}
|
|
121
121
|
providers={providers}
|
|
122
122
|
onUpdateState={onUpdateState}
|
|
123
|
-
autoConnect>
|
|
123
|
+
autoConnect={!!isActiveTab}>
|
|
124
124
|
{props.children}
|
|
125
125
|
</Provider>
|
|
126
126
|
</WidgetContext.Provider>
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import type { WidgetProps } from './Widget.types';
|
|
2
2
|
import type { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
|
-
import React from 'react';
|
|
4
|
+
import React, { useEffect } from 'react';
|
|
5
5
|
|
|
6
6
|
import { DEFAULT_CONFIG } from '../../store/slices/config';
|
|
7
|
+
import { destroyTabManager } from '../../store/ui';
|
|
7
8
|
import { Main } from '../App';
|
|
8
9
|
import { WidgetProvider } from '../WidgetProvider';
|
|
9
10
|
|
|
10
11
|
export function Widget(props: PropsWithChildren<WidgetProps>) {
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
return destroyTabManager;
|
|
14
|
+
}, []);
|
|
15
|
+
|
|
11
16
|
if (!props.config?.externalWallets) {
|
|
12
17
|
return (
|
|
13
18
|
<WidgetProvider config={props.config ?? DEFAULT_CONFIG}>
|
|
@@ -3,8 +3,11 @@ import type { WidgetInfoContextInterface } from './WidgetInfo.types';
|
|
|
3
3
|
import { useManager } from '@rango-dev/queue-manager-react';
|
|
4
4
|
import React, { createContext, useContext } from 'react';
|
|
5
5
|
|
|
6
|
+
import { useLanguage } from '../../hooks/useLanguage';
|
|
6
7
|
import { useAppStore } from '../../store/AppStore';
|
|
8
|
+
import { useNotificationStore } from '../../store/notification';
|
|
7
9
|
import { useQuoteStore } from '../../store/quote';
|
|
10
|
+
import { setCurrentTabAsActive, useUiStore } from '../../store/ui';
|
|
8
11
|
import { useWalletsStore } from '../../store/wallets';
|
|
9
12
|
import { calculateWalletUsdValue } from '../../utils/wallets';
|
|
10
13
|
|
|
@@ -16,6 +19,7 @@ export const WidgetInfoContext = createContext<
|
|
|
16
19
|
|
|
17
20
|
export function WidgetInfo(props: React.PropsWithChildren) {
|
|
18
21
|
const { manager } = useManager();
|
|
22
|
+
const isActiveTab = useUiStore.use.isActiveTab();
|
|
19
23
|
const retrySwap = useQuoteStore.use.retry();
|
|
20
24
|
const history = new WidgetHistory(manager, { retrySwap });
|
|
21
25
|
const details = useWalletsStore.use.connectedWallets();
|
|
@@ -26,9 +30,13 @@ export function WidgetInfo(props: React.PropsWithChildren) {
|
|
|
26
30
|
const tokens = useAppStore().tokens();
|
|
27
31
|
const swappers = useAppStore().swappers();
|
|
28
32
|
const loadingStatus = useAppStore().fetchStatus;
|
|
33
|
+
const resetLanguage = useLanguage().resetLanguage;
|
|
34
|
+
const notifications = useNotificationStore().getUnreadNotifications();
|
|
29
35
|
|
|
30
36
|
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
31
|
-
const value = {
|
|
37
|
+
const value: WidgetInfoContextInterface = {
|
|
38
|
+
isActiveTab,
|
|
39
|
+
setCurrentTabAsActive,
|
|
32
40
|
history,
|
|
33
41
|
wallets: {
|
|
34
42
|
isLoading,
|
|
@@ -42,6 +50,10 @@ export function WidgetInfo(props: React.PropsWithChildren) {
|
|
|
42
50
|
swappers,
|
|
43
51
|
loadingStatus,
|
|
44
52
|
},
|
|
53
|
+
resetLanguage,
|
|
54
|
+
notifications: {
|
|
55
|
+
list: notifications,
|
|
56
|
+
},
|
|
45
57
|
};
|
|
46
58
|
|
|
47
59
|
return (
|
|
@@ -2,9 +2,12 @@ import type { WidgetHistory } from './WidgetInfo.helpers';
|
|
|
2
2
|
import type { FetchStatus } from '../../store/slices/data';
|
|
3
3
|
import type { ConnectedWallet } from '../../store/wallets';
|
|
4
4
|
import type { Wallet } from '../../types';
|
|
5
|
+
import type { Notification } from '../../types/notification';
|
|
5
6
|
import type { BlockchainMeta, SwapperMeta, Token } from 'rango-sdk';
|
|
6
7
|
|
|
7
8
|
export interface WidgetInfoContextInterface {
|
|
9
|
+
isActiveTab: boolean;
|
|
10
|
+
setCurrentTabAsActive: () => void;
|
|
8
11
|
history: WidgetHistory;
|
|
9
12
|
wallets: {
|
|
10
13
|
details: ConnectedWallet[];
|
|
@@ -18,4 +21,8 @@ export interface WidgetInfoContextInterface {
|
|
|
18
21
|
swappers: SwapperMeta[];
|
|
19
22
|
loadingStatus: FetchStatus;
|
|
20
23
|
};
|
|
24
|
+
resetLanguage: () => void;
|
|
25
|
+
notifications: {
|
|
26
|
+
list: Notification[];
|
|
27
|
+
};
|
|
21
28
|
}
|
|
@@ -17,7 +17,8 @@ export function WidgetProvider(props: PropsWithChildren<PropTypes>) {
|
|
|
17
17
|
API_KEY: config?.apiKey || RANGO_PUBLIC_API_KEY,
|
|
18
18
|
BASE_URL: config?.apiUrl || DEFAULT_BASE_URL,
|
|
19
19
|
});
|
|
20
|
-
}, [config]);
|
|
20
|
+
}, [config.apiKey, config.apiUrl]);
|
|
21
|
+
|
|
21
22
|
return (
|
|
22
23
|
<WidgetWallets config={config} onUpdateState={onUpdateState}>
|
|
23
24
|
<QueueManager apiKey={config.apiKey}>
|
package/src/hooks/useLanguage.ts
CHANGED
|
@@ -9,18 +9,20 @@ interface UseLanguage {
|
|
|
9
9
|
languages: LanguageItem[];
|
|
10
10
|
defaultLanguage: Language;
|
|
11
11
|
activeLanguage: Language;
|
|
12
|
-
changeLanguage: (language?: Language) => void;
|
|
12
|
+
changeLanguage: (language?: Language | null) => void;
|
|
13
|
+
resetLanguage: () => void;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export function useLanguage(): UseLanguage {
|
|
16
|
-
const { setLanguage, language } = useAppStore();
|
|
17
|
+
const { setLanguage, language, config } = useAppStore();
|
|
17
18
|
const languages = LANGUAGES;
|
|
18
|
-
const defaultLanguage = DEFAULT_LANGUAGE;
|
|
19
|
+
const defaultLanguage = config?.language || DEFAULT_LANGUAGE;
|
|
19
20
|
|
|
20
21
|
return {
|
|
21
|
-
activeLanguage: language,
|
|
22
|
+
activeLanguage: language || defaultLanguage,
|
|
22
23
|
languages,
|
|
23
24
|
defaultLanguage,
|
|
24
25
|
changeLanguage: (language) => setLanguage(language || DEFAULT_LANGUAGE),
|
|
26
|
+
resetLanguage: () => setLanguage(null),
|
|
25
27
|
};
|
|
26
28
|
}
|
|
@@ -59,8 +59,9 @@ export function useSwapInput(): UseSwapInput {
|
|
|
59
59
|
affiliateRef,
|
|
60
60
|
affiliateWallets,
|
|
61
61
|
disabledLiquiditySources,
|
|
62
|
+
fetchStatus,
|
|
62
63
|
} = useAppStore();
|
|
63
|
-
const [loading, setLoading] = useState(
|
|
64
|
+
const [loading, setLoading] = useState(true);
|
|
64
65
|
const [error, setError] = useState<QuoteError | null>(null);
|
|
65
66
|
const [warning, setWarning] = useState<QuoteWarning | null>(null);
|
|
66
67
|
const userSlippage = customSlippage ?? slippage;
|
|
@@ -148,6 +149,9 @@ export function useSwapInput(): UseSwapInput {
|
|
|
148
149
|
);
|
|
149
150
|
|
|
150
151
|
useEffect(() => {
|
|
152
|
+
if (fetchStatus !== 'success') {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
151
155
|
if (!isPositiveNumber(inputAmount) || inputUsdValue?.eq(0)) {
|
|
152
156
|
resetState(false);
|
|
153
157
|
cancelFetch();
|
|
@@ -175,6 +179,7 @@ export function useSwapInput(): UseSwapInput {
|
|
|
175
179
|
});
|
|
176
180
|
return cancelFetch;
|
|
177
181
|
}, [
|
|
182
|
+
fetchStatus,
|
|
178
183
|
inputAmount,
|
|
179
184
|
fromToken?.symbol,
|
|
180
185
|
fromToken?.address,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Asset } from 'rango-sdk';
|
|
2
2
|
|
|
3
|
-
import { useEffect,
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
4
|
|
|
5
5
|
import { useAppStore } from '../store/AppStore';
|
|
6
6
|
import { useQuoteStore } from '../store/quote';
|
|
@@ -44,14 +44,7 @@ export function useSyncStoresWithConfig() {
|
|
|
44
44
|
setInputAmount(config?.amount?.toString() || '');
|
|
45
45
|
}, [config?.amount]);
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
* We update quote tokens in two scenarios.
|
|
49
|
-
* If default values exist in widget config or search parameters exist in URL.
|
|
50
|
-
* The logic for updating quote store exists in two useEffect in two locations, and they run in order.If default tokens for quote exist in widget config and also exist in URL, widget config values take precedence over URL values, and URL search parameters don’t affect the widget.
|
|
51
|
-
* Using useLayoutEffect causes widget config values to apply first.
|
|
52
|
-
* We may consider replacing this with a better solution in the future.
|
|
53
|
-
*/
|
|
54
|
-
useLayoutEffect(() => {
|
|
47
|
+
useEffect(() => {
|
|
55
48
|
if (fetchMetaStatus === 'success') {
|
|
56
49
|
const chain = blockchains.find(
|
|
57
50
|
(chain) => chain.name === config?.from?.blockchain
|
|
@@ -100,14 +93,7 @@ export function useSyncStoresWithConfig() {
|
|
|
100
93
|
}
|
|
101
94
|
}, [toTokensConfig, toBlockchainsConfig]);
|
|
102
95
|
|
|
103
|
-
|
|
104
|
-
* We update quote tokens in two scenarios.
|
|
105
|
-
* If default values exist in widget config or search parameters exist in URL.
|
|
106
|
-
* The logic for updating quote store exists in two useEffect in two locations, and they run in order.If default tokens for quote exist in widget config and also exist in URL, widget config values take precedence over URL values, and URL search parameters don’t affect the widget.
|
|
107
|
-
* Using useLayoutEffect causes widget config values to apply first.
|
|
108
|
-
* We may consider replacing this with a better solution in the future.
|
|
109
|
-
*/
|
|
110
|
-
useLayoutEffect(() => {
|
|
96
|
+
useEffect(() => {
|
|
111
97
|
if (fetchMetaStatus === 'success') {
|
|
112
98
|
const chain = blockchains.find(
|
|
113
99
|
(chain) => chain.name === config?.to?.blockchain
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useSyncUrlAndStore } from './useSyncUrlAndStore';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { BlockchainMeta, Token } from 'rango-sdk';
|
|
2
|
+
|
|
3
|
+
export function searchParamToToken(
|
|
4
|
+
tokens: Token[],
|
|
5
|
+
searchParam: string | null,
|
|
6
|
+
chain: BlockchainMeta | null
|
|
7
|
+
): Token | null {
|
|
8
|
+
if (!chain) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return (
|
|
12
|
+
tokens.find((token) => {
|
|
13
|
+
const symbolAndAddress = searchParam?.split('--');
|
|
14
|
+
if (symbolAndAddress?.length === 1) {
|
|
15
|
+
return (
|
|
16
|
+
token.symbol === symbolAndAddress[0] &&
|
|
17
|
+
token.address === null &&
|
|
18
|
+
token.blockchain === chain.name
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
return (
|
|
22
|
+
token.symbol === symbolAndAddress?.[0] &&
|
|
23
|
+
token.address === symbolAndAddress?.[1] &&
|
|
24
|
+
token.blockchain === chain.name
|
|
25
|
+
);
|
|
26
|
+
}) || null
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function tokenToSearchParam(token: Token | null): string | undefined {
|
|
31
|
+
if (token) {
|
|
32
|
+
return `${token.symbol}${token.address ? `--${token.address}` : ''}`;
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
useInRouterContext,
|
|
4
|
+
useLocation,
|
|
5
|
+
useSearchParams,
|
|
6
|
+
} from 'react-router-dom';
|
|
7
|
+
|
|
8
|
+
import { SearchParams } from '../../constants/searchParams';
|
|
9
|
+
import { useAppStore } from '../../store/AppStore';
|
|
10
|
+
import { useQuoteStore } from '../../store/quote';
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
searchParamToToken,
|
|
14
|
+
tokenToSearchParam,
|
|
15
|
+
} from './useSyncUrlAndStore.helpers';
|
|
16
|
+
|
|
17
|
+
export function useSyncUrlAndStore() {
|
|
18
|
+
const location = useLocation();
|
|
19
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
20
|
+
const {
|
|
21
|
+
fromBlockchain,
|
|
22
|
+
toBlockchain,
|
|
23
|
+
fromToken,
|
|
24
|
+
toToken,
|
|
25
|
+
inputAmount,
|
|
26
|
+
setFromBlockchain,
|
|
27
|
+
setToBlockchain,
|
|
28
|
+
setFromToken,
|
|
29
|
+
setToToken,
|
|
30
|
+
setInputAmount,
|
|
31
|
+
} = useQuoteStore();
|
|
32
|
+
const fetchMetaStatus = useAppStore().fetchStatus;
|
|
33
|
+
const blockchains = useAppStore().blockchains();
|
|
34
|
+
const tokens = useAppStore().tokens();
|
|
35
|
+
const isInRouterContext = useInRouterContext();
|
|
36
|
+
|
|
37
|
+
const getUrlSearchParams = () => {
|
|
38
|
+
const fromAmount = searchParams.get(SearchParams.FROM_AMOUNT);
|
|
39
|
+
const fromBlockchain = searchParams.get(SearchParams.FROM_BLOCKCHAIN);
|
|
40
|
+
const fromToken = searchParams.get(SearchParams.FROM_TOKEN);
|
|
41
|
+
const toBlockchain = searchParams.get(SearchParams.TO_BLOCKCHAIN);
|
|
42
|
+
const toToken = searchParams.get(SearchParams.TO_TOKEN);
|
|
43
|
+
const autoConnect = searchParams.get(SearchParams.AUTO_CONNECT);
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
fromAmount,
|
|
47
|
+
fromBlockchain,
|
|
48
|
+
fromToken,
|
|
49
|
+
toBlockchain,
|
|
50
|
+
toToken,
|
|
51
|
+
autoConnect,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const updateUrlSearchParams = (
|
|
56
|
+
searchParams: Record<string, string | undefined>
|
|
57
|
+
) => {
|
|
58
|
+
for (const property in searchParams) {
|
|
59
|
+
if (!searchParams[property]) {
|
|
60
|
+
delete searchParams[property];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
setSearchParams(searchParams as Record<string, string>, { replace: true });
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
const { autoConnect } = getUrlSearchParams();
|
|
68
|
+
if (isInRouterContext && fetchMetaStatus === 'success') {
|
|
69
|
+
updateUrlSearchParams({
|
|
70
|
+
[SearchParams.FROM_BLOCKCHAIN]: fromBlockchain?.name,
|
|
71
|
+
[SearchParams.FROM_TOKEN]: tokenToSearchParam(fromToken),
|
|
72
|
+
[SearchParams.TO_BLOCKCHAIN]: toBlockchain?.name,
|
|
73
|
+
[SearchParams.TO_TOKEN]: tokenToSearchParam(toToken),
|
|
74
|
+
[SearchParams.FROM_AMOUNT]: inputAmount,
|
|
75
|
+
[SearchParams.AUTO_CONNECT]: autoConnect ?? undefined,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}, [
|
|
79
|
+
location.pathname,
|
|
80
|
+
inputAmount,
|
|
81
|
+
fromBlockchain,
|
|
82
|
+
fromToken,
|
|
83
|
+
toBlockchain,
|
|
84
|
+
toToken,
|
|
85
|
+
]);
|
|
86
|
+
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (!isInRouterContext) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const searchParams = getUrlSearchParams();
|
|
92
|
+
if (searchParams.fromAmount) {
|
|
93
|
+
setInputAmount(searchParams.fromAmount);
|
|
94
|
+
}
|
|
95
|
+
if (fetchMetaStatus === 'success') {
|
|
96
|
+
const fromBlockchain = blockchains.find(
|
|
97
|
+
(blockchain) => blockchain.name === searchParams.fromBlockchain
|
|
98
|
+
);
|
|
99
|
+
const fromToken = searchParamToToken(
|
|
100
|
+
tokens,
|
|
101
|
+
searchParams.fromToken,
|
|
102
|
+
fromBlockchain ?? null
|
|
103
|
+
);
|
|
104
|
+
const toBlockchain = blockchains.find(
|
|
105
|
+
(blockchain) => blockchain.name === searchParams.toBlockchain
|
|
106
|
+
);
|
|
107
|
+
const toToken = searchParamToToken(
|
|
108
|
+
tokens,
|
|
109
|
+
searchParams.toToken,
|
|
110
|
+
toBlockchain ?? null
|
|
111
|
+
);
|
|
112
|
+
if (!!fromBlockchain) {
|
|
113
|
+
setFromBlockchain(fromBlockchain);
|
|
114
|
+
if (!!fromToken) {
|
|
115
|
+
setFromToken({
|
|
116
|
+
token: fromToken,
|
|
117
|
+
meta: {
|
|
118
|
+
blockchains: blockchains,
|
|
119
|
+
tokens: tokens,
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (!!toBlockchain) {
|
|
125
|
+
setToBlockchain(toBlockchain);
|
|
126
|
+
if (!!toToken) {
|
|
127
|
+
setToToken({
|
|
128
|
+
token: toToken,
|
|
129
|
+
meta: { blockchains: blockchains, tokens: tokens },
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}, [fetchMetaStatus]);
|
|
135
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -9,7 +9,6 @@ import type {
|
|
|
9
9
|
WidgetTheme,
|
|
10
10
|
} from './types';
|
|
11
11
|
import type {
|
|
12
|
-
EventSeverity,
|
|
13
12
|
PendingSwapWithQueueID,
|
|
14
13
|
Route,
|
|
15
14
|
RouteEvent,
|
|
@@ -40,6 +39,7 @@ import type {
|
|
|
40
39
|
import type { PendingSwap, PendingSwapStep } from 'rango-types';
|
|
41
40
|
|
|
42
41
|
import {
|
|
42
|
+
EventSeverity,
|
|
43
43
|
MainEvents,
|
|
44
44
|
RouteEventType,
|
|
45
45
|
StepEventType,
|
|
@@ -115,7 +115,6 @@ export type {
|
|
|
115
115
|
PendingSwapWithQueueID,
|
|
116
116
|
PendingSwapStep,
|
|
117
117
|
RouteExecutionEvents,
|
|
118
|
-
EventSeverity,
|
|
119
118
|
};
|
|
120
119
|
|
|
121
120
|
// Internal function and enum exports for Rango
|
|
@@ -125,4 +124,5 @@ export {
|
|
|
125
124
|
WalletEvents,
|
|
126
125
|
WalletTypes,
|
|
127
126
|
PendingSwapNetworkStatus,
|
|
127
|
+
EventSeverity,
|
|
128
128
|
};
|