@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.
Files changed (211) hide show
  1. package/App.js +6 -86
  2. package/AppDrawer.js +3 -2
  3. package/AppRoutes.d.ts +2 -0
  4. package/AppRoutes.js +85 -0
  5. package/cjs/App.js +5 -85
  6. package/cjs/AppDrawer.js +2 -1
  7. package/cjs/AppRoutes.d.ts +2 -0
  8. package/cjs/AppRoutes.js +89 -0
  9. package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -0
  10. package/cjs/components/AppContainer.d.ts +4 -5
  11. package/cjs/components/AppContainer.js +30 -29
  12. package/cjs/components/Card/Card.d.ts +1 -0
  13. package/cjs/components/Card/Card.js +13 -9
  14. package/cjs/components/ChainSelect/ChainSelect.d.ts +1 -0
  15. package/cjs/components/ChainSelect/ChainSelect.js +3 -3
  16. package/cjs/components/ChainSelect/ChainSelect.style.d.ts +1 -0
  17. package/cjs/components/ChainSelect/ChainSelect.style.js +2 -2
  18. package/cjs/components/ChainSelect/useChainSelect.js +2 -2
  19. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +6 -2
  20. package/cjs/components/Header/Header.d.ts +2 -1
  21. package/cjs/components/Header/Header.js +3 -2
  22. package/cjs/components/Header/Header.style.js +3 -2
  23. package/cjs/components/Header/NavigationHeader.js +4 -1
  24. package/cjs/components/Header/WalletHeader.js +1 -1
  25. package/cjs/components/PoweredBy/PoweredBy.js +7 -0
  26. package/cjs/components/SendToWallet/SendToWallet.js +6 -10
  27. package/cjs/components/SendToWallet/SendToWalletButton.d.ts +2 -0
  28. package/cjs/components/SendToWallet/SendToWalletButton.js +24 -0
  29. package/cjs/components/SendToWallet/index.d.ts +1 -0
  30. package/cjs/components/SendToWallet/index.js +1 -0
  31. package/cjs/components/SendToWallet/store.d.ts +4 -0
  32. package/cjs/components/SendToWallet/store.js +13 -0
  33. package/cjs/components/SendToWallet/types.d.ts +6 -0
  34. package/cjs/{stores/route → components/SendToWallet}/types.js +0 -0
  35. package/cjs/components/Step/CircularProgress.d.ts +1 -0
  36. package/cjs/components/StepActions/StepActions.style.js +1 -1
  37. package/cjs/components/SwapButton/ButtonTooltip.d.ts +1 -0
  38. package/cjs/components/SwapButton/SwapButton.d.ts +1 -1
  39. package/cjs/components/SwapButton/SwapButton.js +4 -4
  40. package/cjs/components/SwapInput/SwapInputAdornment.d.ts +1 -0
  41. package/cjs/components/SwapRouteCard/SwapRouteCard.d.ts +2 -1
  42. package/cjs/components/SwapRouteCard/SwapRouteCard.js +19 -15
  43. package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +30 -0
  44. package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +16 -3
  45. package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -12
  46. package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +1 -3
  47. package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -13
  48. package/cjs/components/SwapRouteCard/types.d.ts +6 -2
  49. package/cjs/{pages/MainPage → components/SwapRoutes}/SwapRoutes.d.ts +0 -0
  50. package/cjs/components/SwapRoutes/SwapRoutes.js +51 -0
  51. package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +43 -0
  52. package/cjs/components/SwapRoutes/SwapRoutes.style.js +47 -0
  53. package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -0
  54. package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +38 -0
  55. package/cjs/components/SwapRoutes/index.d.ts +2 -0
  56. package/cjs/components/SwapRoutes/index.js +18 -0
  57. package/cjs/components/Token/Token.d.ts +2 -1
  58. package/cjs/components/Token/Token.js +10 -6
  59. package/cjs/components/Token/Token.style.js +2 -0
  60. package/cjs/config/theme.js +20 -24
  61. package/cjs/config/version.d.ts +1 -1
  62. package/cjs/config/version.js +1 -1
  63. package/cjs/hooks/useChains.js +2 -2
  64. package/cjs/hooks/useNavigateBack.js +13 -6
  65. package/cjs/hooks/useRouteExecution.js +4 -4
  66. package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -0
  67. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
  68. package/cjs/pages/MainPage/MainPage.js +4 -2
  69. package/cjs/pages/MainPage/MainSwapButton.js +4 -4
  70. package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
  71. package/cjs/pages/SelectTokenPage/SelectTokenPage.js +4 -3
  72. package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
  73. package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +1 -0
  74. package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +1 -0
  75. package/cjs/pages/SettingsPage/SettingsPage.d.ts +1 -0
  76. package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -0
  77. package/cjs/pages/SettingsPage/SlippageInput.d.ts +1 -0
  78. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +1 -1
  79. package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.js +1 -0
  80. package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +8 -5
  81. package/cjs/pages/SwapPage/SwapPage.js +5 -1
  82. package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
  83. package/cjs/providers/WalletProvider/WalletProvider.js +2 -2
  84. package/cjs/stores/index.d.ts +2 -1
  85. package/cjs/stores/index.js +2 -1
  86. package/cjs/stores/{route → routes}/index.d.ts +2 -1
  87. package/cjs/stores/{route → routes}/index.js +2 -1
  88. package/cjs/stores/{route → routes}/types.d.ts +4 -0
  89. package/cjs/stores/routes/types.js +2 -0
  90. package/cjs/stores/{route → routes}/useExecutingRoutesIds.d.ts +0 -0
  91. package/cjs/stores/{route → routes}/useExecutingRoutesIds.js +2 -2
  92. package/cjs/stores/{route/useRouteStore.d.ts → routes/useRouteExecutionStore.d.ts} +1 -1
  93. package/cjs/stores/{route/useRouteStore.js → routes/useRouteExecutionStore.js} +2 -2
  94. package/cjs/stores/routes/useSelectedRouteStore.d.ts +4 -0
  95. package/cjs/stores/routes/useSelectedRouteStore.js +12 -0
  96. package/cjs/stores/{route → routes}/useSetExecutableRoute.d.ts +0 -0
  97. package/cjs/stores/{route → routes}/useSetExecutableRoute.js +2 -2
  98. package/cjs/stores/{route → routes}/useSwapHistory.d.ts +0 -0
  99. package/cjs/stores/{route → routes}/useSwapHistory.js +2 -2
  100. package/cjs/stores/{route → routes}/utils.d.ts +0 -0
  101. package/cjs/stores/{route → routes}/utils.js +0 -0
  102. package/cjs/stores/settings/useSettingsStore.js +1 -1
  103. package/cjs/types/widget.d.ts +2 -0
  104. package/cjs/utils/colors.d.ts +1 -1
  105. package/cjs/utils/navigationRoutes.js +12 -12
  106. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -0
  107. package/components/AppContainer.d.ts +4 -5
  108. package/components/AppContainer.js +29 -28
  109. package/components/Card/Card.d.ts +1 -0
  110. package/components/Card/Card.js +13 -9
  111. package/components/ChainSelect/ChainSelect.d.ts +1 -0
  112. package/components/ChainSelect/ChainSelect.js +1 -1
  113. package/components/ChainSelect/ChainSelect.style.d.ts +1 -0
  114. package/components/ChainSelect/ChainSelect.style.js +2 -2
  115. package/components/ChainSelect/useChainSelect.js +1 -1
  116. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +6 -2
  117. package/components/Header/Header.d.ts +2 -1
  118. package/components/Header/Header.js +1 -1
  119. package/components/Header/Header.style.js +4 -3
  120. package/components/Header/NavigationHeader.js +4 -1
  121. package/components/Header/WalletHeader.js +2 -2
  122. package/components/PoweredBy/PoweredBy.js +7 -0
  123. package/components/SendToWallet/SendToWallet.js +8 -11
  124. package/components/SendToWallet/SendToWalletButton.d.ts +2 -0
  125. package/components/SendToWallet/SendToWalletButton.js +20 -0
  126. package/components/SendToWallet/index.d.ts +1 -0
  127. package/components/SendToWallet/index.js +1 -0
  128. package/components/SendToWallet/store.d.ts +4 -0
  129. package/components/SendToWallet/store.js +10 -0
  130. package/components/SendToWallet/types.d.ts +6 -0
  131. package/{stores/route → components/SendToWallet}/types.js +0 -0
  132. package/components/Step/CircularProgress.d.ts +1 -0
  133. package/components/StepActions/StepActions.style.js +1 -1
  134. package/components/SwapButton/ButtonTooltip.d.ts +1 -0
  135. package/components/SwapButton/SwapButton.d.ts +1 -1
  136. package/components/SwapButton/SwapButton.js +4 -3
  137. package/components/SwapInput/SwapInputAdornment.d.ts +1 -0
  138. package/components/SwapRouteCard/SwapRouteCard.d.ts +2 -1
  139. package/components/SwapRouteCard/SwapRouteCard.js +19 -16
  140. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +30 -0
  141. package/components/SwapRouteCard/SwapRouteCard.style.js +17 -4
  142. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -12
  143. package/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +1 -3
  144. package/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -13
  145. package/components/SwapRouteCard/types.d.ts +6 -2
  146. package/{pages/MainPage → components/SwapRoutes}/SwapRoutes.d.ts +0 -0
  147. package/components/SwapRoutes/SwapRoutes.js +47 -0
  148. package/components/SwapRoutes/SwapRoutes.style.d.ts +43 -0
  149. package/components/SwapRoutes/SwapRoutes.style.js +44 -0
  150. package/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -0
  151. package/components/SwapRoutes/SwapRoutesExpanded.js +34 -0
  152. package/components/SwapRoutes/index.d.ts +2 -0
  153. package/components/SwapRoutes/index.js +2 -0
  154. package/components/Token/Token.d.ts +2 -1
  155. package/components/Token/Token.js +11 -7
  156. package/components/Token/Token.style.js +2 -0
  157. package/config/theme.js +20 -24
  158. package/config/version.d.ts +1 -1
  159. package/config/version.js +1 -1
  160. package/hooks/useChains.js +1 -1
  161. package/hooks/useNavigateBack.js +13 -6
  162. package/hooks/useRouteExecution.js +5 -5
  163. package/package.json +11 -11
  164. package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -0
  165. package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
  166. package/pages/MainPage/MainPage.js +4 -2
  167. package/pages/MainPage/MainSwapButton.js +4 -3
  168. package/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
  169. package/pages/SelectTokenPage/SelectTokenPage.js +4 -3
  170. package/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
  171. package/pages/SettingsPage/AdvancedPreferences.d.ts +1 -0
  172. package/pages/SettingsPage/GasPriceSelect.d.ts +1 -0
  173. package/pages/SettingsPage/SettingsPage.d.ts +1 -0
  174. package/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -0
  175. package/pages/SettingsPage/SlippageInput.d.ts +1 -0
  176. package/pages/SwapDetailsPage/SwapDetailsPage.js +2 -2
  177. package/pages/SwapHistoryPage/SwapHistoryEmpty.js +1 -0
  178. package/pages/SwapHistoryPage/SwapHistoryPage.js +8 -5
  179. package/pages/SwapPage/SwapPage.js +5 -1
  180. package/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
  181. package/providers/WalletProvider/WalletProvider.js +1 -1
  182. package/stores/index.d.ts +2 -1
  183. package/stores/index.js +2 -1
  184. package/stores/{route → routes}/index.d.ts +2 -1
  185. package/stores/{route → routes}/index.js +2 -1
  186. package/stores/{route → routes}/types.d.ts +4 -0
  187. package/stores/routes/types.js +1 -0
  188. package/stores/{route → routes}/useExecutingRoutesIds.d.ts +0 -0
  189. package/stores/{route → routes}/useExecutingRoutesIds.js +2 -2
  190. package/stores/{route/useRouteStore.d.ts → routes/useRouteExecutionStore.d.ts} +1 -1
  191. package/stores/{route/useRouteStore.js → routes/useRouteExecutionStore.js} +1 -1
  192. package/stores/routes/useSelectedRouteStore.d.ts +4 -0
  193. package/stores/routes/useSelectedRouteStore.js +9 -0
  194. package/stores/{route → routes}/useSetExecutableRoute.d.ts +0 -0
  195. package/stores/routes/useSetExecutableRoute.js +4 -0
  196. package/stores/{route → routes}/useSwapHistory.d.ts +0 -0
  197. package/stores/{route → routes}/useSwapHistory.js +2 -2
  198. package/stores/{route → routes}/utils.d.ts +0 -0
  199. package/stores/{route → routes}/utils.js +0 -0
  200. package/stores/settings/useSettingsStore.js +1 -1
  201. package/tsconfig.cjs.tsbuildinfo +1 -1
  202. package/types/widget.d.ts +2 -0
  203. package/utils/colors.d.ts +1 -1
  204. package/utils/navigationRoutes.js +12 -12
  205. package/cjs/pages/MainPage/SwapRoutes.js +0 -43
  206. package/cjs/pages/MainPage/SwapRoutes.style.d.ts +0 -11
  207. package/cjs/pages/MainPage/SwapRoutes.style.js +0 -16
  208. package/pages/MainPage/SwapRoutes.js +0 -39
  209. package/pages/MainPage/SwapRoutes.style.d.ts +0 -11
  210. package/pages/MainPage/SwapRoutes.style.js +0 -13
  211. 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: 32, textStyle: {
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
- tokenSymbol: token.symbol,
29
- chainName: (_b = getChainById(token.chainId)) === null || _b === void 0 ? void 0 : _b.name,
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
- color: primaryLightColor,
117
+ backgroundColor: paletteDark.background.paper,
118
+ color: common.white,
122
119
  '&:hover': {
123
- backgroundColor: alpha(primaryLightColor, 0.08),
124
- borderColor: primaryLightColor,
120
+ backgroundColor: lighten(paletteDark.background.paper, 0.02),
125
121
  },
126
122
  },
