@lifi/widget 1.17.2 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.js +6 -86
- package/AppDrawer.js +3 -2
- package/AppRoutes.d.ts +2 -0
- package/AppRoutes.js +85 -0
- package/cjs/App.js +5 -85
- package/cjs/AppDrawer.js +2 -1
- package/cjs/AppRoutes.d.ts +2 -0
- package/cjs/AppRoutes.js +89 -0
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -0
- package/cjs/components/AppContainer.d.ts +4 -5
- package/cjs/components/AppContainer.js +30 -29
- package/cjs/components/Card/Card.d.ts +1 -0
- package/cjs/components/Card/Card.js +13 -9
- package/cjs/components/ChainSelect/ChainSelect.d.ts +1 -0
- package/cjs/components/ChainSelect/ChainSelect.js +3 -3
- package/cjs/components/ChainSelect/ChainSelect.style.d.ts +1 -0
- package/cjs/components/ChainSelect/ChainSelect.style.js +2 -2
- package/cjs/components/ChainSelect/useChainSelect.js +2 -2
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +6 -2
- package/cjs/components/Header/Header.d.ts +2 -1
- package/cjs/components/Header/Header.js +3 -2
- package/cjs/components/Header/Header.style.js +3 -2
- package/cjs/components/Header/NavigationHeader.js +4 -1
- package/cjs/components/Header/WalletHeader.js +1 -1
- package/cjs/components/PoweredBy/PoweredBy.js +7 -0
- package/cjs/components/SendToWallet/SendToWallet.js +6 -10
- package/cjs/components/SendToWallet/SendToWalletButton.d.ts +2 -0
- package/cjs/components/SendToWallet/SendToWalletButton.js +24 -0
- package/cjs/components/SendToWallet/index.d.ts +1 -0
- package/cjs/components/SendToWallet/index.js +1 -0
- package/cjs/components/SendToWallet/store.d.ts +4 -0
- package/cjs/components/SendToWallet/store.js +13 -0
- package/cjs/components/SendToWallet/types.d.ts +6 -0
- package/cjs/{stores/route → components/SendToWallet}/types.js +0 -0
- package/cjs/components/Step/CircularProgress.d.ts +1 -0
- package/cjs/components/StepActions/StepActions.style.js +1 -1
- package/cjs/components/SwapButton/ButtonTooltip.d.ts +1 -0
- package/cjs/components/SwapButton/SwapButton.d.ts +1 -1
- package/cjs/components/SwapButton/SwapButton.js +4 -4
- package/cjs/components/SwapInput/SwapInputAdornment.d.ts +1 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.d.ts +2 -1
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +19 -15
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +30 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +16 -3
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -12
- package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +1 -3
- package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -13
- package/cjs/components/SwapRouteCard/types.d.ts +6 -2
- package/cjs/{pages/MainPage → components/SwapRoutes}/SwapRoutes.d.ts +0 -0
- package/cjs/components/SwapRoutes/SwapRoutes.js +51 -0
- package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +43 -0
- package/cjs/components/SwapRoutes/SwapRoutes.style.js +47 -0
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -0
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +38 -0
- package/cjs/components/SwapRoutes/index.d.ts +2 -0
- package/cjs/components/SwapRoutes/index.js +18 -0
- package/cjs/components/Token/Token.d.ts +2 -1
- package/cjs/components/Token/Token.js +10 -6
- package/cjs/components/Token/Token.style.js +2 -0
- package/cjs/config/theme.js +20 -24
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useChains.js +2 -2
- package/cjs/hooks/useNavigateBack.js +13 -6
- package/cjs/hooks/useRouteExecution.js +4 -4
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/cjs/pages/MainPage/MainPage.js +4 -2
- package/cjs/pages/MainPage/MainSwapButton.js +4 -4
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
- package/cjs/pages/SelectTokenPage/SelectTokenPage.js +4 -3
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
- package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +1 -0
- package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +1 -0
- package/cjs/pages/SettingsPage/SettingsPage.d.ts +1 -0
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -0
- package/cjs/pages/SettingsPage/SlippageInput.d.ts +1 -0
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +1 -1
- package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.js +1 -0
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +8 -5
- package/cjs/pages/SwapPage/SwapPage.js +5 -1
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
- package/cjs/providers/WalletProvider/WalletProvider.js +2 -2
- package/cjs/stores/index.d.ts +2 -1
- package/cjs/stores/index.js +2 -1
- package/cjs/stores/{route → routes}/index.d.ts +2 -1
- package/cjs/stores/{route → routes}/index.js +2 -1
- package/cjs/stores/{route → routes}/types.d.ts +4 -0
- package/cjs/stores/routes/types.js +2 -0
- package/cjs/stores/{route → routes}/useExecutingRoutesIds.d.ts +0 -0
- package/cjs/stores/{route → routes}/useExecutingRoutesIds.js +2 -2
- package/cjs/stores/{route/useRouteStore.d.ts → routes/useRouteExecutionStore.d.ts} +1 -1
- package/cjs/stores/{route/useRouteStore.js → routes/useRouteExecutionStore.js} +2 -2
- package/cjs/stores/routes/useSelectedRouteStore.d.ts +4 -0
- package/cjs/stores/routes/useSelectedRouteStore.js +12 -0
- package/cjs/stores/{route → routes}/useSetExecutableRoute.d.ts +0 -0
- package/cjs/stores/{route → routes}/useSetExecutableRoute.js +2 -2
- package/cjs/stores/{route → routes}/useSwapHistory.d.ts +0 -0
- package/cjs/stores/{route → routes}/useSwapHistory.js +2 -2
- package/cjs/stores/{route → routes}/utils.d.ts +0 -0
- package/cjs/stores/{route → routes}/utils.js +0 -0
- package/cjs/stores/settings/useSettingsStore.js +1 -1
- package/cjs/types/widget.d.ts +2 -0
- package/cjs/utils/colors.d.ts +1 -1
- package/cjs/utils/navigationRoutes.js +12 -12
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -0
- package/components/AppContainer.d.ts +4 -5
- package/components/AppContainer.js +29 -28
- package/components/Card/Card.d.ts +1 -0
- package/components/Card/Card.js +13 -9
- package/components/ChainSelect/ChainSelect.d.ts +1 -0
- package/components/ChainSelect/ChainSelect.js +1 -1
- package/components/ChainSelect/ChainSelect.style.d.ts +1 -0
- package/components/ChainSelect/ChainSelect.style.js +2 -2
- package/components/ChainSelect/useChainSelect.js +1 -1
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +6 -2
- package/components/Header/Header.d.ts +2 -1
- package/components/Header/Header.js +1 -1
- package/components/Header/Header.style.js +4 -3
- package/components/Header/NavigationHeader.js +4 -1
- package/components/Header/WalletHeader.js +2 -2
- package/components/PoweredBy/PoweredBy.js +7 -0
- package/components/SendToWallet/SendToWallet.js +8 -11
- package/components/SendToWallet/SendToWalletButton.d.ts +2 -0
- package/components/SendToWallet/SendToWalletButton.js +20 -0
- package/components/SendToWallet/index.d.ts +1 -0
- package/components/SendToWallet/index.js +1 -0
- package/components/SendToWallet/store.d.ts +4 -0
- package/components/SendToWallet/store.js +10 -0
- package/components/SendToWallet/types.d.ts +6 -0
- package/{stores/route → components/SendToWallet}/types.js +0 -0
- package/components/Step/CircularProgress.d.ts +1 -0
- package/components/StepActions/StepActions.style.js +1 -1
- package/components/SwapButton/ButtonTooltip.d.ts +1 -0
- package/components/SwapButton/SwapButton.d.ts +1 -1
- package/components/SwapButton/SwapButton.js +4 -3
- package/components/SwapInput/SwapInputAdornment.d.ts +1 -0
- package/components/SwapRouteCard/SwapRouteCard.d.ts +2 -1
- package/components/SwapRouteCard/SwapRouteCard.js +19 -16
- package/components/SwapRouteCard/SwapRouteCard.style.d.ts +30 -0
- package/components/SwapRouteCard/SwapRouteCard.style.js +17 -4
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -12
- package/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +1 -3
- package/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -13
- package/components/SwapRouteCard/types.d.ts +6 -2
- package/{pages/MainPage → components/SwapRoutes}/SwapRoutes.d.ts +0 -0
- package/components/SwapRoutes/SwapRoutes.js +47 -0
- package/components/SwapRoutes/SwapRoutes.style.d.ts +43 -0
- package/components/SwapRoutes/SwapRoutes.style.js +44 -0
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -0
- package/components/SwapRoutes/SwapRoutesExpanded.js +34 -0
- package/components/SwapRoutes/index.d.ts +2 -0
- package/components/SwapRoutes/index.js +2 -0
- package/components/Token/Token.d.ts +2 -1
- package/components/Token/Token.js +11 -7
- package/components/Token/Token.style.js +2 -0
- package/config/theme.js +20 -24
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useChains.js +1 -1
- package/hooks/useNavigateBack.js +13 -6
- package/hooks/useRouteExecution.js +5 -5
- package/package.json +11 -11
- package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -0
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/pages/MainPage/MainPage.js +4 -2
- package/pages/MainPage/MainSwapButton.js +4 -3
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
- package/pages/SelectTokenPage/SelectTokenPage.js +4 -3
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
- package/pages/SettingsPage/AdvancedPreferences.d.ts +1 -0
- package/pages/SettingsPage/GasPriceSelect.d.ts +1 -0
- package/pages/SettingsPage/SettingsPage.d.ts +1 -0
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -0
- package/pages/SettingsPage/SlippageInput.d.ts +1 -0
- package/pages/SwapDetailsPage/SwapDetailsPage.js +2 -2
- package/pages/SwapHistoryPage/SwapHistoryEmpty.js +1 -0
- package/pages/SwapHistoryPage/SwapHistoryPage.js +8 -5
- package/pages/SwapPage/SwapPage.js +5 -1
- package/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
- package/providers/WalletProvider/WalletProvider.js +1 -1
- package/stores/index.d.ts +2 -1
- package/stores/index.js +2 -1
- package/stores/{route → routes}/index.d.ts +2 -1
- package/stores/{route → routes}/index.js +2 -1
- package/stores/{route → routes}/types.d.ts +4 -0
- package/stores/routes/types.js +1 -0
- package/stores/{route → routes}/useExecutingRoutesIds.d.ts +0 -0
- package/stores/{route → routes}/useExecutingRoutesIds.js +2 -2
- package/stores/{route/useRouteStore.d.ts → routes/useRouteExecutionStore.d.ts} +1 -1
- package/stores/{route/useRouteStore.js → routes/useRouteExecutionStore.js} +1 -1
- package/stores/routes/useSelectedRouteStore.d.ts +4 -0
- package/stores/routes/useSelectedRouteStore.js +9 -0
- package/stores/{route → routes}/useSetExecutableRoute.d.ts +0 -0
- package/stores/routes/useSetExecutableRoute.js +4 -0
- package/stores/{route → routes}/useSwapHistory.d.ts +0 -0
- package/stores/{route → routes}/useSwapHistory.js +2 -2
- package/stores/{route → routes}/utils.d.ts +0 -0
- package/stores/{route → routes}/utils.js +0 -0
- package/stores/settings/useSettingsStore.js +1 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/widget.d.ts +2 -0
- package/utils/colors.d.ts +1 -1
- package/utils/navigationRoutes.js +12 -12
- package/cjs/pages/MainPage/SwapRoutes.js +0 -43
- package/cjs/pages/MainPage/SwapRoutes.style.d.ts +0 -11
- package/cjs/pages/MainPage/SwapRoutes.style.js +0 -16
- package/pages/MainPage/SwapRoutes.js +0 -39
- package/pages/MainPage/SwapRoutes.style.d.ts +0 -11
- package/pages/MainPage/SwapRoutes.style.js +0 -13
- package/stores/route/useSetExecutableRoute.js +0 -4
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
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
|
+
children?: import("react").ReactNode;
|
|
5
|
+
direction?: import("@mui/system").ResponsiveStyleValue<"row" | "column" | "column-reverse" | "row-reverse"> | undefined;
|
|
6
|
+
spacing?: import("@mui/system").ResponsiveStyleValue<string | number> | undefined;
|
|
7
|
+
divider?: import("react").ReactNode;
|
|
8
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
9
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
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") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
12
|
+
export declare const CollapseContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
13
|
+
children?: import("react").ReactNode;
|
|
14
|
+
component?: import("react").ElementType<any> | undefined;
|
|
15
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
16
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
17
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
18
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
19
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "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>, {}, {}>;
|
|
20
|
+
export declare const ScrollableContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
21
|
+
children?: import("react").ReactNode;
|
|
22
|
+
component?: import("react").ElementType<any> | undefined;
|
|
23
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
24
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
25
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
26
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
27
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "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>, {}, {}>;
|
|
28
|
+
export declare const Container: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
29
|
+
children?: import("react").ReactNode;
|
|
30
|
+
component?: import("react").ElementType<any> | undefined;
|
|
31
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
32
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
33
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
34
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
35
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "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 Header: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
37
|
+
children?: import("react").ReactNode;
|
|
38
|
+
component?: import("react").ElementType<any> | undefined;
|
|
39
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
40
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
41
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
42
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
43
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "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>, {}, {}>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Header = exports.Container = exports.ScrollableContainer = exports.CollapseContainer = exports.Stack = void 0;
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const AppContainer_1 = require("../AppContainer");
|
|
7
|
+
exports.Stack = (0, styles_1.styled)(material_1.Stack)(({ theme }) => ({
|
|
8
|
+
alignItems: 'stretch',
|
|
9
|
+
display: 'flex',
|
|
10
|
+
flex: 1,
|
|
11
|
+
flexWrap: 'nowrap',
|
|
12
|
+
overflow: 'hidden',
|
|
13
|
+
borderRight: `solid ${theme.palette.mode === 'light'
|
|
14
|
+
? theme.palette.grey[300]
|
|
15
|
+
: theme.palette.grey[800]}`,
|
|
16
|
+
width: 'calc(100% - 48px)',
|
|
17
|
+
}));
|
|
18
|
+
exports.CollapseContainer = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
|
|
19
|
+
height: AppContainer_1.maxHeight,
|
|
20
|
+
}));
|
|
21
|
+
exports.ScrollableContainer = (0, styles_1.styled)(material_1.Box)({
|
|
22
|
+
overflowY: 'auto',
|
|
23
|
+
height: '100%',
|
|
24
|
+
flex: 1,
|
|
25
|
+
display: 'flex',
|
|
26
|
+
flexDirection: 'column',
|
|
27
|
+
});
|
|
28
|
+
exports.Container = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
|
|
29
|
+
backgroundColor: theme.palette.background.default,
|
|
30
|
+
overflow: 'auto',
|
|
31
|
+
width: 436,
|
|
32
|
+
maxHeight: AppContainer_1.maxHeight,
|
|
33
|
+
marginLeft: theme.spacing(3),
|
|
34
|
+
display: 'flex',
|
|
35
|
+
flexDirection: 'column',
|
|
36
|
+
}));
|
|
37
|
+
exports.Header = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
|
|
38
|
+
backgroundColor: (0, styles_1.alpha)(theme.palette.background.default, 0.84),
|
|
39
|
+
backdropFilter: 'blur(12px)',
|
|
40
|
+
display: 'flex',
|
|
41
|
+
justifyContent: 'space-between',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
padding: theme.spacing(1.5, 3),
|
|
44
|
+
position: 'sticky',
|
|
45
|
+
top: 0,
|
|
46
|
+
zIndex: 1200,
|
|
47
|
+
}));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwapRoutesExpanded = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const react_i18next_1 = require("react-i18next");
|
|
7
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const providers_1 = require("../../providers");
|
|
10
|
+
const stores_1 = require("../../stores");
|
|
11
|
+
const utils_1 = require("../../utils");
|
|
12
|
+
const ProgressToNextUpdate_1 = require("../ProgressToNextUpdate");
|
|
13
|
+
const SwapRouteCard_1 = require("../SwapRouteCard");
|
|
14
|
+
const SwapRoutes_style_1 = require("./SwapRoutes.style");
|
|
15
|
+
const SwapRoutesExpanded = () => {
|
|
16
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
17
|
+
const { containerStyle } = (0, providers_1.useWidgetConfig)();
|
|
18
|
+
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
19
|
+
const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = (0, hooks_1.useSwapRoutes)();
|
|
20
|
+
const setExecutableRoute = (0, stores_1.useSetExecutableRoute)();
|
|
21
|
+
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
22
|
+
const cleanedPathname = pathname.endsWith('/')
|
|
23
|
+
? pathname.slice(0, -1)
|
|
24
|
+
: pathname;
|
|
25
|
+
const path = cleanedPathname.substring(cleanedPathname.lastIndexOf('/') + 1);
|
|
26
|
+
const hasPath = utils_1.navigationRoutesValues.includes(path);
|
|
27
|
+
const handleRouteClick = (route) => {
|
|
28
|
+
setExecutableRoute(route);
|
|
29
|
+
navigate(utils_1.navigationRoutes.swapExecution, {
|
|
30
|
+
state: { routeId: route.id },
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const currentRoute = routes === null || routes === void 0 ? void 0 : routes[0];
|
|
34
|
+
const expanded = Boolean(currentRoute || isLoading || isFetching || isFetched) && !hasPath;
|
|
35
|
+
const routeNotFound = !currentRoute && !isLoading && !isFetching && expanded;
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(SwapRoutes_style_1.CollapseContainer, { children: (0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ appear: true, timeout: 225, in: expanded, orientation: "horizontal" }, { children: (0, jsx_runtime_1.jsx)(material_1.Grow, Object.assign({ appear: true, timeout: 225, in: expanded }, { children: (0, jsx_runtime_1.jsx)(SwapRoutes_style_1.Container, Object.assign({ sx: containerStyle }, { children: (0, jsx_runtime_1.jsxs)(SwapRoutes_style_1.ScrollableContainer, { children: [(0, jsx_runtime_1.jsxs)(SwapRoutes_style_1.Header, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 18, fontWeight: "700", flex: 1, noWrap: true }, { children: t('swap.routes') })), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 } })] }), (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ direction: "column", spacing: 2, flex: 1, paddingX: 3, paddingBottom: 3 }, { children: routeNotFound ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { variant: "extended" }, index)))) : (routes === null || routes === void 0 ? void 0 : routes.map((route, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0, variant: "extended" }, route.id)))) }))] }) })) })) })) }));
|
|
37
|
+
};
|
|
38
|
+
exports.SwapRoutesExpanded = SwapRoutesExpanded;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./SwapRoutes"), exports);
|
|
18
|
+
__exportStar(require("./SwapRoutesExpanded"), exports);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { TokenAmount } from '@lifi/sdk';
|
|
2
|
+
import type { Step, TokenAmount } from '@lifi/sdk';
|
|
3
3
|
import type { BoxProps } from '@mui/material';
|
|
4
4
|
export declare const Token: React.FC<{
|
|
5
5
|
token: TokenAmount;
|
|
6
6
|
connected?: boolean;
|
|
7
|
+
step?: Step;
|
|
7
8
|
} & BoxProps>;
|
|
@@ -17,19 +17,23 @@ const material_1 = require("@mui/material");
|
|
|
17
17
|
const react_i18next_1 = require("react-i18next");
|
|
18
18
|
const hooks_1 = require("../../hooks");
|
|
19
19
|
const utils_1 = require("../../utils");
|
|
20
|
+
const SmallAvatar_1 = require("../SmallAvatar");
|
|
20
21
|
const TextFitter_1 = require("../TextFitter");
|
|
21
22
|
const TokenAvatar_1 = require("../TokenAvatar");
|
|
22
23
|
const Token_style_1 = require("./Token.style");
|
|
23
24
|
const Token = (_a) => {
|
|
24
25
|
var _b;
|
|
25
|
-
var { token, connected } = _a, other = __rest(_a, ["token", "connected"]);
|
|
26
|
+
var { token, connected, step } = _a, other = __rest(_a, ["token", "connected", "step"]);
|
|
26
27
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
27
28
|
const { getChainById } = (0, hooks_1.useChains)();
|
|
28
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ flex: 1 }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", flex: 1 }, { children: [(0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: token, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(TextFitter_1.TextFitter, Object.assign({ height:
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ flex: 1 }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", flex: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: token, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(TextFitter_1.TextFitter, Object.assign({ height: 30, textStyle: {
|
|
29
30
|
fontWeight: 700,
|
|
30
|
-
} }, { children: (0, utils_1.formatTokenAmount)(token.amount, token.decimals) }))] })), (0, jsx_runtime_1.jsx)(Token_style_1.TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
} }, { children: (0, utils_1.formatTokenAmount)(token.amount, token.decimals) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex" }, { children: [(0, jsx_runtime_1.jsx)(Token_style_1.TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
|
|
32
|
+
tokenSymbol: token.symbol,
|
|
33
|
+
chainName: (_b = getChainById(token.chainId)) === null || _b === void 0 ? void 0 : _b.name,
|
|
34
|
+
}) })), step ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "flex-end", height: 12, mt: 0.5 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12, lineHeight: 1, fontWeight: 500, color: "text.secondary", px: 1 }, { children: "\u2022" })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ pr: 0.75 }, { children: (0, jsx_runtime_1.jsx)(SmallAvatar_1.SmallAvatar, Object.assign({ src: step.toolDetails.logoURI, alt: step.toolDetails.name, sx: {
|
|
35
|
+
border: 0,
|
|
36
|
+
marginBottom: -0.25,
|
|
37
|
+
} }, { children: step.toolDetails.name[0] })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12, lineHeight: 1, fontWeight: 500, color: "text.secondary" }, { children: step.toolDetails.name }))] }))) : null] }))] })));
|
|
34
38
|
};
|
|
35
39
|
exports.Token = Token;
|
|
@@ -21,6 +21,8 @@ exports.TextSecondary = (0, styles_1.styled)(material_1.Typography, {
|
|
|
21
21
|
padding: connected
|
|
22
22
|
? theme.spacing(0, 0, 0, 3.875)
|
|
23
23
|
: theme.spacing(0, 0, 0, 0),
|
|
24
|
+
display: 'flex',
|
|
25
|
+
alignItems: 'flex-start',
|
|
24
26
|
}));
|
|
25
27
|
exports.TokenDivider = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
|
|
26
28
|
height: 12,
|
package/cjs/config/theme.js
CHANGED
|
@@ -28,6 +28,17 @@ const palette = {
|
|
|
28
28
|
main: '#297EFF',
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
|
+
const paletteLight = {
|
|
32
|
+
text: {
|
|
33
|
+
primary: '#000000',
|
|
34
|
+
secondary: '#747474',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
const paletteDark = {
|
|
38
|
+
background: {
|
|
39
|
+
paper: '#212121',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
31
42
|
const shape = {
|
|
32
43
|
borderRadius: 12,
|
|
33
44
|
borderRadiusSecondary: 6,
|
|
@@ -47,27 +58,7 @@ const createTheme = (mode, theme = {}) => {
|
|
|
47
58
|
main: (_m = (_l = (_k = theme.palette) === null || _k === void 0 ? void 0 : _k.secondary) === null || _l === void 0 ? void 0 : _l.main) !== null && _m !== void 0 ? _m : palette.secondary.main,
|
|
48
59
|
light: (0, styles_1.lighten)((_q = (_p = (_o = theme.palette) === null || _o === void 0 ? void 0 : _o.secondary) === null || _p === void 0 ? void 0 : _p.main) !== null && _q !== void 0 ? _q : palette.secondary.main, 0.5),
|
|
49
60
|
dark: (0, styles_1.darken)((_t = (_s = (_r = theme.palette) === null || _r === void 0 ? void 0 : _r.secondary) === null || _s === void 0 ? void 0 : _s.main) !== null && _t !== void 0 ? _t : palette.secondary.main, 0.2),
|
|
50
|
-
} }), (mode === 'light'
|
|
51
|
-
? {
|
|
52
|
-
text: {
|
|
53
|
-
primary: '#000',
|
|
54
|
-
secondary: '#52575b',
|
|
55
|
-
},
|
|
56
|
-
grey: {
|
|
57
|
-
100: '#F4F5F6',
|
|
58
|
-
200: '#EFF1F2',
|
|
59
|
-
300: '#E3E7E9',
|
|
60
|
-
400: '#C6C9CD',
|
|
61
|
-
500: '#AEB3B7',
|
|
62
|
-
600: '#798086',
|
|
63
|
-
700: '#57595C',
|
|
64
|
-
},
|
|
65
|
-
}
|
|
66
|
-
: {
|
|
67
|
-
background: {
|
|
68
|
-
paper: '#212121',
|
|
69
|
-
},
|
|
70
|
-
})),
|
|
61
|
+
} }), (mode === 'light' ? paletteLight : paletteDark)),
|
|
71
62
|
shape: Object.assign(Object.assign({}, shape), theme.shape),
|
|
72
63
|
breakpoints: {
|
|
73
64
|
values: {
|
|
@@ -99,6 +90,11 @@ const createTheme = (mode, theme = {}) => {
|
|
|
99
90
|
cursor: 'not-allowed',
|
|
100
91
|
pointerEvents: 'auto',
|
|
101
92
|
},
|
|
93
|
+
}, text: {
|
|
94
|
+
backgroundColor: (0, styles_1.alpha)(primaryMainColor, 0.08),
|
|
95
|
+
'&:hover': {
|
|
96
|
+
backgroundColor: (0, styles_1.alpha)(primaryMainColor, 0.12),
|
|
97
|
+
},
|
|
102
98
|
}, contained: {
|
|
103
99
|
'&:hover': {
|
|
104
100
|
color: (0, styles_1.getContrastRatio)(colors_1.common.white, primaryMainColor) >= 3
|
|
@@ -121,10 +117,10 @@ const createTheme = (mode, theme = {}) => {
|
|
|
121
117
|
},
|
|
122
118
|
},
|
|
123
119
|
text: {
|
|
124
|
-
|
|
120
|
+
backgroundColor: paletteDark.background.paper,
|
|
121
|
+
color: colors_1.common.white,
|
|
125
122
|
'&:hover': {
|
|
126
|
-
backgroundColor: (0, styles_1.
|
|
127
|
-
borderColor: primaryLightColor,
|
|
123
|
+
backgroundColor: (0, styles_1.lighten)(paletteDark.background.paper, 0.02),
|
|
128
124
|
},
|
|
129
125
|
},
|
|
130
126
|
}
|
package/cjs/config/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "1.
|
|
2
|
+
export declare const version = "1.18.0";
|
package/cjs/config/version.js
CHANGED
package/cjs/hooks/useChains.js
CHANGED
|
@@ -14,7 +14,7 @@ const react_query_1 = require("@tanstack/react-query");
|
|
|
14
14
|
const react_1 = require("react");
|
|
15
15
|
const react_hook_form_1 = require("react-hook-form");
|
|
16
16
|
const providers_1 = require("../providers");
|
|
17
|
-
const
|
|
17
|
+
const stores_1 = require("../stores");
|
|
18
18
|
const useChains = () => {
|
|
19
19
|
const { disabledChains, chains } = (0, providers_1.useWidgetConfig)();
|
|
20
20
|
const lifi = (0, providers_1.useLiFi)();
|
|
@@ -22,7 +22,7 @@ const useChains = () => {
|
|
|
22
22
|
const { data, isLoading } = (0, react_query_1.useQuery)(['chains'], () => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
23
|
const availableChains = yield lifi.getChains();
|
|
24
24
|
const filteredChains = availableChains.filter((chain) => (0, providers_1.isItemAllowed)(chain.id, chains, disabledChains));
|
|
25
|
-
const chainOrder =
|
|
25
|
+
const chainOrder = stores_1.useChainOrderStore
|
|
26
26
|
.getState()
|
|
27
27
|
.initializeChains(filteredChains.map((chain) => chain.id));
|
|
28
28
|
const [fromChainValue, toChainValue] = getValues([
|
|
@@ -6,12 +6,19 @@ const react_router_dom_1 = require("react-router-dom");
|
|
|
6
6
|
const useNavigateBack = () => {
|
|
7
7
|
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
8
8
|
const navigateBack = (0, react_1.useCallback)(() => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
// https://github.com/remix-run/react-router/pull/9112
|
|
10
|
+
//
|
|
11
|
+
// if (window.history.length > 2) {
|
|
12
|
+
navigate(-1);
|
|
13
|
+
// } else {
|
|
14
|
+
// navigate(
|
|
15
|
+
// window.location.pathname.substring(
|
|
16
|
+
// 0,
|
|
17
|
+
// window.location.pathname.lastIndexOf('/'),
|
|
18
|
+
// ) || '/',
|
|
19
|
+
// { replace: true },
|
|
20
|
+
// );
|
|
21
|
+
// }
|
|
15
22
|
}, [navigate]);
|
|
16
23
|
return { navigateBack, navigate };
|
|
17
24
|
};
|
|
@@ -23,10 +23,10 @@ const useRouteExecution = (routeId, executeInBackground) => {
|
|
|
23
23
|
const { account, switchChain } = (0, providers_1.useWallet)();
|
|
24
24
|
const resumedAfterMount = (0, react_1.useRef)(false);
|
|
25
25
|
const emitter = (0, useWidgetEvents_1.useWidgetEvents)();
|
|
26
|
-
const routeExecution = (0, stores_1.
|
|
27
|
-
const [updateRoute, restartRoute, deleteRoute] = (0, stores_1.
|
|
26
|
+
const routeExecution = (0, stores_1.useRouteExecutionStore)((state) => state.routes[routeId]);
|
|
27
|
+
const [updateRoute, restartRoute, deleteRoute] = (0, stores_1.useRouteExecutionStore)((state) => [state.updateRoute, state.restartRoute, state.deleteRoute], shallow_1.default);
|
|
28
28
|
const updateCallback = (updatedRoute) => {
|
|
29
|
-
const routeExecution = stores_1.
|
|
29
|
+
const routeExecution = stores_1.useRouteExecutionStore.getState().routes[updatedRoute.id];
|
|
30
30
|
if (!routeExecution) {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
@@ -147,7 +147,7 @@ const useRouteExecution = (routeId, executeInBackground) => {
|
|
|
147
147
|
(0, react_1.useEffect)(() => {
|
|
148
148
|
return () => {
|
|
149
149
|
var _a;
|
|
150
|
-
const route = (_a = stores_1.
|
|
150
|
+
const route = (_a = stores_1.useRouteExecutionStore.getState().routes[routeId]) === null || _a === void 0 ? void 0 : _a.route;
|
|
151
151
|
if (!route || !(0, stores_1.isRouteActive)(route)) {
|
|
152
152
|
return;
|
|
153
153
|
}
|
|
@@ -13,6 +13,7 @@ const ActiveSwapsEmpty = () => {
|
|
|
13
13
|
flexDirection: 'column',
|
|
14
14
|
alignItems: 'center',
|
|
15
15
|
justifyContent: 'center',
|
|
16
|
+
paddingY: 12,
|
|
16
17
|
} }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 48 }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.SwapHoriz, { fontSize: "inherit" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 18, fontWeight: 700 }, { children: t('swap.info.title.emptyActiveSwaps') })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.secondary", textAlign: "center", mt: 2 }, { children: t('swap.info.message.emptyActiveSwaps') }))] })));
|
|
17
18
|
};
|
|
18
19
|
exports.ActiveSwapsEmpty = ActiveSwapsEmpty;
|
|
@@ -4,12 +4,14 @@ exports.MainPage = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const ActiveSwaps_1 = require("../../components/ActiveSwaps");
|
|
7
|
+
const GasSufficiencyMessage_1 = require("../../components/GasSufficiencyMessage");
|
|
7
8
|
const SelectChainAndToken_1 = require("../../components/SelectChainAndToken");
|
|
9
|
+
const SendToWallet_1 = require("../../components/SendToWallet");
|
|
8
10
|
const SwapInput_1 = require("../../components/SwapInput");
|
|
11
|
+
const SwapRoutes_1 = require("../../components/SwapRoutes");
|
|
9
12
|
const MainPage_style_1 = require("./MainPage.style");
|
|
10
13
|
const MainSwapButton_1 = require("./MainSwapButton");
|
|
11
|
-
const SwapRoutes_1 = require("./SwapRoutes");
|
|
12
14
|
const MainPage = () => {
|
|
13
|
-
return ((0, jsx_runtime_1.jsxs)(MainPage_style_1.FormContainer, Object.assign({ disableGutters: true }, { children: [(0, jsx_runtime_1.jsx)(ActiveSwaps_1.ActiveSwaps, { mx: 3, mt: 1, mb: 2 }), (0, jsx_runtime_1.jsx)(SelectChainAndToken_1.SelectChainAndToken, { mt: 1, mx: 3, mb: 3 }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mx: 3, mb: 3 }, { children: (0, jsx_runtime_1.jsx)(SwapInput_1.SwapInput, { formType: "from" }) })), (0, jsx_runtime_1.jsx)(SwapRoutes_1.SwapRoutes, { mx: 3, mb: 3 }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mx: 3, mb: 1 }, { children: (0, jsx_runtime_1.jsx)(MainSwapButton_1.MainSwapButton, {}) }))] })));
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)(MainPage_style_1.FormContainer, Object.assign({ disableGutters: true }, { children: [(0, jsx_runtime_1.jsx)(ActiveSwaps_1.ActiveSwaps, { mx: 3, mt: 1, mb: 2 }), (0, jsx_runtime_1.jsx)(SelectChainAndToken_1.SelectChainAndToken, { mt: 1, mx: 3, mb: 3 }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mx: 3, mb: 3 }, { children: (0, jsx_runtime_1.jsx)(SwapInput_1.SwapInput, { formType: "from" }) })), (0, jsx_runtime_1.jsx)(SwapRoutes_1.SwapRoutes, { mx: 3, mb: 3 }), (0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, { mx: 3, mb: 3 }), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ mx: 3, mb: 1 }, { children: [(0, jsx_runtime_1.jsx)(SendToWallet_1.SendToWallet, { mb: 3 }), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: { display: 'flex' } }, { children: [(0, jsx_runtime_1.jsx)(MainSwapButton_1.MainSwapButton, {}), (0, jsx_runtime_1.jsx)(SendToWallet_1.SendToWalletButton, {})] }))] }))] })));
|
|
14
16
|
};
|
|
15
17
|
exports.MainPage = MainPage;
|
|
@@ -11,13 +11,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.MainSwapButton = void 0;
|
|
13
13
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
14
|
+
const react_1 = require("react");
|
|
14
15
|
const react_hook_form_1 = require("react-hook-form");
|
|
15
16
|
const react_router_dom_1 = require("react-router-dom");
|
|
16
17
|
const SwapButton_1 = require("../../components/SwapButton");
|
|
17
18
|
const hooks_1 = require("../../hooks");
|
|
18
19
|
const stores_1 = require("../../stores");
|
|
19
20
|
const utils_1 = require("../../utils");
|
|
20
|
-
|
|
21
|
+
exports.MainSwapButton = (0, react_1.forwardRef)((_, ref) => {
|
|
21
22
|
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
22
23
|
const { isValid, isValidating } = (0, react_hook_form_1.useFormState)();
|
|
23
24
|
const setExecutableRoute = (0, stores_1.useSetExecutableRoute)();
|
|
@@ -31,6 +32,5 @@ const MainSwapButton = () => {
|
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
});
|
|
34
|
-
return ((0, jsx_runtime_1.jsx)(SwapButton_1.SwapButton, { onClick: handleClick, currentRoute: currentRoute, disable: isLoading || isFetching || isValidating || !isValid }));
|
|
35
|
-
};
|
|
36
|
-
exports.MainSwapButton = MainSwapButton;
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(SwapButton_1.SwapButton, { onClick: handleClick, currentRoute: currentRoute, disable: isLoading || isFetching || isValidating || !isValid, ref: ref }));
|
|
36
|
+
});
|
|
@@ -8,16 +8,17 @@ const ChainSelect_1 = require("../../components/ChainSelect");
|
|
|
8
8
|
const TokenList_1 = require("../../components/TokenList");
|
|
9
9
|
const hooks_1 = require("../../hooks");
|
|
10
10
|
const SearchTokenInput_1 = require("./SearchTokenInput");
|
|
11
|
+
const minTokenListHeight = 330;
|
|
11
12
|
const SelectTokenPage = ({ formType }) => {
|
|
12
13
|
(0, hooks_1.useScrollableOverflowHidden)();
|
|
13
14
|
const { navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
14
15
|
const headerRef = (0, react_1.useRef)(null);
|
|
15
16
|
const contentHeight = (0, hooks_1.useContentHeight)();
|
|
16
|
-
const [
|
|
17
|
+
const [tokenListHeight, setTokenListHeight] = (0, react_1.useState)(0);
|
|
17
18
|
(0, react_1.useLayoutEffect)(() => {
|
|
18
19
|
var _a, _b;
|
|
19
|
-
|
|
20
|
+
setTokenListHeight(Math.max(contentHeight - ((_b = (_a = headerRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0), minTokenListHeight));
|
|
20
21
|
}, [contentHeight]);
|
|
21
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Container, Object.assign({ disableGutters: true }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ pt: 1, pb: 2, px: 3, ref: headerRef }, { children: [(0, jsx_runtime_1.jsx)(ChainSelect_1.ChainSelect, { formType: formType }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsx)(SearchTokenInput_1.SearchTokenInput, {}) }))] })), (0, jsx_runtime_1.jsx)(TokenList_1.TokenList, { height:
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Container, Object.assign({ disableGutters: true }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ pt: 1, pb: 2, px: 3, ref: headerRef }, { children: [(0, jsx_runtime_1.jsx)(ChainSelect_1.ChainSelect, { formType: formType }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsx)(SearchTokenInput_1.SearchTokenInput, {}) }))] })), (0, jsx_runtime_1.jsx)(TokenList_1.TokenList, { height: tokenListHeight, onClick: navigateBack, formType: formType })] })));
|
|
22
23
|
};
|
|
23
24
|
exports.SelectTokenPage = SelectTokenPage;
|
|
@@ -30,7 +30,7 @@ const SwapDetailsPage = () => {
|
|
|
30
30
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
31
31
|
const { navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
32
32
|
const { state } = (0, react_router_dom_1.useLocation)();
|
|
33
|
-
const [routeExecution, deleteRoute] = (0, stores_1.
|
|
33
|
+
const [routeExecution, deleteRoute] = (0, stores_1.useRouteExecutionStore)((store) => [store.routes[state === null || state === void 0 ? void 0 : state.routeId], store.deleteRoute], shallow_1.default);
|
|
34
34
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
35
35
|
const toggleDialog = (0, react_1.useCallback)(() => {
|
|
36
36
|
setOpen((open) => !open);
|
|
@@ -13,6 +13,7 @@ const SwapHistoryEmpty = () => {
|
|
|
13
13
|
flexDirection: 'column',
|
|
14
14
|
alignItems: 'center',
|
|
15
15
|
justifyContent: 'center',
|
|
16
|
+
paddingY: 12,
|
|
16
17
|
} }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 48 }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.History, { fontSize: "inherit" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 18, fontWeight: 700 }, { children: t('swap.info.title.emptySwapHistory') })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.secondary", textAlign: "center", mt: 2 }, { children: t('swap.info.message.emptySwapHistory') }))] })));
|
|
17
18
|
};
|
|
18
19
|
exports.SwapHistoryEmpty = SwapHistoryEmpty;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SwapHistoryPage = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/* eslint-disable consistent-return */
|
|
5
6
|
const icons_material_1 = require("@mui/icons-material");
|
|
6
7
|
const material_1 = require("@mui/material");
|
|
7
8
|
const react_1 = require("react");
|
|
@@ -10,21 +11,23 @@ const Dialog_1 = require("../../components/Dialog");
|
|
|
10
11
|
const Header_1 = require("../../components/Header");
|
|
11
12
|
const providers_1 = require("../../providers");
|
|
12
13
|
const stores_1 = require("../../stores");
|
|
13
|
-
const
|
|
14
|
+
const routes_1 = require("../../stores/routes");
|
|
14
15
|
const SwapHistoryEmpty_1 = require("./SwapHistoryEmpty");
|
|
15
16
|
const SwapHistoryItem_1 = require("./SwapHistoryItem");
|
|
16
17
|
const SwapHistoryPage = () => {
|
|
17
18
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
18
19
|
const { account } = (0, providers_1.useWallet)();
|
|
19
|
-
const swaps = (0,
|
|
20
|
-
const deleteRoutes = (0, stores_1.
|
|
20
|
+
const swaps = (0, routes_1.useSwapHistory)(account.address);
|
|
21
|
+
const deleteRoutes = (0, stores_1.useRouteExecutionStore)((store) => store.deleteRoutes);
|
|
21
22
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
22
23
|
const toggleDialog = (0, react_1.useCallback)(() => {
|
|
23
24
|
setOpen((open) => !open);
|
|
24
25
|
}, []);
|
|
25
26
|
(0, react_1.useEffect)(() => {
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
if (swaps.length) {
|
|
28
|
+
return Header_1.useHeaderActionStore.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: toggleDialog }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.DeleteOutline, {}) })));
|
|
29
|
+
}
|
|
30
|
+
}, [swaps.length, toggleDialog]);
|
|
28
31
|
if (!swaps.length) {
|
|
29
32
|
return (0, jsx_runtime_1.jsx)(SwapHistoryEmpty_1.SwapHistoryEmpty, {});
|
|
30
33
|
}
|
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SwapPage = void 0;
|
|
13
13
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
14
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
14
15
|
const material_1 = require("@mui/material");
|
|
15
16
|
const react_1 = require("react");
|
|
16
17
|
const react_hook_form_1 = require("react-hook-form");
|
|
@@ -57,6 +58,9 @@ const SwapPage = () => {
|
|
|
57
58
|
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Step_1.Step, { step: step, fromToken: index === 0
|
|
58
59
|
? Object.assign(Object.assign({}, step.action.fromToken), { amount: step.action.fromAmount }) : undefined, toToken: index === steps.length - 1
|
|
59
60
|
? Object.assign(Object.assign({}, step.action.toToken), { amount: (_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toAmount) !== null && _b !== void 0 ? _b : step.estimate.toAmount }) : undefined }), steps.length > 1 && index !== steps.length - 1 ? ((0, jsx_runtime_1.jsx)(StepDivider_1.StepDivider, {})) : null] }, step.id));
|
|
60
|
-
}), status === 'idle' ? ((0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, { route: route, mt: 2 })) : null, status === 'idle' || status === 'error' ? ((0, jsx_runtime_1.
|
|
61
|
+
}), status === 'idle' ? ((0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, { route: route, mt: 2 })) : null, status === 'idle' || status === 'error' ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ mt: 2, display: "flex" }, { children: [(0, jsx_runtime_1.jsx)(SwapButton_1.SwapButton, { text: getSwapButtonText(), onClick: handleSwapClick, currentRoute: route, disable: status === 'idle' && (isValidating || !isValid) }), status === 'error' ? ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ onClick: handleRemoveRoute, sx: {
|
|
62
|
+
minWidth: 48,
|
|
63
|
+
marginLeft: 1,
|
|
64
|
+
} }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.Delete, {}) }))) : null] }))) : null, route && status ? ((0, jsx_runtime_1.jsx)(StatusBottomSheet_1.StatusBottomSheet, { status: status, route: route })) : null] }));
|
|
61
65
|
};
|
|
62
66
|
exports.SwapPage = SwapPage;
|
|
@@ -33,6 +33,6 @@ const SwapRoutesPage = () => {
|
|
|
33
33
|
.setAction((0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 }, size: "medium", edge: "end" }));
|
|
34
34
|
}, [dataUpdatedAt, isFetching, refetch, refetchTime]);
|
|
35
35
|
const routeNotFound = !(swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.length) && !isLoading && !isFetching;
|
|
36
|
-
return ((0, jsx_runtime_1.jsx)(SwapRoutesPage_style_1.Stack, Object.assign({ direction: "column", spacing: 2, flex: 1 }, { children: routeNotFound ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, {}, index)))) : (swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.map((route) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { route: route, onClick: () => handleRouteClick(route) }, route.id)))) })));
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(SwapRoutesPage_style_1.Stack, Object.assign({ direction: "column", spacing: 2, flex: 1 }, { children: routeNotFound ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, {}, index)))) : (swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.map((route, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0 }, route.id)))) })));
|
|
37
37
|
};
|
|
38
38
|
exports.SwapRoutesPage = SwapRoutesPage;
|