@depay/web3-wallets-evm 18.1.0 → 18.1.1

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,12 @@ class WindowEthereum {
425
425
  if(typeof message === 'object') {
426
426
  let provider = this.getProvider();
427
427
  let account = await this.account();
428
+ if((await wallet.connectedTo(transaction.blockchain)) == false) {
429
+ await wallet.switchTo(transaction.blockchain);
430
+ }
431
+ if((await wallet.connectedTo(transaction.blockchain)) == false) {
432
+ throw({ code: 'WRONG_NETWORK' })
433
+ }
428
434
  let signature = await provider.request({
429
435
  method: 'eth_signTypedData_v4',
430
436
  params: [account, message],
@@ -1300,7 +1306,7 @@ class WalletConnectV2 {
1300
1306
  let account = await this.account();
1301
1307
  let signature = await this.signClient.request({
1302
1308
  topic: this.session.topic,
1303
- chainId: this.getValidChainId(),
1309
+ chainId: message.domain.chainId,
1304
1310
  request:{
1305
1311
  method: 'eth_signTypedData_v4',
1306
1312
  params: [account, JSON.stringify(message)],
package/dist/esm/index.js CHANGED
@@ -698,6 +698,12 @@ class WindowEthereum {
698
698
  if(typeof message === 'object') {
699
699
  let provider = this.getProvider();
700
700
  let account = await this.account();
701
+ if((await wallet.connectedTo(transaction.blockchain)) == false) {
702
+ await wallet.switchTo(transaction.blockchain);
703
+ }
704
+ if((await wallet.connectedTo(transaction.blockchain)) == false) {
705
+ throw({ code: 'WRONG_NETWORK' })
706
+ }
701
707
  let signature = await provider.request({
702
708
  method: 'eth_signTypedData_v4',
703
709
  params: [account, message],
@@ -1901,7 +1907,7 @@ class WalletConnectV2 {
1901
1907
  let account = await this.account();
1902
1908
  let signature = await this.signClient.request({
1903
1909
  topic: this.session.topic,
1904
- chainId: this.getValidChainId(),
1910
+ chainId: message.domain.chainId,
1905
1911
  request:{
1906
1912
  method: 'eth_signTypedData_v4',
1907
1913
  params: [account, JSON.stringify(message)],
@@ -429,6 +429,12 @@
429
429
  if(typeof message === 'object') {
430
430
  let provider = this.getProvider();
431
431
  let account = await this.account();
432
+ if((await wallet.connectedTo(transaction.blockchain)) == false) {
433
+ await wallet.switchTo(transaction.blockchain);
434
+ }
435
+ if((await wallet.connectedTo(transaction.blockchain)) == false) {
436
+ throw({ code: 'WRONG_NETWORK' })
437
+ }
432
438
  let signature = await provider.request({
433
439
  method: 'eth_signTypedData_v4',
434
440
  params: [account, message],
@@ -1304,7 +1310,7 @@
1304
1310
  let account = await this.account();
1305
1311
  let signature = await this.signClient.request({
1306
1312
  topic: this.session.topic,
1307
- chainId: this.getValidChainId(),
1313
+ chainId: message.domain.chainId,
1308
1314
  request:{
1309
1315
  method: 'eth_signTypedData_v4',
1310
1316
  params: [account, JSON.stringify(message)],
package/dist/umd/index.js CHANGED
@@ -701,6 +701,12 @@
701
701
  if(typeof message === 'object') {
702
702
  let provider = this.getProvider();
703
703
  let account = await this.account();
704
+ if((await wallet.connectedTo(transaction.blockchain)) == false) {
705
+ await wallet.switchTo(transaction.blockchain);
706
+ }
707
+ if((await wallet.connectedTo(transaction.blockchain)) == false) {
708
+ throw({ code: 'WRONG_NETWORK' })
709
+ }
704
710
  let signature = await provider.request({
705
711
  method: 'eth_signTypedData_v4',
706
712
  params: [account, message],
@@ -1904,7 +1910,7 @@
1904
1910
  let account = await this.account();
1905
1911
  let signature = await this.signClient.request({
1906
1912
  topic: this.session.topic,
1907
- chainId: this.getValidChainId(),
1913
+ chainId: message.domain.chainId,
1908
1914
  request:{
1909
1915
  method: 'eth_signTypedData_v4',
1910
1916
  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.1",
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",