@lifi/widget 1.11.4 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/AppDrawer.style.d.ts +1 -1
  2. package/AppDrawer.style.js +6 -2
  3. package/AppProvider.d.ts +4 -0
  4. package/AppProvider.js +5 -2
  5. package/components/Header/Header.js +1 -0
  6. package/components/Initializer.js +1 -1
  7. package/components/NotFound.js +2 -1
  8. package/components/PoweredBy/PoweredBy.js +3 -2
  9. package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
  10. package/components/Step/CircularProgress.d.ts +0 -1
  11. package/components/Step/Step.js +4 -1
  12. package/components/Step/StepProcess.style.d.ts +1 -1
  13. package/components/StepActions/StepActions.js +4 -2
  14. package/components/SwapButton/ButtonTooltip.d.ts +0 -1
  15. package/components/SwapButton/SwapButton.js +7 -4
  16. package/components/SwapButton/SwapButton.style.d.ts +1 -1
  17. package/components/SwapInput/FormPriceHelperText.js +2 -2
  18. package/components/SwapInput/SwapInput.style.d.ts +1 -1
  19. package/components/SwapInput/SwapInputAdornment.d.ts +0 -1
  20. package/components/SwapInput/SwapInputAdornment.js +2 -2
  21. package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
  22. package/components/SwapRouteCard/SwapRouteCard.style.js +4 -1
  23. package/components/TokenAvatar/TokenAvatar.js +3 -2
  24. package/components/TokenList/TokenList.js +25 -42
  25. package/components/TokenList/TokenList.style.d.ts +2 -2
  26. package/components/TokenList/TokenList.style.js +5 -2
  27. package/components/TokenList/TokenListItem.d.ts +2 -2
  28. package/components/TokenList/TokenListItem.js +7 -10
  29. package/components/TokenList/TokenNotFound.d.ts +2 -0
  30. package/components/TokenList/TokenNotFound.js +15 -0
  31. package/components/TokenList/VirtualizedTokenList.d.ts +3 -0
  32. package/components/TokenList/VirtualizedTokenList.js +53 -0
  33. package/components/TokenList/types.d.ts +16 -1
  34. package/config/lifi.d.ts +1 -1
  35. package/config/lifi.js +2 -8
  36. package/config/sentry.d.ts +1 -1
  37. package/config/sentry.js +33 -18
  38. package/config/theme.js +14 -11
  39. package/config/version.d.ts +1 -1
  40. package/config/version.js +1 -1
  41. package/hooks/index.d.ts +3 -0
  42. package/hooks/index.js +3 -0
  43. package/hooks/useFeaturedTokens.d.ts +1 -0
  44. package/hooks/useFeaturedTokens.js +6 -0
  45. package/hooks/useGasSufficiency.js +11 -4
  46. package/hooks/useRouteExecution.js +31 -17
  47. package/hooks/useSwapRoutes.js +2 -2
  48. package/hooks/useToken.d.ts +2 -1
  49. package/hooks/useToken.js +2 -1
  50. package/hooks/useTokenBalance.d.ts +2 -4
  51. package/hooks/useTokenBalance.js +11 -42
  52. package/hooks/useTokenBalances.d.ts +6 -3
  53. package/hooks/useTokenBalances.js +46 -22
  54. package/hooks/useTokenSearch.d.ts +7 -0
  55. package/hooks/useTokenSearch.js +37 -0
  56. package/hooks/useTokens.d.ts +2 -1
  57. package/hooks/useTokens.js +12 -4
  58. package/i18n/en/translation.json +5 -2
  59. package/i18n/index.d.ts +3 -0
  60. package/package.json +14 -15
  61. package/pages/MainPage/SwapRoutes.style.d.ts +1 -1
  62. package/pages/SelectTokenPage/ChainSelect.d.ts +0 -1
  63. package/pages/SelectTokenPage/ChainSelect.js +8 -5
  64. package/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
  65. package/pages/SelectTokenPage/SearchTokenInput.js +2 -2
  66. package/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  67. package/pages/SelectWalletPage/SelectWalletPage.style.d.ts +2 -2
  68. package/pages/SettingsPage/AdvancedPreferences.d.ts +0 -1
  69. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  70. package/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
  71. package/pages/SettingsPage/SettingsPage.d.ts +0 -1
  72. package/pages/SettingsPage/SlippageInput.d.ts +0 -1
  73. package/pages/SwapHistoryPage/SwapHistoryPage.js +19 -3
  74. package/pages/SwapPage/StatusBottomSheet.js +2 -2
  75. package/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +1 -1
  76. package/providers/SwapFormProvider/SwapFormProvider.d.ts +1 -1
  77. package/providers/SwapFormProvider/SwapFormProvider.js +22 -5
  78. package/providers/SwapFormProvider/types.d.ts +2 -3
  79. package/providers/SwapFormProvider/types.js +1 -2
  80. package/providers/WalletProvider/WalletProvider.d.ts +11 -1
  81. package/providers/WalletProvider/WalletProvider.js +24 -33
  82. package/providers/WidgetProvider/WidgetProvider.js +24 -12
  83. package/stores/route/types.d.ts +1 -0
  84. package/stores/route/useRouteStore.js +3 -12
  85. package/types/index.d.ts +1 -0
  86. package/types/index.js +1 -0
  87. package/types/token.d.ts +4 -0
  88. package/types/token.js +1 -0
  89. package/types/widget.d.ts +4 -3
  90. package/utils/colors.d.ts +1 -0
  91. package/utils/colors.js +5 -0
  92. package/components/TokenList/utils.d.ts +0 -15
  93. package/components/TokenList/utils.js +0 -10
