@lifi/widget 1.23.0 → 1.24.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/SelectChainAndToken.js +1 -1
- package/cjs/components/StepActions/StepActions.js +2 -2
- package/cjs/components/SwapButton/SwapButton.js +1 -1
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useInitializer.js +5 -1
- package/cjs/hooks/useTelemetry.js +3 -1
- package/cjs/hooks/useTools.d.ts +4 -1
- package/cjs/hooks/useTools.js +1 -1
- package/cjs/i18n/uk.json +11 -6
- package/cjs/pages/SwapHistoryPage/SwapHistoryItem.js +4 -2
- package/cjs/pages/SwapPage/StatusBottomSheet.js +6 -5
- package/components/SelectChainAndToken.js +1 -1
- package/components/StepActions/StepActions.js +2 -2
- package/components/SwapButton/SwapButton.js +1 -1
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useInitializer.js +5 -1
- package/hooks/useTelemetry.js +3 -1
- package/hooks/useTools.d.ts +4 -1
- package/hooks/useTools.js +1 -1
- package/i18n/uk.json +11 -6
- package/package.json +7 -7
- package/pages/SwapHistoryPage/SwapHistoryItem.js +4 -2
- package/pages/SwapPage/StatusBottomSheet.js +6 -5
- package/tsconfig.cjs.tsbuildinfo +1 -1
|
@@ -23,6 +23,6 @@ const SelectChainAndToken = (props) => {
|
|
|
23
23
|
(disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(types_1.DisabledUI.FromToken)) ||
|
|
24
24
|
(disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(types_1.DisabledUI.ToToken));
|
|
25
25
|
const isCompact = fromChain && toChain && fromToken && toToken && !prefersNarrowView;
|
|
26
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: { display: 'flex', flexDirection: isCompact ? 'row' : 'column' } }, props, { children: [(0, jsx_runtime_1.jsx)(SelectTokenButton_1.SelectTokenButton, { formType: "from", compact: isCompact }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, m: !disabledReverse ? -1.
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: { display: 'flex', flexDirection: isCompact ? 'row' : 'column' } }, props, { children: [(0, jsx_runtime_1.jsx)(SelectTokenButton_1.SelectTokenButton, { formType: "from", compact: isCompact }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, m: !disabledReverse ? -1.125 : 1 }, { children: !disabledReverse ? ((0, jsx_runtime_1.jsx)(ReverseTokensButton_1.ReverseTokensButton, { vertical: !isCompact })) : null })), (0, jsx_runtime_1.jsx)(SelectTokenButton_1.SelectTokenButton, { formType: "to", compact: isCompact })] })));
|
|
27
27
|
};
|
|
28
28
|
exports.SelectChainAndToken = SelectChainAndToken;
|
|
@@ -44,13 +44,13 @@ const StepActions = (_a) => {
|
|
|
44
44
|
};
|
|
45
45
|
exports.StepActions = StepActions;
|
|
46
46
|
const StepDetailsContent = ({ step }) => {
|
|
47
|
-
var _a, _b, _c, _d, _e;
|
|
47
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
48
48
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
49
49
|
return ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex" }, { children: [t('format.number', {
|
|
50
50
|
value: (0, utils_1.formatTokenAmount)(step.estimate.fromAmount, step.action.fromToken.decimals),
|
|
51
51
|
}), ' ', step.action.fromToken.symbol, (0, jsx_runtime_1.jsx)(icons_material_1.ArrowForward, { sx: { fontSize: 18, paddingX: 0.5 } }), t('format.number', {
|
|
52
52
|
value: (0, utils_1.formatTokenAmount)((_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toAmount) !== null && _b !== void 0 ? _b : step.estimate.toAmount, (_e = (_d = (_c = step.execution) === null || _c === void 0 ? void 0 : _c.toToken) === null || _d === void 0 ? void 0 : _d.decimals) !== null && _e !== void 0 ? _e : step.action.toToken.decimals),
|
|
53
|
-
}), ' ', step.action.toToken.symbol] })));
|
|
53
|
+
}), ' ', (_h = (_g = (_f = step.execution) === null || _f === void 0 ? void 0 : _f.toToken) === null || _g === void 0 ? void 0 : _g.symbol) !== null && _h !== void 0 ? _h : step.action.toToken.symbol] })));
|
|
54
54
|
};
|
|
55
55
|
exports.StepDetailsContent = StepDetailsContent;
|
|
56
56
|
const CrossStepDetailsLabel = ({ step }) => {
|
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.
|
|
2
|
+
export declare const version = "1.24.0";
|
package/cjs/config/version.js
CHANGED
|
@@ -6,10 +6,14 @@ const sdk_1 = require("@lifi/sdk");
|
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const version_1 = require("../config/version");
|
|
8
8
|
const useTools_1 = require("./useTools");
|
|
9
|
+
let checkedPackageUpdates = false;
|
|
9
10
|
const useInitializer = () => {
|
|
10
11
|
(0, useTools_1.useTools)();
|
|
11
12
|
(0, react_1.useEffect)(() => {
|
|
12
|
-
(
|
|
13
|
+
if (!checkedPackageUpdates) {
|
|
14
|
+
checkedPackageUpdates = true;
|
|
15
|
+
(0, sdk_1.checkPackageUpdates)(version_1.name, version_1.version);
|
|
16
|
+
}
|
|
13
17
|
}, []);
|
|
14
18
|
};
|
|
15
19
|
exports.useInitializer = useInitializer;
|
|
@@ -5,10 +5,12 @@ exports.useTelemetry = void 0;
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const sentry_1 = require("../config/sentry");
|
|
7
7
|
const version_1 = require("../config/version");
|
|
8
|
+
let warningLogged = false;
|
|
8
9
|
const useTelemetry = (disabled) => {
|
|
9
10
|
(0, react_1.useEffect)(() => {
|
|
10
11
|
if (disabled) {
|
|
11
|
-
if (process.env.NODE_ENV === 'development') {
|
|
12
|
+
if (process.env.NODE_ENV === 'development' && !warningLogged) {
|
|
13
|
+
warningLogged = true;
|
|
12
14
|
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.`);
|
|
13
15
|
}
|
|
14
16
|
}
|
package/cjs/hooks/useTools.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { Bridge, Exchange } from '@lifi/sdk';
|
|
2
|
+
interface WidgetBridge extends Omit<Bridge, 'key'> {
|
|
3
|
+
key: string;
|
|
4
|
+
}
|
|
2
5
|
declare type FormattedTool<T, K extends keyof T> = Record<string, Pick<T, K>>;
|
|
3
6
|
export declare const useTools: () => {
|
|
4
7
|
tools: import("@lifi/sdk").ToolsResponse | undefined;
|
|
5
8
|
formattedTools: {
|
|
6
|
-
bridges: FormattedTool<
|
|
9
|
+
bridges: FormattedTool<WidgetBridge, "key" | "name" | "logoURI"> | undefined;
|
|
7
10
|
exchanges: FormattedTool<Exchange, "key" | "name" | "logoURI"> | undefined;
|
|
8
11
|
};
|
|
9
12
|
};
|
package/cjs/hooks/useTools.js
CHANGED
|
@@ -8,7 +8,7 @@ const stores_1 = require("../stores");
|
|
|
8
8
|
const useTools = () => {
|
|
9
9
|
const lifi = (0, providers_1.useLiFi)();
|
|
10
10
|
const { bridges, exchanges } = (0, providers_1.useWidgetConfig)();
|
|
11
|
-
const { data } = (0, react_query_1.useQuery)(['tools'], (
|
|
11
|
+
const { data } = (0, react_query_1.useQuery)(['tools'], () => lifi.getTools(), {
|
|
12
12
|
onSuccess(data) {
|
|
13
13
|
const { initializeTools } = stores_1.useSettingsStore.getState();
|
|
14
14
|
initializeTools('Bridges', data.bridges
|
package/cjs/i18n/uk.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"delete": "Видалити",
|
|
11
11
|
"disconnectWallet": "Відключити гаманець",
|
|
12
12
|
"done": "Готово",
|
|
13
|
+
"getGas": "Отримати газ",
|
|
13
14
|
"hide": "Сховати",
|
|
14
15
|
"lifiSwap": "LI.FI Swap",
|
|
15
16
|
"light": "Світла",
|
|
@@ -21,6 +22,7 @@
|
|
|
21
22
|
"reviewSwap": "Переглянути своп",
|
|
22
23
|
"seeDetails": "Детальніше",
|
|
23
24
|
"showAll": "Показати всі",
|
|
25
|
+
"startGasSwap": "Почати своп газу",
|
|
24
26
|
"startSwap": "Почати своп",
|
|
25
27
|
"swap": "Своп",
|
|
26
28
|
"tryAgain": "Спробувати ще раз"
|
|
@@ -32,6 +34,8 @@
|
|
|
32
34
|
"header": {
|
|
33
35
|
"activeSwaps": "Активні свопи",
|
|
34
36
|
"from": "Своп з",
|
|
37
|
+
"gas": "Газ",
|
|
38
|
+
"gasSwap": "Своп газу",
|
|
35
39
|
"routes": "Ви отримуєте",
|
|
36
40
|
"selectChain": "Оберіть чейн",
|
|
37
41
|
"selectWallet": "Виберіть свій гаманець",
|
|
@@ -64,7 +68,7 @@
|
|
|
64
68
|
"slippage": "Прослизання"
|
|
65
69
|
},
|
|
66
70
|
"swap": {
|
|
67
|
-
"crossStepDetails": "
|
|
71
|
+
"crossStepDetails": "Брідж з {{from}} до {{to}} через {{tool}}",
|
|
68
72
|
"error": {
|
|
69
73
|
"message": {
|
|
70
74
|
"slippageTooLarge": "Прослизання більше визначеного порогу. Будь ласка, оберіть новий маршрут, щоб отримати свіжу пропозицію.",
|
|
@@ -85,7 +89,7 @@
|
|
|
85
89
|
"walletEnsAddressInvalid": "Адреса гаманця недійсна або мережа не підтримує ENS."
|
|
86
90
|
}
|
|
87
91
|
},
|
|
88
|
-
"estimatedTime": "{{value}}
|
|
92
|
+
"estimatedTime": "{{value}}х",
|
|
89
93
|
"featuredTokens": "Рекомендовані токени",
|
|
90
94
|
"from": "З",
|
|
91
95
|
"fromAmount": "Ви платите",
|
|
@@ -139,14 +143,15 @@
|
|
|
139
143
|
"selectChainAndToken": "Виберіть чейн і токен",
|
|
140
144
|
"selectToken": "Токен",
|
|
141
145
|
"sendToWallet": "Надіслати на інший гаманець",
|
|
142
|
-
"stepBridge": "
|
|
146
|
+
"stepBridge": "Брідж",
|
|
143
147
|
"stepSwap": "Своп",
|
|
144
|
-
"stepSwapAndBridge": "Своп
|
|
148
|
+
"stepSwapAndBridge": "Своп та брідж",
|
|
145
149
|
"success": {
|
|
146
150
|
"message": {
|
|
147
151
|
"swapSuccessful": "Зараз у гаманці {{walletAddress}} на чейні {{chainName}} є {{amount, number(maximumFractionDigits: 4)}} {{tokenSymbol}}."
|
|
148
152
|
},
|
|
149
153
|
"title": {
|
|
154
|
+
"gasSwapSuccessful": "Своп газу успішний",
|
|
150
155
|
"swapSuccessful": "Своп успішний"
|
|
151
156
|
}
|
|
152
157
|
},
|
|
@@ -154,10 +159,10 @@
|
|
|
154
159
|
"swapStepDetails": "Своп на {{chain}} через {{tool}}",
|
|
155
160
|
"swapping": "Обмін",
|
|
156
161
|
"tags": {
|
|
157
|
-
"ALTERNATIVE": "
|
|
162
|
+
"ALTERNATIVE": "АЛЬТЕРНАТИВА",
|
|
158
163
|
"CHEAPEST": "ДЕШЕВИЙ",
|
|
159
164
|
"FASTEST": "ШВИДКИЙ",
|
|
160
|
-
"RECOMMENDED": "
|
|
165
|
+
"RECOMMENDED": "РЕКОМЕНДУЄМО",
|
|
161
166
|
"SAFEST": "БЕЗПЕЧНИЙ"
|
|
162
167
|
},
|
|
163
168
|
"to": "До",
|
|
@@ -9,7 +9,7 @@ const Card_1 = require("../../components/Card");
|
|
|
9
9
|
const Token_1 = require("../../components/Token");
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const SwapHistoryItem = ({ route }) => {
|
|
12
|
-
var _a, _b, _c, _d, _e;
|
|
12
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
13
13
|
const { i18n } = (0, react_i18next_1.useTranslation)();
|
|
14
14
|
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
15
15
|
const handleClick = () => {
|
|
@@ -18,12 +18,14 @@ const SwapHistoryItem = ({ route }) => {
|
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
const startedAt = new Date((_b = (_a = route.steps[0].execution) === null || _a === void 0 ? void 0 : _a.process[0].startedAt) !== null && _b !== void 0 ? _b : 0);
|
|
21
|
+
const fromToken = Object.assign(Object.assign({}, route.fromToken), { amount: route.fromAmount });
|
|
22
|
+
const toToken = Object.assign(Object.assign({}, ((_e = (_d = (_c = route.steps.at(-1)) === null || _c === void 0 ? void 0 : _c.execution) === null || _d === void 0 ? void 0 : _d.toToken) !== null && _e !== void 0 ? _e : route.toToken)), { amount: (_h = (_g = (_f = route.steps.at(-1)) === null || _f === void 0 ? void 0 : _f.execution) === null || _g === void 0 ? void 0 : _g.toAmount) !== null && _h !== void 0 ? _h : route.toAmount });
|
|
21
23
|
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ onClick: handleClick }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: {
|
|
22
24
|
display: 'flex',
|
|
23
25
|
flex: 1,
|
|
24
26
|
justifyContent: 'space-between',
|
|
25
27
|
}, pt: 1.75, px: 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }).format(startedAt) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(i18n.language, {
|
|
26
28
|
timeStyle: 'short',
|
|
27
|
-
}).format(startedAt) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ py: 1 }, { children: [(0, jsx_runtime_1.jsx)(Token_1.Token, { token:
|
|
29
|
+
}).format(startedAt) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ py: 1 }, { children: [(0, jsx_runtime_1.jsx)(Token_1.Token, { token: fromToken, px: 2, pt: 1, connected: true }), (0, jsx_runtime_1.jsx)(Token_1.TokenDivider, {}), (0, jsx_runtime_1.jsx)(Token_1.Token, { token: toToken, px: 2, pt: 0.5, pb: 1 })] }))] })));
|
|
28
30
|
};
|
|
29
31
|
exports.SwapHistoryItem = SwapHistoryItem;
|
|
@@ -15,13 +15,14 @@ const providers_1 = require("../../providers");
|
|
|
15
15
|
const utils_1 = require("../../utils");
|
|
16
16
|
const StatusBottomSheet_style_1 = require("./StatusBottomSheet.style");
|
|
17
17
|
const StatusBottomSheet = ({ status, route, }) => {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
19
19
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
20
20
|
const { navigateBack, navigate } = (0, hooks_1.useNavigateBack)();
|
|
21
21
|
const ref = (0, react_1.useRef)(null);
|
|
22
22
|
const { getChainById } = (0, hooks_1.useChains)();
|
|
23
23
|
const { setValue } = (0, react_hook_form_1.useFormContext)();
|
|
24
|
-
const
|
|
24
|
+
const toToken = Object.assign(Object.assign({}, ((_c = (_b = (_a = route.steps.at(-1)) === null || _a === void 0 ? void 0 : _a.execution) === null || _b === void 0 ? void 0 : _b.toToken) !== null && _c !== void 0 ? _c : route.toToken)), { amount: (_h = (_f = (_e = (_d = route.steps.at(-1)) === null || _d === void 0 ? void 0 : _d.execution) === null || _e === void 0 ? void 0 : _e.toAmount) !== null && _f !== void 0 ? _f : (_g = route.steps.at(-1)) === null || _g === void 0 ? void 0 : _g.estimate.toAmount) !== null && _h !== void 0 ? _h : route.toAmount });
|
|
25
|
+
const { token, refetch, refetchNewBalance, refetchAllBalances } = (0, hooks_1.useTokenBalance)(toToken, route.toAddress);
|
|
25
26
|
const clearFromAmount = () => {
|
|
26
27
|
refetchAllBalances();
|
|
27
28
|
setValue(providers_1.SwapFormKey.FromAmount, '');
|
|
@@ -50,13 +51,13 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
50
51
|
message = t('swap.success.message.swapSuccessful', {
|
|
51
52
|
amount: token === null || token === void 0 ? void 0 : token.amount,
|
|
52
53
|
tokenSymbol: token === null || token === void 0 ? void 0 : token.symbol,
|
|
53
|
-
chainName: (
|
|
54
|
+
chainName: (_j = getChainById(route.toChainId)) === null || _j === void 0 ? void 0 : _j.name,
|
|
54
55
|
walletAddress: (0, utils_1.shortenWalletAddress)(route.toAddress),
|
|
55
56
|
});
|
|
56
57
|
break;
|
|
57
58
|
case 'error': {
|
|
58
59
|
const step = route.steps.find((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'FAILED'; });
|
|
59
|
-
const process = (
|
|
60
|
+
const process = (_k = step === null || step === void 0 ? void 0 : step.execution) === null || _k === void 0 ? void 0 : _k.process.find((process) => process.status === 'FAILED');
|
|
60
61
|
if (!step || !process) {
|
|
61
62
|
break;
|
|
62
63
|
}
|
|
@@ -79,6 +80,6 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
79
80
|
(_b = ref.current) === null || _b === void 0 ? void 0 : _b.open();
|
|
80
81
|
}
|
|
81
82
|
}, [refetch, refetchNewBalance, status]);
|
|
82
|
-
return ((0, jsx_runtime_1.jsx)(BottomSheet_1.BottomSheet, Object.assign({ ref: ref }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ p: 3 }, { children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconContainer, { children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconCircle, Object.assign({ status: status, mb: 1 }, { children: [status === 'idle' ? (0, jsx_runtime_1.jsx)(icons_material_1.Info, { color: "primary" }) : null, status === 'success' ? (0, jsx_runtime_1.jsx)(icons_material_1.Done, { color: "success" }) : null, status === 'error' ? (0, jsx_runtime_1.jsx)(icons_material_1.Warning, { color: "error" }) : null] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: title })), status === 'success' ? ((0, jsx_runtime_1.jsx)(Token_1.Token, { token:
|
|
83
|
+
return ((0, jsx_runtime_1.jsx)(BottomSheet_1.BottomSheet, Object.assign({ ref: ref }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ p: 3 }, { children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconContainer, { children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconCircle, Object.assign({ status: status, mb: 1 }, { children: [status === 'idle' ? (0, jsx_runtime_1.jsx)(icons_material_1.Info, { color: "primary" }) : null, status === 'success' ? (0, jsx_runtime_1.jsx)(icons_material_1.Done, { color: "success" }) : null, status === 'error' ? (0, jsx_runtime_1.jsx)(icons_material_1.Warning, { color: "error" }) : null] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: title })), status === 'success' ? ((0, jsx_runtime_1.jsx)(Token_1.Token, { token: toToken, py: 1, disableDescription: true })) : null] }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ py: 1 }, { children: message })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsxs)(material_1.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' ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "text", onClick: handleSeeDetails, fullWidth: true }, { children: t('button.seeDetails') })) }))) : null] })) })));
|
|
83
84
|
};
|
|
84
85
|
exports.StatusBottomSheet = StatusBottomSheet;
|
|
@@ -20,5 +20,5 @@ export const SelectChainAndToken = (props) => {
|
|
|
20
20
|
(disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(DisabledUI.FromToken)) ||
|
|
21
21
|
(disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(DisabledUI.ToToken));
|
|
22
22
|
const isCompact = fromChain && toChain && fromToken && toToken && !prefersNarrowView;
|
|
23
|
-
return (_jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: isCompact ? 'row' : 'column' } }, props, { children: [_jsx(SelectTokenButton, { formType: "from", compact: isCompact }), _jsx(Box, Object.assign({ sx: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, m: !disabledReverse ? -1.
|
|
23
|
+
return (_jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: isCompact ? 'row' : 'column' } }, props, { children: [_jsx(SelectTokenButton, { formType: "from", compact: isCompact }), _jsx(Box, Object.assign({ sx: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, m: !disabledReverse ? -1.125 : 1 }, { children: !disabledReverse ? (_jsx(ReverseTokensButton, { vertical: !isCompact })) : null })), _jsx(SelectTokenButton, { formType: "to", compact: isCompact })] })));
|
|
24
24
|
};
|
|
@@ -40,13 +40,13 @@ export const StepActions = (_a) => {
|
|
|
40
40
|
: step.toolDetails.name }))] })), isFullView ? (_jsx(Stepper, Object.assign({ orientation: "vertical", connector: _jsx(StepConnector, {}), activeStep: -1 }, { children: step.includedSteps.map((step) => (_jsxs(MuiStep, Object.assign({ expanded: true }, { children: [_jsx(StepLabel, Object.assign({ StepIconComponent: StepIconComponent }, { children: step.type === 'cross' || step.type === 'lifi' ? (_jsx(CrossStepDetailsLabel, { step: step })) : (_jsx(SwapStepDetailsLabel, { step: step })) })), _jsx(StepContent, { children: _jsx(StepDetailsContent, { step: step }) })] }), step.id))) }))) : (_jsxs(Box, Object.assign({ ml: 6 }, { children: [_jsx(StepDetailsLabel, { step: step }), _jsx(StepDetailsContent, { step: step })] })))] })));
|
|
41
41
|
};
|
|
42
42
|
export const StepDetailsContent = ({ step }) => {
|
|
43
|
-
var _a, _b, _c, _d, _e;
|
|
43
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
44
44
|
const { t } = useTranslation();
|
|
45
45
|
return (_jsxs(Typography, Object.assign({ fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex" }, { children: [t('format.number', {
|
|
46
46
|
value: formatTokenAmount(step.estimate.fromAmount, step.action.fromToken.decimals),
|
|
47
47
|
}), ' ', step.action.fromToken.symbol, _jsx(ArrowForwardIcon, { sx: { fontSize: 18, paddingX: 0.5 } }), t('format.number', {
|
|
48
48
|
value: formatTokenAmount((_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toAmount) !== null && _b !== void 0 ? _b : step.estimate.toAmount, (_e = (_d = (_c = step.execution) === null || _c === void 0 ? void 0 : _c.toToken) === null || _d === void 0 ? void 0 : _d.decimals) !== null && _e !== void 0 ? _e : step.action.toToken.decimals),
|
|
49
|
-
}), ' ', step.action.toToken.symbol] })));
|
|
49
|
+
}), ' ', (_h = (_g = (_f = step.execution) === null || _f === void 0 ? void 0 : _f.toToken) === null || _g === void 0 ? void 0 : _g.symbol) !== null && _h !== void 0 ? _h : step.action.toToken.symbol] })));
|
|
50
50
|
};
|
|
51
51
|
export const CrossStepDetailsLabel = ({ step }) => {
|
|
52
52
|
var _a, _b;
|
package/config/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "1.
|
|
2
|
+
export declare const version = "1.24.0";
|
package/config/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget';
|
|
2
|
-
export const version = '1.
|
|
2
|
+
export const version = '1.24.0';
|
package/hooks/useInitializer.js
CHANGED
|
@@ -3,9 +3,13 @@ import { checkPackageUpdates } from '@lifi/sdk';
|
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import { name, version } from '../config/version';
|
|
5
5
|
import { useTools } from './useTools';
|
|
6
|
+
let checkedPackageUpdates = false;
|
|
6
7
|
export const useInitializer = () => {
|
|
7
8
|
useTools();
|
|
8
9
|
useEffect(() => {
|
|
9
|
-
|
|
10
|
+
if (!checkedPackageUpdates) {
|
|
11
|
+
checkedPackageUpdates = true;
|
|
12
|
+
checkPackageUpdates(name, version);
|
|
13
|
+
}
|
|
10
14
|
}, []);
|
|
11
15
|
};
|
package/hooks/useTelemetry.js
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import { initSentry } from '../config/sentry';
|
|
4
4
|
import { name } from '../config/version';
|
|
5
|
+
let warningLogged = false;
|
|
5
6
|
export const useTelemetry = (disabled) => {
|
|
6
7
|
useEffect(() => {
|
|
7
8
|
if (disabled) {
|
|
8
|
-
if (process.env.NODE_ENV === 'development') {
|
|
9
|
+
if (process.env.NODE_ENV === 'development' && !warningLogged) {
|
|
10
|
+
warningLogged = true;
|
|
9
11
|
console.warn(`[${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.`);
|
|
10
12
|
}
|
|
11
13
|
}
|
package/hooks/useTools.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { Bridge, Exchange } from '@lifi/sdk';
|
|
2
|
+
interface WidgetBridge extends Omit<Bridge, 'key'> {
|
|
3
|
+
key: string;
|
|
4
|
+
}
|
|
2
5
|
declare type FormattedTool<T, K extends keyof T> = Record<string, Pick<T, K>>;
|
|
3
6
|
export declare const useTools: () => {
|
|
4
7
|
tools: import("@lifi/sdk").ToolsResponse | undefined;
|
|
5
8
|
formattedTools: {
|
|
6
|
-
bridges: FormattedTool<
|
|
9
|
+
bridges: FormattedTool<WidgetBridge, "key" | "name" | "logoURI"> | undefined;
|
|
7
10
|
exchanges: FormattedTool<Exchange, "key" | "name" | "logoURI"> | undefined;
|
|
8
11
|
};
|
|
9
12
|
};
|
package/hooks/useTools.js
CHANGED
|
@@ -5,7 +5,7 @@ import { useSettingsStore } from '../stores';
|
|
|
5
5
|
export const useTools = () => {
|
|
6
6
|
const lifi = useLiFi();
|
|
7
7
|
const { bridges, exchanges } = useWidgetConfig();
|
|
8
|
-
const { data } = useQuery(['tools'], (
|
|
8
|
+
const { data } = useQuery(['tools'], () => lifi.getTools(), {
|
|
9
9
|
onSuccess(data) {
|
|
10
10
|
const { initializeTools } = useSettingsStore.getState();
|
|
11
11
|
initializeTools('Bridges', data.bridges
|
package/i18n/uk.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"delete": "Видалити",
|
|
11
11
|
"disconnectWallet": "Відключити гаманець",
|
|
12
12
|
"done": "Готово",
|
|
13
|
+
"getGas": "Отримати газ",
|
|
13
14
|
"hide": "Сховати",
|
|
14
15
|
"lifiSwap": "LI.FI Swap",
|
|
15
16
|
"light": "Світла",
|
|
@@ -21,6 +22,7 @@
|
|
|
21
22
|
"reviewSwap": "Переглянути своп",
|
|
22
23
|
"seeDetails": "Детальніше",
|
|
23
24
|
"showAll": "Показати всі",
|
|
25
|
+
"startGasSwap": "Почати своп газу",
|
|
24
26
|
"startSwap": "Почати своп",
|
|
25
27
|
"swap": "Своп",
|
|
26
28
|
"tryAgain": "Спробувати ще раз"
|
|
@@ -32,6 +34,8 @@
|
|
|
32
34
|
"header": {
|
|
33
35
|
"activeSwaps": "Активні свопи",
|
|
34
36
|
"from": "Своп з",
|
|
37
|
+
"gas": "Газ",
|
|
38
|
+
"gasSwap": "Своп газу",
|
|
35
39
|
"routes": "Ви отримуєте",
|
|
36
40
|
"selectChain": "Оберіть чейн",
|
|
37
41
|
"selectWallet": "Виберіть свій гаманець",
|
|
@@ -64,7 +68,7 @@
|
|
|
64
68
|
"slippage": "Прослизання"
|
|
65
69
|
},
|
|
66
70
|
"swap": {
|
|
67
|
-
"crossStepDetails": "
|
|
71
|
+
"crossStepDetails": "Брідж з {{from}} до {{to}} через {{tool}}",
|
|
68
72
|
"error": {
|
|
69
73
|
"message": {
|
|
70
74
|
"slippageTooLarge": "Прослизання більше визначеного порогу. Будь ласка, оберіть новий маршрут, щоб отримати свіжу пропозицію.",
|
|
@@ -85,7 +89,7 @@
|
|
|
85
89
|
"walletEnsAddressInvalid": "Адреса гаманця недійсна або мережа не підтримує ENS."
|
|
86
90
|
}
|
|
87
91
|
},
|
|
88
|
-
"estimatedTime": "{{value}}
|
|
92
|
+
"estimatedTime": "{{value}}х",
|
|
89
93
|
"featuredTokens": "Рекомендовані токени",
|
|
90
94
|
"from": "З",
|
|
91
95
|
"fromAmount": "Ви платите",
|
|
@@ -139,14 +143,15 @@
|
|
|
139
143
|
"selectChainAndToken": "Виберіть чейн і токен",
|
|
140
144
|
"selectToken": "Токен",
|
|
141
145
|
"sendToWallet": "Надіслати на інший гаманець",
|
|
142
|
-
"stepBridge": "
|
|
146
|
+
"stepBridge": "Брідж",
|
|
143
147
|
"stepSwap": "Своп",
|
|
144
|
-
"stepSwapAndBridge": "Своп
|
|
148
|
+
"stepSwapAndBridge": "Своп та брідж",
|
|
145
149
|
"success": {
|
|
146
150
|
"message": {
|
|
147
151
|
"swapSuccessful": "Зараз у гаманці {{walletAddress}} на чейні {{chainName}} є {{amount, number(maximumFractionDigits: 4)}} {{tokenSymbol}}."
|
|
148
152
|
},
|
|
149
153
|
"title": {
|
|
154
|
+
"gasSwapSuccessful": "Своп газу успішний",
|
|
150
155
|
"swapSuccessful": "Своп успішний"
|
|
151
156
|
}
|
|
152
157
|
},
|
|
@@ -154,10 +159,10 @@
|
|
|
154
159
|
"swapStepDetails": "Своп на {{chain}} через {{tool}}",
|
|
155
160
|
"swapping": "Обмін",
|
|
156
161
|
"tags": {
|
|
157
|
-
"ALTERNATIVE": "
|
|
162
|
+
"ALTERNATIVE": "АЛЬТЕРНАТИВА",
|
|
158
163
|
"CHEAPEST": "ДЕШЕВИЙ",
|
|
159
164
|
"FASTEST": "ШВИДКИЙ",
|
|
160
|
-
"RECOMMENDED": "
|
|
165
|
+
"RECOMMENDED": "РЕКОМЕНДУЄМО",
|
|
161
166
|
"SAFEST": "БЕЗПЕЧНИЙ"
|
|
162
167
|
},
|
|
163
168
|
"to": "До",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.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,14 +43,14 @@
|
|
|
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.
|
|
46
|
+
"@lifi/wallet-management": "^1.2.0",
|
|
47
47
|
"@mui/icons-material": "^5.10.9",
|
|
48
48
|
"@mui/lab": "^5.0.0-alpha.107",
|
|
49
49
|
"@mui/material": "^5.10.13",
|
|
50
|
-
"@sentry/integrations": "^7.
|
|
51
|
-
"@sentry/react": "^7.
|
|
52
|
-
"@sentry/tracing": "^7.
|
|
53
|
-
"@tanstack/react-query": "^4.14.
|
|
50
|
+
"@sentry/integrations": "^7.19.0",
|
|
51
|
+
"@sentry/react": "^7.19.0",
|
|
52
|
+
"@sentry/tracing": "^7.19.0",
|
|
53
|
+
"@tanstack/react-query": "^4.14.6",
|
|
54
54
|
"@tanstack/react-virtual": "^3.0.0-beta.22",
|
|
55
55
|
"big.js": "^6.2.1",
|
|
56
56
|
"i18next": "^22.0.4",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"mitt": "^3.0.0",
|
|
61
61
|
"react": "^18.2.0",
|
|
62
62
|
"react-dom": "^18.2.0",
|
|
63
|
-
"react-hook-form": "^7.39.
|
|
63
|
+
"react-hook-form": "^7.39.3",
|
|
64
64
|
"react-i18next": "^12.0.0",
|
|
65
65
|
"react-router-dom": "^6.4.3",
|
|
66
66
|
"react-timer-hook": "^3.0.5",
|
|
@@ -6,7 +6,7 @@ import { Card } from '../../components/Card';
|
|
|
6
6
|
import { Token, TokenDivider } from '../../components/Token';
|
|
7
7
|
import { navigationRoutes } from '../../utils';
|
|
8
8
|
export const SwapHistoryItem = ({ route }) => {
|
|
9
|
-
var _a, _b, _c, _d, _e;
|
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
10
10
|
const { i18n } = useTranslation();
|
|
11
11
|
const navigate = useNavigate();
|
|
12
12
|
const handleClick = () => {
|
|
@@ -15,11 +15,13 @@ export const SwapHistoryItem = ({ route }) => {
|
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
const startedAt = new Date((_b = (_a = route.steps[0].execution) === null || _a === void 0 ? void 0 : _a.process[0].startedAt) !== null && _b !== void 0 ? _b : 0);
|
|
18
|
+
const fromToken = Object.assign(Object.assign({}, route.fromToken), { amount: route.fromAmount });
|
|
19
|
+
const toToken = Object.assign(Object.assign({}, ((_e = (_d = (_c = route.steps.at(-1)) === null || _c === void 0 ? void 0 : _c.execution) === null || _d === void 0 ? void 0 : _d.toToken) !== null && _e !== void 0 ? _e : route.toToken)), { amount: (_h = (_g = (_f = route.steps.at(-1)) === null || _f === void 0 ? void 0 : _f.execution) === null || _g === void 0 ? void 0 : _g.toAmount) !== null && _h !== void 0 ? _h : route.toAmount });
|
|
18
20
|
return (_jsxs(Card, Object.assign({ onClick: handleClick }, { children: [_jsxs(Box, Object.assign({ sx: {
|
|
19
21
|
display: 'flex',
|
|
20
22
|
flex: 1,
|
|
21
23
|
justifyContent: 'space-between',
|
|
22
24
|
}, pt: 1.75, px: 2 }, { 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, {
|
|
23
25
|
timeStyle: 'short',
|
|
24
|
-
}).format(startedAt) }))] })), _jsxs(Box, Object.assign({ py: 1 }, { children: [_jsx(Token, { token:
|
|
26
|
+
}).format(startedAt) }))] })), _jsxs(Box, Object.assign({ py: 1 }, { children: [_jsx(Token, { token: fromToken, px: 2, pt: 1, connected: true }), _jsx(TokenDivider, {}), _jsx(Token, { token: toToken, px: 2, pt: 0.5, pb: 1 })] }))] })));
|
|
25
27
|
};
|
|
@@ -12,13 +12,14 @@ import { SwapFormKey } from '../../providers';
|
|
|
12
12
|
import { navigationRoutes, shortenWalletAddress } from '../../utils';
|
|
13
13
|
import { IconCircle, IconContainer } from './StatusBottomSheet.style';
|
|
14
14
|
export const StatusBottomSheet = ({ status, route, }) => {
|
|
15
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
15
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
16
16
|
const { t } = useTranslation();
|
|
17
17
|
const { navigateBack, navigate } = useNavigateBack();
|
|
18
18
|
const ref = useRef(null);
|
|
19
19
|
const { getChainById } = useChains();
|
|
20
20
|
const { setValue } = useFormContext();
|
|
21
|
-
const
|
|
21
|
+
const toToken = Object.assign(Object.assign({}, ((_c = (_b = (_a = route.steps.at(-1)) === null || _a === void 0 ? void 0 : _a.execution) === null || _b === void 0 ? void 0 : _b.toToken) !== null && _c !== void 0 ? _c : route.toToken)), { amount: (_h = (_f = (_e = (_d = route.steps.at(-1)) === null || _d === void 0 ? void 0 : _d.execution) === null || _e === void 0 ? void 0 : _e.toAmount) !== null && _f !== void 0 ? _f : (_g = route.steps.at(-1)) === null || _g === void 0 ? void 0 : _g.estimate.toAmount) !== null && _h !== void 0 ? _h : route.toAmount });
|
|
22
|
+
const { token, refetch, refetchNewBalance, refetchAllBalances } = useTokenBalance(toToken, route.toAddress);
|
|
22
23
|
const clearFromAmount = () => {
|
|
23
24
|
refetchAllBalances();
|
|
24
25
|
setValue(SwapFormKey.FromAmount, '');
|
|
@@ -47,13 +48,13 @@ export const StatusBottomSheet = ({ status, route, }) => {
|
|
|
47
48
|
message = t('swap.success.message.swapSuccessful', {
|
|
48
49
|
amount: token === null || token === void 0 ? void 0 : token.amount,
|
|
49
50
|
tokenSymbol: token === null || token === void 0 ? void 0 : token.symbol,
|
|
50
|
-
chainName: (
|
|
51
|
+
chainName: (_j = getChainById(route.toChainId)) === null || _j === void 0 ? void 0 : _j.name,
|
|
51
52
|
walletAddress: shortenWalletAddress(route.toAddress),
|
|
52
53
|
});
|
|
53
54
|
break;
|
|
54
55
|
case 'error': {
|
|
55
56
|
const step = route.steps.find((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'FAILED'; });
|
|
56
|
-
const process = (
|
|
57
|
+
const process = (_k = step === null || step === void 0 ? void 0 : step.execution) === null || _k === void 0 ? void 0 : _k.process.find((process) => process.status === 'FAILED');
|
|
57
58
|
if (!step || !process) {
|
|
58
59
|
break;
|
|
59
60
|
}
|
|
@@ -76,5 +77,5 @@ export const StatusBottomSheet = ({ status, route, }) => {
|
|
|
76
77
|
(_b = ref.current) === null || _b === void 0 ? void 0 : _b.open();
|
|
77
78
|
}
|
|
78
79
|
}, [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:
|
|
80
|
+
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: toToken, 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", onClick: handleSeeDetails, fullWidth: true }, { children: t('button.seeDetails') })) }))) : null] })) })));
|
|
80
81
|
};
|