@0xsequence/provider 1.2.3 → 1.2.4

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.
@@ -360,7 +360,7 @@ class BaseProviderTransport {
360
360
 
361
361
  // CHAIN_CHANGED -- when a user changes their default chain
362
362
  if (message.type === EventType.CHAIN_CHANGED) {
363
- this.events.emit('chainChanged', message.data);
363
+ this.events.emit('chainChanged', message.data, message.origin);
364
364
  return;
365
365
  }
366
366
 
@@ -949,9 +949,12 @@ class BaseWalletTransport {
949
949
  if (!networks || networks.length === 0) {
950
950
  this.notifyChainChanged('0x0');
951
951
  } else {
952
- this.notifyChainChanged(ethers.ethers.utils.hexlify(networks.find(network => network.isDefaultChain).chainId));
952
+ this.notifyChainChanged(ethers.ethers.utils.hexValue(networks.find(network => network.isDefaultChain).chainId));
953
953
  }
954
954
  });
955
+ this.walletRequestHandler.on('chainChanged', (chainIdHex, origin) => {
956
+ this.notifyChainChanged(chainIdHex, origin);
957
+ });
955
958
  this.walletRequestHandler.on('walletContext', walletContext => {
956
959
  if (!this.registered || !walletContext) return;
957
960
  this.notifyWalletContext(walletContext);
@@ -1021,14 +1024,15 @@ class BaseWalletTransport {
1021
1024
  idx: -1,
1022
1025
  type: EventType.ACCOUNTS_CHANGED,
1023
1026
  data: accounts,
1024
- origin: origin
1027
+ origin
1025
1028
  });
1026
1029
  }
