@lifi/widget 2.0.0-beta.0 → 2.0.0-beta.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 +1 -0
- package/cjs/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -0
- 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/SwapRoutesExpanded.d.ts +1 -0
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.style.js +1 -0
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/i18n/pt.json +8 -5
- package/cjs/i18n/uk.json +3 -3
- package/cjs/i18n/zh.json +15 -8
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
- package/cjs/pages/SelectWalletPage/SelectWalletPage.js +5 -5
- 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/providers/I18nProvider/I18nProvider.js +3 -3
- package/cjs/providers/WalletProvider/WalletProvider.js +72 -28
- package/cjs/providers/WalletProvider/index.d.ts +1 -1
- package/cjs/providers/WalletProvider/index.js +1 -1
- package/cjs/providers/WalletProvider/types.d.ts +1 -1
- package/cjs/types/widget.d.ts +1 -2
- package/components/ChainSelect/ChainSelect.d.ts +1 -0
- package/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -0
- 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/SwapRoutesExpanded.d.ts +1 -0
- package/components/SwapRoutes/SwapRoutesExpanded.style.js +1 -0
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/i18n/pt.json +8 -5
- package/i18n/uk.json +3 -3
- package/i18n/zh.json +15 -8
- package/package.json +3 -3
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
- package/pages/SelectWalletPage/SelectWalletPage.js +5 -5
- 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/providers/I18nProvider/I18nProvider.js +3 -3
- package/providers/WalletProvider/WalletProvider.js +73 -29
- package/providers/WalletProvider/index.d.ts +1 -1
- package/providers/WalletProvider/index.js +1 -1
- package/providers/WalletProvider/types.d.ts +1 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/widget.d.ts +1 -2
|
@@ -11,6 +11,7 @@ exports.CollapseContainer = (0, styles_1.styled)(material_1.Box)(({ theme }) =>
|
|
|
11
11
|
exports.ScrollableContainer = (0, styles_1.styled)(material_1.Box)({
|
|
12
12
|
overflowY: 'auto',
|
|
13
13
|
height: '100%',
|
|
14
|
+
width: '100%',
|
|
14
15
|
flex: 1,
|
|
15
16
|
display: 'flex',
|
|
16
17
|
flexDirection: 'column',
|
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.2";
|
package/cjs/config/version.js
CHANGED
package/cjs/i18n/pt.json
CHANGED
|
@@ -184,11 +184,13 @@
|
|
|
184
184
|
"swapStepDetails": "Converter na {{chain}} via {{tool}}",
|
|
185
185
|
"swapping": "Convertendo",
|
|
186
186
|
"tags": {
|
|
187
|
-
"
|
|
188
|
-
"
|
|
189
|
-
"
|
|
190
|
-
"
|
|
191
|
-
"
|
|
187
|
+
"cheapest": "Barato",
|
|
188
|
+
"fastest": "Rápido",
|
|
189
|
+
"insurable": "Assegurável",
|
|
190
|
+
"insurance": "Seguro",
|
|
191
|
+
"insured": "Segurado",
|
|
192
|
+
"recommended": "Recomendado",
|
|
193
|
+
"safest": "Seguro"
|
|
192
194
|
},
|
|
193
195
|
"to": "Para",
|
|
194
196
|
"tokenOnChain": "{{tokenSymbol}} na {{chainName}}",
|
|
@@ -218,6 +220,7 @@
|
|
|
218
220
|
}
|
|
219
221
|
},
|
|
220
222
|
"tooltip": {
|
|
223
|
+
"additionalProviderFee": "Pontes adicionais, DEXes e taxas de serviço.",
|
|
221
224
|
"estimatedNetworkFee": "Taxa de rede estimada.",
|
|
222
225
|
"estimatedTime": "Tempo de execução da conversão estimado em minutos.",
|
|
223
226
|
"notFound": {
|
package/cjs/i18n/uk.json
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"from": "Своп з",
|
|
42
42
|
"gas": "Газ",
|
|
43
43
|
"gasSwap": "Своп газу",
|
|
44
|
-
"routes": "Ви
|
|
44
|
+
"routes": "Ви отримаєте",
|
|
45
45
|
"selectChain": "Оберіть чейн",
|
|
46
46
|
"selectWallet": "Виберіть свій гаманець",
|
|
47
47
|
"settings": "Налаштування",
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
"rateChange": "Зміна курсу",
|
|
158
158
|
"receiving": "Отримання",
|
|
159
159
|
"refuelStepDetails": "Отримати газ через {{tool}}",
|
|
160
|
-
"routes": "Ви
|
|
160
|
+
"routes": "Ви отримаєте",
|
|
161
161
|
"selectChain": "Чейн",
|
|
162
162
|
"selectChainAndToken": "Виберіть чейн і токен",
|
|
163
163
|
"selectToken": "Токен",
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
"tags": {
|
|
187
187
|
"cheapest": "Дешевий",
|
|
188
188
|
"fastest": "Швидкий",
|
|
189
|
-
"insurable": "
|
|
189
|
+
"insurable": "Страховка",
|
|
190
190
|
"insurance": "Страхування",
|
|
191
191
|
"insured": "Застрахований",
|
|
192
192
|
"recommended": "Рекомендований",
|
package/cjs/i18n/zh.json
CHANGED
|
@@ -106,12 +106,14 @@
|
|
|
106
106
|
"inProgress": "进行中",
|
|
107
107
|
"info": {
|
|
108
108
|
"message": {
|
|
109
|
+
"autoRefuel": "您在 {{chainName}} 链上的燃气费很低。如果启用该选项,您将获得足够的燃气费完成此次兑换。",
|
|
109
110
|
"emptyActiveSwaps": "正在进行的兑换将在这里显示。一旦完成,你可在兑换记录中找到它们。",
|
|
110
111
|
"emptySwapHistory": "兑换记录只存储在本地,如果你清除浏览器数据,他们将被删除。",
|
|
111
112
|
"emptyTokenList": "我们无法在 {{chainName}} 链上找到这些代币,或者你的钱包内没有这些代币。请再次搜索或者选择其他链再试一次。",
|
|
112
113
|
"routeNotFound": "试试另一个代币组合。"
|
|
113
114
|
},
|
|
114
115
|
"title": {
|
|
116
|
+
"autoRefuel": "获得燃气费",
|
|
115
117
|
"emptyActiveSwaps": "没有正在进行的兑换",
|
|
116
118
|
"emptySwapHistory": "没有兑换记录",
|
|
117
119
|
"routeNotFound": "没有可用的路由"
|
|
@@ -154,6 +156,7 @@
|
|
|
154
156
|
"quotedAmount": "报价金额",
|
|
155
157
|
"rateChange": "波动率",
|
|
156
158
|
"receiving": "接收",
|
|
159
|
+
"refuelStepDetails": "通过 {{tool}} 获取燃气费",
|
|
157
160
|
"routes": "你会收到",
|
|
158
161
|
"selectChain": "网络",
|
|
159
162
|
"selectChainAndToken": "选择链和代币",
|
|
@@ -162,6 +165,7 @@
|
|
|
162
165
|
"sendToWallet": "发送到另外的钱包",
|
|
163
166
|
"sentToAddress": "发送到{{address}}",
|
|
164
167
|
"stepBridge": "跨链",
|
|
168
|
+
"stepDetails": "通过 LI.FI {{tool}}",
|
|
165
169
|
"stepSwap": "兑换",
|
|
166
170
|
"stepSwapAndBridge": "兑换和跨链",
|
|
167
171
|
"success": {
|
|
@@ -180,11 +184,13 @@
|
|
|
180
184
|
"swapStepDetails": "通过{{tool}}在{{chain}}链上兑换代币",
|
|
181
185
|
"swapping": "兑换中",
|
|
182
186
|
"tags": {
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
"
|
|
187
|
-
"
|
|
187
|
+
"cheapest": "便宜的",
|
|
188
|
+
"fastest": "快速的",
|
|
189
|
+
"insurable": "可保性",
|
|
190
|
+
"insurance": "保险",
|
|
191
|
+
"insured": "受保的",
|
|
192
|
+
"recommended": "建议的",
|
|
193
|
+
"safest": "最佳/安全"
|
|
188
194
|
},
|
|
189
195
|
"to": "到",
|
|
190
196
|
"tokenOnChain": "{{chainName}}链上的{{tokenSymbol}}",
|
|
@@ -197,8 +203,8 @@
|
|
|
197
203
|
"deleteActiveSwaps": "正在进行的兑换记录只存储在本地,如果删除它们,我们将无法恢复这些记录。",
|
|
198
204
|
"deleteSwapHistory": "兑换记录只存储在本地,如果你删除它,我们将无法恢复这些记录。",
|
|
199
205
|
"highValueLoss": "收到的代币的价值明显低于要被兑换的代币和交易成本。",
|
|
200
|
-
"insufficientFunds": "
|
|
201
|
-
"insufficientGas": "
|
|
206
|
+
"insufficientFunds": "你没有足够的资金来完成这笔交易。",
|
|
207
|
+
"insufficientGas": "您没有足够的燃气费来完成此次交易。您至少需要添加:",
|
|
202
208
|
"rateChanged": "兑换比例已经改变,如果继续兑换,您将接受新的兑换比例。",
|
|
203
209
|
"resetSettings": "这将重置您的路由优先级,滑点,燃气费,选中的跨链桥和链上交易所。"
|
|
204
210
|
},
|
|
@@ -207,13 +213,14 @@
|
|
|
207
213
|
"deleteSwap": "确定要删除这个兑换记录?",
|
|
208
214
|
"deleteSwapHistory": "确定要清空兑换记录?",
|
|
209
215
|
"highValueLoss": "大额资金损失",
|
|
210
|
-
"insufficientGas": "
|
|
216
|
+
"insufficientGas": "燃气费不足",
|
|
211
217
|
"rateChanged": "兑换比例变动",
|
|
212
218
|
"resetSettings": "确定要恢复默认设置吗?"
|
|
213
219
|
}
|
|
214
220
|
}
|
|
215
221
|
},
|
|
216
222
|
"tooltip": {
|
|
223
|
+
"additionalProviderFee": "跨链和交易所的手续费。",
|
|
217
224
|
"estimatedNetworkFee": "预估网络手续费。",
|
|
218
225
|
"estimatedTime": "预计兑换的执行时间(分钟)。",
|
|
219
226
|
"notFound": {
|
|
@@ -16,6 +16,9 @@ const SelectWalletPage = () => {
|
|
|
16
16
|
const { navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
17
17
|
const { connect } = (0, providers_1.useWallet)();
|
|
18
18
|
const [walletIdentity, setWalletIdentity] = (0, react_1.useState)({ show: false });
|
|
19
|
+
// separate into installed and not installed wallets
|
|
20
|
+
const installedWallets = wallet_management_1.supportedWallets.filter((wallet) => wallet.installed());
|
|
21
|
+
const notInstalledWallets = wallet_management_1.supportedWallets.filter((wallet) => !wallet.installed() && wallet.name !== 'Default Wallet');
|
|
19
22
|
const closeDialog = () => {
|
|
20
23
|
setWalletIdentity((state) => ({
|
|
21
24
|
...state,
|
|
@@ -23,10 +26,7 @@ const SelectWalletPage = () => {
|
|
|
23
26
|
}));
|
|
24
27
|
};
|
|
25
28
|
const handleConnect = (0, react_1.useCallback)(async (wallet) => {
|
|
26
|
-
const
|
|
27
|
-
const identityCheckPassed = wallet.checkProviderIdentity({
|
|
28
|
-
provider: ethereum,
|
|
29
|
-
});
|
|
29
|
+
const identityCheckPassed = wallet.installed();
|
|
30
30
|
if (!identityCheckPassed) {
|
|
31
31
|
setWalletIdentity({
|
|
32
32
|
show: true,
|
|
@@ -40,7 +40,7 @@ const SelectWalletPage = () => {
|
|
|
40
40
|
return ((0, jsx_runtime_1.jsxs)(material_1.Container, { disableGutters: true, children: [(0, jsx_runtime_1.jsx)(material_1.List, { sx: {
|
|
41
41
|
paddingLeft: 1.5,
|
|
42
42
|
paddingRight: 1.5,
|
|
43
|
-
}, children:
|
|
43
|
+
}, children: [...installedWallets, ...notInstalledWallets].map((wallet) => ((0, jsx_runtime_1.jsxs)(ListItemButton_1.ListItemButton, { onClick: () => handleConnect(wallet), children: [(0, jsx_runtime_1.jsx)(material_1.ListItemAvatar, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { src: wallet.icon.src || wallet.icon, alt: wallet.name, children: wallet.name[0] }) }), (0, jsx_runtime_1.jsx)(ListItemText_1.ListItemText, { primary: wallet.name })] }, wallet.name))) }), (0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, { open: walletIdentity.show, onClose: closeDialog, children: [(0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsx)(material_1.DialogContentText, { children: t('wallet.extensionNotFound', {
|
|
44
44
|
name: walletIdentity.wallet?.name,
|
|
45
45
|
}) }) }), (0, jsx_runtime_1.jsx)(material_1.DialogActions, { children: (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: closeDialog, autoFocus: true, children: t('button.ok') }) })] })] }));
|
|
46
46
|
};
|
|
@@ -11,7 +11,7 @@ const stores_1 = require("../../stores");
|
|
|
11
11
|
const utils_1 = require("../../utils");
|
|
12
12
|
const WidgetProvider_1 = require("../WidgetProvider");
|
|
13
13
|
const I18nProvider = ({ children, }) => {
|
|
14
|
-
const { languageResources, languages,
|
|
14
|
+
const { languageResources, languages, disableLanguageDetector } = (0, WidgetProvider_1.useWidgetConfig)();
|
|
15
15
|
const { language } = (0, stores_1.useSettings)(['language']);
|
|
16
16
|
const i18n = (0, react_1.useMemo)(() => {
|
|
17
17
|
let resources = Object.keys(supportedLanguages)
|
|
@@ -50,12 +50,12 @@ const I18nProvider = ({ children, }) => {
|
|
|
50
50
|
caches: [],
|
|
51
51
|
},
|
|
52
52
|
});
|
|
53
|
-
if (!language && !languages?.default && !
|
|
53
|
+
if (!language && !languages?.default && !disableLanguageDetector) {
|
|
54
54
|
i18n = i18n.use(i18next_browser_languagedetector_1.default);
|
|
55
55
|
}
|
|
56
56
|
i18n.use(react_i18next_1.initReactI18next).init();
|
|
57
57
|
return i18n;
|
|
58
|
-
}, [
|
|
58
|
+
}, [disableLanguageDetector, language, languageResources, languages]);
|
|
59
59
|
return (0, jsx_runtime_1.jsx)(react_i18next_1.I18nextProvider, { i18n: i18n, children: children });
|
|
60
60
|
};
|
|
61
61
|
exports.I18nProvider = I18nProvider;
|
|
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const wallet_management_1 = require("@lifi/wallet-management");
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const WidgetProvider_1 = require("../WidgetProvider");
|
|
8
|
+
const liFiWalletManagement = new wallet_management_1.LiFiWalletManagement();
|
|
8
9
|
const stub = () => {
|
|
9
10
|
throw new Error(`You forgot to wrap your component in <${exports.WalletProvider.name}>.`);
|
|
10
11
|
};
|
|
@@ -21,8 +22,26 @@ const useWallet = () => (0, react_1.useContext)(WalletContext);
|
|
|
21
22
|
exports.useWallet = useWallet;
|
|
22
23
|
const WalletProvider = ({ children }) => {
|
|
23
24
|
const { walletManagement } = (0, WidgetProvider_1.useWidgetConfig)();
|
|
24
|
-
const { connect: walletManagementConnect, disconnect: walletManagementDisconnect, signer, provider, } = (0, wallet_management_1.useLiFiWalletManagement)();
|
|
25
25
|
const [account, setAccount] = (0, react_1.useState)({});
|
|
26
|
+
const [currentWallet, setCurrentWallet] = (0, react_1.useState)();
|
|
27
|
+
(0, react_1.useEffect)(() => {
|
|
28
|
+
const autoConnect = async () => {
|
|
29
|
+
const persistedActiveWallets = (0, wallet_management_1.readActiveWallets)();
|
|
30
|
+
const activeWallets = wallet_management_1.supportedWallets.filter((wallet) => persistedActiveWallets.some((perstistedWallet) => perstistedWallet.name === wallet.name));
|
|
31
|
+
if (!activeWallets.length) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
await liFiWalletManagement.autoConnect(activeWallets);
|
|
35
|
+
activeWallets[0].on('walletAccountChanged', handleWalletUpdate);
|
|
36
|
+
handleWalletUpdate(activeWallets[0]);
|
|
37
|
+
};
|
|
38
|
+
autoConnect();
|
|
39
|
+
}, []);
|
|
40
|
+
const handleWalletUpdate = async (wallet) => {
|
|
41
|
+
setCurrentWallet(wallet);
|
|
42
|
+
const account = await (0, exports.extractAccountFromSigner)(wallet?.account?.signer);
|
|
43
|
+
setAccount(account);
|
|
44
|
+
};
|
|
26
45
|
const connect = (0, react_1.useCallback)(async (wallet) => {
|
|
27
46
|
if (walletManagement) {
|
|
28
47
|
const signer = await walletManagement.connect();
|
|
@@ -30,17 +49,22 @@ const WalletProvider = ({ children }) => {
|
|
|
30
49
|
setAccount(account);
|
|
31
50
|
return;
|
|
32
51
|
}
|
|
33
|
-
await
|
|
34
|
-
|
|
52
|
+
await liFiWalletManagement.connect(wallet);
|
|
53
|
+
wallet.on('walletAccountChanged', handleWalletUpdate);
|
|
54
|
+
handleWalletUpdate(wallet);
|
|
55
|
+
}, [walletManagement]);
|
|
35
56
|
const disconnect = (0, react_1.useCallback)(async () => {
|
|
36
57
|
if (walletManagement) {
|
|
37
58
|
await walletManagement.disconnect();
|
|
38
59
|
setAccount({});
|
|
39
60
|
return;
|
|
40
61
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
62
|
+
if (currentWallet) {
|
|
63
|
+
await liFiWalletManagement.disconnect(currentWallet);
|
|
64
|
+
currentWallet.removeAllListeners();
|
|
65
|
+
handleWalletUpdate(undefined);
|
|
66
|
+
}
|
|
67
|
+
}, [walletManagement, currentWallet]);
|
|
44
68
|
const switchChain = (0, react_1.useCallback)(async (chainId) => {
|
|
45
69
|
if (walletManagement?.switchChain) {
|
|
46
70
|
const signer = await walletManagement.switchChain(chainId);
|
|
@@ -48,34 +72,46 @@ const WalletProvider = ({ children }) => {
|
|
|
48
72
|
setAccount(account);
|
|
49
73
|
return true;
|
|
50
74
|
}
|
|
51
|
-
|
|
52
|
-
|
|
75
|
+
try {
|
|
76
|
+
await currentWallet?.switchChain(chainId);
|
|
77
|
+
handleWalletUpdate(currentWallet);
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
}, [walletManagement, currentWallet]);
|
|
53
84
|
const addChain = (0, react_1.useCallback)(async (chainId) => {
|
|
54
85
|
if (walletManagement?.addChain) {
|
|
55
86
|
return walletManagement.addChain(chainId);
|
|
56
87
|
}
|
|
57
|
-
|
|
58
|
-
|
|
88
|
+
try {
|
|
89
|
+
await currentWallet?.addChain(chainId);
|
|
90
|
+
handleWalletUpdate(currentWallet);
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}, [walletManagement, currentWallet]);
|
|
59
97
|
const addToken = (0, react_1.useCallback)(async (chainId, token) => {
|
|
60
98
|
if (walletManagement?.addToken) {
|
|
61
99
|
return walletManagement.addToken(token, chainId);
|
|
62
100
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
101
|
+
await currentWallet?.addToken(chainId, token);
|
|
102
|
+
handleWalletUpdate(currentWallet);
|
|
103
|
+
return;
|
|
104
|
+
}, [walletManagement, currentWallet]);
|
|
105
|
+
// keep widget in sync with changing external signer object
|
|
66
106
|
(0, react_1.useEffect)(() => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
account
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
setAccount(account);
|
|
76
|
-
};
|
|
77
|
-
updateAccount();
|
|
78
|
-
}, [signer, walletManagement]);
|
|
107
|
+
if (walletManagement) {
|
|
108
|
+
const updateAccount = async () => {
|
|
109
|
+
const account = await (0, exports.extractAccountFromSigner)(walletManagement?.signer);
|
|
110
|
+
setAccount(account);
|
|
111
|
+
};
|
|
112
|
+
updateAccount();
|
|
113
|
+
}
|
|
114
|
+
}, [walletManagement, walletManagement?.signer]);
|
|
79
115
|
const value = (0, react_1.useMemo)(() => ({
|
|
80
116
|
connect,
|
|
81
117
|
disconnect,
|
|
@@ -83,8 +119,16 @@ const WalletProvider = ({ children }) => {
|
|
|
83
119
|
addChain,
|
|
84
120
|
addToken,
|
|
85
121
|
account,
|
|
86
|
-
provider,
|
|
87
|
-
}), [
|
|
122
|
+
provider: currentWallet?.account?.provider,
|
|
123
|
+
}), [
|
|
124
|
+
account,
|
|
125
|
+
addChain,
|
|
126
|
+
addToken,
|
|
127
|
+
connect,
|
|
128
|
+
disconnect,
|
|
129
|
+
currentWallet,
|
|
130
|
+
switchChain,
|
|
131
|
+
]);
|
|
88
132
|
return ((0, jsx_runtime_1.jsx)(WalletContext.Provider, { value: value, children: children }));
|
|
89
133
|
};
|
|
90
134
|
exports.WalletProvider = WalletProvider;
|
|
@@ -98,7 +142,7 @@ const extractAccountFromSigner = async (signer) => {
|
|
|
98
142
|
};
|
|
99
143
|
}
|
|
100
144
|
catch (error) {
|
|
101
|
-
console.
|
|
145
|
+
console.error(error);
|
|
102
146
|
return {};
|
|
103
147
|
}
|
|
104
148
|
};
|
|
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./types"), exports);
|
|
18
17
|
__exportStar(require("./WalletProvider"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -7,7 +7,7 @@ export interface WalletContextProps {
|
|
|
7
7
|
provider?: Provider;
|
|
8
8
|
addChain(chainId: number): Promise<boolean>;
|
|
9
9
|
addToken(chainId: number, token: Token): Promise<void>;
|
|
10
|
-
disconnect(): void;
|
|
10
|
+
disconnect(wallet?: Wallet): void;
|
|
11
11
|
switchChain(chainId: number): Promise<boolean>;
|
|
12
12
|
connect(wallet?: Wallet | undefined): Promise<void>;
|
|
13
13
|
}
|
package/cjs/types/widget.d.ts
CHANGED
|
@@ -75,7 +75,6 @@ export interface WidgetConfig {
|
|
|
75
75
|
appearance?: Appearance;
|
|
76
76
|
theme?: ThemeConfig;
|
|
77
77
|
containerStyle?: CSSProperties;
|
|
78
|
-
disableTelemetry?: boolean;
|
|
79
78
|
disabledUI?: DisabledUIType[];
|
|
80
79
|
hiddenUI?: HiddenUIType[];
|
|
81
80
|
requiredUI?: RequiredUIType[];
|
|
@@ -107,7 +106,7 @@ export interface WidgetConfig {
|
|
|
107
106
|
deny?: LanguageKey[];
|
|
108
107
|
};
|
|
109
108
|
languageResources?: LanguageResources;
|
|
110
|
-
|
|
109
|
+
disableLanguageDetector?: boolean;
|
|
111
110
|
}
|
|
112
111
|
export type WidgetDrawerProps = {
|
|
113
112
|
elementRef?: RefObject<HTMLDivElement>;
|
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.2";
|
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.2';
|
package/i18n/pt.json
CHANGED
|
@@ -184,11 +184,13 @@
|
|
|
184
184
|
"swapStepDetails": "Converter na {{chain}} via {{tool}}",
|
|
185
185
|
"swapping": "Convertendo",
|
|
186
186
|
"tags": {
|
|
187
|
-
"
|
|
188
|
-
"
|
|
189
|
-
"
|
|
190
|
-
"
|
|
191
|
-
"
|
|
187
|
+
"cheapest": "Barato",
|
|
188
|
+
"fastest": "Rápido",
|
|
189
|
+
"insurable": "Assegurável",
|
|
190
|
+
"insurance": "Seguro",
|
|
191
|
+
"insured": "Segurado",
|
|
192
|
+
"recommended": "Recomendado",
|
|
193
|
+
"safest": "Seguro"
|
|
192
194
|
},
|
|
193
195
|
"to": "Para",
|
|
194
196
|
"tokenOnChain": "{{tokenSymbol}} na {{chainName}}",
|
|
@@ -218,6 +220,7 @@
|
|
|
218
220
|
}
|
|
219
221
|
},
|
|
220
222
|
"tooltip": {
|
|
223
|
+
"additionalProviderFee": "Pontes adicionais, DEXes e taxas de serviço.",
|
|
221
224
|
"estimatedNetworkFee": "Taxa de rede estimada.",
|
|
222
225
|
"estimatedTime": "Tempo de execução da conversão estimado em minutos.",
|
|
223
226
|
"notFound": {
|
package/i18n/uk.json
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"from": "Своп з",
|
|
42
42
|
"gas": "Газ",
|
|
43
43
|
"gasSwap": "Своп газу",
|
|
44
|
-
"routes": "Ви
|
|
44
|
+
"routes": "Ви отримаєте",
|
|
45
45
|
"selectChain": "Оберіть чейн",
|
|
46
46
|
"selectWallet": "Виберіть свій гаманець",
|
|
47
47
|
"settings": "Налаштування",
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
"rateChange": "Зміна курсу",
|
|
158
158
|
"receiving": "Отримання",
|
|
159
159
|
"refuelStepDetails": "Отримати газ через {{tool}}",
|
|
160
|
-
"routes": "Ви
|
|
160
|
+
"routes": "Ви отримаєте",
|
|
161
161
|
"selectChain": "Чейн",
|
|
162
162
|
"selectChainAndToken": "Виберіть чейн і токен",
|
|
163
163
|
"selectToken": "Токен",
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
"tags": {
|
|
187
187
|
"cheapest": "Дешевий",
|
|
188
188
|
"fastest": "Швидкий",
|
|
189
|
-
"insurable": "
|
|
189
|
+
"insurable": "Страховка",
|
|
190
190
|
"insurance": "Страхування",
|
|
191
191
|
"insured": "Застрахований",
|
|
192
192
|
"recommended": "Рекомендований",
|