127
123
  }
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/widget";
2
- export declare const version = "1.17.2";
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.17.2';
2
+ export const version = '1.18.0';
@@ -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/chains';
14
+ import { useChainOrderStore } from '../stores';
15
15
  export const useChains = () => {
16
16
  const { disabledChains, chains } = useWidgetConfig();
17
17
  const lifi = useLiFi();
@@ -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
- if (window.history.state && window.history.state.idx > 0) {
7
- navigate(-1);
8
- }
9
- else {
10
- navigate(window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) || '/', { replace: true });
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, useRouteStore, } from '../stores';
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 = useRouteStore((state) => state.routes[routeId]);
24
- const [updateRoute, restartRoute, deleteRoute] = useRouteStore((state) => [state.updateRoute, state.restartRoute, state.deleteRoute], shallow);
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 = useRouteStore.getState().routes[updatedRoute.id];
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 = useRouteStore.getState().routes[routeId]) === null || _a === void 0 ? void 0 : _a.route;
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.17.2",
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.3",
48
- "@mui/lab": "^5.0.0-alpha.99",
49
- "@mui/material": "^5.10.5",
50
- "@sentry/integrations": "^7.12.1",
51
- "@sentry/react": "^7.12.1",
52
- "@sentry/tracing": "^7.12.1",
53
- "@tanstack/react-query": "^4.3.4",
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.1",
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.35.0",
62
+ "react-hook-form": "^7.36.0",
63
63
  "react-i18next": "^11.18.6",