1027
- notifyChainChanged(chainIdHex) {
1030
+ notifyChainChanged(chainIdHex, origin) {
1028
1031
  this.sendMessage({
1029
1032
  idx: -1,
1030
1033
  type: EventType.CHAIN_CHANGED,
1031
- data: chainIdHex
1034
+ data: chainIdHex,
1035
+ origin
1032
1036
  });
1033
1037
  }
1034
1038
  notifyNetworks(networks) {
@@ -2809,13 +2813,16 @@ class WalletRequestHandler {
2809
2813
  this.events.emit('accountsChanged', [], origin);
2810
2814
  this.events.emit('disconnect');
2811
2815
  }
2816
+ notifyChainChanged(chainId, origin) {
2817
+ this.events.emit('chainChanged', ethers.ethers.utils.hexValue(chainId), origin);
2818
+ }
2812
2819
  async notifyNetworks(networks) {
2813
2820
  const n = networks || (await this.getNetworks(true));
2814
2821
  this.events.emit('networks', n);
2815
2822
  if (n.length > 0) {
2816
2823
  const defaultNetwork = n.find(network => network.chainId === this.defaultChainId());
2817
2824
  if (defaultNetwork) {
2818
- this.events.emit('chainChanged', ethers.ethers.utils.hexlify(defaultNetwork.chainId));
2825
+ this.events.emit('chainChanged', ethers.ethers.utils.hexValue(defaultNetwork.chainId));
2819
2826
  }
2820
2827
  } else {
2821
2828
  this.events.emit('chainChanged', '0x0');
@@ -3524,7 +3531,7 @@ class SingleNetworkSequenceProvider extends SequenceProvider {
3524
3531
 
3525
3532
  var packageJson = {
3526
3533
  name: "@0xsequence/provider",
3527
- version: "1.2.3",
3534
+ version: "1.2.4",
3528
3535
  description: "provider sub-package for Sequence",
3529
3536
  repository: "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
3530
3537
  source: "src/index.ts",
@@ -3704,13 +3711,17 @@ class SequenceClient {
3704
3711
  var _this$callbacks$close;
3705
3712
  (_this$callbacks$close = this.callbacks.close) == null ? void 0 : _this$callbacks$close.forEach(cb => cb());
3706
3713
  });
3714
+ this.transport.on('chainChanged', (chainIdHex, origin) => {
3715
+ var _this$callbacks$chain;
3716
+ (_this$callbacks$chain = this.callbacks.chainChanged) == null ? void 0 : _this$callbacks$chain.forEach(cb => cb(chainIdHex, origin));
3717
+ });
3707
3718
 
3708
3719
  // We don't listen for the transport chainChanged event
3709
3720
  // instead we handle it locally, so we listen for changes in the store
3710
3721
  this.defaultChainId.onDefaultChainIdChanged(chainId => {
3711
- var _this$callbacks$chain;
3722
+ var _this$callbacks$chain2;
3712
3723
  const chainIdHex = ethers.ethers.utils.hexValue(chainId);
3713
- (_this$callbacks$chain = this.callbacks.chainChanged) == null ? void 0 : _this$callbacks$chain.forEach(cb => cb(chainIdHex));
3724
+ (_this$callbacks$chain2 = this.callbacks.chainChanged) == null ? void 0 : _this$callbacks$chain2.forEach(cb => cb(chainIdHex));
3714
3725
  });
3715
3726
  }
3716
3727
 
@@ -3751,6 +3762,9 @@ class SequenceClient {
3751
3762
  onWalletContext(callback) {
3752
3763
  return this.registerCallback('walletContext', callback);
3753
3764
  }
3765
+ onChainChanged(callback) {
3766
+ return this.registerCallback('chainChanged', callback);
3767
+ }
3754
3768
  onDefaultChainIdChanged(callback) {
3755
3769
  return this.registerCallback('chainChanged', callback);
3756
3770
  }
@@ -360,7 +360,7 @@ class BaseProviderTransport {
360
360
 
361
361
  // CHAIN_CHANGED -- when a user changes their default chain
362
362
  if (message.type === EventType.CHAIN_CHANGED) {
363
- this.events.emit('chainChanged', message.data);
363
+ this.events.emit('chainChanged', message.data, message.origin);
364
364
  return;
365
365
  }
366
366
 
@@ -949,9 +949,12 @@ class BaseWalletTransport {
949
949
  if (!networks || networks.length === 0) {
950
950
  this.notifyChainChanged('0x0');
951
951
  } else {
952
- this.notifyChainChanged(ethers.ethers.utils.hexlify(networks.find(network => network.isDefaultChain).chainId));
952
+ this.notifyChainChanged(ethers.ethers.utils.hexValue(networks.find(network => network.isDefaultChain).chainId));
953
953
  }
954
954
  });
955
+ this.walletRequestHandler.on('chainChanged', (chainIdHex, origin) => {
956
+ this.notifyChainChanged(chainIdHex, origin);
957
+ });
955
958
  this.walletRequestHandler.on('walletContext', walletContext => {
956
959
  if (!this.registered || !walletContext) return;
957
960
  this.notifyWalletContext(walletContext);
@@ -1021,14 +1024,15 @@ class BaseWalletTransport {
1021
1024
  idx: -1,
1022
1025
  type: EventType.ACCOUNTS_CHANGED,
1023
1026
  data: accounts,
1024
- origin: origin
1027
+ origin
1025
1028
  });
1026
1029
  }
1027
- notifyChainChanged(chainIdHex) {
1030
+ notifyChainChanged(chainIdHex, origin) {
1028
1031
  this.sendMessage({
1029
1032
  idx: -1,
1030
1033
  type: EventType.CHAIN_CHANGED,
1031
- data: chainIdHex
1034
+ data: chainIdHex,
1035
+ origin
1032
1036
  });
1033
1037
  }
1034
1038
  notifyNetworks(networks) {
@@ -2809,13 +2813,16 @@ class WalletRequestHandler {
2809
2813
  this.events.emit('accountsChanged', [], origin);
2810
2814
  this.events.emit('disconnect');
2811
2815
  }
2816
+ notifyChainChanged(chainId, origin) {
2817
+ this.events.emit('chainChanged', ethers.ethers.utils.hexValue(chainId), origin);
2818
+ }
2812
2819
  async notifyNetworks(networks) {
2813
2820
  const n = networks || (await this.getNetworks(true));
2814
2821
  this.events.emit('networks', n);
2815
2822
  if (n.length > 0) {
2816
2823
  const defaultNetwork = n.find(network => network.chainId === this.defaultChainId());
2817
2824
  if (defaultNetwork) {
2818
- this.events.emit('chainChanged', ethers.ethers.utils.hexlify(defaultNetwork.chainId));
2825
+ this.events.emit('chainChanged', ethers.ethers.utils.hexValue(defaultNetwork.chainId));
2819
2826
  }
2820
2827
  } else {
2821
2828
  this.events.emit('chainChanged', '0x0');
@@ -3524,7 +3531,7 @@ class SingleNetworkSequenceProvider extends SequenceProvider {
3524
3531
 
3525
3532
  var packageJson = {
3526
3533
  name: "@0xsequence/provider",
3527
- version: "1.2.3",
3534
+ version: "1.2.4",
3528
3535
  description: "provider sub-package for Sequence",
3529
3536
  repository: "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
3530
3537
  source: "src/index.ts",
@@ -3704,13 +3711,17 @@ class SequenceClient {
3704
3711
  var _this$callbacks$close;
3705
3712
  (_this$callbacks$close = this.callbacks.close) == null ? void 0 : _this$callbacks$close.forEach(cb => cb());
3706
3713
  });
3714
+ this.transport.on('chainChanged', (chainIdHex, origin) => {
3715
+ var _this$callbacks$chain;
3716
+ (_this$callbacks$chain = this.callbacks.chainChanged) == null ? void 0 : _this$callbacks$chain.forEach(cb => cb(chainIdHex, origin));
3717
+ });
3707
3718
 
3708
3719
  // We don't listen for the transport chainChanged event
3709
3720
  // instead we handle it locally, so we listen for changes in the store
3710
3721
  this.defaultChainId.onDefaultChainIdChanged(chainId => {
3711
- var _this$callbacks$chain;
3722
+ var _this$callbacks$chain2;
3712
3723
  const chainIdHex = ethers.ethers.utils.hexValue(chainId);
3713
- (_this$callbacks$chain = this.callbacks.chainChanged) == null ? void 0 : _this$callbacks$chain.forEach(cb => cb(chainIdHex));
3724
+ (_this$callbacks$chain2 = this.callbacks.chainChanged) == null ? void 0 : _this$callbacks$chain2.forEach(cb => cb(chainIdHex));
3714
3725
  });
3715
3726
  }
3716
3727
 
@@ -3751,6 +3762,9 @@ class SequenceClient {
3751
3762
  onWalletContext(callback) {
3752
3763
  return this.registerCallback('walletContext', callback);
3753
3764
  }
3765
+ onChainChanged(callback) {
3766
+ return this.registerCallback('chainChanged', callback);
3767
+ }
3754
3768
  onDefaultChainIdChanged(callback) {
3755
3769
  return this.registerCallback('chainChanged', callback);
3756
3770
  }
@@ -356,7 +356,7 @@ class BaseProviderTransport {
356
356
 
357
357
  // CHAIN_CHANGED -- when a user changes their default chain
358
358
  if (message.type === EventType.CHAIN_CHANGED) {
359
- this.events.emit('chainChanged', message.data);
359
+ this.events.emit('chainChanged', message.data, message.origin);
360
360
  return;
361
361
  }
362
362
 
@@ -945,9 +945,12 @@ class BaseWalletTransport {
945
945
  if (!networks || networks.length === 0) {
946
946
  this.notifyChainChanged('0x0');
947
947
  } else {
948
- this.notifyChainChanged(ethers.utils.hexlify(networks.find(network => network.isDefaultChain).chainId));
948
+ this.notifyChainChanged(ethers.utils.hexValue(networks.find(network => network.isDefaultChain).chainId));
949
949
  }
950
950
  });
951
+ this.walletRequestHandler.on('chainChanged', (chainIdHex, origin) => {
952
+ this.notifyChainChanged(chainIdHex, origin);
953
+ });
951
954
  this.walletRequestHandler.on('walletContext', walletContext => {
952
955
  if (!this.registered || !walletContext) return;
953
956
  this.notifyWalletContext(walletContext);
@@ -1017,14 +1020,15 @@ class BaseWalletTransport {
1017
1020
  idx: -1,
1018
1021
  type: EventType.ACCOUNTS_CHANGED,
1019
1022
  data: accounts,
1020
- origin: origin
1023
+ origin
1021
1024
  });
1022
1025
  }
1023
- notifyChainChanged(chainIdHex) {
1026
+ notifyChainChanged(chainIdHex, origin) {
1024
1027
  this.sendMessage({
1025
1028
  idx: -1,
1026
1029
  type: EventType.CHAIN_CHANGED,
1027
- data: chainIdHex
1030
+ data: chainIdHex,
1031
+ origin
1028
1032
  });
1029
1033
  }
1030
1034
  notifyNetworks(networks) {
@@ -2805,13 +2809,16 @@ class WalletRequestHandler {
2805
2809
  this.events.emit('accountsChanged', [], origin);
2806
2810
  this.events.emit('disconnect');
2807
2811
  }
2812
+ notifyChainChanged(chainId, origin) {
2813
+ this.events.emit('chainChanged', ethers.utils.hexValue(chainId), origin);
2814
+ }
2808
2815
  async notifyNetworks(networks) {
2809
2816
  const n = networks || (await this.getNetworks(true));
2810
2817
  this.events.emit('networks', n);
2811
2818
  if (n.length > 0) {
2812
2819
  const defaultNetwork = n.find(network => network.chainId === this.defaultChainId());
2813
2820
  if (defaultNetwork) {
2814
- this.events.emit('chainChanged', ethers.utils.hexlify(defaultNetwork.chainId));
2821
+ this.events.emit('chainChanged', ethers.utils.hexValue(defaultNetwork.chainId));
2815
2822
  }
2816
2823
  } else {
2817
2824
  this.events.emit('chainChanged', '0x0');
@@ -3520,7 +3527,7 @@ class SingleNetworkSequenceProvider extends SequenceProvider {
3520
3527
 
3521
3528
  var packageJson = {
3522
3529
  name: "@0xsequence/provider",
3523
- version: "1.2.3",
3530
+ version: "1.2.4",
3524
3531
  description: "provider sub-package for Sequence",
3525
3532
  repository: "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
3526
3533
  source: "src/index.ts",
@@ -3700,13 +3707,17 @@ class SequenceClient {
3700
3707
  var _this$callbacks$close;
3701
3708
  (_this$callbacks$close = this.callbacks.close) == null ? void 0 : _this$callbacks$close.forEach(cb => cb());
3702
3709
  });
3710
+ this.transport.on('chainChanged', (chainIdHex, origin) => {
3711
+ var _this$callbacks$chain;
3712
+ (_this$callbacks$chain = this.callbacks.chainChanged) == null ? void 0 : _this$callbacks$chain.forEach(cb => cb(chainIdHex, origin));
3713
+ });
3703
3714
 
3704
3715
  // We don't listen for the transport chainChanged event
3705
3716
  // instead we handle it locally, so we listen for changes in the store
3706
3717
  this.defaultChainId.onDefaultChainIdChanged(chainId => {
3707
- var _this$callbacks$chain;
3718
+ var _this$callbacks$chain2;
3708
3719
  const chainIdHex = ethers.utils.hexValue(chainId);
3709
- (_this$callbacks$chain = this.callbacks.chainChanged) == null ? void 0 : _this$callbacks$chain.forEach(cb => cb(chainIdHex));
3720
+ (_this$callbacks$chain2 = this.callbacks.chainChanged) == null ? void 0 : _this$callbacks$chain2.forEach(cb => cb(chainIdHex));
3710
3721
  });
3711
3722
  }
3712
3723
 
@@ -3747,6 +3758,9 @@ class SequenceClient {
3747
3758
  onWalletContext(callback) {
3748
3759
  return this.registerCallback('walletContext', callback);
3749
3760
  }
3761
+ onChainChanged(callback) {
3762
+ return this.registerCallback('chainChanged', callback);
3763
+ }
3750
3764
  onDefaultChainIdChanged(callback) {
3751
3765
  return this.registerCallback('chainChanged', callback);
3752
3766
  }
@@ -58,6 +58,7 @@ export declare class SequenceClient {
58
58
  onNetworks(callback: WalletEventTypes['networks']): () => void;
59
59
  onAccountsChanged(callback: WalletEventTypes['accountsChanged']): () => void;
60
60
  onWalletContext(callback: WalletEventTypes['walletContext']): () => void;
61
+ onChainChanged(callback: WalletEventTypes['chainChanged']): () => void;
61
62
  onDefaultChainIdChanged(callback: WalletEventTypes['chainChanged']): () => void;
62
63
  getChainId(): number;
63
64
  setDefaultChainId(chainId: number): void;
@@ -28,7 +28,7 @@ export declare abstract class BaseWalletTransport implements WalletTransport {
28
28
  notifyConnect(connectDetails: ConnectDetails): void;
29
29
  notifyDisconnect(error?: ProviderRpcError): void;
30
30
  notifyAccountsChanged(accounts: string[], origin?: string): void;
31
- notifyChainChanged(chainIdHex: string): void;
31
+ notifyChainChanged(chainIdHex: string, origin?: string): void;
32
32
  notifyNetworks(networks: NetworkConfig[]): void;
33
33
  notifyWalletContext(walletContext: commons.context.VersionedContext): void;
34
34
  protected isValidInitAck(message: ProviderMessage<any>): boolean;
@@ -39,6 +39,7 @@ export declare class WalletRequestHandler implements ExternalProvider, JsonRpcHa
39
39
  walletSession(networkId?: ChainIdLike): WalletSession | undefined;
40
40
  notifyConnect(connectDetails: ConnectDetails, origin?: string): void;
41
41
  notifyDisconnect(origin?: string): void;
42
+ notifyChainChanged(chainId: number, origin?: string): void;
42
43
  notifyNetworks(networks?: NetworkConfig[]): Promise<void>;
43
44
  notifyWalletContext(): Promise<void>;
44
45
  notifyClose(error?: ProviderRpcError): void;
@@ -86,7 +86,7 @@ export interface WalletEventTypes {
86
86
  connect: (connectDetails: ConnectDetails) => void;
87
87
  disconnect: (error?: ProviderRpcError) => void;
88
88
  accountsChanged: (accounts: string[], origin?: string) => void;
89
- chainChanged: (chainIdHex: string) => void;
89
+ chainChanged: (chainIdHex: string, origin?: string) => void;
90
90
  networks: (networks: NetworkConfig[]) => void;
91
91
  walletContext: (walletContext: commons.context.VersionedContext) => void;
92
92
  }
@@ -115,8 +115,7 @@ export interface ConnectOptions {
115
115
  expiry?: number;
116
116
  /** authorize will perform an ETHAuth eip712 signing and return the proof to the dapp. */
117
117
  authorize?: boolean;
118
- /** authorizeNonce number is an optional number to be passed toe ETHAuth nonce claim for extra
119
- * challenge and security feature. **/
118
+ /** authorizeNonce is an optional number to be passed as ETHAuth's nonce claim for replay protection. **/
120
119
  authorizeNonce?: number;
121
120
  /** authorizeVersion is the version of the SDK that will validate the ETHAuth proof. */
122
121
  authorizeVersion?: number;
@@ -192,7 +191,7 @@ export interface Settings {
192
191
  * you can use the camel case version of the name in the wallet settings.
193
192
  * For example: "Blue Dark" on wallet UI can be passed as "blueDark" */
194
193
  export type ThemeOption = 'light' | 'dark' | string;
195
- export type PaymentProviderOption = 'moonpay' | 'wyre' | 'ramp';
194
+ export type PaymentProviderOption = 'ramp' | 'moonpay' | 'transak' | 'onmeta' | 'paytrie' | 'sardine';
196
195
  export type CurrencyOption = 'usdc' | 'eth' | 'matic';
197
196
  export type SignInOption = 'email' | 'google' | 'apple' | 'facebook' | 'discord' | 'twitch';
198
197
  export type BannerSize = 'small' | 'medium';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/provider",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
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.3",
15
- "@0xsequence/account": "1.2.3",
16
- "@0xsequence/auth": "1.2.3",
17
- "@0xsequence/migration": "1.2.3",
18
- "@0xsequence/core": "1.2.3",
19
- "@0xsequence/network": "1.2.3",
20
- "@0xsequence/relayer": "1.2.3",
21
- "@0xsequence/utils": "1.2.3",
22
- "@0xsequence/wallet": "1.2.3"
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"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "ethers": ">=5.5 < 6"
package/src/client.ts CHANGED
@@ -189,6 +189,10 @@ export class SequenceClient {
189
189
  this.callbacks.close?.forEach(cb => cb())
190
190
  })
191
191
 
192
+ this.transport.on('chainChanged', (chainIdHex, origin) => {
193
+ this.callbacks.chainChanged?.forEach(cb => cb(chainIdHex, origin))
194
+ })
195
+
192
196
  // We don't listen for the transport chainChanged event
193
197
  // instead we handle it locally, so we listen for changes in the store
194
198
  this.defaultChainId.onDefaultChainIdChanged((chainId: number) => {
@@ -242,6 +246,10 @@ export class SequenceClient {
242
246
  return this.registerCallback('walletContext', callback)
243
247
  }
244
248
 
249
+ onChainChanged(callback: WalletEventTypes['chainChanged']) {
250
+ return this.registerCallback('chainChanged', callback)
251
+ }
252
+
245
253
  onDefaultChainIdChanged(callback: WalletEventTypes['chainChanged']) {
246
254
  return this.registerCallback('chainChanged', callback)
247
255
  }
@@ -240,7 +240,7 @@ export abstract class BaseProviderTransport implements ProviderTransport {
240
240
 
241
241
  // CHAIN_CHANGED -- when a user changes their default chain
242
242
  if (message.type === EventType.CHAIN_CHANGED) {
243
- this.events.emit('chainChanged', message.data)
243
+ this.events.emit('chainChanged', message.data, message.origin)
244
244
  return
245
245
  }
246
246
 
@@ -65,10 +65,14 @@ export abstract class BaseWalletTransport implements WalletTransport {
65
65
  if (!networks || networks.length === 0) {
66
66
  this.notifyChainChanged('0x0')
67
67
  } else {
68
- this.notifyChainChanged(ethers.utils.hexlify(networks.find(network => network.isDefaultChain)!.chainId))
68
+ this.notifyChainChanged(ethers.utils.hexValue(networks.find(network => network.isDefaultChain)!.chainId))
69
69
  }
70
70
  })
71
71
 
72
+ this.walletRequestHandler.on('chainChanged', (chainIdHex: string, origin?: string) => {
73
+ this.notifyChainChanged(chainIdHex, origin)
74
+ })
75
+
72
76
  this.walletRequestHandler.on('walletContext', (walletContext: commons.context.VersionedContext) => {
73
77
  if (!this.registered || !walletContext) return
74
78
  this.notifyWalletContext(walletContext)
@@ -210,15 +214,16 @@ export abstract class BaseWalletTransport implements WalletTransport {
210
214
  idx: -1,
211
215
  type: EventType.ACCOUNTS_CHANGED,
212
216
  data: accounts,
213
- origin: origin
217
+ origin
214
218
  })
215
219
  }
216
220
 
217
- notifyChainChanged(chainIdHex: string) {
221
+ notifyChainChanged(chainIdHex: string, origin?: string) {
218
222
  this.sendMessage({
219
223
  idx: -1,
220
224
  type: EventType.CHAIN_CHANGED,
221
- data: chainIdHex
225
+ data: chainIdHex,
226
+ origin
222
227
  })
223
228
  }
224
229
 
@@ -771,13 +771,17 @@ export class WalletRequestHandler implements ExternalProvider, JsonRpcHandler, P
771
771
  this.events.emit('disconnect')
772
772
  }
773
773
 
774
+ notifyChainChanged(chainId: number, origin?: string) {
775
+ this.events.emit('chainChanged', ethers.utils.hexValue(chainId), origin)
776
+ }
777
+
774
778
  async notifyNetworks(networks?: NetworkConfig[]) {
775
779
  const n = networks || (await this.getNetworks(true))
776
780
  this.events.emit('networks', n)
777
781
  if (n.length > 0) {
778
782
  const defaultNetwork = n.find(network => network.chainId === this.defaultChainId())
779
783
  if (defaultNetwork) {
780
- this.events.emit('chainChanged', ethers.utils.hexlify(defaultNetwork.chainId))
784
+ this.events.emit('chainChanged', ethers.utils.hexValue(defaultNetwork.chainId))
781
785
  }
782
786
  } else {
783
787
  this.events.emit('chainChanged', '0x0')
package/src/types.ts CHANGED
@@ -132,7 +132,7 @@ export interface WalletEventTypes {
132
132
  disconnect: (error?: ProviderRpcError) => void
133
133
 
134
134
  accountsChanged: (accounts: string[], origin?: string) => void
135
- chainChanged: (chainIdHex: string) => void
135
+ chainChanged: (chainIdHex: string, origin?: string) => void
136
136
 
137
137
  networks: (networks: NetworkConfig[]) => void
138
138
  walletContext: (walletContext: commons.context.VersionedContext) => void
@@ -171,8 +171,7 @@ export interface ConnectOptions {
171
171
  /** authorize will perform an ETHAuth eip712 signing and return the proof to the dapp. */
172
172
  authorize?: boolean
173
173
 
174
- /** authorizeNonce number is an optional number to be passed toe ETHAuth nonce claim for extra
175
- * challenge and security feature. **/
174
+ /** authorizeNonce is an optional number to be passed as ETHAuth's nonce claim for replay protection. **/
176
175
  authorizeNonce?: number
177
176
 
178
177
  /** authorizeVersion is the version of the SDK that will validate the ETHAuth proof. */
@@ -267,7 +266,7 @@ export interface Settings {
267
266
  * you can use the camel case version of the name in the wallet settings.
268
267
  * For example: "Blue Dark" on wallet UI can be passed as "blueDark" */
269
268
  export type ThemeOption = 'light' | 'dark' | string
270
- export type PaymentProviderOption = 'moonpay' | 'wyre' | 'ramp'
269
+ export type PaymentProviderOption = 'ramp' | 'moonpay' | 'transak' | 'onmeta' | 'paytrie' | 'sardine'
271
270
  export type CurrencyOption = 'usdc' | 'eth' | 'matic'
272
271
  export type SignInOption = 'email' | 'google' | 'apple' | 'facebook' | 'discord' | 'twitch'
273
272
  export type BannerSize = 'small' | 'medium' // | 'large'