@lifi/widget 1.32.3 → 1.32.5

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 (106) hide show
  1. package/AppDrawer.js +2 -1
  2. package/cjs/AppDrawer.js +3 -2
  3. package/cjs/components/ActiveSwaps/ActiveSwapItem.js +6 -4
  4. package/cjs/components/ChainSelect/useChainSelect.js +1 -1
  5. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +2 -2
  6. package/cjs/components/Header/NavigationHeader.js +5 -3
  7. package/cjs/components/Header/WalletHeader.js +8 -4
  8. package/cjs/components/NotFound.js +2 -2
  9. package/cjs/components/ReverseTokensButton/ReverseTokensButton.js +3 -2
  10. package/cjs/components/SendToWallet/SendToWalletButton.js +2 -2
  11. package/cjs/components/Step/CircularProgress.js +8 -5
  12. package/cjs/components/Step/DestinationWalletAddress.js +4 -3
  13. package/cjs/components/Step/GasStepProcess.js +2 -2
  14. package/cjs/components/Step/StepProcess.js +2 -2
  15. package/cjs/components/StepActions/StepActions.js +2 -2
  16. package/cjs/components/SwapRouteCard/SwapRouteCard.js +8 -4
  17. package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.js +2 -2
  18. package/cjs/components/SwapRoutes/SwapRoutes.js +2 -2
  19. package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +1 -2
  20. package/cjs/components/TokenList/TokenNotFound.js +2 -2
  21. package/cjs/config/version.d.ts +1 -1
  22. package/cjs/config/version.js +1 -1
  23. package/cjs/hooks/useRouteExecution.js +1 -1
  24. package/cjs/hooks/useSwapRoutes.d.ts +2 -4
  25. package/cjs/hooks/useSwapRoutes.js +19 -0
  26. package/cjs/hooks/useTokenAddressBalance.js +1 -0
  27. package/cjs/hooks/useTokenBalance.js +7 -10
  28. package/cjs/hooks/useTokenBalances.js +0 -1
  29. package/cjs/hooks/useTokenSearch.js +6 -4
  30. package/cjs/i18n/de.json +89 -82
  31. package/cjs/i18n/es.json +52 -22
  32. package/cjs/i18n/id.json +230 -0
  33. package/cjs/i18n/index.d.ts +4 -1
  34. package/cjs/i18n/index.js +7 -2
  35. package/cjs/i18n/ko.json +230 -0
  36. package/cjs/i18n/tr.json +230 -0
  37. package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +2 -2
  38. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.js +2 -3
  39. package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +6 -3
  40. package/cjs/pages/SelectTokenPage/SearchTokenInput.js +2 -2
  41. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +4 -2
  42. package/cjs/pages/SettingsPage/EnabledToolsButton.js +3 -3
  43. package/cjs/pages/SettingsPage/GasPriceSelect.js +2 -2
  44. package/cjs/pages/SettingsPage/LanguageSelect.js +2 -2
  45. package/cjs/pages/SettingsPage/RoutePrioritySelect.js +2 -2
  46. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +4 -3
  47. package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.js +2 -2
  48. package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +2 -3
  49. package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +2 -2
  50. package/cjs/pages/SwapPage/StatusBottomSheet.js +6 -4
  51. package/cjs/pages/SwapPage/SwapPage.js +2 -2
  52. package/cjs/pages/SwapPage/TokenValueBottomSheet.js +2 -2
  53. package/cjs/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +1 -2
  54. package/components/ActiveSwaps/ActiveSwapItem.js +5 -3
  55. package/components/ChainSelect/useChainSelect.js +1 -1
  56. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +2 -2
  57. package/components/Header/NavigationHeader.js +5 -3
  58. package/components/Header/WalletHeader.js +6 -2
  59. package/components/NotFound.js +1 -1
  60. package/components/ReverseTokensButton/ReverseTokensButton.js +2 -1
  61. package/components/SendToWallet/SendToWalletButton.js +1 -1
  62. package/components/Step/CircularProgress.js +8 -5
  63. package/components/Step/DestinationWalletAddress.js +3 -2
  64. package/components/Step/GasStepProcess.js +2 -2
  65. package/components/Step/StepProcess.js +2 -2
  66. package/components/StepActions/StepActions.js +1 -1
  67. package/components/SwapRouteCard/SwapRouteCard.js +7 -3
  68. package/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -1
  69. package/components/SwapRoutes/SwapRoutes.js +1 -1
  70. package/components/SwapRoutes/SwapRoutes.style.d.ts +1 -2
  71. package/components/TokenList/TokenNotFound.js +1 -1
  72. package/config/version.d.ts +1 -1
  73. package/config/version.js +1 -1
  74. package/hooks/useRouteExecution.js +1 -1
  75. package/hooks/useSwapRoutes.d.ts +2 -4
  76. package/hooks/useSwapRoutes.js +19 -0
  77. package/hooks/useTokenAddressBalance.js +1 -0
  78. package/hooks/useTokenBalance.js +7 -10
  79. package/hooks/useTokenBalances.js +0 -1
  80. package/hooks/useTokenSearch.js +6 -4
  81. package/i18n/de.json +89 -82
  82. package/i18n/es.json +52 -22
  83. package/i18n/id.json +230 -0
  84. package/i18n/index.d.ts +4 -1
  85. package/i18n/index.js +4 -2
  86. package/i18n/ko.json +230 -0
  87. package/i18n/tr.json +230 -0
  88. package/package.json +11 -11
  89. package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -1
  90. package/pages/ActiveSwapsPage/ActiveSwapsPage.js +2 -3
  91. package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +6 -3
  92. package/pages/SelectTokenPage/SearchTokenInput.js +1 -1
  93. package/pages/SettingsPage/ColorSchemeButtonGroup.js +3 -1
  94. package/pages/SettingsPage/EnabledToolsButton.js +2 -2
  95. package/pages/SettingsPage/GasPriceSelect.js +1 -1
  96. package/pages/SettingsPage/LanguageSelect.js +1 -1
  97. package/pages/SettingsPage/RoutePrioritySelect.js +1 -1
  98. package/pages/SwapDetailsPage/SwapDetailsPage.js +3 -2
  99. package/pages/SwapHistoryPage/SwapHistoryEmpty.js +2 -2
  100. package/pages/SwapHistoryPage/SwapHistoryPage.js +2 -3
  101. package/pages/SwapPage/ExchangeRateBottomSheet.js +2 -2
  102. package/pages/SwapPage/StatusBottomSheet.js +6 -4
  103. package/pages/SwapPage/SwapPage.js +1 -1
  104. package/pages/SwapPage/TokenValueBottomSheet.js +2 -2
  105. package/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +1 -2
  106. package/tsconfig.cjs.tsbuildinfo +1 -1
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  export declare const Stack: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
3
- ref?: import("react").Ref<unknown> | undefined;
4
3
  children?: import("react").ReactNode;
