@lifi/widget 2.0.0-beta.8 → 2.0.0-beta.9
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/GasMessage/GasMessage.js +1 -6
- package/cjs/components/Insurance/InsuranceCollapsed.js +2 -8
- package/cjs/components/StepActions/StepActions.js +2 -1
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useGasSufficiency.js +10 -1
- package/cjs/hooks/useProcessMessage.js +4 -0
- package/cjs/hooks/useSwapRoutes.d.ts +1 -2
- package/cjs/hooks/useSwapRoutes.js +1 -2
- package/cjs/i18n/en.json +2 -0
- package/cjs/providers/SDKProvider/SDKProvider.js +2 -0
- package/components/GasMessage/GasMessage.js +2 -7
- package/components/Insurance/InsuranceCollapsed.js +2 -8
- package/components/StepActions/StepActions.js +2 -1
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useGasSufficiency.js +11 -2
- package/hooks/useProcessMessage.js +4 -0
- package/hooks/useSwapRoutes.d.ts +1 -2
- package/hooks/useSwapRoutes.js +1 -2
- package/i18n/en.json +2 -0
- package/package.json +5 -5
- package/providers/SDKProvider/SDKProvider.js +2 -0
- package/tsconfig.cjs.tsbuildinfo +1 -1
|
@@ -4,16 +4,11 @@ exports.GasMessage = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const hooks_1 = require("../../hooks");
|
|
7
|
-
const stores_1 = require("../../stores");
|
|
8
7
|
const FundsSufficiencyMessage_1 = require("./FundsSufficiencyMessage");
|
|
9
8
|
const GasSufficiencyMessage_1 = require("./GasSufficiencyMessage");
|
|
10
9
|
const GasMessage = ({ route, ...props }) => {
|
|
11
10
|
const { insufficientGas } = (0, hooks_1.useGasSufficiency)(route);
|
|
12
11
|
const { insufficientFunds } = (0, hooks_1.useFundsSufficiency)(route);
|
|
13
|
-
|
|
14
|
-
const { enabled, isLoading: isRefuelLoading } = (0, hooks_1.useGasRefuel)();
|
|
15
|
-
const enabledRefuel = enabled && enabledAutoRefuel;
|
|
16
|
-
const showGasSufficiencyMessage = insufficientGas?.length && !isRefuelLoading && !enabledRefuel;
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: 225, in: Boolean(insufficientFunds || showGasSufficiencyMessage), unmountOnExit: true, mountOnEnter: true, children: (0, jsx_runtime_1.jsx)(material_1.Box, { ...props, children: insufficientFunds ? ((0, jsx_runtime_1.jsx)(FundsSufficiencyMessage_1.FundsSufficiencyMessage, {})) : showGasSufficiencyMessage ? ((0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, { insufficientGas: insufficientGas })) : null }) }));
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: 225, in: Boolean(insufficientFunds || insufficientGas?.length), unmountOnExit: true, mountOnEnter: true, children: (0, jsx_runtime_1.jsx)(material_1.Box, { ...props, children: insufficientFunds ? ((0, jsx_runtime_1.jsx)(FundsSufficiencyMessage_1.FundsSufficiencyMessage, {})) : insufficientGas?.length ? ((0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, { insufficientGas: insufficientGas })) : null }) }));
|
|
18
13
|
};
|
|
19
14
|
exports.GasMessage = GasMessage;
|
|
@@ -3,22 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.InsuranceCollapsed = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
|
-
const react_1 = require("react");
|
|
7
6
|
const hooks_1 = require("../../hooks");
|
|
8
7
|
const stores_1 = require("../../stores");
|
|
9
8
|
const InsuranceCard_1 = require("./InsuranceCard");
|
|
10
9
|
const InsuranceCollapsed = ({ status, insurableRouteId, insuranceCoverageId, feeAmountUsd, onChange, ...props }) => {
|
|
11
|
-
const [insuredRoute, setInsuredRoute] = (0, react_1.useState)();
|
|
12
10
|
const setExecutableRoute = (0, stores_1.useSetExecutableRoute)();
|
|
13
11
|
const routeExecution = (0, stores_1.useRouteExecutionStore)((state) => state.routes[insurableRouteId]);
|
|
14
|
-
(0, hooks_1.useSwapRoutes)({
|
|
12
|
+
const { routes } = (0, hooks_1.useSwapRoutes)({
|
|
15
13
|
insurableRoute: routeExecution?.route,
|
|
16
|
-
onSettled(data) {
|
|
17
|
-
if (data?.routes?.[0]) {
|
|
18
|
-
setInsuredRoute(data.routes[0]);
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
14
|
});
|
|
15
|
+
const insuredRoute = routes?.[0];
|
|
22
16
|
const toggleInsurance = (checked) => {
|
|
23
17
|
if (insuredRoute) {
|
|
24
18
|
if (checked) {
|
|
@@ -55,7 +55,8 @@ const StepDetailsContent = ({ step, variant }) => {
|
|
|
55
55
|
if (sameTokenProtocolStep) {
|
|
56
56
|
fromAmount = (0, big_js_1.default)(step.estimate.fromAmount)
|
|
57
57
|
.div(10 ** step.action.fromToken.decimals)
|
|
58
|
-
.minus((0, big_js_1.default)(step.estimate.toAmount).div(10 ** step.action.toToken.decimals))
|
|
58
|
+
.minus((0, big_js_1.default)(step.estimate.toAmount).div(10 ** step.action.toToken.decimals))
|
|
59
|
+
.toString();
|
|
59
60
|
}
|
|
60
61
|
else {
|
|
61
62
|
fromAmount = (0, utils_1.formatTokenAmount)(step.estimate.fromAmount, step.action.fromToken.decimals);
|
package/cjs/config/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "2.0.0-beta.
|
|
2
|
+
export declare const version = "2.0.0-beta.9";
|
package/cjs/config/version.js
CHANGED
|
@@ -5,15 +5,23 @@ const react_query_1 = require("@tanstack/react-query");
|
|
|
5
5
|
const big_js_1 = require("big.js");
|
|
6
6
|
const _1 = require(".");
|
|
7
7
|
const providers_1 = require("../providers");
|
|
8
|
+
const stores_1 = require("../stores");
|
|
8
9
|
const refetchInterval = 30000;
|
|
9
10
|
const useGasSufficiency = (route) => {
|
|
10
11
|
const { account } = (0, providers_1.useWallet)();
|
|
11
12
|
const { getChainById } = (0, _1.useChains)();
|
|
12
13
|
const getTokenBalancesWithRetry = (0, _1.useGetTokenBalancesWithRetry)(account.signer?.provider);
|
|
14
|
+
const { enabledAutoRefuel } = (0, stores_1.useSettings)(['enabledAutoRefuel']);
|
|
15
|
+
const { enabled, isLoading: isRefuelLoading } = (0, _1.useGasRefuel)();
|
|
16
|
+
const enabledRefuel = enabled && enabledAutoRefuel;
|
|
13
17
|
const { data: insufficientGas, isInitialLoading } = (0, react_query_1.useQuery)(['gas-sufficiency-check', account.address, route?.id], async () => {
|
|
14
18
|
if (!account.address || !route) {
|
|
15
19
|
return;
|
|
16
20
|
}
|
|
21
|
+
// TODO: include LI.Fuel into calculation once steps and tools are properly typed
|
|
22
|
+
// const refuelSteps = route.steps
|
|
23
|
+
// .flatMap((step) => step.includedSteps)
|
|
24
|
+
// .filter((includedStep) => includedStep.tool === 'lifuelProtocol');
|
|
17
25
|
const gasCosts = route.steps
|
|
18
26
|
.filter((step) => !step.execution || step.execution.status !== 'DONE')
|
|
19
27
|
.reduce((groupedGasCosts, step) => {
|
|
@@ -69,8 +77,9 @@ const useGasSufficiency = (route) => {
|
|
|
69
77
|
staleTime: refetchInterval,
|
|
70
78
|
cacheTime: refetchInterval,
|
|
71
79
|
});
|
|
80
|
+
const isInsufficientGas = Boolean(insufficientGas?.length) && !isRefuelLoading && !enabledRefuel;
|
|
72
81
|
return {
|
|
73
|
-
insufficientGas,
|
|
82
|
+
insufficientGas: isInsufficientGas ? insufficientGas : undefined,
|
|
74
83
|
isInitialLoading,
|
|
75
84
|
};
|
|
76
85
|
};
|
|
@@ -103,6 +103,10 @@ function getProcessMessage(t, getChainById, step, process, variant) {
|
|
|
103
103
|
title = t(`swap.error.title.gasLimitIsTooLow`);
|
|
104
104
|
message = getTransactionNotSentMessage();
|
|
105
105
|
break;
|
|
106
|
+
case sdk_1.LifiErrorCode.InsufficientFunds:
|
|
107
|
+
title = t(`swap.error.title.insufficientFunds`);
|
|
108
|
+
message = `${t(`swap.error.message.insufficientFunds`)} ${getTransactionNotSentMessage()}`;
|
|
109
|
+
break;
|
|
106
110
|
case sdk_1.LifiErrorCode.SlippageError:
|
|
107
111
|
title = t(`swap.error.title.slippageNotMet`);
|
|
108
112
|
message = t(`swap.error.message.slippageThreshold`);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { Route, RoutesResponse } from '@lifi/sdk';
|
|
2
2
|
interface SwapRoutesProps {
|
|
3
|
-
onSettled?: (data?: RoutesResponse) => void;
|
|
4
3
|
insurableRoute?: Route;
|
|
5
4
|
}
|
|
6
|
-
export declare const useSwapRoutes: ({
|
|
5
|
+
export declare const useSwapRoutes: ({ insurableRoute }?: SwapRoutesProps) => {
|
|
7
6
|
routes: Route[] | undefined;
|
|
8
7
|
isLoading: boolean;
|
|
9
8
|
isFetching: boolean;
|
|
@@ -12,7 +12,7 @@ const providers_1 = require("../providers");
|
|
|
12
12
|
const stores_1 = require("../stores");
|
|
13
13
|
const useSwapOnly_1 = require("./useSwapOnly");
|
|
14
14
|
const refetchTime = 60000;
|
|
15
|
-
const useSwapRoutes = ({
|
|
15
|
+
const useSwapRoutes = ({ insurableRoute } = {}) => {
|
|
16
16
|
const lifi = (0, providers_1.useLiFi)();
|
|
17
17
|
const { variant, sdkConfig, insurance, contractTool } = (0, providers_1.useWidgetConfig)();
|
|
18
18
|
const { account } = (0, providers_1.useWallet)();
|
|
@@ -207,7 +207,6 @@ const useSwapRoutes = ({ onSettled, insurableRoute, } = {}) => {
|
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
},
|
|
210
|
-
onSettled,
|
|
211
210
|
});
|
|
212
211
|
return {
|
|
213
212
|
routes: data?.routes,
|
package/cjs/i18n/en.json
CHANGED
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
"error": {
|
|
84
84
|
"message": {
|
|
85
85
|
"allowanceRequired": "Transfer amount for {{tokenSymbol}} exceeds your current allowance. Please increase your allowance and try again.",
|
|
86
|
+
"insufficientFunds": "You don't have enough gas to cover the cost of the transaction.",
|
|
86
87
|
"slippageThreshold": "The slippage is larger than the defined threshold. Please request a new route to get a fresh quote.",
|
|
87
88
|
"transactionFailed": "Please check the block explorer for more information.",
|
|
88
89
|
"transactionNotSent": "Transaction was not sent. {{amount, number(maximumFractionDigits: 9)}} {{tokenSymbol}} on {{chainName}} remain in your wallet.",
|
|
@@ -95,6 +96,7 @@
|
|
|
95
96
|
"chainSwitch": "Chain switch required",
|
|
96
97
|
"failed": "Swap failed",
|
|
97
98
|
"gasLimitIsTooLow": "The gas limit is too low",
|
|
99
|
+
"insufficientFunds": "Insufficient funds",
|
|
98
100
|
"slippageNotMet": "Slippage conditions not met",
|
|
99
101
|
"transactionCanceled": "Transaction canceled",
|
|
100
102
|
"transactionFailed": "Transaction failed",
|
|
@@ -4,6 +4,7 @@ exports.SDKProvider = exports.useLiFi = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const sdk_1 = require("@lifi/sdk");
|
|
6
6
|
const react_1 = require("react");
|
|
7
|
+
const version_1 = require("../../config/version");
|
|
7
8
|
const WidgetProvider_1 = require("../WidgetProvider");
|
|
8
9
|
let lifi;
|
|
9
10
|
const SDKContext = (0, react_1.createContext)(null);
|
|
@@ -27,6 +28,7 @@ const SDKProvider = ({ children, }) => {
|
|
|
27
28
|
if (!lifi) {
|
|
28
29
|
lifi = new sdk_1.LiFi({
|
|
29
30
|
disableVersionCheck: true,
|
|
31
|
+
widgetVersion: version_1.version,
|
|
30
32
|
...config,
|
|
31
33
|
});
|
|
32
34
|
}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Collapse } from '@mui/material';
|
|
3
|
-
import { useFundsSufficiency,
|
|
4
|
-
import { useSettings } from '../../stores';
|
|
3
|
+
import { useFundsSufficiency, useGasSufficiency } from '../../hooks';
|
|
5
4
|
import { FundsSufficiencyMessage } from './FundsSufficiencyMessage';
|
|
6
5
|
import { GasSufficiencyMessage } from './GasSufficiencyMessage';
|
|
7
6
|
export const GasMessage = ({ route, ...props }) => {
|
|
8
7
|
const { insufficientGas } = useGasSufficiency(route);
|
|
9
8
|
const { insufficientFunds } = useFundsSufficiency(route);
|
|
10
|
-
|
|
11
|
-
const { enabled, isLoading: isRefuelLoading } = useGasRefuel();
|
|
12
|
-
const enabledRefuel = enabled && enabledAutoRefuel;
|
|
13
|
-
const showGasSufficiencyMessage = insufficientGas?.length && !isRefuelLoading && !enabledRefuel;
|
|
14
|
-
return (_jsx(Collapse, { timeout: 225, in: Boolean(insufficientFunds || showGasSufficiencyMessage), unmountOnExit: true, mountOnEnter: true, children: _jsx(Box, { ...props, children: insufficientFunds ? (_jsx(FundsSufficiencyMessage, {})) : showGasSufficiencyMessage ? (_jsx(GasSufficiencyMessage, { insufficientGas: insufficientGas })) : null }) }));
|
|
9
|
+
return (_jsx(Collapse, { timeout: 225, in: Boolean(insufficientFunds || insufficientGas?.length), unmountOnExit: true, mountOnEnter: true, children: _jsx(Box, { ...props, children: insufficientFunds ? (_jsx(FundsSufficiencyMessage, {})) : insufficientGas?.length ? (_jsx(GasSufficiencyMessage, { insufficientGas: insufficientGas })) : null }) }));
|
|
15
10
|
};
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Collapse } from '@mui/material';
|
|
3
|
-
import { useState } from 'react';
|
|
4
3
|
import { useSwapRoutes } from '../../hooks';
|
|
5
4
|
import { RouteExecutionStatus, useRouteExecutionStore, useSetExecutableRoute, } from '../../stores';
|
|
6
5
|
import { InsuranceCard } from './InsuranceCard';
|
|
7
6
|
export const InsuranceCollapsed = ({ status, insurableRouteId, insuranceCoverageId, feeAmountUsd, onChange, ...props }) => {
|
|
8
|
-
const [insuredRoute, setInsuredRoute] = useState();
|
|
9
7
|
const setExecutableRoute = useSetExecutableRoute();
|
|
10
8
|
const routeExecution = useRouteExecutionStore((state) => state.routes[insurableRouteId]);
|
|
11
|
-
useSwapRoutes({
|
|
9
|
+
const { routes } = useSwapRoutes({
|
|
12
10
|
insurableRoute: routeExecution?.route,
|
|
13
|
-
onSettled(data) {
|
|
14
|
-
if (data?.routes?.[0]) {
|
|
15
|
-
setInsuredRoute(data.routes[0]);
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
11
|
});
|
|
12
|
+
const insuredRoute = routes?.[0];
|
|
19
13
|
const toggleInsurance = (checked) => {
|
|
20
14
|
if (insuredRoute) {
|
|
21
15
|
if (checked) {
|
|
@@ -50,7 +50,8 @@ export const StepDetailsContent = ({ step, variant }) => {
|
|
|
50
50
|
if (sameTokenProtocolStep) {
|
|
51
51
|
fromAmount = Big(step.estimate.fromAmount)
|
|
52
52
|
.div(10 ** step.action.fromToken.decimals)
|
|
53
|
-
.minus(Big(step.estimate.toAmount).div(10 ** step.action.toToken.decimals))
|
|
53
|
+
.minus(Big(step.estimate.toAmount).div(10 ** step.action.toToken.decimals))
|
|
54
|
+
.toString();
|
|
54
55
|
}
|
|
55
56
|
else {
|
|
56
57
|
fromAmount = formatTokenAmount(step.estimate.fromAmount, step.action.fromToken.decimals);
|
package/config/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "2.0.0-beta.
|
|
2
|
+
export declare const version = "2.0.0-beta.9";
|
package/config/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget';
|
|
2
|
-
export const version = '2.0.0-beta.
|
|
2
|
+
export const version = '2.0.0-beta.9';
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import Big from 'big.js';
|
|
3
|
-
import { useChains, useGetTokenBalancesWithRetry } from '.';
|
|
3
|
+
import { useChains, useGasRefuel, useGetTokenBalancesWithRetry } from '.';
|
|
4
4
|
import { useWallet } from '../providers';
|
|
5
|
+
import { useSettings } from '../stores';
|
|
5
6
|
const refetchInterval = 30000;
|
|
6
7
|
export const useGasSufficiency = (route) => {
|
|
7
8
|
const { account } = useWallet();
|
|
8
9
|
const { getChainById } = useChains();
|
|
9
10
|
const getTokenBalancesWithRetry = useGetTokenBalancesWithRetry(account.signer?.provider);
|
|
11
|
+
const { enabledAutoRefuel } = useSettings(['enabledAutoRefuel']);
|
|
12
|
+
const { enabled, isLoading: isRefuelLoading } = useGasRefuel();
|
|
13
|
+
const enabledRefuel = enabled && enabledAutoRefuel;
|
|
10
14
|
const { data: insufficientGas, isInitialLoading } = useQuery(['gas-sufficiency-check', account.address, route?.id], async () => {
|
|
11
15
|
if (!account.address || !route) {
|
|
12
16
|
return;
|
|
13
17
|
}
|
|
18
|
+
// TODO: include LI.Fuel into calculation once steps and tools are properly typed
|
|
19
|
+
// const refuelSteps = route.steps
|
|
20
|
+
// .flatMap((step) => step.includedSteps)
|
|
21
|
+
// .filter((includedStep) => includedStep.tool === 'lifuelProtocol');
|
|
14
22
|
const gasCosts = route.steps
|
|
15
23
|
.filter((step) => !step.execution || step.execution.status !== 'DONE')
|
|
16
24
|
.reduce((groupedGasCosts, step) => {
|
|
@@ -66,8 +74,9 @@ export const useGasSufficiency = (route) => {
|
|
|
66
74
|
staleTime: refetchInterval,
|
|
67
75
|
cacheTime: refetchInterval,
|
|
68
76
|
});
|
|
77
|
+
const isInsufficientGas = Boolean(insufficientGas?.length) && !isRefuelLoading && !enabledRefuel;
|
|
69
78
|
return {
|
|
70
|
-
insufficientGas,
|
|
79
|
+
insufficientGas: isInsufficientGas ? insufficientGas : undefined,
|
|
71
80
|
isInitialLoading,
|
|
72
81
|
};
|
|
73
82
|
};
|
|
@@ -99,6 +99,10 @@ export function getProcessMessage(t, getChainById, step, process, variant) {
|
|
|
99
99
|
title = t(`swap.error.title.gasLimitIsTooLow`);
|
|
100
100
|
message = getTransactionNotSentMessage();
|
|
101
101
|
break;
|
|
102
|
+
case LifiErrorCode.InsufficientFunds:
|
|
103
|
+
title = t(`swap.error.title.insufficientFunds`);
|
|
104
|
+
message = `${t(`swap.error.message.insufficientFunds`)} ${getTransactionNotSentMessage()}`;
|
|
105
|
+
break;
|
|
102
106
|
case LifiErrorCode.SlippageError:
|
|
103
107
|
title = t(`swap.error.title.slippageNotMet`);
|
|
104
108
|
message = t(`swap.error.message.slippageThreshold`);
|
package/hooks/useSwapRoutes.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { Route, RoutesResponse } from '@lifi/sdk';
|
|
2
2
|
interface SwapRoutesProps {
|
|
3
|
-
onSettled?: (data?: RoutesResponse) => void;
|
|
4
3
|
insurableRoute?: Route;
|
|
5
4
|
}
|
|
6
|
-
export declare const useSwapRoutes: ({
|
|
5
|
+
export declare const useSwapRoutes: ({ insurableRoute }?: SwapRoutesProps) => {
|
|
7
6
|
routes: Route[] | undefined;
|
|
8
7
|
isLoading: boolean;
|
|
9
8
|
isFetching: boolean;
|
package/hooks/useSwapRoutes.js
CHANGED
|
@@ -9,7 +9,7 @@ import { SwapFormKey, useLiFi, useWallet, useWidgetConfig } from '../providers';
|
|
|
9
9
|
import { useSettings } from '../stores';
|
|
10
10
|
import { useSwapOnly } from './useSwapOnly';
|
|
11
11
|
const refetchTime = 60000;
|
|
12
|
-
export const useSwapRoutes = ({
|
|
12
|
+
export const useSwapRoutes = ({ insurableRoute } = {}) => {
|
|
13
13
|
const lifi = useLiFi();
|
|
14
14
|
const { variant, sdkConfig, insurance, contractTool } = useWidgetConfig();
|
|
15
15
|
const { account } = useWallet();
|
|
@@ -204,7 +204,6 @@ export const useSwapRoutes = ({ onSettled, insurableRoute, } = {}) => {
|
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
},
|
|
207
|
-
onSettled,
|
|
208
207
|
});
|
|
209
208
|
return {
|
|
210
209
|
routes: data?.routes,
|
package/i18n/en.json
CHANGED
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
"error": {
|
|
84
84
|
"message": {
|
|
85
85
|
"allowanceRequired": "Transfer amount for {{tokenSymbol}} exceeds your current allowance. Please increase your allowance and try again.",
|
|
86
|
+
"insufficientFunds": "You don't have enough gas to cover the cost of the transaction.",
|
|
86
87
|
"slippageThreshold": "The slippage is larger than the defined threshold. Please request a new route to get a fresh quote.",
|
|
87
88
|
"transactionFailed": "Please check the block explorer for more information.",
|
|
88
89
|
"transactionNotSent": "Transaction was not sent. {{amount, number(maximumFractionDigits: 9)}} {{tokenSymbol}} on {{chainName}} remain in your wallet.",
|
|
@@ -95,6 +96,7 @@
|
|
|
95
96
|
"chainSwitch": "Chain switch required",
|
|
96
97
|
"failed": "Swap failed",
|
|
97
98
|
"gasLimitIsTooLow": "The gas limit is too low",
|
|
99
|
+
"insufficientFunds": "Insufficient funds",
|
|
98
100
|
"slippageNotMet": "Slippage conditions not met",
|
|
99
101
|
"transactionCanceled": "Transaction canceled",
|
|
100
102
|
"transactionFailed": "Transaction failed",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.9",
|
|
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,12 +43,12 @@
|
|
|
43
43
|
"@ethersproject/address": "^5.7.0",
|
|
44
44
|
"@ethersproject/experimental": "^5.7.0",
|
|
45
45
|
"@ethersproject/providers": "^5.7.2",
|
|
46
|
-
"@lifi/sdk": "^2.0.0-beta.
|
|
47
|
-
"@lifi/wallet-management": "^2.0.0-beta.
|
|
46
|
+
"@lifi/sdk": "^2.0.0-beta.13",
|
|
47
|
+
"@lifi/wallet-management": "^2.0.0-beta.7",
|
|
48
48
|
"@mui/icons-material": "^5.11.16",
|
|
49
49
|
"@mui/lab": "^5.0.0-alpha.129",
|
|
50
50
|
"@mui/material": "^5.13.0",
|
|
51
|
-
"@tanstack/react-query": "^4.29.
|
|
51
|
+
"@tanstack/react-query": "^4.29.7",
|
|
52
52
|
"@tanstack/react-virtual": "^3.0.0-beta.54",
|
|
53
53
|
"big.js": "^6.2.1",
|
|
54
54
|
"i18next": "^22.4.15",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"react-i18next": "^12.2.2",
|
|
62
62
|
"react-intersection-observer": "^9.4.3",
|
|
63
63
|
"react-router-dom": "^6.11.1",
|
|
64
|
-
"react-timer-hook": "^3.0.
|
|
64
|
+
"react-timer-hook": "^3.0.6",
|
|
65
65
|
"uuid": "^9.0.0",
|
|
66
66
|
"zustand": "^4.3.8"
|
|
67
67
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { LiFi } from '@lifi/sdk';
|
|
3
3
|
import { createContext, useContext, useMemo } from 'react';
|
|
4
|
+
import { version } from '../../config/version';
|
|
4
5
|
import { useWidgetConfig } from '../WidgetProvider';
|
|
5
6
|
let lifi;
|
|
6
7
|
const SDKContext = createContext(null);
|
|
@@ -23,6 +24,7 @@ export const SDKProvider = ({ children, }) => {
|
|
|
23
24
|
if (!lifi) {
|
|
24
25
|
lifi = new LiFi({
|
|
25
26
|
disableVersionCheck: true,
|
|
27
|
+
widgetVersion: version,
|
|
26
28
|
...config,
|
|
27
29
|
});
|
|
28
30
|
}
|