@lifi/widget 2.0.0-beta.6 → 2.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.d.ts +4 -3
- package/AppDrawer.d.ts +1 -1
- package/cjs/App.d.ts +4 -3
- package/cjs/AppDrawer.d.ts +1 -1
- package/cjs/components/ChainSelect/ChainSelect.d.ts +1 -1
- package/cjs/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -1
- package/cjs/components/Header/Header.style.d.ts +10 -3
- package/cjs/components/Header/NavigationHeader.js +1 -1
- package/cjs/components/Header/NavigationTabs.d.ts +1 -1
- package/cjs/components/Header/NavigationTabs.style.d.ts +4 -71
- package/cjs/components/Header/WalletHeader.js +1 -1
- package/cjs/components/SelectChainAndToken.js +8 -7
- package/cjs/components/SendToWallet/SendToWallet.js +2 -2
- package/cjs/components/SmallAvatar.d.ts +1 -1
- package/cjs/components/Step/CircularProgress.d.ts +1 -1
- package/cjs/components/Step/Step.js +1 -1
- package/cjs/components/Step/StepList.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +1 -1
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -2
- package/cjs/components/TokenList/TokenList.js +5 -2
- package/cjs/components/TokenList/TokenList.style.d.ts +5 -2
- package/cjs/components/TokenList/TokenList.style.js +20 -1
- package/cjs/components/TokenList/TokenListItem.d.ts +1 -1
- package/cjs/components/TokenList/TokenListItem.js +27 -4
- package/cjs/components/TokenList/VirtualizedTokenList.js +3 -3
- package/cjs/components/TokenList/types.d.ts +4 -0
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useFundsSufficiency.js +2 -2
- package/cjs/hooks/useGasRefuel.d.ts +1 -1
- package/cjs/hooks/useGasRefuel.js +5 -15
- package/cjs/hooks/useGasSufficiency.js +2 -2
- package/cjs/hooks/useRouteExecution.js +3 -3
- package/cjs/hooks/useSwapRoutes.js +4 -4
- package/cjs/hooks/useTokenBalance.js +2 -2
- package/cjs/i18n/en.json +1 -1
- package/cjs/icons/InsuraceLogo.d.ts +1 -1
- package/cjs/icons/LiFiFullLogo.d.ts +1 -1
- package/cjs/icons/LiFiLogo.d.ts +1 -1
- package/cjs/icons/LiFiToolLogo.d.ts +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -1
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -1
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -1
- package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +1 -1
- package/cjs/pages/SettingsPage/SettingsPage.d.ts +1 -1
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -1
- package/cjs/pages/SettingsPage/SlippageInput.d.ts +1 -1
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +1 -1
- package/cjs/pages/SwapPage/StatusBottomSheet.js +3 -3
- package/cjs/providers/WalletProvider/WalletProvider.js +73 -47
- package/cjs/providers/WalletProvider/types.d.ts +0 -2
- package/cjs/stores/routes/RouteExecutionStore.d.ts +1 -1
- package/cjs/stores/settings/useSplitSubvariantStore.d.ts +1 -1
- package/cjs/types/widget.d.ts +1 -0
- package/cjs/types/widget.js +1 -0
- package/cjs/utils/wallet.d.ts +1 -1
- package/cjs/utils/wallet.js +3 -3
- package/components/ChainSelect/ChainSelect.d.ts +1 -1
- package/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -1
- package/components/Header/Header.style.d.ts +10 -3
- package/components/Header/NavigationHeader.js +1 -1
- package/components/Header/NavigationTabs.d.ts +1 -1
- package/components/Header/NavigationTabs.style.d.ts +4 -71
- package/components/Header/WalletHeader.js +2 -2
- package/components/SelectChainAndToken.js +9 -8
- package/components/SendToWallet/SendToWallet.js +2 -2
- package/components/SmallAvatar.d.ts +1 -1
- package/components/Step/CircularProgress.d.ts +1 -1
- package/components/Step/Step.js +2 -2
- package/components/Step/StepList.d.ts +1 -1
- package/components/SwapInput/SwapInputEndAdornment.d.ts +1 -1
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -2
- package/components/TokenList/TokenList.js +6 -3
- package/components/TokenList/TokenList.style.d.ts +5 -2
- package/components/TokenList/TokenList.style.js +21 -2
- package/components/TokenList/TokenListItem.d.ts +1 -1
- package/components/TokenList/TokenListItem.js +31 -8
- package/components/TokenList/VirtualizedTokenList.js +3 -3
- package/components/TokenList/types.d.ts +4 -0
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useFundsSufficiency.js +2 -2
- package/hooks/useGasRefuel.d.ts +1 -1
- package/hooks/useGasRefuel.js +5 -15
- package/hooks/useGasSufficiency.js +2 -2
- package/hooks/useRouteExecution.js +3 -3
- package/hooks/useSwapRoutes.js +4 -4
- package/hooks/useTokenBalance.js +2 -2
- package/i18n/en.json +1 -1
- package/icons/InsuraceLogo.d.ts +1 -1
- package/icons/LiFiFullLogo.d.ts +1 -1
- package/icons/LiFiLogo.d.ts +1 -1
- package/icons/LiFiToolLogo.d.ts +1 -1
- package/index.d.ts +1 -1
- package/package.json +6 -6
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -1
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -1
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -1
- package/pages/SettingsPage/GasPriceSelect.d.ts +1 -1
- package/pages/SettingsPage/SettingsPage.d.ts +1 -1
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -1
- package/pages/SettingsPage/SlippageInput.d.ts +1 -1
- package/pages/SwapDetailsPage/SwapDetailsPage.js +1 -1
- package/pages/SwapPage/StatusBottomSheet.js +4 -4
- package/providers/WalletProvider/WalletProvider.js +74 -48
- package/providers/WalletProvider/types.d.ts +0 -2
- package/stores/routes/RouteExecutionStore.d.ts +1 -1
- package/stores/settings/useSplitSubvariantStore.d.ts +1 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/widget.d.ts +1 -0
- package/types/widget.js +1 -0
- package/utils/wallet.d.ts +1 -1
- package/utils/wallet.js +1 -1
package/App.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
2
|
+
import type { WidgetDrawer } from './AppDrawer';
|
|
3
|
+
import type { WidgetConfig } from './types';
|
|
4
|
+
export declare const App: import("react").ForwardRefExoticComponent<import("./types").WidgetDrawerProps & WidgetConfig & import("./types").WidgetConfigPartialProps & import("react").RefAttributes<WidgetDrawer>>;
|
|
5
|
+
export declare const AppDefault: () => import("react/jsx-runtime").JSX.Element;
|
package/AppDrawer.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export interface WidgetDrawer {
|
|
|
9
9
|
export declare const AppDrawer: import("react").ForwardRefExoticComponent<import("./types").WidgetDrawerProps & WidgetConfig & import("./types").WidgetConfigPartialProps & import("react").RefAttributes<WidgetDrawer>>;
|
|
10
10
|
export declare const DrawerButtonText: ({ open }: {
|
|
11
11
|
open: boolean;
|
|
12
|
-
}) => JSX.Element;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
package/cjs/App.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
2
|
+
import type { WidgetDrawer } from './AppDrawer';
|
|
3
|
+
import type { WidgetConfig } from './types';
|
|
4
|
+
export declare const App: import("react").ForwardRefExoticComponent<import("./types").WidgetDrawerProps & WidgetConfig & import("./types").WidgetConfigPartialProps & import("react").RefAttributes<WidgetDrawer>>;
|
|
5
|
+
export declare const AppDefault: () => import("react/jsx-runtime").JSX.Element;
|
package/cjs/AppDrawer.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export interface WidgetDrawer {
|
|
|
9
9
|
export declare const AppDrawer: import("react").ForwardRefExoticComponent<import("./types").WidgetDrawerProps & WidgetConfig & import("./types").WidgetConfigPartialProps & import("react").RefAttributes<WidgetDrawer>>;
|
|
10
10
|
export declare const DrawerButtonText: ({ open }: {
|
|
11
11
|
open: boolean;
|
|
12
|
-
}) => JSX.Element;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { SwapFormTypeProps } from '../../providers';
|
|
2
|
-
export declare const ChainSelect: ({ formType }: SwapFormTypeProps) => JSX.Element;
|
|
2
|
+
export declare const ChainSelect: ({ formType }: SwapFormTypeProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const FundsSufficiencyMessage: () => JSX.Element;
|
|
1
|
+
export declare const FundsSufficiencyMessage: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const HeaderAppBar: import("@emotion/styled").StyledComponent<
|
|
2
|
+
export declare const HeaderAppBar: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
classes?: Partial<import("@mui/material").AppBarClasses> | undefined;
|
|
4
4
|
color?: import("@mui/types").OverridableStringUnion<"transparent" | import("@mui/material").PropTypes.Color, import("@mui/material").AppBarPropsColorOverrides> | undefined;
|
|
5
5
|
enableColorOnDark?: boolean | undefined;
|
|
6
6
|
position?: "fixed" | "absolute" | "relative" | "static" | "sticky" | undefined;
|
|
7
7
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
8
|
-
} &
|
|
8
|
+
} & Omit<{
|
|
9
|
+
children?: import("react").ReactNode;
|
|
10
|
+
classes?: Partial<import("@mui/material").PaperClasses> | undefined;
|
|
11
|
+
elevation?: number | undefined;
|
|
12
|
+
square?: boolean | undefined;
|
|
13
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
14
|
+
variant?: import("@mui/types").OverridableStringUnion<"outlined" | "elevation", import("@mui/material").PaperPropsVariantOverrides> | undefined;
|
|
15
|
+
}, "classes" | "color" | "position"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
|
|
9
16
|
ref?: ((instance: HTMLElement | null) => void) | import("react").RefObject<HTMLElement> | null | undefined;
|
|
10
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "
|
|
17
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "children" | "sx" | "position" | "variant" | "square" | "elevation" | "enableColorOnDark"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
11
18
|
export declare const Container: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
12
19
|
children?: import("react").ReactNode;
|
|
13
20
|
component?: import("react").ElementType<any> | undefined;
|
|
@@ -18,7 +18,7 @@ const WalletHeader_1 = require("./WalletHeader");
|
|
|
18
18
|
const useHeaderActionStore_1 = require("./useHeaderActionStore");
|
|
19
19
|
const NavigationHeader = () => {
|
|
20
20
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
21
|
-
const { variant, subvariant, hiddenUI
|
|
21
|
+
const { variant, subvariant, hiddenUI } = (0, providers_1.useWidgetConfig)();
|
|
22
22
|
const { navigate, navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
23
23
|
const { account } = (0, providers_1.useWallet)();
|
|
24
24
|
const { element } = (0, useHeaderActionStore_1.useHeaderActionStore)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const NavigationTabs: () => JSX.Element;
|
|
1
|
+
export declare const NavigationTabs: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,75 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
'aria-labelledby'?: string | undefined;
|
|
7
|
-
centered?: boolean | undefined;
|
|
8
|
-
children?: import("react").ReactNode;
|
|
9
|
-
classes?: Partial<import("@mui/material").TabsClasses> | undefined;
|
|
10
|
-
slots?: {
|
|
11
|
-
StartScrollButtonIcon?: import("react").ElementType<any> | undefined;
|
|
12
|
-
EndScrollButtonIcon?: import("react").ElementType<any> | undefined;
|
|
13
|
-
} | undefined;
|
|
14
|
-
slotProps?: {
|
|
15
|
-
startScrollButtonIcon?: import("@mui/base").SlotComponentProps<import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
|
|
16
|
-
muiName: string;
|
|
17
|
-
}, import("@mui/material").TabsStartScrollButtonIconSlotPropsOverrides, import("@mui/material").TabsOwnerState> | undefined;
|
|
18
|
-
endScrollButtonIcon?: import("@mui/base").SlotComponentProps<import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
|
|
19
|
-
muiName: string;
|
|
20
|
-
}, import("@mui/material").TabsEndScrollButtonIconSlotPropsOverrides, import("@mui/material").TabsOwnerState> | undefined;
|
|
21
|
-
} | undefined;
|
|
22
|
-
indicatorColor?: import("@mui/types").OverridableStringUnion<"primary" | "secondary", import("@mui/material").TabsPropsIndicatorColorOverrides> | undefined;
|
|
23
|
-
onChange?: ((event: import("react").SyntheticEvent<Element, Event>, value: any) => void) | undefined;
|
|
24
|
-
orientation?: "horizontal" | "vertical" | undefined;
|
|
25
|
-
ScrollButtonComponent?: import("react").ElementType<any> | undefined;
|
|
26
|
-
scrollButtons?: boolean | "auto" | undefined;
|
|
27
|
-
selectionFollowsFocus?: boolean | undefined;
|
|
28
|
-
TabIndicatorProps?: (import("react").HTMLAttributes<HTMLDivElement> & {
|
|
29
|
-
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
30
|
-
}) | undefined;
|
|
31
|
-
TabScrollButtonProps?: Partial<import("@mui/material").TabScrollButtonProps> | undefined;
|
|
32
|
-
textColor?: "inherit" | "primary" | "secondary" | undefined;
|
|
33
|
-
value?: any;
|
|
34
|
-
variant?: "fullWidth" | "standard" | "scrollable" | undefined;
|
|
35
|
-
visibleScrollbar?: boolean | undefined;
|
|
36
|
-
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
37
|
-
} & import("@mui/material/OverridableComponent").CommonProps & Omit<{
|
|
38
|
-
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
39
|
-
centerRipple?: boolean | undefined;
|
|
40
|
-
children?: import("react").ReactNode;
|
|
41
|
-
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
42
|
-
disabled?: boolean | undefined;
|
|
43
|
-
disableRipple?: boolean | undefined;
|
|
44
|
-
disableTouchRipple?: boolean | undefined;
|
|
45
|
-
focusRipple?: boolean | undefined;
|
|
46
|
-
focusVisibleClassName?: string | undefined;
|
|
47
|
-
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
48
|
-
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
49
|
-
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
50
|
-
tabIndex?: number | undefined;
|
|
51
|
-
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
52
|
-
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
53
|
-
} & Omit<{
|
|
54
|
-
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
55
|
-
centerRipple?: boolean | undefined;
|
|
56
|
-
children?: import("react").ReactNode;
|
|
57
|
-
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
58
|
-
disabled?: boolean | undefined;
|
|
59
|
-
disableRipple?: boolean | undefined;
|
|
60
|
-
disableTouchRipple?: boolean | undefined;
|
|
61
|
-
focusRipple?: boolean | undefined;
|
|
62
|
-
focusVisibleClassName?: string | undefined;
|
|
63
|
-
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
64
|
-
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
65
|
-
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
66
|
-
tabIndex?: number | undefined;
|
|
67
|
-
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
68
|
-
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
69
|
-
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
70
|
-
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
71
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef">, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "aria-label" | "aria-labelledby" | "onChange" | "action" | "sx" | "variant" | "value" | "slotProps" | "slots" | "orientation" | "allowScrollButtonsMobile" | "centered" | "indicatorColor" | "ScrollButtonComponent" | "scrollButtons" | "selectionFollowsFocus" | "TabIndicatorProps" | "TabScrollButtonProps" | "textColor" | "visibleScrollbar"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
72
|
-
export declare const NavbarTab: import("@emotion/styled").StyledComponent<{
|
|
2
|
+
import type { StyledComponent } from '@emotion/styled';
|
|
3
|
+
import type { TabsProps } from '@mui/material';
|
|
4
|
+
export declare const NavbarTabs: StyledComponent<TabsProps>;
|
|
5
|
+
export declare const NavbarTab: StyledComponent<{
|
|
73
6
|
children?: null | undefined;
|
|
74
7
|
classes?: Partial<import("@mui/material").TabClasses> | undefined;
|
|
75
8
|
disabled?: boolean | undefined;
|
|
@@ -47,7 +47,7 @@ const ConnectedButton = () => {
|
|
|
47
47
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
48
48
|
const { subvariant } = (0, providers_1.useWidgetConfig)();
|
|
49
49
|
const { account, disconnect } = (0, providers_1.useWallet)();
|
|
50
|
-
const walletAddress = (0, utils_1.
|
|
50
|
+
const walletAddress = (0, utils_1.shortenAddress)(account.address);
|
|
51
51
|
const { chain } = (0, hooks_1.useChain)(account.chainId);
|
|
52
52
|
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
53
53
|
const handleClick = (event) => {
|
|
@@ -10,7 +10,7 @@ const providers_1 = require("../providers");
|
|
|
10
10
|
const types_1 = require("../types");
|
|
11
11
|
const SelectChainAndToken = (props) => {
|
|
12
12
|
const prefersNarrowView = (0, material_1.useMediaQuery)((theme) => theme.breakpoints.down('sm'));
|
|
13
|
-
const { disabledUI, variant } = (0, providers_1.useWidgetConfig)();
|
|
13
|
+
const { disabledUI, hiddenUI, variant } = (0, providers_1.useWidgetConfig)();
|
|
14
14
|
const [fromChain, toChain, fromToken, toToken] = (0, react_hook_form_1.useWatch)({
|
|
15
15
|
name: [
|
|
16
16
|
providers_1.SwapFormKey.FromChain,
|
|
@@ -19,20 +19,21 @@ const SelectChainAndToken = (props) => {
|
|
|
19
19
|
providers_1.SwapFormKey.ToToken,
|
|
20
20
|
],
|
|
21
21
|
});
|
|
22
|
-
const
|
|
22
|
+
const hiddenReverse = variant === 'refuel' ||
|
|
23
23
|
disabledUI?.includes(types_1.DisabledUI.FromToken) ||
|
|
24
|
-
disabledUI?.includes(types_1.DisabledUI.ToToken)
|
|
25
|
-
|
|
24
|
+
disabledUI?.includes(types_1.DisabledUI.ToToken) ||
|
|
25
|
+
hiddenUI?.includes(types_1.HiddenUI.ToToken);
|
|
26
|
+
const hiddenToToken = variant === 'nft' || hiddenUI?.includes(types_1.HiddenUI.ToToken);
|
|
26
27
|
const isCompact = fromChain &&
|
|
27
28
|
toChain &&
|
|
28
29
|
fromToken &&
|
|
29
30
|
toToken &&
|
|
30
31
|
!prefersNarrowView &&
|
|
31
|
-
!
|
|
32
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { display: 'flex', flexDirection: isCompact ? 'row' : 'column' }, ...props, children: [(0, jsx_runtime_1.jsx)(SelectTokenButton_1.SelectTokenButton, { formType: "from", compact: isCompact }), !
|
|
32
|
+
!hiddenToToken;
|
|
33
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { display: 'flex', flexDirection: isCompact ? 'row' : 'column' }, ...props, children: [(0, jsx_runtime_1.jsx)(SelectTokenButton_1.SelectTokenButton, { formType: "from", compact: isCompact }), !hiddenToToken ? ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
33
34
|
display: 'flex',
|
|
34
35
|
justifyContent: 'center',
|
|
35
36
|
alignItems: 'center',
|
|
36
|
-
}, m: !
|
|
37
|
+
}, m: !hiddenReverse ? -1.125 : 1, children: !hiddenReverse ? ((0, jsx_runtime_1.jsx)(ReverseTokensButton_1.ReverseTokensButton, { vertical: !isCompact })) : null })) : null, !hiddenToToken ? ((0, jsx_runtime_1.jsx)(SelectTokenButton_1.SelectTokenButton, { formType: "to", compact: isCompact })) : null] }));
|
|
37
38
|
};
|
|
38
39
|
exports.SelectChainAndToken = SelectChainAndToken;
|
|
@@ -15,7 +15,7 @@ const SendToWallet_style_1 = require("./SendToWallet.style");
|
|
|
15
15
|
exports.SendToWallet = (0, react_1.forwardRef)((props, ref) => {
|
|
16
16
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
17
17
|
const { trigger, getValues, clearErrors } = (0, react_hook_form_1.useFormContext)();
|
|
18
|
-
const { account
|
|
18
|
+
const { account } = (0, providers_1.useWallet)();
|
|
19
19
|
const { disabledUI, hiddenUI, requiredUI, toAddress } = (0, providers_1.useWidgetConfig)();
|
|
20
20
|
const { showSendToWallet, showSendToWalletDirty, setSendToWallet } = (0, stores_1.useSendToWalletStore)();
|
|
21
21
|
const { showDestinationWallet } = (0, stores_1.useSettings)(['showDestinationWallet']);
|
|
@@ -33,7 +33,7 @@ exports.SendToWallet = (0, react_1.forwardRef)((props, ref) => {
|
|
|
33
33
|
if (!value) {
|
|
34
34
|
return true;
|
|
35
35
|
}
|
|
36
|
-
const address = await provider?.resolveName(value);
|
|
36
|
+
const address = await account.signer?.provider?.resolveName(value);
|
|
37
37
|
return ((0, address_1.isAddress)(address || value) ||
|
|
38
38
|
t('swap.error.title.walletAddressInvalid'));
|
|
39
39
|
}
|
|
@@ -33,4 +33,4 @@ export declare const SmallAvatarSkeletonContainer: import("@emotion/styled").Sty
|
|
|
33
33
|
} & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
34
34
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
35
35
|
}, "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>, {}, {}>;
|
|
36
|
-
export declare const SmallAvatarSkeleton: () => JSX.Element;
|
|
36
|
+
export declare const SmallAvatarSkeleton: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -43,7 +43,7 @@ const Step = ({ step, fromToken, toToken, toAddress }) => {
|
|
|
43
43
|
: t('swap.stepSwap');
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
const formattedToAddress = (0, utils_1.
|
|
46
|
+
const formattedToAddress = (0, utils_1.shortenAddress)(toAddress);
|
|
47
47
|
const toAddressLink = toAddress
|
|
48
48
|
? `${getChainById(step.action.toChainId)?.metamask.blockExplorerUrls[0]}address/${toAddress}`
|
|
49
49
|
: undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Route } from '@lifi/sdk';
|
|
2
|
-
export declare const getStepList: (route?: Route) => JSX.Element[] | undefined;
|
|
2
|
+
export declare const getStepList: (route?: Route) => import("react/jsx-runtime").JSX.Element[] | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { SwapFormTypeProps } from '../../providers';
|
|
2
|
-
export declare const SwapInputEndAdornment: ({ formType }: SwapFormTypeProps) => JSX.Element;
|
|
2
|
+
export declare const SwapInputEndAdornment: ({ formType }: SwapFormTypeProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SwapRoutesExpanded: () => JSX.Element;
|
|
2
|
-
export declare const SwapRoutesExpandedElement: () => JSX.Element;
|
|
1
|
+
export declare const SwapRoutesExpanded: () => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const SwapRoutesExpandedElement: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -17,6 +17,7 @@ const TokenList = ({ formType, height, onClick, }) => {
|
|
|
17
17
|
name: [providers_1.SwapFormKeyHelper.getChainKey(formType)],
|
|
18
18
|
});
|
|
19
19
|
const [tokenSearchFilter] = (0, hooks_1.useDebouncedWatch)([providers_1.SwapFormKey.TokenSearchFilter], 320);
|
|
20
|
+
const { chain, isLoading: isChainLoading } = (0, hooks_1.useChain)(selectedChainId);
|
|
20
21
|
const { tokens: chainTokens, tokensWithBalance, isLoading: isTokensLoading, isBalanceLoading, featuredTokens, } = (0, hooks_1.useTokenBalances)(selectedChainId);
|
|
21
22
|
let filteredTokens = (tokensWithBalance ??
|
|
22
23
|
chainTokens ??
|
|
@@ -32,13 +33,15 @@ const TokenList = ({ formType, height, onClick, }) => {
|
|
|
32
33
|
!!tokenSearchFilter &&
|
|
33
34
|
!!selectedChainId;
|
|
34
35
|
const { token: searchedToken, isLoading: isSearchedTokenLoading } = (0, hooks_1.useTokenSearch)(selectedChainId, tokenSearchFilter, tokenSearchEnabled);
|
|
35
|
-
const isLoading = isTokensLoading ||
|
|
36
|
+
const isLoading = isTokensLoading ||
|
|
37
|
+
isChainLoading ||
|
|
38
|
+
(tokenSearchEnabled && isSearchedTokenLoading);
|
|
36
39
|
const tokens = filteredTokens.length
|
|
37
40
|
? filteredTokens
|
|
38
41
|
: searchedToken
|
|
39
42
|
? [searchedToken]
|
|
40
43
|
: filteredTokens;
|
|
41
44
|
const handleTokenClick = (0, useTokenSelect_1.useTokenSelect)(formType, onClick);
|
|
42
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { ref: parentRef, style: { height, overflow: 'auto' }, children: [!tokens.length && !isLoading ? ((0, jsx_runtime_1.jsx)(TokenNotFound_1.TokenNotFound, { formType: formType })) : null, (0, jsx_runtime_1.jsx)(VirtualizedTokenList_1.VirtualizedTokenList, { tokens: tokens, featuredTokensLength: featuredTokens?.length, scrollElementRef: parentRef, chainId: selectedChainId, isLoading: isLoading, isBalanceLoading: isBalanceLoading, showBalance: account.isActive, showFeatured: !tokenSearchFilter, onClick: handleTokenClick })] }));
|
|
45
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { ref: parentRef, style: { height, overflow: 'auto' }, children: [!tokens.length && !isLoading ? ((0, jsx_runtime_1.jsx)(TokenNotFound_1.TokenNotFound, { formType: formType })) : null, (0, jsx_runtime_1.jsx)(VirtualizedTokenList_1.VirtualizedTokenList, { tokens: tokens, featuredTokensLength: featuredTokens?.length, scrollElementRef: parentRef, chainId: selectedChainId, chain: chain, isLoading: isLoading, isBalanceLoading: isBalanceLoading, showBalance: account.isActive, showFeatured: !tokenSearchFilter, onClick: handleTokenClick })] }));
|
|
43
46
|
};
|
|
44
47
|
exports.TokenList = TokenList;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import type { StyledComponent } from '@emotion/styled';
|
|
3
|
+
import type { ButtonProps, LinkProps } from '@mui/material';
|
|
4
|
+
export declare const ListItemButton: StyledComponent<import("@mui/material").ListItemButtonBaseProps & Omit<{
|
|
3
5
|
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
4
6
|
centerRipple?: boolean | undefined;
|
|
5
7
|
children?: import("react").ReactNode;
|
|
@@ -18,7 +20,7 @@ export declare const ListItemButton: import("@emotion/styled").StyledComponent<i
|
|
|
18
20
|
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
19
21
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
20
22
|
}, "className" | "style" | "classes" | "autoFocus" | "tabIndex" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "alignItems" | "dense" | "divider" | "selected" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
21
|
-
export declare const ListItem:
|
|
23
|
+
export declare const ListItem: StyledComponent<{
|
|
22
24
|
button?: false | undefined;
|
|
23
25
|
} & import("@mui/material").ListItemBaseProps & {
|
|
24
26
|
components?: {
|
|
@@ -36,3 +38,4 @@ export declare const ListItem: import("@emotion/styled").StyledComponent<{
|
|
|
36
38
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & {
|
|
37
39
|
ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
|
|
38
40
|
}, "button" | "className" | "style" | "classes" | "autoFocus" | "children" | "disabled" | "sx" | "alignItems" | "dense" | "divider" | "components" | "slotProps" | "slots" | "componentsProps" | "selected" | "disableGutters" | "ContainerComponent" | "ContainerProps" | "disablePadding" | "secondaryAction"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
41
|
+
export declare const LinkButton: StyledComponent<ButtonProps & LinkProps>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ListItem = exports.ListItemButton = void 0;
|
|
3
|
+
exports.LinkButton = exports.ListItem = exports.ListItemButton = void 0;
|
|
4
4
|
const material_1 = require("@mui/material");
|
|
5
5
|
const ListItemSecondaryAction_1 = require("@mui/material/ListItemSecondaryAction");
|
|
6
6
|
const ListItemText_1 = require("@mui/material/ListItemText");
|
|
@@ -29,3 +29,22 @@ exports.ListItem = (0, styles_1.styled)(material_1.ListItem)(({ theme }) => ({
|
|
|
29
29
|
whiteSpace: 'nowrap',
|
|
30
30
|
},
|
|
31
31
|
}));
|
|
32
|
+
exports.LinkButton = (0, styles_1.styled)(material_1.Button)(({ theme }) => ({
|
|
33
|
+
lineHeight: 1,
|
|
34
|
+
fontSize: '0.75rem',
|
|
35
|
+
fontWeight: 400,
|
|
36
|
+
padding: theme.spacing(0.375, 0.75),
|
|
37
|
+
color: 'inherit',
|
|
38
|
+
backgroundColor: 'unset',
|
|
39
|
+
'&:hover': {
|
|
40
|
+
backgroundColor: theme.palette.mode === 'light'
|
|
41
|
+
? (0, styles_1.alpha)(theme.palette.common.black, 0.04)
|
|
42
|
+
: (0, styles_1.alpha)(theme.palette.common.white, 0.08),
|
|
43
|
+
},
|
|
44
|
+
[`.${material_1.buttonClasses.endIcon}`]: {
|
|
45
|
+
marginLeft: theme.spacing(0.25),
|
|
46
|
+
},
|
|
47
|
+
[`.${material_1.buttonClasses.endIcon} > *:nth-of-type(1)`]: {
|
|
48
|
+
fontSize: '0.75rem',
|
|
49
|
+
},
|
|
50
|
+
}));
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
import type { TokenListItemButtonProps, TokenListItemProps } from './types';
|
|
3
3
|
export declare const TokenListItem: React.FC<TokenListItemProps>;
|
|
4
4
|
export declare const TokenListItemButton: React.FC<TokenListItemButtonProps>;
|
|
5
|
-
export declare const TokenListItemSkeleton: () => JSX.Element;
|
|
5
|
+
export declare const TokenListItemSkeleton: () => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export declare const TokenAmountSkeleton: React.FC;
|
|
@@ -2,22 +2,45 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TokenAmountSkeleton = exports.TokenListItemSkeleton = exports.TokenListItemButton = exports.TokenListItem = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const OpenInNewRounded_1 = require("@mui/icons-material/OpenInNewRounded");
|
|
5
6
|
const material_1 = require("@mui/material");
|
|
6
7
|
const react_1 = require("react");
|
|
7
8
|
const react_i18next_1 = require("react-i18next");
|
|
8
9
|
const utils_1 = require("../../utils");
|
|
9
10
|
const TokenList_style_1 = require("./TokenList.style");
|
|
10
|
-
exports.TokenListItem = (0, react_1.memo)(({ onClick, size, start, token, showBalance, isBalanceLoading, startAdornment, endAdornment, }) => {
|
|
11
|
+
exports.TokenListItem = (0, react_1.memo)(({ onClick, size, start, token, chain, showBalance, isBalanceLoading, startAdornment, endAdornment, }) => {
|
|
11
12
|
const handleClick = () => onClick?.(token.address);
|
|
12
13
|
return ((0, jsx_runtime_1.jsxs)(TokenList_style_1.ListItem, { disablePadding: true, style: {
|
|
13
14
|
height: `${size}px`,
|
|
14
15
|
transform: `translateY(${start}px)`,
|
|
15
|
-
}, children: [startAdornment, (0, jsx_runtime_1.jsx)(exports.TokenListItemButton, { token: token, showBalance: showBalance, isBalanceLoading: isBalanceLoading, onClick: handleClick }), endAdornment] }));
|
|
16
|
+
}, children: [startAdornment, (0, jsx_runtime_1.jsx)(exports.TokenListItemButton, { token: token, chain: chain, showBalance: showBalance, isBalanceLoading: isBalanceLoading, onClick: handleClick }), endAdornment] }));
|
|
16
17
|
});
|
|
17
|
-
const TokenListItemButton = ({ onClick, token, showBalance, isBalanceLoading, }) => {
|
|
18
|
+
const TokenListItemButton = ({ onClick, token, chain, showBalance, isBalanceLoading, }) => {
|
|
18
19
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
19
20
|
const tokenPrice = (0, utils_1.formatTokenPrice)(token.amount, token.priceUSD);
|
|
20
|
-
|
|
21
|
+
const container = (0, react_1.useRef)(null);
|
|
22
|
+
const timeoutId = (0, react_1.useRef)();
|
|
23
|
+
const [showAddress, setShowAddress] = (0, react_1.useState)(false);
|
|
24
|
+
const onMouseEnter = () => {
|
|
25
|
+
timeoutId.current = setTimeout(() => setShowAddress(true), 350);
|
|
26
|
+
};
|
|
27
|
+
const onMouseLeave = () => {
|
|
28
|
+
clearTimeout(timeoutId.current);
|
|
29
|
+
if (showAddress) {
|
|
30
|
+
setShowAddress(false);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return ((0, jsx_runtime_1.jsxs)(TokenList_style_1.ListItemButton, { onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, dense: true, children: [(0, jsx_runtime_1.jsx)(material_1.ListItemAvatar, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { src: token.logoURI, alt: token.symbol, children: token.symbol[0] }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: token.symbol, secondaryTypographyProps: {
|
|
34
|
+
component: 'div',
|
|
35
|
+
sx: {
|
|
36
|
+
overflow: 'auto',
|
|
37
|
+
marginLeft: -0.75,
|
|
38
|
+
},
|
|
39
|
+
}, secondary: (0, jsx_runtime_1.jsxs)(material_1.Box, { position: "relative", height: 18, ref: container, children: [(0, jsx_runtime_1.jsx)(material_1.Slide, { direction: "down", in: !showAddress, container: container.current, style: {
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
}, appear: false, children: (0, jsx_runtime_1.jsx)(material_1.Box, { pl: 0.75, children: token.name }) }), (0, jsx_runtime_1.jsx)(material_1.Slide, { direction: "up", in: showAddress, container: container.current, style: {
|
|
42
|
+
position: 'absolute',
|
|
43
|
+
}, appear: false, mountOnEnter: true, children: (0, jsx_runtime_1.jsx)(TokenList_style_1.LinkButton, { size: "small", LinkComponent: material_1.Link, href: `${chain?.metamask.blockExplorerUrls[0]}address/${token.address}`, target: "_blank", rel: "nofollow noreferrer", onClick: (e) => e.stopPropagation(), endIcon: (0, jsx_runtime_1.jsx)(OpenInNewRounded_1.default, {}), children: (0, utils_1.shortenAddress)(token.address) }) })] }) }), showBalance ? (isBalanceLoading ? ((0, jsx_runtime_1.jsx)(exports.TokenAmountSkeleton, {})) : ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { textAlign: 'right' }, children: [Number(token.amount) ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body1", noWrap: true, children: t('format.number', {
|
|
21
44
|
value: token.amount,
|
|
22
45
|
}) })) : null, tokenPrice ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { fontWeight: 400, fontSize: 12, color: "text.secondary", "data-price": token.priceUSD, children: t(`format.currency`, {
|
|
23
46
|
value: tokenPrice,
|
|
@@ -7,7 +7,7 @@ const react_virtual_1 = require("@tanstack/react-virtual");
|
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const react_i18next_1 = require("react-i18next");
|
|
9
9
|
const TokenListItem_1 = require("./TokenListItem");
|
|
10
|
-
const VirtualizedTokenList = ({ tokens, featuredTokensLength, scrollElementRef, chainId, isLoading, isBalanceLoading, showBalance, showFeatured, onClick, }) => {
|
|
10
|
+
const VirtualizedTokenList = ({ tokens, featuredTokensLength, scrollElementRef, chainId, chain, isLoading, isBalanceLoading, showBalance, showFeatured, onClick, }) => {
|
|
11
11
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
12
12
|
const hasFeaturedTokens = !!featuredTokensLength && showFeatured;
|
|
13
13
|
const featuredTokensLastIndex = (featuredTokensLength ?? 0) - 1;
|
|
@@ -35,7 +35,7 @@ const VirtualizedTokenList = ({ tokens, featuredTokensLength, scrollElementRef,
|
|
|
35
35
|
}
|
|
36
36
|
return size;
|
|
37
37
|
},
|
|
38
|
-
getItemKey: (index) => tokens[index].address
|
|
38
|
+
getItemKey: (index) => `${tokens[index].address}-${index}`,
|
|
39
39
|
});
|
|
40
40
|
(0, react_1.useEffect)(() => {
|
|
41
41
|
if (getVirtualItems().length) {
|
|
@@ -49,7 +49,7 @@ const VirtualizedTokenList = ({ tokens, featuredTokensLength, scrollElementRef,
|
|
|
49
49
|
}
|
|
50
50
|
return ((0, jsx_runtime_1.jsx)(material_1.List, { style: { height: getTotalSize() }, disablePadding: true, children: getVirtualItems().map((item) => {
|
|
51
51
|
const token = tokens[item.index];
|
|
52
|
-
return ((0, jsx_runtime_1.jsx)(TokenListItem_1.TokenListItem, { onClick: onClick, size: item.size, start: item.start, token: token, isBalanceLoading: isBalanceLoading, showBalance: showBalance, startAdornment: hasFeaturedTokens && token.featured && item.index === 0 ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, fontWeight: 600, lineHeight: 1, px: 2, pb: 1.25, children: t('swap.featuredTokens') })) : null, endAdornment: hasFeaturedTokens &&
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(TokenListItem_1.TokenListItem, { onClick: onClick, size: item.size, start: item.start, token: token, chain: chain, isBalanceLoading: isBalanceLoading, showBalance: showBalance, startAdornment: hasFeaturedTokens && token.featured && item.index === 0 ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, fontWeight: 600, lineHeight: 1, px: 2, pb: 1.25, children: t('swap.featuredTokens') })) : null, endAdornment: hasFeaturedTokens &&
|
|
53
53
|
token.featured &&
|
|
54
54
|
item.index === featuredTokensLastIndex &&
|
|
55
55
|
item.index !== tokensLastIndex ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, fontWeight: 600, lineHeight: 1, px: 2, py: 1.25, children: t('swap.otherTokens') })) : null }, item.key));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ExtendedChain } from '@lifi/sdk';
|
|
1
2
|
import type { MutableRefObject } from 'react';
|
|
2
3
|
import type { SwapFormType } from '../../providers';
|
|
3
4
|
import type { TokenAmount } from '../../types';
|
|
@@ -13,6 +14,7 @@ export interface VirtualizedTokenListProps {
|
|
|
13
14
|
isLoading: boolean;
|
|
14
15
|
isBalanceLoading: boolean;
|
|
15
16
|
chainId: number;
|
|
17
|
+
chain?: ExtendedChain;
|
|
16
18
|
showBalance?: boolean;
|
|
17
19
|
showFeatured?: boolean;
|
|
18
20
|
onClick(tokenAddress: string): void;
|
|
@@ -25,6 +27,7 @@ export interface TokenListItemBaseProps {
|
|
|
25
27
|
export interface TokenListItemProps extends TokenListItemBaseProps {
|
|
26
28
|
showBalance?: boolean;
|
|
27
29
|
token: TokenAmount;
|
|
30
|
+
chain?: ExtendedChain;
|
|
28
31
|
isBalanceLoading?: boolean;
|
|
29
32
|
startAdornment?: React.ReactNode;
|
|
30
33
|
endAdornment?: React.ReactNode;
|
|
@@ -33,5 +36,6 @@ export interface TokenListItemButtonProps {
|
|
|
33
36
|
onClick?(): void;
|
|
34
37
|
showBalance?: boolean;
|
|
35
38
|
token: TokenAmount;
|
|
39
|
+
chain?: ExtendedChain;
|
|
36
40
|
isBalanceLoading?: boolean;
|
|
37
41
|
}
|
package/cjs/config/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "2.0.0-beta.
|
|
2
|
+
export declare const version = "2.0.0-beta.8";
|
package/cjs/config/version.js
CHANGED
|
@@ -10,8 +10,8 @@ const useGetTokenBalancesWithRetry_1 = require("./useGetTokenBalancesWithRetry")
|
|
|
10
10
|
const useTokenAddressBalance_1 = require("./useTokenAddressBalance");
|
|
11
11
|
const refetchInterval = 30000;
|
|
12
12
|
const useFundsSufficiency = (route) => {
|
|
13
|
-
const { account
|
|
14
|
-
const getTokenBalancesWithRetry = (0, useGetTokenBalancesWithRetry_1.useGetTokenBalancesWithRetry)(provider);
|
|
13
|
+
const { account } = (0, providers_1.useWallet)();
|
|
14
|
+
const getTokenBalancesWithRetry = (0, useGetTokenBalancesWithRetry_1.useGetTokenBalancesWithRetry)(account.signer?.provider);
|
|
15
15
|
const [fromChainId, fromTokenAddress, fromAmount] = (0, react_hook_form_1.useWatch)({
|
|
16
16
|
name: [
|
|
17
17
|
providers_1.SwapFormKey.FromChain,
|
|
@@ -3,5 +3,5 @@ export declare const useGasRefuel: () => {
|
|
|
3
3
|
availble: boolean | undefined;
|
|
4
4
|
isLoading: boolean;
|
|
5
5
|
chain: import("@lifi/types").ExtendedChain | undefined;
|
|
6
|
-
|
|
6
|
+
fromAmount: string | undefined;
|
|
7
7
|
};
|
|
@@ -10,12 +10,11 @@ const useGasRecommendation_1 = require("./useGasRecommendation");
|
|
|
10
10
|
const useTokenBalance_1 = require("./useTokenBalance");
|
|
11
11
|
const useGasRefuel = () => {
|
|
12
12
|
const { getChainById } = (0, _1.useChains)();
|
|
13
|
-
const [fromChainId, fromTokenAddress, toChainId,
|
|
13
|
+
const [fromChainId, fromTokenAddress, toChainId, toAddress] = (0, react_hook_form_1.useWatch)({
|
|
14
14
|
name: [
|
|
15
15
|
providers_1.SwapFormKey.FromChain,
|
|
16
16
|
providers_1.SwapFormKey.FromToken,
|
|
17
17
|
providers_1.SwapFormKey.ToChain,
|
|
18
|
-
providers_1.SwapFormKey.ToToken,
|
|
19
18
|
providers_1.SwapFormKey.ToAddress,
|
|
20
19
|
],
|
|
21
20
|
});
|
|
@@ -27,10 +26,7 @@ const useGasRefuel = () => {
|
|
|
27
26
|
// We don't allow same chain refuel.
|
|
28
27
|
// If a user runs out of gas, he can't send a source chain transaction.
|
|
29
28
|
fromChainId === toChainId ||
|
|
30
|
-
// We don't want to apply auto refuel when swapping to native tokens
|
|
31
|
-
toChain?.nativeToken.address === toTokenAddress ||
|
|
32
29
|
!gasRecommendation?.available ||
|
|
33
|
-
!gasRecommendation.recommended ||
|
|
34
30
|
!nativeToken) {
|
|
35
31
|
return false;
|
|
36
32
|
}
|
|
@@ -41,21 +37,15 @@ const useGasRefuel = () => {
|
|
|
41
37
|
.div(2);
|
|
42
38
|
const insufficientGas = tokenBalance.lt(recommendedAmount);
|
|
43
39
|
return insufficientGas;
|
|
44
|
-
}, [
|
|
45
|
-
fromChainId,
|
|
46
|
-
gasRecommendation?.available,
|
|
47
|
-
gasRecommendation?.recommended,
|
|
48
|
-
nativeToken,
|
|
49
|
-
toChain?.nativeToken.address,
|
|
50
|
-
toChainId,
|
|
51
|
-
toTokenAddress,
|
|
52
|
-
]);
|
|
40
|
+
}, [fromChainId, gasRecommendation, nativeToken, toChainId]);
|
|
53
41
|
return {
|
|
54
42
|
enabled: enabled,
|
|
55
43
|
availble: gasRecommendation?.available,
|
|
56
44
|
isLoading: isLoading,
|
|
57
45
|
chain: toChain,
|
|
58
|
-
gasRecommendation
|
|
46
|
+
fromAmount: gasRecommendation?.available
|
|
47
|
+
? gasRecommendation.fromAmount
|
|
48
|
+
: undefined,
|
|
59
49
|
};
|
|
60
50
|
};
|
|
61
51
|
exports.useGasRefuel = useGasRefuel;
|
|
@@ -7,9 +7,9 @@ const _1 = require(".");
|
|
|
7
7
|
const providers_1 = require("../providers");
|
|
8
8
|
const refetchInterval = 30000;
|
|
9
9
|
const useGasSufficiency = (route) => {
|
|
10
|
-
const { account
|
|
10
|
+
const { account } = (0, providers_1.useWallet)();
|
|
11
11
|
const { getChainById } = (0, _1.useChains)();
|
|
12
|
-
const getTokenBalancesWithRetry = (0, _1.useGetTokenBalancesWithRetry)(provider);
|
|
12
|
+
const getTokenBalancesWithRetry = (0, _1.useGetTokenBalancesWithRetry)(account.signer?.provider);
|
|
13
13
|
const { data: insufficientGas, isInitialLoading } = (0, react_query_1.useQuery)(['gas-sufficiency-check', account.address, route?.id], async () => {
|
|
14
14
|
if (!account.address || !route) {
|
|
15
15
|
return;
|