@lifi/widget 1.10.2 → 1.11.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/App.js +6 -10
- package/AppDrawer.js +1 -1
- package/AppDrawer.style.d.ts +1 -1
- package/AppDrawer.style.js +0 -1
- package/AppProvider.d.ts +1 -0
- package/AppProvider.js +5 -2
- package/components/AppContainer.d.ts +10 -0
- package/components/AppContainer.js +4 -7
- package/components/Card/Card.d.ts +11 -5
- package/components/Card/Card.js +29 -5
- package/components/Card/index.d.ts +0 -1
- package/components/Card/index.js +0 -1
- package/components/Dialog.d.ts +3 -0
- package/components/Dialog.js +23 -0
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.d.ts +6 -0
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +48 -0
- package/components/{InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.style.d.ts → GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts} +0 -0
- package/components/{InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.style.js → GasSufficiencyMessage/GasSufficiencyMessage.style.js} +1 -0
- package/components/GasSufficiencyMessage/index.d.ts +1 -0
- package/components/GasSufficiencyMessage/index.js +1 -0
- package/components/Header/Header.js +5 -6
- package/components/Header/Header.style.js +2 -1
- package/components/Header/NavigationHeader.js +27 -23
- package/components/Header/WalletHeader.js +4 -4
- package/components/Header/index.d.ts +1 -0
- package/components/Header/index.js +1 -0
- package/components/Header/types.d.ts +9 -0
- package/components/Header/types.js +1 -0
- package/components/Header/useHeaderActionStore.d.ts +6 -0
- package/components/Header/useHeaderActionStore.js +21 -0
- package/components/PoweredBy/PoweredBy.js +0 -1
- package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +14 -2
- package/components/ReverseTokensButton/ReverseTokensButton.js +5 -7
- package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/components/ReverseTokensButton/ReverseTokensButton.style.js +4 -2
- package/components/SelectTokenButton/SelectTokenButton.js +9 -7
- package/components/SelectTokenButton/SelectTokenButton.style.d.ts +3 -10
- package/components/SelectTokenButton/SelectTokenButton.style.js +0 -7
- package/components/SmallAvatar.d.ts +16 -0
- package/components/SmallAvatar.js +8 -0
- package/{pages/SwapPage → components/Step}/CircularProgress.d.ts +0 -0
- package/{pages/SwapPage → components/Step}/CircularProgress.js +0 -0
- package/{pages/SwapPage → components/Step}/CircularProgress.style.d.ts +0 -0
- package/{pages/SwapPage → components/Step}/CircularProgress.style.js +0 -0
- package/components/Step/Step.d.ts +7 -0
- package/{pages/SwapPage/StepItem.js → components/Step/Step.js} +6 -6
- package/{pages/SwapPage/ExecutionItem.d.ts → components/Step/StepProcess.d.ts} +1 -1
- package/{pages/SwapPage/ExecutionItem.js → components/Step/StepProcess.js} +2 -2
- package/{pages/SwapPage/ExecutionItem.style.d.ts → components/Step/StepProcess.style.d.ts} +1 -1
- package/{pages/SwapPage/ExecutionItem.style.js → components/Step/StepProcess.style.js} +0 -0
- package/{pages/SwapPage → components/Step}/StepTimer.d.ts +0 -0
- package/{pages/SwapPage → components/Step}/StepTimer.js +0 -0
- package/components/Step/index.d.ts +1 -0
- package/components/Step/index.js +1 -0
- package/components/Step/utils.d.ts +6 -0
- package/components/Step/utils.js +89 -0
- package/components/StepActions/StepActions.js +17 -7
- package/components/StepActions/StepActions.style.js +2 -2
- package/{pages/SwapPage → components/StepDivider}/StepDivider.d.ts +0 -0
- package/{pages/SwapPage → components/StepDivider}/StepDivider.js +0 -0
- package/{pages/SwapPage → components/StepDivider}/StepDivider.style.d.ts +0 -0
- package/{pages/SwapPage → components/StepDivider}/StepDivider.style.js +0 -0
- package/components/StepDivider/index.d.ts +1 -0
- package/components/StepDivider/index.js +1 -0
- package/components/SwapButton/SwapButton.js +9 -12
- package/components/SwapButton/SwapButton.style.d.ts +1 -1
- package/components/SwapButton/SwapButton.style.js +1 -5
- package/components/SwapButton/types.d.ts +2 -0
- package/components/SwapInProgress/SwapInProgress.js +9 -6
- package/components/SwapInProgress/SwapInProgress.style.d.ts +9 -21
- package/components/SwapInProgress/SwapInProgress.style.js +5 -6
- package/components/SwapInput/FormPriceHelperText.js +1 -1
- package/components/SwapInput/SwapInput.js +4 -5
- package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/components/SwapInput/SwapInputAdornment.style.js +0 -2
- package/components/SwapRouteCard/SwapRouteCard.js +15 -15
- package/components/SwapRouteCard/SwapRouteCard.style.d.ts +0 -20
- package/components/SwapRouteCard/SwapRouteCard.style.js +7 -54
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +6 -10
- package/components/SwapRouteCard/SwapRouteNotFoundCard.js +3 -3
- package/components/SwapRouteCard/types.d.ts +0 -3
- package/components/{StepToken.d.ts → Token/Token.d.ts} +2 -1
- package/components/Token/Token.js +31 -0
- package/components/Token/Token.style.d.ts +24 -0
- package/components/Token/Token.style.js +31 -0
- package/components/Token/index.d.ts +2 -0
- package/components/Token/index.js +2 -0
- package/components/TokenAvatar/TokenAvatar.d.ts +7 -0
- package/components/TokenAvatar/TokenAvatar.js +8 -0
- package/components/TokenAvatar/TokenAvatar.style.d.ts +1 -0
- package/components/TokenAvatar/TokenAvatar.style.js +16 -0
- package/components/TokenAvatar/index.d.ts +2 -0
- package/components/TokenAvatar/index.js +2 -0
- package/components/TokenList/TokenList.js +2 -2
- package/components/TokenList/TokenList.style.js +1 -1
- package/components/TokenList/TokenListItem.d.ts +1 -0
- package/components/TokenList/TokenListItem.js +13 -7
- package/components/TokenList/types.d.ts +1 -0
- package/config/queryClient.d.ts +1 -1
- package/config/queryClient.js +1 -1
- package/config/sentry.js +1 -1
- package/config/theme.js +14 -1
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/index.d.ts +1 -1
- package/hooks/index.js +1 -1
- package/hooks/useChains.d.ts +8 -8
- package/hooks/useChains.js +1 -1
- package/hooks/useContentHeight.js +1 -1
- package/hooks/useGasSufficiency.d.ts +15 -0
- package/hooks/useGasSufficiency.js +91 -0
- package/hooks/useRouteExecution.d.ts +3 -3
- package/hooks/useRouteExecution.js +23 -19
- package/hooks/useScrollableContainer.js +1 -1
- package/hooks/useSwapRoutes.d.ts +1 -1
- package/hooks/useSwapRoutes.js +2 -14
- package/hooks/useTelemetry.js +11 -3
- package/hooks/useTokenBalance.js +5 -5
- package/hooks/useTokenBalances.d.ts +2 -2
- package/hooks/useTokenBalances.js +8 -10
- package/hooks/useTokens.js +1 -1
- package/hooks/useTools.d.ts +10 -1
- package/hooks/useTools.js +13 -3
- package/i18n/en/translation.json +18 -9
- package/i18n/index.d.ts +12 -3
- package/icons/LiFiToolLogo.svg +6 -0
- package/index.js +0 -2
- package/package.json +9 -9
- package/pages/MainPage/MainPage.js +2 -3
- package/pages/MainPage/MainSwapButton.js +6 -7
- package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.d.ts +0 -0
- package/pages/MainPage/SwapRoutes.js +36 -0
- package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.style.d.ts +0 -0
- package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.style.js +4 -0
- package/pages/SelectTokenPage/ChainSelect.js +2 -2
- package/pages/SelectTokenPage/SearchTokenInput.js +2 -2
- package/pages/SelectWalletPage/SelectWalletPage.js +4 -23
- package/pages/SelectWalletPage/SelectWalletPage.style.js +1 -1
- package/pages/SettingsPage/AdvancedPreferences.js +1 -1
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/pages/SettingsPage/EnabledBridgesSelect.js +7 -4
- package/pages/SettingsPage/EnabledExchangesSelect.js +7 -4
- package/pages/SettingsPage/GasPriceSelect.js +2 -2
- package/pages/SettingsPage/RoutePrioritySelect.js +2 -2
- package/pages/SettingsPage/SlippageInput.js +3 -3
- package/pages/SwapDetailsPage/SwapDetailsPage.d.ts +2 -0
- package/pages/SwapDetailsPage/SwapDetailsPage.js +63 -0
- package/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +11 -0
- package/pages/SwapDetailsPage/SwapDetailsPage.style.js +5 -0
- package/pages/SwapDetailsPage/index.d.ts +1 -0
- package/pages/SwapDetailsPage/index.js +1 -0
- package/pages/SwapHistoryPage/SwapHistoryEmpty.d.ts +2 -0
- package/pages/SwapHistoryPage/SwapHistoryEmpty.js +14 -0
- package/pages/SwapHistoryPage/SwapHistoryItem.d.ts +5 -0
- package/pages/SwapHistoryPage/SwapHistoryItem.js +23 -0
- package/pages/SwapHistoryPage/SwapHistoryPage.d.ts +2 -0
- package/pages/SwapHistoryPage/SwapHistoryPage.js +14 -0
- package/pages/SwapHistoryPage/index.d.ts +1 -0
- package/pages/SwapHistoryPage/index.js +1 -0
- package/pages/SwapPage/StatusBottomSheet.js +4 -4
- package/pages/SwapPage/SwapPage.js +13 -10
- package/pages/SwapPage/SwapPage.style.d.ts +0 -33
- package/pages/SwapPage/SwapPage.style.js +2 -9
- package/pages/SwapPage/utils.js +1 -1
- package/pages/SwapRoutesPage/SwapRoutesPage.js +14 -7
- package/pages/SwapRoutesPage/SwapRoutesPage.style.js +1 -1
- package/providers/WalletProvider/WalletProvider.js +7 -26
- package/providers/WalletProvider/types.d.ts +0 -1
- package/providers/WidgetProvider/WidgetProvider.js +1 -1
- package/stores/route/index.d.ts +1 -1
- package/stores/route/index.js +1 -1
- package/stores/route/types.d.ts +2 -4
- package/stores/route/useExecutingRoutes.d.ts +2 -1
- package/stores/route/useExecutingRoutes.js +4 -2
- package/stores/route/useRouteStore.d.ts +4 -1
- package/stores/route/useRouteStore.js +23 -24
- package/stores/route/useSwapHistory.d.ts +2 -0
- package/stores/route/useSwapHistory.js +11 -0
- package/stores/settings/useSettingsStore.d.ts +13 -0
- package/types/widget.d.ts +3 -4
- package/utils/index.d.ts +6 -0
- package/utils/index.js +6 -0
- package/utils/navigationRoutes.d.ts +13 -0
- package/utils/navigationRoutes.js +12 -0
- package/components/Card/CardContainer.d.ts +0 -11
- package/components/Card/CardContainer.js +0 -16
- package/components/InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.d.ts +0 -3
- package/components/InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.js +0 -31
- package/components/InsufficientGasOrFundsMessage/index.d.ts +0 -1
- package/components/InsufficientGasOrFundsMessage/index.js +0 -1
- package/components/StepToken.js +0 -21
- package/components/SwapRoutes/SwapRoutes.js +0 -32
- package/components/SwapRoutes/SwapRoutesUpdateProgress.d.ts +0 -3
- package/components/SwapRoutes/SwapRoutesUpdateProgress.js +0 -24
- package/components/SwapRoutes/index.d.ts +0 -1
- package/components/SwapRoutes/index.js +0 -1
- package/hooks/useHasSufficientBalance.d.ts +0 -5
- package/hooks/useHasSufficientBalance.js +0 -72
- package/pages/SwapPage/StepItem.d.ts +0 -7
- package/stores/route/useCurrentRoute.d.ts +0 -2
- package/stores/route/useCurrentRoute.js +0 -5
- package/utils/routes.d.ts +0 -11
- package/utils/routes.js +0 -10
package/hooks/useTools.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
3
|
import { LiFi } from '../config/lifi';
|
|
4
4
|
import { useSettingsStore } from '../stores';
|
|
5
5
|
export const useTools = () => {
|
|
@@ -10,5 +10,15 @@ export const useTools = () => {
|
|
|
10
10
|
initializeTools('Exchanges', data.exchanges.map((exchange) => exchange.key));
|
|
11
11
|
},
|
|
12
12
|
});
|
|
13
|
-
|
|
13
|
+
const formattedTools = useMemo(() => ({
|
|
14
|
+
bridges: data === null || data === void 0 ? void 0 : data.bridges.reduce((bridges, bridge) => {
|
|
15
|
+
bridges[bridge.key] = bridge;
|
|
16
|
+
return bridges;
|
|
17
|
+
}, {}),
|
|
18
|
+
exchanges: data === null || data === void 0 ? void 0 : data.exchanges.reduce((exchanges, exchange) => {
|
|
19
|
+
exchanges[exchange.key] = exchange;
|
|
20
|
+
return exchanges;
|
|
21
|
+
}, {}),
|
|
22
|
+
}), [data === null || data === void 0 ? void 0 : data.bridges, data === null || data === void 0 ? void 0 : data.exchanges]);
|
|
23
|
+
return { tools: data, formattedTools };
|
|
14
24
|
};
|
package/i18n/en/translation.json
CHANGED
|
@@ -7,13 +7,15 @@
|
|
|
7
7
|
"from": "Swap from",
|
|
8
8
|
"to": "Swap to",
|
|
9
9
|
"settings": "Settings",
|
|
10
|
-
"routes": "You get"
|
|
10
|
+
"routes": "You get",
|
|
11
|
+
"swapHistory": "Swap history",
|
|
12
|
+
"swapDetails": "Swap details"
|
|
11
13
|
},
|
|
12
14
|
"button": {
|
|
13
|
-
"swap": "Swap",
|
|
14
15
|
"connectWallet": "Connect wallet",
|
|
15
16
|
"switchChain": "Switch chain",
|
|
16
|
-
"
|
|
17
|
+
"reviewSwap": "Review swap",
|
|
18
|
+
"startSwap": "Start swap",
|
|
17
19
|
"restartSwap": "Restart swap",
|
|
18
20
|
"removeSwap": "Remove swap",
|
|
19
21
|
"done": "Done",
|
|
@@ -24,8 +26,11 @@
|
|
|
24
26
|
"dark": "Dark",
|
|
25
27
|
"auto": "Auto",
|
|
26
28
|
"ok": "Ok",
|
|
29
|
+
"cancel": "Cancel",
|
|
30
|
+
"delete": "Delete",
|
|
27
31
|
"hide": "Hide",
|
|
28
32
|
"max": "max",
|
|
33
|
+
"contactSupport": "Contact support",
|
|
29
34
|
"lifiSwap": "LI.FI Swap"
|
|
30
35
|
},
|
|
31
36
|
"swap": {
|
|
@@ -51,8 +56,11 @@
|
|
|
51
56
|
"stepSwapAndBridge": "Swap and bridge",
|
|
52
57
|
"estimatedTime": "~{{value}} min.",
|
|
53
58
|
"networkIsBusy": "Network is busy...",
|
|
54
|
-
"crossStepDetails": "Bridge {{from}} to {{to}} via {{tool}}",
|
|
59
|
+
"crossStepDetails": "Bridge from {{from}} to {{to}} via {{tool}}",
|
|
55
60
|
"swapStepDetails": "Swap on {{chain}} via {{tool}}",
|
|
61
|
+
"tokenOnChain": "{{tokenSymbol}} on {{chainName}}",
|
|
62
|
+
"tokenOnChainAmount": "{{amount}} {{tokenSymbol}} on {{chainName}}",
|
|
63
|
+
"routeId": "Route ID",
|
|
56
64
|
"tags": {
|
|
57
65
|
"recommended": "Recommended",
|
|
58
66
|
"fastest": "Fast",
|
|
@@ -73,17 +81,18 @@
|
|
|
73
81
|
"routeNotFound": "No routes available"
|
|
74
82
|
},
|
|
75
83
|
"message": {
|
|
76
|
-
"routeNotFound": "Try another
|
|
84
|
+
"routeNotFound": "Try another token combination."
|
|
77
85
|
}
|
|
78
86
|
},
|
|
79
87
|
"warning": {
|
|
80
88
|
"title": {
|
|
81
|
-
"insufficientGas": "Insufficient gas"
|
|
89
|
+
"insufficientGas": "Insufficient gas",
|
|
90
|
+
"deleteSwap": "Delete this swap?"
|
|
82
91
|
},
|
|
83
92
|
"message": {
|
|
84
|
-
"insufficientFunds": "You don't have enough funds
|
|
85
|
-
"
|
|
86
|
-
"
|
|
93
|
+
"insufficientFunds": "You don't have enough funds to execute the swap.",
|
|
94
|
+
"insufficientGas": "You need to add at least:",
|
|
95
|
+
"deleteSwap": "Swap history is only stored locally and can't be recovered if you delete it."
|
|
87
96
|
}
|
|
88
97
|
},
|
|
89
98
|
"error": {
|
package/i18n/index.d.ts
CHANGED
|
@@ -11,11 +11,13 @@ export declare const resources: {
|
|
|
11
11
|
to: string;
|
|
12
12
|
settings: string;
|
|
13
13
|
routes: string;
|
|
14
|
+
swapHistory: string;
|
|
15
|
+
swapDetails: string;
|
|
14
16
|
};
|
|
15
17
|
button: {
|
|
16
|
-
swap: string;
|
|
17
18
|
connectWallet: string;
|
|
18
19
|
switchChain: string;
|
|
20
|
+
reviewSwap: string;
|
|
19
21
|
startSwap: string;
|
|
20
22
|
restartSwap: string;
|
|
21
23
|
removeSwap: string;
|
|
@@ -27,8 +29,11 @@ export declare const resources: {
|
|
|
27
29
|
dark: string;
|
|
28
30
|
auto: string;
|
|
29
31
|
ok: string;
|
|
32
|
+
cancel: string;
|
|
33
|
+
delete: string;
|
|
30
34
|
hide: string;
|
|
31
35
|
max: string;
|
|
36
|
+
contactSupport: string;
|
|
32
37
|
lifiSwap: string;
|
|
33
38
|
};
|
|
34
39
|
swap: {
|
|
@@ -56,6 +61,9 @@ export declare const resources: {
|
|
|
56
61
|
networkIsBusy: string;
|
|
57
62
|
crossStepDetails: string;
|
|
58
63
|
swapStepDetails: string;
|
|
64
|
+
tokenOnChain: string;
|
|
65
|
+
tokenOnChainAmount: string;
|
|
66
|
+
routeId: string;
|
|
59
67
|
tags: {
|
|
60
68
|
recommended: string;
|
|
61
69
|
fastest: string;
|
|
@@ -82,11 +90,12 @@ export declare const resources: {
|
|
|
82
90
|
warning: {
|
|
83
91
|
title: {
|
|
84
92
|
insufficientGas: string;
|
|
93
|
+
deleteSwap: string;
|
|
85
94
|
};
|
|
86
95
|
message: {
|
|
87
96
|
insufficientFunds: string;
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
insufficientGas: string;
|
|
98
|
+
deleteSwap: string;
|
|
90
99
|
};
|
|
91
100
|
};
|
|
92
101
|
error: {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg width="32" height="32" viewBox="0 0 32 32" fill="none"
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<circle cx="16" cy="16" r="16" fill="#F5B5FF"/>
|
|
4
|
+
<path d="M15.5031 19.2031L10.1691 20.4379C9.97453 20.4867 9.82861 20.6816 9.82861 20.8766V24.5486C9.82861 24.8573 10.0718 25.0523 10.3798 24.9873L17.8215 23.265C18.1296 23.2 18.2593 22.9076 18.1296 22.6314L16.7839 19.853C16.5731 19.4143 16.7839 18.9594 17.2541 18.8619L22.1179 17.692C22.4584 17.6108 22.7502 17.2534 22.7502 16.8959V13.5001C22.7502 13.1914 22.507 12.9802 22.199 13.0614L15.1788 14.735C14.7411 14.8324 14.5465 15.2549 14.7411 15.6611L15.9733 18.212C16.184 18.6507 15.9733 19.0893 15.5031 19.2031Z" fill="black"/>
|
|
5
|
+
<path d="M11.985 10.0233L13.3793 12.8829C13.5577 13.2566 13.3793 13.6466 12.974 13.7278L10.3962 14.329C10.0719 14.4102 9.8125 14.7352 9.8125 15.0601V18.1309C9.8125 18.6509 10.234 18.9758 10.7366 18.8621L13.1361 18.3097C13.4604 18.2447 13.7198 17.9035 13.7198 17.5785L13.736 14.4265C13.736 13.9878 14.0927 13.5491 14.5142 13.4516L22.3774 11.5669C22.572 11.5181 22.7179 11.3231 22.7179 11.1282V7.45618C22.7179 7.14747 22.4747 6.93625 22.1666 7.01749L12.2931 9.38966C11.985 9.45465 11.8553 9.74711 11.985 10.0233Z" fill="black"/>
|
|
6
|
+
</svg>
|
package/index.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { App } from './App';
|
|
2
2
|
import { AppDrawer } from './AppDrawer';
|
|
3
|
-
import { initSentry } from './config/sentry';
|
|
4
3
|
import './fonts/inter.css';
|
|
5
4
|
import { configureReactI18next } from './i18n';
|
|
6
5
|
export * from './types';
|
|
7
|
-
initSentry(true);
|
|
8
6
|
configureReactI18next();
|
|
9
7
|
// ClassNameGenerator.configure((componentName) => componentName.replace('Mui', ''));
|
|
10
8
|
export const LiFiWidget = App;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./index.js",
|
|
@@ -42,13 +42,14 @@
|
|
|
42
42
|
"@ethersproject/experimental": "^5.6.3",
|
|
43
43
|
"@ethersproject/providers": "^5.6.8",
|
|
44
44
|
"@lifi/sdk": "^1.0.2",
|
|
45
|
-
"@lifi/wallet-management": "^1.1.
|
|
45
|
+
"@lifi/wallet-management": "^1.1.2",
|
|
46
46
|
"@mui/icons-material": "^5.8.4",
|
|
47
|
-
"@mui/lab": "^5.0.0-alpha.
|
|
48
|
-
"@mui/material": "^5.9.
|
|
49
|
-
"@sentry/integrations": "^7.
|
|
50
|
-
"@sentry/react": "^7.
|
|
51
|
-
"@sentry/tracing": "^7.
|
|
47
|
+
"@mui/lab": "^5.0.0-alpha.92",
|
|
48
|
+
"@mui/material": "^5.9.2",
|
|
49
|
+
"@sentry/integrations": "^7.7.0",
|
|
50
|
+
"@sentry/react": "^7.7.0",
|
|
51
|
+
"@sentry/tracing": "^7.7.0",
|
|
52
|
+
"@tanstack/react-query": "^4.0.10",
|
|
52
53
|
"big.js": "^6.2.1",
|
|
53
54
|
"i18next": "^21.8.14",
|
|
54
55
|
"immer": "^9.0.15",
|
|
@@ -56,12 +57,11 @@
|
|
|
56
57
|
"react-dom": "^18.2.0",
|
|
57
58
|
"react-hook-form": "^7.33.1",
|
|
58
59
|
"react-i18next": "^11.18.1",
|
|
59
|
-
"react-query": "^4.0.0-beta.23",
|
|
60
60
|
"react-resize-detector": "^7.1.2",
|
|
61
61
|
"react-router-dom": "^6.3.0",
|
|
62
62
|
"react-timer-hook": "^3.0.5",
|
|
63
63
|
"react-virtual": "^2.10.4",
|
|
64
|
-
"zustand": "^4.0.0
|
|
64
|
+
"zustand": "^4.0.0"
|
|
65
65
|
},
|
|
66
66
|
"eslintConfig": {
|
|
67
67
|
"extends": "../../.eslintrc"
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box } from '@mui/material';
|
|
3
|
-
import { InsufficientGasOrFundsMessage } from '../../components/InsufficientGasOrFundsMessage';
|
|
4
3
|
import { SelectChainAndToken } from '../../components/SelectChainAndToken';
|
|
5
4
|
import { SwapInProgress } from '../../components/SwapInProgress';
|
|
6
5
|
import { SwapInput } from '../../components/SwapInput';
|
|
7
|
-
import { SwapRoutes } from '../../components/SwapRoutes';
|
|
8
6
|
import { FormContainer } from './MainPage.style';
|
|
9
7
|
import { MainSwapButton } from './MainSwapButton';
|
|
8
|
+
import { SwapRoutes } from './SwapRoutes';
|
|
10
9
|
export const MainPage = () => {
|
|
11
|
-
return (_jsxs(FormContainer, Object.assign({ disableGutters: true }, { children: [_jsx(SwapInProgress, { mx: 3, mt:
|
|
10
|
+
return (_jsxs(FormContainer, Object.assign({ disableGutters: true }, { children: [_jsx(SwapInProgress, { mx: 3, mt: 1, mb: 2 }), _jsx(SelectChainAndToken, { mt: 1, mx: 3, mb: 3 }), _jsx(Box, Object.assign({ mx: 3, mb: 3 }, { children: _jsx(SwapInput, { formType: "from" }) })), _jsx(SwapRoutes, { mx: 3, mb: 3 }), _jsx(Box, Object.assign({ mx: 3, mb: 1 }, { children: _jsx(MainSwapButton, {}) }))] })));
|
|
12
11
|
};
|
|
@@ -11,21 +11,20 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
import { useNavigate } from 'react-router-dom';
|
|
12
12
|
import { SwapButton } from '../../components/SwapButton';
|
|
13
13
|
import { useSwapRoutes } from '../../hooks';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { useSetExecutableRoute } from '../../stores';
|
|
15
|
+
import { navigationRoutes } from '../../utils';
|
|
16
16
|
export const MainSwapButton = () => {
|
|
17
17
|
const navigate = useNavigate();
|
|
18
|
-
const [currentRoute] = useCurrentRoute();
|
|
19
18
|
const setExecutableRoute = useSetExecutableRoute();
|
|
20
19
|
const { routes: swapRoutes, isLoading, isFetching } = useSwapRoutes();
|
|
20
|
+
const currentRoute = swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes[0];
|
|
21
21
|
const handleClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
-
if (currentRoute
|
|
23
|
-
(swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.some((route) => route.id === currentRoute.id))) {
|
|
22
|
+
if (currentRoute) {
|
|
24
23
|
setExecutableRoute(currentRoute);
|
|
25
|
-
navigate(
|
|
24
|
+
navigate(navigationRoutes.swap, {
|
|
26
25
|
state: { routeId: currentRoute.id },
|
|
27
26
|
});
|
|
28
27
|
}
|
|
29
28
|
});
|
|
30
|
-
return _jsx(SwapButton, { onClick: handleClick, loading: isLoading || isFetching });
|
|
29
|
+
return (_jsx(SwapButton, { onClick: handleClick, currentRoute: currentRoute, loading: isLoading || isFetching || !currentRoute }));
|
|
31
30
|
};
|
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable react/no-array-index-key */
|
|
3
|
+
import { KeyboardArrowRight as KeyboardArrowRightIcon } from '@mui/icons-material';
|
|
4
|
+
import { Box, IconButton } from '@mui/material';
|
|
5
|
+
import { useCallback } from 'react';
|
|
6
|
+
import { useTranslation } from 'react-i18next';
|
|
7
|
+
import { useNavigate } from 'react-router-dom';
|
|
8
|
+
import { Card, CardTitle } from '../../components/Card';
|
|
9
|
+
import { GasSufficiencyMessage } from '../../components/GasSufficiencyMessage';
|
|
10
|
+
import { ProgressToNextUpdate } from '../../components/ProgressToNextUpdate';
|
|
11
|
+
import { SwapRouteCard, SwapRouteCardSkeleton, SwapRouteNotFoundCard, } from '../../components/SwapRouteCard';
|
|
12
|
+
import { useSwapRoutes } from '../../hooks';
|
|
13
|
+
import { navigationRoutes } from '../../utils';
|
|
14
|
+
import { Stack } from './SwapRoutes.style';
|
|
15
|
+
export const SwapRoutes = (props) => {
|
|
16
|
+
const { t } = useTranslation();
|
|
17
|
+
const navigate = useNavigate();
|
|
18
|
+
const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = useSwapRoutes();
|
|
19
|
+
const handleCardClick = useCallback(() => {
|
|
20
|
+
navigate(navigationRoutes.swapRoutes);
|
|
21
|
+
}, [navigate]);
|
|
22
|
+
const currentRoute = routes === null || routes === void 0 ? void 0 : routes[0];
|
|
23
|
+
if (!currentRoute && !isLoading && !isFetching && !isFetched) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const routeNotFound = !currentRoute && isFetched;
|
|
27
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Card, Object.assign({}, props, { children: [_jsx(CardTitle, { children: t('swap.routes') }), _jsx(ProgressToNextUpdate, { updatedAt: dataUpdatedAt, timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: {
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
top: 8,
|
|
30
|
+
right: 8,
|
|
31
|
+
} }), _jsxs(Box, Object.assign({ sx: { display: 'flex' } }, { children: [_jsx(Stack, Object.assign({ direction: "row", spacing: 2, my: 2, ml: 2, mr: routeNotFound ? 2 : 1, sx: {
|
|
32
|
+
borderWidth: !routeNotFound && (isFetching || (routes && routes.length > 1))
|
|
33
|
+
? 1
|
|
34
|
+
: 0,
|
|
35
|
+
} }, { children: routeNotFound ? (_jsx(SwapRouteNotFoundCard, { minWidth: "100%", dense: true })) : isLoading || isFetching || !currentRoute ? (_jsxs(_Fragment, { children: [_jsx(SwapRouteCardSkeleton, { minWidth: "80%", dense: true }), _jsx(SwapRouteCardSkeleton, { minWidth: "80%", dense: true })] })) : (_jsxs(_Fragment, { children: [_jsx(SwapRouteCard, { minWidth: routes.length > 1 ? '80%' : '100%', route: currentRoute, active: true, dense: true }), routes.length > 1 ? (_jsx(SwapRouteCard, { minWidth: "80%", route: routes[1], dense: true })) : null] })) })), _jsx(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: !routeNotFound ? (_jsx(Box, Object.assign({ py: 1, pr: 1 }, { children: _jsx(IconButton, Object.assign({ onClick: handleCardClick, size: "medium", "aria-label": "swap-routes" }, { children: _jsx(KeyboardArrowRightIcon, {}) })) }))) : null }))] }))] })), !isFetching ? (_jsx(GasSufficiencyMessage, Object.assign({ route: currentRoute }, props))) : null] }));
|
|
36
|
+
};
|
|
File without changes
|
|
@@ -3,7 +3,7 @@ import { KeyboardArrowDown as KeyboardArrowDownIcon } from '@mui/icons-material'
|
|
|
3
3
|
import { Avatar, FormControl, ListItemAvatar, MenuItem, Skeleton, } from '@mui/material';
|
|
4
4
|
import { useFormContext, useWatch } from 'react-hook-form';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import {
|
|
6
|
+
import { Card, CardTitle } from '../../components/Card';
|
|
7
7
|
import { Select } from '../../components/Select';
|
|
8
8
|
import { useChains } from '../../hooks';
|
|
9
9
|
import { SwapFormKeyHelper, } from '../../providers/SwapFormProvider';
|
|
@@ -21,5 +21,5 @@ export const ChainSelect = ({ formType }) => {
|
|
|
21
21
|
setValue(SwapFormKeyHelper.getTokenKey(formType), '');
|
|
22
22
|
setValue(SwapFormKeyHelper.getAmountKey(formType), '');
|
|
23
23
|
};
|
|
24
|
-
return !isLoading ? (_jsxs(
|
|
24
|
+
return !isLoading ? (_jsxs(Card, { children: [_jsx(CardTitle, { children: t(`swap.selectChain`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Select, Object.assign({ labelId: "label", MenuProps: { elevation: 2 }, defaultValue: formType === 'from' ? fromChain : toChain, value: chainId, onChange: handleChain, IconComponent: KeyboardArrowDownIcon }, { children: chains === null || chains === void 0 ? void 0 : chains.map((chain) => (_jsxs(MenuItem, Object.assign({ value: chain.id }, { children: [_jsx(ListItemAvatar, { children: _jsx(Avatar, Object.assign({ src: chain.logoURI, alt: chain.key }, { children: chain.name[0] })) }), chain.name] }), chain.key))) })) }))] })) : (_jsx(Skeleton, { variant: "rectangular", width: "100%", height: 98, sx: { borderRadius: 1 } }));
|
|
25
25
|
};
|
|
@@ -4,7 +4,7 @@ import { FormControl, InputAdornment } from '@mui/material';
|
|
|
4
4
|
import { useEffect } from 'react';
|
|
5
5
|
import { useFormContext } from 'react-hook-form';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import {
|
|
7
|
+
import { Card } from '../../components/Card';
|
|
8
8
|
import { SwapFormKey } from '../../providers/SwapFormProvider';
|
|
9
9
|
import { Input } from './SearchTokenInput.style';
|
|
10
10
|
export const SearchTokenInput = () => {
|
|
@@ -13,5 +13,5 @@ export const SearchTokenInput = () => {
|
|
|
13
13
|
useEffect(() => () => {
|
|
14
14
|
setValue(SwapFormKey.SearchTokensFilter, '');
|
|
15
15
|
}, [setValue]);
|
|
16
|
-
return (_jsx(
|
|
16
|
+
return (_jsx(Card, { children: _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Input, { size: "small", placeholder: t(`swap.tokenSearch`), defaultValue: "", endAdornment: _jsx(InputAdornment, Object.assign({ position: "end" }, { children: _jsx(SearchIcon, {}) })), inputProps: Object.assign({ inputMode: 'search' }, register(SwapFormKey.SearchTokensFilter)), autoComplete: "off" }) })) }));
|
|
17
17
|
};
|
|
@@ -9,11 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { supportedWallets } from '@lifi/wallet-management';
|
|
12
|
-
import { Avatar, Button, Container,
|
|
12
|
+
import { Avatar, Button, Container, DialogActions, DialogContent, DialogContentText, List, ListItemAvatar, } from '@mui/material';
|
|
13
13
|
import { useCallback, useState } from 'react';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useNavigate } from 'react-router-dom';
|
|
16
|
-
import {
|
|
16
|
+
import { Dialog } from '../../components/Dialog';
|
|
17
17
|
import { useWallet } from '../../providers/WalletProvider';
|
|
18
18
|
import { WalletListItemButton, WalletListItemText, } from './SelectWalletPage.style';
|
|
19
19
|
export const SelectWalletPage = () => {
|
|
@@ -21,12 +21,9 @@ export const SelectWalletPage = () => {
|
|
|
21
21
|
const { t } = useTranslation();
|
|
22
22
|
const navigate = useNavigate();
|
|
23
23
|
const { connect } = useWallet();
|
|
24
|
-
const containerElement = useScrollableContainer();
|
|
25
24
|
const [walletIdentity, setWalletIdentity] = useState({ show: false });
|
|
26
25
|
const closeDialog = () => {
|
|
27
|
-
setWalletIdentity({
|
|
28
|
-
show: false,
|
|
29
|
-
});
|
|
26
|
+
setWalletIdentity((state) => (Object.assign(Object.assign({}, state), { show: false })));
|
|
30
27
|
};
|
|
31
28
|
const handleConnect = useCallback((event, wallet) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
29
|
const { ethereum } = window;
|
|
@@ -46,23 +43,7 @@ export const SelectWalletPage = () => {
|
|
|
46
43
|
return (_jsxs(Container, Object.assign({ disableGutters: true }, { children: [_jsx(List, Object.assign({ sx: {
|
|
47
44
|
paddingLeft: 2,
|
|
48
45
|
paddingRight: 2,
|
|
49
|
-
} }, { children: supportedWallets.map((wallet) => (_jsxs(WalletListItemButton, Object.assign({ onClick: (event) => handleConnect(event, wallet), disableRipple: true }, { children: [_jsx(ListItemAvatar, { children: _jsx(Avatar, Object.assign({ src: wallet.icon, alt: wallet.name }, { children: wallet.name[0] })) }), _jsx(WalletListItemText, { primary: wallet.name })] }), wallet.name))) })), _jsxs(Dialog, Object.assign({ open: walletIdentity.show, onClose: closeDialog,
|
|
50
|
-
position: 'absolute',
|
|
51
|
-
overflow: 'hidden',
|
|
52
|
-
}, PaperProps: {
|
|
53
|
-
sx: (theme) => ({
|
|
54
|
-
position: 'absolute',
|
|
55
|
-
backgroundImage: 'none',
|
|
56
|
-
borderTopLeftRadius: theme.shape.borderRadius,
|
|
57
|
-
borderTopRightRadius: theme.shape.borderRadius,
|
|
58
|
-
}),
|
|
59
|
-
}, BackdropProps: {
|
|
60
|
-
sx: {
|
|
61
|
-
position: 'absolute',
|
|
62
|
-
backgroundColor: 'rgb(0 0 0 / 48%)',
|
|
63
|
-
backdropFilter: 'blur(3px)',
|
|
64
|
-
},
|
|
65
|
-
} }, { children: [_jsx(DialogContent, { children: _jsx(DialogContentText, { children: t('wallet.extensionNotFound', {
|
|
46
|
+
} }, { children: supportedWallets.map((wallet) => (_jsxs(WalletListItemButton, Object.assign({ onClick: (event) => handleConnect(event, wallet), disableRipple: true }, { children: [_jsx(ListItemAvatar, { children: _jsx(Avatar, Object.assign({ src: wallet.icon, alt: wallet.name }, { children: wallet.name[0] })) }), _jsx(WalletListItemText, { primary: wallet.name })] }), wallet.name))) })), _jsxs(Dialog, Object.assign({ open: walletIdentity.show, onClose: closeDialog }, { children: [_jsx(DialogContent, { children: _jsx(DialogContentText, { children: t('wallet.extensionNotFound', {
|
|
66
47
|
name: (_a = walletIdentity.wallet) === null || _a === void 0 ? void 0 : _a.name,
|
|
67
48
|
}) }) }), _jsx(DialogActions, { children: _jsx(Button, Object.assign({ onClick: closeDialog, autoFocus: true }, { children: t('button.ok') })) })] }))] })));
|
|
68
49
|
};
|
|
@@ -2,7 +2,7 @@ import { ListItem, ListItemButton, ListItemText, Typography, } from '@mui/materi
|
|
|
2
2
|
import { listItemSecondaryActionClasses } from '@mui/material/ListItemSecondaryAction';
|
|
3
3
|
import { listItemTextClasses } from '@mui/material/ListItemText';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
|
-
import { getContrastAlphaColor } from '../../utils
|
|
5
|
+
import { getContrastAlphaColor } from '../../utils';
|
|
6
6
|
export const WalletListItemButton = styled(ListItemButton)(({ theme }) => ({
|
|
7
7
|
borderRadius: theme.shape.borderRadiusSecondary,
|
|
8
8
|
paddingLeft: theme.spacing(1.5),
|
|
@@ -12,7 +12,7 @@ export const AdvancedPreferences = () => {
|
|
|
12
12
|
const handleAdvancedPreferences = (_, checked) => {
|
|
13
13
|
setValue('advancedPreferences', checked);
|
|
14
14
|
};
|
|
15
|
-
return (_jsxs(Box, Object.assign({
|
|
15
|
+
return (_jsxs(Box, Object.assign({ px: 3, pt: 3 }, { children: [_jsxs(Box, Object.assign({ sx: {
|
|
16
16
|
display: 'flex',
|
|
17
17
|
justifyContent: 'space-between',
|
|
18
18
|
alignItems: 'center',
|
|
@@ -9,7 +9,7 @@ export declare const ToggleButton: import("@emotion/styled").StyledComponent<{
|
|
|
9
9
|
onChange?: ((event: import("react").MouseEvent<HTMLElement, MouseEvent>, value: any) => void) | undefined;
|
|
10
10
|
onClick?: ((event: import("react").MouseEvent<HTMLElement, MouseEvent>, value: any) => void) | undefined;
|
|
11
11
|
selected?: boolean | undefined;
|
|
12
|
-
size?: "small" | "
|
|
12
|
+
size?: "small" | "medium" | "large" | undefined;
|
|
13
13
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
14
14
|
value: unknown;
|
|
15
15
|
} & Omit<{
|
|
@@ -3,18 +3,21 @@ import { KeyboardArrowDown as KeyboardArrowDownIcon } from '@mui/icons-material'
|
|
|
3
3
|
import { Box, Chip, FormControl, MenuItem, Skeleton } from '@mui/material';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import shallow from 'zustand/shallow';
|
|
6
|
-
import {
|
|
6
|
+
import { Card, CardTitle } from '../../components/Card';
|
|
7
7
|
import { Select } from '../../components/Select';
|
|
8
8
|
import { useTools } from '../../hooks';
|
|
9
9
|
import { useSettingsStore } from '../../stores';
|
|
10
10
|
export const EnabledBridgesSelect = () => {
|
|
11
11
|
var _a;
|
|
12
12
|
const { t } = useTranslation();
|
|
13
|
-
const tools = useTools();
|
|
13
|
+
const { tools, formattedTools } = useTools();
|
|
14
14
|
const [enabledBridges, setTools] = useSettingsStore((state) => [state.enabledBridges, state.setTools], shallow);
|
|
15
|
-
return (tools === null || tools === void 0 ? void 0 : tools.bridges.length) ? (_jsxs(
|
|
15
|
+
return (tools === null || tools === void 0 ? void 0 : tools.bridges.length) ? (_jsxs(Card, { children: [_jsx(CardTitle, { children: t(`settings.enabledBridges`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Select, Object.assign({ multiple: true, placeholder: t(`settings.selectEnabledBridges`), MenuProps: { elevation: 2 }, IconComponent: KeyboardArrowDownIcon, value: enabledBridges !== null && enabledBridges !== void 0 ? enabledBridges : [], onChange: (event) => {
|
|
16
16
|
if (tools === null || tools === void 0 ? void 0 : tools.bridges) {
|
|
17
17
|
setTools('Bridges', event.target.value, tools.bridges);
|
|
18
18
|
}
|
|
19
|
-
}, renderValue: (selected) => (_jsx(Box, Object.assign({ sx: { display: 'flex', flexWrap: 'wrap', gap: 0.5 } }, { children: selected.map((value) =>
|
|
19
|
+
}, renderValue: (selected) => (_jsx(Box, Object.assign({ sx: { display: 'flex', flexWrap: 'wrap', gap: 0.5 } }, { children: selected.map((value) => {
|
|
20
|
+
var _a, _b, _c;
|
|
21
|
+
return (_jsx(Chip, { label: (_c = (_b = (_a = formattedTools.bridges) === null || _a === void 0 ? void 0 : _a[value]) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : value }, value));
|
|
22
|
+
}) }))) }, { children: (_a = tools === null || tools === void 0 ? void 0 : tools.bridges) === null || _a === void 0 ? void 0 : _a.map((bridge) => (_jsx(MenuItem, Object.assign({ value: bridge.key }, { children: bridge.name }), bridge.key))) })) }))] })) : (_jsx(Skeleton, { variant: "rectangular", width: "100%", height: 134, sx: { borderRadius: 1 } }));
|
|
20
23
|
};
|
|
@@ -3,17 +3,20 @@ import { KeyboardArrowDown as KeyboardArrowDownIcon } from '@mui/icons-material'
|
|
|
3
3
|
import { Box, Chip, FormControl, MenuItem, Skeleton } from '@mui/material';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import shallow from 'zustand/shallow';
|
|
6
|
-
import {
|
|
6
|
+
import { Card, CardTitle } from '../../components/Card';
|
|
7
7
|
import { Select } from '../../components/Select';
|
|
8
8
|
import { useTools } from '../../hooks';
|
|
9
9
|
import { useSettingsStore } from '../../stores';
|
|
10
10
|
export const EnabledExchangesSelect = () => {
|
|
11
11
|
const { t } = useTranslation();
|
|
12
|
-
const tools = useTools();
|
|
12
|
+
const { tools, formattedTools } = useTools();
|
|
13
13
|
const [enabledExchanges, setTools] = useSettingsStore((state) => [state.enabledExchanges, state.setTools], shallow);
|
|
14
|
-
return (tools === null || tools === void 0 ? void 0 : tools.exchanges.length) ? (_jsxs(
|
|
14
|
+
return (tools === null || tools === void 0 ? void 0 : tools.exchanges.length) ? (_jsxs(Card, { children: [_jsx(CardTitle, { children: t(`settings.enabledExchanges`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Select, Object.assign({ multiple: true, placeholder: t(`settings.selectEnabledExchanges`), value: enabledExchanges !== null && enabledExchanges !== void 0 ? enabledExchanges : [], onChange: (event) => {
|
|
15
15
|
if (tools === null || tools === void 0 ? void 0 : tools.exchanges) {
|
|
16
16
|
setTools('Exchanges', event.target.value, tools.exchanges);
|
|
17
17
|
}
|
|
18
|
-
}, MenuProps: { elevation: 2 }, IconComponent: KeyboardArrowDownIcon, renderValue: (selected) => (_jsx(Box, Object.assign({ sx: { display: 'flex', flexWrap: 'wrap', gap: 0.5 } }, { children: selected.map((value) =>
|
|
18
|
+
}, MenuProps: { elevation: 2 }, IconComponent: KeyboardArrowDownIcon, renderValue: (selected) => (_jsx(Box, Object.assign({ sx: { display: 'flex', flexWrap: 'wrap', gap: 0.5 } }, { children: selected.map((value) => {
|
|
19
|
+
var _a, _b, _c;
|
|
20
|
+
return (_jsx(Chip, { label: (_c = (_b = (_a = formattedTools.exchanges) === null || _a === void 0 ? void 0 : _a[value]) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : value }, value));
|
|
21
|
+
}) }))) }, { children: tools === null || tools === void 0 ? void 0 : tools.exchanges.map((exchange) => (_jsx(MenuItem, Object.assign({ value: exchange.key }, { children: exchange.key }), exchange.key))) })) }))] })) : (_jsx(Skeleton, { variant: "rectangular", width: "100%", height: 206, sx: { borderRadius: 1 } }));
|
|
19
22
|
};
|
|
@@ -2,12 +2,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { KeyboardArrowDown as KeyboardArrowDownIcon } from '@mui/icons-material';
|
|
3
3
|
import { FormControl, MenuItem } from '@mui/material';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import {
|
|
5
|
+
import { Card, CardTitle } from '../../components/Card';
|
|
6
6
|
import { Select } from '../../components/Select';
|
|
7
7
|
import { useSetSettings, useSettings } from '../../stores';
|
|
8
8
|
export const GasPriceSelect = () => {
|
|
9
9
|
const { t } = useTranslation();
|
|
10
10
|
const [setValue] = useSetSettings();
|
|
11
11
|
const { gasPrice } = useSettings(['gasPrice']);
|
|
12
|
-
return (_jsxs(
|
|
12
|
+
return (_jsxs(Card, Object.assign({ flex: 1 }, { children: [_jsx(CardTitle, { children: t(`settings.gasPrice.title`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsxs(Select, Object.assign({ MenuProps: { elevation: 2 }, value: gasPrice, onChange: (event) => setValue('gasPrice', event.target.value), IconComponent: KeyboardArrowDownIcon, dense: true }, { children: [_jsx(MenuItem, Object.assign({ value: "slow" }, { children: t(`settings.gasPrice.slow`) })), _jsx(MenuItem, Object.assign({ value: "normal" }, { children: t(`settings.gasPrice.normal`) })), _jsx(MenuItem, Object.assign({ value: "fast" }, { children: t(`settings.gasPrice.fast`) }))] })) }))] })));
|
|
13
13
|
};
|
|
@@ -3,12 +3,12 @@ import { Orders } from '@lifi/sdk';
|
|
|
3
3
|
import { KeyboardArrowDown as KeyboardArrowDownIcon } from '@mui/icons-material';
|
|
4
4
|
import { FormControl, MenuItem } from '@mui/material';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import {
|
|
6
|
+
import { Card, CardTitle } from '../../components/Card';
|
|
7
7
|
import { Select } from '../../components/Select';
|
|
8
8
|
import { useSetSettings, useSettings } from '../../stores';
|
|
9
9
|
export const RoutePrioritySelect = () => {
|
|
10
10
|
const { t } = useTranslation();
|
|
11
11
|
const [setValue] = useSetSettings();
|
|
12
12
|
const { routePriority } = useSettings(['routePriority']);
|
|
13
|
-
return (_jsxs(
|
|
13
|
+
return (_jsxs(Card, { children: [_jsx(CardTitle, { children: t(`settings.routePriority`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Select, Object.assign({ MenuProps: { elevation: 2 }, value: routePriority, onChange: (event) => setValue('routePriority', event.target.value), IconComponent: KeyboardArrowDownIcon, dense: true }, { children: Orders.map((order) => (_jsx(MenuItem, Object.assign({ value: order }, { children: t(`swap.tags.${order.toLowerCase()}`) }), order))) })) }))] }));
|
|
14
14
|
};
|
|
@@ -2,10 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { FormControl, InputAdornment } from '@mui/material';
|
|
3
3
|
import { useRef } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import {
|
|
5
|
+
import { Card, CardTitle } from '../../components/Card';
|
|
6
6
|
import { Input } from '../../components/Input';
|
|
7
7
|
import { useSetSettings, useSettings } from '../../stores';
|
|
8
|
-
import { formatSlippage } from '../../utils
|
|
8
|
+
import { formatSlippage } from '../../utils';
|
|
9
9
|
export const SlippageInput = () => {
|
|
10
10
|
const { t } = useTranslation();
|
|
11
11
|
const [setValue] = useSetSettings();
|
|
@@ -19,7 +19,7 @@ export const SlippageInput = () => {
|
|
|
19
19
|
const { value } = event.target;
|
|
20
20
|
setValue('slippage', formatSlippage(value, defaultValue.current));
|
|
21
21
|
};
|
|
22
|
-
return (_jsxs(
|
|
22
|
+
return (_jsxs(Card, { children: [_jsx(CardTitle, { children: t(`settings.slippage`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Input, { size: "small", placeholder: t(`settings.slippage`), endAdornment: _jsx(InputAdornment, Object.assign({ position: "end" }, { children: "%" })), autoComplete: "off", inputProps: {
|
|
23
23
|
inputMode: 'decimal',
|
|
24
24
|
}, onChange: handleChange, onBlur: handleBlur, value: slippage }) }))] }));
|
|
25
25
|
};
|