@dynamic-labs/sdk-react-core 1.0.0-alpha.12 → 1.0.0-alpha.13
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/CHANGELOG.md +7 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +10 -10
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +5 -5
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +5 -5
- package/src/lib/utils/hooks/useWalletConnectors/utils/updateUserWalletsFromLinkedWallets/updateUserWalletsFromLinkedWallets.cjs +0 -2
- package/src/lib/utils/hooks/useWalletConnectors/utils/updateUserWalletsFromLinkedWallets/updateUserWalletsFromLinkedWallets.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
## [1.0.0-alpha.13](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.12...v1.0.0-alpha.13) (2023-12-12)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* embedded wallet connected flag not picking up ([#4128](https://github.com/dynamic-labs/DynamicAuth/issues/4128)) ([c6fbb1d](https://github.com/dynamic-labs/DynamicAuth/commit/c6fbb1de2027b186a4277a75545fd66d0d11ba95))
|
|
8
|
+
|
|
2
9
|
## [1.0.0-alpha.12](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.11...v1.0.0-alpha.12) (2023-12-11)
|
|
3
10
|
|
|
4
11
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.13",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
"react-focus-lock": "2.9.2",
|
|
18
18
|
"react-i18next": "^13.2.0",
|
|
19
19
|
"yup": "0.32.11",
|
|
20
|
-
"@dynamic-labs/ethereum": "1.0.0-alpha.
|
|
21
|
-
"@dynamic-labs/logger": "1.0.0-alpha.
|
|
22
|
-
"@dynamic-labs/multi-wallet": "1.0.0-alpha.
|
|
23
|
-
"@dynamic-labs/rpc-providers": "1.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/types": "1.0.0-alpha.
|
|
25
|
-
"@dynamic-labs/utils": "1.0.0-alpha.
|
|
26
|
-
"@dynamic-labs/viem-utils": "1.0.0-alpha.
|
|
27
|
-
"@dynamic-labs/wallet-book": "1.0.0-alpha.
|
|
28
|
-
"@dynamic-labs/wallet-connector-core": "1.0.0-alpha.
|
|
20
|
+
"@dynamic-labs/ethereum": "1.0.0-alpha.13",
|
|
21
|
+
"@dynamic-labs/logger": "1.0.0-alpha.13",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "1.0.0-alpha.13",
|
|
23
|
+
"@dynamic-labs/rpc-providers": "1.0.0-alpha.13",
|
|
24
|
+
"@dynamic-labs/types": "1.0.0-alpha.13",
|
|
25
|
+
"@dynamic-labs/utils": "1.0.0-alpha.13",
|
|
26
|
+
"@dynamic-labs/viem-utils": "1.0.0-alpha.13",
|
|
27
|
+
"@dynamic-labs/wallet-book": "1.0.0-alpha.13",
|
|
28
|
+
"@dynamic-labs/wallet-connector-core": "1.0.0-alpha.13",
|
|
29
29
|
"eventemitter3": "5.0.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
@@ -35,11 +35,6 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, walletConn
|
|
|
35
35
|
walletConnectorOptions,
|
|
36
36
|
});
|
|
37
37
|
}, [authToken, primaryWalletId, walletConnectorOptions]);
|
|
38
|
-
const { setUserWallets } = UserWalletsContext.useInternalUserWallets();
|
|
39
|
-
// Keep userWallets in sync whenever linkedWallets changes
|
|
40
|
-
React.useEffect(() => {
|
|
41
|
-
setUserWallets((userWallets) => updateUserWalletsFromLinkedWallets.updateUserWalletsFromLinkedWallets(userWallets, linkedWallets));
|
|
42
|
-
}, [linkedWallets, setUserWallets]);
|
|
43
38
|
const walletsBasedOnAuthMode = React.useMemo(() => {
|
|
44
39
|
// Before signing the first message we are using connected wallets list
|
|
45
40
|
// This is because we want the first connected wallet to have events applied by useWalletEventListeners
|
|
@@ -71,6 +66,11 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, walletConn
|
|
|
71
66
|
}), [walletsBasedOnAuthMode]);
|
|
72
67
|
const { connectedWalletMap, didConnectedStateLoad } = useWalletsConnectionState.useWalletsConnectionState(walletsBasedOnAuthMode);
|
|
73
68
|
const wallets = React.useMemo(() => walletsBasedOnAuthMode.map((wallet) => (Object.assign(Object.assign({}, wallet), { connected: Boolean(connectedWalletMap[wallet.id]) }))), [connectedWalletMap, walletsBasedOnAuthMode]);
|
|
69
|
+
const { setUserWallets } = UserWalletsContext.useInternalUserWallets();
|
|
70
|
+
// Keep userWallets in sync whenever linkedWallets changes
|
|
71
|
+
React.useEffect(() => {
|
|
72
|
+
setUserWallets((userWallets) => updateUserWalletsFromLinkedWallets.updateUserWalletsFromLinkedWallets(userWallets, wallets));
|
|
73
|
+
}, [setUserWallets, wallets]);
|
|
74
74
|
const primaryWallet = React.useMemo(() => { var _a; return (_a = wallets.find((wallet) => wallet.id === primaryWalletId)) !== null && _a !== void 0 ? _a : null; }, [primaryWalletId, wallets]);
|
|
75
75
|
const secondaryWallets = React.useMemo(() => canHaveMultipleWalletsConnected
|
|
76
76
|
? wallets.filter((wallet) => wallet.id !== primaryWalletId)
|
|
@@ -31,11 +31,6 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, walletConn
|
|
|
31
31
|
walletConnectorOptions,
|
|
32
32
|
});
|
|
33
33
|
}, [authToken, primaryWalletId, walletConnectorOptions]);
|
|
34
|
-
const { setUserWallets } = useInternalUserWallets();
|
|
35
|
-
// Keep userWallets in sync whenever linkedWallets changes
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
setUserWallets((userWallets) => updateUserWalletsFromLinkedWallets(userWallets, linkedWallets));
|
|
38
|
-
}, [linkedWallets, setUserWallets]);
|
|
39
34
|
const walletsBasedOnAuthMode = useMemo(() => {
|
|
40
35
|
// Before signing the first message we are using connected wallets list
|
|
41
36
|
// This is because we want the first connected wallet to have events applied by useWalletEventListeners
|
|
@@ -67,6 +62,11 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, walletConn
|
|
|
67
62
|
}), [walletsBasedOnAuthMode]);
|
|
68
63
|
const { connectedWalletMap, didConnectedStateLoad } = useWalletsConnectionState(walletsBasedOnAuthMode);
|
|
69
64
|
const wallets = useMemo(() => walletsBasedOnAuthMode.map((wallet) => (Object.assign(Object.assign({}, wallet), { connected: Boolean(connectedWalletMap[wallet.id]) }))), [connectedWalletMap, walletsBasedOnAuthMode]);
|
|
65
|
+
const { setUserWallets } = useInternalUserWallets();
|
|
66
|
+
// Keep userWallets in sync whenever linkedWallets changes
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
setUserWallets((userWallets) => updateUserWalletsFromLinkedWallets(userWallets, wallets));
|
|
69
|
+
}, [setUserWallets, wallets]);
|
|
70
70
|
const primaryWallet = useMemo(() => { var _a; return (_a = wallets.find((wallet) => wallet.id === primaryWalletId)) !== null && _a !== void 0 ? _a : null; }, [primaryWalletId, wallets]);
|
|
71
71
|
const secondaryWallets = useMemo(() => canHaveMultipleWalletsConnected
|
|
72
72
|
? wallets.filter((wallet) => wallet.id !== primaryWalletId)
|
|
@@ -22,8 +22,6 @@ const updateUserWalletsFromLinkedWallets = (userWallets, authenticatedWallets) =
|
|
|
22
22
|
continue;
|
|
23
23
|
}
|
|
24
24
|
// If already present, just update to match the new state
|
|
25
|
-
// Don't change connected state
|
|
26
|
-
authenticatedWallet.connected = userWalletsCopy[respectiveIndex].connected;
|
|
27
25
|
userWalletsCopy[respectiveIndex] = authenticatedWallet;
|
|
28
26
|
// NOTE: this will actually update the wallet's ID if it changed, which happens when a wallet is signed
|
|
29
27
|
// It initially has a id in the format "connected-wallet-X", and after being signed it changes to a hash
|
|
@@ -18,8 +18,6 @@ const updateUserWalletsFromLinkedWallets = (userWallets, authenticatedWallets) =
|
|
|
18
18
|
continue;
|
|
19
19
|
}
|
|
20
20
|
// If already present, just update to match the new state
|
|
21
|
-
// Don't change connected state
|
|
22
|
-
authenticatedWallet.connected = userWalletsCopy[respectiveIndex].connected;
|
|
23
21
|
userWalletsCopy[respectiveIndex] = authenticatedWallet;
|
|
24
22
|
// NOTE: this will actually update the wallet's ID if it changed, which happens when a wallet is signed
|
|
25
23
|
// It initially has a id in the format "connected-wallet-X", and after being signed it changes to a hash
|