package/i18n/index.d.ts CHANGED
@@ -53,6 +53,8 @@ export declare const resources: {
53
53
  selectChain: string;
54
54
  selectToken: string;
55
55
  selectChainAndToken: string;
56
+ featuredTokens: string;
57
+ otherTokens: string;
56
58
  inProgress: string;
57
59
  couldntFindTokens: string;
58
60
  stepSwap: string;
@@ -94,6 +96,7 @@ export declare const resources: {
94
96
  title: {
95
97
  insufficientGas: string;
96
98
  deleteSwap: string;
99
+ deleteSwapHistory: string;
97
100
  };
98
101
  message: {
99
102
  insufficientFunds: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/widget",
3
- "version": "1.11.4",
3
+ "version": "1.13.0",
4
4
  "description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
5
5
  "sideEffects": false,
6
6
  "main": "./index.js",
@@ -37,30 +37,29 @@
37
37
  "lifi"
38
38
  ],
39
39
  "dependencies": {
40
- "@emotion/react": "^11.9.3",
41
- "@emotion/styled": "^11.9.3",
40
+ "@emotion/react": "^11.10.0",
41
+ "@emotion/styled": "^11.10.0",
42
42
  "@ethersproject/experimental": "^5.6.3",
43
43
  "@ethersproject/providers": "^5.6.8",
44
- "@lifi/sdk": "^1.0.2",
45
- "@lifi/wallet-management": "^1.1.2",
44
+ "@lifi/sdk": "^1.1.3",
45
+ "@lifi/wallet-management": "^1.1.3",
46
46
  "@mui/icons-material": "^5.8.4",
47
- "@mui/lab": "^5.0.0-alpha.92",
48
- "@mui/material": "^5.9.2",
49
- "@sentry/integrations": "^7.7.0",
50
- "@sentry/react": "^7.7.0",
51
- "@sentry/tracing": "^7.7.0",
47
+ "@mui/lab": "^5.0.0-alpha.94",
48
+ "@mui/material": "^5.10.0",
49
+ "@sentry/integrations": "^7.10.0",
50
+ "@sentry/react": "^7.10.0",
51
+ "@sentry/tracing": "^7.10.0",
52
52
  "@tanstack/react-query": "^4.0.10",
53
+ "@tanstack/react-virtual": "^3.0.0-beta.17",
53
54
  "big.js": "^6.2.1",
54
- "i18next": "^21.8.14",
55
+ "i18next": "^21.9.0",
55
56
  "immer": "^9.0.15",
56
57
  "react": "^18.2.0",
57
58
  "react-dom": "^18.2.0",
58
- "react-hook-form": "^7.33.1",
59
- "react-i18next": "^11.18.1",
60
- "react-resize-detector": "^7.1.2",
59
+ "react-hook-form": "^7.34.0",
60
+ "react-i18next": "^11.18.3",
61
61
  "react-router-dom": "^6.3.0",
62
62
  "react-timer-hook": "^3.0.5",
63
- "react-virtual": "^2.10.4",
64
63
  "zustand": "^4.0.0"
65
64
  },
66
65
  "eslintConfig": {
@@ -8,4 +8,4 @@ export declare const Stack: import("@emotion/styled").StyledComponent<import("@m
8
8
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
9
9
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
10
10
  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") | "spacing" | "divider"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
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>, {}, {}>;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import { SwapFormTypeProps } from '../../providers/SwapFormProvider';
3
2
  export declare const ChainSelect: ({ formType }: SwapFormTypeProps) => JSX.Element;
@@ -6,20 +6,23 @@ import { useTranslation } from 'react-i18next';
6
6
  import { Card, CardTitle } from '../../components/Card';
7
7
  import { Select } from '../../components/Select';
8
8
  import { useChains } from '../../hooks';
9
- import { SwapFormKeyHelper, } from '../../providers/SwapFormProvider';
9
+ import { SwapFormKey, SwapFormKeyHelper, } from '../../providers/SwapFormProvider';
10
10
  import { useWidgetConfig } from '../../providers/WidgetProvider';
11
11
  export const ChainSelect = ({ formType }) => {
12
12
  const { t } = useTranslation();
13
- const { setValue } = useFormContext();
13
+ const { setValue, register } = useFormContext();
14
14
  const { fromChain, toChain } = useWidgetConfig();
15
15
  const { chains, isLoading } = useChains();
16
+ const chainKey = SwapFormKeyHelper.getChainKey(formType);
16
17
  const [chainId] = useWatch({
17
- name: [SwapFormKeyHelper.getChainKey(formType)],
18
+ name: [chainKey],
18
19
  });
20
+ const { onChange, onBlur, name, ref } = register(chainKey);
19
21
  const handleChain = (event) => {
20
- setValue(SwapFormKeyHelper.getChainKey(formType), event.target.value);
22
+ onChange(event);
21
23
  setValue(SwapFormKeyHelper.getTokenKey(formType), '');
22
24
  setValue(SwapFormKeyHelper.getAmountKey(formType), '');
25
+ setValue(SwapFormKey.TokenSearchFilter, '');
23
26
  };
24
- return !isLoading ? (_jsxs(Card, { children: [_jsx(CardTitle, { children: t(`swap.selectChain`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Select, Object.assign({ labelId: "label", MenuProps: { elevation: 2 }, defaultValue: formType === 'from' ? fromChain : toChain, value: chainId, onChange: handleChain, IconComponent: KeyboardArrowDownIcon }, { children: chains === null || chains === void 0 ? void 0 : chains.map((chain) => (_jsxs(MenuItem, Object.assign({ value: chain.id }, { children: [_jsx(ListItemAvatar, { children: _jsx(Avatar, Object.assign({ src: chain.logoURI, alt: chain.key }, { children: chain.name[0] })) }), chain.name] }), chain.key))) })) }))] })) : (_jsx(Skeleton, { variant: "rectangular", width: "100%", height: 98, sx: { borderRadius: 1 } }));
27
+ return !isLoading ? (_jsxs(Card, { children: [_jsx(CardTitle, { children: t(`swap.selectChain`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Select, Object.assign({ ref: ref, labelId: chainKey, name: name, MenuProps: { elevation: 2 }, defaultValue: formType === 'from' ? fromChain : toChain, value: chainId, onChange: handleChain, onBlur: onBlur, IconComponent: KeyboardArrowDownIcon }, { children: chains === null || chains === void 0 ? void 0 : chains.map((chain) => (_jsxs(MenuItem, Object.assign({ value: chain.id }, { children: [_jsx(ListItemAvatar, { children: _jsx(Avatar, Object.assign({ src: chain.logoURI, alt: chain.key }, { children: chain.name[0] })) }), chain.name] }), chain.key))) })) }))] })) : (_jsx(Skeleton, { variant: "rectangular", width: "100%", height: 98, sx: { borderRadius: 1 } }));
25
28
  };
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SearchTokenInput: () => JSX.Element;
@@ -11,7 +11,7 @@ export const SearchTokenInput = () => {
11
11
  const { t } = useTranslation();
12
12
  const { register, setValue } = useFormContext();
13
13
  useEffect(() => () => {
14
- setValue(SwapFormKey.SearchTokensFilter, '');
14
+ setValue(SwapFormKey.TokenSearchFilter, '');
15
15
  }, [setValue]);
16
- return (_jsx(Card, { children: _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Input, { size: "small", placeholder: t(`swap.tokenSearch`), defaultValue: "", endAdornment: _jsx(InputAdornment, Object.assign({ position: "end" }, { children: _jsx(SearchIcon, {}) })), inputProps: Object.assign({ inputMode: 'search' }, register(SwapFormKey.SearchTokensFilter)), autoComplete: "off" }) })) }));
16
+ return (_jsx(Card, { children: _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Input, { size: "small", placeholder: t(`swap.tokenSearch`), defaultValue: "", endAdornment: _jsx(InputAdornment, Object.assign({ position: "end" }, { children: _jsx(SearchIcon, {}) })), inputProps: Object.assign({ inputMode: 'search' }, register(SwapFormKey.TokenSearchFilter)), autoComplete: "off" }) })) }));
17
17
  };
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SelectWalletPage: () => JSX.Element;
@@ -17,7 +17,7 @@ export declare const WalletListItemButton: import("@emotion/styled").StyledCompo
17
17
  touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
