@rango-dev/widget-embedded 0.20.1-next.9 → 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.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/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 +8 -8
- 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 +24 -39
- 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.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/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 +13 -2
- 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 +3 -4
- package/src/pages/SelectBlockchainPage.tsx +38 -38
- package/src/pages/SelectSwapItemsPage.tsx +40 -38
- 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/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
|
@@ -14,14 +14,13 @@ import {
|
|
|
14
14
|
} from '@rango-dev/ui';
|
|
15
15
|
import React, { useState } from 'react';
|
|
16
16
|
|
|
17
|
-
import { Layout } from '../components/Layout';
|
|
17
|
+
import { Layout, PageContainer } from '../components/Layout';
|
|
18
18
|
import { LoadingLiquiditySourceList } from '../components/LoadingLiquiditySourceList';
|
|
19
19
|
import { SearchInput } from '../components/SearchInput';
|
|
20
20
|
import {
|
|
21
21
|
LiquiditySourceList,
|
|
22
22
|
LiquiditySourceSuffix,
|
|
23
23
|
NotFoundContainer,
|
|
24
|
-
SettingsContainer,
|
|
25
24
|
} from '../components/SettingsContainer';
|
|
26
25
|
import { useAppStore } from '../store/AppStore';
|
|
27
26
|
import { containsText } from '../utils/numbers';
|
|
@@ -109,7 +108,7 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
|
|
|
109
108
|
</LiquiditySourceSuffix>
|
|
110
109
|
),
|
|
111
110
|
}}>
|
|
112
|
-
<
|
|
111
|
+
<PageContainer view>
|
|
113
112
|
<SearchInput
|
|
114
113
|
value={searchedFor}
|
|
115
114
|
setValue={setSearchedFor}
|
|
@@ -148,7 +147,7 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
|
|
|
148
147
|
</LiquiditySourceList>
|
|
149
148
|
)
|
|
150
149
|
)}
|
|
151
|
-
</
|
|
150
|
+
</PageContainer>
|
|
152
151
|
</Layout>
|
|
153
152
|
);
|
|
154
153
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import React, { useState } from 'react';
|
|
8
8
|
|
|
9
9
|
import { BlockchainList } from '../components/BlockchainList';
|
|
10
|
-
import { Layout } from '../components/Layout';
|
|
10
|
+
import { Layout, PageContainer } from '../components/Layout';
|
|
11
11
|
import { SearchInput } from '../components/SearchInput';
|
|
12
12
|
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
13
13
|
import { useAppStore } from '../store/AppStore';
|
|
@@ -39,45 +39,45 @@ export function SelectBlockchainPage(props: PropTypes) {
|
|
|
39
39
|
header={{
|
|
40
40
|
title: i18n.t(`Select Blockchain`),
|
|
41
41
|
}}>
|
|
42
|
-
<
|
|
42
|
+
<PageContainer view>
|
|
43
|
+
{showCategory && (
|
|
44
|
+
<>
|
|
45
|
+
<SelectableCategoryList
|
|
46
|
+
setCategory={setBlockchainCategory}
|
|
47
|
+
category={blockchainCategory}
|
|
48
|
+
blockchains={blockchains}
|
|
49
|
+
isLoading={fetchStatus === 'loading'}
|
|
50
|
+
/>
|
|
51
|
+
<Divider size={24} />
|
|
52
|
+
</>
|
|
53
|
+
)}
|
|
43
54
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
<SearchInput
|
|
56
|
+
value={searchedFor}
|
|
57
|
+
autoFocus
|
|
58
|
+
placeholder={i18n.t('Search Blockchain')}
|
|
59
|
+
color="light"
|
|
60
|
+
variant="contained"
|
|
61
|
+
size="large"
|
|
62
|
+
setValue={() => setSearchedFor('')}
|
|
63
|
+
onChange={(event) => setSearchedFor(event.target.value)}
|
|
64
|
+
/>
|
|
65
|
+
<Divider size={16} />
|
|
55
66
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
searchedFor={searchedFor}
|
|
71
|
-
blockchainCategory={blockchainCategory}
|
|
72
|
-
onChange={(blockchain) => {
|
|
73
|
-
if (type === 'source') {
|
|
74
|
-
setFromBlockchain(blockchain);
|
|
75
|
-
} else {
|
|
76
|
-
setToBlockchain(blockchain);
|
|
77
|
-
}
|
|
78
|
-
navigateBack();
|
|
79
|
-
}}
|
|
80
|
-
/>
|
|
67
|
+
<BlockchainList
|
|
68
|
+
list={blockchains}
|
|
69
|
+
searchedFor={searchedFor}
|
|
70
|
+
blockchainCategory={blockchainCategory}
|
|
71
|
+
onChange={(blockchain) => {
|
|
72
|
+
if (type === 'source') {
|
|
73
|
+
setFromBlockchain(blockchain);
|
|
74
|
+
} else {
|
|
75
|
+
setToBlockchain(blockchain);
|
|
76
|
+
}
|
|
77
|
+
navigateBack();
|
|
78
|
+
}}
|
|
79
|
+
/>
|
|
80
|
+
</PageContainer>
|
|
81
81
|
</Layout>
|
|
82
82
|
);
|
|
83
83
|
}
|
|
@@ -6,7 +6,7 @@ import React, { useState } from 'react';
|
|
|
6
6
|
import { useNavigate } from 'react-router-dom';
|
|
7
7
|
|
|
8
8
|
import { BlockchainsSection } from '../components/BlockchainsSection';
|
|
9
|
-
import { Layout } from '../components/Layout';
|
|
9
|
+
import { Layout, PageContainer } from '../components/Layout';
|
|
10
10
|
import { SearchInput } from '../components/SearchInput';
|
|
11
11
|
import { TokenList } from '../components/TokenList/TokenList';
|
|
12
12
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
@@ -78,45 +78,47 @@ export function SelectSwapItemsPage(props: PropTypes) {
|
|
|
78
78
|
header={{
|
|
79
79
|
title: i18n.t('Swap {type}', { type: types[type] }),
|
|
80
80
|
}}>
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
81
|
+
<PageContainer>
|
|
82
|
+
<BlockchainsSection
|
|
83
|
+
blockchains={blockchains}
|
|
84
|
+
type={type == 'source' ? 'from' : 'to'}
|
|
85
|
+
blockchain={type === 'source' ? fromBlockchain : toBlockchain}
|
|
86
|
+
onMoreClick={() => navigate(navigationRoutes.blockchains)}
|
|
87
|
+
onChange={(blockchain) => {
|
|
88
|
+
updateBlockchain(blockchain);
|
|
89
|
+
}}
|
|
90
|
+
/>
|
|
91
|
+
<Divider size={24} />
|
|
92
|
+
<SearchInput
|
|
93
|
+
value={searchedFor}
|
|
94
|
+
autoFocus
|
|
95
|
+
placeholder={i18n.t('Search Token')}
|
|
96
|
+
color="light"
|
|
97
|
+
variant="contained"
|
|
98
|
+
size="large"
|
|
99
|
+
setValue={() => setSearchedFor('')}
|
|
100
|
+
onChange={(event) => setSearchedFor(event.target.value)}
|
|
101
|
+
/>
|
|
102
|
+
<Divider size={16} />
|
|
103
|
+
<TokenList
|
|
104
|
+
list={tokensList}
|
|
105
|
+
selectedBlockchain={selectedBlockchainName}
|
|
106
|
+
searchedFor={searchedFor}
|
|
107
|
+
type={type}
|
|
108
|
+
onChange={(token) => {
|
|
109
|
+
updateToken(token);
|
|
109
110
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
const tokenBlockchain = blockchains.find(
|
|
112
|
+
(chain) => token.blockchain === chain.name
|
|
113
|
+
);
|
|
114
|
+
if (tokenBlockchain) {
|
|
115
|
+
updateBlockchain(tokenBlockchain);
|
|
116
|
+
}
|
|
116
117
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
navigateBack();
|
|
119
|
+
}}
|
|
120
|
+
/>
|
|
121
|
+
</PageContainer>
|
|
120
122
|
</Layout>
|
|
121
123
|
);
|
|
122
124
|
}
|
|
@@ -13,8 +13,7 @@ import {
|
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import { useNavigate } from 'react-router-dom';
|
|
15
15
|
|
|
16
|
-
import { Layout } from '../components/Layout';
|
|
17
|
-
import { SettingsContainer } from '../components/SettingsContainer';
|
|
16
|
+
import { Layout, PageContainer } from '../components/Layout';
|
|
18
17
|
import { Slippage } from '../components/Slippage';
|
|
19
18
|
import { SlippageTooltipContainer as TooltipContainer } from '../components/Slippage/Slippage.styles';
|
|
20
19
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
@@ -183,7 +182,7 @@ export function SettingsPage() {
|
|
|
183
182
|
header={{
|
|
184
183
|
title: i18n.t('Settings'),
|
|
185
184
|
}}>
|
|
186
|
-
<
|
|
185
|
+
<PageContainer>
|
|
187
186
|
<Slippage />
|
|
188
187
|
<List
|
|
189
188
|
type={
|
|
@@ -191,7 +190,7 @@ export function SettingsPage() {
|
|
|
191
190
|
}
|
|
192
191
|
items={settingItems}
|
|
193
192
|
/>
|
|
194
|
-
</
|
|
193
|
+
</PageContainer>
|
|
195
194
|
</Layout>
|
|
196
195
|
);
|
|
197
196
|
}
|
|
@@ -1,27 +1,41 @@
|
|
|
1
|
+
import { i18n } from '@lingui/core';
|
|
1
2
|
import { cancelSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
2
3
|
import { useManager } from '@rango-dev/queue-manager-react';
|
|
4
|
+
import { Alert } from '@rango-dev/ui';
|
|
3
5
|
import React from 'react';
|
|
6
|
+
import { useParams } from 'react-router-dom';
|
|
4
7
|
|
|
5
8
|
import { SwapDetails } from '../components/SwapDetails';
|
|
6
9
|
import { SwapDetailsPlaceholder } from '../components/SwapDetails/SwapDetails.Placeholder';
|
|
7
10
|
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
8
11
|
import { useAppStore } from '../store/AppStore';
|
|
9
|
-
import { useUiStore } from '../store/ui';
|
|
10
12
|
import { getPendingSwaps } from '../utils/queue';
|
|
11
13
|
|
|
12
14
|
export function SwapDetailsPage() {
|
|
13
15
|
const { manager, state } = useManager();
|
|
14
16
|
const loading = !state.loadedFromPersistor;
|
|
15
17
|
const pendingSwaps = getPendingSwaps(manager);
|
|
16
|
-
const requestId =
|
|
18
|
+
const { requestId } = useParams<{ requestId: string }>();
|
|
17
19
|
const navigateBack = useNavigateBack();
|
|
18
20
|
const { fetchStatus: fetchMetaStatus } = useAppStore();
|
|
19
21
|
|
|
22
|
+
if (!requestId) {
|
|
23
|
+
return (
|
|
24
|
+
<Alert
|
|
25
|
+
containerStyles={{ margin: '20px' }}
|
|
26
|
+
type="error"
|
|
27
|
+
title={i18n.t(
|
|
28
|
+
'The request ID is necessary to display the swap details.'
|
|
29
|
+
)}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
20
34
|
const showSkeleton = loading || fetchMetaStatus === 'loading';
|
|
21
35
|
|
|
22
|
-
const selectedSwap =
|
|
23
|
-
({ swap }) => swap.requestId === requestId
|
|
24
|
-
|
|
36
|
+
const selectedSwap = requestId
|
|
37
|
+
? pendingSwaps.find(({ swap }) => swap.requestId === requestId)
|
|
38
|
+
: undefined;
|
|
25
39
|
|
|
26
40
|
const onCancel = () => {
|
|
27
41
|
if (selectedSwap?.id) {
|
|
@@ -47,7 +61,7 @@ export function SwapDetailsPage() {
|
|
|
47
61
|
if (!swap || showSkeleton) {
|
|
48
62
|
return (
|
|
49
63
|
<SwapDetailsPlaceholder
|
|
50
|
-
requestId={requestId
|
|
64
|
+
requestId={requestId}
|
|
51
65
|
showSkeleton={showSkeleton}
|
|
52
66
|
/>
|
|
53
67
|
);
|
|
@@ -56,7 +70,7 @@ export function SwapDetailsPage() {
|
|
|
56
70
|
return (
|
|
57
71
|
<SwapDetails
|
|
58
72
|
swap={swap}
|
|
59
|
-
requestId={requestId
|
|
73
|
+
requestId={requestId}
|
|
60
74
|
onCancel={onCancel}
|
|
61
75
|
onDelete={onDelete}
|
|
62
76
|
/>
|
package/src/pages/ThemePage.tsx
CHANGED
|
@@ -11,8 +11,7 @@ import {
|
|
|
11
11
|
} from '@rango-dev/ui';
|
|
12
12
|
import React from 'react';
|
|
13
13
|
|
|
14
|
-
import { Layout } from '../components/Layout';
|
|
15
|
-
import { SettingsContainer } from '../components/SettingsContainer';
|
|
14
|
+
import { Layout, PageContainer } from '../components/Layout';
|
|
16
15
|
import { useAppStore } from '../store/AppStore';
|
|
17
16
|
|
|
18
17
|
type Theme = 'dark' | 'light' | 'auto';
|
|
@@ -70,7 +69,7 @@ export function ThemePage() {
|
|
|
70
69
|
header={{
|
|
71
70
|
title: i18n.t('Theme'),
|
|
72
71
|
}}>
|
|
73
|
-
<
|
|
72
|
+
<PageContainer>
|
|
74
73
|
<RadioRoot
|
|
75
74
|
onValueChange={(value) => setTheme(value as Theme)}
|
|
76
75
|
value={theme}>
|
|
@@ -85,7 +84,7 @@ export function ThemePage() {
|
|
|
85
84
|
items={themesList}
|
|
86
85
|
/>
|
|
87
86
|
</RadioRoot>
|
|
88
|
-
</
|
|
87
|
+
</PageContainer>
|
|
89
88
|
</Layout>
|
|
90
89
|
);
|
|
91
90
|
}
|
|
@@ -2,12 +2,13 @@ import type { WalletType } from '@rango-dev/wallets-shared';
|
|
|
2
2
|
|
|
3
3
|
import { i18n } from '@lingui/core';
|
|
4
4
|
import { styled, Typography, Wallet, WalletState } from '@rango-dev/ui';
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Layout } from '../components/Layout';
|
|
7
|
+
import { Layout, PageContainer } from '../components/Layout';
|
|
8
8
|
import { WalletModal } from '../components/WalletModal';
|
|
9
9
|
import { useWalletList } from '../hooks/useWalletList';
|
|
10
10
|
import { useAppStore } from '../store/AppStore';
|
|
11
|
+
import { useUiStore } from '../store/ui';
|
|
11
12
|
import { getContainer } from '../utils/common';
|
|
12
13
|
|
|
13
14
|
const ListContainer = styled('div', {
|
|
@@ -20,7 +21,7 @@ const ListContainer = styled('div', {
|
|
|
20
21
|
height: '100%',
|
|
21
22
|
});
|
|
22
23
|
|
|
23
|
-
const Container = styled(
|
|
24
|
+
const Container = styled(PageContainer, {
|
|
24
25
|
textAlign: 'center',
|
|
25
26
|
});
|
|
26
27
|
|
|
@@ -32,6 +33,7 @@ export function WalletsPage() {
|
|
|
32
33
|
const [openModal, setOpenModal] = useState(false);
|
|
33
34
|
const [selectedWalletType, setSelectedWalletType] = useState<WalletType>('');
|
|
34
35
|
let modalTimerId: ReturnType<typeof setTimeout> | null = null;
|
|
36
|
+
const isActiveTab = useUiStore.use.isActiveTab();
|
|
35
37
|
|
|
36
38
|
const { list, handleClick, error } = useWalletList({
|
|
37
39
|
config,
|
|
@@ -71,16 +73,16 @@ export function WalletsPage() {
|
|
|
71
73
|
{list.map((wallet, index) => {
|
|
72
74
|
const key = `wallet-${index}-${wallet.type}`;
|
|
73
75
|
return (
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
76
|
+
<Wallet
|
|
77
|
+
key={key}
|
|
78
|
+
{...wallet}
|
|
79
|
+
container={getContainer()}
|
|
80
|
+
onClick={(type) => {
|
|
81
|
+
void handleClick(type);
|
|
82
|
+
}}
|
|
83
|
+
isLoading={fetchMetaStatus === 'loading'}
|
|
84
|
+
disabled={!isActiveTab}
|
|
85
|
+
/>
|
|
84
86
|
);
|
|
85
87
|
})}
|
|
86
88
|
<WalletModal
|
|
@@ -15,7 +15,7 @@ export type ThemeMode = 'auto' | 'dark' | 'light';
|
|
|
15
15
|
|
|
16
16
|
export interface SettingsSlice {
|
|
17
17
|
theme: ThemeMode;
|
|
18
|
-
language: Language;
|
|
18
|
+
language: Language | null;
|
|
19
19
|
disabledLiquiditySources: string[];
|
|
20
20
|
/** Keeping a history of blockchains that user has selected (in Swap process) */
|
|
21
21
|
preferredBlockchains: string[];
|
|
@@ -31,7 +31,7 @@ export interface SettingsSlice {
|
|
|
31
31
|
toggleInfiniteApprove: () => void;
|
|
32
32
|
toggleLiquiditySource: (name: string) => void;
|
|
33
33
|
setTheme: (theme: ThemeMode) => void;
|
|
34
|
-
setLanguage: (language: Language) => void;
|
|
34
|
+
setLanguage: (language: Language | null) => void;
|
|
35
35
|
toggleAllLiquiditySources: (
|
|
36
36
|
swappers: SwapperMeta[],
|
|
37
37
|
shouldReset?: boolean
|
|
@@ -53,7 +53,7 @@ export const createSettingsSlice: StateCreator<
|
|
|
53
53
|
> = (set, get) => ({
|
|
54
54
|
disabledLiquiditySources: [],
|
|
55
55
|
theme: 'auto',
|
|
56
|
-
language:
|
|
56
|
+
language: null,
|
|
57
57
|
preferredBlockchains: [],
|
|
58
58
|
slippage: DEFAULT_SLIPPAGE,
|
|
59
59
|
customSlippage: null,
|
package/src/store/ui.ts
CHANGED
|
@@ -1,21 +1,49 @@
|
|
|
1
|
+
import type { TabManagerInterface } from '../libs/tabManager';
|
|
2
|
+
|
|
1
3
|
import { create } from 'zustand';
|
|
2
4
|
|
|
5
|
+
import { TabManager } from '../libs/tabManager';
|
|
6
|
+
|
|
3
7
|
import createSelectors from './selectors';
|
|
4
8
|
|
|
5
9
|
interface UiState {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
isActiveTab: boolean;
|
|
11
|
+
tabManagerInitiated: boolean;
|
|
12
|
+
showActivateTabModal: boolean;
|
|
13
|
+
activateCurrentTab: (
|
|
14
|
+
setCurrentTabAsActive: () => void,
|
|
15
|
+
hasRunningSwaps: boolean
|
|
16
|
+
) => void;
|
|
17
|
+
setShowActivateTabModal: (flag: boolean) => void;
|
|
11
18
|
}
|
|
12
19
|
|
|
13
20
|
export const useUiStore = createSelectors(
|
|
14
|
-
create<UiState>()((set) => ({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
create<UiState>()((set, get) => ({
|
|
22
|
+
isActiveTab: false,
|
|
23
|
+
tabManagerInitiated: false,
|
|
24
|
+
showActivateTabModal: false,
|
|
25
|
+
activateCurrentTab: (setCurrentTabAsActive, hasRunningSwaps) => {
|
|
26
|
+
const { showActivateTabModal } = get();
|
|
27
|
+
|
|
28
|
+
if (!showActivateTabModal && hasRunningSwaps) {
|
|
29
|
+
set({ showActivateTabModal: true });
|
|
30
|
+
} else if (showActivateTabModal || !hasRunningSwaps) {
|
|
31
|
+
setCurrentTabAsActive();
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
setShowActivateTabModal: (flag) => {
|
|
35
|
+
set({ showActivateTabModal: flag });
|
|
36
|
+
},
|
|
20
37
|
}))
|
|
21
38
|
);
|
|
39
|
+
|
|
40
|
+
const tabManager: TabManagerInterface = new TabManager({
|
|
41
|
+
onInit: () => useUiStore.setState({ tabManagerInitiated: true }),
|
|
42
|
+
onClaim: () =>
|
|
43
|
+
useUiStore.setState({ isActiveTab: true, showActivateTabModal: false }),
|
|
44
|
+
onRelease: () => useUiStore.setState({ isActiveTab: false }),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const setCurrentTabAsActive = tabManager.forceClaim;
|
|
48
|
+
|
|
49
|
+
export const destroyTabManager = tabManager.destroy;
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
type RouteEvent,
|
|
4
4
|
type Step,
|
|
5
5
|
type StepEvent,
|
|
6
|
-
StepExecutionBlockedEventStatus,
|
|
7
6
|
} from '@rango-dev/queue-manager-rango-preset';
|
|
8
7
|
|
|
9
8
|
type NotificationRoute = {
|
|
@@ -25,9 +24,3 @@ export type Notification = Pick<Route, 'requestId'> & {
|
|
|
25
24
|
read: boolean;
|
|
26
25
|
route: NotificationRoute;
|
|
27
26
|
};
|
|
28
|
-
|
|
29
|
-
export const validBlockedStatuses: StepExecutionBlockedEventStatus[] = [
|
|
30
|
-
StepExecutionBlockedEventStatus.WAITING_FOR_CHANGE_WALLET_ACCOUNT,
|
|
31
|
-
StepExecutionBlockedEventStatus.WAITING_FOR_NETWORK_CHANGE,
|
|
32
|
-
StepExecutionBlockedEventStatus.WAITING_FOR_WALLET_CONNECT,
|
|
33
|
-
];
|
package/src/utils/quote.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
2
|
import type { QuoteError, QuoteWarning, Wallet } from '../types';
|
|
3
|
-
import type { PriceImpactWarningLevel } from '@rango-dev/ui';
|
|
3
|
+
import type { PriceImpactWarningLevel, Step } from '@rango-dev/ui';
|
|
4
4
|
import type {
|
|
5
5
|
SimulationAssetAndAmount,
|
|
6
6
|
SimulationValidationStatus,
|
|
@@ -35,33 +35,6 @@ import {
|
|
|
35
35
|
hasProperSlippage,
|
|
36
36
|
} from './swap';
|
|
37
37
|
|
|
38
|
-
export function searchParamsToToken(
|
|
39
|
-
tokens: Token[],
|
|
40
|
-
searchParams: string | null,
|
|
41
|
-
chain: BlockchainMeta | null
|
|
42
|
-
): Token | null {
|
|
43
|
-
if (!chain) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
return (
|
|
47
|
-
tokens.find((token) => {
|
|
48
|
-
const symbolAndAddress = searchParams?.split('--');
|
|
49
|
-
if (symbolAndAddress?.length === 1) {
|
|
50
|
-
return (
|
|
51
|
-
token.symbol === symbolAndAddress[0] &&
|
|
52
|
-
token.address === null &&
|
|
53
|
-
token.blockchain === chain.name
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
return (
|
|
57
|
-
token.symbol === symbolAndAddress?.[0] &&
|
|
58
|
-
token.address === symbolAndAddress?.[1] &&
|
|
59
|
-
token.blockchain === chain.name
|
|
60
|
-
);
|
|
61
|
-
}) || null
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
38
|
export function getQuoteToTokenUsdPrice(
|
|
66
39
|
quote: BestRouteResponse | null
|
|
67
40
|
): number | null | undefined {
|
|
@@ -336,3 +309,20 @@ export function getPriceImpact(
|
|
|
336
309
|
|
|
337
310
|
return percentageChange && percentageChange < 0 ? percentageChange : null;
|
|
338
311
|
}
|
|
312
|
+
|
|
313
|
+
export const getUniqueBlockchains = (steps: Step[]) => {
|
|
314
|
+
const set = new Set();
|
|
315
|
+
const result: { displayName: string; image: string }[] = [];
|
|
316
|
+
steps.forEach((step) => {
|
|
317
|
+
if (!set.has(step.from.chain.displayName)) {
|
|
318
|
+
set.add(step.from.chain.displayName);
|
|
319
|
+
result.push(step.from.chain);
|
|
320
|
+
}
|
|
321
|
+
if (!set.has(step.to.chain.displayName)) {
|
|
322
|
+
set.add(step.to.chain.displayName);
|
|
323
|
+
result.push(step.to.chain);
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
return result;
|
|
328
|
+
};
|
package/src/utils/swap.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
+
import type { FeesGroup, NameOfFees } from '../constants/quote';
|
|
2
3
|
import type { FetchStatus } from '../store/slices/data';
|
|
3
4
|
import type {
|
|
4
5
|
ConvertedToken,
|
|
@@ -14,6 +15,7 @@ import type {
|
|
|
14
15
|
BestRouteResponse,
|
|
15
16
|
BlockchainMeta,
|
|
16
17
|
RecommendedSlippage,
|
|
18
|
+
SwapFee,
|
|
17
19
|
SwapResult,
|
|
18
20
|
Token,
|
|
19
21
|
} from 'rango-sdk';
|
|
@@ -328,6 +330,39 @@ export function getTotalFeeInUsd(
|
|
|
328
330
|
);
|
|
329
331
|
}
|
|
330
332
|
|
|
333
|
+
export function getUsdFee(fee: SwapFee): BigNumber {
|
|
334
|
+
let totalFeeInUsd = ZERO;
|
|
335
|
+
totalFeeInUsd = totalFeeInUsd.plus(
|
|
336
|
+
new BigNumber(fee.amount).multipliedBy(fee.price || 0)
|
|
337
|
+
);
|
|
338
|
+
|
|
339
|
+
return totalFeeInUsd;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export function getTotalFeesInUsd(fees: SwapFee[]): BigNumber {
|
|
343
|
+
return fees.reduce(
|
|
344
|
+
(totalFee: BigNumber, fee) => totalFee.plus(getUsdFee(fee)),
|
|
345
|
+
ZERO
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
export function getFeesGroup(swaps: SwapResult[]): FeesGroup {
|
|
349
|
+
return swaps.reduce(
|
|
350
|
+
(result, swap) => {
|
|
351
|
+
for (const fee of swap.fee) {
|
|
352
|
+
const name = fee.name as NameOfFees;
|
|
353
|
+
const feeGroup =
|
|
354
|
+
fee.expenseType !== 'DECREASE_FROM_OUTPUT'
|
|
355
|
+
? result.payable
|
|
356
|
+
: result.nonePayable;
|
|
357
|
+
|
|
358
|
+
feeGroup[name] = [...(feeGroup[name] || []), fee];
|
|
359
|
+
}
|
|
360
|
+
return result;
|
|
361
|
+
},
|
|
362
|
+
{ payable: {}, nonePayable: {} } as FeesGroup
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
|
|
331
366
|
export function hasHighFee(totalFeeInUsd: BigNumber | null) {
|
|
332
367
|
if (!totalFeeInUsd) {
|
|
333
368
|
return false;
|
package/src/utils/ui.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
2
|
import type { WidgetTheme } from '../types';
|
|
3
3
|
import type { createTheme } from '@rango-dev/ui';
|
|
4
|
+
import type React from 'react';
|
|
4
5
|
|
|
5
6
|
import {
|
|
6
7
|
theme as baseThemeTokens,
|
|
@@ -70,3 +71,22 @@ export function customizedThemeTokens(
|
|
|
70
71
|
dark,
|
|
71
72
|
};
|
|
72
73
|
}
|
|
74
|
+
|
|
75
|
+
export function joinList(
|
|
76
|
+
list: React.JSX.Element[],
|
|
77
|
+
divider: React.JSX.Element
|
|
78
|
+
) {
|
|
79
|
+
if (list.length <= 1) {
|
|
80
|
+
return list;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const output: React.JSX.Element[] = [];
|
|
84
|
+
list.forEach((item, index) => {
|
|
85
|
+
output.push(item);
|
|
86
|
+
if (index < list.length - 1) {
|
|
87
|
+
output.push(divider);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return output;
|
|
92
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateUrl.d.ts","sourceRoot":"","sources":["../../src/components/UpdateUrl.tsx"],"names":[],"mappings":"AAcA,wBAAgB,SAAS,SA+IxB"}
|