@lifi/widget 1.26.1 → 1.26.3
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/cjs/AppDrawer.style.d.ts +1 -1
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -1
- package/cjs/components/BottomSheet/BottomSheet.js +1 -1
- package/cjs/components/Header/Header.style.d.ts +1 -1
- package/cjs/components/Header/useHeaderActionStore.d.ts +1 -3
- package/cjs/components/Header/useHeaderActionStore.js +8 -9
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/cjs/components/SendToWallet/SendToWallet.js +1 -1
- package/cjs/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/cjs/components/SendToWallet/store.d.ts +1 -3
- package/cjs/components/SendToWallet/store.js +5 -6
- 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/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useRouteExecution.js +2 -0
- package/cjs/hooks/useWidgetEvents.d.ts +2 -2
- package/cjs/hooks/useWidgetEvents.js +3 -4
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +2 -1
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/cjs/pages/SwapPage/ExchangeRateBottomSheet.d.ts +1 -1
- package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +11 -4
- package/cjs/pages/SwapPage/SwapPage.js +1 -1
- package/cjs/pages/SwapPage/TokenValueBottomSheet.js +3 -3
- package/cjs/stores/chains/useChainOrderStore.d.ts +1 -3
- package/cjs/stores/chains/useChainOrderStore.js +28 -17
- package/cjs/stores/routes/useRecommendedRouteStore.d.ts +1 -3
- package/cjs/stores/routes/useRecommendedRouteStore.js +6 -7
- package/cjs/stores/routes/useRouteExecutionStore.d.ts +1 -3
- package/cjs/stores/routes/useRouteExecutionStore.js +75 -47
- package/cjs/stores/settings/useSettingsStore.d.ts +1 -3
- package/cjs/stores/settings/useSettingsStore.js +36 -31
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -1
- package/components/BottomSheet/BottomSheet.js +2 -2
- package/components/Header/Header.style.d.ts +1 -1
- package/components/Header/useHeaderActionStore.d.ts +1 -3
- package/components/Header/useHeaderActionStore.js +8 -9
- package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/components/SendToWallet/SendToWallet.js +1 -1
- package/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/components/SendToWallet/store.d.ts +1 -3
- package/components/SendToWallet/store.js +5 -6
- 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/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useRouteExecution.js +3 -1
- package/hooks/useWidgetEvents.d.ts +2 -2
- package/hooks/useWidgetEvents.js +2 -3
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +9 -10
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/pages/SwapPage/ExchangeRateBottomSheet.d.ts +1 -1
- package/pages/SwapPage/ExchangeRateBottomSheet.js +12 -5
- package/pages/SwapPage/StatusBottomSheet.js +3 -3
- package/pages/SwapPage/SwapPage.js +2 -2
- package/pages/SwapPage/TokenValueBottomSheet.js +4 -4
- package/stores/chains/useChainOrderStore.d.ts +1 -3
- package/stores/chains/useChainOrderStore.js +28 -17
- package/stores/routes/useRecommendedRouteStore.d.ts +1 -3
- package/stores/routes/useRecommendedRouteStore.js +6 -7
- package/stores/routes/useRouteExecutionStore.d.ts +1 -3
- package/stores/routes/useRouteExecutionStore.js +75 -47
- package/stores/settings/useSettingsStore.d.ts +1 -3
- package/stores/settings/useSettingsStore.js +36 -31
- package/tsconfig.cjs.tsbuildinfo +1 -1
package/AppDrawer.style.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const DrawerButton: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
5
|
-
color?: "inherit" | "
|
|
5
|
+
color?: "inherit" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableElevation?: boolean | undefined;
|
|
8
8
|
disableFocusRipple?: boolean | undefined;
|
package/cjs/AppDrawer.style.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const DrawerButton: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
5
|
-
color?: "inherit" | "
|
|
5
|
+
color?: "inherit" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableElevation?: boolean | undefined;
|
|
8
8
|
disableFocusRipple?: boolean | undefined;
|
|
@@ -39,7 +39,7 @@ export declare const ListItem: import("@emotion/styled").StyledComponent<{
|
|
|
39
39
|
export declare const ShowAllButton: import("@emotion/styled").StyledComponent<{
|
|
40
40
|
children?: import("react").ReactNode;
|
|
41
41
|
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
42
|
-
color?: "inherit" | "
|
|
42
|
+
color?: "inherit" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
43
43
|
disabled?: boolean | undefined;
|
|
44
44
|
disableElevation?: boolean | undefined;
|
|
45
45
|
disableFocusRipple?: boolean | undefined;
|
|
@@ -13,7 +13,7 @@ exports.BottomSheet = (0, react_1.forwardRef)(({ elementRef, children, open, onC
|
|
|
13
13
|
setDrawerOpen(false);
|
|
14
14
|
openRef.current = false;
|
|
15
15
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
16
|
-
}, []);
|
|
16
|
+
}, [onClose]);
|
|
17
17
|
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
18
18
|
isOpen: () => openRef.current,
|
|
19
19
|
open: () => {
|
|
@@ -21,7 +21,7 @@ export declare const Container: import("@emotion/styled").StyledComponent<import
|
|
|
21
21
|
export declare const WalletButton: import("@emotion/styled").StyledComponent<{
|
|
22
22
|
children?: import("react").ReactNode;
|
|
23
23
|
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
24
|
-
color?: "inherit" | "
|
|
24
|
+
color?: "inherit" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
25
25
|
disabled?: boolean | undefined;
|
|
26
26
|
disableElevation?: boolean | undefined;
|
|
27
27
|
disableFocusRipple?: boolean | undefined;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import type { HeaderActionStore } from './types';
|
|
2
|
-
export declare const useHeaderActionStore: import("zustand").UseBoundStore<
|
|
3
|
-
setState(nextStateOrUpdater: HeaderActionStore | Partial<HeaderActionStore> | ((state: import("immer/dist/internal").WritableDraft<HeaderActionStore>) => void), shouldReplace?: boolean | undefined): void;
|
|
4
|
-
}>;
|
|
2
|
+
export declare const useHeaderActionStore: import("zustand").UseBoundStore<import("zustand").StoreApi<HeaderActionStore>>;
|
|
@@ -3,17 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useHeaderActionStore = void 0;
|
|
4
4
|
/* eslint-disable no-underscore-dangle */
|
|
5
5
|
const zustand_1 = require("zustand");
|
|
6
|
-
|
|
7
|
-
exports.useHeaderActionStore = (0, zustand_1.default)()((0, immer_1.immer)((set, get) => ({
|
|
6
|
+
exports.useHeaderActionStore = (0, zustand_1.default)((set, get) => ({
|
|
8
7
|
setAction: (element) => {
|
|
9
|
-
set((
|
|
10
|
-
|
|
11
|
-
});
|
|
8
|
+
set(() => ({
|
|
9
|
+
element,
|
|
10
|
+
}));
|
|
12
11
|
return get().removeAction;
|
|
13
12
|
},
|
|
14
13
|
removeAction: () => {
|
|
15
|
-
set((
|
|
16
|
-
|
|
17
|
-
});
|
|
14
|
+
set(() => ({
|
|
15
|
+
element: null,
|
|
16
|
+
}));
|
|
18
17
|
},
|
|
19
|
-
}))
|
|
18
|
+
}));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const IconButton: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
5
|
-
color?: "inherit" | "default" | "
|
|
5
|
+
color?: "inherit" | "default" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableFocusRipple?: boolean | undefined;
|
|
8
8
|
edge?: false | "end" | "start" | undefined;
|
|
@@ -49,7 +49,7 @@ exports.SendToWallet = (0, react_1.forwardRef)((props, ref) => {
|
|
|
49
49
|
}),
|
|
50
50
|
onBlur: () => trigger(providers_1.SwapFormKey.ToAddress),
|
|
51
51
|
});
|
|
52
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ timeout: 225, in: showSendToWallet, mountOnEnter: true, unmountOnExit: true }, { children: (0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({}, props, { ref: ref }, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.sendToWallet') }), (0, jsx_runtime_1.jsxs)(SendToWallet_style_1.FormControl, Object.assign({ fullWidth: true, sx: { paddingTop: '6px', paddingBottom: '5px' } }, { children: [(0, jsx_runtime_1.jsx)(SendToWallet_style_1.Input, { ref: inputRef, size: "small", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: "false", onChange: onChange, onBlur: onBlur, name: name, placeholder: t('swap.walletAddressOrEns')
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ timeout: 225, in: showSendToWallet, mountOnEnter: true, unmountOnExit: true }, { children: (0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({}, props, { ref: ref }, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.sendToWallet') }), (0, jsx_runtime_1.jsxs)(SendToWallet_style_1.FormControl, Object.assign({ fullWidth: true, sx: { paddingTop: '6px', paddingBottom: '5px' } }, { children: [(0, jsx_runtime_1.jsx)(SendToWallet_style_1.Input, { ref: inputRef, size: "small", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: "false", onChange: onChange, onBlur: onBlur, name: name, placeholder: t('swap.walletAddressOrEns') }), (0, jsx_runtime_1.jsx)(exports.SendToWalletFormHelperText, {})] }))] })) })));
|
|
53
53
|
});
|
|
54
54
|
const SendToWalletFormHelperText = () => {
|
|
55
55
|
var _a;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const FormControl: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").FormControlClasses> | undefined;
|
|
5
|
-
color?: "
|
|
5
|
+
color?: "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
error?: boolean | undefined;
|
|
8
8
|
fullWidth?: boolean | undefined;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import type { SendToWalletStore } from './types';
|
|
2
|
-
export declare const useSendToWalletStore: import("zustand").UseBoundStore<
|
|
3
|
-
setState(nextStateOrUpdater: SendToWalletStore | Partial<SendToWalletStore> | ((state: import("immer/dist/internal").WritableDraft<SendToWalletStore>) => void), shouldReplace?: boolean | undefined): void;
|
|
4
|
-
}>;
|
|
2
|
+
export declare const useSendToWalletStore: import("zustand").UseBoundStore<import("zustand").StoreApi<SendToWalletStore>>;
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSendToWalletStore = void 0;
|
|
4
4
|
const zustand_1 = require("zustand");
|
|
5
|
-
|
|
6
|
-
exports.useSendToWalletStore = (0, zustand_1.default)()((0, immer_1.immer)((set) => ({
|
|
5
|
+
exports.useSendToWalletStore = (0, zustand_1.default)((set) => ({
|
|
7
6
|
showSendToWallet: false,
|
|
8
7
|
toggleSendToWallet: () => {
|
|
9
|
-
set((state) => {
|
|
10
|
-
|
|
11
|
-
});
|
|
8
|
+
set((state) => ({
|
|
9
|
+
showSendToWallet: !state.showSendToWallet,
|
|
10
|
+
}));
|
|
12
11
|
},
|
|
13
|
-
}))
|
|
12
|
+
}));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const LinkButton: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
5
|
-
color?: "inherit" | "default" | "
|
|
5
|
+
color?: "inherit" | "default" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableFocusRipple?: boolean | undefined;
|
|
8
8
|
edge?: false | "end" | "start" | undefined;
|
|
@@ -4,7 +4,7 @@ export declare const minInputFontSize = 14;
|
|
|
4
4
|
export declare const FormControl: import("@emotion/styled").StyledComponent<{
|
|
5
5
|
children?: import("react").ReactNode;
|
|
6
6
|
classes?: Partial<import("@mui/material").FormControlClasses> | undefined;
|
|
7
|
-
color?: "
|
|
7
|
+
color?: "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
8
8
|
disabled?: boolean | undefined;
|
|
9
9
|
error?: boolean | undefined;
|
|
10
10
|
fullWidth?: boolean | undefined;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const Button: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
5
|
-
color?: "inherit" | "
|
|
5
|
+
color?: "inherit" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableElevation?: boolean | undefined;
|
|
8
8
|
disableFocusRipple?: boolean | undefined;
|
|
@@ -17,7 +17,7 @@ export declare const Label: import("@emotion/styled").StyledComponent<import("@m
|
|
|
17
17
|
export declare const IconButton: import("@emotion/styled").StyledComponent<{
|
|
18
18
|
children?: import("react").ReactNode;
|
|
19
19
|
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
20
|
-
color?: "inherit" | "default" | "
|
|
20
|
+
color?: "inherit" | "default" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
21
21
|
disabled?: boolean | undefined;
|
|
22
22
|
disableFocusRipple?: boolean | undefined;
|
|
23
23
|
edge?: false | "end" | "start" | undefined;
|
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.26.
|
|
2
|
+
export declare const version = "1.26.3";
|
package/cjs/config/version.js
CHANGED
|
@@ -20,6 +20,7 @@ const utils_1 = require("../utils");
|
|
|
20
20
|
const useWidgetEvents_1 = require("./useWidgetEvents");
|
|
21
21
|
const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateUpdate, }) => {
|
|
22
22
|
const lifi = (0, providers_1.useLiFi)();
|
|
23
|
+
const queryClient = (0, react_query_1.useQueryClient)();
|
|
23
24
|
const { account, switchChain } = (0, providers_1.useWallet)();
|
|
24
25
|
const resumedAfterMount = (0, react_1.useRef)(false);
|
|
25
26
|
const emitter = (0, useWidgetEvents_1.useWidgetEvents)();
|
|
@@ -77,6 +78,7 @@ const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateU
|
|
|
77
78
|
if (!(routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route)) {
|
|
78
79
|
throw Error('Execution route not found.');
|
|
79
80
|
}
|
|
81
|
+
queryClient.removeQueries(['routes']);
|
|
80
82
|
return lifi.executeRoute(account.signer, routeExecution.route, {
|
|
81
83
|
updateCallback,
|
|
82
84
|
switchChainHook,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Emitter } from 'mitt';
|
|
2
1
|
import type { WidgetEvents } from '../types';
|
|
3
|
-
export declare const
|
|
2
|
+
export declare const widgetEvents: import("mitt").Emitter<WidgetEvents>;
|
|
3
|
+
export declare const useWidgetEvents: () => import("mitt").Emitter<WidgetEvents>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useWidgetEvents = void 0;
|
|
3
|
+
exports.useWidgetEvents = exports.widgetEvents = void 0;
|
|
4
4
|
const mitt_1 = require("mitt");
|
|
5
|
-
|
|
6
|
-
const emitterStore = (0, zustand_1.default)()(() => (0, mitt_1.default)());
|
|
5
|
+
exports.widgetEvents = (0, mitt_1.default)();
|
|
7
6
|
const useWidgetEvents = () => {
|
|
8
|
-
return
|
|
7
|
+
return exports.widgetEvents;
|
|
9
8
|
};
|
|
10
9
|
exports.useWidgetEvents = useWidgetEvents;
|
package/cjs/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import './fonts/inter.css';
|
|
3
3
|
export type { WidgetDrawer } from './AppDrawer';
|
|
4
|
-
export { useWidgetEvents } from './hooks';
|
|
4
|
+
export { useWidgetEvents, widgetEvents } from './hooks';
|
|
5
5
|
export * from './types';
|
|
6
6
|
export declare const LiFiWidget: import("react").FC<import("./types").WidgetProps>;
|
|
7
7
|
/**
|
package/cjs/index.js
CHANGED
|
@@ -14,12 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.LiFiWidgetDrawer = exports.LiFiWidget = exports.useWidgetEvents = void 0;
|
|
17
|
+
exports.LiFiWidgetDrawer = exports.LiFiWidget = exports.widgetEvents = exports.useWidgetEvents = void 0;
|
|
18
18
|
const App_1 = require("./App");
|
|
19
19
|
const AppDrawer_1 = require("./AppDrawer");
|
|
20
20
|
require("./fonts/inter.css");
|
|
21
21
|
var hooks_1 = require("./hooks");
|
|
22
22
|
Object.defineProperty(exports, "useWidgetEvents", { enumerable: true, get: function () { return hooks_1.useWidgetEvents; } });
|
|
23
|
+
Object.defineProperty(exports, "widgetEvents", { enumerable: true, get: function () { return hooks_1.widgetEvents; } });
|
|
23
24
|
__exportStar(require("./types"), exports);
|
|
24
25
|
// ClassNameGenerator.configure((componentName) =>
|
|
25
26
|
// componentName.replace('Mui', 'LiFi'),
|
|
@@ -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?: "
|
|
5
|
+
color?: "success" | "warning" | "error" | "primary" | "secondary" | "info" | "standard" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableFocusRipple?: boolean | undefined;
|
|
8
8
|
fullWidth?: boolean | undefined;
|
|
@@ -3,7 +3,7 @@ import type { ExchangeRateUpdateParams, Route } from '@lifi/sdk';
|
|
|
3
3
|
export interface ExchangeRateBottomSheetBase {
|
|
4
4
|
isOpen(): void;
|
|
5
5
|
open(resolver: (value: boolean) => void, data: ExchangeRateUpdateParams): void;
|
|
6
|
-
close(value?: boolean): void;
|
|
6
|
+
close(value?: boolean, bottomSheetClose?: boolean): void;
|
|
7
7
|
}
|
|
8
8
|
interface ExchangeRateBottomSheetProps {
|
|
9
9
|
data?: ExchangeRateUpdateParams;
|
|
@@ -24,7 +24,12 @@ exports.ExchangeRateBottomSheet = (0, react_1.forwardRef)(({ onContinue, onCance
|
|
|
24
24
|
var _a;
|
|
25
25
|
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.close(false);
|
|
26
26
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
27
|
-
}, []);
|
|
27
|
+
}, [onCancel, ref]);
|
|
28
|
+
const handleClose = (0, react_1.useCallback)(() => {
|
|
29
|
+
var _a;
|
|
30
|
+
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.close(false, false);
|
|
31
|
+
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
32
|
+
}, [onCancel, ref]);
|
|
28
33
|
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
29
34
|
isOpen: () => { var _a; return (_a = bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.isOpen(); },
|
|
30
35
|
open: (resolver, data) => {
|
|
@@ -33,13 +38,15 @@ exports.ExchangeRateBottomSheet = (0, react_1.forwardRef)(({ onContinue, onCance
|
|
|
33
38
|
resolverRef.current = resolver;
|
|
34
39
|
(_a = bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
35
40
|
},
|
|
36
|
-
close: (value = false) => {
|
|
41
|
+
close: (value = false, bottomSheetClose = true) => {
|
|
37
42
|
var _a, _b;
|
|
38
43
|
(_a = resolverRef.current) === null || _a === void 0 ? void 0 : _a.call(resolverRef, value);
|
|
39
|
-
(
|
|
44
|
+
if (bottomSheetClose) {
|
|
45
|
+
(_b = bottomSheetRef.current) === null || _b === void 0 ? void 0 : _b.close();
|
|
46
|
+
}
|
|
40
47
|
},
|
|
41
48
|
}), []);
|
|
42
|
-
return ((0, jsx_runtime_1.jsx)(BottomSheet_1.BottomSheet, Object.assign({ ref: bottomSheetRef, onClose:
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(BottomSheet_1.BottomSheet, Object.assign({ ref: bottomSheetRef, onClose: handleClose }, { children: (0, jsx_runtime_1.jsx)(ExchangeRateBottomSheetContent, { data: data, onContinue: handleContinue, onCancel: handleCancel }) })));
|
|
43
50
|
});
|
|
44
51
|
const ExchangeRateBottomSheetContent = ({ data, onCancel, onContinue }) => {
|
|
45
52
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
@@ -82,6 +82,6 @@ const SwapPage = () => {
|
|
|
82
82
|
enableLoading: true }), status === stores_1.RouteExecutionStatus.Failed ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: t('button.removeSwap'), placement: "bottom-end", enterDelay: 400, arrow: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ onClick: handleRemoveRoute, sx: {
|
|
83
83
|
minWidth: 48,
|
|
84
84
|
marginLeft: 1,
|
|
85
|
-
} }, { 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, route ? ((0, jsx_runtime_1.jsx)(TokenValueBottomSheet_1.TokenValueBottomSheet, { route: route, ref: tokenValueBottomSheetRef, onContinue: handleExecuteRoute })) : null, route ? (0, jsx_runtime_1.jsx)(ExchangeRateBottomSheet_1.ExchangeRateBottomSheet, { ref: exchangeRateBottomSheetRef }) : null] }));
|
|
85
|
+
} }, { 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, route ? ((0, jsx_runtime_1.jsx)(TokenValueBottomSheet_1.TokenValueBottomSheet, { route: route, ref: tokenValueBottomSheetRef, onContinue: handleExecuteRoute })) : null, route ? ((0, jsx_runtime_1.jsx)(ExchangeRateBottomSheet_1.ExchangeRateBottomSheet, { ref: exchangeRateBottomSheetRef })) : null] }));
|
|
86
86
|
};
|
|
87
87
|
exports.SwapPage = SwapPage;
|
|
@@ -11,12 +11,12 @@ const BottomSheet_1 = require("../../components/BottomSheet");
|
|
|
11
11
|
const hooks_1 = require("../../hooks");
|
|
12
12
|
const StatusBottomSheet_style_1 = require("./StatusBottomSheet.style");
|
|
13
13
|
exports.TokenValueBottomSheet = (0, react_1.forwardRef)(({ route, onContinue, onCancel }, ref) => {
|
|
14
|
-
const handleCancel = (
|
|
14
|
+
const handleCancel = () => {
|
|
15
15
|
var _a;
|
|
16
16
|
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
17
17
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
18
|
-
}
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)(BottomSheet_1.BottomSheet, Object.assign({ ref: ref, onClose:
|
|
18
|
+
};
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(BottomSheet_1.BottomSheet, Object.assign({ ref: ref, onClose: onCancel }, { children: (0, jsx_runtime_1.jsx)(TokenValueBottomSheetContent, { route: route, onContinue: onContinue, onCancel: handleCancel }) })));
|
|
20
20
|
});
|
|
21
21
|
const TokenValueBottomSheetContent = ({ route, onCancel, onContinue, }) => {
|
|
22
22
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChainOrderStore } from './types';
|
|
2
2
|
export declare const maxChainToOrder = 9;
|
|
3
|
-
export declare const useChainOrderStore: import("zustand").UseBoundStore<Omit<
|
|
3
|
+
export declare const useChainOrderStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<ChainOrderStore>, "persist"> & {
|
|
4
4
|
persist: {
|
|
5
5
|
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<ChainOrderStore, {
|
|
6
6
|
chainOrder: number[];
|
|
@@ -14,6 +14,4 @@ export declare const useChainOrderStore: import("zustand").UseBoundStore<Omit<Om
|
|
|
14
14
|
chainOrder: number[];
|
|
15
15
|
}>>;
|
|
16
16
|
};
|
|
17
|
-
}, "setState"> & {
|
|
18
|
-
setState(nextStateOrUpdater: ChainOrderStore | Partial<ChainOrderStore> | ((state: import("immer/dist/internal").WritableDraft<ChainOrderStore>) => void), shouldReplace?: boolean | undefined): void;
|
|
19
17
|
}>;
|
|
@@ -4,38 +4,49 @@ exports.useChainOrderStore = exports.maxChainToOrder = void 0;
|
|
|
4
4
|
/* eslint-disable no-underscore-dangle */
|
|
5
5
|
const zustand_1 = require("zustand");
|
|
6
6
|
const middleware_1 = require("zustand/middleware");
|
|
7
|
-
const immer_1 = require("zustand/middleware/immer");
|
|
8
7
|
exports.maxChainToOrder = 9;
|
|
9
|
-
exports.useChainOrderStore = (0, zustand_1.default)()((0, middleware_1.persist)((
|
|
8
|
+
exports.useChainOrderStore = (0, zustand_1.default)()((0, middleware_1.persist)((set, get) => ({
|
|
10
9
|
chainOrder: [],
|
|
11
10
|
availableChains: [],
|
|
12
11
|
initializeChains: (chainIds) => {
|
|
13
12
|
set((state) => {
|
|
14
|
-
state.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
const chainOrder = state.chainOrder.filter((chainId) => chainIds.includes(chainId));
|
|
14
|
+
const chainsToAdd = chainIds.filter((chainId) => !chainOrder.includes(chainId));
|
|
15
|
+
if (chainOrder.length === exports.maxChainToOrder || !chainsToAdd.length) {
|
|
16
|
+
return {
|
|
17
|
+
availableChains: chainIds,
|
|
18
|
+
chainOrder,
|
|
19
|
+
};
|
|
20
20
|
}
|
|
21
|
-
const chainsToAddLength = exports.maxChainToOrder -
|
|
21
|
+
const chainsToAddLength = exports.maxChainToOrder - chainOrder.length;
|
|
22
22
|
for (let index = 0; index < chainsToAddLength; index++) {
|
|
23
|
-
|
|
23
|
+
chainOrder.push(chainsToAdd[index]);
|
|
24
24
|
}
|
|
25
|
+
return {
|
|
26
|
+
availableChains: chainIds,
|
|
27
|
+
chainOrder,
|
|
28
|
+
};
|
|
25
29
|
});
|
|
26
30
|
return get().chainOrder;
|
|
27
31
|
},
|
|
28
|
-
setChain: (chainId) =>
|
|
32
|
+
setChain: (chainId) => {
|
|
33
|
+
const state = get();
|
|
29
34
|
if (state.chainOrder.includes(chainId) ||
|
|
30
35
|
!state.availableChains.includes(chainId)) {
|
|
31
36
|
return;
|
|
32
37
|
}
|
|
33
|
-
state
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
38
|
+
set((state) => {
|
|
39
|
+
const chainOrder = state.chainOrder.slice();
|
|
40
|
+
chainOrder.unshift(chainId);
|
|
41
|
+
if (chainOrder.length > exports.maxChainToOrder) {
|
|
42
|
+
chainOrder.pop();
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
chainOrder,
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
}), {
|
|
39
50
|
name: 'li.fi-widget-chains-order',
|
|
40
51
|
version: 0,
|
|
41
52
|
partialize: (state) => ({ chainOrder: state.chainOrder }),
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import type { RecommendedRouteStore } from './types';
|
|
2
|
-
export declare const useRecommendedRouteStore: import("zustand").UseBoundStore<
|
|
3
|
-
setState(nextStateOrUpdater: RecommendedRouteStore | Partial<RecommendedRouteStore> | ((state: import("immer/dist/internal").WritableDraft<RecommendedRouteStore>) => void), shouldReplace?: boolean | undefined): void;
|
|
4
|
-
}>;
|
|
2
|
+
export declare const useRecommendedRouteStore: import("zustand").UseBoundStore<import("zustand").StoreApi<RecommendedRouteStore>>;
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useRecommendedRouteStore = void 0;
|
|
4
4
|
const zustand_1 = require("zustand");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
5
|
+
exports.useRecommendedRouteStore = (0, zustand_1.default)((set) => ({
|
|
6
|
+
setRecommendedRoute: (recommendedRoute) => {
|
|
7
|
+
set(() => ({
|
|
8
|
+
recommendedRoute,
|
|
9
|
+
}));
|
|
11
10
|
},
|
|
12
|
-
}))
|
|
11
|
+
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RouteExecutionStore } from './types';
|
|
2
|
-
export declare const useRouteExecutionStore: import("zustand").UseBoundStore<Omit<
|
|
2
|
+
export declare const useRouteExecutionStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<RouteExecutionStore>, "persist"> & {
|
|
3
3
|
persist: {
|
|
4
4
|
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<RouteExecutionStore, {
|
|
5
5
|
routes: Partial<Record<string, import("./types").RouteExecution>>;
|
|
@@ -13,6 +13,4 @@ export declare const useRouteExecutionStore: import("zustand").UseBoundStore<Omi
|
|
|
13
13
|
routes: Partial<Record<string, import("./types").RouteExecution>>;
|
|
14
14
|
}>>;
|
|
15
15
|
};
|
|
16
|
-
}, "setState"> & {
|
|
17
|
-
setState(nextStateOrUpdater: RouteExecutionStore | Partial<RouteExecutionStore> | ((state: import("immer/dist/internal").WritableDraft<RouteExecutionStore>) => void), shouldReplace?: boolean | undefined): void;
|
|
18
16
|
}>;
|