5
4
  direction?: import("@mui/system").ResponsiveStyleValue<"column" | "column-reverse" | "row" | "row-reverse"> | undefined;
6
5
  spacing?: import("@mui/system").ResponsiveStyleValue<string | number> | undefined;
@@ -8,4 +7,4 @@ export declare const Stack: import("@emotion/styled").StyledComponent<import("@m
8
7
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
9
8
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
10
9
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
11
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | "direction" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
10
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "direction" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -1,5 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ArrowForward as ArrowForwardIcon, ErrorRounded as ErrorIcon, InfoRounded as InfoIcon, } from '@mui/icons-material';
2
+ import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
3
+ import ErrorRoundedIcon from '@mui/icons-material/ErrorRounded';
4
+ import InfoRoundedIcon from '@mui/icons-material/InfoRounded';
3
5
  import { ListItemAvatar, ListItemText, Typography } from '@mui/material';
4
6
  import { useNavigate } from 'react-router-dom';
5
7
  import { useProcessMessage, useRouteExecution } from '../../hooks';
@@ -30,9 +32,9 @@ export const ActiveSwapItem = ({ routeId, dense }) => {
30
32
  const getStatusComponent = () => {
31
33
  switch (lastActiveProcess?.status) {
32
34
  case 'ACTION_REQUIRED':
33
- return _jsx(InfoIcon, { color: "info", fontSize: "small" });
35
+ return _jsx(InfoRoundedIcon, { color: "info", fontSize: "small" });
34
36
  case 'FAILED':
35
- return _jsx(ErrorIcon, { color: "error", fontSize: "small" });
37
+ return _jsx(ErrorRoundedIcon, { color: "error", fontSize: "small" });
36
38
  default:
37
39
  return (_jsx(Typography, { fontSize: 14, fontWeight: 500, children: _jsx(StepTimer, { step: lastActiveStep, hideInProgress: true }) }));
38
40
  }
@@ -14,7 +14,7 @@ export const useChainSelect = (formType) => {
14
14
  }
15
15
  const selectedChains = chainOrder
16
16
  .map((chainId) => chains.find((chain) => chain.id === chainId))
17
- .filter((chain) => chain);
17
+ .filter(Boolean);
18
18
  return selectedChains;
19
19
  };
20
20
  const setCurrentChain = (chainId) => {
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { WarningAmberRounded as WarningIcon } from '@mui/icons-material';
2
+ import WarningAmberRoundedIcon from '@mui/icons-material/WarningAmberRounded';
3
3
  import { Box, Collapse, Typography } from '@mui/material';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { useGasSufficiency } from '../../hooks';
@@ -10,7 +10,7 @@ export const GasSufficiencyMessage = ({ route, ...props }) => {
10
10
  const { t } = useTranslation();
11
11
  const recommendedRoute = useRecommendedRouteStore((state) => state.recommendedRoute);
12
12
  const { insufficientFunds, insufficientGas } = useGasSufficiency(route ?? recommendedRoute);
13
- return (_jsx(Collapse, { timeout: 225, in: Boolean(insufficientFunds || insufficientGas?.length), unmountOnExit: true, mountOnEnter: true, appear: true, children: _jsx(Box, { ...props, children: _jsxs(MessageCard, { children: [_jsx(WarningIcon, { sx: {
13
+ return (_jsx(Collapse, { timeout: 225, in: Boolean(insufficientFunds || insufficientGas?.length), unmountOnExit: true, mountOnEnter: true, appear: true, children: _jsx(Box, { ...props, children: _jsxs(MessageCard, { children: [_jsx(WarningAmberRoundedIcon, { sx: {
14
14
  marginTop: 2,
15
15
  marginLeft: 2,
16
16
  } }), _jsxs(Box, { children: [insufficientGas?.length ? (_jsx(CardTitle, { children: t(`swap.warning.title.insufficientGas`) })) : null, insufficientFunds ? (_jsx(Typography, { variant: "body2", px: 2, pb: insufficientGas?.length ? 0 : 2, pt: insufficientGas?.length ? 1 : 2, children: insufficientFunds
@@ -1,5 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ArrowBack as ArrowBackIcon, ReceiptLongRounded as HistoryIcon, SettingsOutlined as SettingsIcon, } from '@mui/icons-material';
2
+ import ArrowBackIcon from '@mui/icons-material/ArrowBack';
3
+ import ReceiptLongRoundedIcon from '@mui/icons-material/ReceiptLongRounded';
4
+ import SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined';
3
5
  import { Box, IconButton, Tooltip, Typography } from '@mui/material';
4
6
  import { useTranslation } from 'react-i18next';
5
7
  import { Route, Routes, useLocation } from 'react-router-dom';
@@ -60,7 +62,7 @@ export const NavigationHeader = () => {
60
62
  }
61
63
  }
62
64
  };
63
- return (_jsxs(HeaderAppBar, { elevation: 0, children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: _jsx(ArrowBackIcon, {}) })) : null, _jsx(Typography, { fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true, children: handleHeaderTitle() }), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsxs(_Fragment, { children: [account.isActive ? (_jsx(Tooltip, { title: t(`header.swapHistory`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", edge: "start", onClick: () => navigate(navigationRoutes.swapHistory), children: _jsx(HistoryIcon, {}) }) })) : null, _jsx(Tooltip, { title: t(`header.settings`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", onClick: () => navigate(navigationRoutes.settings), sx: {
65
+ return (_jsxs(HeaderAppBar, { elevation: 0, children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: _jsx(ArrowBackIcon, {}) })) : null, _jsx(Typography, { fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true, children: handleHeaderTitle() }), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsxs(_Fragment, { children: [account.isActive ? (_jsx(Tooltip, { title: t(`header.swapHistory`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", edge: "start", onClick: () => navigate(navigationRoutes.swapHistory), children: _jsx(ReceiptLongRoundedIcon, {}) }) })) : null, _jsx(Tooltip, { title: t(`header.settings`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", onClick: () => navigate(navigationRoutes.settings), sx: {
64
66
  marginRight: -1.25,
65
- }, children: _jsx(SettingsIcon, {}) }) })] }) }), _jsx(Route, { path: "*", element: element || _jsx(Box, { width: 28, height: 40 }) })] })] }));
67
+ }, children: _jsx(SettingsOutlinedIcon, {}) }) })] }) }), _jsx(Route, { path: "*", element: element || _jsx(Box, { width: 28, height: 40 }) })] })] }));
66
68
  };
@@ -1,5 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { ContentCopy as ContentCopyIcon, ExpandMore as ExpandMoreIcon, OpenInNewOutlined as OpenInNewOutlinedIcon, PowerSettingsNewRounded as PowerSettingsIcon, WalletOutlined as WalletOutlinedIcon, } from '@mui/icons-material';
2
+ import ContentCopyIcon from '@mui/icons-material/ContentCopy';
3
+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
4
+ import OpenInNewOutlinedIcon from '@mui/icons-material/OpenInNewOutlined';
5
+ import PowerSettingsNewRoundedIcon from '@mui/icons-material/PowerSettingsNewRounded';
6
+ import WalletOutlinedIcon from '@mui/icons-material/WalletOutlined';
3
7
  import { Avatar, Button, MenuItem } from '@mui/material';
4
8
  import { useState } from 'react';
5
9
  import { useTranslation } from 'react-i18next';
@@ -52,7 +56,7 @@ const ConnectedButton = () => {
52
56
  };
53
57
  return (_jsxs(_Fragment, { children: [_jsx(WalletButton, { endIcon: _jsx(ExpandMoreIcon, {}), startIcon: _jsx(Avatar, { src: chain?.logoURI, alt: chain?.key, sx: { width: 24, height: 24 }, children: chain?.name[0] }), sx: {
54
58
  marginRight: -1.25,
55
- }, onClick: handleClick, children: walletAddress }), _jsxs(WalletMenu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, children: [_jsxs(MenuItem, { onClick: handleCopyAddress, children: [_jsx(ContentCopyIcon, {}), t(`button.copyAddress`)] }), _jsxs(MenuItem, { component: "a", onClick: handleClose, href: `${chain?.metamask.blockExplorerUrls[0]}address/${account.address}`, target: "_blank", children: [_jsx(OpenInNewOutlinedIcon, {}), t(`button.viewOnExplorer`)] }), _jsx(Button, { onClick: handleDisconnect, fullWidth: true, startIcon: _jsx(PowerSettingsIcon, {}), sx: {
59
+ }, onClick: handleClick, children: walletAddress }), _jsxs(WalletMenu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, children: [_jsxs(MenuItem, { onClick: handleCopyAddress, children: [_jsx(ContentCopyIcon, {}), t(`button.copyAddress`)] }), _jsxs(MenuItem, { component: "a", onClick: handleClose, href: `${chain?.metamask.blockExplorerUrls[0]}address/${account.address}`, target: "_blank", children: [_jsx(OpenInNewOutlinedIcon, {}), t(`button.viewOnExplorer`)] }), _jsx(Button, { onClick: handleDisconnect, fullWidth: true, startIcon: _jsx(PowerSettingsNewRoundedIcon, {}), sx: {
56
60
  marginTop: 1,
57
61
  }, children: t(`button.disconnect`) })] })] }));
58
62
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Block as BlockIcon } from '@mui/icons-material';
2
+ import BlockIcon from '@mui/icons-material/Block';
3
3
  import { Box, Typography } from '@mui/material';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  export const NotFound = () => {
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { SwapHoriz as SwapHorizIcon, SwapVert as SwapVertIcon, } from '@mui/icons-material';
2
+ import SwapHorizIcon from '@mui/icons-material/SwapHoriz';
3
+ import SwapVertIcon from '@mui/icons-material/SwapVert';
3
4
  import { useFormContext } from 'react-hook-form';
4
5
  import { SwapFormKey } from '../../providers';
5
6
  import { IconButton } from './ReverseTokensButton.style';
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { WalletOutlined as WalletOutlinedIcon } from '@mui/icons-material';
2
+ import WalletOutlinedIcon from '@mui/icons-material/WalletOutlined';
3
3
  import { Button, Tooltip } from '@mui/material';
4
4
  import { useFormContext } from 'react-hook-form';
5
5
  import { useTranslation } from 'react-i18next';
@@ -1,20 +1,23 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Done as DoneIcon, ErrorRounded as ErrorIcon, InfoRounded as InfoIcon, WarningRounded as WarningIcon } from '@mui/icons-material';
2
+ import DoneIcon from '@mui/icons-material/Done';
3
+ import ErrorRoundedIcon from '@mui/icons-material/ErrorRounded';
4
+ import InfoRoundedIcon from '@mui/icons-material/InfoRounded';
5
+ import WarningRoundedIcon from '@mui/icons-material/WarningRounded';
3
6
  import { darken } from '@mui/material/styles';
4
- import { CircularIcon, CircularProgressPending } from './CircularProgress.style';
7
+ import { CircularIcon, CircularProgressPending, } from './CircularProgress.style';
5
8
  export function CircularProgress({ process }) {
6
- return (_jsxs(CircularIcon, { status: process.status, substatus: process.substatus, children: [process.status === 'STARTED' || process.status === 'PENDING' ? (_jsx(CircularProgressPending, { size: 32, thickness: 3 })) : null, process.status === 'ACTION_REQUIRED' ? (_jsx(InfoIcon, { color: "info", sx: {
9
+ return (_jsxs(CircularIcon, { status: process.status, substatus: process.substatus, children: [process.status === 'STARTED' || process.status === 'PENDING' ? (_jsx(CircularProgressPending, { size: 32, thickness: 3 })) : null, process.status === 'ACTION_REQUIRED' ? (_jsx(InfoRoundedIcon, { color: "info", sx: {
7
10
  position: 'absolute',
8
11
  fontSize: '1rem',
9
12
  } })) : null, process.status === 'DONE' &&
10
- (process.substatus === 'PARTIAL' || process.substatus === 'REFUNDED') ? (_jsx(WarningIcon, { sx: (theme) => ({
13
+ (process.substatus === 'PARTIAL' || process.substatus === 'REFUNDED') ? (_jsx(WarningRoundedIcon, { sx: (theme) => ({
11
14
  position: 'absolute',
12
15
  fontSize: '1rem',
13
16
  color: darken(theme.palette.warning.main, 0.32),
14
17
  }) })) : process.status === 'DONE' ? (_jsx(DoneIcon, { color: "success", sx: {
15
18
  position: 'absolute',
16
19
  fontSize: '1rem',
17
- } })) : null, process.status === 'FAILED' ? (_jsx(ErrorIcon, { color: "error", sx: {
20
+ } })) : null, process.status === 'FAILED' ? (_jsx(ErrorRoundedIcon, { color: "error", sx: {
18
21
  position: 'absolute',
19
22
  fontSize: '1rem',
20
23
  } })) : null] }));
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { LinkRounded as LinkIcon, WalletOutlined as WalletOutlinedIcon } from '@mui/icons-material';
2
+ import LinkRoundedIcon from '@mui/icons-material/LinkRounded';
3
+ import WalletOutlinedIcon from '@mui/icons-material/WalletOutlined';
3
4
  import { Box, Link, Typography } from '@mui/material';
4
5
  import { useTranslation } from 'react-i18next';
5
6
  import { CircularIcon } from './CircularProgress.style';
@@ -23,5 +24,5 @@ export const DestinationWalletAddress = ({ step, toAddress, toAddressLink }) =>
23
24
  display: 'flex',
24
25
  flex: 1,
25
26
  justifyContent: 'flex-end',
26
- }, children: _jsx(LinkButton, { size: "small", edge: "end", LinkComponent: Link, href: toAddressLink, target: "_blank", rel: "nofollow noreferrer", children: _jsx(LinkIcon, {}) }) })] }) }));
27
+ }, children: _jsx(LinkButton, { size: "small", edge: "end", LinkComponent: Link, href: toAddressLink, target: "_blank", rel: "nofollow noreferrer", children: _jsx(LinkRoundedIcon, {}) }) })] }) }));
27
28
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { EvStationOutlined as EvStationIcon } from '@mui/icons-material';
2
+ import EvStationOutlinedIcon from '@mui/icons-material/EvStationOutlined';
3
3
  import { Box, Typography } from '@mui/material';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { CircularIcon } from './CircularProgress.style';
@@ -9,7 +9,7 @@ export const GasStepProcess = ({ step }) => {
9
9
  return (_jsx(Box, { px: 2, py: 1, children: _jsxs(Box, { sx: {
10
10
  display: 'flex',
11
11
  alignItems: 'center',
12
- }, children: [_jsx(CircularIcon, { status: isDone ? 'DONE' : 'NOT_STARTED', children: _jsx(EvStationIcon, { color: isDone ? 'success' : 'inherit', sx: {
12
+ }, children: [_jsx(CircularIcon, { status: isDone ? 'DONE' : 'NOT_STARTED', children: _jsx(EvStationOutlinedIcon, { color: isDone ? 'success' : 'inherit', sx: {
13
13
  position: 'absolute',
14
14
  fontSize: '1rem',
15
15
  } }) }), _jsxs(Typography, { ml: 2, fontSize: 14, fontWeight: 400, children: [t('format.currency', {
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { LinkRounded as LinkIcon } from '@mui/icons-material';
2
+ import LinkRoundedIcon from '@mui/icons-material/LinkRounded';
3
3
  import { Box, Link, Typography } from '@mui/material';
4
4
  import { useProcessMessage } from '../../hooks';
5
5
  import { CircularProgress } from './CircularProgress';
@@ -13,5 +13,5 @@ export const StepProcess = ({ step, process }) => {
13
13
  display: 'flex',
14
14
  flex: 1,
15
15
  justifyContent: 'flex-end',
16
- }, children: _jsx(LinkButton, { size: "small", edge: "end", LinkComponent: Link, href: process.txLink, target: "_blank", rel: "nofollow noreferrer", children: _jsx(LinkIcon, {}) }) })) : null] }), message ? (_jsx(Typography, { ml: 6, fontSize: 14, fontWeight: 500, color: "text.secondary", children: message })) : null] }));
16
+ }, children: _jsx(LinkButton, { size: "small", edge: "end", LinkComponent: Link, href: process.txLink, target: "_blank", rel: "nofollow noreferrer", children: _jsx(LinkRoundedIcon, {}) }) })) : null] }), message ? (_jsx(Typography, { ml: 6, fontSize: 14, fontWeight: 500, color: "text.secondary", children: message })) : null] }));
17
17
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { ArrowForward as ArrowForwardIcon } from '@mui/icons-material';
2
+ import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
3
3
  import { Box, Step as MuiStep, Stepper, Typography } from '@mui/material';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { useChains } from '../../hooks';
