@lifi/widget 1.22.0 → 1.23.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/AppRoutes.js +1 -2
- package/cjs/AppRoutes.js +1 -2
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +7 -1
- package/cjs/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/cjs/components/ChainSelect/ChainSelect.d.ts +1 -0
- package/cjs/components/Header/Header.style.d.ts +1 -1
- package/cjs/components/Header/NavigationHeader.js +3 -2
- package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +4 -2
- package/cjs/components/SelectTokenButton/SelectTokenButton.style.js +2 -2
- package/cjs/components/Step/CircularProgress.d.ts +1 -0
- package/cjs/components/Step/StepProcess.style.d.ts +1 -1
- package/cjs/components/StepActions/StepActions.js +2 -2
- package/cjs/components/SwapButton/SwapButton.js +9 -4
- package/cjs/components/SwapInput/FormPriceHelperText.js +1 -1
- package/cjs/components/SwapInput/SwapInput.js +1 -1
- package/cjs/components/SwapInput/SwapInputAdornment.d.ts +1 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +2 -1
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -1
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +1 -0
- package/cjs/components/Token/Token.d.ts +5 -2
- package/cjs/components/Token/Token.js +11 -7
- package/cjs/components/Token/Token.style.d.ts +1 -0
- package/cjs/components/Token/Token.style.js +3 -3
- package/cjs/components/TokenAvatar/TokenAvatar.d.ts +8 -0
- package/cjs/components/TokenAvatar/TokenAvatar.js +12 -3
- package/cjs/components/TokenAvatar/TokenAvatar.style.d.ts +17 -0
- package/cjs/components/TokenAvatar/TokenAvatar.style.js +14 -1
- package/cjs/components/TokenList/TokenList.style.d.ts +7 -1
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useGasSufficiency.js +0 -2
- package/cjs/hooks/useSwapRoutes.js +0 -1
- package/cjs/hooks/useTokenBalance.js +0 -1
- package/cjs/hooks/useTokenBalances.js +0 -1
- package/cjs/i18n/en.json +5 -0
- package/cjs/i18n/es.json +1 -0
- package/cjs/i18n/fr.json +2 -2
- package/cjs/i18n/uk.json +5 -5
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/cjs/pages/SelectChainPage/SelectChainPage.d.ts +2 -2
- package/cjs/pages/SelectChainPage/SelectChainPage.js +12 -5
- package/cjs/pages/SelectChainPage/types.d.ts +4 -0
- package/cjs/pages/SelectChainPage/types.js +2 -0
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
- 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 +6 -4
- package/cjs/pages/SwapPage/StatusBottomSheet.js +1 -1
- package/cjs/pages/SwapPage/SwapPage.js +7 -7
- package/cjs/utils/input.js +3 -1
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +7 -1
- package/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/components/ChainSelect/ChainSelect.d.ts +1 -0
- package/components/Header/Header.style.d.ts +1 -1
- package/components/Header/NavigationHeader.js +4 -3
- package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/components/SelectTokenButton/SelectTokenButton.js +5 -3
- package/components/SelectTokenButton/SelectTokenButton.style.js +2 -2
- package/components/Step/CircularProgress.d.ts +1 -0
- package/components/Step/StepProcess.style.d.ts +1 -1
- package/components/StepActions/StepActions.js +2 -2
- package/components/SwapButton/SwapButton.js +9 -4
- package/components/SwapInput/FormPriceHelperText.js +1 -1
- package/components/SwapInput/SwapInput.js +2 -2
- package/components/SwapInput/SwapInputAdornment.d.ts +1 -0
- package/components/SwapRouteCard/SwapRouteCard.js +2 -1
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -1
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +1 -0
- package/components/Token/Token.d.ts +5 -2
- package/components/Token/Token.js +14 -10
- package/components/Token/Token.style.d.ts +1 -0
- package/components/Token/Token.style.js +3 -3
- package/components/TokenAvatar/TokenAvatar.d.ts +8 -0
- package/components/TokenAvatar/TokenAvatar.js +9 -2
- package/components/TokenAvatar/TokenAvatar.style.d.ts +17 -0
- package/components/TokenAvatar/TokenAvatar.style.js +14 -1
- package/components/TokenList/TokenList.style.d.ts +7 -1
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useGasSufficiency.js +0 -2
- package/hooks/useSwapRoutes.js +0 -1
- package/hooks/useTokenBalance.js +0 -1
- package/hooks/useTokenBalances.js +0 -1
- package/i18n/en.json +5 -0
- package/i18n/es.json +1 -0
- package/i18n/fr.json +2 -2
- package/i18n/uk.json +5 -5
- package/package.json +14 -14
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/pages/SelectChainPage/SelectChainPage.d.ts +2 -2
- package/pages/SelectChainPage/SelectChainPage.js +12 -5
- package/pages/SelectChainPage/types.d.ts +4 -0
- package/pages/SelectChainPage/types.js +1 -0
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
- 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 +6 -4
- package/pages/SwapPage/StatusBottomSheet.js +1 -1
- package/pages/SwapPage/SwapPage.js +7 -7
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/utils/input.js +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -43,28 +43,28 @@
|
|
|
43
43
|
"@ethersproject/experimental": "^5.7.0",
|
|
44
44
|
"@ethersproject/providers": "^5.7.2",
|
|
45
45
|
"@lifi/sdk": "^1.6.3",
|
|
46
|
-
"@lifi/wallet-management": "^1.1.
|
|
46
|
+
"@lifi/wallet-management": "^1.1.12",
|
|
47
47
|
"@mui/icons-material": "^5.10.9",
|
|
48
|
-
"@mui/lab": "^5.0.0-alpha.
|
|
49
|
-
"@mui/material": "^5.10.
|
|
50
|
-
"@sentry/integrations": "^7.
|
|
51
|
-
"@sentry/react": "^7.
|
|
52
|
-
"@sentry/tracing": "^7.
|
|
53
|
-
"@tanstack/react-query": "^4.
|
|
54
|
-
"@tanstack/react-virtual": "^3.0.0-beta.
|
|
48
|
+
"@mui/lab": "^5.0.0-alpha.107",
|
|
49
|
+
"@mui/material": "^5.10.13",
|
|
50
|
+
"@sentry/integrations": "^7.18.0",
|
|
51
|
+
"@sentry/react": "^7.18.0",
|
|
52
|
+
"@sentry/tracing": "^7.18.0",
|
|
53
|
+
"@tanstack/react-query": "^4.14.5",
|
|
54
|
+
"@tanstack/react-virtual": "^3.0.0-beta.22",
|
|
55
55
|
"big.js": "^6.2.1",
|
|
56
|
-
"i18next": "^22.0.
|
|
57
|
-
"i18next-browser-languagedetector": "^7.0.
|
|
56
|
+
"i18next": "^22.0.4",
|
|
57
|
+
"i18next-browser-languagedetector": "^7.0.1",
|
|
58
58
|
"immer": "^9.0.16",
|
|
59
59
|
"microdiff": "^1.3.1",
|
|
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.39.1",
|
|
64
64
|
"react-i18next": "^12.0.0",
|
|
65
|
-
"react-router-dom": "^6.4.
|
|
65
|
+
"react-router-dom": "^6.4.3",
|
|
66
66
|
"react-timer-hook": "^3.0.5",
|
|
67
|
-
"zustand": "^4.1.
|
|
67
|
+
"zustand": "^4.1.4"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@types/react": "^18.0.0",
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
3
|
-
export declare const SelectChainPage: React.FC<
|
|
2
|
+
import type { SelectChainPageProps } from './types';
|
|
3
|
+
export declare const SelectChainPage: React.FC<SelectChainPageProps>;
|
|
@@ -10,17 +10,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { Avatar, Container, List, ListItemAvatar } from '@mui/material';
|
|
12
12
|
import { useChainSelect } from '../../components/ChainSelect';
|
|
13
|
+
import { useTokenSelect } from '../../components/TokenList';
|
|
13
14
|
import { useNavigateBack } from '../../hooks';
|
|
14
15
|
import { ListItemButton, ListItemText } from './SelectChainPage.style';
|
|
15
|
-
export const SelectChainPage = ({ formType }) => {
|
|
16
|
+
export const SelectChainPage = ({ formType, selectNativeToken, }) => {
|
|
16
17
|
const { navigateBack } = useNavigateBack();
|
|
17
18
|
const { chains, setCurrentChain } = useChainSelect(formType);
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const selectToken = useTokenSelect(formType, navigateBack);
|
|
20
|
+
const handleClick = (chain) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
if (selectNativeToken) {
|
|
22
|
+
selectToken(chain.nativeToken.address, chain.id);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
setCurrentChain(chain.id);
|
|
26
|
+
navigateBack();
|
|
27
|
+
}
|
|
21
28
|
});
|
|
22
29
|
return (_jsx(Container, Object.assign({ disableGutters: true }, { children: _jsx(List, Object.assign({ sx: {
|
|
23
30
|
paddingLeft: 1.5,
|
|
24
31
|
paddingRight: 1.5,
|
|
25
|
-
} }, { children: chains === null || chains === void 0 ? void 0 : chains.map((chain) => (_jsxs(ListItemButton, Object.assign({ onClick: () => handleClick(chain
|
|
32
|
+
} }, { children: chains === null || chains === void 0 ? void 0 : chains.map((chain) => (_jsxs(ListItemButton, Object.assign({ onClick: () => handleClick(chain), disableRipple: true }, { children: [_jsx(ListItemAvatar, { children: _jsx(Avatar, Object.assign({ src: chain.logoURI, alt: chain.name }, { children: chain.name[0] })) }), _jsx(ListItemText, { primary: chain.name })] }), chain.id))) })) })));
|
|
26
33
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -53,10 +53,12 @@ export const SwapDetailsPage = () => {
|
|
|
53
53
|
}, pb: 1 }, { children: [_jsx(Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }).format(startedAt) })), _jsx(Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(i18n.language, {
|
|
54
54
|
timeStyle: 'short',
|
|
55
55
|
}).format(startedAt) }))] })), routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route.steps.map((step, index, steps) => {
|
|
56
|
-
var _a, _b;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
var _a, _b, _c, _d, _e;
|
|
57
|
+
const fromToken = index === 0
|
|
58
|
+
? Object.assign(Object.assign({}, step.action.fromToken), { amount: step.action.fromAmount }) : undefined;
|
|
59
|
+
const toToken = index === steps.length - 1
|
|
60
|
+
? Object.assign(Object.assign({}, ((_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toToken) !== null && _b !== void 0 ? _b : (_c = step.action) === null || _c === void 0 ? void 0 : _c.toToken)), { amount: (_e = (_d = step.execution) === null || _d === void 0 ? void 0 : _d.toAmount) !== null && _e !== void 0 ? _e : step.estimate.toAmount }) : undefined;
|
|
61
|
+
return (_jsxs(Fragment, { children: [_jsx(Step, { step: step, fromToken: fromToken, toToken: toToken }), steps.length > 1 && index !== steps.length - 1 ? (_jsx(StepDivider, {})) : null] }, step.id));
|
|
60
62
|
}), _jsxs(Card, Object.assign({ mt: 2 }, { children: [_jsxs(Box, Object.assign({ sx: {
|
|
61
63
|
display: 'flex',
|
|
62
64
|
flex: 1,
|
|
@@ -76,5 +76,5 @@ export const StatusBottomSheet = ({ status, route, }) => {
|
|
|
76
76
|
(_b = ref.current) === null || _b === void 0 ? void 0 : _b.open();
|
|
77
77
|
}
|
|
78
78
|
}, [refetch, refetchNewBalance, status]);
|
|
79
|
-
return (_jsx(BottomSheet, Object.assign({ ref: ref }, { children: _jsxs(Box, Object.assign({ p: 3 }, { children: [_jsxs(IconContainer, { children: [_jsxs(IconCircle, Object.assign({ status: status, mb: 1 }, { children: [status === 'idle' ? _jsx(InfoIcon, { color: "primary" }) : null, status === 'success' ? _jsx(DoneIcon, { color: "success" }) : null, status === 'error' ? _jsx(WarningIcon, { color: "error" }) : null] })), _jsx(Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: title })), status === 'success' ? (_jsx(Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: (_g = (_e = (_d = (_c = route.steps.at(-1)) === null || _c === void 0 ? void 0 : _c.execution) === null || _d === void 0 ? void 0 : _d.toAmount) !== null && _e !== void 0 ? _e : (_f = route.steps.at(-1)) === null || _f === void 0 ? void 0 : _f.estimate.toAmount) !== null && _g !== void 0 ? _g : route.toAmount }), py: 1 })) : null] }), _jsx(Typography, Object.assign({ py: 1 }, { children: message })), _jsx(Box, Object.assign({ mt: 2 }, { children: _jsxs(Button, Object.assign({ variant: "contained", fullWidth: true, onClick: status === 'success' ? handleDone : handleClose }, { children: [status === 'idle' ? t('button.ok') : null, status === 'success' ? t('button.done') : null, status === 'error' ? t('button.seeDetails') : null] })) })), status === 'success' ? (_jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(Button, Object.assign({ variant: "text", fullWidth: true, onClick: handleSeeDetails }, { children: t('button.seeDetails') })) }))) : null] })) })));
|
|
79
|
+
return (_jsx(BottomSheet, Object.assign({ ref: ref }, { children: _jsxs(Box, Object.assign({ p: 3 }, { children: [_jsxs(IconContainer, { children: [_jsxs(IconCircle, Object.assign({ status: status, mb: 1 }, { children: [status === 'idle' ? _jsx(InfoIcon, { color: "primary" }) : null, status === 'success' ? _jsx(DoneIcon, { color: "success" }) : null, status === 'error' ? _jsx(WarningIcon, { color: "error" }) : null] })), _jsx(Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: title })), status === 'success' ? (_jsx(Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: (_g = (_e = (_d = (_c = route.steps.at(-1)) === null || _c === void 0 ? void 0 : _c.execution) === null || _d === void 0 ? void 0 : _d.toAmount) !== null && _e !== void 0 ? _e : (_f = route.steps.at(-1)) === null || _f === void 0 ? void 0 : _f.estimate.toAmount) !== null && _g !== void 0 ? _g : route.toAmount }), py: 1, disableDescription: true })) : null] }), _jsx(Typography, Object.assign({ py: 1 }, { children: message })), _jsx(Box, Object.assign({ mt: 2 }, { children: _jsxs(Button, Object.assign({ variant: "contained", fullWidth: true, onClick: status === 'success' ? handleDone : handleClose }, { children: [status === 'idle' ? t('button.ok') : null, status === 'success' ? t('button.done') : null, status === 'error' ? t('button.seeDetails') : null] })) })), status === 'success' ? (_jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(Button, Object.assign({ variant: "text", fullWidth: true, onClick: handleSeeDetails }, { children: t('button.seeDetails') })) }))) : null] })) })));
|
|
80
80
|
};
|
|
@@ -28,9 +28,7 @@ export const SwapPage = () => {
|
|
|
28
28
|
const { state } = useLocation();
|
|
29
29
|
const { navigateBack } = useNavigateBack();
|
|
30
30
|
const tokenValueBottomSheetRef = useRef(null);
|
|
31
|
-
const { setValue
|
|
32
|
-
// formState: { isValid, isValidating },
|
|
33
|
-
} = useFormContext();
|
|
31
|
+
const { setValue } = useFormContext();
|
|
34
32
|
const { route, status, executeRoute, restartRoute, deleteRoute } = useRouteExecution(state === null || state === void 0 ? void 0 : state.routeId);
|
|
35
33
|
const handleExecuteRoute = useCallback(() => {
|
|
36
34
|
var _a, _b;
|
|
@@ -70,10 +68,12 @@ export const SwapPage = () => {
|
|
|
70
68
|
}
|
|
71
69
|
};
|
|
72
70
|
return (_jsxs(Container, { children: [route === null || route === void 0 ? void 0 : route.steps.map((step, index, steps) => {
|
|
73
|
-
var _a, _b;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
var _a, _b, _c, _d, _e;
|
|
72
|
+
const fromToken = index === 0
|
|
73
|
+
? Object.assign(Object.assign({}, step.action.fromToken), { amount: step.action.fromAmount }) : undefined;
|
|
74
|
+
const toToken = index === steps.length - 1
|
|
75
|
+
? Object.assign(Object.assign({}, ((_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toToken) !== null && _b !== void 0 ? _b : (_c = step.action) === null || _c === void 0 ? void 0 : _c.toToken)), { amount: (_e = (_d = step.execution) === null || _d === void 0 ? void 0 : _d.toAmount) !== null && _e !== void 0 ? _e : step.estimate.toAmount }) : undefined;
|
|
76
|
+
return (_jsxs(Fragment, { children: [_jsx(Step, { step: step, fromToken: fromToken, toToken: toToken }), steps.length > 1 && index !== steps.length - 1 ? (_jsx(StepDivider, {})) : null] }, step.id));
|
|
77
77
|
}), status === 'idle' || status === 'error' ? (_jsxs(_Fragment, { children: [_jsx(GasSufficiencyMessage, { route: route, mt: 2 }), _jsxs(Box, Object.assign({ mt: 2, display: "flex" }, { children: [_jsx(SwapButton, { text: getSwapButtonText(), onClick: handleSwapClick, currentRoute: route,
|
|
78
78
|
// disable={status === 'idle' && (isValidating || !isValid)}
|
|
79
79
|
enableLoading: true }), status === 'error' ? (_jsx(Tooltip, Object.assign({ title: t('button.removeSwap'), placement: "bottom-end", enterDelay: 400, arrow: true }, { children: _jsx(Button, Object.assign({ onClick: handleRemoveRoute, sx: {
|