@dynamic-labs/ethereum 0.17.29 → 0.17.30

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.30](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.29...v0.17.30) (2023-08-01)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * ensure auto-redirect back to dapp after message signing
8
+
2
9
  ### [0.17.29](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.28...v0.17.29) (2023-07-28)
3
10
 
4
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum",
3
- "version": "0.17.29",
3
+ "version": "0.17.30",
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.29",
36
- "@dynamic-labs/types": "0.17.29",
37
- "@dynamic-labs/utils": "0.17.29",
38
- "@dynamic-labs/wallet-book": "0.17.29",
39
- "@dynamic-labs/wallet-connector-core": "0.17.29"
35
+ "@dynamic-labs/rpc-providers": "0.17.30",
36
+ "@dynamic-labs/types": "0.17.30",
37
+ "@dynamic-labs/utils": "0.17.30",
38
+ "@dynamic-labs/wallet-book": "0.17.30",
39
+ "@dynamic-labs/wallet-connector-core": "0.17.30"
40
40
  },
41
41
  "peerDependencies": {}
42
42
  }
@@ -182,18 +182,21 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
182
182
  }
183
183
  getDeepLink() {
184
184
  var _a, _b;
185
- if (!((_a = WalletConnectV2.provider) === null || _a === void 0 ? void 0 : _a.uri))
185
+ if (!((_a = WalletConnectV2.provider) === null || _a === void 0 ? void 0 : _a.uri) || !this.session)
186
186
  return;
187
187
  const wallet = walletBook.getWalletBookWallet(this.name);
188
188
  if (!utils.isMobile() && !((_b = wallet.desktop) === null || _b === void 0 ? void 0 : _b.native)) {
189
189
  return undefined;
190
190
  }
191
- return walletConnectorCore.getDeepLink({
191
+ const deepLink = walletConnectorCore.getDeepLink({
192
192
  isWC2: true,
193
193
  metadata: wallet,
194
194
  mode: 'regular',
195
195
  uri: WalletConnectV2.provider.uri,
196
196
  });
197
+ // we need to include the session topic here because it helps the wallet
198
+ // auto redirect back to the dapp after signing
199
+ return `${deepLink}?sessionTopic=${this.session.topic}`;
197
200
  }
198
201
  getWeb3Provider() {
199
202
  if (!WalletConnectV2.provider) {
@@ -294,16 +297,8 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
294
297
  if (!WalletConnectV2.provider) {
295
298
  throw new utils.DynamicError('No WalletConnect provider found to handle signing');
296
299
  }
297
- const metadata = walletBook.getWalletBookWallet(this.name);
298
- if (utils.isMobile()) {
299
- // for sign message, no uri is needed because the uri encodes connection details,
300
- // and at this point we are already connected
301
- const deepLink = walletConnectorCore.getDeepLink({
302
- isWC2: true,
303
- metadata,
304
- mode: 'regular',
305
- uri: WalletConnectV2.provider.uri,
306
- });
300
+ const deepLink = this.getDeepLink();
301
+ if (utils.isMobile() && deepLink) {
307
302
  window.location.href = deepLink;
308
303
  }
309
304
  const web3Provider = this.getWeb3Provider();
@@ -173,18 +173,21 @@ class WalletConnectV2 extends EthWalletConnector {
173
173
  }
174
174
  getDeepLink() {
175
175
  var _a, _b;
176
- if (!((_a = WalletConnectV2.provider) === null || _a === void 0 ? void 0 : _a.uri))
176
+ if (!((_a = WalletConnectV2.provider) === null || _a === void 0 ? void 0 : _a.uri) || !this.session)
177
177
  return;
178
178
  const wallet = getWalletBookWallet(this.name);
179
179
  if (!isMobile() && !((_b = wallet.desktop) === null || _b === void 0 ? void 0 : _b.native)) {
180
180
  return undefined;
181
181
  }
182
- return getDeepLink({
182
+ const deepLink = getDeepLink({
183
183
  isWC2: true,
184
184
  metadata: wallet,
185
185
  mode: 'regular',
186
186
  uri: WalletConnectV2.provider.uri,
187
187
  });
188
+ // we need to include the session topic here because it helps the wallet
189
+ // auto redirect back to the dapp after signing
190
+ return `${deepLink}?sessionTopic=${this.session.topic}`;
188
191
  }
189
192
  getWeb3Provider() {
190
193
  if (!WalletConnectV2.provider) {
@@ -285,16 +288,8 @@ class WalletConnectV2 extends EthWalletConnector {
285
288
  if (!WalletConnectV2.provider) {
286
289
  throw new DynamicError('No WalletConnect provider found to handle signing');
287
290
  }
288
- const metadata = getWalletBookWallet(this.name);
289
- if (isMobile()) {
290
- // for sign message, no uri is needed because the uri encodes connection details,
291
- // and at this point we are already connected
292
- const deepLink = getDeepLink({
293
- isWC2: true,
294
- metadata,
295
- mode: 'regular',
296
- uri: WalletConnectV2.provider.uri,
297
- });
291
+ const deepLink = this.getDeepLink();
292
+ if (isMobile() && deepLink) {
298
293
  window.location.href = deepLink;
299
294
  }
300
295
  const web3Provider = this.getWeb3Provider();