@lifi/widget 1.17.1 → 1.17.2
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/ChainSelect/ChainSelect.d.ts +0 -1
- package/cjs/components/Header/useHeaderActionStore.js +1 -4
- package/cjs/components/Step/CircularProgress.d.ts +0 -1
- package/cjs/components/SwapButton/ButtonTooltip.d.ts +0 -1
- package/cjs/components/SwapInput/SwapInputAdornment.d.ts +0 -1
- package/cjs/components/TokenList/TokenList.js +4 -1
- package/cjs/config/sentry.js +3 -26
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useGasSufficiency.js +14 -37
- package/cjs/hooks/useRouteExecution.js +1 -4
- package/cjs/hooks/useSwapRoutes.js +1 -4
- package/cjs/hooks/useTelemetry.js +3 -2
- package/cjs/hooks/useTokenBalances.d.ts +1 -1
- package/cjs/hooks/useTokenBalances.js +3 -1
- package/cjs/hooks/useWidgetEvents.js +2 -5
- package/cjs/i18n/index.js +2 -5
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
- package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +0 -1
- package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +1 -4
- package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +1 -4
- 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/SwapDetailsPage/SwapDetailsPage.js +1 -4
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +2 -4
- package/cjs/providers/SDKProvider/SDKProvider.js +1 -4
- package/cjs/stores/chains/useChainOrder.js +1 -4
- package/cjs/stores/chains/useChainOrderStore.js +1 -4
- package/cjs/stores/route/useExecutingRoutesIds.js +1 -4
- package/cjs/stores/route/useRouteStore.js +1 -4
- package/cjs/stores/route/useSwapHistory.js +1 -4
- package/cjs/stores/route/utils.js +1 -4
- package/cjs/stores/settings/useAppearance.js +1 -4
- package/cjs/stores/settings/useSettings.js +1 -4
- package/cjs/stores/settings/useSettingsStore.js +1 -4
- package/cjs/utils/format.js +1 -4
- package/components/ChainSelect/ChainSelect.d.ts +0 -1
- package/components/Step/CircularProgress.d.ts +0 -1
- package/components/SwapButton/ButtonTooltip.d.ts +0 -1
- package/components/SwapInput/SwapInputAdornment.d.ts +0 -1
- package/components/TokenList/TokenList.js +4 -1
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useGasSufficiency.js +15 -35
- package/hooks/useTelemetry.js +3 -2
- package/hooks/useTokenBalances.d.ts +1 -1
- package/hooks/useTokenBalances.js +3 -1
- package/package.json +5 -5
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
- package/pages/SettingsPage/AdvancedPreferences.d.ts +0 -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/SwapRoutesPage/SwapRoutesPage.js +3 -5
- package/tsconfig.cjs.tsbuildinfo +1 -1
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useHeaderActionStore = void 0;
|
|
7
4
|
/* eslint-disable no-underscore-dangle */
|
|
8
|
-
const zustand_1 =
|
|
5
|
+
const zustand_1 = require("zustand");
|
|
9
6
|
const immer_1 = require("zustand/middleware/immer");
|
|
10
7
|
exports.useHeaderActionStore = (0, zustand_1.default)()((0, immer_1.immer)((set, get) => ({
|
|
11
8
|
setAction: (element) => {
|
|
@@ -26,7 +26,10 @@ const TokenList = ({ formType, height, onClick, }) => {
|
|
|
26
26
|
token.symbol.toUpperCase().includes(searchFilter) ||
|
|
27
27
|
token.address.toUpperCase().includes(searchFilter))
|
|
28
28
|
: filteredTokens;
|
|
29
|
-
const tokenSearchEnabled = !
|
|
29
|
+
const tokenSearchEnabled = !isTokensLoading &&
|
|
30
|
+
!!filteredTokens.length &&
|
|
31
|
+
!!tokenSearchFilter &&
|
|
32
|
+
!!selectedChainId;
|
|
30
33
|
const { token: searchedToken, isLoading: isSearchedTokenLoading } = (0, hooks_1.useTokenSearch)(tokenSearchFilter, selectedChainId, tokenSearchEnabled);
|
|
31
34
|
const isLoading = isTokensLoading || (tokenSearchEnabled && isSearchedTokenLoading);
|
|
32
35
|
const tokens = filteredTokens.length
|
package/cjs/config/sentry.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -41,9 +18,9 @@ const initSentry = (enabled) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
41
18
|
}
|
|
42
19
|
if (enabled || sentryLoaded) {
|
|
43
20
|
const [Sentry, { CaptureConsole }, { BrowserTracing }] = yield Promise.all([
|
|
44
|
-
Promise.resolve().then(() =>
|
|
45
|
-
Promise.resolve().then(() =>
|
|
46
|
-
Promise.resolve().then(() =>
|
|
21
|
+
Promise.resolve().then(() => require('@sentry/react')),
|
|
22
|
+
Promise.resolve().then(() => require('@sentry/integrations')),
|
|
23
|
+
Promise.resolve().then(() => require('@sentry/tracing')),
|
|
47
24
|
]);
|
|
48
25
|
Sentry.init({
|
|
49
26
|
dsn: 'https://bc1312161bf948db9b9c82618035ec22@o1302189.ingest.sentry.io/6539228',
|
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.17.
|
|
2
|
+
export declare const version = "1.17.2";
|
package/cjs/config/version.js
CHANGED
|
@@ -8,34 +8,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.useGasSufficiency = void 0;
|
|
16
|
-
const big_js_1 =
|
|
13
|
+
const big_js_1 = require("big.js");
|
|
17
14
|
const react_1 = require("react");
|
|
18
|
-
const react_hook_form_1 = require("react-hook-form");
|
|
19
15
|
const _1 = require(".");
|
|
20
16
|
const providers_1 = require("../providers");
|
|
21
17
|
const useTokenBalances_1 = require("./useTokenBalances");
|
|
22
18
|
const useGasSufficiency = (route) => {
|
|
23
19
|
const lifi = (0, providers_1.useLiFi)();
|
|
24
20
|
const { account } = (0, providers_1.useWallet)();
|
|
25
|
-
const [fromChainId, toChainId, fromToken] = (0, react_hook_form_1.useWatch)({
|
|
26
|
-
name: [
|
|
27
|
-
providers_1.SwapFormKeyHelper.getChainKey('from'),
|
|
28
|
-
providers_1.SwapFormKeyHelper.getChainKey('to'),
|
|
29
|
-
providers_1.SwapFormKey.FromToken,
|
|
30
|
-
],
|
|
31
|
-
});
|
|
32
|
-
const fromAmount = (0, _1.useDebouncedWatch)(providers_1.SwapFormKey.FromAmount, 250);
|
|
33
21
|
const { getChainById } = (0, _1.useChains)();
|
|
34
|
-
const { tokensWithBalance: fromChainTokenBalances } = (0, useTokenBalances_1.useTokenBalances)(fromChainId);
|
|
22
|
+
const { tokensWithBalance: fromChainTokenBalances } = (0, useTokenBalances_1.useTokenBalances)(route === null || route === void 0 ? void 0 : route.fromChainId);
|
|
35
23
|
const [insufficientGas, setInsufficientGas] = (0, react_1.useState)();
|
|
36
24
|
const checkInsufficientGas = (0, react_1.useCallback)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
-
var _a;
|
|
38
|
-
if (!account.isActive || !route
|
|
25
|
+
var _a, _b;
|
|
26
|
+
if (!account.isActive || !route) {
|
|
39
27
|
setInsufficientGas(undefined);
|
|
40
28
|
return;
|
|
41
29
|
}
|
|
@@ -59,16 +47,15 @@ const useGasSufficiency = (route) => {
|
|
|
59
47
|
}
|
|
60
48
|
return groupedGasCosts;
|
|
61
49
|
}, {});
|
|
62
|
-
if (gasCosts[fromChainId]
|
|
63
|
-
route.
|
|
64
|
-
gasCosts[fromChainId].tokenAmount = (_a = gasCosts[fromChainId]) === null || _a === void 0 ? void 0 : _a.gasAmount.plus((0, big_js_1.default)(fromAmount));
|
|
50
|
+
if (route.fromToken.address === ((_a = gasCosts[route.fromChainId]) === null || _a === void 0 ? void 0 : _a.token.address)) {
|
|
51
|
+
gasCosts[route.fromChainId].tokenAmount = (_b = gasCosts[route.fromChainId]) === null || _b === void 0 ? void 0 : _b.gasAmount.plus((0, big_js_1.default)(route.fromAmount).div(Math.pow(10, route.fromToken.decimals)));
|
|
65
52
|
}
|
|
66
53
|
const tokenBalances = yield lifi.getTokenBalances(account.address, Object.values(gasCosts).map((item) => item.token));
|
|
67
54
|
if (!(tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.length)) {
|
|
68
55
|
setInsufficientGas(undefined);
|
|
69
56
|
return;
|
|
70
57
|
}
|
|
71
|
-
[fromChainId, toChainId].forEach((chainId) => {
|
|
58
|
+
[route.fromChainId, route.toChainId].forEach((chainId) => {
|
|
72
59
|
var _a, _b, _c, _d, _e, _f;
|
|
73
60
|
if (gasCosts[chainId]) {
|
|
74
61
|
const gasTokenBalance = (0, big_js_1.default)((_b = (_a = tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.find((t) => t.chainId === gasCosts[chainId].token.chainId &&
|
|
@@ -84,27 +71,17 @@ const useGasSufficiency = (route) => {
|
|
|
84
71
|
});
|
|
85
72
|
const gasCostResult = Object.values(gasCosts).filter((gasCost) => gasCost.insufficient);
|
|
86
73
|
setInsufficientGas(gasCostResult);
|
|
87
|
-
}), [
|
|
88
|
-
account.address,
|
|
89
|
-
account.isActive,
|
|
90
|
-
fromAmount,
|
|
91
|
-
fromChainId,
|
|
92
|
-
getChainById,
|
|
93
|
-
lifi,
|
|
94
|
-
route,
|
|
95
|
-
toChainId,
|
|
96
|
-
]);
|
|
74
|
+
}), [account.address, account.isActive, getChainById, lifi, route]);
|
|
97
75
|
const insufficientFunds = (0, react_1.useMemo)(() => {
|
|
98
76
|
var _a, _b;
|
|
99
|
-
if (!account.isActive ||
|
|
100
|
-
!fromToken ||
|
|
101
|
-
!fromAmount ||
|
|
102
|
-
!fromChainTokenBalances) {
|
|
77
|
+
if (!account.isActive || !fromChainTokenBalances || !route) {
|
|
103
78
|
return false;
|
|
104
79
|
}
|
|
105
|
-
const balance = (0, big_js_1.default)((_b = (_a = fromChainTokenBalances === null || fromChainTokenBalances === void 0 ? void 0 : fromChainTokenBalances.find((t) => t.address === fromToken)) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0);
|
|
106
|
-
return (0, big_js_1.default)(fromAmount)
|
|
107
|
-
|
|
80
|
+
const balance = (0, big_js_1.default)((_b = (_a = fromChainTokenBalances === null || fromChainTokenBalances === void 0 ? void 0 : fromChainTokenBalances.find((t) => t.address === (route === null || route === void 0 ? void 0 : route.fromToken.address))) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0);
|
|
81
|
+
return (0, big_js_1.default)(route.fromAmount)
|
|
82
|
+
.div(Math.pow(10, route.fromToken.decimals))
|
|
83
|
+
.gt(balance);
|
|
84
|
+
}, [account.isActive, fromChainTokenBalances, route]);
|
|
108
85
|
(0, react_1.useEffect)(() => {
|
|
109
86
|
checkInsufficientGas();
|
|
110
87
|
}, [checkInsufficientGas]);
|
|
@@ -8,14 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.useRouteExecution = void 0;
|
|
16
13
|
const react_query_1 = require("@tanstack/react-query");
|
|
17
14
|
const react_1 = require("react");
|
|
18
|
-
const shallow_1 =
|
|
15
|
+
const shallow_1 = require("zustand/shallow");
|
|
19
16
|
const providers_1 = require("../providers");
|
|
20
17
|
const stores_1 = require("../stores");
|
|
21
18
|
const events_1 = require("../types/events");
|
|
@@ -8,14 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.useSwapRoutes = void 0;
|
|
16
13
|
const address_1 = require("@ethersproject/address");
|
|
17
14
|
const react_query_1 = require("@tanstack/react-query");
|
|
18
|
-
const big_js_1 =
|
|
15
|
+
const big_js_1 = require("big.js");
|
|
19
16
|
const react_hook_form_1 = require("react-hook-form");
|
|
20
17
|
const _1 = require(".");
|
|
21
18
|
const providers_1 = require("../providers");
|
|
@@ -4,11 +4,12 @@ exports.useTelemetry = void 0;
|
|
|
4
4
|
/* eslint-disable consistent-return */
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const sentry_1 = require("../config/sentry");
|
|
7
|
+
const version_1 = require("../config/version");
|
|
7
8
|
const useTelemetry = (disabled) => {
|
|
8
9
|
(0, react_1.useEffect)(() => {
|
|
9
10
|
if (disabled) {
|
|
10
|
-
if (process.env.NODE_ENV === '
|
|
11
|
-
console.warn(
|
|
11
|
+
if (process.env.NODE_ENV === 'development') {
|
|
12
|
+
console.warn(`[${version_1.name}] Enable crash reports and diagnostic data to be collected. This helps us to better understand how the widget is performing and where improvements need to be made.`);
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Token } from '../types';
|
|
2
|
-
export declare const useTokenBalances: (selectedChainId
|
|
2
|
+
export declare const useTokenBalances: (selectedChainId?: number) => {
|
|
3
3
|
tokens: Token[] | undefined;
|
|
4
4
|
tokensWithBalance: Token[] | undefined;
|
|
5
5
|
featuredTokens: import("@lifi/types").Token[];
|
|
@@ -25,7 +25,9 @@ const useTokenBalances = (selectedChainId) => {
|
|
|
25
25
|
const featuredTokens = (0, useFeaturedTokens_1.useFeaturedTokens)(selectedChainId);
|
|
26
26
|
const { tokens, isLoading } = (0, useTokens_1.useTokens)(selectedChainId);
|
|
27
27
|
const [refetchInterval, setRefetchInterval] = (0, react_1.useState)(defaultRefetchInterval);
|
|
28
|
-
const isBalanceLoadingEnabled = Boolean(account.address) &&
|
|
28
|
+
const isBalanceLoadingEnabled = Boolean(account.address) &&
|
|
29
|
+
Boolean(tokens === null || tokens === void 0 ? void 0 : tokens.length) &&
|
|
30
|
+
Boolean(selectedChainId);
|
|
29
31
|
const { data: tokensWithBalance, isLoading: isBalanceLoading, refetch, } = (0, react_query_1.useQuery)(['token-balances', account.address, selectedChainId, tokens === null || tokens === void 0 ? void 0 : tokens.length], ({ queryKey: [, accountAddress] }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
32
|
if (!accountAddress || !tokens) {
|
|
31
33
|
return;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useWidgetEvents = void 0;
|
|
7
|
-
const mitt_1 =
|
|
8
|
-
const zustand_1 =
|
|
4
|
+
const mitt_1 = require("mitt");
|
|
5
|
+
const zustand_1 = require("zustand");
|
|
9
6
|
const emitterStore = (0, zustand_1.default)()(() => (0, mitt_1.default)());
|
|
10
7
|
const useWidgetEvents = () => {
|
|
11
8
|
return emitterStore();
|
package/cjs/i18n/index.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.configureReactI18next = exports.resources = exports.defaultNS = void 0;
|
|
7
|
-
const i18next_1 =
|
|
4
|
+
const i18next_1 = require("i18next");
|
|
8
5
|
const react_i18next_1 = require("react-i18next");
|
|
9
|
-
const translation_json_1 =
|
|
6
|
+
const translation_json_1 = require("./en/translation.json");
|
|
10
7
|
exports.defaultNS = 'translation';
|
|
11
8
|
exports.resources = {
|
|
12
9
|
en: {
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.EnabledBridgesSelect = void 0;
|
|
7
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
5
|
const icons_material_1 = require("@mui/icons-material");
|
|
9
6
|
const material_1 = require("@mui/material");
|
|
10
7
|
const react_i18next_1 = require("react-i18next");
|
|
11
|
-
const shallow_1 =
|
|
8
|
+
const shallow_1 = require("zustand/shallow");
|
|
12
9
|
const Card_1 = require("../../components/Card");
|
|
13
10
|
const Select_1 = require("../../components/Select");
|
|
14
11
|
const hooks_1 = require("../../hooks");
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.EnabledExchangesSelect = void 0;
|
|
7
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
5
|
const icons_material_1 = require("@mui/icons-material");
|
|
9
6
|
const material_1 = require("@mui/material");
|
|
10
7
|
const react_i18next_1 = require("react-i18next");
|
|
11
|
-
const shallow_1 =
|
|
8
|
+
const shallow_1 = require("zustand/shallow");
|
|
12
9
|
const Card_1 = require("../../components/Card");
|
|
13
10
|
const Select_1 = require("../../components/Select");
|
|
14
11
|
const hooks_1 = require("../../hooks");
|
|
@@ -8,9 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.SwapDetailsPage = void 0;
|
|
16
13
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -19,7 +16,7 @@ const material_1 = require("@mui/material");
|
|
|
19
16
|
const react_1 = require("react");
|
|
20
17
|
const react_i18next_1 = require("react-i18next");
|
|
21
18
|
const react_router_dom_1 = require("react-router-dom");
|
|
22
|
-
const shallow_1 =
|
|
19
|
+
const shallow_1 = require("zustand/shallow");
|
|
23
20
|
const Card_1 = require("../../components/Card");
|
|
24
21
|
const Dialog_1 = require("../../components/Dialog");
|
|
25
22
|
const Header_1 = require("../../components/Header");
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SwapRoutesPage = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const react_router_dom_1 = require("react-router-dom");
|
|
7
6
|
const Header_1 = require("../../components/Header");
|
|
8
7
|
const ProgressToNextUpdate_1 = require("../../components/ProgressToNextUpdate");
|
|
9
8
|
const SwapRouteCard_1 = require("../../components/SwapRouteCard");
|
|
@@ -12,8 +11,7 @@ const stores_1 = require("../../stores");
|
|
|
12
11
|
const utils_1 = require("../../utils");
|
|
13
12
|
const SwapRoutesPage_style_1 = require("./SwapRoutesPage.style");
|
|
14
13
|
const SwapRoutesPage = () => {
|
|
15
|
-
const navigate = (0,
|
|
16
|
-
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
14
|
+
const { navigateBack, navigate } = (0, hooks_1.useNavigateBack)();
|
|
17
15
|
const { routes: swapRoutes, isLoading, isFetching, dataUpdatedAt, refetchTime, refetch, } = (0, hooks_1.useSwapRoutes)();
|
|
18
16
|
const setExecutableRoute = (0, stores_1.useSetExecutableRoute)();
|
|
19
17
|
const handleRouteClick = (route) => {
|
|
@@ -24,7 +22,7 @@ const SwapRoutesPage = () => {
|
|
|
24
22
|
};
|
|
25
23
|
(0, react_1.useEffect)(() => {
|
|
26
24
|
if (!(swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.length) && !isLoading && !isFetching) {
|
|
27
|
-
|
|
25
|
+
navigateBack();
|
|
28
26
|
}
|
|
29
27
|
// redirect to the home page if no routes are found on page reload
|
|
30
28
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.SDKProvider = exports.useLiFi = void 0;
|
|
7
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const sdk_1 =
|
|
5
|
+
const sdk_1 = require("@lifi/sdk");
|
|
9
6
|
const react_1 = require("react");
|
|
10
7
|
const WidgetProvider_1 = require("../WidgetProvider");
|
|
11
8
|
let lifi;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useChainOrder = void 0;
|
|
7
|
-
const shallow_1 =
|
|
4
|
+
const shallow_1 = require("zustand/shallow");
|
|
8
5
|
const useChainOrderStore_1 = require("./useChainOrderStore");
|
|
9
6
|
const useChainOrder = () => {
|
|
10
7
|
return (0, useChainOrderStore_1.useChainOrderStore)((state) => [state.chainOrder, state.setChain], shallow_1.default);
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useChainOrderStore = exports.maxChainToOrder = void 0;
|
|
7
4
|
/* eslint-disable no-underscore-dangle */
|
|
8
|
-
const zustand_1 =
|
|
5
|
+
const zustand_1 = require("zustand");
|
|
9
6
|
const middleware_1 = require("zustand/middleware");
|
|
10
7
|
const immer_1 = require("zustand/middleware/immer");
|
|
11
8
|
exports.maxChainToOrder = 9;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useExecutingRoutesIds = void 0;
|
|
7
|
-
const shallow_1 =
|
|
4
|
+
const shallow_1 = require("zustand/shallow");
|
|
8
5
|
const useRouteStore_1 = require("./useRouteStore");
|
|
9
6
|
const useExecutingRoutesIds = (address) => {
|
|
10
7
|
return (0, useRouteStore_1.useRouteStore)((state) => Object.values(state.routes)
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useRouteStore = void 0;
|
|
7
|
-
const zustand_1 =
|
|
4
|
+
const zustand_1 = require("zustand");
|
|
8
5
|
const middleware_1 = require("zustand/middleware");
|
|
9
6
|
const immer_1 = require("zustand/middleware/immer");
|
|
10
7
|
const utils_1 = require("./utils");
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useSwapHistory = void 0;
|
|
7
|
-
const shallow_1 =
|
|
4
|
+
const shallow_1 = require("zustand/shallow");
|
|
8
5
|
const useRouteStore_1 = require("./useRouteStore");
|
|
9
6
|
const useSwapHistory = (address) => {
|
|
10
7
|
return (0, useRouteStore_1.useRouteStore)((state) => Object.values(state.routes)
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getUpdatedProcess = exports.isRouteActive = exports.isRouteFailed = exports.isRouteCompleted = void 0;
|
|
7
|
-
const microdiff_1 =
|
|
4
|
+
const microdiff_1 = require("microdiff");
|
|
8
5
|
const isRouteCompleted = (route) => {
|
|
9
6
|
return route.steps.every((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'DONE'; });
|
|
10
7
|
};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useAppearance = void 0;
|
|
7
|
-
const shallow_1 =
|
|
4
|
+
const shallow_1 = require("zustand/shallow");
|
|
8
5
|
const useSettingsStore_1 = require("./useSettingsStore");
|
|
9
6
|
const useAppearance = () => {
|
|
10
7
|
const [appearance, setValue] = (0, useSettingsStore_1.useSettingsStore)((state) => [state.appearance, state.setValue], shallow_1.default);
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useSettings = void 0;
|
|
7
|
-
const shallow_1 =
|
|
4
|
+
const shallow_1 = require("zustand/shallow");
|
|
8
5
|
const useSettingsStore_1 = require("./useSettingsStore");
|
|
9
6
|
const useSettings = (keys) => {
|
|
10
7
|
return (0, useSettingsStore_1.useSettingsStore)((state) => keys.reduce((values, key) => {
|
|
@@ -10,13 +10,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
14
|
exports.useSettingsStore = void 0;
|
|
18
15
|
/* eslint-disable no-underscore-dangle */
|
|
19
|
-
const zustand_1 =
|
|
16
|
+
const zustand_1 = require("zustand");
|
|
20
17
|
const middleware_1 = require("zustand/middleware");
|
|
21
18
|
const immer_1 = require("zustand/middleware/immer");
|
|
22
19
|
const types_1 = require("./types");
|
package/cjs/utils/format.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.formatTokenPrice = exports.formatAmount = exports.formatSlippage = exports.formatTokenAmount = void 0;
|
|
7
|
-
const big_js_1 =
|
|
4
|
+
const big_js_1 = require("big.js");
|
|
8
5
|
// JavaScript numbers use exponential notation for positive exponents of 21 and above. We need more.
|
|
9
6
|
big_js_1.default.PE = 42;
|
|
10
7
|
// JavaScript numbers use exponential notation for negative exponents of -7 and below. We need more.
|
|
@@ -23,7 +23,10 @@ export const TokenList = ({ formType, height, onClick, }) => {
|
|
|
23
23
|
token.symbol.toUpperCase().includes(searchFilter) ||
|
|
24
24
|
token.address.toUpperCase().includes(searchFilter))
|
|
25
25
|
: filteredTokens;
|
|
26
|
-
const tokenSearchEnabled = !
|
|
26
|
+
const tokenSearchEnabled = !isTokensLoading &&
|
|
27
|
+
!!filteredTokens.length &&
|
|
28
|
+
!!tokenSearchFilter &&
|
|
29
|
+
!!selectedChainId;
|
|
27
30
|
const { token: searchedToken, isLoading: isSearchedTokenLoading } = useTokenSearch(tokenSearchFilter, selectedChainId, tokenSearchEnabled);
|
|
28
31
|
const isLoading = isTokensLoading || (tokenSearchEnabled && isSearchedTokenLoading);
|
|
29
32
|
const tokens = filteredTokens.length
|
package/config/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "1.17.
|
|
2
|
+
export declare const version = "1.17.2";
|
package/config/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget';
|
|
2
|
-
export const version = '1.17.
|
|
2
|
+
export const version = '1.17.2';
|