@dynamic-labs/ethereum 2.0.0-alpha.20 → 2.0.0-alpha.21
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
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.0.0-alpha.21](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.20...v2.0.0-alpha.21) (2024-03-20)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* implement barebones signer in PhantomRedirect connector ([#5043](https://github.com/dynamic-labs/DynamicAuth/issues/5043)) ([4d7ff79](https://github.com/dynamic-labs/DynamicAuth/commit/4d7ff79acfe554d651791139b5e1d23ebafe712c))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* find embedded wallets when no chain is specified ([#5036](https://github.com/dynamic-labs/DynamicAuth/issues/5036)) ([ac50742](https://github.com/dynamic-labs/DynamicAuth/commit/ac50742c6002f48aae7b60c9ec094eb12df8dcca))
|
|
13
|
+
* ignore walletconnect chainChange event when it's the same chain ([#5029](https://github.com/dynamic-labs/DynamicAuth/issues/5029)) ([115311a](https://github.com/dynamic-labs/DynamicAuth/commit/115311a4a64ae35317b8864f93c38203566714fc))
|
|
14
|
+
|
|
2
15
|
## [2.0.0-alpha.20](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.19...v2.0.0-alpha.20) (2024-03-19)
|
|
3
16
|
|
|
4
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ethereum",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.21",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"@walletconnect/universal-provider": "2.10.6",
|
|
31
31
|
"eventemitter3": "5.0.1",
|
|
32
32
|
"buffer": "6.0.3",
|
|
33
|
-
"@dynamic-labs/rpc-provider-ethereum": "2.0.0-alpha.
|
|
34
|
-
"@dynamic-labs/turnkey": "2.0.0-alpha.
|
|
35
|
-
"@dynamic-labs/types": "2.0.0-alpha.
|
|
36
|
-
"@dynamic-labs/utils": "2.0.0-alpha.
|
|
37
|
-
"@dynamic-labs/viem-utils": "2.0.0-alpha.
|
|
38
|
-
"@dynamic-labs/wallet-book": "2.0.0-alpha.
|
|
39
|
-
"@dynamic-labs/wallet-connector-core": "2.0.0-alpha.
|
|
33
|
+
"@dynamic-labs/rpc-provider-ethereum": "2.0.0-alpha.21",
|
|
34
|
+
"@dynamic-labs/turnkey": "2.0.0-alpha.21",
|
|
35
|
+
"@dynamic-labs/types": "2.0.0-alpha.21",
|
|
36
|
+
"@dynamic-labs/utils": "2.0.0-alpha.21",
|
|
37
|
+
"@dynamic-labs/viem-utils": "2.0.0-alpha.21",
|
|
38
|
+
"@dynamic-labs/wallet-book": "2.0.0-alpha.21",
|
|
39
|
+
"@dynamic-labs/wallet-connector-core": "2.0.0-alpha.21",
|
|
40
40
|
"stream": "0.0.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
@@ -191,6 +191,10 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
|
|
|
191
191
|
const { name, data } = params.event;
|
|
192
192
|
if (name === 'chainChanged') {
|
|
193
193
|
const chainId = parseIntSafe.parseIntSafe(data);
|
|
194
|
+
if (chainId === this.currentChainId) {
|
|
195
|
+
walletConnectorCore.logger.debug(`ignoring chainChanged event with same chain id as current chain id: ${chainId}`);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
194
198
|
if (chainId === undefined) {
|
|
195
199
|
walletConnectorCore.logger.debug(`received unexpected data for chainChanged: ${data} with type ${typeof data}}`);
|
|
196
200
|
return;
|
|
@@ -286,7 +290,10 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
|
|
|
286
290
|
}
|
|
287
291
|
this.setSession(session);
|
|
288
292
|
this.setActiveAccount(session.namespaces.eip155.accounts[0].split(':')[2]);
|
|
289
|
-
|
|
293
|
+
this.getNetwork().then((chainId) => {
|
|
294
|
+
this.currentChainId = chainId;
|
|
295
|
+
resolve(this.activeAccount);
|
|
296
|
+
});
|
|
290
297
|
// We must clean up the onConnect and onFail listeners
|
|
291
298
|
// whenever the connection attempt either succeeds or fails
|
|
292
299
|
cleanupListeners();
|
|
@@ -314,10 +321,12 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
|
|
|
314
321
|
*/
|
|
315
322
|
waitForSignMessage(signMessageFn, messageToSign) {
|
|
316
323
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
317
|
-
const raceConditionPromise = new Promise((resolve) => {
|
|
324
|
+
const raceConditionPromise = new Promise((resolve, reject) => {
|
|
318
325
|
// Create listener for chain change event
|
|
319
326
|
this.on('chainChange', () => resolve({ success: false }));
|
|
320
|
-
signMessageFn(messageToSign)
|
|
327
|
+
signMessageFn(messageToSign)
|
|
328
|
+
.then((result) => resolve({ signedMessage: result, success: true }))
|
|
329
|
+
.catch(reject);
|
|
321
330
|
});
|
|
322
331
|
const signedMessageResult = yield raceConditionPromise;
|
|
323
332
|
if (signedMessageResult.success === false) {
|
|
@@ -182,6 +182,10 @@ class WalletConnect extends EthWalletConnector {
|
|
|
182
182
|
const { name, data } = params.event;
|
|
183
183
|
if (name === 'chainChanged') {
|
|
184
184
|
const chainId = parseIntSafe(data);
|
|
185
|
+
if (chainId === this.currentChainId) {
|
|
186
|
+
logger.debug(`ignoring chainChanged event with same chain id as current chain id: ${chainId}`);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
185
189
|
if (chainId === undefined) {
|
|
186
190
|
logger.debug(`received unexpected data for chainChanged: ${data} with type ${typeof data}}`);
|
|
187
191
|
return;
|
|
@@ -277,7 +281,10 @@ class WalletConnect extends EthWalletConnector {
|
|
|
277
281
|
}
|
|
278
282
|
this.setSession(session);
|
|
279
283
|
this.setActiveAccount(session.namespaces.eip155.accounts[0].split(':')[2]);
|
|
280
|
-
|
|
284
|
+
this.getNetwork().then((chainId) => {
|
|
285
|
+
this.currentChainId = chainId;
|
|
286
|
+
resolve(this.activeAccount);
|
|
287
|
+
});
|
|
281
288
|
// We must clean up the onConnect and onFail listeners
|
|
282
289
|
// whenever the connection attempt either succeeds or fails
|
|
283
290
|
cleanupListeners();
|
|
@@ -305,10 +312,12 @@ class WalletConnect extends EthWalletConnector {
|
|
|
305
312
|
*/
|
|
306
313
|
waitForSignMessage(signMessageFn, messageToSign) {
|
|
307
314
|
return __awaiter(this, void 0, void 0, function* () {
|
|
308
|
-
const raceConditionPromise = new Promise((resolve) => {
|
|
315
|
+
const raceConditionPromise = new Promise((resolve, reject) => {
|
|
309
316
|
// Create listener for chain change event
|
|
310
317
|
this.on('chainChange', () => resolve({ success: false }));
|
|
311
|
-
signMessageFn(messageToSign)
|
|
318
|
+
signMessageFn(messageToSign)
|
|
319
|
+
.then((result) => resolve({ signedMessage: result, success: true }))
|
|
320
|
+
.catch(reject);
|
|
312
321
|
});
|
|
313
322
|
const signedMessageResult = yield raceConditionPromise;
|
|
314
323
|
if (signedMessageResult.success === false) {
|