@wagmi/core 0.2.0-next.6 → 0.2.0-next.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.
@@ -83,7 +83,9 @@ class CoinbaseWalletConnector extends base.Connector {
83
83
  provider.on('chainChanged', _this.onChainChanged);
84
84
  provider.on('disconnect', _this.onDisconnect);
85
85
 
86
- _this.emit('connecting');
86
+ _this.emit('message', {
87
+ type: 'connecting'
88
+ });
87
89
 
88
90
  var accounts = yield provider.enable();
89
91
  var account = utils.getAddress(accounts[0]);
@@ -83,7 +83,9 @@ class CoinbaseWalletConnector extends base.Connector {
83
83
  provider.on('chainChanged', _this.onChainChanged);
84
84
  provider.on('disconnect', _this.onDisconnect);
85
85
 
86
- _this.emit('connecting');
86
+ _this.emit('message', {
87
+ type: 'connecting'
88
+ });
87
89
 
88
90
  var accounts = yield provider.enable();
89
91
  var account = utils.getAddress(accounts[0]);
@@ -61,7 +61,9 @@ class CoinbaseWalletConnector extends Connector {
61
61
  provider.on('chainChanged', _this.onChainChanged);
62
62
  provider.on('disconnect', _this.onDisconnect);
63
63
 
64
- _this.emit('connecting');
64
+ _this.emit('message', {
65
+ type: 'connecting'
66
+ });
65
67
 
66
68
  var accounts = yield provider.enable();
67
69
  var account = getAddress(accounts[0]);
@@ -81,8 +81,11 @@ class WalletConnectConnector extends base.Connector {
81
81
  var provider = yield _this.getProvider(true);
82
82
  provider.on('accountsChanged', _this.onAccountsChanged);
83
83
  provider.on('chainChanged', _this.onChainChanged);
84
- provider.on('disconnect', _this.onDisconnect);
85
- setTimeout(() => _this.emit('connecting'), 0);
84
+ provider.on('disconnect', _this.onDisconnect); // Defer message to the next tick to ensure wallet connect data (provided by `.enable()`) is available
85
+
86
+ setTimeout(() => _this.emit('message', {
87
+ type: 'connecting'
88
+ }), 0);
86
89
  var accounts = yield provider.enable();
87
90
  var account = utils.getAddress(accounts[0]);
88
91
  var id = yield _this.getChainId();
@@ -81,8 +81,11 @@ class WalletConnectConnector extends base.Connector {
81
81
  var provider = yield _this.getProvider(true);
82
82
  provider.on('accountsChanged', _this.onAccountsChanged);
83
83
  provider.on('chainChanged', _this.onChainChanged);
84
- provider.on('disconnect', _this.onDisconnect);
85
- setTimeout(() => _this.emit('connecting'), 0);
84
+ provider.on('disconnect', _this.onDisconnect); // Defer message to the next tick to ensure wallet connect data (provided by `.enable()`) is available
85
+
86
+ setTimeout(() => _this.emit('message', {
87
+ type: 'connecting'
88
+ }), 0);
86
89
  var accounts = yield provider.enable();
87
90
  var account = utils.getAddress(accounts[0]);
88
91
  var id = yield _this.getChainId();
@@ -59,8 +59,11 @@ class WalletConnectConnector extends Connector {
59
59
  var provider = yield _this.getProvider(true);
60
60
  provider.on('accountsChanged', _this.onAccountsChanged);
61
61
  provider.on('chainChanged', _this.onChainChanged);
62
- provider.on('disconnect', _this.onDisconnect);
63
- setTimeout(() => _this.emit('connecting'), 0);
62
+ provider.on('disconnect', _this.onDisconnect); // Defer message to the next tick to ensure wallet connect data (provided by `.enable()`) is available
63
+
64
+ setTimeout(() => _this.emit('message', {
65
+ type: 'connecting'
66
+ }), 0);
64
67
  var accounts = yield provider.enable();
65
68
  var account = getAddress(accounts[0]);
66
69
  var id = yield _this.getChainId();
@@ -61,7 +61,7 @@ export declare class Client {
61
61
  get data(): Data | undefined;
62
62
  get error(): Error | undefined;
63
63
  get provider(): BaseProvider;
64
- get status(): "connected" | "connecting" | "reconnecting" | "disconnected";
64
+ get status(): "connecting" | "connected" | "reconnecting" | "disconnected";
65
65
  get subscribe(): {
66
66
  (listener: (selectedState: State, previousSelectedState: State) => void): () => void;
67
67
  <U>(selector: (state: State) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
@@ -12,7 +12,10 @@ export declare type ConnectorData<Provider = any> = {
12
12
  export interface ConnectorEvents<Provider = any> {
13
13
  change(data: ConnectorData<Provider>): void;
14
14
  connect(data: ConnectorData<Provider>): void;
15
- connecting(): void;
15
+ message({ type, data }: {
16
+ type: string;
17
+ data?: unknown;
18
+ }): void;
16
19
  disconnect(): void;
17
20
  error(error: Error): void;
18
21
  }
@@ -358,7 +358,9 @@ class InjectedConnector extends base.Connector {
358
358
  provider.on('disconnect', _this.onDisconnect);
359
359
  }
360
360
 
361
- _this.emit('connecting');
361
+ _this.emit('message', {
362
+ type: 'connecting'
363
+ });
362
364
 
363
365
  var account = yield _this.getAccount();
364
366
  var id = yield _this.getChainId();
@@ -358,7 +358,9 @@ class InjectedConnector extends base.Connector {
358
358
  provider.on('disconnect', _this.onDisconnect);
359
359
  }
360
360
 
361
- _this.emit('connecting');
361
+ _this.emit('message', {
362
+ type: 'connecting'
363
+ });
362
364
 
363
365
  var account = yield _this.getAccount();
364
366
  var id = yield _this.getChainId();
@@ -351,7 +351,9 @@ class InjectedConnector extends Connector {
351
351
  provider.on('disconnect', _this.onDisconnect);
352
352
  }
353
353
 
354
- _this.emit('connecting');
354
+ _this.emit('message', {
355
+ type: 'connecting'
356
+ });
355
357
 
356
358
  var account = yield _this.getAccount();
357
359
  var id = yield _this.getChainId();
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@wagmi/core",
3
3
  "description": "JavaScript library for Ethereum",
4
4
  "license": "MIT",
5
- "version": "0.2.0-next.6",
5
+ "version": "0.2.0-next.7",
6
6
  "ethereum": "awkweb.eth",
7
7
  "repository": "tmm/wagmi",
8
8
  "sideEffects": false,