@@ -1,5 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { AccessTime as AccessTimeIcon, EvStationOutlined as EvStationIcon, ExpandLess as ExpandLessIcon, ExpandMore as ExpandMoreIcon, LayersOutlined as LayersIcon, } from '@mui/icons-material';
2
+ import AccessTimeIcon from '@mui/icons-material/AccessTime';
3
+ import EvStationOutlinedIcon from '@mui/icons-material/EvStationOutlined';
4
+ import ExpandLessIcon from '@mui/icons-material/ExpandLess';
5
+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
6
+ import LayersOutlinedIcon from '@mui/icons-material/LayersOutlined';
3
7
  import { Box, Collapse, Tooltip, Typography } from '@mui/material';
4
8
  import { useState } from 'react';
5
9
  import { useTranslation } from 'react-i18next';
@@ -34,7 +38,7 @@ export const SwapRouteCardEssentials = ({ route, dense }) => {
34
38
  .reduce((duration, x) => duration + x, 0) / 60);
35
39
  const gasCostUSD = parseFloat(route.gasCostUSD ?? '') || 0.01;
36
40
  const gasCosts = getGasCostsBreakdown(route);
37
- return (_jsxs(Box, { display: "flex", justifyContent: dense ? 'space-between' : 'flex-end', flex: 1, pl: dense ? 0 : 2, mt: dense ? 2 : 0, children: [_jsx(Tooltip, { title: _jsxs(Box, { component: "span", children: [t(`tooltip.estimatedNetworkFee`), gasCosts.map((gas) => (_jsxs(Typography, { fontSize: 11, children: [gas.amount?.toFixed(6), " ", gas.token.symbol, " (", t(`format.currency`, { value: gas.amountUSD }), ")"] }, `${gas.token.address}${gas.token.symbol}`)))] }), placement: "top", enterDelay: 400, arrow: true, children: _jsxs(Box, { display: "flex", alignItems: "center", mr: dense ? 0 : 2, children: [_jsx(Typography, { lineHeight: 0, mr: 0.5, color: "grey.500", children: _jsx(EvStationIcon, { fontSize: dense ? 'medium' : 'small' }) }), _jsx(Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: t(`format.currency`, { value: gasCostUSD }) })] }) }), _jsx(Tooltip, { title: t(`tooltip.estimatedTime`), placement: "top", enterDelay: 400, arrow: true, children: _jsxs(Box, { display: "flex", alignItems: "center", mr: dense ? 0 : 2, children: [_jsx(Typography, { lineHeight: 0, mr: 0.5, color: "grey.500", children: _jsx(AccessTimeIcon, { fontSize: dense ? 'medium' : 'small' }) }), _jsx(Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: t('swap.estimatedTime', {
41
+ return (_jsxs(Box, { display: "flex", justifyContent: dense ? 'space-between' : 'flex-end', flex: 1, pl: dense ? 0 : 2, mt: dense ? 2 : 0, children: [_jsx(Tooltip, { title: _jsxs(Box, { component: "span", children: [t(`tooltip.estimatedNetworkFee`), gasCosts.map((gas) => (_jsxs(Typography, { fontSize: 11, children: [gas.amount?.toFixed(6), " ", gas.token.symbol, " (", t(`format.currency`, { value: gas.amountUSD }), ")"] }, `${gas.token.address}${gas.token.symbol}`)))] }), placement: "top", enterDelay: 400, arrow: true, children: _jsxs(Box, { display: "flex", alignItems: "center", mr: dense ? 0 : 2, children: [_jsx(Typography, { lineHeight: 0, mr: 0.5, color: "grey.500", children: _jsx(EvStationOutlinedIcon, { fontSize: dense ? 'medium' : 'small' }) }), _jsx(Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: t(`format.currency`, { value: gasCostUSD }) })] }) }), _jsx(Tooltip, { title: t(`tooltip.estimatedTime`), placement: "top", enterDelay: 400, arrow: true, children: _jsxs(Box, { display: "flex", alignItems: "center", mr: dense ? 0 : 2, children: [_jsx(Typography, { lineHeight: 0, mr: 0.5, color: "grey.500", children: _jsx(AccessTimeIcon, { fontSize: dense ? 'medium' : 'small' }) }), _jsx(Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: t('swap.estimatedTime', {
38
42
  value: executionTimeMinutes,
39
- }) })] }) }), !dense ? (_jsx(Tooltip, { title: t(`tooltip.numberOfSteps`), placement: "top", enterDelay: 400, arrow: true, children: _jsxs(Box, { display: "flex", alignItems: "center", children: [_jsx(Typography, { lineHeight: 0, mr: 0.5, color: "grey.500", children: _jsx(LayersIcon, { fontSize: dense ? 'medium' : 'small' }) }), _jsx(Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: route.steps.length })] }) })) : null] }));
43
+ }) })] }) }), !dense ? (_jsx(Tooltip, { title: t(`tooltip.numberOfSteps`), placement: "top", enterDelay: 400, arrow: true, children: _jsxs(Box, { display: "flex", alignItems: "center", children: [_jsx(Typography, { lineHeight: 0, mr: 0.5, color: "grey.500", children: _jsx(LayersOutlinedIcon, { fontSize: dense ? 'medium' : 'small' }) }), _jsx(Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: route.steps.length })] }) })) : null] }));
40
44
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Route as RouteIcon } from '@mui/icons-material';
2
+ import RouteIcon from '@mui/icons-material/Route';
3
3
  import { Box, Typography } from '@mui/material';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  export const SwapRouteNotFoundCard = () => {
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { KeyboardArrowRight as KeyboardArrowRightIcon } from '@mui/icons-material';
2
+ import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
3
3
  import { Box, IconButton } from '@mui/material';
4
4
  import { useFormState } from 'react-hook-form';
5
5
  import { useTranslation } from 'react-i18next';
@@ -32,7 +32,6 @@ export declare const Header: import("@emotion/styled").StyledComponent<import("@
32
32
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
33
33
  }, "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
34
34
  export declare const Stack: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
35
- ref?: import("react").Ref<unknown> | undefined;
36
35
  children?: import("react").ReactNode;
37
36
  direction?: import("@mui/system").ResponsiveStyleValue<"column" | "column-reverse" | "row" | "row-reverse"> | undefined;
38
37
  spacing?: import("@mui/system").ResponsiveStyleValue<string | number> | undefined;
@@ -40,4 +39,4 @@ export declare const Stack: import("@emotion/styled").StyledComponent<import("@m
40
39
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
41
40
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
42
41
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
43
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | "direction" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
42
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "direction" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { SearchOff as SearchOffIcon } from '@mui/icons-material';
2
+ import SearchOffIcon from '@mui/icons-material/SearchOff';
3
3
  import { Box, Typography } from '@mui/material';
4
4
  import { useWatch } from 'react-hook-form';
5
5
  import { useTranslation } from 'react-i18next';
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/widget";
2
- export declare const version = "1.32.3";
2
+ export declare const version = "1.32.5";
package/config/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/widget';
2
- export const version = '1.32.3';
2
+ export const version = '1.32.5';
@@ -66,7 +66,7 @@ export const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchan
66
66
  if (!routeExecution?.route) {
67
67
  throw Error('Execution route not found.');
68
68
  }
69
- queryClient.removeQueries(['routes']);
69
+ queryClient.removeQueries(['routes'], { exact: false });
70
70
  return lifi.executeRoute(account.signer, routeExecution.route, {
71
71
  updateCallback,
72
72
  switchChainHook,
@@ -1,4 +1,4 @@
1
- import type { Route } from '@lifi/sdk';
1
+ import type { Route, RoutesResponse } from '@lifi/sdk';
2
2
  export declare const useSwapRoutes: () => {
3
3
  routes: Route[] | undefined;
4
4
  isLoading: boolean;
@@ -6,7 +6,5 @@ export declare const useSwapRoutes: () => {
6
6
  isFetched: boolean;
7
7
  dataUpdatedAt: number;
8
8
  refetchTime: number;
9
- refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@lifi/sdk").RoutesResponse | {
10
- routes: Route[];
11
- }, any>>;
9
+ refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<RoutesResponse, any>>;
12
10
  };
@@ -151,6 +151,25 @@ export const useSwapRoutes = () => {
151
151
  }
152
152
  return true;
153
153
  },
154
+ onSuccess(data) {
155
+ if (data.routes[0]) {
156
+ // Update local tokens cache to keep priceUSD in sync
157
+ const { fromToken, toToken } = data.routes[0];
158
+ [fromToken, toToken].forEach((token) => {
159
+ queryClient.setQueriesData(['token-balances', account.address, token.chainId], (data) => {
160
+ if (data) {
161
+ const clonedData = [...data];
162
+ const index = clonedData.findIndex((dataToken) => dataToken.address === token.address);
163
+ clonedData[index] = {
164
+ ...clonedData[index],
165
+ ...token,
166
+ };
167
+ return clonedData;
168
+ }
169
+ });
170
+ });
171
+ }
172
+ },
154
173
  });
155
174
  return {
156
175
  routes: data?.routes,
@@ -3,6 +3,7 @@ import { useTokenBalances } from './useTokenBalances';
3
3
  export const useTokenAddressBalance = (chainId, tokenAddress) => {
4
4
  const { tokens, tokensWithBalance, isBalanceLoading, refetch } = useTokenBalances(chainId);
5
5
  const token = useMemo(() => {
6
+ console.log('useTokenAddressBalance');
6
7
  const token = (tokensWithBalance ?? tokens)?.find((token) => token.address === tokenAddress && token.chainId === chainId);
7
8
  return token;
8
9
  }, [chainId, tokenAddress, tokens, tokensWithBalance]);
@@ -51,15 +51,16 @@ export const useTokenBalance = (token, accountAddress) => {
51
51
  staleTime: defaultRefetchInterval,
52
52
  });
53
53
  }
54
- queryClient.setQueryData(['token-balances', accountAddress, token.chainId], (data) => {
54
+ queryClient.setQueriesData(['token-balances', accountAddress, token.chainId], (data) => {
55
55
  if (data) {
56
- const index = data.findIndex((dataToken) => dataToken.address === token.address);
57
- data[index] = {
58
- ...data[index],
56
+ const clonedData = [...data];
57
+ const index = clonedData.findIndex((dataToken) => dataToken.address === token.address);
58
+ clonedData[index] = {
59
+ ...clonedData[index],
59
60
  amount: formattedAmount,
60
61
  };
62
+ return clonedData;
61
63
  }
62
- return data;
63
64
  });
64
65
  return {
65
66
  ...tokenBalances[0],
@@ -71,11 +72,7 @@ export const useTokenBalance = (token, accountAddress) => {
71
72
  staleTime: defaultRefetchInterval,
72
73
  });
73
74
  const refetchAllBalances = () => {
74
- queryClient.refetchQueries([
75
- 'token-balances',
76
- token?.chainId,
77
- accountAddress,
78
- ]);
75
+ queryClient.refetchQueries(['token-balances', accountAddress, token?.chainId], { exact: false });
79
76
  };
80
77
  const refetchNewBalance = useCallback(() => {
81
78
  queryClient.setQueryDefaults(tokenBalanceQueryKey, {
@@ -1,4 +1,3 @@
1
- /* eslint-disable consistent-return */
2
1
  import { useQuery } from '@tanstack/react-query';
3
2
  import { useState } from 'react';
4
3
  import { useLiFi, useWallet } from '../providers';
@@ -9,11 +9,13 @@ export const useTokenSearch = (chainId, tokenQuery, enabled) => {
9
9
  });
10
10
  if (token) {
11
11
  queryClient.setQueriesData(['tokens'], (data) => {
12
- if (!data?.tokens[chainId].some((t) => t.address === token.address)) {
13
- data?.tokens[chainId].push(token);
12
+ if (data &&
13
+ !data.tokens[chainId].some((t) => t.address === token.address)) {
14
+ const clonedData = { ...data };
15
+ clonedData.tokens[chainId].push(token);
16
+ return clonedData;
14
17
  }
15
- return data;
16
- }, { updatedAt: Date.now() });
18
+ });
17
19
  }
18
20
  return token;
19
21
  }, {