18
18
  }, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
19
19
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
20
- }, "className" | "style" | "classes" | "tabIndex" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "alignItems" | "autoFocus" | "dense" | "selected" | "disableGutters" | "divider"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
20
+ }, "className" | "style" | "classes" | "tabIndex" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "alignItems" | "autoFocus" | "dense" | "divider" | "selected" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
21
21
  export declare const WalletListItem: import("@emotion/styled").StyledComponent<{
22
22
  button?: false | undefined;
23
23
  } & import("@mui/material").ListItemBaseProps & {
@@ -29,7 +29,7 @@ export declare const WalletListItem: import("@emotion/styled").StyledComponent<{
29
29
  } | undefined;
30
30
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "key" | keyof import("react").LiHTMLAttributes<HTMLLIElement>> & {
31
31
  ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
32
- }, "button" | "className" | "style" | "classes" | "children" | "disabled" | "sx" | "alignItems" | "autoFocus" | "dense" | "components" | "componentsProps" | "selected" | "disableGutters" | "divider" | "ContainerComponent" | "ContainerProps" | "disablePadding" | "secondaryAction"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
32
+ }, "button" | "className" | "style" | "classes" | "children" | "disabled" | "sx" | "alignItems" | "autoFocus" | "dense" | "divider" | "components" | "componentsProps" | "selected" | "disableGutters" | "ContainerComponent" | "ContainerProps" | "disablePadding" | "secondaryAction"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
33
33
  export declare const WalletListItemText: import("@emotion/styled").StyledComponent<import("@mui/material").ListItemTextProps<import("react").ElementType<any>, import("react").ElementType<any>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
