@dynamic-labs/sdk-react-core 3.0.0-alpha.43 → 3.0.0-alpha.44
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 +8 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +2 -0
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +2 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.cjs +2 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.js +2 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +7 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +7 -2
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js +1 -0
- package/src/lib/views/EmailVerification/EmailVerification.cjs +1 -0
- package/src/lib/views/EmailVerification/EmailVerification.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.0.0-alpha.44](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.43...v3.0.0-alpha.44) (2024-08-15)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* populate wallet new isPrimary flag ([#6597](https://github.com/dynamic-labs/DynamicAuth/issues/6597)) ([7809f81](https://github.com/dynamic-labs/DynamicAuth/commit/7809f81c9743b8bf7bc27dc34cf45923cf9baf99))
|
|
8
|
+
* twitter should no longer rely polling for oauth flow ([#6603](https://github.com/dynamic-labs/DynamicAuth/issues/6603)) ([09aea8b](https://github.com/dynamic-labs/DynamicAuth/commit/09aea8b3f197c25dcfb5bc72049b90859df246f3))
|
|
9
|
+
|
|
2
10
|
## [3.0.0-alpha.43](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.42...v3.0.0-alpha.43) (2024-08-15)
|
|
3
11
|
|
|
4
12
|
|
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": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.44",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
"react-i18next": "13.5.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
19
|
"react-international-phone": "4.2.5",
|
|
20
|
-
"@dynamic-labs/iconic": "3.0.0-alpha.
|
|
21
|
-
"@dynamic-labs/logger": "3.0.0-alpha.
|
|
22
|
-
"@dynamic-labs/message-transport": "3.0.0-alpha.
|
|
23
|
-
"@dynamic-labs/multi-wallet": "3.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/rpc-providers": "3.0.0-alpha.
|
|
25
|
-
"@dynamic-labs/store": "3.0.0-alpha.
|
|
26
|
-
"@dynamic-labs/types": "3.0.0-alpha.
|
|
27
|
-
"@dynamic-labs/utils": "3.0.0-alpha.
|
|
28
|
-
"@dynamic-labs/viem-utils": "3.0.0-alpha.
|
|
29
|
-
"@dynamic-labs/wallet-book": "3.0.0-alpha.
|
|
30
|
-
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.
|
|
20
|
+
"@dynamic-labs/iconic": "3.0.0-alpha.44",
|
|
21
|
+
"@dynamic-labs/logger": "3.0.0-alpha.44",
|
|
22
|
+
"@dynamic-labs/message-transport": "3.0.0-alpha.44",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "3.0.0-alpha.44",
|
|
24
|
+
"@dynamic-labs/rpc-providers": "3.0.0-alpha.44",
|
|
25
|
+
"@dynamic-labs/store": "3.0.0-alpha.44",
|
|
26
|
+
"@dynamic-labs/types": "3.0.0-alpha.44",
|
|
27
|
+
"@dynamic-labs/utils": "3.0.0-alpha.44",
|
|
28
|
+
"@dynamic-labs/viem-utils": "3.0.0-alpha.44",
|
|
29
|
+
"@dynamic-labs/wallet-book": "3.0.0-alpha.44",
|
|
30
|
+
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.44",
|
|
31
31
|
"eventemitter3": "5.0.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
@@ -165,6 +165,7 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
165
165
|
connector: walletConnector,
|
|
166
166
|
id: storedConnectedWalletInfo.id,
|
|
167
167
|
isAuthenticated: false,
|
|
168
|
+
isPrimary: primaryWalletId === storedConnectedWalletInfo.id,
|
|
168
169
|
key: walletConnector.key,
|
|
169
170
|
network: walletNetwork,
|
|
170
171
|
});
|
|
@@ -176,6 +177,7 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
176
177
|
disconnectWallet,
|
|
177
178
|
setConnectedWallets,
|
|
178
179
|
walletConnectorOptions,
|
|
180
|
+
primaryWalletId,
|
|
179
181
|
]);
|
|
180
182
|
// Generate the connectedWallets list when connectedWalletsInfo (localStorage) or memoized wallet connector updates
|
|
181
183
|
React.useEffect(() => {
|
|
@@ -161,6 +161,7 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
161
161
|
connector: walletConnector,
|
|
162
162
|
id: storedConnectedWalletInfo.id,
|
|
163
163
|
isAuthenticated: false,
|
|
164
|
+
isPrimary: primaryWalletId === storedConnectedWalletInfo.id,
|
|
164
165
|
key: walletConnector.key,
|
|
165
166
|
network: walletNetwork,
|
|
166
167
|
});
|
|
@@ -172,6 +173,7 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
172
173
|
disconnectWallet,
|
|
173
174
|
setConnectedWallets,
|
|
174
175
|
walletConnectorOptions,
|
|
176
|
+
primaryWalletId,
|
|
175
177
|
]);
|
|
176
178
|
// Generate the connectedWallets list when connectedWalletsInfo (localStorage) or memoized wallet connector updates
|
|
177
179
|
useEffect(() => {
|
package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.cjs
CHANGED
|
@@ -112,6 +112,7 @@ const useCoinbaseMPC = () => {
|
|
|
112
112
|
connector,
|
|
113
113
|
id: embeddedWalletVerifiedCredential.id,
|
|
114
114
|
isAuthenticated: true,
|
|
115
|
+
isPrimary: true,
|
|
115
116
|
key: (_a = embeddedWalletVerifiedCredential.walletName) !== null && _a !== void 0 ? _a : connector.key,
|
|
116
117
|
});
|
|
117
118
|
return coinbaseMPCWallet;
|
|
@@ -178,6 +179,7 @@ const useCoinbaseMPC = () => {
|
|
|
178
179
|
connector,
|
|
179
180
|
id: newSelectedCredentialWallet.id,
|
|
180
181
|
isAuthenticated: true,
|
|
182
|
+
isPrimary: true,
|
|
181
183
|
key: (_c = newSelectedCredentialWallet.walletName) !== null && _c !== void 0 ? _c : connector.key,
|
|
182
184
|
});
|
|
183
185
|
dynamicEvents.dynamicEvents.emit('embeddedWalletCreated', coinbaseMPCWallet, newSelectedCredentialWallet, updatedUser);
|
package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.js
CHANGED
|
@@ -108,6 +108,7 @@ const useCoinbaseMPC = () => {
|
|
|
108
108
|
connector,
|
|
109
109
|
id: embeddedWalletVerifiedCredential.id,
|
|
110
110
|
isAuthenticated: true,
|
|
111
|
+
isPrimary: true,
|
|
111
112
|
key: (_a = embeddedWalletVerifiedCredential.walletName) !== null && _a !== void 0 ? _a : connector.key,
|
|
112
113
|
});
|
|
113
114
|
return coinbaseMPCWallet;
|
|
@@ -174,6 +175,7 @@ const useCoinbaseMPC = () => {
|
|
|
174
175
|
connector,
|
|
175
176
|
id: newSelectedCredentialWallet.id,
|
|
176
177
|
isAuthenticated: true,
|
|
178
|
+
isPrimary: true,
|
|
177
179
|
key: (_c = newSelectedCredentialWallet.walletName) !== null && _c !== void 0 ? _c : connector.key,
|
|
178
180
|
});
|
|
179
181
|
dynamicEvents.emit('embeddedWalletCreated', coinbaseMPCWallet, newSelectedCredentialWallet, updatedUser);
|
|
@@ -148,6 +148,7 @@ const useTurnkey = () => {
|
|
|
148
148
|
var _a, _b, _c, _d;
|
|
149
149
|
const { chain } = embeddedWalletVerifiedCredential;
|
|
150
150
|
const turnkeyWallet = findTurnkeyWallet.findTurnkeyWalletByChain(walletConnectorOptions, chain);
|
|
151
|
+
let newPrimaryWalletId = null;
|
|
151
152
|
// if user already has embedded wallet, set it as primary wallet
|
|
152
153
|
if (user) {
|
|
153
154
|
(_a = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) === null || _a === void 0 ? void 0 : _a.setVerifiedCredentials(user.verifiedCredentials);
|
|
@@ -158,12 +159,14 @@ const useTurnkey = () => {
|
|
|
158
159
|
verifiedCredentials: user.verifiedCredentials,
|
|
159
160
|
walletConnectorOptions,
|
|
160
161
|
});
|
|
161
|
-
|
|
162
|
+
newPrimaryWalletId = smartWallet$1.id;
|
|
162
163
|
}
|
|
163
164
|
else {
|
|
164
|
-
|
|
165
|
+
newPrimaryWalletId = embeddedWalletVerifiedCredential.id;
|
|
165
166
|
}
|
|
166
167
|
}
|
|
168
|
+
if (newPrimaryWalletId)
|
|
169
|
+
setPrimaryWalletId(newPrimaryWalletId);
|
|
167
170
|
/** It's not authenticated if it still hasn't created a passkey */
|
|
168
171
|
const isAuthenticated = Boolean((_b = embeddedWalletVerifiedCredential.walletProperties) === null || _b === void 0 ? void 0 : _b.isAuthenticatorAttached);
|
|
169
172
|
const passkeyWallet = new walletConnectorCore.Wallet({
|
|
@@ -172,6 +175,7 @@ const useTurnkey = () => {
|
|
|
172
175
|
connector: (turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) || {},
|
|
173
176
|
id: embeddedWalletVerifiedCredential.id,
|
|
174
177
|
isAuthenticated,
|
|
178
|
+
isPrimary: newPrimaryWalletId === embeddedWalletVerifiedCredential.id,
|
|
175
179
|
key: embeddedWalletVerifiedCredential.walletName ||
|
|
176
180
|
(turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector.key) ||
|
|
177
181
|
'',
|
|
@@ -224,6 +228,7 @@ const useTurnkey = () => {
|
|
|
224
228
|
connector: walletConnector,
|
|
225
229
|
id: embeddedWalletVerifiedCredential.id,
|
|
226
230
|
isAuthenticated: Boolean((_h = embeddedWalletVerifiedCredential === null || embeddedWalletVerifiedCredential === void 0 ? void 0 : embeddedWalletVerifiedCredential.walletProperties) === null || _h === void 0 ? void 0 : _h.isAuthenticatorAttached),
|
|
231
|
+
isPrimary: true,
|
|
227
232
|
key: (_j = embeddedWalletVerifiedCredential.walletName) !== null && _j !== void 0 ? _j : walletConnector.key,
|
|
228
233
|
});
|
|
229
234
|
setPrimaryWalletId(embeddedWalletVerifiedCredential.id);
|
|
@@ -144,6 +144,7 @@ const useTurnkey = () => {
|
|
|
144
144
|
var _a, _b, _c, _d;
|
|
145
145
|
const { chain } = embeddedWalletVerifiedCredential;
|
|
146
146
|
const turnkeyWallet = findTurnkeyWalletByChain(walletConnectorOptions, chain);
|
|
147
|
+
let newPrimaryWalletId = null;
|
|
147
148
|
// if user already has embedded wallet, set it as primary wallet
|
|
148
149
|
if (user) {
|
|
149
150
|
(_a = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) === null || _a === void 0 ? void 0 : _a.setVerifiedCredentials(user.verifiedCredentials);
|
|
@@ -154,12 +155,14 @@ const useTurnkey = () => {
|
|
|
154
155
|
verifiedCredentials: user.verifiedCredentials,
|
|
155
156
|
walletConnectorOptions,
|
|
156
157
|
});
|
|
157
|
-
|
|
158
|
+
newPrimaryWalletId = smartWallet.id;
|
|
158
159
|
}
|
|
159
160
|
else {
|
|
160
|
-
|
|
161
|
+
newPrimaryWalletId = embeddedWalletVerifiedCredential.id;
|
|
161
162
|
}
|
|
162
163
|
}
|
|
164
|
+
if (newPrimaryWalletId)
|
|
165
|
+
setPrimaryWalletId(newPrimaryWalletId);
|
|
163
166
|
/** It's not authenticated if it still hasn't created a passkey */
|
|
164
167
|
const isAuthenticated = Boolean((_b = embeddedWalletVerifiedCredential.walletProperties) === null || _b === void 0 ? void 0 : _b.isAuthenticatorAttached);
|
|
165
168
|
const passkeyWallet = new Wallet({
|
|
@@ -168,6 +171,7 @@ const useTurnkey = () => {
|
|
|
168
171
|
connector: (turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) || {},
|
|
169
172
|
id: embeddedWalletVerifiedCredential.id,
|
|
170
173
|
isAuthenticated,
|
|
174
|
+
isPrimary: newPrimaryWalletId === embeddedWalletVerifiedCredential.id,
|
|
171
175
|
key: embeddedWalletVerifiedCredential.walletName ||
|
|
172
176
|
(turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector.key) ||
|
|
173
177
|
'',
|
|
@@ -220,6 +224,7 @@ const useTurnkey = () => {
|
|
|
220
224
|
connector: walletConnector,
|
|
221
225
|
id: embeddedWalletVerifiedCredential.id,
|
|
222
226
|
isAuthenticated: Boolean((_h = embeddedWalletVerifiedCredential === null || embeddedWalletVerifiedCredential === void 0 ? void 0 : embeddedWalletVerifiedCredential.walletProperties) === null || _h === void 0 ? void 0 : _h.isAuthenticatorAttached),
|
|
227
|
+
isPrimary: true,
|
|
223
228
|
key: (_j = embeddedWalletVerifiedCredential.walletName) !== null && _j !== void 0 ? _j : walletConnector.key,
|
|
224
229
|
});
|
|
225
230
|
setPrimaryWalletId(embeddedWalletVerifiedCredential.id);
|
|
@@ -131,6 +131,7 @@ const createLinkedWalletsFromWalletOptions = ({ user, walletConnectorOptions, pr
|
|
|
131
131
|
connector: wallet.walletConnector,
|
|
132
132
|
id: account.id,
|
|
133
133
|
isAuthenticated: true,
|
|
134
|
+
isPrimary: account.id === primaryWalletId,
|
|
134
135
|
key: (_a = account.walletName) !== null && _a !== void 0 ? _a : wallet.walletConnector.key,
|
|
135
136
|
});
|
|
136
137
|
}
|
|
@@ -127,6 +127,7 @@ const createLinkedWalletsFromWalletOptions = ({ user, walletConnectorOptions, pr
|
|
|
127
127
|
connector: wallet.walletConnector,
|
|
128
128
|
id: account.id,
|
|
129
129
|
isAuthenticated: true,
|
|
130
|
+
isPrimary: account.id === primaryWalletId,
|
|
130
131
|
key: (_a = account.walletName) !== null && _a !== void 0 ? _a : wallet.walletConnector.key,
|
|
131
132
|
});
|
|
132
133
|
}
|
|
@@ -204,6 +204,7 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
|
|
|
204
204
|
connector: walletOption.walletConnector,
|
|
205
205
|
id: embeddedWalletVerifiedCredential.id,
|
|
206
206
|
isAuthenticated: false,
|
|
207
|
+
isPrimary: true,
|
|
207
208
|
key: (_k = embeddedWalletVerifiedCredential.walletName) !== null && _k !== void 0 ? _k : '',
|
|
208
209
|
});
|
|
209
210
|
setPrimaryWalletId(embeddedWalletVerifiedCredential.id);
|
|
@@ -200,6 +200,7 @@ const EmailVerification = ({ isEmailRecoveryFlow = false, showRetryButton: _show
|
|
|
200
200
|
connector: walletOption.walletConnector,
|
|
201
201
|
id: embeddedWalletVerifiedCredential.id,
|
|
202
202
|
isAuthenticated: false,
|
|
203
|
+
isPrimary: true,
|
|
203
204
|
key: (_k = embeddedWalletVerifiedCredential.walletName) !== null && _k !== void 0 ? _k : '',
|
|
204
205
|
});
|
|
205
206
|
setPrimaryWalletId(embeddedWalletVerifiedCredential.id);
|