@depay/web3-wallets-evm 18.1.0 → 18.1.2

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.
@@ -425,6 +425,13 @@ class WindowEthereum {
425
425
  if(typeof message === 'object') {
426
426
  let provider = this.getProvider();
427
427
  let account = await this.account();
428
+ let blockchain = Blockchains.findByNetworkId(message.domain.chainId);
429
+ if((await this.connectedTo(blockchain.name)) == false) {
430
+ await this.switchTo(blockchain.name);
431
+ }
432
+ if((await this.connectedTo(blockchain.name)) == false) {
433
+ throw({ code: 'WRONG_NETWORK' })
434
+ }
428
435
  let signature = await provider.request({
429
436
  method: 'eth_signTypedData_v4',
430
437
  params: [account, message],
@@ -1300,7 +1307,7 @@ class WalletConnectV2 {
1300
1307
  let account = await this.account();
1301
1308
  let signature = await this.signClient.request({
1302
1309
  topic: this.session.topic,
1303
- chainId: this.getValidChainId(),
1310
+ chainId: message.domain.chainId,
1304
1311
  request:{
1305
1312
  method: 'eth_signTypedData_v4',
1306
1313
  params: [account, JSON.stringify(message)],
package/dist/esm/index.js CHANGED
@@ -698,6 +698,13 @@ class WindowEthereum {
698
698
  if(typeof message === 'object') {
699
699
  let provider = this.getProvider();
700
700
  let account = await this.account();
701
+ let blockchain = Blockchains.findByNetworkId(message.domain.chainId);
702
+ if((await this.connectedTo(blockchain.name)) == false) {
703
+ await this.switchTo(blockchain.name);
704
+ }
705
+ if((await this.connectedTo(blockchain.name)) == false) {
706
+ throw({ code: 'WRONG_NETWORK' })
707
+ }
701
708
  let signature = await provider.request({
702
709
  method: 'eth_signTypedData_v4',
703
710
  params: [account, message],
@@ -1901,7 +1908,7 @@ class WalletConnectV2 {
1901
1908
  let account = await this.account();
1902
1909
  let signature = await this.signClient.request({
1903
1910
  topic: this.session.topic,
1904
- chainId: this.getValidChainId(),
1911
+ chainId: message.domain.chainId,
1905
1912
  request:{
1906
1913
  method: 'eth_signTypedData_v4',
1907
1914
  params: [account, JSON.stringify(message)],
@@ -429,6 +429,13 @@
429
429
  if(typeof message === 'object') {
430
430
  let provider = this.getProvider();
431
431
  let account = await this.account();
432
+ let blockchain = Blockchains__default['default'].findByNetworkId(message.domain.chainId);
433
+ if((await this.connectedTo(blockchain.name)) == false) {
434
+ await this.switchTo(blockchain.name);
435
+ }
436
+ if((await this.connectedTo(blockchain.name)) == false) {
437
+ throw({ code: 'WRONG_NETWORK' })
438
+ }
432
439
  let signature = await provider.request({
433
440
  method: 'eth_signTypedData_v4',
434
441
  params: [account, message],
@@ -1304,7 +1311,7 @@
1304
1311
  let account = await this.account();
1305
1312
  let signature = await this.signClient.request({
1306
1313
  topic: this.session.topic,
1307
- chainId: this.getValidChainId(),
1314
+ chainId: message.domain.chainId,
1308
1315
  request:{
1309
1316
  method: 'eth_signTypedData_v4',
1310
1317
  params: [account, JSON.stringify(message)],
package/dist/umd/index.js CHANGED
@@ -701,6 +701,13 @@
701
701
  if(typeof message === 'object') {
702
702
  let provider = this.getProvider();
703
703
  let account = await this.account();
704
+ let blockchain = Blockchains__default['default'].findByNetworkId(message.domain.chainId);
705
+ if((await this.connectedTo(blockchain.name)) == false) {
706
+ await this.switchTo(blockchain.name);
707
+ }
708
+ if((await this.connectedTo(blockchain.name)) == false) {
709
+ throw({ code: 'WRONG_NETWORK' })
710
+ }
704
711
  let signature = await provider.request({
705
712
  method: 'eth_signTypedData_v4',
706
713
  params: [account, message],
@@ -1904,7 +1911,7 @@
1904
1911
  let account = await this.account();
1905
1912
  let signature = await this.signClient.request({
1906
1913
  topic: this.session.topic,
1907
- chainId: this.getValidChainId(),
1914
+ chainId: message.domain.chainId,
1908
1915
  request:{
1909
1916
  method: 'eth_signTypedData_v4',
1910
1917
  params: [account, JSON.stringify(message)],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@depay/web3-wallets-evm",
3
3
  "moduleName": "Web3Wallets",
4
- "version": "18.1.0",
4
+ "version": "18.1.2",
5
5
  "description": "One-Stop-Shop JavaScript library to integrate various web3 crypto wallets and multiple blockchains at once with a single interface.",
6
6
  "main": "dist/umd/index.evm.js",
7
7
  "module": "dist/esm/index.evm.js",