@dynamic-labs/multi-wallet 0.16.6 → 0.16.7

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,13 @@
1
1
 
2
+ ### [0.16.7](https://github.com/dynamic-labs/DynamicAuth/compare/v0.16.6...v0.16.7) (2023-04-24)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * **Cypress:** add polyfills ([#1945](https://github.com/dynamic-labs/DynamicAuth/issues/1945)) ([093c9f9](https://github.com/dynamic-labs/DynamicAuth/commit/093c9f98725f90f3dea49328e76c5f126fa6478d))
8
+ * **DYN-2261:** hide authorization flow after network switch ([#1942](https://github.com/dynamic-labs/DynamicAuth/issues/1942)) ([0b44470](https://github.com/dynamic-labs/DynamicAuth/commit/0b444708183ffcbfd5302f3e48f69c0d0de6a0b4))
9
+ * remove listeners properly ([#1940](https://github.com/dynamic-labs/DynamicAuth/issues/1940)) ([aaca308](https://github.com/dynamic-labs/DynamicAuth/commit/aaca308e834149d50322768887c308171f9f767f))
10
+
2
11
  ### [0.16.6](https://github.com/dynamic-labs/DynamicAuth/compare/v0.16.5...v0.16.6) (2023-04-23)
3
12
 
4
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/multi-wallet",
3
- "version": "0.16.6",
3
+ "version": "0.16.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -28,8 +28,8 @@
28
28
  "magic-sdk": "^16.0.1",
29
29
  "@keplr-wallet/provider": "0.11.56",
30
30
  "@keplr-wallet/types": "^0.11.51",
31
- "@dynamic-labs/logger": "0.16.6",
32
- "@dynamic-labs/wallet-connector-core": "0.16.6"
31
+ "@dynamic-labs/logger": "0.16.7",
32
+ "@dynamic-labs/wallet-connector-core": "0.16.7"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@walletconnect/types": "^2.2.1"
@@ -150,7 +150,7 @@ class EthProviderHelper {
150
150
  // nothing to teardown
151
151
  };
152
152
  }
153
- const provider = web3Provider.provider;
153
+ const externalProvider = web3Provider.provider;
154
154
  this.handleAccountChange = (accounts) => tslib.__awaiter(this, void 0, void 0, function* () {
155
155
  var _a, _b;
156
156
  if (accounts.length === 0) {
@@ -171,19 +171,26 @@ class EthProviderHelper {
171
171
  }
172
172
  yield ((_d = listeners.onDisconnect) === null || _d === void 0 ? void 0 : _d.call(listeners));
173
173
  });
174
- provider.on('accountsChanged', this.handleAccountChange);
175
- provider.on('chainChanged', this.handleChainChange);
176
- provider.on('disconnect', this.handleDisconnect);
174
+ externalProvider.on('accountsChanged', this.handleAccountChange);
175
+ externalProvider.on('chainChanged', this.handleChainChange);
176
+ externalProvider.on('disconnect', this.handleDisconnect);
177
177
  return () => { };
178
178
  }
179
179
  _teardownEventListeners(name) {
180
180
  const web3Provider = this.findProvider(name);
181
- if (!web3Provider) {
181
+ if (!web3Provider || !(web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.provider)) {
182
182
  return;
183
183
  }
184
- web3Provider.off('accountsChanged', this.handleAccountChange);
185
- web3Provider.off('chainChangedm', this.handleChainChange);
186
- web3Provider.off('disconnect', this.handleDisconnect);
184
+ const externalProvider = web3Provider.provider;
185
+ if (this.handleAccountChange) {
186
+ externalProvider.removeListener('accountsChanged', this.handleAccountChange);
187
+ }
188
+ if (this.handleChainChange) {
189
+ externalProvider.removeListener('chainChanged', this.handleChainChange);
190
+ }
191
+ if (this.handleDisconnect) {
192
+ externalProvider.removeListener('disconnect', this.handleDisconnect);
193
+ }
187
194
  }
188
195
  }
189
196
 
@@ -146,7 +146,7 @@ class EthProviderHelper {
146
146
  // nothing to teardown
147
147
  };
148
148
  }
149
- const provider = web3Provider.provider;
149
+ const externalProvider = web3Provider.provider;
150
150
  this.handleAccountChange = (accounts) => __awaiter(this, void 0, void 0, function* () {
151
151
  var _a, _b;
152
152
  if (accounts.length === 0) {
@@ -167,19 +167,26 @@ class EthProviderHelper {
167
167
  }
168
168
  yield ((_d = listeners.onDisconnect) === null || _d === void 0 ? void 0 : _d.call(listeners));
169
169
  });
170
- provider.on('accountsChanged', this.handleAccountChange);
171
- provider.on('chainChanged', this.handleChainChange);
172
- provider.on('disconnect', this.handleDisconnect);
170
+ externalProvider.on('accountsChanged', this.handleAccountChange);
171
+ externalProvider.on('chainChanged', this.handleChainChange);
172
+ externalProvider.on('disconnect', this.handleDisconnect);
173
173
  return () => { };
174
174
  }
175
175
  _teardownEventListeners(name) {
176
176
  const web3Provider = this.findProvider(name);
177
- if (!web3Provider) {
177
+ if (!web3Provider || !(web3Provider === null || web3Provider === void 0 ? void 0 : web3Provider.provider)) {
178
178
  return;
179
179
  }
180
- web3Provider.off('accountsChanged', this.handleAccountChange);
181
- web3Provider.off('chainChangedm', this.handleChainChange);
182
- web3Provider.off('disconnect', this.handleDisconnect);
180
+ const externalProvider = web3Provider.provider;
181
+ if (this.handleAccountChange) {
182
+ externalProvider.removeListener('accountsChanged', this.handleAccountChange);
183
+ }
184
+ if (this.handleChainChange) {
185
+ externalProvider.removeListener('chainChanged', this.handleChainChange);
186
+ }
187
+ if (this.handleDisconnect) {
188
+ externalProvider.removeListener('disconnect', this.handleDisconnect);
189
+ }
183
190
  }
184
191
  }
185
192