64
- "react-router-dom": "^6.4.0",
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 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const ActiveSwapsPage: () => JSX.Element;
@@ -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
+ });
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const SearchTokenInput: () => JSX.Element;
@@ -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 [headerHeight, setHeaderHeight] = useState(0);
14
+ const [tokenListHeight, setTokenListHeight] = useState(0);
14
15
  useLayoutEffect(() => {
15
16
  var _a, _b;
16
- setHeaderHeight(contentHeight - ((_b = (_a = headerRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0));
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: headerHeight, onClick: navigateBack, formType: formType })] })));
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
  };
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const SelectWalletPage: () => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const AdvancedPreferences: () => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const GasPriceSelect: () => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const SettingsPage: () => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const ShowDestinationWallet: () => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const SlippageInput: () => JSX.Element;
@@ -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 { useRouteStore } from '../../stores';
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] = useRouteStore((store) => [store.routes[state === null || state === void 0 ? void 0 : state.routeId], store.deleteRoute], shallow);
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 { useRouteStore } from '../../stores';
10
- import { useSwapHistory } from '../../stores/route';
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 = useRouteStore((store) => store.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
- return useHeaderActionStore.getState().setAction(_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: toggleDialog }, { children: _jsx(DeleteIcon, {}) })));
24
- }, [toggleDialog]);
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' ? (_jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(SwapButton, { text: getSwapButtonText(), onClick: handleSwapClick, currentRoute: route, disable: status === 'idle' && (isValidating || !isValid) }) }))) : null, status === 'error' ? (_jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(Button, Object.assign({ variant: "outlined", onClick: handleRemoveRoute, fullWidth: true }, { children: t('button.removeSwap') })) }))) : null, route && status ? (_jsx(StatusBottomSheet, { status: status, route: route })) : null] }));
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/chains';
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
@@ -1,2 +1,3 @@
1
- export * from './route';
1
+ export * from './chains';
2
+ export * from './routes';
2
3
  export * from './settings';