34
34
  export declare const WalletIdentityPopoverContent: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
35
35
  align?: "inherit" | "left" | "right" | "center" | "justify" | undefined;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const AdvancedPreferences: () => JSX.Element;
@@ -2,7 +2,7 @@
2
2
  export declare const ToggleButton: import("@emotion/styled").StyledComponent<{
3
3
  children?: import("react").ReactNode;
4
4
  classes?: Partial<import("@mui/material").ToggleButtonClasses> | undefined;
5
- color?: "success" | "info" | "warning" | "error" | "primary" | "secondary" | "standard" | undefined;
5
+ color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "standard" | undefined;
6
6
  disabled?: boolean | undefined;
7
7
  disableFocusRipple?: boolean | undefined;
8
8
  fullWidth?: boolean | undefined;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const GasPriceSelect: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SettingsPage: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SlippageInput: () => JSX.Element;
@@ -1,14 +1,30 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Container, Stack } from '@mui/material';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DeleteOutline as DeleteIcon } from '@mui/icons-material';
3
+ import { Button, Container, DialogActions, DialogContent, DialogContentText, DialogTitle, IconButton, Stack, } from '@mui/material';
4
+ import { useCallback, useEffect, useState } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { Dialog } from '../../components/Dialog';
7
+ import { useSetHeaderAction } from '../../components/Header';
3
8
  import { useWallet } from '../../providers/WalletProvider';
9
+ import { useRouteStore } from '../../stores';
4
10
  import { useSwapHistory } from '../../stores/route';
5
11
  import { SwapHistoryEmpty } from './SwapHistoryEmpty';
6
12
  import { SwapHistoryItem } from './SwapHistoryItem';
7
13
  export const SwapHistoryPage = () => {
14
+ const { t } = useTranslation();
8
15
  const { account } = useWallet();
9
16
  const swaps = useSwapHistory(account.address);
17
+ const deleteRoutes = useRouteStore((store) => store.deleteRoutes);
18
+ const setHeaderAction = useSetHeaderAction();
19
+ const [open, setOpen] = useState(false);
20
+ const toggleDialog = useCallback(() => {
21
+ setOpen((open) => !open);
22
+ }, []);
23
+ useEffect(() => {
24
+ return setHeaderAction(_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: toggleDialog }, { children: _jsx(DeleteIcon, {}) })));
25
+ }, [setHeaderAction, toggleDialog]);
10
26
  if (!swaps.length) {
11
27
  return _jsx(SwapHistoryEmpty, {});
12
28
  }
13
- return (_jsx(Container, { children: _jsx(Stack, Object.assign({ spacing: 2, mt: 1 }, { children: swaps.length ? (swaps.map(({ route }) => (_jsx(SwapHistoryItem, { route: route }, route.id)))) : (_jsx(SwapHistoryEmpty, {})) })) }));
29
+ return (_jsxs(Container, { children: [_jsx(Stack, Object.assign({ spacing: 2, mt: 1 }, { children: swaps.length ? (swaps.map(({ route }) => (_jsx(SwapHistoryItem, { route: route }, route.id)))) : (_jsx(SwapHistoryEmpty, {})) })), _jsxs(Dialog, Object.assign({ open: open, onClose: toggleDialog }, { children: [_jsx(DialogTitle, { children: t('swap.warning.title.deleteSwapHistory') }), _jsx(DialogContent, { children: _jsx(DialogContentText, { children: t('swap.warning.message.deleteSwap') }) }), _jsxs(DialogActions, { children: [_jsx(Button, Object.assign({ onClick: toggleDialog }, { children: t('button.cancel') })), _jsx(Button, Object.assign({ onClick: deleteRoutes, autoFocus: true }, { children: t('button.delete') }))] })] }))] }));
14
30
  };
