@lifi/widget 1.17.2 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.js +6 -86
- package/AppDrawer.js +3 -2
- package/AppRoutes.d.ts +2 -0
- package/AppRoutes.js +85 -0
- package/cjs/App.js +5 -85
- package/cjs/AppDrawer.js +2 -1
- package/cjs/AppRoutes.d.ts +2 -0
- package/cjs/AppRoutes.js +89 -0
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -0
- package/cjs/components/AppContainer.d.ts +4 -5
- package/cjs/components/AppContainer.js +30 -29
- package/cjs/components/Card/Card.d.ts +1 -0
- package/cjs/components/Card/Card.js +13 -9
- package/cjs/components/ChainSelect/ChainSelect.d.ts +1 -0
- package/cjs/components/ChainSelect/ChainSelect.js +3 -3
- package/cjs/components/ChainSelect/ChainSelect.style.d.ts +1 -0
- package/cjs/components/ChainSelect/ChainSelect.style.js +2 -2
- package/cjs/components/ChainSelect/useChainSelect.js +2 -2
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +6 -2
- package/cjs/components/Header/Header.d.ts +2 -1
- package/cjs/components/Header/Header.js +3 -2
- package/cjs/components/Header/Header.style.js +3 -2
- package/cjs/components/Header/NavigationHeader.js +4 -1
- package/cjs/components/Header/WalletHeader.js +1 -1
- package/cjs/components/PoweredBy/PoweredBy.js +7 -0
- package/cjs/components/SendToWallet/SendToWallet.js +6 -10
- package/cjs/components/SendToWallet/SendToWalletButton.d.ts +2 -0
- package/cjs/components/SendToWallet/SendToWalletButton.js +24 -0
- package/cjs/components/SendToWallet/index.d.ts +1 -0
- package/cjs/components/SendToWallet/index.js +1 -0
- package/cjs/components/SendToWallet/store.d.ts +4 -0
- package/cjs/components/SendToWallet/store.js +13 -0
- package/cjs/components/SendToWallet/types.d.ts +6 -0
- package/cjs/{stores/route → components/SendToWallet}/types.js +0 -0
- package/cjs/components/Step/CircularProgress.d.ts +1 -0
- package/cjs/components/StepActions/StepActions.style.js +1 -1
- package/cjs/components/SwapButton/ButtonTooltip.d.ts +1 -0
- package/cjs/components/SwapButton/SwapButton.d.ts +1 -1
- package/cjs/components/SwapButton/SwapButton.js +4 -4
- package/cjs/components/SwapInput/SwapInputAdornment.d.ts +1 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.d.ts +2 -1
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +19 -15
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +30 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +16 -3
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -12
- package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +1 -3
- package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -13
- package/cjs/components/SwapRouteCard/types.d.ts +6 -2
- package/cjs/{pages/MainPage → components/SwapRoutes}/SwapRoutes.d.ts +0 -0
- package/cjs/components/SwapRoutes/SwapRoutes.js +51 -0
- package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +43 -0
- package/cjs/components/SwapRoutes/SwapRoutes.style.js +47 -0
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -0
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +38 -0
- package/cjs/components/SwapRoutes/index.d.ts +2 -0
- package/cjs/components/SwapRoutes/index.js +18 -0
- package/cjs/components/Token/Token.d.ts +2 -1
- package/cjs/components/Token/Token.js +10 -6
- package/cjs/components/Token/Token.style.js +2 -0
- package/cjs/config/theme.js +20 -24
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useChains.js +2 -2
- package/cjs/hooks/useNavigateBack.js +13 -6
- package/cjs/hooks/useRouteExecution.js +4 -4
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/cjs/pages/MainPage/MainPage.js +4 -2
- package/cjs/pages/MainPage/MainSwapButton.js +4 -4
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
- package/cjs/pages/SelectTokenPage/SelectTokenPage.js +4 -3
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
- package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +1 -0
- package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +1 -0
- package/cjs/pages/SettingsPage/SettingsPage.d.ts +1 -0
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -0
- package/cjs/pages/SettingsPage/SlippageInput.d.ts +1 -0
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +1 -1
- package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.js +1 -0
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +8 -5
- package/cjs/pages/SwapPage/SwapPage.js +5 -1
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
- package/cjs/providers/WalletProvider/WalletProvider.js +2 -2
- package/cjs/stores/index.d.ts +2 -1
- package/cjs/stores/index.js +2 -1
- package/cjs/stores/{route → routes}/index.d.ts +2 -1
- package/cjs/stores/{route → routes}/index.js +2 -1
- package/cjs/stores/{route → routes}/types.d.ts +4 -0
- package/cjs/stores/routes/types.js +2 -0
- package/cjs/stores/{route → routes}/useExecutingRoutesIds.d.ts +0 -0
- package/cjs/stores/{route → routes}/useExecutingRoutesIds.js +2 -2
- package/cjs/stores/{route/useRouteStore.d.ts → routes/useRouteExecutionStore.d.ts} +1 -1
- package/cjs/stores/{route/useRouteStore.js → routes/useRouteExecutionStore.js} +2 -2
- package/cjs/stores/routes/useSelectedRouteStore.d.ts +4 -0
- package/cjs/stores/routes/useSelectedRouteStore.js +12 -0
- package/cjs/stores/{route → routes}/useSetExecutableRoute.d.ts +0 -0
- package/cjs/stores/{route → routes}/useSetExecutableRoute.js +2 -2
- package/cjs/stores/{route → routes}/useSwapHistory.d.ts +0 -0
- package/cjs/stores/{route → routes}/useSwapHistory.js +2 -2
- package/cjs/stores/{route → routes}/utils.d.ts +0 -0
- package/cjs/stores/{route → routes}/utils.js +0 -0
- package/cjs/stores/settings/useSettingsStore.js +1 -1
- package/cjs/types/widget.d.ts +2 -0
- package/cjs/utils/colors.d.ts +1 -1
- package/cjs/utils/navigationRoutes.js +12 -12
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -0
- package/components/AppContainer.d.ts +4 -5
- package/components/AppContainer.js +29 -28
- package/components/Card/Card.d.ts +1 -0
- package/components/Card/Card.js +13 -9
- package/components/ChainSelect/ChainSelect.d.ts +1 -0
- package/components/ChainSelect/ChainSelect.js +1 -1
- package/components/ChainSelect/ChainSelect.style.d.ts +1 -0
- package/components/ChainSelect/ChainSelect.style.js +2 -2
- package/components/ChainSelect/useChainSelect.js +1 -1
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +6 -2
- package/components/Header/Header.d.ts +2 -1
- package/components/Header/Header.js +1 -1
- package/components/Header/Header.style.js +4 -3
- package/components/Header/NavigationHeader.js +4 -1
- package/components/Header/WalletHeader.js +2 -2
- package/components/PoweredBy/PoweredBy.js +7 -0
- package/components/SendToWallet/SendToWallet.js +8 -11
- package/components/SendToWallet/SendToWalletButton.d.ts +2 -0
- package/components/SendToWallet/SendToWalletButton.js +20 -0
- package/components/SendToWallet/index.d.ts +1 -0
- package/components/SendToWallet/index.js +1 -0
- package/components/SendToWallet/store.d.ts +4 -0
- package/components/SendToWallet/store.js +10 -0
- package/components/SendToWallet/types.d.ts +6 -0
- package/{stores/route → components/SendToWallet}/types.js +0 -0
- package/components/Step/CircularProgress.d.ts +1 -0
- package/components/StepActions/StepActions.style.js +1 -1
- package/components/SwapButton/ButtonTooltip.d.ts +1 -0
- package/components/SwapButton/SwapButton.d.ts +1 -1
- package/components/SwapButton/SwapButton.js +4 -3
- package/components/SwapInput/SwapInputAdornment.d.ts +1 -0
- package/components/SwapRouteCard/SwapRouteCard.d.ts +2 -1
- package/components/SwapRouteCard/SwapRouteCard.js +19 -16
- package/components/SwapRouteCard/SwapRouteCard.style.d.ts +30 -0
- package/components/SwapRouteCard/SwapRouteCard.style.js +17 -4
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -12
- package/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +1 -3
- package/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -13
- package/components/SwapRouteCard/types.d.ts +6 -2
- package/{pages/MainPage → components/SwapRoutes}/SwapRoutes.d.ts +0 -0
- package/components/SwapRoutes/SwapRoutes.js +47 -0
- package/components/SwapRoutes/SwapRoutes.style.d.ts +43 -0
- package/components/SwapRoutes/SwapRoutes.style.js +44 -0
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -0
- package/components/SwapRoutes/SwapRoutesExpanded.js +34 -0
- package/components/SwapRoutes/index.d.ts +2 -0
- package/components/SwapRoutes/index.js +2 -0
- package/components/Token/Token.d.ts +2 -1
- package/components/Token/Token.js +11 -7
- package/components/Token/Token.style.js +2 -0
- package/config/theme.js +20 -24
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useChains.js +1 -1
- package/hooks/useNavigateBack.js +13 -6
- package/hooks/useRouteExecution.js +5 -5
- package/package.json +11 -11
- package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -0
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/pages/MainPage/MainPage.js +4 -2
- package/pages/MainPage/MainSwapButton.js +4 -3
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
- package/pages/SelectTokenPage/SelectTokenPage.js +4 -3
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
- package/pages/SettingsPage/AdvancedPreferences.d.ts +1 -0
- package/pages/SettingsPage/GasPriceSelect.d.ts +1 -0
- package/pages/SettingsPage/SettingsPage.d.ts +1 -0
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -0
- package/pages/SettingsPage/SlippageInput.d.ts +1 -0
- package/pages/SwapDetailsPage/SwapDetailsPage.js +2 -2
- package/pages/SwapHistoryPage/SwapHistoryEmpty.js +1 -0
- package/pages/SwapHistoryPage/SwapHistoryPage.js +8 -5
- package/pages/SwapPage/SwapPage.js +5 -1
- package/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
- package/providers/WalletProvider/WalletProvider.js +1 -1
- package/stores/index.d.ts +2 -1
- package/stores/index.js +2 -1
- package/stores/{route → routes}/index.d.ts +2 -1
- package/stores/{route → routes}/index.js +2 -1
- package/stores/{route → routes}/types.d.ts +4 -0
- package/stores/routes/types.js +1 -0
- package/stores/{route → routes}/useExecutingRoutesIds.d.ts +0 -0
- package/stores/{route → routes}/useExecutingRoutesIds.js +2 -2
- package/stores/{route/useRouteStore.d.ts → routes/useRouteExecutionStore.d.ts} +1 -1
- package/stores/{route/useRouteStore.js → routes/useRouteExecutionStore.js} +1 -1
- package/stores/routes/useSelectedRouteStore.d.ts +4 -0
- package/stores/routes/useSelectedRouteStore.js +9 -0
- package/stores/{route → routes}/useSetExecutableRoute.d.ts +0 -0
- package/stores/routes/useSetExecutableRoute.js +4 -0
- package/stores/{route → routes}/useSwapHistory.d.ts +0 -0
- package/stores/{route → routes}/useSwapHistory.js +2 -2
- package/stores/{route → routes}/utils.d.ts +0 -0
- package/stores/{route → routes}/utils.js +0 -0
- package/stores/settings/useSettingsStore.js +1 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/widget.d.ts +2 -0
- package/utils/colors.d.ts +1 -1
- package/utils/navigationRoutes.js +12 -12
- package/cjs/pages/MainPage/SwapRoutes.js +0 -43
- package/cjs/pages/MainPage/SwapRoutes.style.d.ts +0 -11
- package/cjs/pages/MainPage/SwapRoutes.style.js +0 -16
- package/pages/MainPage/SwapRoutes.js +0 -39
- package/pages/MainPage/SwapRoutes.style.d.ts +0 -11
- package/pages/MainPage/SwapRoutes.style.js +0 -13
- package/stores/route/useSetExecutableRoute.js +0 -4
|
@@ -10,22 +10,26 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { Box } from '@mui/material';
|
|
13
|
+
import { Box, Typography } from '@mui/material';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useChains } from '../../hooks';
|
|
16
16
|
import { formatTokenAmount } from '../../utils';
|
|
17
|
+
import { SmallAvatar } from '../SmallAvatar';
|
|
17
18
|
import { TextFitter } from '../TextFitter';
|
|
18
19
|
import { TokenAvatar } from '../TokenAvatar';
|
|
19
20
|
import { TextSecondary } from './Token.style';
|
|
20
21
|
export const Token = (_a) => {
|
|
21
22
|
var _b;
|
|
22
|
-
var { token, connected } = _a, other = __rest(_a, ["token", "connected"]);
|
|
23
|
+
var { token, connected, step } = _a, other = __rest(_a, ["token", "connected", "step"]);
|
|
23
24
|
const { t } = useTranslation();
|
|
24
25
|
const { getChainById } = useChains();
|
|
25
|
-
return (_jsxs(Box, Object.assign({ flex: 1 }, other, { children: [_jsxs(Box, Object.assign({ display: "flex", flex: 1 }, { children: [_jsx(TokenAvatar, { token: token, sx: { marginRight: 2 } }), _jsx(TextFitter, Object.assign({ height:
|
|
26
|
+
return (_jsxs(Box, Object.assign({ flex: 1 }, other, { children: [_jsxs(Box, Object.assign({ display: "flex", flex: 1, alignItems: "center" }, { children: [_jsx(TokenAvatar, { token: token, sx: { marginRight: 2 } }), _jsx(TextFitter, Object.assign({ height: 30, textStyle: {
|
|
26
27
|
fontWeight: 700,
|
|
27
|
-
} }, { children: formatTokenAmount(token.amount, token.decimals) }))] })), _jsx(TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
} }, { children: formatTokenAmount(token.amount, token.decimals) }))] })), _jsxs(Box, Object.assign({ display: "flex" }, { children: [_jsx(TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
|
|
29
|
+
tokenSymbol: token.symbol,
|
|
30
|
+
chainName: (_b = getChainById(token.chainId)) === null || _b === void 0 ? void 0 : _b.name,
|
|
31
|
+
}) })), step ? (_jsxs(Box, Object.assign({ display: "flex", alignItems: "flex-end", height: 12, mt: 0.5 }, { children: [_jsx(Typography, Object.assign({ fontSize: 12, lineHeight: 1, fontWeight: 500, color: "text.secondary", px: 1 }, { children: "\u2022" })), _jsx(Box, Object.assign({ pr: 0.75 }, { children: _jsx(SmallAvatar, Object.assign({ src: step.toolDetails.logoURI, alt: step.toolDetails.name, sx: {
|
|
32
|
+
border: 0,
|
|
33
|
+
marginBottom: -0.25,
|
|
34
|
+
} }, { children: step.toolDetails.name[0] })) })), _jsx(Typography, Object.assign({ fontSize: 12, lineHeight: 1, fontWeight: 500, color: "text.secondary" }, { children: step.toolDetails.name }))] }))) : null] }))] })));
|
|
31
35
|
};
|
|
@@ -18,6 +18,8 @@ export const TextSecondary = styled(Typography, {
|
|
|
18
18
|
padding: connected
|
|
19
19
|
? theme.spacing(0, 0, 0, 3.875)
|
|
20
20
|
: theme.spacing(0, 0, 0, 0),
|
|
21
|
+
display: 'flex',
|
|
22
|
+
alignItems: 'flex-start',
|
|
21
23
|
}));
|
|
22
24
|
export const TokenDivider = styled(Box)(({ theme }) => ({
|
|
23
25
|
height: 12,
|
package/config/theme.js
CHANGED
|
@@ -25,6 +25,17 @@ const palette = {
|
|
|
25
25
|
main: '#297EFF',
|
|
26
26
|
},
|
|
27
27
|
};
|
|
28
|
+
const paletteLight = {
|
|
29
|
+
text: {
|
|
30
|
+
primary: '#000000',
|
|
31
|
+
secondary: '#747474',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
const paletteDark = {
|
|
35
|
+
background: {
|
|
36
|
+
paper: '#212121',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
28
39
|
const shape = {
|
|
29
40
|
borderRadius: 12,
|
|
30
41
|
borderRadiusSecondary: 6,
|
|
@@ -44,27 +55,7 @@ export const createTheme = (mode, theme = {}) => {
|
|
|
44
55
|
main: (_m = (_l = (_k = theme.palette) === null || _k === void 0 ? void 0 : _k.secondary) === null || _l === void 0 ? void 0 : _l.main) !== null && _m !== void 0 ? _m : palette.secondary.main,
|
|
45
56
|
light: lighten((_q = (_p = (_o = theme.palette) === null || _o === void 0 ? void 0 : _o.secondary) === null || _p === void 0 ? void 0 : _p.main) !== null && _q !== void 0 ? _q : palette.secondary.main, 0.5),
|
|
46
57
|
dark: darken((_t = (_s = (_r = theme.palette) === null || _r === void 0 ? void 0 : _r.secondary) === null || _s === void 0 ? void 0 : _s.main) !== null && _t !== void 0 ? _t : palette.secondary.main, 0.2),
|
|
47
|
-
} }), (mode === 'light'
|
|
48
|
-
? {
|
|
49
|
-
text: {
|
|
50
|
-
primary: '#000',
|
|
51
|
-
secondary: '#52575b',
|
|
52
|
-
},
|
|
53
|
-
grey: {
|
|
54
|
-
100: '#F4F5F6',
|
|
55
|
-
200: '#EFF1F2',
|
|
56
|
-
300: '#E3E7E9',
|
|
57
|
-
400: '#C6C9CD',
|
|
58
|
-
500: '#AEB3B7',
|
|
59
|
-
600: '#798086',
|
|
60
|
-
700: '#57595C',
|
|
61
|
-
},
|
|
62
|
-
}
|
|
63
|
-
: {
|
|
64
|
-
background: {
|
|
65
|
-
paper: '#212121',
|
|
66
|
-
},
|
|
67
|
-
})),
|
|
58
|
+
} }), (mode === 'light' ? paletteLight : paletteDark)),
|
|
68
59
|
shape: Object.assign(Object.assign({}, shape), theme.shape),
|
|
69
60
|
breakpoints: {
|
|
70
61
|
values: {
|
|
@@ -96,6 +87,11 @@ export const createTheme = (mode, theme = {}) => {
|
|
|
96
87
|
cursor: 'not-allowed',
|
|
97
88
|
pointerEvents: 'auto',
|
|
98
89
|
},
|
|
90
|
+
}, text: {
|
|
91
|
+
backgroundColor: alpha(primaryMainColor, 0.08),
|
|
92
|
+
'&:hover': {
|
|
93
|
+
backgroundColor: alpha(primaryMainColor, 0.12),
|
|
94
|
+
},
|
|
99
95
|
}, contained: {
|
|
100
96
|
'&:hover': {
|
|
101
97
|
color: getContrastRatio(common.white, primaryMainColor) >= 3
|
|
@@ -118,10 +114,10 @@ export const createTheme = (mode, theme = {}) => {
|
|
|
118
114
|
},
|
|
119
115
|
},
|
|
120
116
|
text: {
|
|
121
|
-
|
|
117
|
+
backgroundColor: paletteDark.background.paper,
|
|
118
|
+
color: common.white,
|
|
122
119
|
'&:hover': {
|
|
123
|
-
backgroundColor:
|
|
124
|
-
borderColor: primaryLightColor,
|
|
120
|
+
backgroundColor: lighten(paletteDark.background.paper, 0.02),
|
|
125
121
|
},
|
|
126
122
|
},
|
|
127
123
|
}
|
package/config/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "1.
|
|
2
|
+
export declare const version = "1.18.0";
|
package/config/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget';
|
|
2
|
-
export const version = '1.
|
|
2
|
+
export const version = '1.18.0';
|
package/hooks/useChains.js
CHANGED
|
@@ -11,7 +11,7 @@ import { useQuery } from '@tanstack/react-query';
|
|
|
11
11
|
import { useCallback } from 'react';
|
|
12
12
|
import { useFormContext } from 'react-hook-form';
|
|
13
13
|
import { isItemAllowed, SwapFormKey, useLiFi, useWidgetConfig, } from '../providers';
|
|
14
|
-
import { useChainOrderStore } from '../stores
|
|
14
|
+
import { useChainOrderStore } from '../stores';
|
|
15
15
|
export const useChains = () => {
|
|
16
16
|
const { disabledChains, chains } = useWidgetConfig();
|
|
17
17
|
const lifi = useLiFi();
|
package/hooks/useNavigateBack.js
CHANGED
|
@@ -3,12 +3,19 @@ import { useNavigate } from 'react-router-dom';
|
|
|
3
3
|
export const useNavigateBack = () => {
|
|
4
4
|
const navigate = useNavigate();
|
|
5
5
|
const navigateBack = useCallback(() => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
// https://github.com/remix-run/react-router/pull/9112
|
|
7
|
+
//
|
|
8
|
+
// if (window.history.length > 2) {
|
|
9
|
+
navigate(-1);
|
|
10
|
+
// } else {
|
|
11
|
+
// navigate(
|
|
12
|
+
// window.location.pathname.substring(
|
|
13
|
+
// 0,
|
|
14
|
+
// window.location.pathname.lastIndexOf('/'),
|
|
15
|
+
// ) || '/',
|
|
16
|
+
// { replace: true },
|
|
17
|
+
// );
|
|
18
|
+
// }
|
|
12
19
|
}, [navigate]);
|
|
13
20
|
return { navigateBack, navigate };
|
|
14
21
|
};
|
|
@@ -11,7 +11,7 @@ import { useMutation } from '@tanstack/react-query';
|
|
|
11
11
|
import { useCallback, useEffect, useRef } from 'react';
|
|
12
12
|
import shallow from 'zustand/shallow';
|
|
13
13
|
import { useLiFi, useWallet } from '../providers';
|
|
14
|
-
import { getUpdatedProcess, isRouteActive, isRouteCompleted, isRouteFailed,
|
|
14
|
+
import { getUpdatedProcess, isRouteActive, isRouteCompleted, isRouteFailed, useRouteExecutionStore, } from '../stores';
|
|
15
15
|
import { WidgetEvent } from '../types/events';
|
|
16
16
|
import { deepClone } from '../utils';
|
|
17
17
|
import { useWidgetEvents } from './useWidgetEvents';
|
|
@@ -20,10 +20,10 @@ export const useRouteExecution = (routeId, executeInBackground) => {
|
|
|
20
20
|
const { account, switchChain } = useWallet();
|
|
21
21
|
const resumedAfterMount = useRef(false);
|
|
22
22
|
const emitter = useWidgetEvents();
|
|
23
|
-
const routeExecution =
|
|
24
|
-
const [updateRoute, restartRoute, deleteRoute] =
|
|
23
|
+
const routeExecution = useRouteExecutionStore((state) => state.routes[routeId]);
|
|
24
|
+
const [updateRoute, restartRoute, deleteRoute] = useRouteExecutionStore((state) => [state.updateRoute, state.restartRoute, state.deleteRoute], shallow);
|
|
25
25
|
const updateCallback = (updatedRoute) => {
|
|
26
|
-
const routeExecution =
|
|
26
|
+
const routeExecution = useRouteExecutionStore.getState().routes[updatedRoute.id];
|
|
27
27
|
if (!routeExecution) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
@@ -144,7 +144,7 @@ export const useRouteExecution = (routeId, executeInBackground) => {
|
|
|
144
144
|
useEffect(() => {
|
|
145
145
|
return () => {
|
|
146
146
|
var _a;
|
|
147
|
-
const route = (_a =
|
|
147
|
+
const route = (_a = useRouteExecutionStore.getState().routes[routeId]) === null || _a === void 0 ? void 0 : _a.route;
|
|
148
148
|
if (!route || !isRouteActive(route)) {
|
|
149
149
|
return;
|
|
150
150
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.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
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -44,24 +44,24 @@
|
|
|
44
44
|
"@ethersproject/providers": "^5.7.1",
|
|
45
45
|
"@lifi/sdk": "^1.6.0",
|
|
46
46
|
"@lifi/wallet-management": "^1.1.10",
|
|
47
|
-
"@mui/icons-material": "^5.10.
|
|
48
|
-
"@mui/lab": "^5.0.0-alpha.
|
|
49
|
-
"@mui/material": "^5.10.
|
|
50
|
-
"@sentry/integrations": "^7.
|
|
51
|
-
"@sentry/react": "^7.
|
|
52
|
-
"@sentry/tracing": "^7.
|
|
53
|
-
"@tanstack/react-query": "^4.3.
|
|
47
|
+
"@mui/icons-material": "^5.10.6",
|
|
48
|
+
"@mui/lab": "^5.0.0-alpha.100",
|
|
49
|
+
"@mui/material": "^5.10.6",
|
|
50
|
+
"@sentry/integrations": "^7.13.0",
|
|
51
|
+
"@sentry/react": "^7.13.0",
|
|
52
|
+
"@sentry/tracing": "^7.13.0",
|
|
53
|
+
"@tanstack/react-query": "^4.3.9",
|
|
54
54
|
"@tanstack/react-virtual": "^3.0.0-beta.18",
|
|
55
55
|
"big.js": "^6.2.1",
|
|
56
|
-
"i18next": "^21.9.
|
|
56
|
+
"i18next": "^21.9.2",
|
|
57
57
|
"immer": "^9.0.15",
|
|
58
58
|
"microdiff": "^1.3.1",
|
|
59
59
|
"mitt": "^3.0.0",
|
|
60
60
|
"react": "^18.2.0",
|
|
61
61
|
"react-dom": "^18.2.0",
|
|
62
|
-
"react-hook-form": "^7.
|
|
62
|
+
"react-hook-form": "^7.36.0",
|
|
63
63
|
"react-i18next": "^11.18.6",
|
|
64
|
-
"react-router-dom": "^6.4.
|
|
64
|
+
"react-router-dom": "^6.4.1",
|
|
65
65
|
"react-timer-hook": "^3.0.5",
|
|
66
66
|
"zustand": "^4.1.1"
|
|
67
67
|
},
|
|
@@ -10,5 +10,6 @@ export const ActiveSwapsEmpty = () => {
|
|
|
10
10
|
flexDirection: 'column',
|
|
11
11
|
alignItems: 'center',
|
|
12
12
|
justifyContent: 'center',
|
|
13
|
+
paddingY: 12,
|
|
13
14
|
} }, { children: [_jsx(Typography, Object.assign({ fontSize: 48 }, { children: _jsx(SwapHorizIcon, { fontSize: "inherit" }) })), _jsx(Typography, Object.assign({ fontSize: 18, fontWeight: 700 }, { children: t('swap.info.title.emptyActiveSwaps') })), _jsx(Typography, Object.assign({ fontSize: 14, color: "text.secondary", textAlign: "center", mt: 2 }, { children: t('swap.info.message.emptyActiveSwaps') }))] })));
|
|
14
15
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box } from '@mui/material';
|
|
3
3
|
import { ActiveSwaps } from '../../components/ActiveSwaps';
|
|
4
|
+
import { GasSufficiencyMessage } from '../../components/GasSufficiencyMessage';
|
|
4
5
|
import { SelectChainAndToken } from '../../components/SelectChainAndToken';
|
|
6
|
+
import { SendToWallet, SendToWalletButton, } from '../../components/SendToWallet';
|
|
5
7
|
import { SwapInput } from '../../components/SwapInput';
|
|
8
|
+
import { SwapRoutes } from '../../components/SwapRoutes';
|
|
6
9
|
import { FormContainer } from './MainPage.style';
|
|
7
10
|
import { MainSwapButton } from './MainSwapButton';
|
|
8
|
-
import { SwapRoutes } from './SwapRoutes';
|
|
9
11
|
export const MainPage = () => {
|
|
10
|
-
return (_jsxs(FormContainer, Object.assign({ disableGutters: true }, { children: [_jsx(ActiveSwaps, { 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
|
+
return (_jsxs(FormContainer, Object.assign({ disableGutters: true }, { children: [_jsx(ActiveSwaps, { 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(GasSufficiencyMessage, { mx: 3, mb: 3 }), _jsxs(Box, Object.assign({ mx: 3, mb: 1 }, { children: [_jsx(SendToWallet, { mb: 3 }), _jsxs(Box, Object.assign({ sx: { display: 'flex' } }, { children: [_jsx(MainSwapButton, {}), _jsx(SendToWalletButton, {})] }))] }))] })));
|
|
11
13
|
};
|
|
@@ -8,13 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { forwardRef } from 'react';
|
|
11
12
|
import { useFormState } from 'react-hook-form';
|
|
12
13
|
import { useNavigate } from 'react-router-dom';
|
|
13
14
|
import { SwapButton } from '../../components/SwapButton';
|
|
14
15
|
import { useSwapRoutes } from '../../hooks';
|
|
15
16
|
import { useSetExecutableRoute } from '../../stores';
|
|
16
17
|
import { navigationRoutes } from '../../utils';
|
|
17
|
-
export const MainSwapButton = () => {
|
|
18
|
+
export const MainSwapButton = forwardRef((_, ref) => {
|
|
18
19
|
const navigate = useNavigate();
|
|
19
20
|
const { isValid, isValidating } = useFormState();
|
|
20
21
|
const setExecutableRoute = useSetExecutableRoute();
|
|
@@ -28,5 +29,5 @@ export const MainSwapButton = () => {
|
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
31
|
});
|
|
31
|
-
return (_jsx(SwapButton, { onClick: handleClick, currentRoute: currentRoute, disable: isLoading || isFetching || isValidating || !isValid }));
|
|
32
|
-
};
|
|
32
|
+
return (_jsx(SwapButton, { onClick: handleClick, currentRoute: currentRoute, disable: isLoading || isFetching || isValidating || !isValid, ref: ref }));
|
|
33
|
+
});
|
|
@@ -5,15 +5,16 @@ import { ChainSelect } from '../../components/ChainSelect';
|
|
|
5
5
|
import { TokenList } from '../../components/TokenList';
|
|
6
6
|
import { useContentHeight, useNavigateBack, useScrollableOverflowHidden, } from '../../hooks';
|
|
7
7
|
import { SearchTokenInput } from './SearchTokenInput';
|
|
8
|
+
const minTokenListHeight = 330;
|
|
8
9
|
export const SelectTokenPage = ({ formType }) => {
|
|
9
10
|
useScrollableOverflowHidden();
|
|
10
11
|
const { navigateBack } = useNavigateBack();
|
|
11
12
|
const headerRef = useRef(null);
|
|
12
13
|
const contentHeight = useContentHeight();
|
|
13
|
-
const [
|
|
14
|
+
const [tokenListHeight, setTokenListHeight] = useState(0);
|
|
14
15
|
useLayoutEffect(() => {
|
|
15
16
|
var _a, _b;
|
|
16
|
-
|
|
17
|
+
setTokenListHeight(Math.max(contentHeight - ((_b = (_a = headerRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0), minTokenListHeight));
|
|
17
18
|
}, [contentHeight]);
|
|
18
|
-
return (_jsxs(Container, Object.assign({ disableGutters: true }, { children: [_jsxs(Box, Object.assign({ pt: 1, pb: 2, px: 3, ref: headerRef }, { children: [_jsx(ChainSelect, { formType: formType }), _jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(SearchTokenInput, {}) }))] })), _jsx(TokenList, { height:
|
|
19
|
+
return (_jsxs(Container, Object.assign({ disableGutters: true }, { children: [_jsxs(Box, Object.assign({ pt: 1, pb: 2, px: 3, ref: headerRef }, { children: [_jsx(ChainSelect, { formType: formType }), _jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(SearchTokenInput, {}) }))] })), _jsx(TokenList, { height: tokenListHeight, onClick: navigateBack, formType: formType })] })));
|
|
19
20
|
};
|
|
@@ -20,14 +20,14 @@ import { useHeaderActionStore } from '../../components/Header';
|
|
|
20
20
|
import { Step } from '../../components/Step';
|
|
21
21
|
import { StepDivider } from '../../components/StepDivider';
|
|
22
22
|
import { useNavigateBack } from '../../hooks';
|
|
23
|
-
import {
|
|
23
|
+
import { useRouteExecutionStore } from '../../stores';
|
|
24
24
|
import { Container } from './SwapDetailsPage.style';
|
|
25
25
|
export const SwapDetailsPage = () => {
|
|
26
26
|
var _a, _b;
|
|
27
27
|
const { t } = useTranslation();
|
|
28
28
|
const { navigateBack } = useNavigateBack();
|
|
29
29
|
const { state } = useLocation();
|
|
30
|
-
const [routeExecution, deleteRoute] =
|
|
30
|
+
const [routeExecution, deleteRoute] = useRouteExecutionStore((store) => [store.routes[state === null || state === void 0 ? void 0 : state.routeId], store.deleteRoute], shallow);
|
|
31
31
|
const [open, setOpen] = useState(false);
|
|
32
32
|
const toggleDialog = useCallback(() => {
|
|
33
33
|
setOpen((open) => !open);
|
|
@@ -10,5 +10,6 @@ export const SwapHistoryEmpty = () => {
|
|
|
10
10
|
flexDirection: 'column',
|
|
11
11
|
alignItems: 'center',
|
|
12
12
|
justifyContent: 'center',
|
|
13
|
+
paddingY: 12,
|
|
13
14
|
} }, { children: [_jsx(Typography, Object.assign({ fontSize: 48 }, { children: _jsx(HistoryIcon, { fontSize: "inherit" }) })), _jsx(Typography, Object.assign({ fontSize: 18, fontWeight: 700 }, { children: t('swap.info.title.emptySwapHistory') })), _jsx(Typography, Object.assign({ fontSize: 14, color: "text.secondary", textAlign: "center", mt: 2 }, { children: t('swap.info.message.emptySwapHistory') }))] })));
|
|
14
15
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable consistent-return */
|
|
2
3
|
import { DeleteOutline as DeleteIcon } from '@mui/icons-material';
|
|
3
4
|
import { Button, Container, DialogActions, DialogContent, DialogContentText, DialogTitle, IconButton, Stack, } from '@mui/material';
|
|
4
5
|
import { useCallback, useEffect, useState } from 'react';
|
|
@@ -6,22 +7,24 @@ import { useTranslation } from 'react-i18next';
|
|
|
6
7
|
import { Dialog } from '../../components/Dialog';
|
|
7
8
|
import { useHeaderActionStore } from '../../components/Header';
|
|
8
9
|
import { useWallet } from '../../providers';
|
|
9
|
-
import {
|
|
10
|
-
import { useSwapHistory } from '../../stores/
|
|
10
|
+
import { useRouteExecutionStore } from '../../stores';
|
|
11
|
+
import { useSwapHistory } from '../../stores/routes';
|
|
11
12
|
import { SwapHistoryEmpty } from './SwapHistoryEmpty';
|
|
12
13
|
import { SwapHistoryItem } from './SwapHistoryItem';
|
|
13
14
|
export const SwapHistoryPage = () => {
|
|
14
15
|
const { t } = useTranslation();
|
|
15
16
|
const { account } = useWallet();
|
|
16
17
|
const swaps = useSwapHistory(account.address);
|
|
17
|
-
const deleteRoutes =
|
|
18
|
+
const deleteRoutes = useRouteExecutionStore((store) => store.deleteRoutes);
|
|
18
19
|
const [open, setOpen] = useState(false);
|
|
19
20
|
const toggleDialog = useCallback(() => {
|
|
20
21
|
setOpen((open) => !open);
|
|
21
22
|
}, []);
|
|
22
23
|
useEffect(() => {
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
if (swaps.length) {
|
|
25
|
+
return useHeaderActionStore.getState().setAction(_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: toggleDialog }, { children: _jsx(DeleteIcon, {}) })));
|
|
26
|
+
}
|
|
27
|
+
}, [swaps.length, toggleDialog]);
|
|
25
28
|
if (!swaps.length) {
|
|
26
29
|
return _jsx(SwapHistoryEmpty, {});
|
|
27
30
|
}
|
|
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Delete as DeleteIcon } from '@mui/icons-material';
|
|
11
12
|
import { Box, Button } from '@mui/material';
|
|
12
13
|
import { Fragment } from 'react';
|
|
13
14
|
import { useFormContext } from 'react-hook-form';
|
|
@@ -54,5 +55,8 @@ export const SwapPage = () => {
|
|
|
54
55
|
return (_jsxs(Fragment, { children: [_jsx(Step, { step: step, fromToken: index === 0
|
|
55
56
|
? Object.assign(Object.assign({}, step.action.fromToken), { amount: step.action.fromAmount }) : undefined, toToken: index === steps.length - 1
|
|
56
57
|
? Object.assign(Object.assign({}, step.action.toToken), { amount: (_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toAmount) !== null && _b !== void 0 ? _b : step.estimate.toAmount }) : undefined }), steps.length > 1 && index !== steps.length - 1 ? (_jsx(StepDivider, {})) : null] }, step.id));
|
|
57
|
-
}), status === 'idle' ? (_jsx(GasSufficiencyMessage, { route: route, mt: 2 })) : null, status === 'idle' || status === 'error' ? (
|
|
58
|
+
}), status === 'idle' ? (_jsx(GasSufficiencyMessage, { route: route, mt: 2 })) : null, status === 'idle' || status === 'error' ? (_jsxs(Box, Object.assign({ mt: 2, display: "flex" }, { children: [_jsx(SwapButton, { text: getSwapButtonText(), onClick: handleSwapClick, currentRoute: route, disable: status === 'idle' && (isValidating || !isValid) }), status === 'error' ? (_jsx(Button, Object.assign({ onClick: handleRemoveRoute, sx: {
|
|
59
|
+
minWidth: 48,
|
|
60
|
+
marginLeft: 1,
|
|
61
|
+
} }, { children: _jsx(DeleteIcon, {}) }))) : null] }))) : null, route && status ? (_jsx(StatusBottomSheet, { status: status, route: route })) : null] }));
|
|
58
62
|
};
|
|
@@ -30,5 +30,5 @@ export const SwapRoutesPage = () => {
|
|
|
30
30
|
.setAction(_jsx(ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 }, size: "medium", edge: "end" }));
|
|
31
31
|
}, [dataUpdatedAt, isFetching, refetch, refetchTime]);
|
|
32
32
|
const routeNotFound = !(swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.length) && !isLoading && !isFetching;
|
|
33
|
-
return (_jsx(Stack, Object.assign({ direction: "column", spacing: 2, flex: 1 }, { children: routeNotFound ? (_jsx(SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => (_jsx(SwapRouteCardSkeleton, {}, index)))) : (swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.map((route) => (_jsx(SwapRouteCard, { route: route, onClick: () => handleRouteClick(route) }, route.id)))) })));
|
|
33
|
+
return (_jsx(Stack, Object.assign({ direction: "column", spacing: 2, flex: 1 }, { children: routeNotFound ? (_jsx(SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => (_jsx(SwapRouteCardSkeleton, {}, index)))) : (swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.map((route, index) => (_jsx(SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0 }, route.id)))) })));
|
|
34
34
|
};
|
|
@@ -11,7 +11,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
import { addChain as walletAddChain, switchChain as walletSwitchChain, switchChainAndAddToken, useLiFiWalletManagement, } from '@lifi/wallet-management';
|
|
12
12
|
import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from 'react';
|
|
13
13
|
import { useFormContext } from 'react-hook-form';
|
|
14
|
-
import { useChainOrderStore } from '../../stores
|
|
14
|
+
import { useChainOrderStore } from '../../stores';
|
|
15
15
|
import { SwapFormKey } from '../SwapFormProvider';
|
|
16
16
|
import { isItemAllowed, useWidgetConfig } from '../WidgetProvider';
|
|
17
17
|
const stub = () => {
|
package/stores/index.d.ts
CHANGED
package/stores/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './types';
|
|
2
2
|
export * from './useExecutingRoutesIds';
|
|
3
|
-
export * from './
|
|
3
|
+
export * from './useRouteExecutionStore';
|
|
4
|
+
export * from './useSelectedRouteStore';
|
|
4
5
|
export * from './useSetExecutableRoute';
|
|
5
6
|
export * from './useSwapHistory';
|
|
6
7
|
export * from './utils';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './types';
|
|
2
2
|
export * from './useExecutingRoutesIds';
|
|
3
|
-
export * from './
|
|
3
|
+
export * from './useRouteExecutionStore';
|
|
4
|
+
export * from './useSelectedRouteStore';
|
|
4
5
|
export * from './useSetExecutableRoute';
|
|
5
6
|
export * from './useSwapHistory';
|
|
6
7
|
export * from './utils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import shallow from 'zustand/shallow';
|
|
2
|
-
import {
|
|
2
|
+
import { useRouteExecutionStore } from './useRouteExecutionStore';
|
|
3
3
|
export const useExecutingRoutesIds = (address) => {
|
|
4
|
-
return
|
|
4
|
+
return useRouteExecutionStore((state) => Object.values(state.routes)
|
|
5
5
|
.filter((item) => item.route.fromAddress === address &&
|
|
6
6
|
(item.status === 'loading' || item.status === 'error'))
|
|
7
7
|
.sort((a, b) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RouteExecutionStore } from './types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const useRouteExecutionStore: import("zustand").UseBoundStore<Omit<Omit<import("zustand").StoreApi<RouteExecutionStore>, "persist"> & {
|
|
3
3
|
persist: {
|
|
4
4
|
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<RouteExecutionStore, {
|
|
5
5
|
routes: Partial<Record<string, import("./types").RouteExecution>>;
|
|
@@ -2,7 +2,7 @@ import create from 'zustand';
|
|
|
2
2
|
import { persist } from 'zustand/middleware';
|
|
3
3
|
import { immer } from 'zustand/middleware/immer';
|
|
4
4
|
import { isRouteCompleted, isRouteFailed } from './utils';
|
|
5
|
-
export const
|
|
5
|
+
export const useRouteExecutionStore = create()(persist(immer((set) => ({
|
|
6
6
|
routes: {},
|
|
7
7
|
setExecutableRoute: (route) => set((state) => {
|
|
8
8
|
if (!state.routes[route.id]) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SelectedRouteStore } from './types';
|
|
2
|
+
export declare const useSelectedRouteStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<SelectedRouteStore>, "setState"> & {
|
|
3
|
+
setState(nextStateOrUpdater: SelectedRouteStore | Partial<SelectedRouteStore> | ((state: import("immer/dist/internal").WritableDraft<SelectedRouteStore>) => void), shouldReplace?: boolean | undefined): void;
|
|
4
|
+
}>;
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import shallow from 'zustand/shallow';
|
|
2
|
-
import {
|
|
2
|
+
import { useRouteExecutionStore } from './useRouteExecutionStore';
|
|
3
3
|
export const useSwapHistory = (address) => {
|
|
4
|
-
return
|
|
4
|
+
return useRouteExecutionStore((state) => Object.values(state.routes)
|
|
5
5
|
.filter((item) => (item === null || item === void 0 ? void 0 : item.route.fromAddress) === address && (item === null || item === void 0 ? void 0 : item.status) === 'success')
|
|
6
6
|
.sort((a, b) => {
|
|
7
7
|
var _a, _b, _c, _d;
|
|
File without changes
|
|
File without changes
|
|
@@ -16,7 +16,7 @@ import { immer } from 'zustand/middleware/immer';
|
|
|
16
16
|
import { SettingsToolTypes } from './types';
|
|
17
17
|
export const useSettingsStore = create()(persist(immer((set) => ({
|
|
18
18
|
advancedPreferences: false,
|
|
19
|
-
showDestinationWallet:
|
|
19
|
+
showDestinationWallet: true,
|
|
20
20
|
appearance: 'auto',
|
|
21
21
|
gasPrice: 'normal',
|
|
22
22
|
routePriority: 'RECOMMENDED',
|