@txnlab/use-wallet 1.2.2 → 1.2.4
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/dist/esm/index.js
CHANGED
|
@@ -2399,12 +2399,25 @@ const initializeProviders = (providers, nodeConfig, algosdkStatic) => {
|
|
|
2399
2399
|
return initializedProviders;
|
|
2400
2400
|
};
|
|
2401
2401
|
|
|
2402
|
+
const getActiveProviders = () => {
|
|
2403
|
+
const accounts = useWalletStore.getState().accounts;
|
|
2404
|
+
return [...new Set(accounts.map((acct) => acct.providerId))];
|
|
2405
|
+
};
|
|
2406
|
+
const isActiveProvider = (id) => {
|
|
2407
|
+
const activeProviders = getActiveProviders();
|
|
2408
|
+
return activeProviders.includes(id);
|
|
2409
|
+
};
|
|
2410
|
+
|
|
2402
2411
|
const reconnectProviders = async (providers) => {
|
|
2403
2412
|
try {
|
|
2404
2413
|
const clients = Object.values(providers);
|
|
2405
2414
|
for (const client of clients) {
|
|
2406
2415
|
const c = await client;
|
|
2407
|
-
|
|
2416
|
+
const id = c?.metadata.id;
|
|
2417
|
+
// Only reconnect to active providers
|
|
2418
|
+
if (id && isActiveProvider(id)) {
|
|
2419
|
+
c.reconnect(() => clearAccounts(id));
|
|
2420
|
+
}
|
|
2408
2421
|
}
|
|
2409
2422
|
}
|
|
2410
2423
|
catch (e) {
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"url": "https://github.com/txnlab/use-wallet/issues"
|
|
13
13
|
},
|
|
14
14
|
"homepage": "https://txnlab.github.io/use-wallet",
|
|
15
|
-
"version": "1.2.
|
|
15
|
+
"version": "1.2.4",
|
|
16
16
|
"description": "React hooks for using Algorand compatible wallets in dApps.",
|
|
17
17
|
"scripts": {
|
|
18
18
|
"dev": "yarn storybook",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@blockshake/defly-connect": "^1.0.0",
|
|
34
34
|
"@json-rpc-tools/utils": "^1.7.6",
|
|
35
35
|
"@mdx-js/react": "^2.1.2",
|
|
36
|
-
"@perawallet/connect": "^1.1.
|
|
36
|
+
"@perawallet/connect": "^1.1.1",
|
|
37
37
|
"@randlabs/myalgo-connect": "^1.4.2",
|
|
38
38
|
"@rollup/plugin-commonjs": "^23.0.2",
|
|
39
39
|
"@rollup/plugin-json": "^5.0.1",
|