@lifi/widget 1.16.1 → 1.17.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/AppProvider.js +1 -1
- package/README.md +1 -1
- package/cjs/AppProvider.js +1 -1
- package/cjs/components/ChainSelect/ChainSelect.style.js +4 -4
- package/cjs/components/ChainSelect/useChainSelect.d.ts +2 -2
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +3 -3
- package/cjs/components/Header/useHeaderActionStore.d.ts +0 -2
- package/cjs/components/Header/useHeaderActionStore.js +1 -5
- package/cjs/components/SwapButton/SwapButton.js +3 -23
- package/cjs/components/TokenList/TokenList.js +1 -1
- package/cjs/components/TokenList/TokenList.style.js +4 -3
- package/cjs/components/TokenList/TokenListItem.js +1 -1
- package/cjs/components/TokenList/TokenNotFound.d.ts +2 -1
- package/cjs/components/TokenList/TokenNotFound.js +12 -2
- package/cjs/components/TokenList/types.d.ts +2 -2
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useChains.js +21 -8
- package/cjs/hooks/useFeaturedTokens.d.ts +1 -1
- package/cjs/hooks/useFeaturedTokens.js +5 -2
- package/cjs/hooks/useGasSufficiency.d.ts +1 -1
- package/cjs/hooks/useGasSufficiency.js +30 -21
- package/cjs/hooks/useToken.d.ts +0 -1
- package/cjs/hooks/useToken.js +1 -2
- package/cjs/hooks/useTokenBalances.d.ts +1 -2
- package/cjs/hooks/useTokenBalances.js +1 -2
- package/cjs/hooks/useTokens.d.ts +1 -2
- package/cjs/hooks/useTokens.js +30 -8
- package/cjs/hooks/useTools.js +8 -3
- package/cjs/i18n/en/translation.json +2 -3
- package/cjs/i18n/index.d.ts +1 -2
- package/cjs/pages/MainPage/MainSwapButton.js +1 -1
- package/cjs/pages/SettingsPage/AdvancedPreferences.js +1 -1
- package/cjs/pages/SettingsPage/GasPriceSelect.js +1 -1
- package/cjs/pages/SettingsPage/RoutePrioritySelect.js +1 -1
- package/cjs/pages/SettingsPage/ShowDestinationWallet.js +1 -1
- package/cjs/pages/SettingsPage/SlippageInput.js +1 -1
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +2 -3
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +2 -3
- package/cjs/pages/SwapPage/SwapPage.js +11 -2
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +4 -3
- package/cjs/providers/SwapFormProvider/SwapFormProvider.js +4 -58
- package/cjs/providers/SwapFormProvider/types.d.ts +5 -5
- package/cjs/providers/WalletProvider/WalletProvider.js +57 -1
- package/cjs/providers/WidgetProvider/index.d.ts +1 -0
- package/cjs/providers/WidgetProvider/index.js +1 -0
- package/cjs/providers/WidgetProvider/utils.d.ts +4 -0
- package/cjs/providers/WidgetProvider/utils.js +13 -0
- package/cjs/stores/chains/index.d.ts +0 -1
- package/cjs/stores/chains/index.js +0 -1
- package/cjs/stores/chains/types.d.ts +1 -1
- package/cjs/stores/chains/useChainOrderStore.js +17 -14
- package/cjs/stores/settings/index.d.ts +0 -1
- package/cjs/stores/settings/index.js +0 -1
- package/cjs/stores/settings/useAppearance.js +3 -1
- package/cjs/types/widget.d.ts +29 -22
- package/components/ChainSelect/ChainSelect.style.js +4 -4
- package/components/ChainSelect/useChainSelect.d.ts +2 -2
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +3 -3
- package/components/Header/useHeaderActionStore.d.ts +0 -2
- package/components/Header/useHeaderActionStore.js +0 -3
- package/components/SwapButton/SwapButton.js +5 -25
- package/components/TokenList/TokenList.js +1 -1
- package/components/TokenList/TokenList.style.js +4 -3
- package/components/TokenList/TokenListItem.js +1 -1
- package/components/TokenList/TokenNotFound.d.ts +2 -1
- package/components/TokenList/TokenNotFound.js +12 -2
- package/components/TokenList/types.d.ts +2 -2
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useChains.js +23 -10
- package/hooks/useFeaturedTokens.d.ts +1 -1
- package/hooks/useFeaturedTokens.js +5 -2
- package/hooks/useGasSufficiency.d.ts +1 -1
- package/hooks/useGasSufficiency.js +32 -23
- package/hooks/useToken.d.ts +0 -1
- package/hooks/useToken.js +1 -2
- package/hooks/useTokenBalances.d.ts +1 -2
- package/hooks/useTokenBalances.js +1 -2
- package/hooks/useTokens.d.ts +1 -2
- package/hooks/useTokens.js +31 -9
- package/hooks/useTools.js +9 -4
- package/i18n/en/translation.json +2 -3
- package/i18n/index.d.ts +1 -2
- package/package.json +4 -4
- package/pages/MainPage/MainSwapButton.js +1 -1
- package/pages/SettingsPage/AdvancedPreferences.js +2 -2
- package/pages/SettingsPage/GasPriceSelect.js +2 -2
- package/pages/SettingsPage/RoutePrioritySelect.js +2 -2
- package/pages/SettingsPage/ShowDestinationWallet.js +2 -2
- package/pages/SettingsPage/SlippageInput.js +2 -2
- package/pages/SwapDetailsPage/SwapDetailsPage.js +3 -4
- package/pages/SwapHistoryPage/SwapHistoryPage.js +3 -4
- package/pages/SwapPage/SwapPage.js +11 -2
- package/pages/SwapRoutesPage/SwapRoutesPage.js +5 -4
- package/providers/SwapFormProvider/SwapFormProvider.js +4 -58
- package/providers/SwapFormProvider/types.d.ts +5 -5
- package/providers/WalletProvider/WalletProvider.js +58 -2
- package/providers/WidgetProvider/index.d.ts +1 -0
- package/providers/WidgetProvider/index.js +1 -0
- package/providers/WidgetProvider/utils.d.ts +4 -0
- package/providers/WidgetProvider/utils.js +9 -0
- package/stores/chains/index.d.ts +0 -1
- package/stores/chains/index.js +0 -1
- package/stores/chains/types.d.ts +1 -1
- package/stores/chains/useChainOrderStore.js +17 -14
- package/stores/settings/index.d.ts +0 -1
- package/stores/settings/index.js +0 -1
- package/stores/settings/useAppearance.js +3 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/widget.d.ts +29 -22
- package/cjs/stores/chains/useInitializeChainOrder.d.ts +0 -1
- package/cjs/stores/chains/useInitializeChainOrder.js +0 -12
- package/cjs/stores/settings/useSetSettings.d.ts +0 -5
- package/cjs/stores/settings/useSetSettings.js +0 -12
- package/stores/chains/useInitializeChainOrder.d.ts +0 -1
- package/stores/chains/useInitializeChainOrder.js +0 -5
- package/stores/settings/useSetSettings.d.ts +0 -5
- package/stores/settings/useSetSettings.js +0 -5
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
},
|
|
16
16
|
"button": {
|
|
17
17
|
"connectWallet": "Connect wallet",
|
|
18
|
-
"switchChain": "Switch chain",
|
|
19
18
|
"swap": "Swap",
|
|
20
19
|
"reviewSwap": "Review swap",
|
|
21
20
|
"startSwap": "Start swap",
|
|
@@ -56,7 +55,6 @@
|
|
|
56
55
|
"featuredTokens": "Featured tokens",
|
|
57
56
|
"otherTokens": "Other tokens",
|
|
58
57
|
"inProgress": "in progress",
|
|
59
|
-
"couldntFindTokens": "We couldn't find tokens on this chain or you don't have any.",
|
|
60
58
|
"stepSwap": "Swap",
|
|
61
59
|
"stepBridge": "Bridge",
|
|
62
60
|
"stepSwapAndBridge": "Swap and bridge",
|
|
@@ -92,7 +90,8 @@
|
|
|
92
90
|
"message": {
|
|
93
91
|
"routeNotFound": "Try another token combination.",
|
|
94
92
|
"emptySwapHistory": "Swap history is only stored locally and will be deleted if you clear your browser data.",
|
|
95
|
-
"emptyActiveSwaps": "Swaps in progress will appear here. Once completed, find them in swap history."
|
|
93
|
+
"emptyActiveSwaps": "Swaps in progress will appear here. Once completed, find them in swap history.",
|
|
94
|
+
"emptyTokenList": "We couldn't find tokens on {{chainName}} chain or you don't have any. Please try search again or choose another chain."
|
|
96
95
|
}
|
|
97
96
|
},
|
|
98
97
|
"warning": {
|
package/cjs/i18n/index.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ export declare const resources: {
|
|
|
18
18
|
};
|
|
19
19
|
button: {
|
|
20
20
|
connectWallet: string;
|
|
21
|
-
switchChain: string;
|
|
22
21
|
swap: string;
|
|
23
22
|
reviewSwap: string;
|
|
24
23
|
startSwap: string;
|
|
@@ -59,7 +58,6 @@ export declare const resources: {
|
|
|
59
58
|
featuredTokens: string;
|
|
60
59
|
otherTokens: string;
|
|
61
60
|
inProgress: string;
|
|
62
|
-
couldntFindTokens: string;
|
|
63
61
|
stepSwap: string;
|
|
64
62
|
stepBridge: string;
|
|
65
63
|
stepSwapAndBridge: string;
|
|
@@ -96,6 +94,7 @@ export declare const resources: {
|
|
|
96
94
|
routeNotFound: string;
|
|
97
95
|
emptySwapHistory: string;
|
|
98
96
|
emptyActiveSwaps: string;
|
|
97
|
+
emptyTokenList: string;
|
|
99
98
|
};
|
|
100
99
|
};
|
|
101
100
|
warning: {
|
|
@@ -31,6 +31,6 @@ const MainSwapButton = () => {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
return ((0, jsx_runtime_1.jsx)(SwapButton_1.SwapButton, { onClick: handleClick, currentRoute: currentRoute, disable: isLoading || isFetching ||
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(SwapButton_1.SwapButton, { onClick: handleClick, currentRoute: currentRoute, disable: isLoading || isFetching || isValidating || !isValid }));
|
|
35
35
|
};
|
|
36
36
|
exports.MainSwapButton = MainSwapButton;
|
|
@@ -10,7 +10,7 @@ const EnabledBridgesSelect_1 = require("./EnabledBridgesSelect");
|
|
|
10
10
|
const EnabledExchangesSelect_1 = require("./EnabledExchangesSelect");
|
|
11
11
|
const AdvancedPreferences = () => {
|
|
12
12
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
13
|
-
const
|
|
13
|
+
const setValue = (0, stores_1.useSettingsStore)((state) => state.setValue);
|
|
14
14
|
const { advancedPreferences } = (0, stores_1.useSettings)(['advancedPreferences']);
|
|
15
15
|
const handleAdvancedPreferences = (_, checked) => {
|
|
16
16
|
setValue('advancedPreferences', checked);
|
|
@@ -10,7 +10,7 @@ const Select_1 = require("../../components/Select");
|
|
|
10
10
|
const stores_1 = require("../../stores");
|
|
11
11
|
const GasPriceSelect = () => {
|
|
12
12
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
13
|
-
const
|
|
13
|
+
const setValue = (0, stores_1.useSettingsStore)((state) => state.setValue);
|
|
14
14
|
const { gasPrice } = (0, stores_1.useSettings)(['gasPrice']);
|
|
15
15
|
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ flex: 1 }, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t(`settings.gasPrice.title`) }), (0, jsx_runtime_1.jsx)(material_1.FormControl, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsxs)(Select_1.Select, Object.assign({ MenuProps: { elevation: 2 }, value: gasPrice, onChange: (event) => setValue('gasPrice', event.target.value), IconComponent: icons_material_1.KeyboardArrowDown, dense: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ value: "slow" }, { children: t(`settings.gasPrice.slow`) })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ value: "normal" }, { children: t(`settings.gasPrice.normal`) })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ value: "fast" }, { children: t(`settings.gasPrice.fast`) }))] })) }))] })));
|
|
16
16
|
};
|
|
@@ -11,7 +11,7 @@ const Select_1 = require("../../components/Select");
|
|
|
11
11
|
const stores_1 = require("../../stores");
|
|
12
12
|
const RoutePrioritySelect = () => {
|
|
13
13
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
14
|
-
const
|
|
14
|
+
const setValue = (0, stores_1.useSettingsStore)((state) => state.setValue);
|
|
15
15
|
const { routePriority } = (0, stores_1.useSettings)(['routePriority']);
|
|
16
16
|
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t(`settings.routePriority`) }), (0, jsx_runtime_1.jsx)(material_1.FormControl, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(Select_1.Select, Object.assign({ MenuProps: { elevation: 2 }, value: routePriority, onChange: (event) => setValue('routePriority', event.target.value), IconComponent: icons_material_1.KeyboardArrowDown, dense: true }, { children: sdk_1.Orders.map((order) => {
|
|
17
17
|
const tag = t(`swap.tags.${order.toUpperCase()}`);
|
|
@@ -8,7 +8,7 @@ const Switch_1 = require("../../components/Switch");
|
|
|
8
8
|
const stores_1 = require("../../stores");
|
|
9
9
|
const ShowDestinationWallet = () => {
|
|
10
10
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
11
|
-
const
|
|
11
|
+
const setValue = (0, stores_1.useSettingsStore)((state) => state.setValue);
|
|
12
12
|
const { showDestinationWallet } = (0, stores_1.useSettings)(['showDestinationWallet']);
|
|
13
13
|
const onChange = (_, checked) => {
|
|
14
14
|
setValue('showDestinationWallet', checked);
|
|
@@ -11,8 +11,8 @@ const stores_1 = require("../../stores");
|
|
|
11
11
|
const utils_1 = require("../../utils");
|
|
12
12
|
const SlippageInput = () => {
|
|
13
13
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
14
|
-
const [setValue] = (0, stores_1.useSetSettings)();
|
|
15
14
|
const { slippage } = (0, stores_1.useSettings)(['slippage']);
|
|
15
|
+
const setValue = (0, stores_1.useSettingsStore)((state) => state.setValue);
|
|
16
16
|
const defaultValue = (0, react_1.useRef)(slippage);
|
|
17
17
|
const handleChange = (event) => {
|
|
18
18
|
const { value } = event.target;
|
|
@@ -32,7 +32,6 @@ const SwapDetailsPage = () => {
|
|
|
32
32
|
var _a, _b;
|
|
33
33
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
34
34
|
const { navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
35
|
-
const setHeaderAction = (0, Header_1.useSetHeaderAction)();
|
|
36
35
|
const { state } = (0, react_router_dom_1.useLocation)();
|
|
37
36
|
const [routeExecution, deleteRoute] = (0, stores_1.useRouteStore)((store) => [store.routes[state === null || state === void 0 ? void 0 : state.routeId], store.deleteRoute], shallow_1.default);
|
|
38
37
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
@@ -50,8 +49,8 @@ const SwapDetailsPage = () => {
|
|
|
50
49
|
yield navigator.clipboard.writeText((_c = routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route.id) !== null && _c !== void 0 ? _c : '');
|
|
51
50
|
});
|
|
52
51
|
(0, react_1.useEffect)(() => {
|
|
53
|
-
return
|
|
54
|
-
}, [
|
|
52
|
+
return Header_1.useHeaderActionStore.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: toggleDialog }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.DeleteOutline, {}) })));
|
|
53
|
+
}, [toggleDialog]);
|
|
55
54
|
const startedAt = new Date((_b = (_a = routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route.steps[0].execution) === null || _a === void 0 ? void 0 : _a.process[0].startedAt) !== null && _b !== void 0 ? _b : 0);
|
|
56
55
|
return ((0, jsx_runtime_1.jsxs)(SwapDetailsPage_style_1.Container, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: {
|
|
57
56
|
display: 'flex',
|
|
@@ -18,14 +18,13 @@ const SwapHistoryPage = () => {
|
|
|
18
18
|
const { account } = (0, providers_1.useWallet)();
|
|
19
19
|
const swaps = (0, route_1.useSwapHistory)(account.address);
|
|
20
20
|
const deleteRoutes = (0, stores_1.useRouteStore)((store) => store.deleteRoutes);
|
|
21
|
-
const setHeaderAction = (0, Header_1.useSetHeaderAction)();
|
|
22
21
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
23
22
|
const toggleDialog = (0, react_1.useCallback)(() => {
|
|
24
23
|
setOpen((open) => !open);
|
|
25
24
|
}, []);
|
|
26
25
|
(0, react_1.useEffect)(() => {
|
|
27
|
-
return
|
|
28
|
-
}, [
|
|
26
|
+
return Header_1.useHeaderActionStore.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: toggleDialog }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.DeleteOutline, {}) })));
|
|
27
|
+
}, [toggleDialog]);
|
|
29
28
|
if (!swaps.length) {
|
|
30
29
|
return (0, jsx_runtime_1.jsx)(SwapHistoryEmpty_1.SwapHistoryEmpty, {});
|
|
31
30
|
}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.SwapPage = void 0;
|
|
4
13
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -25,7 +34,7 @@ const SwapPage = () => {
|
|
|
25
34
|
navigateBack();
|
|
26
35
|
deleteRoute();
|
|
27
36
|
};
|
|
28
|
-
const handleSwapClick = () => {
|
|
37
|
+
const handleSwapClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
38
|
if (status === 'idle') {
|
|
30
39
|
executeRoute();
|
|
31
40
|
setValue(providers_1.SwapFormKey.FromAmount, '');
|
|
@@ -33,7 +42,7 @@ const SwapPage = () => {
|
|
|
33
42
|
if (status === 'error') {
|
|
34
43
|
restartRoute();
|
|
35
44
|
}
|
|
36
|
-
};
|
|
45
|
+
});
|
|
37
46
|
// eslint-disable-next-line consistent-return
|
|
38
47
|
const getSwapButtonText = () => {
|
|
39
48
|
if (status === 'idle') {
|
|
@@ -14,7 +14,6 @@ const SwapRoutesPage_style_1 = require("./SwapRoutesPage.style");
|
|
|
14
14
|
const SwapRoutesPage = () => {
|
|
15
15
|
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
16
16
|
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
17
|
-
const setHeaderAction = (0, Header_1.useSetHeaderAction)();
|
|
18
17
|
const { routes: swapRoutes, isLoading, isFetching, dataUpdatedAt, refetchTime, refetch, } = (0, hooks_1.useSwapRoutes)();
|
|
19
18
|
const setExecutableRoute = (0, stores_1.useSetExecutableRoute)();
|
|
20
19
|
const handleRouteClick = (route) => {
|
|
@@ -31,8 +30,10 @@ const SwapRoutesPage = () => {
|
|
|
31
30
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32
31
|
}, []);
|
|
33
32
|
(0, react_1.useEffect)(() => {
|
|
34
|
-
return
|
|
35
|
-
|
|
33
|
+
return Header_1.useHeaderActionStore
|
|
34
|
+
.getState()
|
|
35
|
+
.setAction((0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 }, size: "medium", edge: "end" }));
|
|
36
|
+
}, [dataUpdatedAt, isFetching, refetch, refetchTime]);
|
|
36
37
|
const routeNotFound = !(swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.length) && !isLoading && !isFetching;
|
|
37
38
|
return ((0, jsx_runtime_1.jsx)(SwapRoutesPage_style_1.Stack, Object.assign({ direction: "column", spacing: 2, flex: 1 }, { children: routeNotFound ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, {}, index)))) : (swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.map((route) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { route: route, onClick: () => handleRouteClick(route) }, route.id)))) })));
|
|
38
39
|
};
|
|
@@ -2,11 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SwapFormProvider = exports.formDefaultValues = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const sdk_1 = require("@lifi/sdk");
|
|
6
|
-
const react_1 = require("react");
|
|
7
5
|
const react_hook_form_1 = require("react-hook-form");
|
|
8
|
-
const chains_1 = require("../../stores/chains");
|
|
9
|
-
const WalletProvider_1 = require("../WalletProvider");
|
|
10
6
|
const WidgetProvider_1 = require("../WidgetProvider");
|
|
11
7
|
const types_1 = require("./types");
|
|
12
8
|
exports.formDefaultValues = {
|
|
@@ -15,65 +11,15 @@ exports.formDefaultValues = {
|
|
|
15
11
|
[types_1.SwapFormKey.TokenSearchFilter]: '',
|
|
16
12
|
};
|
|
17
13
|
const SwapFormProvider = ({ children, }) => {
|
|
18
|
-
const [setChain] = (0, chains_1.useSetChainOrder)();
|
|
19
|
-
const { account } = (0, WalletProvider_1.useWallet)();
|
|
20
14
|
const { fromChain, fromToken, fromAmount, toChain, toToken, toAddress } = (0, WidgetProvider_1.useWidgetConfig)();
|
|
21
15
|
const methods = (0, react_hook_form_1.useForm)({
|
|
22
|
-
defaultValues: Object.assign(Object.assign({}, exports.formDefaultValues), { fromChain
|
|
16
|
+
defaultValues: Object.assign(Object.assign({}, exports.formDefaultValues), { fromChain,
|
|
17
|
+
fromToken, fromAmount: (typeof fromAmount === 'number'
|
|
23
18
|
? fromAmount === null || fromAmount === void 0 ? void 0 : fromAmount.toPrecision()
|
|
24
|
-
: fromAmount) || exports.formDefaultValues.fromAmount, toChain
|
|
19
|
+
: fromAmount) || exports.formDefaultValues.fromAmount, toChain,
|
|
20
|
+
toToken,
|
|
25
21
|
toAddress }),
|
|
26
22
|
});
|
|
27
|
-
// Set wallet chain as default if no chains are provided by config and if they were not changed during widget usage
|
|
28
|
-
(0, react_1.useEffect)(() => {
|
|
29
|
-
if (!account.isActive || !account.chainId) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const [fromChainValue, toChainValue] = methods.getValues([
|
|
33
|
-
types_1.SwapFormKey.FromChain,
|
|
34
|
-
types_1.SwapFormKey.ToChain,
|
|
35
|
-
]);
|
|
36
|
-
const { isDirty: isFromChainDirty } = methods.getFieldState(types_1.SwapFormKey.FromChain, methods.formState);
|
|
37
|
-
const { isDirty: isToChainDirty } = methods.getFieldState(types_1.SwapFormKey.ToChain, methods.formState);
|
|
38
|
-
const { isDirty: isFromTokenDirty } = methods.getFieldState(types_1.SwapFormKey.FromToken, methods.formState);
|
|
39
|
-
const { isDirty: isToTokenDirty } = methods.getFieldState(types_1.SwapFormKey.ToToken, methods.formState);
|
|
40
|
-
// Users can switch chains in the wallet.
|
|
41
|
-
// If we don't have a chain in the ordered chain list we should add it.
|
|
42
|
-
setChain(account.chainId);
|
|
43
|
-
// If we ran out of slots for the ordered chain list and the current chain isn't there
|
|
44
|
-
// we should make a recently switched chain as current.
|
|
45
|
-
const { chainOrder } = chains_1.useChainOrderStore.getState();
|
|
46
|
-
const hasFromChainInOrderedList = chainOrder.includes(fromChainValue);
|
|
47
|
-
const hasToChainInOrderedList = chainOrder.includes(toChainValue);
|
|
48
|
-
if ((!fromChain && !isFromChainDirty && !isFromTokenDirty) ||
|
|
49
|
-
!hasFromChainInOrderedList) {
|
|
50
|
-
methods.setValue(types_1.SwapFormKey.FromChain, account.chainId, {
|
|
51
|
-
shouldDirty: false,
|
|
52
|
-
});
|
|
53
|
-
methods.setValue(types_1.SwapFormKey.FromToken, '', {
|
|
54
|
-
shouldDirty: false,
|
|
55
|
-
});
|
|
56
|
-
methods.setValue(types_1.SwapFormKey.FromAmount, '', {
|
|
57
|
-
shouldDirty: false,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
if ((!toChain && !isToChainDirty && !isToTokenDirty) ||
|
|
61
|
-
!hasToChainInOrderedList) {
|
|
62
|
-
methods.setValue(types_1.SwapFormKey.ToChain, account.chainId, {
|
|
63
|
-
shouldDirty: false,
|
|
64
|
-
});
|
|
65
|
-
methods.setValue(types_1.SwapFormKey.ToToken, '', {
|
|
66
|
-
shouldDirty: false,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}, [
|
|
70
|
-
account.chainId,
|
|
71
|
-
account.isActive,
|
|
72
|
-
fromChain,
|
|
73
|
-
methods,
|
|
74
|
-
setChain,
|
|
75
|
-
toChain,
|
|
76
|
-
]);
|
|
77
23
|
return (0, jsx_runtime_1.jsx)(react_hook_form_1.FormProvider, Object.assign({}, methods, { children: children }));
|
|
78
24
|
};
|
|
79
25
|
exports.SwapFormProvider = SwapFormProvider;
|
|
@@ -16,12 +16,12 @@ export declare type SwapFormValues = {
|
|
|
16
16
|
[SwapFormKey.ToToken]: string;
|
|
17
17
|
[SwapFormKey.ToAddress]: string;
|
|
18
18
|
};
|
|
19
|
-
export declare type
|
|
19
|
+
export declare type SwapFormType = 'from' | 'to';
|
|
20
20
|
export declare const SwapFormKeyHelper: {
|
|
21
|
-
getChainKey: (formType:
|
|
22
|
-
getTokenKey: (formType:
|
|
23
|
-
getAmountKey: (formType:
|
|
21
|
+
getChainKey: (formType: SwapFormType) => 'fromChain' | 'toChain';
|
|
22
|
+
getTokenKey: (formType: SwapFormType) => 'fromToken' | 'toToken';
|
|
23
|
+
getAmountKey: (formType: SwapFormType) => 'fromAmount' | 'toAmount';
|
|
24
24
|
};
|
|
25
25
|
export interface SwapFormTypeProps {
|
|
26
|
-
formType:
|
|
26
|
+
formType: SwapFormType;
|
|
27
27
|
}
|
|
@@ -13,6 +13,9 @@ exports.extractAccountFromSigner = exports.WalletProvider = exports.useWallet =
|
|
|
13
13
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
14
14
|
const wallet_management_1 = require("@lifi/wallet-management");
|
|
15
15
|
const react_1 = require("react");
|
|
16
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
17
|
+
const chains_1 = require("../../stores/chains");
|
|
18
|
+
const SwapFormProvider_1 = require("../SwapFormProvider");
|
|
16
19
|
const WidgetProvider_1 = require("../WidgetProvider");
|
|
17
20
|
const stub = () => {
|
|
18
21
|
throw new Error('You forgot to wrap your component in <WalletProvider>.');
|
|
@@ -29,7 +32,8 @@ const WalletContext = (0, react_1.createContext)(initialContext);
|
|
|
29
32
|
const useWallet = () => (0, react_1.useContext)(WalletContext);
|
|
30
33
|
exports.useWallet = useWallet;
|
|
31
34
|
const WalletProvider = ({ children }) => {
|
|
32
|
-
const { walletManagement } = (0, WidgetProvider_1.useWidgetConfig)();
|
|
35
|
+
const { walletManagement, fromChain, toChain, chains, disabledChains } = (0, WidgetProvider_1.useWidgetConfig)();
|
|
36
|
+
const methods = (0, react_hook_form_1.useFormContext)();
|
|
33
37
|
const { connect: walletManagementConnect, disconnect: walletManagementDisconnect, signer, provider, } = (0, wallet_management_1.useLiFiWalletManagement)();
|
|
34
38
|
const [account, setAccount] = (0, react_1.useState)({});
|
|
35
39
|
const connect = (0, react_1.useCallback)((wallet) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -94,6 +98,58 @@ const WalletProvider = ({ children }) => {
|
|
|
94
98
|
account,
|
|
95
99
|
provider,
|
|
96
100
|
}), [account, addChain, addToken, connect, disconnect, provider, switchChain]);
|
|
101
|
+
// Set wallet chain as default if no chains are provided by config and if they were not changed during widget usage
|
|
102
|
+
(0, react_1.useEffect)(() => {
|
|
103
|
+
const chainAllowed = account.chainId && (0, WidgetProvider_1.isItemAllowed)(account.chainId, chains, disabledChains);
|
|
104
|
+
if (!account.isActive || !account.chainId || !chainAllowed) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const [fromChainValue, toChainValue] = methods.getValues([
|
|
108
|
+
SwapFormProvider_1.SwapFormKey.FromChain,
|
|
109
|
+
SwapFormProvider_1.SwapFormKey.ToChain,
|
|
110
|
+
]);
|
|
111
|
+
const { isDirty: isFromChainDirty } = methods.getFieldState(SwapFormProvider_1.SwapFormKey.FromChain, methods.formState);
|
|
112
|
+
const { isDirty: isToChainDirty } = methods.getFieldState(SwapFormProvider_1.SwapFormKey.ToChain, methods.formState);
|
|
113
|
+
const { isDirty: isFromTokenDirty } = methods.getFieldState(SwapFormProvider_1.SwapFormKey.FromToken, methods.formState);
|
|
114
|
+
const { isDirty: isToTokenDirty } = methods.getFieldState(SwapFormProvider_1.SwapFormKey.ToToken, methods.formState);
|
|
115
|
+
const { chainOrder, setChain } = chains_1.useChainOrderStore.getState();
|
|
116
|
+
// Users can switch chains in the wallet.
|
|
117
|
+
// If we don't have a chain in the ordered chain list we should add it.
|
|
118
|
+
setChain(account.chainId);
|
|
119
|
+
// If we ran out of slots for the ordered chain list and the current chain isn't there
|
|
120
|
+
// we should make a recently switched chain as current.
|
|
121
|
+
const hasFromChainInOrderedList = chainOrder.includes(fromChainValue);
|
|
122
|
+
const hasToChainInOrderedList = chainOrder.includes(toChainValue);
|
|
123
|
+
if ((!fromChain && !isFromChainDirty && !isFromTokenDirty) ||
|
|
124
|
+
!hasFromChainInOrderedList) {
|
|
125
|
+
methods.setValue(SwapFormProvider_1.SwapFormKey.FromChain, account.chainId, {
|
|
126
|
+
shouldDirty: false,
|
|
127
|
+
});
|
|
128
|
+
methods.setValue(SwapFormProvider_1.SwapFormKey.FromToken, '', {
|
|
129
|
+
shouldDirty: false,
|
|
130
|
+
});
|
|
131
|
+
methods.setValue(SwapFormProvider_1.SwapFormKey.FromAmount, '', {
|
|
132
|
+
shouldDirty: false,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
if ((!toChain && !isToChainDirty && !isToTokenDirty) ||
|
|
136
|
+
!hasToChainInOrderedList) {
|
|
137
|
+
methods.setValue(SwapFormProvider_1.SwapFormKey.ToChain, account.chainId, {
|
|
138
|
+
shouldDirty: false,
|
|
139
|
+
});
|
|
140
|
+
methods.setValue(SwapFormProvider_1.SwapFormKey.ToToken, '', {
|
|
141
|
+
shouldDirty: false,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}, [
|
|
145
|
+
account.chainId,
|
|
146
|
+
account.isActive,
|
|
147
|
+
chains,
|
|
148
|
+
disabledChains,
|
|
149
|
+
fromChain,
|
|
150
|
+
methods,
|
|
151
|
+
toChain,
|
|
152
|
+
]);
|
|
97
153
|
return ((0, jsx_runtime_1.jsx)(WalletContext.Provider, Object.assign({ value: value }, { children: children })));
|
|
98
154
|
};
|
|
99
155
|
exports.WalletProvider = WalletProvider;
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./utils"), exports);
|
|
18
19
|
__exportStar(require("./WidgetProvider"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isItemAllowed = void 0;
|
|
4
|
+
const isItemAllowed = (chainId, chains,
|
|
5
|
+
/** @deprecated Remove in the next major release */
|
|
6
|
+
disabledChains) => {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
if ((_a = chains === null || chains === void 0 ? void 0 : chains.allow) === null || _a === void 0 ? void 0 : _a.length) {
|
|
9
|
+
return chains.allow.includes(chainId);
|
|
10
|
+
}
|
|
11
|
+
return !((disabledChains === null || disabledChains === void 0 ? void 0 : disabledChains.includes(chainId)) || ((_b = chains === null || chains === void 0 ? void 0 : chains.deny) === null || _b === void 0 ? void 0 : _b.includes(chainId)));
|
|
12
|
+
};
|
|
13
|
+
exports.isItemAllowed = isItemAllowed;
|
|
@@ -17,4 +17,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./types"), exports);
|
|
18
18
|
__exportStar(require("./useChainOrder"), exports);
|
|
19
19
|
__exportStar(require("./useChainOrderStore"), exports);
|
|
20
|
-
__exportStar(require("./useInitializeChainOrder"), exports);
|
|
@@ -9,22 +9,25 @@ const zustand_1 = __importDefault(require("zustand"));
|
|
|
9
9
|
const middleware_1 = require("zustand/middleware");
|
|
10
10
|
const immer_1 = require("zustand/middleware/immer");
|
|
11
11
|
exports.maxChainToOrder = 9;
|
|
12
|
-
exports.useChainOrderStore = (0, zustand_1.default)()((0, middleware_1.persist)((0, immer_1.immer)((set) => ({
|
|
12
|
+
exports.useChainOrderStore = (0, zustand_1.default)()((0, middleware_1.persist)((0, immer_1.immer)((set, get) => ({
|
|
13
13
|
chainOrder: [],
|
|
14
14
|
availableChains: [],
|
|
15
|
-
initializeChains: (chainIds) =>
|
|
16
|
-
state
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
initializeChains: (chainIds) => {
|
|
16
|
+
set((state) => {
|
|
17
|
+
state.availableChains = chainIds;
|
|
18
|
+
state.chainOrder = state.chainOrder.filter((chainId) => chainIds.includes(chainId));
|
|
19
|
+
const chainsToAdd = chainIds.filter((chainId) => !state.chainOrder.includes(chainId));
|
|
20
|
+
if (state.chainOrder.length === exports.maxChainToOrder ||
|
|
21
|
+
!chainsToAdd.length) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const chainsToAddLength = exports.maxChainToOrder - state.chainOrder.length;
|
|
25
|
+
for (let index = 0; index < chainsToAddLength; index++) {
|
|
26
|
+
state.chainOrder.push(chainsToAdd[index]);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return get().chainOrder;
|
|
30
|
+
},
|
|
28
31
|
setChain: (chainId) => set((state) => {
|
|
29
32
|
if (state.chainOrder.includes(chainId) ||
|
|
30
33
|
!state.availableChains.includes(chainId)) {
|
|
@@ -16,6 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./types"), exports);
|
|
18
18
|
__exportStar(require("./useAppearance"), exports);
|
|
19
|
-
__exportStar(require("./useSetSettings"), exports);
|
|
20
19
|
__exportStar(require("./useSettings"), exports);
|
|
21
20
|
__exportStar(require("./useSettingsStore"), exports);
|
|
@@ -8,7 +8,9 @@ const shallow_1 = __importDefault(require("zustand/shallow"));
|
|
|
8
8
|
const useSettingsStore_1 = require("./useSettingsStore");
|
|
9
9
|
const useAppearance = () => {
|
|
10
10
|
const [appearance, setValue] = (0, useSettingsStore_1.useSettingsStore)((state) => [state.appearance, state.setValue], shallow_1.default);
|
|
11
|
-
const setAppearance = (appearance) =>
|
|
11
|
+
const setAppearance = (appearance) => {
|
|
12
|
+
setValue('appearance', appearance);
|
|
13
|
+
};
|
|
12
14
|
return [appearance, setAppearance];
|
|
13
15
|
};
|
|
14
16
|
exports.useAppearance = useAppearance;
|
package/cjs/types/widget.d.ts
CHANGED
|
@@ -17,33 +17,40 @@ export interface WidgetWalletManagement {
|
|
|
17
17
|
addChain?(chainId: number): Promise<boolean>;
|
|
18
18
|
signer?: Signer;
|
|
19
19
|
}
|
|
20
|
-
interface
|
|
21
|
-
|
|
20
|
+
export interface WidgetConfig {
|
|
21
|
+
fromChain?: `${ChainKey}` | number;
|
|
22
|
+
toChain?: `${ChainKey}` | number;
|
|
23
|
+
fromToken?: string;
|
|
24
|
+
toToken?: string;
|
|
22
25
|
toAddress?: string;
|
|
23
|
-
|
|
24
|
-
theme?: ThemeConfig;
|
|
26
|
+
fromAmount?: number | string;
|
|
25
27
|
appearance?: Appearance;
|
|
28
|
+
theme?: ThemeConfig;
|
|
29
|
+
containerStyle?: CSSProperties;
|
|
26
30
|
disableAppearance?: boolean;
|
|
27
31
|
disableTelemetry?: boolean;
|
|
28
|
-
|
|
29
|
-
integrator?: string;
|
|
32
|
+
/** @deprecated Use chains.deny instead */
|
|
30
33
|
disabledChains?: number[];
|
|
34
|
+
/** @deprecated Use tokens.featured instead */
|
|
31
35
|
featuredTokens?: Token[];
|
|
36
|
+
integrator?: string;
|
|
37
|
+
walletManagement?: WidgetWalletManagement;
|
|
32
38
|
sdkConfig?: ConfigUpdate;
|
|
39
|
+
bridges?: {
|
|
40
|
+
allow?: string[];
|
|
41
|
+
deny?: string[];
|
|
42
|
+
};
|
|
43
|
+
exchanges?: {
|
|
44
|
+
allow?: string[];
|
|
45
|
+
deny?: string[];
|
|
46
|
+
};
|
|
47
|
+
chains?: {
|
|
48
|
+
allow?: number[];
|
|
49
|
+
deny?: number[];
|
|
50
|
+
};
|
|
51
|
+
tokens?: {
|
|
52
|
+
featured?: Token[];
|
|
53
|
+
allow?: Token[];
|
|
54
|
+
deny?: (Partial<Token> & Pick<Token, 'address' | 'chainId'>)[];
|
|
55
|
+
};
|
|
33
56
|
}
|
|
34
|
-
declare type WidgetFromTokenConfig = {
|
|
35
|
-
fromChain: `${ChainKey}` | number;
|
|
36
|
-
fromToken?: string;
|
|
37
|
-
} | {
|
|
38
|
-
fromChain?: never;
|
|
39
|
-
fromToken?: never;
|
|
40
|
-
};
|
|
41
|
-
declare type WidgetToTokenConfig = {
|
|
42
|
-
toChain: `${ChainKey}` | number;
|
|
43
|
-
toToken?: string;
|
|
44
|
-
} | {
|
|
45
|
-
toChain?: never;
|
|
46
|
-
toToken?: never;
|
|
47
|
-
};
|
|
48
|
-
export declare type WidgetConfig = WidgetConfigBase & WidgetFromTokenConfig & WidgetToTokenConfig;
|
|
49
|
-
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Box } from '@mui/material';
|
|
2
2
|
import { styled } from '@mui/material/styles';
|
|
3
3
|
import { Card } from '../../components/Card';
|
|
4
|
-
export const ChainCard = styled(Card)(
|
|
4
|
+
export const ChainCard = styled(Card)({
|
|
5
5
|
display: 'grid',
|
|
6
6
|
placeItems: 'center',
|
|
7
|
-
|
|
7
|
+
minWidth: 56,
|
|
8
8
|
height: 56,
|
|
9
|
-
})
|
|
9
|
+
});
|
|
10
10
|
export const ChainContainer = styled(Box)(({ theme }) => ({
|
|
11
11
|
display: 'grid',
|
|
12
|
-
gridTemplateColumns: 'repeat(auto-fit, 56px)',
|
|
12
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(56px, 1fr))',
|
|
13
13
|
gridAutoRows: '56px',
|
|
14
14
|
justifyContent: 'space-between',
|
|
15
15
|
gap: theme.spacing(1.5),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EVMChain } from '@lifi/sdk';
|
|
2
|
-
import type {
|
|
3
|
-
export declare const useChainSelect: (formType:
|
|
2
|
+
import type { SwapFormType } from '../../providers';
|
|
3
|
+
export declare const useChainSelect: (formType: SwapFormType) => {
|
|
4
4
|
chains: EVMChain[] | undefined;
|
|
5
5
|
getChains: () => EVMChain[];
|
|
6
6
|
setCurrentChain: (chainId: number) => void;
|
|
@@ -20,15 +20,15 @@ export const GasSufficiencyMessage = (_a) => {
|
|
|
20
20
|
var { route } = _a, props = __rest(_a, ["route"]);
|
|
21
21
|
const { t } = useTranslation();
|
|
22
22
|
const { insufficientFunds, insufficientGas } = useGasSufficiency(route);
|
|
23
|
-
if (!insufficientFunds && !insufficientGas.length) {
|
|
23
|
+
if (!insufficientFunds && !(insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length)) {
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
26
|
return (_jsxs(MessageCard, Object.assign({}, props, { children: [_jsx(WarningIcon, { sx: {
|
|
27
27
|
marginTop: 2,
|
|
28
28
|
marginLeft: 2,
|
|
29
|
-
} }), _jsxs(Box, { children: [insufficientGas.length ? (_jsx(CardTitle, { children: t(`swap.warning.title.insufficientGas`) })) : null, insufficientFunds ? (_jsx(Typography, Object.assign({ variant: "body2", px: 2, pb: insufficientGas.length ? 0 : 2, pt: insufficientGas.length ? 1 : 2 }, { children: insufficientFunds
|
|
29
|
+
} }), _jsxs(Box, { children: [(insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? (_jsx(CardTitle, { children: t(`swap.warning.title.insufficientGas`) })) : null, insufficientFunds ? (_jsx(Typography, Object.assign({ variant: "body2", px: 2, pb: (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? 0 : 2, pt: (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? 1 : 2 }, { children: insufficientFunds
|
|
30
30
|
? t(`swap.warning.message.insufficientFunds`)
|
|
31
|
-
: null }))) : null, insufficientGas.length ? (_jsx(Typography, Object.assign({ variant: "body2", px: 2, pt: 1 }, { children: t(`swap.warning.message.insufficientGas`) }))) : null, insufficientGas.length
|
|
31
|
+
: null }))) : null, (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? (_jsx(Typography, Object.assign({ variant: "body2", px: 2, pt: 1 }, { children: t(`swap.warning.message.insufficientGas`) }))) : null, (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length)
|
|
32
32
|
? insufficientGas.map((item, index) => {
|
|
33
33
|
var _a, _b;
|
|
34
34
|
return (_jsx(Typography, Object.assign({ variant: "body2", px: 2, pb: insufficientGas.length - 1 === index ? 2 : 0, pt: 0.5 }, { children: t(`swap.tokenOnChainAmount`, {
|