@dynamic-labs/starknet 0.18.20 → 0.18.22

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,14 @@
1
1
 
2
+ ### [0.18.22](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.21...v0.18.22) (2023-09-28)
3
+
4
+ ### [0.18.21](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.20...v0.18.21) (2023-09-28)
5
+
6
+
7
+ ### Bug Fixes
8
+
9
+ * better handling for starknet account changed event ([#3441](https://github.com/dynamic-labs/DynamicAuth/issues/3441)) ([#3452](https://github.com/dynamic-labs/DynamicAuth/issues/3452)) ([6b814ea](https://github.com/dynamic-labs/DynamicAuth/commit/6b814eaf0b4a5429a7b0e1c30ff4e5c209f185cd))
10
+ * wait for networks to fetch wallets ([#3425](https://github.com/dynamic-labs/DynamicAuth/issues/3425)) ([b760042](https://github.com/dynamic-labs/DynamicAuth/commit/b76004273b0c62d001e85da8f1dc0ee7a94b0437))
11
+
2
12
  ### [0.18.20](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.19...v0.18.20) (2023-09-25)
3
13
 
4
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/starknet",
3
- "version": "0.18.20",
3
+ "version": "0.18.22",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -30,9 +30,9 @@
30
30
  "get-starknet-core": "^3.2.0",
31
31
  "text-encoding": "0.7.0",
32
32
  "@dynamic-labs/sdk-api": "0.0.270",
33
- "@dynamic-labs/utils": "0.18.20",
34
- "@dynamic-labs/wallet-book": "0.18.20",
35
- "@dynamic-labs/wallet-connector-core": "0.18.20"
33
+ "@dynamic-labs/utils": "0.18.22",
34
+ "@dynamic-labs/wallet-book": "0.18.22",
35
+ "@dynamic-labs/wallet-connector-core": "0.18.22"
36
36
  },
37
37
  "peerDependencies": {}
38
38
  }
@@ -167,10 +167,15 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
167
167
  }
168
168
  this.handleAccountChange = (address) => _tslib.__awaiter(this, void 0, void 0, function* () {
169
169
  var _a, _b;
170
- if (!address) {
170
+ if (!(yield wallet.isPreauthorized()) && !address) {
171
171
  yield ((_a = listeners.onDisconnect) === null || _a === void 0 ? void 0 : _a.call(listeners));
172
172
  return;
173
173
  }
174
+ // this is the case where the wallet emits an empty account change event
175
+ // when the user is simply switching network
176
+ if (!address) {
177
+ return;
178
+ }
174
179
  if (address.toString()) {
175
180
  yield ((_b = listeners.onAccountChange) === null || _b === void 0 ? void 0 : _b.call(listeners, [address.toString()]));
176
181
  }
@@ -165,10 +165,15 @@ class StarknetWalletConnector extends WalletConnectorBase {
165
165
  }
166
166
  this.handleAccountChange = (address) => __awaiter(this, void 0, void 0, function* () {
167
167
  var _a, _b;
168
- if (!address) {
168
+ if (!(yield wallet.isPreauthorized()) && !address) {
169
169
  yield ((_a = listeners.onDisconnect) === null || _a === void 0 ? void 0 : _a.call(listeners));
170
170
  return;
171
171
  }
172
+ // this is the case where the wallet emits an empty account change event
173
+ // when the user is simply switching network
174
+ if (!address) {
175
+ return;
176
+ }
172
177
  if (address.toString()) {
173
178
  yield ((_b = listeners.onAccountChange) === null || _b === void 0 ? void 0 : _b.call(listeners, [address.toString()]));
174
179
  }