@lifi/widget 1.29.5 → 1.30.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/cjs/components/Card/CardTitle.d.ts +3 -1
- package/cjs/components/Card/CardTitle.js +7 -1
- package/cjs/components/ChainSelect/ChainSelect.d.ts +1 -0
- package/cjs/components/Header/WalletHeader.js +2 -2
- package/cjs/components/SendToWallet/SendToWallet.js +18 -10
- package/cjs/components/SendToWallet/SendToWalletButton.js +3 -2
- package/cjs/components/Step/CircularProgress.d.ts +1 -0
- package/cjs/components/Step/StepList.d.ts +1 -0
- package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +1 -0
- package/cjs/components/SwapRoutes/SwapRoutes.js +1 -1
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +1 -0
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +1 -1
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/i18n/en.json +1 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/cjs/pages/MainPage/MainSwapButton.js +1 -1
- 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/SwapPage/ExchangeRateBottomSheet.js +2 -2
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
- package/cjs/providers/SwapFormProvider/FormUpdater.js +2 -0
- package/cjs/providers/SwapFormProvider/SwapFormProvider.d.ts +5 -0
- package/cjs/providers/SwapFormProvider/SwapFormProvider.js +6 -3
- package/cjs/types/widget.d.ts +5 -0
- package/cjs/types/widget.js +5 -1
- package/cjs/utils/format.d.ts +1 -1
- package/cjs/utils/format.js +1 -2
- package/components/Card/CardTitle.d.ts +3 -1
- package/components/Card/CardTitle.js +7 -1
- package/components/ChainSelect/ChainSelect.d.ts +1 -0
- package/components/Header/WalletHeader.js +2 -2
- package/components/SendToWallet/SendToWallet.js +18 -10
- package/components/SendToWallet/SendToWalletButton.js +3 -2
- package/components/Step/CircularProgress.d.ts +1 -0
- package/components/Step/StepList.d.ts +1 -0
- package/components/SwapInput/SwapInputEndAdornment.d.ts +1 -0
- package/components/SwapRoutes/SwapRoutes.js +1 -1
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +1 -0
- package/components/SwapRoutes/SwapRoutesExpanded.js +1 -1
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/i18n/en.json +1 -0
- package/package.json +11 -11
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/pages/MainPage/MainSwapButton.js +1 -1
- 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/SwapPage/ExchangeRateBottomSheet.js +2 -2
- package/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
- package/providers/SwapFormProvider/FormUpdater.js +2 -0
- package/providers/SwapFormProvider/SwapFormProvider.d.ts +5 -0
- package/providers/SwapFormProvider/SwapFormProvider.js +6 -3
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/widget.d.ts +5 -0
- package/types/widget.js +4 -0
- package/utils/format.d.ts +1 -1
- package/utils/format.js +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.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",
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"@ethersproject/experimental": "^5.7.0",
|
|
45
45
|
"@ethersproject/providers": "^5.7.2",
|
|
46
46
|
"@lifi/sdk": "^1.7.2",
|
|
47
|
-
"@lifi/wallet-management": "^1.2.
|
|
47
|
+
"@lifi/wallet-management": "^1.2.6",
|
|
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.
|
|
55
|
-
"@tanstack/react-virtual": "^3.0.0-beta.
|
|
49
|
+
"@mui/lab": "^5.0.0-alpha.118",
|
|
50
|
+
"@mui/material": "^5.11.7",
|
|
51
|
+
"@sentry/integrations": "^7.35.0",
|
|
52
|
+
"@sentry/react": "^7.35.0",
|
|
53
|
+
"@sentry/tracing": "^7.35.0",
|
|
54
|
+
"@tanstack/react-query": "^4.24.4",
|
|
55
|
+
"@tanstack/react-virtual": "^3.0.0-beta.41",
|
|
56
56
|
"big.js": "^6.2.1",
|
|
57
57
|
"i18next": "^22.4.9",
|
|
58
58
|
"i18next-browser-languagedetector": "^7.0.1",
|
|
@@ -60,9 +60,9 @@
|
|
|
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.43.0",
|
|
64
64
|
"react-i18next": "^12.1.4",
|
|
65
|
-
"react-router-dom": "^6.
|
|
65
|
+
"react-router-dom": "^6.8.0",
|
|
66
66
|
"react-timer-hook": "^3.0.5",
|
|
67
67
|
"uuid": "^9.0.0",
|
|
68
68
|
"zustand": "^4.3.2"
|
|
@@ -28,5 +28,5 @@ export const MainSwapButton = () => {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
return (_jsx(SwapButton, { onClick: handleClick, currentRoute: currentRoute, disabled: isLoading || isFetching || isValidating || !isValid }));
|
|
31
|
+
return (_jsx(SwapButton, { onClick: handleClick, currentRoute: currentRoute, disabled: currentRoute && (isLoading || isFetching || isValidating || !isValid) }));
|
|
32
32
|
};
|
|
@@ -50,9 +50,9 @@ const ExchangeRateBottomSheetContent = ({ data, onCancel, onContinue }) => {
|
|
|
50
50
|
const ref = useRef();
|
|
51
51
|
useSetContentHeight(ref);
|
|
52
52
|
return (_jsxs(Box, Object.assign({ p: 3, ref: ref }, { children: [_jsxs(IconContainer, { children: [_jsx(IconCircle, Object.assign({ status: "warning", mb: 1 }, { children: _jsx(WarningIcon, { color: "warning" }) })), _jsx(Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: t('swap.warning.title.rateChanged') }))] }), _jsx(Typography, Object.assign({ py: 1 }, { children: t('swap.warning.message.rateChanged') })), _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 1 }, { children: [_jsx(Typography, { children: t('swap.quotedAmount') }), _jsxs(Typography, Object.assign({ fontWeight: 600 }, { children: [t('format.number', {
|
|
53
|
-
value: formatTokenAmount(data === null || data === void 0 ? void 0 : data.oldToAmount, data === null || data === void 0 ? void 0 : data.toToken.decimals),
|
|
53
|
+
value: formatTokenAmount(data === null || data === void 0 ? void 0 : data.oldToAmount, data === null || data === void 0 ? void 0 : data.toToken.decimals, 5),
|
|
54
54
|
}), ' ', data === null || data === void 0 ? void 0 : data.toToken.symbol] }))] })), _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 0.25 }, { children: [_jsx(Typography, { children: t('swap.currentAmount') }), _jsxs(Typography, Object.assign({ fontWeight: 600 }, { children: [t('format.number', {
|
|
55
|
-
value: formatTokenAmount(data === null || data === void 0 ? void 0 : data.newToAmount, data === null || data === void 0 ? void 0 : data.toToken.decimals),
|
|
55
|
+
value: formatTokenAmount(data === null || data === void 0 ? void 0 : data.newToAmount, data === null || data === void 0 ? void 0 : data.toToken.decimals, 5),
|
|
56
56
|
}), ' ', data === null || data === void 0 ? void 0 : data.toToken.symbol] }))] })), _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 0.25 }, { children: [_jsx(Typography, { children: t('swap.rateChange') }), _jsxs(Typography, Object.assign({ fontWeight: 600 }, { children: [Big((data === null || data === void 0 ? void 0 : data.newToAmount) || 0)
|
|
57
57
|
.div(Big((data === null || data === void 0 ? void 0 : data.oldToAmount) || 0))
|
|
58
58
|
.minus(1)
|
|
@@ -30,5 +30,5 @@ export const SwapRoutesPage = () => {
|
|
|
30
30
|
.setAction(_jsx(ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 }, size: "medium", edge: "end" }));
|
|
31
31
|
}, [dataUpdatedAt, isFetching, refetch, refetchTime]);
|
|
32
32
|
const routeNotFound = !(swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.length) && !isLoading && !isFetching;
|
|
33
|
-
return (_jsx(Stack, Object.assign({ direction: "column", spacing: 2, flex: 1 }, { children: routeNotFound ? (_jsx(SwapRouteNotFoundCard, {})) : isLoading
|
|
33
|
+
return (_jsx(Stack, Object.assign({ direction: "column", spacing: 2, flex: 1 }, { children: routeNotFound ? (_jsx(SwapRouteNotFoundCard, {})) : isLoading ? (Array.from({ length: 3 }).map((_, index) => (_jsx(SwapRouteCardSkeleton, {}, index)))) : (swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.map((route, index) => (_jsx(SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0 }, route.id)))) })));
|
|
34
34
|
};
|
|
@@ -44,6 +44,8 @@ export const FormUpdater = ({ defaultValues }) => {
|
|
|
44
44
|
setValue,
|
|
45
45
|
toChain,
|
|
46
46
|
]);
|
|
47
|
+
// Makes widget config options reactive to changes
|
|
48
|
+
// Acts similar to values property from useForm, but includes additional logic for chains
|
|
47
49
|
useEffect(() => {
|
|
48
50
|
Object.keys(defaultValues).forEach((key) => {
|
|
49
51
|
if (previousDefaultValues.current[key] !== defaultValues[key]) {
|
|
@@ -3,5 +3,10 @@ export declare const formDefaultValues: {
|
|
|
3
3
|
fromAmount: string;
|
|
4
4
|
toAddress: string;
|
|
5
5
|
tokenSearchFilter: string;
|
|
6
|
+
contractOutputsToken: string;
|
|
7
|
+
toContractAddress: string;
|
|
8
|
+
toContractCallData: string;
|
|
9
|
+
ToContractGasLimit: string;
|
|
10
|
+
toAmount: string;
|
|
6
11
|
};
|
|
7
12
|
export declare const SwapFormProvider: React.FC<React.PropsWithChildren<{}>>;
|
|
@@ -9,6 +9,11 @@ export const formDefaultValues = {
|
|
|
9
9
|
[SwapFormKey.FromAmount]: '',
|
|
10
10
|
[SwapFormKey.ToAddress]: '',
|
|
11
11
|
[SwapFormKey.TokenSearchFilter]: '',
|
|
12
|
+
[SwapFormKey.ContractOutputsToken]: '',
|
|
13
|
+
[SwapFormKey.ToContractAddress]: '',
|
|
14
|
+
[SwapFormKey.ToContractCallData]: '',
|
|
15
|
+
[SwapFormKey.ToContractGasLimit]: '',
|
|
16
|
+
[SwapFormKey.ToAmount]: '',
|
|
12
17
|
};
|
|
13
18
|
export const SwapFormProvider = ({ children, }) => {
|
|
14
19
|
const { fromChain, fromToken, fromAmount, toChain, toToken, toAddress, buildSwapUrl, } = useWidgetConfig();
|
|
@@ -16,10 +21,8 @@ export const SwapFormProvider = ({ children, }) => {
|
|
|
16
21
|
fromToken, fromAmount: (typeof fromAmount === 'number'
|
|
17
22
|
? fromAmount === null || fromAmount === void 0 ? void 0 : fromAmount.toPrecision()
|
|
18
23
|
: fromAmount) || formDefaultValues.fromAmount, toChain,
|
|
19
|
-
toToken,
|
|
20
|
-
toAddress })), [fromAmount, fromChain, fromToken, toAddress, toChain, toToken]);
|
|
24
|
+
toToken, toAddress: toAddress || formDefaultValues.toAddress })), [fromAmount, fromChain, fromToken, toAddress, toChain, toToken]);
|
|
21
25
|
const methods = useForm({
|
|
22
|
-
// TODO: revisit after RHF release values support
|
|
23
26
|
// values,
|
|
24
27
|
defaultValues,
|
|
25
28
|
});
|