@lifi/widget 1.10.3 → 1.11.1

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 (201) hide show
  1. package/App.js +59 -11
  2. package/AppDrawer.js +1 -1
  3. package/AppDrawer.style.d.ts +1 -1
  4. package/AppDrawer.style.js +0 -1
  5. package/AppProvider.d.ts +1 -0
  6. package/AppProvider.js +5 -2
  7. package/components/AppContainer.d.ts +10 -0
  8. package/components/AppContainer.js +4 -7
  9. package/components/Card/Card.d.ts +11 -5
  10. package/components/Card/Card.js +29 -5
  11. package/components/Card/index.d.ts +0 -1
  12. package/components/Card/index.js +0 -1
  13. package/components/Dialog.d.ts +3 -0
  14. package/components/Dialog.js +23 -0
  15. package/components/GasSufficiencyMessage/GasSufficiencyMessage.d.ts +6 -0
  16. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +41 -0
  17. package/components/{InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.style.d.ts → GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts} +0 -0
  18. package/components/{InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.style.js → GasSufficiencyMessage/GasSufficiencyMessage.style.js} +1 -0
  19. package/components/GasSufficiencyMessage/index.d.ts +1 -0
  20. package/components/GasSufficiencyMessage/index.js +1 -0
  21. package/components/Header/Header.js +5 -6
  22. package/components/Header/Header.style.js +2 -1
  23. package/components/Header/NavigationHeader.js +28 -22
  24. package/components/Header/WalletHeader.js +4 -4
  25. package/components/Header/index.d.ts +1 -0
  26. package/components/Header/index.js +1 -0
  27. package/components/Header/types.d.ts +8 -0
  28. package/components/Header/types.js +1 -0
  29. package/components/Header/useHeaderActionStore.d.ts +6 -0
  30. package/components/Header/useHeaderActionStore.js +19 -0
  31. package/components/PoweredBy/PoweredBy.js +0 -1
  32. package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +14 -2
  33. package/components/ReverseTokensButton/ReverseTokensButton.js +5 -7
  34. package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
  35. package/components/ReverseTokensButton/ReverseTokensButton.style.js +4 -2
  36. package/components/SelectTokenButton/SelectTokenButton.js +9 -7
  37. package/components/SelectTokenButton/SelectTokenButton.style.d.ts +3 -10
  38. package/components/SelectTokenButton/SelectTokenButton.style.js +0 -7
  39. package/components/SmallAvatar.d.ts +16 -0
  40. package/components/SmallAvatar.js +8 -0
  41. package/{pages/SwapPage → components/Step}/CircularProgress.d.ts +0 -0
  42. package/{pages/SwapPage → components/Step}/CircularProgress.js +0 -0
  43. package/{pages/SwapPage → components/Step}/CircularProgress.style.d.ts +0 -0
  44. package/{pages/SwapPage → components/Step}/CircularProgress.style.js +0 -0
  45. package/components/Step/Step.d.ts +7 -0
  46. package/{pages/SwapPage/StepItem.js → components/Step/Step.js} +6 -6
  47. package/{pages/SwapPage/ExecutionItem.d.ts → components/Step/StepProcess.d.ts} +1 -1
  48. package/{pages/SwapPage/ExecutionItem.js → components/Step/StepProcess.js} +2 -2
  49. package/{pages/SwapPage/ExecutionItem.style.d.ts → components/Step/StepProcess.style.d.ts} +1 -1
  50. package/{pages/SwapPage/ExecutionItem.style.js → components/Step/StepProcess.style.js} +0 -0
  51. package/{pages/SwapPage → components/Step}/StepTimer.d.ts +0 -0
  52. package/{pages/SwapPage → components/Step}/StepTimer.js +0 -0
  53. package/components/Step/index.d.ts +1 -0
  54. package/components/Step/index.js +1 -0
  55. package/components/Step/utils.d.ts +6 -0
  56. package/components/Step/utils.js +89 -0
  57. package/components/StepActions/StepActions.js +17 -7
  58. package/components/StepActions/StepActions.style.js +2 -2
  59. package/{pages/SwapPage → components/StepDivider}/StepDivider.d.ts +0 -0
  60. package/{pages/SwapPage → components/StepDivider}/StepDivider.js +0 -0
  61. package/{pages/SwapPage → components/StepDivider}/StepDivider.style.d.ts +0 -0
  62. package/{pages/SwapPage → components/StepDivider}/StepDivider.style.js +0 -0
  63. package/components/StepDivider/index.d.ts +1 -0
  64. package/components/StepDivider/index.js +1 -0
  65. package/components/SwapButton/SwapButton.js +9 -12
  66. package/components/SwapButton/SwapButton.style.d.ts +1 -1
  67. package/components/SwapButton/SwapButton.style.js +1 -5
  68. package/components/SwapButton/types.d.ts +2 -0
  69. package/components/SwapInProgress/SwapInProgress.js +9 -6
  70. package/components/SwapInProgress/SwapInProgress.style.d.ts +9 -21
  71. package/components/SwapInProgress/SwapInProgress.style.js +5 -6
  72. package/components/SwapInput/FormPriceHelperText.js +1 -1
  73. package/components/SwapInput/SwapInput.js +4 -5
  74. package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
  75. package/components/SwapInput/SwapInputAdornment.style.js +0 -2
  76. package/components/SwapRouteCard/SwapRouteCard.js +15 -15
  77. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +0 -20
  78. package/components/SwapRouteCard/SwapRouteCard.style.js +7 -54
  79. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +6 -10
  80. package/components/SwapRouteCard/SwapRouteNotFoundCard.js +3 -3
  81. package/components/SwapRouteCard/types.d.ts +0 -3
  82. package/components/{StepToken.d.ts → Token/Token.d.ts} +2 -1
  83. package/components/Token/Token.js +31 -0
  84. package/components/Token/Token.style.d.ts +24 -0
  85. package/components/Token/Token.style.js +31 -0
  86. package/components/Token/index.d.ts +2 -0
  87. package/components/Token/index.js +2 -0
  88. package/components/TokenAvatar/TokenAvatar.d.ts +7 -0
  89. package/components/TokenAvatar/TokenAvatar.js +8 -0
  90. package/components/TokenAvatar/TokenAvatar.style.d.ts +1 -0
  91. package/components/TokenAvatar/TokenAvatar.style.js +16 -0
  92. package/components/TokenAvatar/index.d.ts +2 -0
  93. package/components/TokenAvatar/index.js +2 -0
  94. package/components/TokenList/TokenList.js +2 -2
  95. package/components/TokenList/TokenList.style.js +1 -1
  96. package/components/TokenList/TokenListItem.d.ts +1 -0
  97. package/components/TokenList/TokenListItem.js +13 -7
  98. package/components/TokenList/types.d.ts +1 -0
  99. package/config/queryClient.d.ts +1 -1
  100. package/config/queryClient.js +1 -1
  101. package/config/theme.js +14 -1
  102. package/config/version.d.ts +1 -1
  103. package/config/version.js +1 -1
  104. package/hooks/index.d.ts +1 -1
  105. package/hooks/index.js +1 -1
  106. package/hooks/useChains.d.ts +8 -8
  107. package/hooks/useChains.js +1 -1
  108. package/hooks/useContentHeight.js +1 -1
  109. package/hooks/useGasSufficiency.d.ts +15 -0
  110. package/hooks/useGasSufficiency.js +91 -0
  111. package/hooks/useRouteExecution.d.ts +3 -3
  112. package/hooks/useRouteExecution.js +23 -19
  113. package/hooks/useScrollableContainer.js +1 -1
  114. package/hooks/useSwapRoutes.d.ts +1 -1
  115. package/hooks/useSwapRoutes.js +2 -14
  116. package/hooks/useTelemetry.js +3 -1
  117. package/hooks/useTokenBalance.js +5 -5
  118. package/hooks/useTokenBalances.d.ts +2 -2
  119. package/hooks/useTokenBalances.js +8 -10
  120. package/hooks/useTokens.js +1 -1
  121. package/hooks/useTools.d.ts +10 -1
  122. package/hooks/useTools.js +13 -3
  123. package/i18n/en/translation.json +18 -9
  124. package/i18n/index.d.ts +12 -3
  125. package/icons/LiFiToolLogo.svg +6 -0
  126. package/package.json +9 -9
  127. package/pages/MainPage/MainPage.js +2 -3
  128. package/pages/MainPage/MainSwapButton.js +6 -7
  129. package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.d.ts +0 -0
  130. package/pages/MainPage/SwapRoutes.js +36 -0
  131. package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.style.d.ts +0 -0
  132. package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.style.js +4 -0
  133. package/pages/SelectTokenPage/ChainSelect.js +2 -2
  134. package/pages/SelectTokenPage/SearchTokenInput.js +2 -2
  135. package/pages/SelectWalletPage/SelectWalletPage.js +4 -23
  136. package/pages/SelectWalletPage/SelectWalletPage.style.js +1 -1
  137. package/pages/SettingsPage/AdvancedPreferences.js +1 -1
  138. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  139. package/pages/SettingsPage/EnabledBridgesSelect.js +7 -4
  140. package/pages/SettingsPage/EnabledExchangesSelect.js +7 -4
  141. package/pages/SettingsPage/GasPriceSelect.js +2 -2
  142. package/pages/SettingsPage/RoutePrioritySelect.js +2 -2
  143. package/pages/SettingsPage/SlippageInput.js +3 -3
  144. package/pages/SwapDetailsPage/SwapDetailsPage.d.ts +2 -0
  145. package/pages/SwapDetailsPage/SwapDetailsPage.js +62 -0
  146. package/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +11 -0
  147. package/pages/SwapDetailsPage/SwapDetailsPage.style.js +5 -0
  148. package/pages/SwapDetailsPage/index.d.ts +1 -0
  149. package/pages/SwapDetailsPage/index.js +1 -0
  150. package/pages/SwapHistoryPage/SwapHistoryEmpty.d.ts +2 -0
  151. package/pages/SwapHistoryPage/SwapHistoryEmpty.js +14 -0
  152. package/pages/SwapHistoryPage/SwapHistoryItem.d.ts +5 -0
  153. package/pages/SwapHistoryPage/SwapHistoryItem.js +23 -0
  154. package/pages/SwapHistoryPage/SwapHistoryPage.d.ts +2 -0
  155. package/pages/SwapHistoryPage/SwapHistoryPage.js +14 -0
  156. package/pages/SwapHistoryPage/index.d.ts +1 -0
  157. package/pages/SwapHistoryPage/index.js +1 -0
  158. package/pages/SwapPage/StatusBottomSheet.js +4 -4
  159. package/pages/SwapPage/SwapPage.js +13 -10
  160. package/pages/SwapPage/SwapPage.style.d.ts +0 -33
  161. package/pages/SwapPage/SwapPage.style.js +2 -9
  162. package/pages/SwapPage/utils.js +1 -1
  163. package/pages/SwapRoutesPage/SwapRoutesPage.js +16 -8
  164. package/pages/SwapRoutesPage/SwapRoutesPage.style.js +1 -1
  165. package/providers/WalletProvider/WalletProvider.js +7 -26
  166. package/providers/WalletProvider/types.d.ts +0 -1
  167. package/providers/WidgetProvider/WidgetProvider.js +1 -1
  168. package/stores/route/index.d.ts +1 -1
  169. package/stores/route/index.js +1 -1
  170. package/stores/route/types.d.ts +2 -4
  171. package/stores/route/useExecutingRoutes.d.ts +2 -1
  172. package/stores/route/useExecutingRoutes.js +4 -2
  173. package/stores/route/useRouteStore.d.ts +4 -1
  174. package/stores/route/useRouteStore.js +23 -24
  175. package/stores/route/useSwapHistory.d.ts +2 -0
  176. package/stores/route/useSwapHistory.js +11 -0
  177. package/stores/settings/useSettingsStore.d.ts +13 -0
  178. package/types/widget.d.ts +3 -4
  179. package/utils/index.d.ts +6 -0
  180. package/utils/index.js +6 -0
  181. package/utils/navigationRoutes.d.ts +13 -0
  182. package/utils/navigationRoutes.js +12 -0
  183. package/components/Card/CardContainer.d.ts +0 -11
  184. package/components/Card/CardContainer.js +0 -16
  185. package/components/InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.d.ts +0 -3
  186. package/components/InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.js +0 -31
  187. package/components/InsufficientGasOrFundsMessage/index.d.ts +0 -1
  188. package/components/InsufficientGasOrFundsMessage/index.js +0 -1
  189. package/components/StepToken.js +0 -21
  190. package/components/SwapRoutes/SwapRoutes.js +0 -32
  191. package/components/SwapRoutes/SwapRoutesUpdateProgress.d.ts +0 -3
  192. package/components/SwapRoutes/SwapRoutesUpdateProgress.js +0 -24
  193. package/components/SwapRoutes/index.d.ts +0 -1
  194. package/components/SwapRoutes/index.js +0 -1
  195. package/hooks/useHasSufficientBalance.d.ts +0 -5
  196. package/hooks/useHasSufficientBalance.js +0 -72
  197. package/pages/SwapPage/StepItem.d.ts +0 -7
  198. package/stores/route/useCurrentRoute.d.ts +0 -2
  199. package/stores/route/useCurrentRoute.js +0 -5
  200. package/utils/routes.d.ts +0 -11
  201. package/utils/routes.js +0 -10