@@ -17,10 +17,10 @@ export const StatusBottomSheet = ({ status, route, }) => {
17
17
  const navigate = useNavigate();
18
18
  const ref = useRef(null);
19
19
  const { getChainById } = useChains();
20
- const { token, refetchBalance } = useTokenBalance(route.toChainId, route.toToken.address);
20
+ const { token, refetch: refetchBalance } = useTokenBalance(route.toChainId, route.toToken.address);
21
21
  const { setValue } = useFormContext();
22
22
  const clearFromAmount = () => {
23
- refetchBalance(route.fromChainId, route.fromToken.address);
23
+ refetchBalance();
24
24
  setValue(SwapFormKey.FromAmount, '');
25
25
  };
26
26
  const handleDone = () => {
@@ -8,4 +8,4 @@ export declare const Stack: import("@emotion/styled").StyledComponent<import("@m
8
8
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
9
9
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
10
10
  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") | "spacing" | "divider"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
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>, {}, {}>;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export declare const formDefaultValues: {
3
3
  fromAmount: string;
4
- searchTokensFilter: string;
4
+ tokenSearchFilter: string;
5
5
  };
6
6
  export declare const SwapFormProvider: React.FC<React.PropsWithChildren<{}>>;
@@ -1,18 +1,35 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ChainId } from '@lifi/sdk';
3
+ import { useEffect } from 'react';
2
4
  import { FormProvider, useForm } from 'react-hook-form';
5
+ import { useWallet } from '../WalletProvider';
3
6
  import { useWidgetConfig } from '../WidgetProvider';
4
7
  import { SwapFormKey } from './types';
5
8
  export const formDefaultValues = {
6
9
  [SwapFormKey.FromAmount]: '',
7
- [SwapFormKey.SearchTokensFilter]: '',
10
+ [SwapFormKey.TokenSearchFilter]: '',
8
11
  };
9
12
  export const SwapFormProvider = ({ children, }) => {
10
- var _a;
13
+ const { account } = useWallet();
11
14
  const { fromChain, fromToken, fromAmount, toChain, toToken } = useWidgetConfig();
12
15
  const methods = useForm({
13
- defaultValues: Object.assign(Object.assign({}, formDefaultValues), { fromChain,
14
- fromToken, fromAmount: (_a = fromAmount === null || fromAmount === void 0 ? void 0 : fromAmount.toPrecision()) !== null && _a !== void 0 ? _a : formDefaultValues.fromAmount, toChain,
15
- toToken }),
16
+ defaultValues: Object.assign(Object.assign({}, formDefaultValues), { fromChain: fromChain !== null && fromChain !== void 0 ? fromChain : ChainId.ETH, fromToken, fromAmount: (typeof fromAmount === 'number'
17
+ ? fromAmount === null || fromAmount === void 0 ? void 0 : fromAmount.toPrecision()
18
+ : fromAmount) || formDefaultValues.fromAmount, toChain: toChain !== null && toChain !== void 0 ? toChain : ChainId.ETH, toToken }),
16
19
  });
20
+ // Set wallet chain as default if no fromChain is provided by config and if it wasn't changed during widget usage
21
+ useEffect(() => {
22
+ const { isDirty, isTouched } = methods.getFieldState(SwapFormKey.FromChain, methods.formState);
23
+ if (account.isActive &&
24
+ account.chainId &&
25
+ !fromChain &&
26
+ !isDirty &&
27
+ !isTouched) {
28
+ methods.setValue(SwapFormKey.FromChain, account.chainId, {
29
+ shouldDirty: false,
30
+ shouldTouch: false,
31
+ });
32
+ }
33
+ }, [account.chainId, account.isActive, fromChain, methods]);
17
34
  return _jsx(FormProvider, Object.assign({}, methods, { children: children }));
18
35
  };
@@ -2,7 +2,7 @@ export declare enum SwapFormKey {
2
2
  FromAmount = "fromAmount",
3
3
  FromChain = "fromChain",
4
4
  FromToken = "fromToken",
5
- SearchTokensFilter = "searchTokensFilter",
5
+ TokenSearchFilter = "tokenSearchFilter",
6
6
  ToChain = "toChain",
7
7
  ToToken = "toToken"
8
8
  }
@@ -10,7 +10,7 @@ export declare type SwapFormValues = {
10
10
  [SwapFormKey.FromAmount]: string;
11
11
  [SwapFormKey.FromChain]: number;
12
12
  [SwapFormKey.FromToken]: string;
13
- [SwapFormKey.SearchTokensFilter]: string;
13
+ [SwapFormKey.TokenSearchFilter]: string;
14
14
  [SwapFormKey.ToChain]: number;
15
15
  [SwapFormKey.ToToken]: string;
16
16
  };
@@ -19,7 +19,6 @@ export declare const SwapFormKeyHelper: {
19
19
  getChainKey: (formType: SwapFormDirection) => 'fromChain' | 'toChain';
20
20
  getTokenKey: (formType: SwapFormDirection) => 'fromToken' | 'toToken';
21
21
  getAmountKey: (formType: SwapFormDirection) => 'fromAmount' | 'toAmount';
22
- getSearchTokensFilterKey: (formType: SwapFormDirection) => string;
23
22
  };
24
23
  export interface SwapFormTypeProps {
25
24
  formType: SwapFormDirection;
@@ -3,7 +3,7 @@ export var SwapFormKey;
3
3
  SwapFormKey["FromAmount"] = "fromAmount";
4
4
  SwapFormKey["FromChain"] = "fromChain";
5
5
  SwapFormKey["FromToken"] = "fromToken";
6
- SwapFormKey["SearchTokensFilter"] = "searchTokensFilter";
6
+ SwapFormKey["TokenSearchFilter"] = "tokenSearchFilter";
7
7
  SwapFormKey["ToChain"] = "toChain";
8
8
  SwapFormKey["ToToken"] = "toToken";
9
9
  })(SwapFormKey || (SwapFormKey = {}));
@@ -11,5 +11,4 @@ export const SwapFormKeyHelper = {
11
11
  getChainKey: (formType) => `${formType}Chain`,
12
12
  getTokenKey: (formType) => `${formType}Token`,
13
13
  getAmountKey: (formType) => `${formType}Amount`,
14
- getSearchTokensFilterKey: (formType) => `${formType}SearchTokensFilter`,
15
14
  };
@@ -1,4 +1,14 @@
1
+ import { Signer } from 'ethers';
1
2
  import { FC, PropsWithChildren } from 'react';
3
+ import { WidgetWalletManagement } from '../../types';
2
4
  import type { WalletContextProps } from './types';
3
5
  export declare const useWallet: () => WalletContextProps;
4
- export declare const WalletProvider: FC<PropsWithChildren<{}>>;
6
+ export declare const WalletProvider: FC<PropsWithChildren<{
7
+ walletManagement?: WidgetWalletManagement;
8
+ }>>;
9
+ export declare const extractAccountFromSigner: (signer?: Signer) => Promise<{
10
+ address: string | undefined;
11
+ isActive: boolean;
12
+ signer: Signer | undefined;
13
+ chainId: number | undefined;
14
+ }>;
@@ -8,9 +8,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
- import { addChain as walletAddChain, switchChain as walletSwitchChain, switchChainAndAddToken, useLifiWalletManagement, } from '@lifi/wallet-management';
11
+ import { addChain as walletAddChain, switchChain as walletSwitchChain, switchChainAndAddToken, useLiFiWalletManagement, } from '@lifi/wallet-management';
12
12
  import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from 'react';
13
- import { useWidgetConfig } from '../WidgetProvider';
14
13
  const stub = () => {
15
14
  throw new Error('You forgot to wrap your component in <WalletProvider>.');
16
15
  };
@@ -24,65 +23,57 @@ const initialContext = {
24
23
  };
25
24
  const WalletContext = createContext(initialContext);
26
25
  export const useWallet = () => useContext(WalletContext);
27
- export const WalletProvider = ({ children }) => {
28
- const config = useWidgetConfig();
29
- const { connect: walletManagementConnect, disconnect: walletManagementDisconnect, signer, } = useLifiWalletManagement();
26
+ export const WalletProvider = ({ children, walletManagement }) => {
27
+ const { connect: walletManagementConnect, disconnect: walletManagementDisconnect, signer, } = useLiFiWalletManagement();
30
28
  const [account, setAccount] = useState({});
31
29
  const connect = useCallback((wallet) => __awaiter(void 0, void 0, void 0, function* () {
32
- if (config.walletManagement) {
33
- const signer = yield config.walletManagement.connect();
30
+ if (walletManagement) {
31
+ const signer = yield walletManagement.connect();
34
32
  const account = yield extractAccountFromSigner(signer);
35
33
  setAccount(account);
36
34
  return;
37
35
  }
38
36
  yield walletManagementConnect(wallet);
39
- }), [config.walletManagement, walletManagementConnect]);
37
+ }), [walletManagement, walletManagementConnect]);
40
38
  const disconnect = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
41
- if (config.walletManagement) {
42
- yield config.walletManagement.disconnect();
39
+ if (walletManagement) {
40
+ yield walletManagement.disconnect();
43
41
  setAccount({});
44
42
  return;
45
43
  }
46
44
  yield walletManagementDisconnect();
47
- }), [config.walletManagement, walletManagementDisconnect]);
45
+ }), [walletManagement, walletManagementDisconnect]);
48
46
  // only for injected wallets
