@dynamic-labs/wagmi-connector 0.18.10 → 0.18.12

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,26 @@
1
1
 
2
+ ### [0.18.12](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.11...v0.18.12) (2023-08-30)
3
+
4
+
5
+ ### Features
6
+
7
+ * add deepLinkPreference prop ([#3174](https://github.com/dynamic-labs/DynamicAuth/issues/3174)) ([#3176](https://github.com/dynamic-labs/DynamicAuth/issues/3176)) ([8a6e389](https://github.com/dynamic-labs/DynamicAuth/commit/8a6e389e84bd74e80dc9df37ba6df5d46e6ba831))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * end connector session when unlinking from bridge ([#3120](https://github.com/dynamic-labs/DynamicAuth/issues/3120)) ([#3178](https://github.com/dynamic-labs/DynamicAuth/issues/3178)) ([0a69e21](https://github.com/dynamic-labs/DynamicAuth/commit/0a69e218dc9a9a0709bb74b901ed0ca08c7f463c))
13
+ * **bridge:** update address when switching networks ([#3171](https://github.com/dynamic-labs/DynamicAuth/issues/3171)) ([#3180](https://github.com/dynamic-labs/DynamicAuth/issues/3180)) ([8ab5ce4](https://github.com/dynamic-labs/DynamicAuth/commit/8ab5ce4add675ae326c052fc1510d54d56d0d665))
14
+
15
+ ### [0.18.11](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.10...v0.18.11) (2023-08-29)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **bridge:** connect L2 wallet after updating network ([#3162](https://github.com/dynamic-labs/DynamicAuth/issues/3162)) ([6a90668](https://github.com/dynamic-labs/DynamicAuth/commit/6a906687d793fdfa03df87895f9c44b7a5e099dc))
21
+ * resend magic OTP on back click ([#3123](https://github.com/dynamic-labs/DynamicAuth/issues/3123)) ([#3150](https://github.com/dynamic-labs/DynamicAuth/issues/3150)) ([bcba905](https://github.com/dynamic-labs/DynamicAuth/commit/bcba905f22e796c122bb3bb156ec0e0f2a8fb3c6))
22
+ * **WagmiConnector:** sync wagmi with wallet connector events ([#3161](https://github.com/dynamic-labs/DynamicAuth/issues/3161)) ([7cd1da1](https://github.com/dynamic-labs/DynamicAuth/commit/7cd1da173ff7fca50cf2e92e0fad4dfbe651717c)), closes [#3149](https://github.com/dynamic-labs/DynamicAuth/issues/3149)
23
+
2
24
  ### [0.18.10](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.9...v0.18.10) (2023-08-25)
3
25
 
4
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/wagmi-connector",
3
- "version": "0.18.10",
3
+ "version": "0.18.12",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -11,8 +11,8 @@
11
11
  "react": "^17.0.2 || ^18.0.0",
12
12
  "ethers": "5.7.2",
13
13
  "wagmi": "~0.12.13",
14
- "@dynamic-labs/sdk-react-core": "0.18.10",
15
- "@dynamic-labs/types": "0.18.10",
14
+ "@dynamic-labs/sdk-react-core": "0.18.12",
15
+ "@dynamic-labs/types": "0.18.12",
16
16
  "eventemitter3": "5.0.1"
17
17
  },
18
18
  "license": "MIT",
@@ -12,6 +12,13 @@ export declare class Connector extends BaseWagmiConnector<ethers.providers.Web3P
12
12
  handleLogOut: () => Promise<void>;
13
13
  walletConnector: WalletConnector;
14
14
  });
15
+ _onAccountsChanged({ accounts }: {
16
+ accounts: string[];
17
+ }): void;
18
+ _onChainChanged({ chain }: {
19
+ chain: number | string;
20
+ }): void;
21
+ _onDisconnect(): void;
15
22
  setupEventListeners(): void;
16
23
  connect(config?: {
17
24
  chainId?: number;
@@ -26,14 +26,20 @@ class Connector extends Connector$1 {
26
26
  this.handleLogOut = handleLogOut;
27
27
  this.walletConnector = walletConnector;
28
28
  this.id = `dynamic-${walletConnector.key}`;
29
- this.setupEventListeners();
29
+ }
30
+ _onAccountsChanged({ accounts }) {
31
+ this.onAccountsChanged(accounts);
32
+ }
33
+ _onChainChanged({ chain }) {
34
+ this.onChainChanged(chain);
35
+ }
36
+ _onDisconnect() {
37
+ this.onDisconnect();
30
38
  }
31
39
  setupEventListeners() {
32
- this.walletConnector.setupEventListeners({
33
- onAccountChange: this.onAccountsChanged,
34
- onChainChange: this.onChainChanged,
35
- onDisconnect: this.onDisconnect,
36
- });
40
+ this.walletConnector.on('accountChange', this._onAccountsChanged, this);
41
+ this.walletConnector.on('chainChange', this._onChainChanged, this);
42
+ this.walletConnector.on('disconnect', this._onDisconnect, this);
37
43
  }
38
44
  connect(config) {
39
45
  return __awaiter(this, void 0, void 0, function* () {
@@ -55,11 +61,9 @@ class Connector extends Connector$1 {
55
61
  disconnect() {
56
62
  var _a, _b;
57
63
  return __awaiter(this, void 0, void 0, function* () {
58
- const web3Provider = yield this.getProvider();
59
- const { provider } = web3Provider;
60
- provider.removeListener('accountsChanged', this.onAccountsChanged);
61
- provider.removeListener('chainChanged', this.onChainChanged);
62
- provider.removeListener('disconnect', this.onDisconnect);
64
+ this.walletConnector.removeListener('accountChange', this._onAccountsChanged, this);
65
+ this.walletConnector.removeListener('chainChange', this._onChainChanged, this);
66
+ this.walletConnector.removeListener('disconnect', this._onDisconnect, this);
63
67
  yield ((_a = this.walletConnector) === null || _a === void 0 ? void 0 : _a.endSession());
64
68
  yield ((_b = this.handleLogOut) === null || _b === void 0 ? void 0 : _b.call(this));
65
69
  });