@@ -1,3 +1,14 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  import { Box, CircularProgress, IconButton, Tooltip, } from '@mui/material';
3
14
  import { useEffect, useState } from 'react';
@@ -6,7 +17,8 @@ const getProgressValue = (updatedAt, timeToUpdate) => updatedAt
6
17
  ? Math.min(100, ((Date.now() - updatedAt) / timeToUpdate) * 100)
7
18
  : 0;
8
19
  const getSecondsToUpdate = (updatedAt, timeToUpdate) => Math.max(Math.round((timeToUpdate - (Date.now() - updatedAt)) / 1000), 0);
9
- export const ProgressToNextUpdate = ({ updatedAt, timeToUpdate, isLoading, onClick, sx }) => {
20
+ export const ProgressToNextUpdate = (_a) => {
21
+ var { updatedAt, timeToUpdate, isLoading, onClick } = _a, other = __rest(_a, ["updatedAt", "timeToUpdate", "isLoading", "onClick"]);
10
22
  const { t } = useTranslation();
11
23
  const [value, setValue] = useState(() => getProgressValue(updatedAt, timeToUpdate));
12
24
  useEffect(() => {
@@ -25,7 +37,7 @@ export const ProgressToNextUpdate = ({ updatedAt, timeToUpdate, isLoading, onCli
25
37
  setValue(0);
26
38
  }
27
39
  }, [isLoading]);
28
- return (_jsx(IconButton, Object.assign({ onClick: onClick, sx: sx, disabled: isLoading }, { children: _jsx(Tooltip, Object.assign({ title: t('tooltip.progressToNextUpdate', {
40
+ return (_jsx(IconButton, Object.assign({ onClick: onClick, disabled: isLoading }, other, { children: _jsx(Tooltip, Object.assign({ title: t('tooltip.progressToNextUpdate', {
29
41
  value: getSecondsToUpdate(updatedAt, timeToUpdate),
30
42
  }), placement: "top", enterDelay: 250, arrow: true }, { children: _jsxs(Box, Object.assign({ sx: {
31
43
  display: 'grid',
@@ -12,13 +12,11 @@ export const ReverseTokensButton = ({ vertical, }) => {
12
12
  SwapFormKey.ToChain,
13
13
  SwapFormKey.ToToken,
14
14
  ]);
15
- if (fromChain && fromToken && toChain && toToken) {
16
- setValue(SwapFormKey.FromAmount, '');
17
- setValue(SwapFormKey.FromChain, toChain);
18
- setValue(SwapFormKey.FromToken, toToken);
19
- setValue(SwapFormKey.ToChain, fromChain);
20
- setValue(SwapFormKey.ToToken, fromToken);
21
- }
15
+ setValue(SwapFormKey.FromAmount, '');
16
+ setValue(SwapFormKey.FromChain, toChain);
17
+ setValue(SwapFormKey.FromToken, toToken);
18
+ setValue(SwapFormKey.ToChain, fromChain);
19
+ setValue(SwapFormKey.ToToken, fromToken);
22
20
  };
23
21
  return (_jsx(IconButton, Object.assign({ onClick: handleClick, size: "small", "aria-label": "swap-destinations" }, { children: vertical ? _jsx(SwapVertIcon, {}) : _jsx(SwapHorizIcon, {}) })));
24
22
  };
@@ -6,7 +6,7 @@ export declare const IconButton: import("@emotion/styled").StyledComponent<{
6
6
  disabled?: boolean | undefined;
7
7
  disableFocusRipple?: boolean | undefined;
8
8
  edge?: false | "end" | "start" | undefined;
9
- size?: "small" | "large" | "medium" | undefined;
9
+ size?: "small" | "medium" | "large" | undefined;
10
10
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
11
11
  } & Omit<{
12
12
  action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
@@ -1,5 +1,5 @@
1
1
  import { IconButton as MuiIconButton } from '@mui/material';
2
- import { darken, styled } from '@mui/material/styles';
2
+ import { darken, lighten, styled } from '@mui/material/styles';
3
3
  export const IconButton = styled(MuiIconButton)(({ theme }) => ({
4
4
  backgroundColor: theme.palette.background.paper,
5
5
  border: `1px solid`,
@@ -9,6 +9,8 @@ export const IconButton = styled(MuiIconButton)(({ theme }) => ({
9
9
  zIndex: 1200,
10
10
  padding: theme.spacing(0.5),
11
11
  '&:hover': {
12
- backgroundColor: darken(theme.palette.background.paper, 0.04),
12
+ backgroundColor: theme.palette.mode === 'light'
13
+ ? darken(theme.palette.background.paper, 0.02)
14
+ : lighten(theme.palette.background.paper, 0.02),
13
15
  },
14
16
  }));
@@ -1,15 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { KeyboardArrowRight as KeyboardArrowRightIcon } from '@mui/icons-material';
3
- import { Avatar, Skeleton } from '@mui/material';
3
+ import { Skeleton } from '@mui/material';
4
4
  import { useWatch } from 'react-hook-form';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import { useNavigate } from 'react-router-dom';
7
7
  import { useChain, useToken } from '../../hooks';
8
8
  import { SwapFormKeyHelper, } from '../../providers/SwapFormProvider';
9
- import { routes } from '../../utils/routes';
10
- import { CardTitle } from '../Card';
11
- import { CardContainer } from '../Card/CardContainer';
12
- import { Card, SelectTokenCardHeader } from './SelectTokenButton.style';
9
+ import { navigationRoutes } from '../../utils';
10
+ import { Card, CardTitle } from '../Card';
11
+ import { TokenAvatar } from '../TokenAvatar';
12
+ import { SelectTokenCardHeader } from './SelectTokenButton.style';
13
13
  export const SelectTokenButton = ({ formType, compact }) => {
14
14
  const { t } = useTranslation();
15
15
  const navigate = useNavigate();
@@ -22,8 +22,10 @@ export const SelectTokenButton = ({ formType, compact }) => {
22
22
  const { chain, isLoading: isChainLoading } = useChain(chainId);
23
23
  const { token, isLoading: isTokenLoading } = useToken(chainId, tokenAddress);
24
24
  const handleClick = () => {
25
- navigate(formType === 'from' ? routes.fromToken : routes.toToken);
25
+ navigate(formType === 'from'
26
+ ? navigationRoutes.fromToken
27
+ : navigationRoutes.toToken);
26
28
  };
27
29
  const isSelected = !!(chain && token);
28
- return (_jsx(CardContainer, Object.assign({ flex: 1 }, { children: _jsxs(Card, Object.assign({ onClick: handleClick, elevation: 0 }, { children: [_jsx(CardTitle, { children: t(`swap.${formType}`) }), chainId && tokenAddress && (isChainLoading || isTokenLoading) ? (_jsx(SelectTokenCardHeader, { avatar: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }), title: _jsx(Skeleton, { variant: "text", width: 64, height: 24 }), subheader: _jsx(Skeleton, { variant: "text", width: 64, height: 16 }), compact: compact })) : (_jsx(SelectTokenCardHeader, { avatar: isSelected ? (_jsx(Avatar, Object.assign({ src: token.logoURI, alt: token.symbol }, { children: token.symbol[0] }))) : null, action: !compact ? _jsx(KeyboardArrowRightIcon, {}) : null, title: isSelected ? token.symbol : t(`swap.selectChainAndToken`), subheader: isSelected ? `on ${chain.name}` : null, selected: isSelected, compact: compact }))] })) })));
30
+ return (_jsxs(Card, Object.assign({ flex: 1, onClick: handleClick }, { children: [_jsx(CardTitle, { children: t(`swap.${formType}`) }), chainId && tokenAddress && (isChainLoading || isTokenLoading) ? (_jsx(SelectTokenCardHeader, { avatar: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }), title: _jsx(Skeleton, { variant: "text", width: 64, height: 24 }), subheader: _jsx(Skeleton, { variant: "text", width: 64, height: 16 }), compact: compact })) : (_jsx(SelectTokenCardHeader, { avatar: isSelected ? _jsx(TokenAvatar, { token: token }) : null, action: !compact ? _jsx(KeyboardArrowRightIcon, {}) : null, title: isSelected ? token.symbol : t(`swap.selectChainAndToken`), subheader: isSelected ? `on ${chain.name}` : null, selected: isSelected, compact: compact }))] })));
29
31
  };
@@ -1,28 +1,21 @@
1
1
  /// <reference types="react" />
2
- export declare const Card: import("@emotion/styled").StyledComponent<Omit<import("@mui/material").PaperProps<"div", {}>, "classes"> & {
3
- classes?: Partial<import("@mui/material").CardClasses> | undefined;
4
- raised?: boolean | undefined;
5
- sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
6
- } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
7
- ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
8
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "ref" | "key" | "variant" | "square" | "elevation" | "raised"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
9
2
  export declare const SelectTokenCardHeader: import("@emotion/styled").StyledComponent<{
10
3
  action?: import("react").ReactNode;
11
4
  avatar?: import("react").ReactNode;
12
- classes?: Partial<import("@mui/material").CardHeaderClasses> | undefined;
5
+ classes?: Partial<import("@mui/material/CardHeader").CardHeaderClasses> | undefined;
13
6
  disableTypography?: boolean | undefined;
14
7
  subheader?: import("react").ReactNode;
15
8
  subheaderTypographyProps?: import("@mui/material").TypographyProps<"span", {
16
9
  component?: "span" | undefined;
17
10
  }> | undefined;
18
- sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
11
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
19
12
  title?: import("react").ReactNode;
20
13
  titleTypographyProps?: import("@mui/material").TypographyProps<"span", {
21
14
  component?: "span" | undefined;
22
15
  }> | undefined;
23
16
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
24
17
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
25
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "title" | "action" | "sx" | "avatar" | "disableTypography" | "subheader" | "subheaderTypographyProps" | "titleTypographyProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
18
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "title" | "action" | "sx" | "avatar" | "disableTypography" | "subheader" | "subheaderTypographyProps" | "titleTypographyProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
26
19
  selected?: boolean | undefined;
27
20
  compact?: boolean | undefined;
28
21
  }, {}, {}>;
@@ -1,13 +1,6 @@
1
- import { Card as MuiCard } from '@mui/material';
2
1
  import { cardHeaderClasses } from '@mui/material/CardHeader';
3
2
  import { styled } from '@mui/material/styles';
4
3
  import { CardHeader } from '../Card';
5
- export const Card = styled(MuiCard)(({ theme }) => ({
6
- borderRadius: 0,
7
- '&:hover': {
8
- cursor: 'pointer',
9
- },
10
- }));
11
4
  export const SelectTokenCardHeader = styled(CardHeader, {
12
5
  shouldForwardProp: (prop) => !['selected', 'compact'].includes(prop),
13
6
  })(({ theme, selected, compact }) => ({
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ export declare const SmallAvatar: import("@emotion/styled").StyledComponent<{
3
+ alt?: string | undefined;
4
+ children?: import("react").ReactNode;
5
+ classes?: Partial<import("@mui/material").AvatarClasses> | undefined;
6
+ imgProps?: (import("react").ImgHTMLAttributes<HTMLImageElement> & {
7
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
8
+ }) | undefined;
9
+ sizes?: string | undefined;
10
+ src?: string | undefined;
11
+ srcSet?: string | undefined;
12
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
13
+ variant?: "square" | "circular" | "rounded" | undefined;
14
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
15
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
16
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "alt" | "src" | "sizes" | "srcSet" | "imgProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -0,0 +1,8 @@
1
+ import { Avatar } from '@mui/material';
2
+ import { styled } from '@mui/material/styles';
3
+ export const SmallAvatar = styled(Avatar)(({ theme }) => ({
4
+ background: theme.palette.background.paper,
5
+ width: 16,
6
+ height: 16,
7
+ border: `2px solid ${theme.palette.background.paper}`,
8
+ }));
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { Step as StepType, TokenAmount } from '@lifi/sdk';
3
+ export declare const Step: React.FC<{
4
+ step: StepType;
5
+ fromToken?: TokenAmount;
6
+ toToken?: TokenAmount;
7
+ }>;
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box } from '@mui/material';
3
3
  import { useTranslation } from 'react-i18next';
4
- import { CardContainer, CardTitle } from '../../components/Card';
4
+ import { Card, CardTitle } from '../../components/Card';
5
5
  import { StepActions } from '../../components/StepActions';
6
- import { StepToken } from '../../components/StepToken';
7
- import { ExecutionItem } from './ExecutionItem';
6
+ import { Token } from '../../components/Token';
7
+ import { StepProcess } from './StepProcess';
8
8
  import { StepTimer } from './StepTimer';
9
- export const StepItem = ({ step, fromToken, toToken }) => {
9
+ export const Step = ({ step, fromToken, toToken }) => {
10
10
  var _a, _b;
11
11
  const { t } = useTranslation();
12
12
  const stepHasError = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.process.some((process) => process.status === 'FAILED');
@@ -22,8 +22,8 @@ export const StepItem = ({ step, fromToken, toToken }) => {
22
22
  return t('swap.stepSwap');
23
23
  }
24
24
  };
25
- return (_jsxs(CardContainer, Object.assign({ isError: stepHasError }, { children: [_jsxs(Box, Object.assign({ sx: {
25
+ return (_jsxs(Card, Object.assign({ variant: stepHasError ? 'error' : 'default' }, { children: [_jsxs(Box, Object.assign({ sx: {
26
26
  display: 'flex',
27
27
  flex: 1,
28
- } }, { children: [_jsx(CardTitle, Object.assign({ flex: 1 }, { children: getCardTitle() })), _jsx(CardTitle, Object.assign({ sx: { fontWeight: 500 } }, { children: _jsx(StepTimer, { step: step }) }))] })), _jsxs(Box, Object.assign({ py: 1 }, { children: [fromToken ? _jsx(StepToken, { token: fromToken, px: 2, py: 1 }) : null, _jsx(StepActions, { step: step, px: 2, py: 1, dense: true }), (_b = step.execution) === null || _b === void 0 ? void 0 : _b.process.map((process, index) => (_jsx(ExecutionItem, { step: step, process: process }, index))), toToken ? _jsx(StepToken, { token: toToken, px: 2, py: 1 }) : null] }))] })));
28
+ } }, { children: [_jsx(CardTitle, Object.assign({ flex: 1 }, { children: getCardTitle() })), _jsx(CardTitle, Object.assign({ sx: { fontWeight: 500 } }, { children: _jsx(StepTimer, { step: step }) }))] })), _jsxs(Box, Object.assign({ py: 1 }, { children: [fromToken ? _jsx(Token, { token: fromToken, px: 2, py: 1 }) : null, _jsx(StepActions, { step: step, px: 2, py: 1, dense: true }), (_b = step.execution) === null || _b === void 0 ? void 0 : _b.process.map((process, index) => (_jsx(StepProcess, { step: step, process: process }, index))), toToken ? _jsx(Token, { token: toToken, px: 2, py: 1 }) : null] }))] })));
29
29
  };
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { Process, Step } from '@lifi/sdk';
3
- export declare const ExecutionItem: React.FC<{
3
+ export declare const StepProcess: React.FC<{
4
4
  step: Step;
5
5
  process: Process;
6
6
  }>;
@@ -4,9 +4,9 @@ import { Box, Link, Typography } from '@mui/material';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { useChains } from '../../hooks';
6
6
  import { CircularProgress } from './CircularProgress';
7
- import { LinkButton } from './ExecutionItem.style';
7
+ import { LinkButton } from './StepProcess.style';
8
8
  import { getProcessMessage } from './utils';
9
- export const ExecutionItem = ({ step, process }) => {
9
+ export const StepProcess = ({ step, process }) => {
10
10
  const { t } = useTranslation();
11
11
  const { getChainById } = useChains();
12
12
  const { title, message } = getProcessMessage(t, getChainById, step, process);
@@ -6,7 +6,7 @@ export declare const LinkButton: import("@emotion/styled").StyledComponent<{
6
6
  disabled?: boolean | undefined;
7
7
  disableFocusRipple?: boolean | undefined;
8
8
  edge?: false | "end" | "start" | undefined;
9
- size?: "small" | "large" | "medium" | undefined;
9
+ size?: "small" | "medium" | "large" | undefined;
10
10
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
11
11
  } & Omit<{
12
12
  action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
File without changes
@@ -0,0 +1 @@
1
+ export * from './Step';
@@ -0,0 +1 @@
1
+ export * from './Step';
@@ -0,0 +1,6 @@
1
+ import { EVMChain, Process, Step } from '@lifi/sdk';
2
+ import { TFunction } from 'react-i18next';
3
+ export declare function getProcessMessage(t: TFunction<'translation', undefined>, getChainById: (chainId: number) => EVMChain | undefined, step: Step, process: Process): {
4
+ title?: string;
5
+ message?: string;
6
+ };
@@ -0,0 +1,89 @@
1
+ import { LifiErrorCode, MetaMaskProviderErrorCode, } from '@lifi/sdk';
2
+ import { formatTokenAmount } from '../../utils';
3
+ const formatProcessMessage = (initialMessage, args = {}) => {
4
+ return Object.keys(args).reduce((message, key) => {
5
+ return message.replace(`{${key}}`, args[key]);
6
+ }, initialMessage);
7
+ };
8
+ const processMessages = {
9
+ TOKEN_ALLOWANCE: {
10
+ STARTED: (t) => t(`swap.process.tokenAllowance.started`),
11
+ PENDING: (t) => t(`swap.process.tokenAllowance.pending`),
12
+ DONE: (t) => t(`swap.process.tokenAllowance.done`),
13
+ },
14
+ SWITCH_CHAIN: {
15
+ PENDING: (t) => t(`swap.process.switchChain.pending`),
16
+ DONE: (t) => t(`swap.process.switchChain.done`),
17
+ },
18
+ SWAP: {
19
+ STARTED: (t) => t(`swap.process.swap.started`),
20
+ ACTION_REQUIRED: (t) => t(`swap.process.swap.actionRequired`),
21
+ PENDING: (t) => t(`swap.process.swap.pending`),
22
+ DONE: (t) => t(`swap.process.swap.done`),
23
+ },
24
+ CROSS_CHAIN: {
25
+ STARTED: (t) => t(`swap.process.crossChain.started`),
26
+ ACTION_REQUIRED: (t) => t(`swap.process.crossChain.actionRequired`),
27
+ PENDING: (t) => t(`swap.process.crossChain.pending`),
28
+ DONE: (t) => t(`swap.process.crossChain.done`),
29
+ },
30
+ RECEIVING_CHAIN: {
31
+ PENDING: (t) => t(`swap.process.receivingChain.pending`),
32
+ DONE: (t) => t(`swap.process.receivingChain.done`),
33
+ },
34
+ TRANSACTION: {},
35
+ };
36
+ export function getProcessMessage(t, getChainById, step, process) {
37
+ var _a, _b, _c, _d;
38
+ if (process.error && process.status === 'FAILED') {
39
+ const getTransactionNotSentMessage = () => {
40
+ var _a, _b;
41
+ return t(`swap.error.message.transactionNotSent`, {
42
+ amount: formatTokenAmount(step.action.fromAmount, step.action.fromToken.decimals),
43
+ tokenSymbol: step.action.fromToken.symbol,
44
+ chainName: (_b = (_a = getChainById(step.action.fromChainId)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '',
45
+ });
46
+ };
47
+ let title = '';
48
+ let message = '';
49
+ switch (process.error.code) {
50
+ case LifiErrorCode.ChainSwitchError:
51
+ title = t(`swap.error.title.chainSwitch`);
52
+ message = getTransactionNotSentMessage();
53
+ break;
54
+ case LifiErrorCode.TransactionFailed:
55
+ title = t(`swap.error.title.transactionFailed`);
56
+ message = t(`swap.error.message.transactionFailed`);
57
+ break;
58
+ case LifiErrorCode.TransactionUnderpriced:
59
+ title = t(`swap.error.title.transactionUnderpriced`);
60
+ message = getTransactionNotSentMessage();
61
+ break;
62
+ case LifiErrorCode.TransactionUnprepared:
63
+ title = t(`swap.error.title.transactionUnprepared`);
64
+ message = getTransactionNotSentMessage();
65
+ break;
66
+ case LifiErrorCode.SlippageError:
67
+ title = t(`swap.error.title.slippageTooLarge`);
68
+ message = t(`swap.error.message.slippageTooLarge`);
69
+ break;
70
+ case MetaMaskProviderErrorCode.userRejectedRequest:
71
+ title = t(`swap.error.title.userRejectedSignatureRequest`);
72
+ message = t(`swap.error.message.signatureRequired`, {
73
+ amount: formatTokenAmount(step.action.fromAmount, step.action.fromToken.decimals),
74
+ tokenSymbol: step.action.fromToken.symbol,
75
+ chainName: (_b = (_a = getChainById(step.action.fromChainId)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '',
76
+ });
77
+ break;
78
+ default:
79
+ title = t(`swap.error.title.unknown`);
80
+ if (process.txLink) {
81
+ message = t(`swap.error.message.transactionFailed`);
82
+ }
83
+ break;
84
+ }
85
+ return { title, message };
86
+ }
87
+ const title = (_d = (_c = processMessages[process.type])[process.status]) === null || _d === void 0 ? void 0 : _d.call(_c, t);
88
+ return { title };
89
+ }
@@ -11,12 +11,13 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { ArrowForward as ArrowForwardIcon } from '@mui/icons-material';
14
- import { Box, Step as MuiStep, Stepper, Typography } from '@mui/material';
14
+ import { Box, Step as MuiStep, Stepper, Typography, } from '@mui/material';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import { useChains } from '../../hooks';
17
- import { formatTokenAmount } from '../../utils/format';
18
- import { LiFiLogo } from '../LiFiLogo';
19
- import { StepAvatar, StepConnector, StepContent, StepIcon, StepLabel, } from './StepActions.style';
17
+ import { ReactComponent as LiFiToolLogo } from '../../icons/LiFiToolLogo.svg';
18
+ import { formatTokenAmount } from '../../utils';
19
+ import { SmallAvatar } from '../SmallAvatar';
20
+ import { StepAvatar, StepConnector, StepContent, StepLabel, } from './StepActions.style';
20
21
  export const StepActions = (_a) => {
21
22
  var _b;
22
23
  var { step, dense } = _a, other = __rest(_a, ["step", "dense"]);
@@ -24,12 +25,21 @@ export const StepActions = (_a) => {
24
25
  ? CrossStepDetailsLabel
25
26
  : SwapStepDetailsLabel;
26
27
  const isFullView = !dense && ((_b = step.includedSteps) === null || _b === void 0 ? void 0 : _b.length) > 1;
27
- return (_jsxs(Box, Object.assign({}, other, { children: [_jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' }, mb: isFullView ? 1 : 0 }, { children: [_jsx(StepAvatar, Object.assign({ variant: step.type === 'lifi' ? 'square' : 'circular', src: step.type !== 'lifi' ? step.toolDetails.logoURI : undefined, alt: step.toolDetails.name }, { children: step.type === 'lifi' ? _jsx(LiFiLogo, {}) : step.toolDetails.name[0] })), _jsx(Typography, Object.assign({ ml: 2, fontSize: 18, fontWeight: "500", textTransform: "capitalize" }, { children: step.type === 'lifi'
28
+ // eslint-disable-next-line react/no-unstable-nested-components
29
+ const StepIconComponent = ({ icon }) => {
30
+ var _a;
31
+ const tool = (_a = step.includedSteps) === null || _a === void 0 ? void 0 : _a[Number(icon) - 1];
32
+ return tool ? (_jsx(SmallAvatar, Object.assign({ src: tool.toolDetails.logoURI, alt: tool.toolDetails.name, sx: {
33
+ boxSizing: 'content-box',
34
+ } }, { children: tool.toolDetails.name[0] }))) : null;
35
+ };
36
+ return (_jsxs(Box, Object.assign({}, other, { children: [_jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' }, mb: isFullView ? 1.5 : 0 }, { children: [_jsx(StepAvatar, Object.assign({ variant: step.type === 'lifi' ? 'square' : 'circular', src: step.type !== 'lifi' ? step.toolDetails.logoURI : undefined, alt: step.toolDetails.name }, { children: step.type === 'lifi' ? _jsx(LiFiToolLogo, {}) : step.toolDetails.name[0] })), _jsx(Typography, Object.assign({ ml: 2, fontSize: 18, fontWeight: "500", textTransform: "capitalize" }, { children: step.type === 'lifi'
28
37
  ? 'LI.FI Smart Contract'
29
- : step.toolDetails.name }))] })), isFullView ? (_jsx(Stepper, Object.assign({ orientation: "vertical", connector: _jsx(StepConnector, {}), activeStep: -1 }, { children: step.includedSteps.map((step) => (_jsxs(MuiStep, Object.assign({ expanded: true }, { children: [_jsx(StepLabel, Object.assign({ StepIconComponent: StepIcon }, { children: step.type === 'cross' || step.type === 'lifi' ? (_jsx(CrossStepDetailsLabel, { step: step })) : (_jsx(SwapStepDetailsLabel, { step: step })) })), _jsx(StepContent, { children: _jsx(StepDetailsContent, { step: step }) })] }), step.id))) }))) : (_jsxs(Box, Object.assign({ ml: 6 }, { children: [_jsx(StepDetailsLabel, { step: step }), _jsx(StepDetailsContent, { step: step })] })))] })));
38
+ : step.toolDetails.name }))] })), isFullView ? (_jsx(Stepper, Object.assign({ orientation: "vertical", connector: _jsx(StepConnector, {}), activeStep: -1 }, { children: step.includedSteps.map((step) => (_jsxs(MuiStep, Object.assign({ expanded: true }, { children: [_jsx(StepLabel, Object.assign({ StepIconComponent: StepIconComponent }, { children: step.type === 'cross' || step.type === 'lifi' ? (_jsx(CrossStepDetailsLabel, { step: step })) : (_jsx(SwapStepDetailsLabel, { step: step })) })), _jsx(StepContent, { children: _jsx(StepDetailsContent, { step: step }) })] }), step.id))) }))) : (_jsxs(Box, Object.assign({ ml: 6 }, { children: [_jsx(StepDetailsLabel, { step: step }), _jsx(StepDetailsContent, { step: step })] })))] })));
30
39
  };
31
40
  export const StepDetailsContent = ({ step }) => {
32
- return (_jsxs(Typography, Object.assign({ fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex" }, { children: [formatTokenAmount(step.estimate.fromAmount, step.action.fromToken.decimals), ' ', step.action.fromToken.symbol, _jsx(ArrowForwardIcon, { sx: { fontSize: 18, paddingX: 0.5 } }), formatTokenAmount(step.estimate.toAmount, step.action.toToken.decimals), ' ', step.action.toToken.symbol] })));
41
+ var _a, _b;
42
+ return (_jsxs(Typography, Object.assign({ fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex" }, { children: [formatTokenAmount(step.estimate.fromAmount, step.action.fromToken.decimals), ' ', step.action.fromToken.symbol, _jsx(ArrowForwardIcon, { sx: { fontSize: 18, paddingX: 0.5 } }), formatTokenAmount((_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toAmount) !== null && _b !== void 0 ? _b : step.estimate.toAmount, step.action.toToken.decimals), ' ', step.action.toToken.symbol] })));
33
43
  };
34
44
  export const CrossStepDetailsLabel = ({ step }) => {
35
45
  var _a, _b;
@@ -30,8 +30,8 @@ export const StepLabel = styled(MuiStepLabel, {
30
30
  })(({ theme }) => ({
31
31
  padding: 0,
32
32
  [`.${stepLabelClasses.iconContainer}`]: {
33
- paddingLeft: theme.spacing(1.25),
34
- paddingRight: theme.spacing(3.25),
33
+ paddingLeft: theme.spacing(0.75),
34
+ paddingRight: theme.spacing(2.75),
35
35
  },
36
36
  [`&.${stepLabelClasses.disabled}`]: {
37
37
  cursor: 'inherit',
@@ -0,0 +1 @@
1
+ export * from './StepDivider';
@@ -0,0 +1 @@
1
+ export * from './StepDivider';
@@ -12,20 +12,20 @@ import { ChainId } from '@lifi/sdk';
12
12
  import { useWatch } from 'react-hook-form';
13
13
  import { useTranslation } from 'react-i18next';
14
14
  import { useNavigate } from 'react-router-dom';
15
- import { useChains, useHasSufficientBalance } from '../../hooks';
15
+ import { useChains, useGasSufficiency } from '../../hooks';
16
16
  import { SwapFormKeyHelper } from '../../providers/SwapFormProvider';
17
17
  import { useWallet } from '../../providers/WalletProvider';
18
18
  import { useWidgetConfig } from '../../providers/WidgetProvider';
19
- import { routes } from '../../utils/routes';
19
+ import { navigationRoutes } from '../../utils';
20
20
  import { Button } from './SwapButton.style';
21
- export const SwapButton = ({ onClick, text, loading, }) => {
21
+ export const SwapButton = ({ onClick, currentRoute, text, loading, }) => {
22
22
  var _a;
23
23
  const navigate = useNavigate();
24
24
  const { t } = useTranslation();
25
25
  const { getChainById } = useChains();
26
26
  const config = useWidgetConfig();
27
27
  const { account, switchChain, connect: walletConnect } = useWallet();
28
- const { hasGasOnStartChain, hasGasOnCrossChain, hasSufficientBalance } = useHasSufficientBalance();
28
+ const { insufficientFunds, insufficientGas } = useGasSufficiency(currentRoute);
29
29
  const [chainId] = useWatch({
30
30
  name: [SwapFormKeyHelper.getChainKey('from')],
31
31
  });
@@ -36,7 +36,7 @@ export const SwapButton = ({ onClick, text, loading, }) => {
36
36
  yield walletConnect();
37
37
  }
38
38
  else {
39
- navigate(routes.selectWallet);
39
+ navigate(navigationRoutes.selectWallet);
40
40
  }
41
41
  }
42
42
  else if (!isCurrentChainMatch) {
@@ -52,15 +52,12 @@ export const SwapButton = ({ onClick, text, loading, }) => {
52
52
  if (!isCurrentChainMatch) {
53
53
  return t(`button.switchChain`);
54
54
  }
55
- return text || t(`button.swap`);
55
+ return text || t(`button.reviewSwap`);
56
56
  }
57
57
  return t(`button.connectWallet`);
58
58
  };
59
- return (_jsx(Button, Object.assign({ variant: "contained", disableElevation: true, fullWidth: true, color: account.isActive ? 'primary' : 'success', onClick: handleSwapButtonClick,
59
+ return (_jsx(Button, Object.assign({ variant: "contained", color: account.isActive ? 'primary' : 'success', onClick: handleSwapButtonClick,
60
60
  // loading={isLoading || isFetching}
61
- disabled: (!hasSufficientBalance ||
62
- !hasGasOnStartChain ||
63
- !hasGasOnCrossChain ||
64
- loading) &&
65
- isCurrentChainMatch }, { children: getButtonText() })));
61
+ disabled: (insufficientFunds || !!insufficientGas.length || loading) &&
62
+ isCurrentChainMatch, fullWidth: true }, { children: getButtonText() })));
66
63
  };
@@ -24,7 +24,7 @@ export declare const Button: import("@emotion/styled").StyledComponent<{
24
24
  endIcon?: import("react").ReactNode;
25
25
  fullWidth?: boolean | undefined;
26
26
  href?: string | undefined;
27
- size?: "small" | "large" | "medium" | undefined;
27
+ size?: "small" | "medium" | "large" | undefined;
28
28
  startIcon?: import("react").ReactNode;
29
29
  sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
30
30
  variant?: "text" | "outlined" | "contained" | undefined;
@@ -1,12 +1,8 @@
1
1
  import { LoadingButton } from '@mui/lab';
2
2
  import { loadingButtonClasses } from '@mui/lab/LoadingButton';
3
3
  import { styled } from '@mui/material/styles';
4
- import { getContrastAlphaColor } from '../../utils/colors';
4
+ import { getContrastAlphaColor } from '../../utils';
5
5
  export const Button = styled(LoadingButton)(({ theme }) => ({
6
- textTransform: 'none',
7
- borderRadius: theme.shape.borderRadiusSecondary,
8
- padding: theme.spacing(1.25, 2),
9
- fontSize: '1rem',
10
6
  [`&.${loadingButtonClasses.loading}`]: {
11
7
  color: 'transparent',
12
8
  },
@@ -1,5 +1,7 @@
1
+ import { Route } from '@lifi/sdk';
1
2
  export interface SwapButtonProps {
2
3
  onClick?(): void;
4
+ currentRoute?: Route;
3
5
  text?: string;
4
6
  loading?: boolean;
5
7
  }
@@ -1,22 +1,25 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ArrowForward as ArrowForwardIcon, KeyboardArrowRight as KeyboardArrowRightIcon, } from '@mui/icons-material';
3
- import { AvatarGroup, Box, Stack } from '@mui/material';
3
+ import { Box, Stack } from '@mui/material';
4
4
  import { useCallback } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import { useNavigate } from 'react-router-dom';
7
+ import { useWallet } from '../../providers/WalletProvider';
7
8
  import { useExecutingRoutes } from '../../stores';
8
- import { routes } from '../../utils/routes';
9
+ import { navigationRoutes } from '../../utils';
9
10
  import { CardTitle } from '../Card';
10
- import { Card, RouteAvatar, RouteCard } from './SwapInProgress.style';
11
+ import { TokenAvatar, TokenAvatarGroup } from '../TokenAvatar';
12
+ import { ProgressCard, RouteCard } from './SwapInProgress.style';
11
13
  export const SwapInProgress = (props) => {
12
14
  const { t } = useTranslation();
13
15
  const navigate = useNavigate();
14
- const executingRoutes = useExecutingRoutes();
16
+ const { account } = useWallet();
17
+ const executingRoutes = useExecutingRoutes(account.address);
15
18
  const handleCardClick = useCallback((routeId) => {
16
- navigate(routes.swap, { state: { routeId } });
19
+ navigate(navigationRoutes.swapExecution, { state: { routeId } });
17
20
  }, [navigate]);
18
21
  if (!(executingRoutes === null || executingRoutes === void 0 ? void 0 : executingRoutes.length)) {
19
22
  return null;
20
23
  }
21
- return (_jsxs(Card, Object.assign({}, props, { children: [_jsx(CardTitle, { children: t('swap.inProgress') }), _jsx(Stack, Object.assign({ spacing: 2, py: 2 }, { children: executingRoutes.map(({ route, status }) => (_jsx(RouteCard, { onClick: () => handleCardClick(route.id), avatar: _jsxs(AvatarGroup, Object.assign({ total: 2 }, { children: [_jsx(RouteAvatar, Object.assign({ src: route.fromToken.logoURI, alt: route.fromToken.symbol }, { children: route.fromToken.symbol[0] })), _jsx(RouteAvatar, Object.assign({ src: route.toToken.logoURI, alt: route.toToken.symbol }, { children: route.toToken.symbol[0] }))] })), action: _jsx(KeyboardArrowRightIcon, {}), title: _jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: [route.fromToken.symbol, _jsx(ArrowForwardIcon, { fontSize: "small", sx: { paddingX: 0.5 } }), route.toToken.symbol] })) }, route.id))) }))] })));
24
+ return (_jsxs(ProgressCard, Object.assign({}, props, { children: [_jsx(CardTitle, { children: t('swap.inProgress') }), _jsx(Stack, Object.assign({ spacing: 2, py: 2 }, { children: executingRoutes.map(({ route, status }) => (_jsx(RouteCard, { onClick: () => handleCardClick(route.id), avatar: _jsxs(TokenAvatarGroup, Object.assign({ total: 2 }, { children: [_jsx(TokenAvatar, { token: route.fromToken }), _jsx(TokenAvatar, { token: route.toToken })] })), action: _jsx(KeyboardArrowRightIcon, {}), title: _jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: [route.fromToken.symbol, _jsx(ArrowForwardIcon, { fontSize: "small", sx: { paddingX: 0.5 } }), route.toToken.symbol] })) }, route.id))) }))] })));
22
25
  };