package/stores/index.js CHANGED
@@ -1,2 +1,3 @@
1
- export * from './route';
1
+ export * from './chains';
2
+ export * from './routes';
2
3
  export * from './settings';
@@ -1,6 +1,7 @@
1
1
  export * from './types';
2
2
  export * from './useExecutingRoutesIds';
3
- export * from './useRouteStore';
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 './useRouteStore';
3
+ export * from './useRouteExecutionStore';
4
+ export * from './useSelectedRouteStore';
4
5
  export * from './useSetExecutableRoute';
5
6
  export * from './useSwapHistory';
6
7
  export * from './utils';
@@ -12,3 +12,7 @@ export interface RouteExecution {
12
12
  route: Route;
13
13
  status: RouteExecutionStatus;
14
14
  }
15
+ export interface SelectedRouteStore {
16
+ selectedRoute?: Route;
17
+ setSelectedRoute: (route?: Route) => void;
18
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,7 @@
1
1
  import shallow from 'zustand/shallow';
2
- import { useRouteStore } from './useRouteStore';
2
+ import { useRouteExecutionStore } from './useRouteExecutionStore';
3
3
  export const useExecutingRoutesIds = (address) => {
4
- return useRouteStore((state) => Object.values(state.routes)
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 useRouteStore: import("zustand").UseBoundStore<Omit<Omit<import("zustand").StoreApi<RouteExecutionStore>, "persist"> & {
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 useRouteStore = create()(persist(immer((set) => ({
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
+ }>;
@@ -0,0 +1,9 @@
1
+ import create from 'zustand';
2
+ import { immer } from 'zustand/middleware/immer';
3
+ export const useSelectedRouteStore = create()(immer((set) => ({
4
+ setSelectedRoute: (route) => {
5
+ set((state) => {
6
+ state.selectedRoute = route;
7
+ });
8
+ },
9
+ })));
@@ -0,0 +1,4 @@
1
+ import { useRouteExecutionStore } from './useRouteExecutionStore';
2
+ export const useSetExecutableRoute = () => {
3
+ return useRouteExecutionStore((state) => state.setExecutableRoute);
4
+ };
File without changes
@@ -1,7 +1,7 @@
1
1
  import shallow from 'zustand/shallow';
2
- import { useRouteStore } from './useRouteStore';
2
+ import { useRouteExecutionStore } from './useRouteExecutionStore';
3
3
  export const useSwapHistory = (address) => {
4
- return useRouteStore((state) => Object.values(state.routes)
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: false,
19
+ showDestinationWallet: true,
20
20
  appearance: 'auto',
21
21
  gasPrice: 'normal',
22
22
  routePriority: 'RECOMMENDED',