49
47
  const switchChain = useCallback((chainId) => __awaiter(void 0, void 0, void 0, function* () {
50
- var _a;
51
- if ((_a = config.walletManagement) === null || _a === void 0 ? void 0 : _a.switchChain) {
52
- const signer = yield config.walletManagement.switchChain(chainId);
48
+ if (walletManagement === null || walletManagement === void 0 ? void 0 : walletManagement.switchChain) {
49
+ const signer = yield walletManagement.switchChain(chainId);
53
50
  const account = yield extractAccountFromSigner(signer);
54
51
  setAccount(account);
52
+ return true;
55
53
  }
56
54
  return walletSwitchChain(chainId);
57
- }), [config.walletManagement]);
55
+ }), [walletManagement]);
58
56
  const addChain = useCallback((chainId) => __awaiter(void 0, void 0, void 0, function* () {
59
- var _b;
60
- if ((_b = config.walletManagement) === null || _b === void 0 ? void 0 : _b.addChain) {
61
- return config.walletManagement.addChain(chainId);
57
+ if (walletManagement === null || walletManagement === void 0 ? void 0 : walletManagement.addChain) {
58
+ return walletManagement.addChain(chainId);
62
59
  }
63
60
  return walletAddChain(chainId);
64
- }), [config.walletManagement]);
61
+ }), [walletManagement]);
65
62
  const addToken = useCallback((chainId, token) => __awaiter(void 0, void 0, void 0, function* () {
66
- var _c;
67
- if ((_c = config.walletManagement) === null || _c === void 0 ? void 0 : _c.addToken) {
68
- return config.walletManagement.addToken(token, chainId);
63
+ if (walletManagement === null || walletManagement === void 0 ? void 0 : walletManagement.addToken) {
64
+ return walletManagement.addToken(token, chainId);
69
65
  }
70
66
  return switchChainAndAddToken(chainId, token);
71
- }), [config.walletManagement]);
67
+ }), [walletManagement]);
72
68
  // keep account information up to date
