@lifi/widget 1.28.4 → 1.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AppDrawer.style.d.ts +1 -1
- package/AppProvider.js +2 -2
- package/cjs/AppDrawer.style.d.ts +1 -1
- package/cjs/AppProvider.js +2 -2
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +2 -2
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.js +1 -1
- package/cjs/components/AppContainer.d.ts +2 -2
- package/cjs/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/cjs/components/Card/Card.d.ts +5 -3
- package/cjs/components/Card/Card.js +1 -3
- package/cjs/components/ChainSelect/ChainSelect.d.ts +0 -1
- package/cjs/components/ChainSelect/ChainSelect.style.d.ts +7 -5
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +2 -2
- package/cjs/components/Header/Header.style.d.ts +3 -3
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/cjs/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/cjs/components/SmallAvatar.d.ts +2 -2
- package/cjs/components/Step/CircularProgress.d.ts +0 -1
- package/cjs/components/Step/CircularProgress.style.d.ts +2 -2
- package/cjs/components/Step/StepList.d.ts +0 -1
- package/cjs/components/Step/StepProcess.style.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInput.style.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +1 -1
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +3 -1
- package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +6 -6
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
- package/cjs/components/Switch.js +1 -1
- package/cjs/components/Token/Token.style.d.ts +4 -4
- package/cjs/components/Token/Token.style.js +3 -1
- package/cjs/components/TokenAvatar/TokenAvatar.style.d.ts +4 -4
- package/cjs/components/TokenList/TokenList.style.d.ts +1 -1
- package/cjs/components/TokenList/TokenList.style.js +1 -1
- package/cjs/config/theme.js +22 -27
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useChains.js +2 -3
- package/cjs/hooks/useRouteExecution.js +4 -3
- package/cjs/hooks/useTools.js +2 -1
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
- package/cjs/pages/SelectChainPage/SelectChainPage.style.js +1 -1
- package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js +1 -1
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
- package/cjs/pages/SelectWalletPage/SelectWalletPage.style.js +1 -1
- package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +0 -1
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
- package/cjs/pages/SettingsPage/SettingsPage.d.ts +0 -1
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
- package/cjs/pages/SettingsPage/SlippageInput.d.ts +0 -1
- package/cjs/pages/SwapPage/StatusBottomSheet.style.d.ts +4 -4
- package/cjs/providers/WalletProvider/WalletProvider.js +1 -1
- package/cjs/providers/WidgetProvider/WidgetProvider.js +3 -2
- package/cjs/stores/StoreProvider.d.ts +3 -0
- package/cjs/stores/StoreProvider.js +13 -0
- package/cjs/stores/chains/ChainOrderStore.d.ts +9 -0
- package/cjs/stores/chains/ChainOrderStore.js +44 -0
- package/cjs/stores/chains/createChainOrderStore.d.ts +4 -0
- package/cjs/stores/chains/{useChainOrderStore.js → createChainOrderStore.js} +4 -4
- package/cjs/stores/chains/index.d.ts +2 -1
- package/cjs/stores/chains/index.js +2 -1
- package/cjs/stores/chains/types.d.ts +2 -2
- package/cjs/stores/chains/useChainOrder.js +2 -2
- package/cjs/stores/index.d.ts +1 -0
- package/cjs/stores/index.js +1 -0
- package/cjs/stores/routes/RouteExecutionStore.d.ts +9 -0
- package/cjs/stores/routes/RouteExecutionStore.js +44 -0
- package/cjs/stores/routes/createRouteExecutionStore.d.ts +3 -0
- package/cjs/stores/routes/{useRouteExecutionStore.js → createRouteExecutionStore.js} +6 -4
- package/cjs/stores/routes/index.d.ts +1 -1
- package/cjs/stores/routes/index.js +1 -1
- package/cjs/stores/routes/types.d.ts +5 -5
- package/cjs/stores/routes/useExecutingRoutesIds.js +2 -2
- package/cjs/stores/routes/useSetExecutableRoute.js +2 -2
- package/cjs/stores/routes/useSwapHistory.js +2 -2
- package/cjs/stores/settings/SettingsStore.d.ts +11 -0
- package/cjs/stores/settings/SettingsStore.js +58 -0
- package/cjs/stores/settings/createSettingsStore.d.ts +5 -0
- package/cjs/stores/settings/{useSettingsStore.js → createSettingsStore.js} +4 -19
- package/cjs/stores/settings/index.d.ts +1 -1
- package/cjs/stores/settings/index.js +1 -1
- package/cjs/stores/settings/types.d.ts +4 -4
- package/cjs/stores/settings/useAppearance.js +2 -2
- package/cjs/stores/settings/useSettings.js +2 -2
- package/cjs/stores/types.d.ts +5 -0
- package/cjs/stores/types.js +2 -0
- package/cjs/types/widget.d.ts +1 -0
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +2 -2
- package/components/ActiveSwaps/ActiveSwaps.style.js +1 -1
- package/components/AppContainer.d.ts +2 -2
- package/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/components/Card/Card.d.ts +5 -3
- package/components/Card/Card.js +1 -3
- package/components/ChainSelect/ChainSelect.d.ts +0 -1
- package/components/ChainSelect/ChainSelect.style.d.ts +7 -5
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +2 -2
- package/components/Header/Header.style.d.ts +3 -3
- package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/components/SmallAvatar.d.ts +2 -2
- package/components/Step/CircularProgress.d.ts +0 -1
- package/components/Step/CircularProgress.style.d.ts +2 -2
- package/components/Step/StepList.d.ts +0 -1
- package/components/Step/StepProcess.style.d.ts +1 -1
- package/components/SwapInput/SwapInput.style.d.ts +1 -1
- package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
- package/components/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
- package/components/SwapRouteCard/SwapRouteCard.style.js +1 -1
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +3 -1
- package/components/SwapRoutes/SwapRoutes.style.d.ts +6 -6
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
- package/components/Switch.js +1 -1
- package/components/Token/Token.style.d.ts +4 -4
- package/components/Token/Token.style.js +4 -2
- package/components/TokenAvatar/TokenAvatar.style.d.ts +4 -4
- package/components/TokenList/TokenList.style.d.ts +1 -1
- package/components/TokenList/TokenList.style.js +1 -1
- package/config/theme.js +22 -27
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useChains.js +3 -4
- package/hooks/useRouteExecution.js +5 -4
- package/hooks/useTools.js +3 -2
- package/package.json +11 -11
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
- package/pages/SelectChainPage/SelectChainPage.style.js +1 -1
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js +1 -1
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
- package/pages/SelectWalletPage/SelectWalletPage.style.js +1 -1
- package/pages/SettingsPage/AdvancedPreferences.d.ts +0 -1
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
- package/pages/SettingsPage/SettingsPage.d.ts +0 -1
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
- package/pages/SettingsPage/SlippageInput.d.ts +0 -1
- package/pages/SwapPage/StatusBottomSheet.style.d.ts +4 -4
- package/providers/WalletProvider/WalletProvider.js +1 -1
- package/providers/WidgetProvider/WidgetProvider.js +4 -3
- package/stores/StoreProvider.d.ts +3 -0
- package/stores/StoreProvider.js +9 -0
- package/stores/chains/ChainOrderStore.d.ts +9 -0
- package/stores/chains/ChainOrderStore.js +38 -0
- package/stores/chains/createChainOrderStore.d.ts +4 -0
- package/stores/chains/{useChainOrderStore.js → createChainOrderStore.js} +2 -3
- package/stores/chains/index.d.ts +2 -1
- package/stores/chains/index.js +2 -1
- package/stores/chains/types.d.ts +2 -2
- package/stores/chains/useChainOrder.js +1 -1
- package/stores/index.d.ts +1 -0
- package/stores/index.js +1 -0
- package/stores/routes/RouteExecutionStore.d.ts +9 -0
- package/stores/routes/RouteExecutionStore.js +38 -0
- package/stores/routes/createRouteExecutionStore.d.ts +3 -0
- package/stores/routes/{useRouteExecutionStore.js → createRouteExecutionStore.js} +4 -3
- package/stores/routes/index.d.ts +1 -1
- package/stores/routes/index.js +1 -1
- package/stores/routes/types.d.ts +5 -5
- package/stores/routes/useExecutingRoutesIds.js +1 -1
- package/stores/routes/useSetExecutableRoute.js +1 -1
- package/stores/routes/useSwapHistory.js +1 -1
- package/stores/settings/SettingsStore.d.ts +11 -0
- package/stores/settings/SettingsStore.js +51 -0
- package/stores/settings/createSettingsStore.d.ts +5 -0
- package/stores/settings/{useSettingsStore.js → createSettingsStore.js} +2 -17
- package/stores/settings/index.d.ts +1 -1
- package/stores/settings/index.js +1 -1
- package/stores/settings/types.d.ts +4 -4
- package/stores/settings/useAppearance.js +1 -1
- package/stores/settings/useSettings.js +1 -1
- package/stores/types.d.ts +5 -0
- package/stores/types.js +1 -0
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/widget.d.ts +1 -0
- package/cjs/stores/chains/useChainOrderStore.d.ts +0 -17
- package/cjs/stores/routes/useRouteExecutionStore.d.ts +0 -16
- package/cjs/stores/settings/useSettingsStore.d.ts +0 -44
- package/stores/chains/useChainOrderStore.d.ts +0 -17
- package/stores/routes/useRouteExecutionStore.d.ts +0 -16
- package/stores/settings/useSettingsStore.d.ts +0 -44
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.1",
|
|
4
4
|
"description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"@lifi/sdk": "^1.7.2",
|
|
47
47
|
"@lifi/wallet-management": "^1.2.4",
|
|
48
48
|
"@mui/icons-material": "^5.11.0",
|
|
49
|
-
"@mui/lab": "^5.0.0-alpha.
|
|
50
|
-
"@mui/material": "^5.11.
|
|
51
|
-
"@sentry/integrations": "^7.
|
|
52
|
-
"@sentry/react": "^7.
|
|
53
|
-
"@sentry/tracing": "^7.
|
|
54
|
-
"@tanstack/react-query": "^4.22.
|
|
55
|
-
"@tanstack/react-virtual": "^3.0.0-beta.
|
|
49
|
+
"@mui/lab": "^5.0.0-alpha.116",
|
|
50
|
+
"@mui/material": "^5.11.5",
|
|
51
|
+
"@sentry/integrations": "^7.31.1",
|
|
52
|
+
"@sentry/react": "^7.31.1",
|
|
53
|
+
"@sentry/tracing": "^7.31.1",
|
|
54
|
+
"@tanstack/react-query": "^4.22.4",
|
|
55
|
+
"@tanstack/react-virtual": "^3.0.0-beta.39",
|
|
56
56
|
"big.js": "^6.2.1",
|
|
57
57
|
"i18next": "^22.4.9",
|
|
58
58
|
"i18next-browser-languagedetector": "^7.0.1",
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
"mitt": "^3.0.0",
|
|
61
61
|
"react": "^18.2.0",
|
|
62
62
|
"react-dom": "^18.2.0",
|
|
63
|
-
"react-hook-form": "^7.
|
|
63
|
+
"react-hook-form": "^7.42.1",
|
|
64
64
|
"react-i18next": "^12.1.4",
|
|
65
|
-
"react-router-dom": "^6.
|
|
65
|
+
"react-router-dom": "^6.7.0",
|
|
66
66
|
"react-timer-hook": "^3.0.5",
|
|
67
67
|
"uuid": "^9.0.0",
|
|
68
|
-
"zustand": "^4.3.
|
|
68
|
+
"zustand": "^4.3.2"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@types/react": "^18.0.0",
|
|
@@ -3,7 +3,7 @@ import { listItemTextClasses } from '@mui/material/ListItemText';
|
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { getContrastAlphaColor } from '../../utils';
|
|
5
5
|
export const ListItemButton = styled(MuiListItemButton)(({ theme }) => ({
|
|
6
|
-
borderRadius: theme.shape.
|
|
6
|
+
borderRadius: theme.shape.borderRadius,
|
|
7
7
|
paddingLeft: theme.spacing(1.5),
|
|
8
8
|
height: 56,
|
|
9
9
|
'&:hover': {
|
|
@@ -3,7 +3,7 @@ import { listItemTextClasses } from '@mui/material/ListItemText';
|
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { getContrastAlphaColor } from '../../utils';
|
|
5
5
|
export const ListItemButton = styled(MuiListItemButton)(({ theme }) => ({
|
|
6
|
-
borderRadius: theme.shape.
|
|
6
|
+
borderRadius: theme.shape.borderRadius,
|
|
7
7
|
paddingLeft: theme.spacing(1.5),
|
|
8
8
|
height: 56,
|
|
9
9
|
'&:hover': {
|
|
@@ -3,7 +3,7 @@ import { listItemTextClasses } from '@mui/material/ListItemText';
|
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { getContrastAlphaColor } from '../../utils';
|
|
5
5
|
export const ListItemButton = styled(MuiListItemButton)(({ theme }) => ({
|
|
6
|
-
borderRadius: theme.shape.
|
|
6
|
+
borderRadius: theme.shape.borderRadius,
|
|
7
7
|
paddingLeft: theme.spacing(1.5),
|
|
8
8
|
height: 56,
|
|
9
9
|
'&:hover': {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const ToggleButton: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").ToggleButtonClasses> | undefined;
|
|
5
|
-
color?: "success" | "warning" | "error" | "
|
|
5
|
+
color?: "success" | "warning" | "error" | "info" | "primary" | "secondary" | "standard" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableFocusRipple?: boolean | undefined;
|
|
8
8
|
fullWidth?: boolean | undefined;
|
|
@@ -7,17 +7,17 @@ export declare const IconContainer: import("@emotion/styled").StyledComponent<im
|
|
|
7
7
|
component?: import("react").ElementType<any> | undefined;
|
|
8
8
|
ref?: import("react").Ref<unknown> | undefined;
|
|
9
9
|
sx?: import("@mui/material").SxProps<Theme> | undefined;
|
|
10
|
-
} &
|
|
10
|
+
} & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
11
11
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
12
|
-
},
|
|
12
|
+
}, "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<Theme>, {}, {}>;
|
|
13
13
|
export declare const IconCircle: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<Theme> & {
|
|
14
14
|
children?: import("react").ReactNode;
|
|
15
15
|
component?: import("react").ElementType<any> | undefined;
|
|
16
16
|
ref?: import("react").Ref<unknown> | undefined;
|
|
17
17
|
sx?: import("@mui/material").SxProps<Theme> | undefined;
|
|
18
|
-
} &
|
|
18
|
+
} & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
19
19
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
20
|
-
},
|
|
20
|
+
}, "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<Theme> & {
|
|
21
21
|
status: StatusColor;
|
|
22
22
|
}, {}, {}>;
|
|
23
23
|
export {};
|
|
@@ -12,7 +12,7 @@ import { addChain as walletAddChain, switchChain as walletSwitchChain, switchCha
|
|
|
12
12
|
import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from 'react';
|
|
13
13
|
import { useWidgetConfig } from '../WidgetProvider';
|
|
14
14
|
const stub = () => {
|
|
15
|
-
throw new Error(
|
|
15
|
+
throw new Error(`You forgot to wrap your component in <${WalletProvider.name}>.`);
|
|
16
16
|
};
|
|
17
17
|
const initialContext = {
|
|
18
18
|
connect: stub,
|
|
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { getChainByKey } from '@lifi/sdk';
|
|
14
14
|
import { createContext, useContext, useEffect, useMemo } from 'react';
|
|
15
|
-
import { setDefaultSettings } from '../../stores';
|
|
15
|
+
import { setDefaultSettings, useSettingsStoreContext } from '../../stores';
|
|
16
16
|
import { formatAmount } from '../../utils';
|
|
17
17
|
const initialContext = {
|
|
18
18
|
disabledChains: [],
|
|
@@ -21,6 +21,7 @@ const WidgetContext = createContext(initialContext);
|
|
|
21
21
|
export const useWidgetConfig = () => useContext(WidgetContext);
|
|
22
22
|
export const WidgetProvider = (_a) => {
|
|
23
23
|
var { children } = _a, _b = _a.config, _c = _b === void 0 ? {} : _b, { fromChain, fromToken, toChain, toToken, fromAmount } = _c, config = __rest(_c, ["fromChain", "fromToken", "toChain", "toToken", "fromAmount"]);
|
|
24
|
+
const settingsStoreContext = useSettingsStoreContext();
|
|
24
25
|
const value = useMemo(() => {
|
|
25
26
|
var _a, _b, _c, _d, _e, _f;
|
|
26
27
|
try {
|
|
@@ -57,7 +58,7 @@ export const WidgetProvider = (_a) => {
|
|
|
57
58
|
}
|
|
58
59
|
}, [config, fromAmount, fromChain, fromToken, toChain, toToken]);
|
|
59
60
|
useEffect(() => {
|
|
60
|
-
setDefaultSettings(value);
|
|
61
|
-
}, [value]);
|
|
61
|
+
setDefaultSettings(settingsStoreContext, value);
|
|
62
|
+
}, [settingsStoreContext, value]);
|
|
62
63
|
return (_jsx(WidgetContext.Provider, Object.assign({ value: value }, { children: children })));
|
|
63
64
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ChainOrderStoreProvider } from './chains';
|
|
3
|
+
import { RouteExecutionStoreProvider } from './routes';
|
|
4
|
+
import { SettingsStoreProvider } from './settings';
|
|
5
|
+
export const StoreProvider = ({ children, namePrefix }) => {
|
|
6
|
+
return (_jsx(RouteExecutionStoreProvider, Object.assign({ namePrefix: namePrefix }, { children: _jsx(SettingsStoreProvider
|
|
7
|
+
// namePrefix={namePrefix}
|
|
8
|
+
, { children: _jsx(ChainOrderStoreProvider, Object.assign({ namePrefix: namePrefix }, { children: children })) }) })));
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StoreApi, UseBoundStore } from 'zustand';
|
|
3
|
+
import type { PersistStoreProviderProps } from '../types';
|
|
4
|
+
import type { ChainOrderState } from './types';
|
|
5
|
+
export type ChainOrderStore = UseBoundStore<StoreApi<ChainOrderState>>;
|
|
6
|
+
export declare const ChainOrderStoreContext: import("react").Context<ChainOrderStore | null>;
|
|
7
|
+
export declare function ChainOrderStoreProvider({ children, ...props }: PersistStoreProviderProps): JSX.Element;
|
|
8
|
+
export declare function useChainOrderStore<T>(selector: (state: ChainOrderState) => T, equalityFn?: (left: T, right: T) => boolean): T;
|
|
9
|
+
export declare function useChainOrderStoreContext(): ChainOrderStore;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
/* eslint-disable no-underscore-dangle */
|
|
14
|
+
import { createContext, useContext, useRef } from 'react';
|
|
15
|
+
import { createChainOrderStore } from './createChainOrderStore';
|
|
16
|
+
export const ChainOrderStoreContext = createContext(null);
|
|
17
|
+
export function ChainOrderStoreProvider(_a) {
|
|
18
|
+
var { children } = _a, props = __rest(_a, ["children"]);
|
|
19
|
+
const storeRef = useRef();
|
|
20
|
+
if (!storeRef.current) {
|
|
21
|
+
storeRef.current = createChainOrderStore(props);
|
|
22
|
+
}
|
|
23
|
+
return (_jsx(ChainOrderStoreContext.Provider, Object.assign({ value: storeRef.current }, { children: children })));
|
|
24
|
+
}
|
|
25
|
+
export function useChainOrderStore(selector, equalityFn) {
|
|
26
|
+
const useStore = useContext(ChainOrderStoreContext);
|
|
27
|
+
if (!useStore) {
|
|
28
|
+
throw new Error(`You forgot to wrap your component in <${ChainOrderStoreProvider.name}>.`);
|
|
29
|
+
}
|
|
30
|
+
return useStore(selector, equalityFn);
|
|
31
|
+
}
|
|
32
|
+
export function useChainOrderStoreContext() {
|
|
33
|
+
const useStore = useContext(ChainOrderStoreContext);
|
|
34
|
+
if (!useStore) {
|
|
35
|
+
throw new Error(`You forgot to wrap your component in <${ChainOrderStoreProvider.name}>.`);
|
|
36
|
+
}
|
|
37
|
+
return useStore;
|
|
38
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PersistStoreProps } from '../types';
|
|
2
|
+
import type { ChainOrderState } from './types';
|
|
3
|
+
export declare const maxChainToOrder = 9;
|
|
4
|
+
export declare const createChainOrderStore: ({ namePrefix }: PersistStoreProps) => import("zustand").UseBoundStore<import("zustand").StoreApi<ChainOrderState>>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/* eslint-disable no-underscore-dangle */
|
|
2
1
|
import { create } from 'zustand';
|
|
3
2
|
import { persist } from 'zustand/middleware';
|
|
4
3
|
export const maxChainToOrder = 9;
|
|
5
|
-
export const
|
|
4
|
+
export const createChainOrderStore = ({ namePrefix }) => create(persist((set, get) => ({
|
|
6
5
|
chainOrder: [],
|
|
7
6
|
availableChains: [],
|
|
8
7
|
initializeChains: (chainIds) => {
|
|
@@ -44,7 +43,7 @@ export const useChainOrderStore = create()(persist((set, get) => ({
|
|
|
44
43
|
});
|
|
45
44
|
},
|
|
46
45
|
}), {
|
|
47
|
-
name: 'li.fi-widget-chains-order
|
|
46
|
+
name: `${namePrefix || 'li.fi'}-widget-chains-order`,
|
|
48
47
|
version: 0,
|
|
49
48
|
partialize: (state) => ({ chainOrder: state.chainOrder }),
|
|
50
49
|
}));
|
package/stores/chains/index.d.ts
CHANGED
package/stores/chains/index.js
CHANGED
package/stores/chains/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface ChainOrderProps {
|
|
2
2
|
chainOrder: number[];
|
|
3
3
|
availableChains: number[];
|
|
4
4
|
}
|
|
5
|
-
export interface
|
|
5
|
+
export interface ChainOrderState extends ChainOrderProps {
|
|
6
6
|
initializeChains(chainIds: number[]): number[];
|
|
7
7
|
setChain(chainId: number): void;
|
|
8
8
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallow } from 'zustand/shallow';
|
|
2
|
-
import { useChainOrderStore } from './
|
|
2
|
+
import { useChainOrderStore } from './ChainOrderStore';
|
|
3
3
|
export const useChainOrder = () => {
|
|
4
4
|
return useChainOrderStore((state) => [state.chainOrder, state.setChain], shallow);
|
|
5
5
|
};
|
package/stores/index.d.ts
CHANGED
package/stores/index.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StoreApi, UseBoundStore } from 'zustand';
|
|
3
|
+
import type { PersistStoreProviderProps } from '../types';
|
|
4
|
+
import type { RouteExecutionState } from './types';
|
|
5
|
+
export type RouteExecutionStore = UseBoundStore<StoreApi<RouteExecutionState>>;
|
|
6
|
+
export declare const RouteExecutionStoreContext: import("react").Context<RouteExecutionStore | null>;
|
|
7
|
+
export declare function RouteExecutionStoreProvider({ children, ...props }: PersistStoreProviderProps): JSX.Element;
|
|
8
|
+
export declare function useRouteExecutionStore<T>(selector: (state: RouteExecutionState) => T, equalityFn?: (left: T, right: T) => boolean): T;
|
|
9
|
+
export declare function useRouteExecutionStoreContext(): RouteExecutionStore;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
/* eslint-disable no-underscore-dangle */
|
|
14
|
+
import { createContext, useContext, useRef } from 'react';
|
|
15
|
+
import { createRouteExecutionStore } from './createRouteExecutionStore';
|
|
16
|
+
export const RouteExecutionStoreContext = createContext(null);
|
|
17
|
+
export function RouteExecutionStoreProvider(_a) {
|
|
18
|
+
var { children } = _a, props = __rest(_a, ["children"]);
|
|
19
|
+
const storeRef = useRef();
|
|
20
|
+
if (!storeRef.current) {
|
|
21
|
+
storeRef.current = createRouteExecutionStore(props);
|
|
22
|
+
}
|
|
23
|
+
return (_jsx(RouteExecutionStoreContext.Provider, Object.assign({ value: storeRef.current }, { children: children })));
|
|
24
|
+
}
|
|
25
|
+
export function useRouteExecutionStore(selector, equalityFn) {
|
|
26
|
+
const useStore = useContext(RouteExecutionStoreContext);
|
|
27
|
+
if (!useStore) {
|
|
28
|
+
throw new Error(`You forgot to wrap your component in <${RouteExecutionStoreProvider.name}>.`);
|
|
29
|
+
}
|
|
30
|
+
return useStore(selector, equalityFn);
|
|
31
|
+
}
|
|
32
|
+
export function useRouteExecutionStoreContext() {
|
|
33
|
+
const useStore = useContext(RouteExecutionStoreContext);
|
|
34
|
+
if (!useStore) {
|
|
35
|
+
throw new Error(`You forgot to wrap your component in <${RouteExecutionStoreProvider.name}>.`);
|
|
36
|
+
}
|
|
37
|
+
return useStore;
|
|
38
|
+
}
|
|
@@ -3,7 +3,7 @@ import { persist } from 'zustand/middleware';
|
|
|
3
3
|
import { hasEnumFlag } from '../../utils';
|
|
4
4
|
import { RouteExecutionStatus } from './types';
|
|
5
5
|
import { isRouteDone, isRouteFailed, isRoutePartiallyDone, isRouteRefunded, } from './utils';
|
|
6
|
-
export const
|
|
6
|
+
export const createRouteExecutionStore = ({ namePrefix }) => create(persist((set, get) => ({
|
|
7
7
|
routes: {},
|
|
8
8
|
setExecutableRoute: (route) => {
|
|
9
9
|
if (!get().routes[route.id]) {
|
|
@@ -37,7 +37,8 @@ export const useRouteExecutionStore = create()(persist((set, get) => ({
|
|
|
37
37
|
}
|
|
38
38
|
const isDone = isRouteDone(route);
|
|
39
39
|
if (isDone) {
|
|
40
|
-
updatedState.routes[route.id].status =
|
|
40
|
+
updatedState.routes[route.id].status =
|
|
41
|
+
RouteExecutionStatus.Done;
|
|
41
42
|
if (isRoutePartiallyDone(route)) {
|
|
42
43
|
updatedState.routes[route.id].status |=
|
|
43
44
|
RouteExecutionStatus.Partial;
|
|
@@ -90,7 +91,7 @@ export const useRouteExecutionStore = create()(persist((set, get) => ({
|
|
|
90
91
|
};
|
|
91
92
|
}),
|
|
92
93
|
}), {
|
|
93
|
-
name: 'li.fi-widget-routes
|
|
94
|
+
name: `${namePrefix || 'li.fi'}-widget-routes`,
|
|
94
95
|
version: 1,
|
|
95
96
|
partialize: (state) => ({ routes: state.routes }),
|
|
96
97
|
merge: (persistedState, currentState) => {
|
package/stores/routes/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
export * from './RouteExecutionStore';
|
|
1
2
|
export * from './types';
|
|
2
3
|
export * from './useExecutingRoutesIds';
|
|
3
4
|
export * from './useRecommendedRouteStore';
|
|
4
|
-
export * from './useRouteExecutionStore';
|
|
5
5
|
export * from './useSetExecutableRoute';
|
|
6
6
|
export * from './useSwapHistory';
|
|
7
7
|
export * from './utils';
|
package/stores/routes/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
export * from './RouteExecutionStore';
|
|
1
2
|
export * from './types';
|
|
2
3
|
export * from './useExecutingRoutesIds';
|
|
3
4
|
export * from './useRecommendedRouteStore';
|
|
4
|
-
export * from './useRouteExecutionStore';
|
|
5
5
|
export * from './useSetExecutableRoute';
|
|
6
6
|
export * from './useSwapHistory';
|
|
7
7
|
export * from './utils';
|
package/stores/routes/types.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { Route } from '@lifi/sdk';
|
|
2
|
-
export interface
|
|
2
|
+
export interface RouteExecution {
|
|
3
|
+
route: Route;
|
|
4
|
+
status: RouteExecutionStatus;
|
|
5
|
+
}
|
|
6
|
+
export interface RouteExecutionState {
|
|
3
7
|
routes: Partial<Record<string, RouteExecution>>;
|
|
4
8
|
setExecutableRoute: (route: Route) => void;
|
|
5
9
|
updateRoute: (route: Route) => void;
|
|
@@ -15,10 +19,6 @@ export declare enum RouteExecutionStatus {
|
|
|
15
19
|
Partial = 8,
|
|
16
20
|
Refunded = 16
|
|
17
21
|
}
|
|
18
|
-
export interface RouteExecution {
|
|
19
|
-
route: Route;
|
|
20
|
-
status: RouteExecutionStatus;
|
|
21
|
-
}
|
|
22
22
|
export interface RecommendedRouteStore {
|
|
23
23
|
recommendedRoute?: Route;
|
|
24
24
|
setRecommendedRoute: (route?: Route) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { shallow } from 'zustand/shallow';
|
|
2
|
+
import { useRouteExecutionStore } from './RouteExecutionStore';
|
|
2
3
|
import { RouteExecutionStatus } from './types';
|
|
3
|
-
import { useRouteExecutionStore } from './useRouteExecutionStore';
|
|
4
4
|
export const useExecutingRoutesIds = (address) => {
|
|
5
5
|
return useRouteExecutionStore((state) => Object.values(state.routes)
|
|
6
6
|
.filter((item) => item.route.fromAddress === address &&
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { shallow } from 'zustand/shallow';
|
|
2
2
|
import { hasEnumFlag } from '../../utils';
|
|
3
|
+
import { useRouteExecutionStore } from './RouteExecutionStore';
|
|
3
4
|
import { RouteExecutionStatus } from './types';
|
|
4
|
-
import { useRouteExecutionStore } from './useRouteExecutionStore';
|
|
5
5
|
export const useSwapHistory = (address) => {
|
|
6
6
|
return useRouteExecutionStore((state) => Object.values(state.routes)
|
|
7
7
|
.filter((item) => (item === null || item === void 0 ? void 0 : item.route.fromAddress) === address &&
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { WidgetConfig } from '@lifi/widget';
|
|
3
|
+
import type { StoreApi, UseBoundStore } from 'zustand';
|
|
4
|
+
import type { PersistStoreProviderProps } from '../types';
|
|
5
|
+
import type { SettingsState } from './types';
|
|
6
|
+
export type SettingsStore = UseBoundStore<StoreApi<SettingsState>>;
|
|
7
|
+
export declare const SettingsStoreContext: import("react").Context<SettingsStore | null>;
|
|
8
|
+
export declare function SettingsStoreProvider({ children, ...props }: PersistStoreProviderProps): JSX.Element;
|
|
9
|
+
export declare function useSettingsStore<T>(selector: (state: SettingsState) => T, equalityFn?: (left: T, right: T) => boolean): T;
|
|
10
|
+
export declare function useSettingsStoreContext(): SettingsStore;
|
|
11
|
+
export declare const setDefaultSettings: (useSettingsStore: SettingsStore, config?: WidgetConfig) => void;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { createContext, useContext, useRef } from 'react';
|
|
14
|
+
import { createSettingsStore, defaultConfigurableSettings, } from './createSettingsStore';
|
|
15
|
+
export const SettingsStoreContext = createContext(null);
|
|
16
|
+
export function SettingsStoreProvider(_a) {
|
|
17
|
+
var { children } = _a, props = __rest(_a, ["children"]);
|
|
18
|
+
const storeRef = useRef();
|
|
19
|
+
if (!storeRef.current) {
|
|
20
|
+
storeRef.current = createSettingsStore(props);
|
|
21
|
+
}
|
|
22
|
+
return (_jsx(SettingsStoreContext.Provider, Object.assign({ value: storeRef.current }, { children: children })));
|
|
23
|
+
}
|
|
24
|
+
export function useSettingsStore(selector, equalityFn) {
|
|
25
|
+
const useStore = useContext(SettingsStoreContext);
|
|
26
|
+
if (!useStore) {
|
|
27
|
+
throw new Error(`You forgot to wrap your component in <${SettingsStoreProvider.name}>.`);
|
|
28
|
+
}
|
|
29
|
+
return useStore(selector, equalityFn);
|
|
30
|
+
}
|
|
31
|
+
export function useSettingsStoreContext() {
|
|
32
|
+
const useStore = useContext(SettingsStoreContext);
|
|
33
|
+
if (!useStore) {
|
|
34
|
+
throw new Error(`You forgot to wrap your component in <${SettingsStoreProvider.name}>.`);
|
|
35
|
+
}
|
|
36
|
+
return useStore;
|
|
37
|
+
}
|
|
38
|
+
export const setDefaultSettings = (useSettingsStore, config) => {
|
|
39
|
+
var _a, _b, _c, _d, _e;
|
|
40
|
+
const { slippage, routePriority, setValue } = useSettingsStore.getState();
|
|
41
|
+
const defaultSlippage = ((config === null || config === void 0 ? void 0 : config.slippage) ||
|
|
42
|
+
((_b = (_a = config === null || config === void 0 ? void 0 : config.sdkConfig) === null || _a === void 0 ? void 0 : _a.defaultRouteOptions) === null || _b === void 0 ? void 0 : _b.slippage) ||
|
|
43
|
+
0) * 100;
|
|
44
|
+
const defaultRoutePriority = (config === null || config === void 0 ? void 0 : config.routePriority) || ((_d = (_c = config === null || config === void 0 ? void 0 : config.sdkConfig) === null || _c === void 0 ? void 0 : _c.defaultRouteOptions) === null || _d === void 0 ? void 0 : _d.order);
|
|
45
|
+
if (!slippage) {
|
|
46
|
+
setValue('slippage', (_e = (defaultSlippage || defaultConfigurableSettings.slippage)) === null || _e === void 0 ? void 0 : _e.toString());
|
|
47
|
+
}
|
|
48
|
+
if (!routePriority) {
|
|
49
|
+
setValue('routePriority', defaultRoutePriority || defaultConfigurableSettings.routePriority);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PersistStoreProps } from '../types';
|
|
2
|
+
import type { SettingsProps, SettingsState } from './types';
|
|
3
|
+
export declare const defaultConfigurableSettings: Pick<SettingsState, 'routePriority' | 'slippage'>;
|
|
4
|
+
export declare const defaultSettings: SettingsProps;
|
|
5
|
+
export declare const createSettingsStore: ({ namePrefix }: PersistStoreProps) => import("zustand").UseBoundStore<import("zustand").StoreApi<SettingsState>>;
|
|
@@ -9,7 +9,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
/* eslint-disable no-underscore-dangle */
|
|
13
12
|
import { create } from 'zustand';
|
|
14
13
|
import { persist } from 'zustand/middleware';
|
|
15
14
|
import { SettingsToolTypes } from './types';
|
|
@@ -23,7 +22,7 @@ export const defaultSettings = {
|
|
|
23
22
|
advancedPreferences: false,
|
|
24
23
|
showDestinationWallet: true,
|
|
25
24
|
};
|
|
26
|
-
export const
|
|
25
|
+
export const createSettingsStore = ({ namePrefix }) => create(persist((set) => (Object.assign(Object.assign({}, defaultSettings), { setValue: (key, value) => set(() => ({
|
|
27
26
|
[key]: value,
|
|
28
27
|
})), setValues: (values) => set((state) => {
|
|
29
28
|
const updatedState = Object.assign({}, state);
|
|
@@ -68,7 +67,7 @@ export const useSettingsStore = create()(persist((set) => (Object.assign(Object.
|
|
|
68
67
|
return values;
|
|
69
68
|
}, {}),
|
|
70
69
|
})) })), {
|
|
71
|
-
name: 'li.fi-widget-settings
|
|
70
|
+
name: `${namePrefix || 'li.fi'}-widget-settings`,
|
|
72
71
|
version: 2,
|
|
73
72
|
partialize: (state) => {
|
|
74
73
|
const { enabledBridges, enabledExchanges } = state, partializedState = __rest(state, ["enabledBridges", "enabledExchanges"]);
|
|
@@ -93,17 +92,3 @@ export const useSettingsStore = create()(persist((set) => (Object.assign(Object.
|
|
|
93
92
|
return persistedState;
|
|
94
93
|
},
|
|
95
94
|
}));
|
|
96
|
-
export const setDefaultSettings = (config) => {
|
|
97
|
-
var _a, _b, _c, _d, _e;
|
|
98
|
-
const { slippage, routePriority, setValue } = useSettingsStore.getState();
|
|
99
|
-
const defaultSlippage = ((config === null || config === void 0 ? void 0 : config.slippage) ||
|
|
100
|
-
((_b = (_a = config === null || config === void 0 ? void 0 : config.sdkConfig) === null || _a === void 0 ? void 0 : _a.defaultRouteOptions) === null || _b === void 0 ? void 0 : _b.slippage) ||
|
|
101
|
-
0) * 100;
|
|
102
|
-
const defaultRoutePriority = (config === null || config === void 0 ? void 0 : config.routePriority) || ((_d = (_c = config === null || config === void 0 ? void 0 : config.sdkConfig) === null || _c === void 0 ? void 0 : _c.defaultRouteOptions) === null || _d === void 0 ? void 0 : _d.order);
|
|
103
|
-
if (!slippage) {
|
|
104
|
-
setValue('slippage', (_e = (defaultSlippage || defaultConfigurableSettings.slippage)) === null || _e === void 0 ? void 0 : _e.toString());
|
|
105
|
-
}
|
|
106
|
-
if (!routePriority) {
|
|
107
|
-
setValue('routePriority', defaultRoutePriority || defaultConfigurableSettings.routePriority);
|
|
108
|
-
}
|
|
109
|
-
};
|