@dynamic-labs/ethereum 0.17.26 → 0.17.27

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
+ ### [0.17.27](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.26...v0.17.27) (2023-07-26)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * do not proceed to authSuccess if there are still missing fields ([#2726](https://github.com/dynamic-labs/DynamicAuth/issues/2726)) ([e5b8139](https://github.com/dynamic-labs/DynamicAuth/commit/e5b8139bedbcc82f6f42251c5877a97955d90564)), closes [#2740](https://github.com/dynamic-labs/DynamicAuth/issues/2740)
8
+ * WalletConnect bug on fresh session with high latency ([#2669](https://github.com/dynamic-labs/DynamicAuth/issues/2669)) ([0fcb9c9](https://github.com/dynamic-labs/DynamicAuth/commit/0fcb9c969d39dad856ae76b2bdd02368c6c8d64a))
9
+
2
10
  ### [0.17.26](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.25...v0.17.26) (2023-07-25)
3
11
 
4
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum",
3
- "version": "0.17.26",
3
+ "version": "0.17.27",
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.26",
36
- "@dynamic-labs/types": "0.17.26",
37
- "@dynamic-labs/utils": "0.17.26",
38
- "@dynamic-labs/wallet-book": "0.17.26",
39
- "@dynamic-labs/wallet-connector-core": "0.17.26"
35
+ "@dynamic-labs/rpc-providers": "0.17.27",
36
+ "@dynamic-labs/types": "0.17.27",
37
+ "@dynamic-labs/utils": "0.17.27",
38
+ "@dynamic-labs/wallet-book": "0.17.27",
39
+ "@dynamic-labs/wallet-connector-core": "0.17.27"
40
40
  },
41
41
  "peerDependencies": {}
42
42
  }
@@ -92,13 +92,19 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
92
92
  }
93
93
  initProvider() {
94
94
  return _tslib.__awaiter(this, void 0, void 0, function* () {
95
- const { provider } = WalletConnectV2;
96
- if (!provider) {
95
+ if (!WalletConnectV2.provider) {
97
96
  if (this.initializePromise === undefined) {
98
97
  this.initializePromise = this.createInitProviderPromise();
99
98
  }
100
99
  yield this.initializePromise;
101
100
  }
101
+ // If the provider is still undefined, then the promise failed or already resolved
102
+ // but we still don't have a provider. This is because sometimes we need to unset the provider
103
+ // to ensure a new one is established
104
+ if (!WalletConnectV2.provider) {
105
+ this.initializePromise = this.createInitProviderPromise();
106
+ yield this.initializePromise;
107
+ }
102
108
  });
103
109
  }
104
110
  refreshSession() {
@@ -265,7 +271,13 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
265
271
  resolve({ success: false });
266
272
  }),
267
273
  });
268
- signMessageFn(messageToSign).then((result) => resolve({ signedMessage: result, success: true }));
274
+ const sign = () => _tslib.__awaiter(this, void 0, void 0, function* () {
275
+ // Due to a weird issue where the signing request will return "invalid id" if initated too quickly
276
+ // on a fresh session, we need to wait 1 second before sending the sign request
277
+ yield new Promise((resolve) => setTimeout(resolve, 1000));
278
+ signMessageFn(messageToSign).then((result) => resolve({ signedMessage: result, success: true }));
279
+ });
280
+ sign();
269
281
  });
270
282
  const signedMessageResult = yield raceConditionPromise;
271
283
  if (signedMessageResult.success === false) {
@@ -83,13 +83,19 @@ class WalletConnectV2 extends EthWalletConnector {
83
83
  }
84
84
  initProvider() {
85
85
  return __awaiter(this, void 0, void 0, function* () {
86
- const { provider } = WalletConnectV2;
87
- if (!provider) {
86
+ if (!WalletConnectV2.provider) {
88
87
  if (this.initializePromise === undefined) {
89
88
  this.initializePromise = this.createInitProviderPromise();
90
89
  }
91
90
  yield this.initializePromise;
92
91
  }
92
+ // If the provider is still undefined, then the promise failed or already resolved
93
+ // but we still don't have a provider. This is because sometimes we need to unset the provider
94
+ // to ensure a new one is established
95
+ if (!WalletConnectV2.provider) {
96
+ this.initializePromise = this.createInitProviderPromise();
97
+ yield this.initializePromise;
98
+ }
93
99
  });
94
100
  }
95
101
  refreshSession() {
@@ -256,7 +262,13 @@ class WalletConnectV2 extends EthWalletConnector {
256
262
  resolve({ success: false });
257
263
  }),
258
264
  });
259
- signMessageFn(messageToSign).then((result) => resolve({ signedMessage: result, success: true }));
265
+ const sign = () => __awaiter(this, void 0, void 0, function* () {
266
+ // Due to a weird issue where the signing request will return "invalid id" if initated too quickly
267
+ // on a fresh session, we need to wait 1 second before sending the sign request
268
+ yield new Promise((resolve) => setTimeout(resolve, 1000));
269
+ signMessageFn(messageToSign).then((result) => resolve({ signedMessage: result, success: true }));
270
+ });
271
+ sign();
260
272
  });
261
273
  const signedMessageResult = yield raceConditionPromise;
262
274
  if (signedMessageResult.success === false) {