@dynamic-labs/ethereum 1.1.0-alpha.19 → 1.1.0-alpha.20

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,12 @@
1
1
 
2
+ ## [1.1.0-alpha.20](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.19...v1.1.0-alpha.20) (2024-01-31)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * return all enabled chains in getSupportedNetworks instead of undefined ([#4547](https://github.com/dynamic-labs/DynamicAuth/issues/4547)) ([08e7889](https://github.com/dynamic-labs/DynamicAuth/commit/08e78896e045f24bbd96e39416a7f58006929da0))
8
+ * show modal for existing social account from other signin provider ([#4535](https://github.com/dynamic-labs/DynamicAuth/issues/4535)) ([282914a](https://github.com/dynamic-labs/DynamicAuth/commit/282914ac94b3ef5bd66e0b2265d9e414203a7406))
9
+
2
10
  ## [1.1.0-alpha.19](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.18...v1.1.0-alpha.19) (2024-01-31)
3
11
 
4
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum",
3
- "version": "1.1.0-alpha.19",
3
+ "version": "1.1.0-alpha.20",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -32,12 +32,12 @@
32
32
  "@walletconnect/universal-provider": "2.10.6",
33
33
  "eventemitter3": "5.0.1",
34
34
  "buffer": "6.0.3",
35
- "@dynamic-labs/rpc-providers": "1.1.0-alpha.19",
36
- "@dynamic-labs/turnkey": "1.1.0-alpha.19",
37
- "@dynamic-labs/types": "1.1.0-alpha.19",
38
- "@dynamic-labs/utils": "1.1.0-alpha.19",
39
- "@dynamic-labs/wallet-book": "1.1.0-alpha.19",
40
- "@dynamic-labs/wallet-connector-core": "1.1.0-alpha.19",
35
+ "@dynamic-labs/rpc-providers": "1.1.0-alpha.20",
36
+ "@dynamic-labs/turnkey": "1.1.0-alpha.20",
37
+ "@dynamic-labs/types": "1.1.0-alpha.20",
38
+ "@dynamic-labs/utils": "1.1.0-alpha.20",
39
+ "@dynamic-labs/wallet-book": "1.1.0-alpha.20",
40
+ "@dynamic-labs/wallet-connector-core": "1.1.0-alpha.20",
41
41
  "stream": "0.0.2"
42
42
  },
43
43
  "peerDependencies": {
@@ -439,11 +439,17 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
439
439
  return [this.activeAccount];
440
440
  });
441
441
  }
442
+ isMetaMask() {
443
+ var _a, _b, _c, _d, _e;
444
+ return ((_e = (_d = (_c = (_b = (_a = this.session) === null || _a === void 0 ? void 0 : _a.peer) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c.name) === null || _d === void 0 ? void 0 : _d.toLowerCase().startsWith('metamask')) !== null && _e !== void 0 ? _e : false);
445
+ }
442
446
  getSupportedNetworks() {
443
447
  var _a;
444
448
  return _tslib.__awaiter(this, void 0, void 0, function* () {
445
- if (!this.hasSwitchedNetwork) {
446
- return undefined;
449
+ // MM allows you to switch to any network the first time, even if it's not enabled in MM
450
+ // so we should consider all networks as supported if network switching hasn't been triggered yet
451
+ if (this.isMetaMask() && !this.hasSwitchedNetwork) {
452
+ return this.evmNetworks.map((network) => network.chainId.toString());
447
453
  }
448
454
  yield this.initProvider();
449
455
  this.refreshSession();
@@ -459,7 +465,9 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
459
465
  }
460
466
  });
461
467
  (_a = this.session.namespaces.eip155) === null || _a === void 0 ? void 0 : _a.accounts.forEach((account) => chains.push(account.split(':')[1]));
462
- return chains.length ? chains : undefined;
468
+ return chains.length
469
+ ? chains
470
+ : this.evmNetworks.map((network) => network.chainId.toString());
463
471
  });
464
472
  }
465
473
  }
@@ -328,5 +328,6 @@ export declare class WalletConnectV2 extends EthWalletConnector {
328
328
  provider: WalletClient;
329
329
  }): Promise<void>;
330
330
  getConnectedAccounts(): Promise<string[]>;
331
+ private isMetaMask;
331
332
  getSupportedNetworks(): Promise<string[] | undefined>;
332
333
  }
@@ -430,11 +430,17 @@ class WalletConnectV2 extends EthWalletConnector {
430
430
  return [this.activeAccount];
431
431
  });
432
432
  }
433
+ isMetaMask() {
434
+ var _a, _b, _c, _d, _e;
435
+ return ((_e = (_d = (_c = (_b = (_a = this.session) === null || _a === void 0 ? void 0 : _a.peer) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c.name) === null || _d === void 0 ? void 0 : _d.toLowerCase().startsWith('metamask')) !== null && _e !== void 0 ? _e : false);
436
+ }
433
437
  getSupportedNetworks() {
434
438
  var _a;
435
439
  return __awaiter(this, void 0, void 0, function* () {
436
- if (!this.hasSwitchedNetwork) {
437
- return undefined;
440
+ // MM allows you to switch to any network the first time, even if it's not enabled in MM
441
+ // so we should consider all networks as supported if network switching hasn't been triggered yet
442
+ if (this.isMetaMask() && !this.hasSwitchedNetwork) {
443
+ return this.evmNetworks.map((network) => network.chainId.toString());
438
444
  }
439
445
  yield this.initProvider();
440
446
  this.refreshSession();
@@ -450,7 +456,9 @@ class WalletConnectV2 extends EthWalletConnector {
450
456
  }
451
457
  });
452
458
  (_a = this.session.namespaces.eip155) === null || _a === void 0 ? void 0 : _a.accounts.forEach((account) => chains.push(account.split(':')[1]));
453
- return chains.length ? chains : undefined;
459
+ return chains.length
460
+ ? chains
461
+ : this.evmNetworks.map((network) => network.chainId.toString());
454
462
  });
455
463
  }
456
464
  }