@dynamic-labs/ethereum 0.18.13 → 0.18.14

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,16 @@
1
1
 
2
+ ### [0.18.14](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.13...v0.18.14) (2023-09-05)
3
+
4
+
5
+ ### Features
6
+
7
+ * add onSignedMessage callback ([#3213](https://github.com/dynamic-labs/DynamicAuth/issues/3213)) ([648defa](https://github.com/dynamic-labs/DynamicAuth/commit/648defa1c5f84805e5dcdbb98a30be2a47f53ed7))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * prefer mainnet chain id when connecting with WCv2 ([#3219](https://github.com/dynamic-labs/DynamicAuth/issues/3219)) ([6ee8fb6](https://github.com/dynamic-labs/DynamicAuth/commit/6ee8fb6c0565e759837f45179de12c985ac0dd71))
13
+
2
14
  ### [0.18.13](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.12...v0.18.13) (2023-08-31)
3
15
 
4
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum",
3
- "version": "0.18.13",
3
+ "version": "0.18.14",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -32,11 +32,11 @@
32
32
  "ethers": "5.7.2",
33
33
  "eventemitter3": "5.0.1",
34
34
  "buffer": "6.0.3",
35
- "@dynamic-labs/rpc-providers": "0.18.13",
36
- "@dynamic-labs/types": "0.18.13",
37
- "@dynamic-labs/utils": "0.18.13",
38
- "@dynamic-labs/wallet-book": "0.18.13",
39
- "@dynamic-labs/wallet-connector-core": "0.18.13",
35
+ "@dynamic-labs/rpc-providers": "0.18.14",
36
+ "@dynamic-labs/types": "0.18.14",
37
+ "@dynamic-labs/utils": "0.18.14",
38
+ "@dynamic-labs/wallet-book": "0.18.14",
39
+ "@dynamic-labs/wallet-connector-core": "0.18.14",
40
40
  "@ethersproject/providers": "5.7.2"
41
41
  },
42
42
  "peerDependencies": {}
@@ -32,8 +32,15 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
32
32
  this.projectId = opts.projectId;
33
33
  this.deepLinkPreference = opts.deepLinkPreference || 'native';
34
34
  }
35
+ getDefaultChainId() {
36
+ var _a, _b;
37
+ const etheriumMainnetNetwork = (_a = this.evmNetworks) === null || _a === void 0 ? void 0 : _a.find((network) => network.chainId === 1);
38
+ if (!etheriumMainnetNetwork && ((_b = this.evmNetworks) === null || _b === void 0 ? void 0 : _b.length)) {
39
+ return this.evmNetworks[0].chainId;
40
+ }
41
+ return 1;
42
+ }
35
43
  initConnection() {
36
- var _a;
37
44
  return _tslib.__awaiter(this, void 0, void 0, function* () {
38
45
  const { provider } = WalletConnectV2;
39
46
  if (!provider) {
@@ -43,9 +50,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
43
50
  if (provider === null || provider === void 0 ? void 0 : provider.uri) {
44
51
  return;
45
52
  }
46
- const defaultChain = ((_a = this.evmNetworks) === null || _a === void 0 ? void 0 : _a.length)
47
- ? this.evmNetworks[0].chainId
48
- : 1;
53
+ const defaultChain = this.getDefaultChainId();
49
54
  provider
50
55
  .connect({
51
56
  namespaces: {
@@ -22,6 +22,7 @@ export declare class WalletConnectV2 extends EthWalletConnector {
22
22
  private projectId?;
23
23
  private deepLinkPreference;
24
24
  constructor(opts: WalletConnectorV2Opts);
25
+ getDefaultChainId(): number;
25
26
  private initConnection;
26
27
  private createInitProviderPromise;
27
28
  private initProvider;
@@ -23,8 +23,15 @@ class WalletConnectV2 extends EthWalletConnector {
23
23
  this.projectId = opts.projectId;
24
24
  this.deepLinkPreference = opts.deepLinkPreference || 'native';
25
25
  }
26
+ getDefaultChainId() {
27
+ var _a, _b;
28
+ const etheriumMainnetNetwork = (_a = this.evmNetworks) === null || _a === void 0 ? void 0 : _a.find((network) => network.chainId === 1);
29
+ if (!etheriumMainnetNetwork && ((_b = this.evmNetworks) === null || _b === void 0 ? void 0 : _b.length)) {
30
+ return this.evmNetworks[0].chainId;
31
+ }
32
+ return 1;
33
+ }
26
34
  initConnection() {
27
- var _a;
28
35
  return __awaiter(this, void 0, void 0, function* () {
29
36
  const { provider } = WalletConnectV2;
30
37
  if (!provider) {
@@ -34,9 +41,7 @@ class WalletConnectV2 extends EthWalletConnector {
34
41
  if (provider === null || provider === void 0 ? void 0 : provider.uri) {
35
42
  return;
36
43
  }
37
- const defaultChain = ((_a = this.evmNetworks) === null || _a === void 0 ? void 0 : _a.length)
38
- ? this.evmNetworks[0].chainId
39
- : 1;
44
+ const defaultChain = this.getDefaultChainId();
40
45
  provider
41
46
  .connect({
42
47
  namespaces: {