@dynamic-labs/ethereum 0.17.12 → 0.17.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 CHANGED
@@ -1,4 +1,11 @@
1
1
 
2
+ ### [0.17.13](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.12...v0.17.13) (2023-06-27)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * wagmi detect connect-only wallet ([#2492](https://github.com/dynamic-labs/DynamicAuth/issues/2492)) ([890f158](https://github.com/dynamic-labs/DynamicAuth/commit/890f1587331e63aae901f10665218a6e4271492c))
8
+
2
9
  ### [0.17.12](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.11...v0.17.12) (2023-06-26)
3
10
 
4
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum",
3
- "version": "0.17.12",
3
+ "version": "0.17.13",
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.17.12",
36
- "@dynamic-labs/types": "0.17.12",
37
- "@dynamic-labs/utils": "0.17.12",
38
- "@dynamic-labs/wallet-book": "0.17.12",
39
- "@dynamic-labs/wallet-connector-core": "0.17.12"
35
+ "@dynamic-labs/rpc-providers": "0.17.13",
36
+ "@dynamic-labs/types": "0.17.13",
37
+ "@dynamic-labs/utils": "0.17.13",
38
+ "@dynamic-labs/wallet-book": "0.17.13",
39
+ "@dynamic-labs/wallet-connector-core": "0.17.13"
40
40
  },
41
41
  "peerDependencies": {}
42
42
  }
@@ -77,14 +77,22 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
77
77
  });
78
78
  });
79
79
  }
80
+ createInitProviderPromise() {
81
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
82
+ const provider = yield Provider__default["default"].init({
83
+ projectId: this.projectId,
84
+ });
85
+ WalletConnectV2.provider = provider;
86
+ });
87
+ }
80
88
  initProvider() {
81
89
  return _tslib.__awaiter(this, void 0, void 0, function* () {
82
- let { provider } = WalletConnectV2;
90
+ const { provider } = WalletConnectV2;
83
91
  if (!provider) {
84
- provider = yield Provider__default["default"].init({
85
- projectId: this.projectId,
86
- });
87
- WalletConnectV2.provider = provider;
92
+ if (this.initializePromise === undefined) {
93
+ this.initializePromise = this.createInitProviderPromise();
94
+ }
95
+ yield this.initializePromise;
88
96
  }
89
97
  });
90
98
  }
@@ -147,7 +155,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
147
155
  });
148
156
  WalletConnectV2.provider.client.on('session_delete', () => _tslib.__awaiter(this, void 0, void 0, function* () {
149
157
  var _a;
150
- localStorage.removeItem(this.sessionTopicKey);
158
+ this.endSession();
151
159
  yield ((_a = listeners.onDisconnect) === null || _a === void 0 ? void 0 : _a.call(listeners));
152
160
  }));
153
161
  }
@@ -240,7 +248,11 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
240
248
  if (utils.isMobile()) {
241
249
  // for sign message, no uri is needed because the uri encodes connection details,
242
250
  // and at this point we are already connected
243
- const deepLink = walletConnectorCore.getDeepLink({ metadata, mode: 'regular' });
251
+ const deepLink = walletConnectorCore.getDeepLink({
252
+ metadata,
253
+ mode: 'regular',
254
+ uri: WalletConnectV2.provider.uri,
255
+ });
244
256
  window.location.href = deepLink;
245
257
  }
246
258
  const web3Provider = this.getWeb3Provider();
@@ -14,12 +14,14 @@ export declare class WalletConnectV2 extends EthWalletConnector {
14
14
  session: SessionTypes.Struct | undefined;
15
15
  activeAccount: string | undefined;
16
16
  isInitialized: boolean;
17
+ initializePromise: Promise<void> | undefined;
17
18
  canConnectViaQrCode: boolean;
18
19
  isWalletConnect: boolean;
19
20
  private static provider;
20
21
  private projectId?;
21
22
  constructor(opts: WalletConnectorV2Opts);
22
23
  private initConnection;
24
+ private createInitProviderPromise;
23
25
  private initProvider;
24
26
  private refreshSession;
25
27
  init(): Promise<void>;
@@ -68,14 +68,22 @@ class WalletConnectV2 extends EthWalletConnector {
68
68
  });
69
69
  });
70
70
  }
71
+ createInitProviderPromise() {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const provider = yield Provider.init({
74
+ projectId: this.projectId,
75
+ });
76
+ WalletConnectV2.provider = provider;
77
+ });
78
+ }
71
79
  initProvider() {
72
80
  return __awaiter(this, void 0, void 0, function* () {
73
- let { provider } = WalletConnectV2;
81
+ const { provider } = WalletConnectV2;
74
82
  if (!provider) {
75
- provider = yield Provider.init({
76
- projectId: this.projectId,
77
- });
78
- WalletConnectV2.provider = provider;
83
+ if (this.initializePromise === undefined) {
84
+ this.initializePromise = this.createInitProviderPromise();
85
+ }
86
+ yield this.initializePromise;
79
87
  }
80
88
  });
81
89
  }
@@ -138,7 +146,7 @@ class WalletConnectV2 extends EthWalletConnector {
138
146
  });
139
147
  WalletConnectV2.provider.client.on('session_delete', () => __awaiter(this, void 0, void 0, function* () {
140
148
  var _a;
141
- localStorage.removeItem(this.sessionTopicKey);
149
+ this.endSession();
142
150
  yield ((_a = listeners.onDisconnect) === null || _a === void 0 ? void 0 : _a.call(listeners));
143
151
  }));
144
152
  }
@@ -231,7 +239,11 @@ class WalletConnectV2 extends EthWalletConnector {
231
239
  if (isMobile()) {
232
240
  // for sign message, no uri is needed because the uri encodes connection details,
233
241
  // and at this point we are already connected
234
- const deepLink = getDeepLink({ metadata, mode: 'regular' });
242
+ const deepLink = getDeepLink({
243
+ metadata,
244
+ mode: 'regular',
245
+ uri: WalletConnectV2.provider.uri,
246
+ });
235
247
  window.location.href = deepLink;
236
248
  }
237
249
  const web3Provider = this.getWeb3Provider();