@0xsequence/provider 1.2.4 → 1.2.6

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.
@@ -394,7 +394,7 @@ class BaseProviderTransport {
394
394
  // NOTIFY DISCONNECT -- when wallet instructs to disconnect
395
395
  if (message.type === EventType.DISCONNECT) {
396
396
  if (this.isConnected()) {
397
- this.events.emit('disconnect', message.data);
397
+ this.events.emit('disconnect', message.data, message.origin);
398
398
  this.close();
399
399
  }
400
400
  }
@@ -934,10 +934,10 @@ class BaseWalletTransport {
934
934
  // means user has logged in and wallet is connected to the app
935
935
  this.notifyConnect(connectDetails);
936
936
  });
937
- this.walletRequestHandler.on('disconnect', error => {
937
+ this.walletRequestHandler.on('disconnect', (error, origin) => {
938
938
  if (!this.registered) return;
939
939
  // means user has logged out the app / disconnected wallet from the app
940
- this.notifyDisconnect(error);
940
+ this.notifyDisconnect(error, origin);
941
941
  });
942
942
  this.walletRequestHandler.on('accountsChanged', (accounts, origin) => {
943
943
  if (!this.registered) return;
@@ -1010,13 +1010,14 @@ class BaseWalletTransport {
1010
1010
  data: connectDetails
1011
1011
  });
1012
1012
  }
1013
- notifyDisconnect(error) {
1013
+ notifyDisconnect(error, origin) {
1014
1014
  this.sendMessage({
1015
1015
  idx: -1,
1016
1016
  type: EventType.DISCONNECT,
1017
1017
  data: error ? {
1018
1018
  error
1019
- } : null
1019
+ } : null,
1020
+ origin
1020
1021
  });
1021
1022
  }
1022
1023
  notifyAccountsChanged(accounts, origin) {
@@ -2811,7 +2812,7 @@ class WalletRequestHandler {
2811
2812
  }
2812
2813
  notifyDisconnect(origin) {
2813
2814
  this.events.emit('accountsChanged', [], origin);
2814
- this.events.emit('disconnect');
2815
+ this.events.emit('disconnect', undefined, origin);
2815
2816
  }
2816
2817
  notifyChainChanged(chainId, origin) {
2817
2818
  this.events.emit('chainChanged', ethers.ethers.utils.hexValue(chainId), origin);
@@ -3531,7 +3532,7 @@ class SingleNetworkSequenceProvider extends SequenceProvider {
3531
3532
 
3532
3533
  var packageJson = {
3533
3534
  name: "@0xsequence/provider",
3534
- version: "1.2.4",
3535
+ version: "1.2.6",
3535
3536
  description: "provider sub-package for Sequence",
3536
3537
  repository: "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
3537
3538
  source: "src/index.ts",
@@ -3691,9 +3692,9 @@ class SequenceClient {
3691
3692
  chainId: chainIdHex
3692
3693
  })));
3693
3694
  });
3694
- this.transport.on('disconnect', error => {
3695
+ this.transport.on('disconnect', (error, origin) => {
3695
3696
  var _this$callbacks$disco;
3696
- (_this$callbacks$disco = this.callbacks.disconnect) == null ? void 0 : _this$callbacks$disco.forEach(cb => cb(error));
3697
+ (_this$callbacks$disco = this.callbacks.disconnect) == null ? void 0 : _this$callbacks$disco.forEach(cb => cb(error, origin));
3697
3698
  });
3698
3699
  this.transport.on('networks', networks => {
3699
3700
  var _this$callbacks$netwo;
@@ -394,7 +394,7 @@ class BaseProviderTransport {
394
394
  // NOTIFY DISCONNECT -- when wallet instructs to disconnect
395
395
  if (message.type === EventType.DISCONNECT) {
396
396
  if (this.isConnected()) {
397
- this.events.emit('disconnect', message.data);
397
+ this.events.emit('disconnect', message.data, message.origin);
398
398
  this.close();
399
399
  }
400
400
  }
@@ -934,10 +934,10 @@ class BaseWalletTransport {
934
934
  // means user has logged in and wallet is connected to the app
935
935
  this.notifyConnect(connectDetails);
936
936
  });
937
- this.walletRequestHandler.on('disconnect', error => {
937
+ this.walletRequestHandler.on('disconnect', (error, origin) => {
938
938
  if (!this.registered) return;
939
939
  // means user has logged out the app / disconnected wallet from the app
940
- this.notifyDisconnect(error);
940
+ this.notifyDisconnect(error, origin);
941
941
  });
942
942
  this.walletRequestHandler.on('accountsChanged', (accounts, origin) => {
943
943
  if (!this.registered) return;
@@ -1010,13 +1010,14 @@ class BaseWalletTransport {
1010
1010
  data: connectDetails
1011
1011
  });
1012
1012
  }
1013
- notifyDisconnect(error) {
1013
+ notifyDisconnect(error, origin) {
1014
1014
  this.sendMessage({
1015
1015
  idx: -1,
1016
1016
  type: EventType.DISCONNECT,
1017
1017
  data: error ? {
1018
1018
  error
1019
- } : null
1019
+ } : null,
1020
+ origin
1020
1021
  });
1021
1022
  }
1022
1023
  notifyAccountsChanged(accounts, origin) {
@@ -2811,7 +2812,7 @@ class WalletRequestHandler {
2811
2812
  }
2812
2813
  notifyDisconnect(origin) {
2813
2814
  this.events.emit('accountsChanged', [], origin);
2814
- this.events.emit('disconnect');
2815
+ this.events.emit('disconnect', undefined, origin);
2815
2816
  }
2816
2817
  notifyChainChanged(chainId, origin) {
2817
2818
  this.events.emit('chainChanged', ethers.ethers.utils.hexValue(chainId), origin);
@@ -3531,7 +3532,7 @@ class SingleNetworkSequenceProvider extends SequenceProvider {
3531
3532
 
3532
3533
  var packageJson = {
3533
3534
  name: "@0xsequence/provider",
3534
- version: "1.2.4",
3535
+ version: "1.2.6",
3535
3536
  description: "provider sub-package for Sequence",
3536
3537
  repository: "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
3537
3538
  source: "src/index.ts",
@@ -3691,9 +3692,9 @@ class SequenceClient {
3691
3692
  chainId: chainIdHex
3692
3693
  })));
3693
3694
  });
3694
- this.transport.on('disconnect', error => {
3695
+ this.transport.on('disconnect', (error, origin) => {
3695
3696
  var _this$callbacks$disco;
3696
- (_this$callbacks$disco = this.callbacks.disconnect) == null ? void 0 : _this$callbacks$disco.forEach(cb => cb(error));
3697
+ (_this$callbacks$disco = this.callbacks.disconnect) == null ? void 0 : _this$callbacks$disco.forEach(cb => cb(error, origin));
3697
3698
  });
3698
3699
  this.transport.on('networks', networks => {
3699
3700
  var _this$callbacks$netwo;
@@ -390,7 +390,7 @@ class BaseProviderTransport {
390
390
  // NOTIFY DISCONNECT -- when wallet instructs to disconnect
391
391
  if (message.type === EventType.DISCONNECT) {
392
392
  if (this.isConnected()) {
393
- this.events.emit('disconnect', message.data);
393
+ this.events.emit('disconnect', message.data, message.origin);
394
394
  this.close();
395
395
  }
396
396
  }
@@ -930,10 +930,10 @@ class BaseWalletTransport {
930
930
  // means user has logged in and wallet is connected to the app
931
931
  this.notifyConnect(connectDetails);
932
932
  });
933
- this.walletRequestHandler.on('disconnect', error => {
933
+ this.walletRequestHandler.on('disconnect', (error, origin) => {
934
934
  if (!this.registered) return;
935
935
  // means user has logged out the app / disconnected wallet from the app
936
- this.notifyDisconnect(error);
936
+ this.notifyDisconnect(error, origin);
937
937
  });
938
938
  this.walletRequestHandler.on('accountsChanged', (accounts, origin) => {
939
939
  if (!this.registered) return;
@@ -1006,13 +1006,14 @@ class BaseWalletTransport {
1006
1006
  data: connectDetails
1007
1007
  });
1008
1008
  }
1009
- notifyDisconnect(error) {
1009
+ notifyDisconnect(error, origin) {
1010
1010
  this.sendMessage({
1011
1011
  idx: -1,
1012
1012
  type: EventType.DISCONNECT,
1013
1013
  data: error ? {
1014
1014
  error
1015
- } : null
1015
+ } : null,
1016
+ origin
1016
1017
  });
1017
1018
  }
1018
1019
  notifyAccountsChanged(accounts, origin) {
@@ -2807,7 +2808,7 @@ class WalletRequestHandler {
2807
2808
  }
2808
2809
  notifyDisconnect(origin) {
2809
2810
  this.events.emit('accountsChanged', [], origin);
2810
- this.events.emit('disconnect');
2811
+ this.events.emit('disconnect', undefined, origin);
2811
2812
  }
2812
2813
  notifyChainChanged(chainId, origin) {
2813
2814
  this.events.emit('chainChanged', ethers.utils.hexValue(chainId), origin);
@@ -3527,7 +3528,7 @@ class SingleNetworkSequenceProvider extends SequenceProvider {
3527
3528
 
3528
3529
  var packageJson = {
3529
3530
  name: "@0xsequence/provider",
3530
- version: "1.2.4",
3531
+ version: "1.2.6",
3531
3532
  description: "provider sub-package for Sequence",
3532
3533
  repository: "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
3533
3534
  source: "src/index.ts",
@@ -3687,9 +3688,9 @@ class SequenceClient {
3687
3688
  chainId: chainIdHex
3688
3689
  })));
3689
3690
  });
3690
- this.transport.on('disconnect', error => {
3691
+ this.transport.on('disconnect', (error, origin) => {
3691
3692
  var _this$callbacks$disco;
3692
- (_this$callbacks$disco = this.callbacks.disconnect) == null ? void 0 : _this$callbacks$disco.forEach(cb => cb(error));
3693
+ (_this$callbacks$disco = this.callbacks.disconnect) == null ? void 0 : _this$callbacks$disco.forEach(cb => cb(error, origin));
3693
3694
  });
3694
3695
  this.transport.on('networks', networks => {
3695
3696
  var _this$callbacks$netwo;
@@ -26,7 +26,7 @@ export declare abstract class BaseWalletTransport implements WalletTransport {
26
26
  }): void;
27
27
  notifyClose(error?: ProviderRpcError): void;
28
28
  notifyConnect(connectDetails: ConnectDetails): void;
29
- notifyDisconnect(error?: ProviderRpcError): void;
29
+ notifyDisconnect(error?: ProviderRpcError, origin?: string): void;
30
30
  notifyAccountsChanged(accounts: string[], origin?: string): void;
31
31
  notifyChainChanged(chainIdHex: string, origin?: string): void;
32
32
  notifyNetworks(networks: NetworkConfig[]): void;
@@ -84,7 +84,7 @@ export interface WalletEventTypes {
84
84
  }) => void;
85
85
  close: (error?: ProviderRpcError) => void;
86
86
  connect: (connectDetails: ConnectDetails) => void;
87
- disconnect: (error?: ProviderRpcError) => void;
87
+ disconnect: (error?: ProviderRpcError, origin?: string) => void;
88
88
  accountsChanged: (accounts: string[], origin?: string) => void;
89
89
  chainChanged: (chainIdHex: string, origin?: string) => void;
90
90
  networks: (networks: NetworkConfig[]) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/provider",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "provider sub-package for Sequence",
5
5
  "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
6
6
  "source": "src/index.ts",
@@ -11,15 +11,15 @@
11
11
  "dependencies": {
12
12
  "eventemitter2": "^6.4.5",
13
13
  "webextension-polyfill": "^0.10.0",
14
- "@0xsequence/abi": "1.2.4",
15
- "@0xsequence/account": "1.2.4",
16
- "@0xsequence/auth": "1.2.4",
17
- "@0xsequence/core": "1.2.4",
18
- "@0xsequence/migration": "1.2.4",
19
- "@0xsequence/relayer": "1.2.4",
20
- "@0xsequence/network": "1.2.4",
21
- "@0xsequence/utils": "1.2.4",
22
- "@0xsequence/wallet": "1.2.4"
14
+ "@0xsequence/abi": "1.2.6",
15
+ "@0xsequence/core": "1.2.6",
16
+ "@0xsequence/account": "1.2.6",
17
+ "@0xsequence/auth": "1.2.6",
18
+ "@0xsequence/migration": "1.2.6",
19
+ "@0xsequence/network": "1.2.6",
20
+ "@0xsequence/utils": "1.2.6",
21
+ "@0xsequence/relayer": "1.2.6",
22
+ "@0xsequence/wallet": "1.2.6"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "ethers": ">=5.5 < 6"
package/src/client.ts CHANGED
@@ -169,8 +169,8 @@ export class SequenceClient {
169
169
  )
170
170
  })
171
171
 
172
- this.transport.on('disconnect', error => {
173
- this.callbacks.disconnect?.forEach(cb => cb(error))
172
+ this.transport.on('disconnect', (error, origin) => {
173
+ this.callbacks.disconnect?.forEach(cb => cb(error, origin))
174
174
  })
175
175
 
176
176
  this.transport.on('networks', networks => {
@@ -274,7 +274,7 @@ export abstract class BaseProviderTransport implements ProviderTransport {
274
274
  // NOTIFY DISCONNECT -- when wallet instructs to disconnect
275
275
  if (message.type === EventType.DISCONNECT) {
276
276
  if (this.isConnected()) {
277
- this.events.emit('disconnect', message.data)
277
+ this.events.emit('disconnect', message.data, message.origin)
278
278
  this.close()
279
279
  }
280
280
  }
@@ -48,10 +48,10 @@ export abstract class BaseWalletTransport implements WalletTransport {
48
48
  this.notifyConnect(connectDetails)
49
49
  })
50
50
 
51
- this.walletRequestHandler.on('disconnect', (error?: ProviderRpcError) => {
51
+ this.walletRequestHandler.on('disconnect', (error?: ProviderRpcError, origin?: string) => {
52
52
  if (!this.registered) return
53
53
  // means user has logged out the app / disconnected wallet from the app
54
- this.notifyDisconnect(error)
54
+ this.notifyDisconnect(error, origin)
55
55
  })
56
56
 
57
57
  this.walletRequestHandler.on('accountsChanged', (accounts: string[], origin?: string) => {
@@ -201,11 +201,12 @@ export abstract class BaseWalletTransport implements WalletTransport {
201
201
  })
202
202
  }
203
203
 
204
- notifyDisconnect(error?: ProviderRpcError) {
204
+ notifyDisconnect(error?: ProviderRpcError, origin?: string) {
205
205
  this.sendMessage({
206
206
  idx: -1,
207
207
  type: EventType.DISCONNECT,
208
- data: error ? { error } : null
208
+ data: error ? { error } : null,
209
+ origin
209
210
  })
210
211
  }
211
212
 
@@ -768,7 +768,7 @@ export class WalletRequestHandler implements ExternalProvider, JsonRpcHandler, P
768
768
 
769
769
  notifyDisconnect(origin?: string) {
770
770
  this.events.emit('accountsChanged', [], origin)
771
- this.events.emit('disconnect')
771
+ this.events.emit('disconnect', undefined, origin)
772
772
  }
773
773
 
774
774
  notifyChainChanged(chainId: number, origin?: string) {
package/src/types.ts CHANGED
@@ -129,7 +129,7 @@ export interface WalletEventTypes {
129
129
  close: (error?: ProviderRpcError) => void
130
130
 
131
131
  connect: (connectDetails: ConnectDetails) => void
132
- disconnect: (error?: ProviderRpcError) => void
132
+ disconnect: (error?: ProviderRpcError, origin?: string) => void
133
133
 
134
134
  accountsChanged: (accounts: string[], origin?: string) => void
135
135
  chainChanged: (chainIdHex: string, origin?: string) => void