73
69
  useEffect(() => {
74
70
  const updateAccount = () => __awaiter(void 0, void 0, void 0, function* () {
75
- if (config.walletManagement) {
76
- const account = yield extractAccountFromSigner(config.walletManagement.signer);
77
- setAccount(account);
78
- }
79
- else {
80
- const account = yield extractAccountFromSigner(signer);
81
- setAccount(account);
82
- }
71
+ var _a;
72
+ const account = yield extractAccountFromSigner((_a = walletManagement === null || walletManagement === void 0 ? void 0 : walletManagement.signer) !== null && _a !== void 0 ? _a : signer);
73
+ setAccount(account);
83
74
  });
84
75
  updateAccount();
85
- }, [signer, config.walletManagement]);
76
+ }, [signer, walletManagement]);
86
77
  const value = useMemo(() => ({
87
78
  connect,
88
79
  disconnect,
@@ -93,7 +84,7 @@ export const WalletProvider = ({ children }) => {
93
84
  }), [account, addChain, addToken, connect, disconnect, switchChain]);
94
85
  return (_jsx(WalletContext.Provider, Object.assign({ value: value }, { children: children })));
95
86
  };
96
- const extractAccountFromSigner = (signer) => __awaiter(void 0, void 0, void 0, function* () {
87
+ export const extractAccountFromSigner = (signer) => __awaiter(void 0, void 0, void 0, function* () {
97
88
  return ({
98
89
  address: (yield (signer === null || signer === void 0 ? void 0 : signer.getAddress())) || undefined,
99
90
  isActive: (signer && !!(yield signer.getAddress()) === null) || !!signer,
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
- import { ChainId, getChainByKey } from '@lifi/sdk';
13
+ import { getChainByKey } from '@lifi/sdk';
14
14
  import { createContext, useContext, useEffect, useMemo } from 'react';
15
15
  import { updateLiFiConfig } from '../../config/lifi';
16
16
  const stub = () => {
@@ -22,24 +22,36 @@ const initialContext = {
22
22
  const WidgetContext = createContext(initialContext);
23
23
  export const useWidgetConfig = () => useContext(WidgetContext);
24
24
  export const WidgetProvider = (_a) => {
25
- var { children } = _a, _b = _a.config, _c = _b === void 0 ? {} : _b, { fromChain, fromToken, toChain, toToken, integrator } = _c, config = __rest(_c, ["fromChain", "fromToken", "toChain", "toToken", "integrator"]);
25
+ var { children } = _a, _b = _a.config, _c = _b === void 0 ? {} : _b, { fromChain, fromToken, toChain, toToken, fromAmount, integrator } = _c, config = __rest(_c, ["fromChain", "fromToken", "toChain", "toToken", "fromAmount", "integrator"]);
26
26
  const value = useMemo(() => {
27
+ var _a, _b, _c, _d;
27
28
  try {
28
- return Object.assign(Object.assign({}, config), { fromChain: typeof fromChain === 'number'
29
- ? fromChain
30
- : typeof fromChain === 'string'
31
- ? getChainByKey(fromChain.toLowerCase()).id
32
- : ChainId.ETH, toChain: typeof toChain === 'number'
33
- ? toChain
34
- : typeof toChain === 'string'
35
- ? getChainByKey(toChain.toLowerCase()).id
36
- : ChainId.ETH, fromToken: fromToken === null || fromToken === void 0 ? void 0 : fromToken.toLowerCase(), toToken: toToken === null || toToken === void 0 ? void 0 : toToken.toLowerCase() });
29
+ const searchParams = Object.fromEntries(new URLSearchParams(window === null || window === void 0 ? void 0 : window.location.search));
30
+ return Object.assign(Object.assign({}, config), { fromChain: (searchParams.fromChain &&
31
+ isNaN(parseInt(searchParams.fromChain, 10))) ||
32
+ typeof fromChain === 'string'
33
+ ? getChainByKey((_a = (searchParams.fromChain || fromChain)) === null || _a === void 0 ? void 0 : _a.toLowerCase()).id
34
+ : (searchParams.fromChain &&
35
+ !isNaN(parseInt(searchParams.fromChain, 10))) ||
36
+ typeof fromChain === 'number'
37
+ ? parseInt(searchParams.fromChain, 10) || fromChain
38
+ : undefined, toChain: (searchParams.toChain && isNaN(parseInt(searchParams.toChain, 10))) ||
39
+ typeof toChain === 'string'
40
+ ? getChainByKey((_b = (searchParams.toChain || toChain)) === null || _b === void 0 ? void 0 : _b.toLowerCase()).id
41
+ : (searchParams.toChain &&
42
+ !isNaN(parseInt(searchParams.toChain, 10))) ||
43
+ typeof toChain === 'number'
44
+ ? parseInt(searchParams.toChain, 10) || toChain
45
+ : undefined, fromToken: ((_c = searchParams.fromToken) === null || _c === void 0 ? void 0 : _c.toLowerCase()) || (fromToken === null || fromToken === void 0 ? void 0 : fromToken.toLowerCase()), toToken: ((_d = searchParams.toToken) === null || _d === void 0 ? void 0 : _d.toLowerCase()) || (toToken === null || toToken === void 0 ? void 0 : toToken.toLowerCase()), fromAmount: typeof searchParams.fromAmount === 'string' &&
46
+ !isNaN(parseFloat(searchParams.fromAmount))
47
+ ? searchParams.fromAmount
48
+ : fromAmount });
37
49
  }
38
50
  catch (e) {
39
51
  console.warn(e);
40
52
  return config;
41
53
  }
42
- }, [config, fromChain, fromToken, toChain, toToken]);
54
+ }, [config, fromAmount, fromChain, fromToken, toChain, toToken]);
43
55
  useEffect(() => {
44
56
  updateLiFiConfig({
45
57
  defaultRouteOptions: {
@@ -5,6 +5,7 @@ export interface RouteExecutionStore {
5
5
  updateRoute: (route: Route) => void;
6
6
  restartRoute: (routeId: string) => void;
7
7
  deleteRoute: (routeId: string) => void;
8
+ deleteRoutes: () => void;
8
9
  }
9
10
  export declare type RouteExecutionStatus = 'error' | 'idle' | 'loading' | 'success';
10
11
  export interface RouteExecution {
@@ -35,18 +35,6 @@ export const useRouteStore = create()(persist(immer((set) => ({
35
35
  }
36
36
  }),
37
37
  restartRoute: (routeId) => set((state) => {
38
- var _a;
39
- (_a = state.routes[routeId]) === null || _a === void 0 ? void 0 : _a.route.steps.forEach((step) => {
40
- var _a, _b;
41
- const stepHasFailed = ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'FAILED';
42
- // check if the step has been cancelled which is a "failed" state
43
- const stepHasBeenCancelled = (_b = step.execution) === null || _b === void 0 ? void 0 : _b.process.some((process) => process.status === 'CANCELLED');
44
- if (step.execution && (stepHasFailed || stepHasBeenCancelled)) {
45
- step.execution.status = 'RESUME';
46
- // remove last (failed) process
47
- step.execution.process.pop();
48
- }
49
- });
50
38
  state.routes[routeId].status = 'loading';
51
39
  }),
52
40
  deleteRoute: (routeId) => set((state) => {
@@ -54,6 +42,9 @@ export const useRouteStore = create()(persist(immer((set) => ({
54
42
  delete state.routes[routeId];
55
43
  }
56
44
  }),
45
+ deleteRoutes: () => set((state) => {
46
+ state.routes = {};
47
+ }),
57
48
  })), {
58
49
  name: 'li.fi-widget-routes',
59
50
  partialize: (state) => ({ routes: state.routes }),
package/types/index.d.ts CHANGED
@@ -1 +1,2 @@
1
+ export * from './token';
1
2
  export * from './widget';
package/types/index.js CHANGED
@@ -1 +1,2 @@
1
+ export * from './token';
1
2
  export * from './widget';
@@ -0,0 +1,4 @@
1
+ import { TokenAmount } from '@lifi/sdk';
2
+ export interface Token extends TokenAmount {
3
+ featured?: boolean;
4
+ }
package/types/token.js ADDED
@@ -0,0 +1 @@
1
+ export {};