@depay/web3-wallets-evm 14.2.0 → 14.5.0

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.
package/dist/umd/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Web3Wallets = {}, global.Web3Blockchains, global.ethers, global.Web3Constants, global.SolanaWeb3js, global.Web3Client, global.WalletConnect, global.WalletConnectV2, global.CoinbaseWalletSdk));
5
5
  }(this, (function (exports, web3Blockchains, ethers, web3Constants, solanaWeb3_js, web3Client, walletconnectV1, walletconnectV2, coinbaseWalletSdk) { 'use strict';
6
6
 
7
- function _optionalChain$h(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
7
+ function _optionalChain$g(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
8
8
  class Transaction {
9
9
 
10
10
  constructor({ blockchain, from, to, value, api, method, params, instructions, sent, succeeded, failed }) {
@@ -15,7 +15,7 @@
15
15
  this.to = (to && to.match('0x')) ? ethers.ethers.utils.getAddress(to) : to;
16
16
 
17
17
  // optional
18
- this.value = _optionalChain$h([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
18
+ this.value = _optionalChain$g([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
19
19
  this.api = api;
20
20
  this.method = method;
21
21
  this.params = params;
@@ -293,7 +293,7 @@
293
293
  setProvider: setProvider$1,
294
294
  };
295
295
 
296
- function _optionalChain$g(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
296
+ function _optionalChain$f(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
297
297
  let getCacheStore = () => {
298
298
  if (getWindow()._cacheStore == undefined) {
299
299
  resetCache();
@@ -323,7 +323,7 @@
323
323
 
324
324
  let get = function ({ key, expires }) {
325
325
  let cachedEntry = getCacheStore()[key];
326
- if (_optionalChain$g([cachedEntry, 'optionalAccess', _ => _.expiresAt]) > Date.now()) {
326
+ if (_optionalChain$f([cachedEntry, 'optionalAccess', _ => _.expiresAt]) > Date.now()) {
327
327
  return cachedEntry.value
328
328
  }
329
329
  };
@@ -564,7 +564,7 @@
564
564
  supported$2.evm = ['ethereum', 'bsc', 'polygon', 'velas'];
565
565
  supported$2.solana = [];
566
566
 
567
- function _optionalChain$f(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
567
+ function _optionalChain$e(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
568
568
  class WindowEthereum {
569
569
 
570
570
  static __initStatic() {this.info = {
@@ -575,12 +575,12 @@
575
575
 
576
576
  static __initStatic2() {this.isAvailable = ()=>{
577
577
  return (
578
- _optionalChain$f([window, 'optionalAccess', _13 => _13.ethereum]) &&
578
+ _optionalChain$e([window, 'optionalAccess', _13 => _13.ethereum]) &&
579
579
  Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)/)).length != 1 && // MetaMask
580
- !_optionalChain$f([window, 'optionalAccess', _14 => _14.coin98]) && // Coin98
581
- !(_optionalChain$f([window, 'optionalAccess', _15 => _15.ethereum, 'optionalAccess', _16 => _16.isTrust]) || _optionalChain$f([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isTrustWallet])) && // Trust Wallet
582
- !_optionalChain$f([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isDeficonnectProvider]) && // crypto.com
583
- !(_optionalChain$f([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.isCoinbaseWallet]) || _optionalChain$f([window, 'optionalAccess', _23 => _23.ethereum, 'optionalAccess', _24 => _24.isWalletLink]))
580
+ !_optionalChain$e([window, 'optionalAccess', _14 => _14.coin98]) && // Coin98
581
+ !(_optionalChain$e([window, 'optionalAccess', _15 => _15.ethereum, 'optionalAccess', _16 => _16.isTrust]) || _optionalChain$e([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isTrustWallet])) && // Trust Wallet
582
+ !_optionalChain$e([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isDeficonnectProvider]) && // crypto.com
583
+ !(_optionalChain$e([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.isCoinbaseWallet]) || _optionalChain$e([window, 'optionalAccess', _23 => _23.ethereum, 'optionalAccess', _24 => _24.isWalletLink]))
584
584
  )
585
585
  };}
586
586
 
@@ -687,7 +687,7 @@
687
687
  }
688
688
  } WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
689
689
 
690
- function _optionalChain$e(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
690
+ function _optionalChain$d(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
691
691
  class Binance extends WindowEthereum {
692
692
 
693
693
  static __initStatic() {this.info = {
@@ -697,7 +697,7 @@
697
697
  };}
698
698
 
699
699
  static __initStatic2() {this.isAvailable = ()=>{
700
- return _optionalChain$e([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
700
+ return _optionalChain$d([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
701
701
  !window.coin98
702
702
  };}
703
703
 
@@ -705,7 +705,7 @@
705
705
 
706
706
  } Binance.__initStatic(); Binance.__initStatic2();
707
707
 
708
- function _optionalChain$d(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
708
+ function _optionalChain$c(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
709
709
  class Brave extends WindowEthereum {
710
710
 
711
711
  static __initStatic() {this.info = {
@@ -714,10 +714,10 @@
714
714
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
715
715
  };}
716
716
 
717
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$d([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
717
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$c([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
718
718
  } Brave.__initStatic(); Brave.__initStatic2();
719
719
 
720
- function _optionalChain$c(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
720
+ function _optionalChain$b(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
721
721
  class Coin98 extends WindowEthereum {
722
722
 
723
723
  static __initStatic() {this.info = {
@@ -726,10 +726,10 @@
726
726
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
727
727
  };}
728
728
 
729
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$c([window, 'optionalAccess', _2 => _2.coin98]) };}
729
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$b([window, 'optionalAccess', _2 => _2.coin98]) };}
730
730
  } Coin98.__initStatic(); Coin98.__initStatic2();
731
731
 
732
- function _optionalChain$b(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
732
+ function _optionalChain$a(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
733
733
  class Coinbase extends WindowEthereum {
734
734
 
735
735
  static __initStatic() {this.info = {
@@ -738,10 +738,10 @@
738
738
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
739
739
  };}
740
740
 
741
- static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$b([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isCoinbaseWallet]) || _optionalChain$b([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isWalletLink])) };}
741
+ static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$a([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isCoinbaseWallet]) || _optionalChain$a([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isWalletLink])) };}
742
742
  } Coinbase.__initStatic(); Coinbase.__initStatic2();
743
743
 
744
- function _optionalChain$a(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
744
+ function _optionalChain$9(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
745
745
  class CryptoCom extends WindowEthereum {
746
746
 
747
747
  static __initStatic() {this.info = {
@@ -750,10 +750,10 @@
750
750
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
751
751
  };}
752
752
 
753
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$a([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
753
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$9([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
754
754
  } CryptoCom.__initStatic(); CryptoCom.__initStatic2();
755
755
 
756
- function _optionalChain$9(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
756
+ function _optionalChain$8(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
757
757
  class MetaMask extends WindowEthereum {
758
758
 
759
759
  static __initStatic() {this.info = {
@@ -763,11 +763,11 @@
763
763
  };}
764
764
 
765
765
  static __initStatic2() {this.isAvailable = ()=>{
766
- return _optionalChain$9([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMetaMask]) && Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)/)).length == 1
766
+ return _optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMetaMask]) && Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)/)).length == 1
767
767
  };}
768
768
  } MetaMask.__initStatic(); MetaMask.__initStatic2();
769
769
 
770
- function _optionalChain$8(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
770
+ function _optionalChain$7(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
771
771
  class Opera extends WindowEthereum {
772
772
 
773
773
  static __initStatic() {this.info = {
@@ -776,10 +776,10 @@
776
776
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
777
777
  };}
778
778
 
779
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
779
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$7([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
780
780
  } Opera.__initStatic(); Opera.__initStatic2();
781
781
 
782
- function _optionalChain$7(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
782
+ function _optionalChain$6(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
783
783
  const POLL_SPEED = 500; // 0.5 seconds
784
784
  const MAX_POLLS = 240; // 120 seconds
785
785
 
@@ -799,14 +799,14 @@
799
799
 
800
800
  const provider = await web3Client.getProvider(transaction.blockchain);
801
801
  const { value } = await provider.getSignatureStatus(signature);
802
- const confirmationStatus = _optionalChain$7([value, 'optionalAccess', _ => _.confirmationStatus]);
802
+ const confirmationStatus = _optionalChain$6([value, 'optionalAccess', _ => _.confirmationStatus]);
803
803
  if(confirmationStatus) {
804
804
  const hasReachedSufficientCommitment = confirmationStatus === 'confirmed' || confirmationStatus === 'finalized';
805
805
  if (hasReachedSufficientCommitment) {
806
806
  if(value.err) {
807
807
  transaction._failed = true;
808
808
  const confirmedTransaction = await provider.getConfirmedTransaction(signature);
809
- const failedReason = _optionalChain$7([confirmedTransaction, 'optionalAccess', _2 => _2.meta, 'optionalAccess', _3 => _3.logMessages]) ? confirmedTransaction.meta.logMessages[confirmedTransaction.meta.logMessages.length - 1] : null;
809
+ const failedReason = _optionalChain$6([confirmedTransaction, 'optionalAccess', _2 => _2.meta, 'optionalAccess', _3 => _3.logMessages]) ? confirmedTransaction.meta.logMessages[confirmedTransaction.meta.logMessages.length - 1] : null;
810
810
  if(transaction.failed) transaction.failed(transaction, failedReason);
811
811
  } else {
812
812
  transaction._succeeded = true;
@@ -869,7 +869,7 @@
869
869
  supported$1.evm = ['ethereum', 'bsc', 'polygon', 'velas'];
870
870
  supported$1.solana = ['solana'];
871
871
 
872
- function _optionalChain$6(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
872
+ function _optionalChain$5(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
873
873
  class WindowSolana {
874
874
 
875
875
  static __initStatic() {this.info = {
@@ -880,8 +880,8 @@
880
880
 
881
881
  static __initStatic2() {this.isAvailable = ()=>{
882
882
  return (
883
- _optionalChain$6([window, 'optionalAccess', _4 => _4.solana]) &&
884
- !_optionalChain$6([window, 'optionalAccess', _5 => _5.solana, 'optionalAccess', _6 => _6.isPhantom]) &&
883
+ _optionalChain$5([window, 'optionalAccess', _4 => _4.solana]) &&
884
+ !_optionalChain$5([window, 'optionalAccess', _5 => _5.solana, 'optionalAccess', _6 => _6.isPhantom]) &&
885
885
  !window.coin98
886
886
  )
887
887
  };}
@@ -899,9 +899,9 @@
899
899
  }
900
900
 
901
901
  async account() {
902
- if(_optionalChain$6([window, 'optionalAccess', _7 => _7.solana]) == undefined){ return }
903
- if(_optionalChain$6([window, 'optionalAccess', _8 => _8.solana, 'optionalAccess', _9 => _9.publicKey])) { return window.solana.publicKey.toString() }
904
- if(_optionalChain$6([window, 'optionalAccess', _10 => _10.solana, 'optionalAccess', _11 => _11.isBraveWallet]) != true) {
902
+ if(_optionalChain$5([window, 'optionalAccess', _7 => _7.solana]) == undefined){ return }
903
+ if(_optionalChain$5([window, 'optionalAccess', _8 => _8.solana, 'optionalAccess', _9 => _9.publicKey])) { return window.solana.publicKey.toString() }
904
+ if(_optionalChain$5([window, 'optionalAccess', _10 => _10.solana, 'optionalAccess', _11 => _11.isBraveWallet]) != true) {
905
905
  let publicKey;
906
906
  try { ({ publicKey } = await window.solana.connect({ onlyIfTrusted: true })); } catch (e) {}
907
907
  if(publicKey){ return publicKey.toString() }
@@ -909,7 +909,7 @@
909
909
  }
910
910
 
911
911
  async connect() {
912
- if(!_optionalChain$6([window, 'optionalAccess', _12 => _12.solana])) { return undefined }
912
+ if(!_optionalChain$5([window, 'optionalAccess', _12 => _12.solana])) { return undefined }
913
913
  let { publicKey } = await window.solana.connect();
914
914
  return publicKey.toString()
915
915
  }
@@ -918,7 +918,7 @@
918
918
  let internalCallback;
919
919
  switch (event) {
920
920
  case 'account':
921
- internalCallback = (publicKey) => callback(_optionalChain$6([publicKey, 'optionalAccess', _13 => _13.toString, 'call', _14 => _14()]));
921
+ internalCallback = (publicKey) => callback(_optionalChain$5([publicKey, 'optionalAccess', _13 => _13.toString, 'call', _14 => _14()]));
922
922
  window.solana.on('accountChanged', internalCallback);
923
923
  break
924
924
  }
@@ -958,7 +958,7 @@
958
958
  }
959
959
  } WindowSolana.__initStatic(); WindowSolana.__initStatic2();
960
960
 
961
- function _optionalChain$5(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
961
+ function _optionalChain$4(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
962
962
  class Phantom extends WindowSolana {
963
963
 
964
964
  static __initStatic() {this.info = {
@@ -967,10 +967,10 @@
967
967
  blockchains: supported$1.solana
968
968
  };}
969
969
 
970
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$5([window, 'optionalAccess', _3 => _3.solana, 'optionalAccess', _4 => _4.isPhantom]) };}
970
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$4([window, 'optionalAccess', _3 => _3.solana, 'optionalAccess', _4 => _4.isPhantom]) };}
971
971
  } Phantom.__initStatic(); Phantom.__initStatic2();
972
972
 
973
- function _optionalChain$4(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
973
+ function _optionalChain$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
974
974
  class Trust extends WindowEthereum {
975
975
 
976
976
  static __initStatic() {this.info = {
@@ -979,10 +979,9 @@
979
979
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
980
980
  };}
981
981
 
982
- static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$4([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$4([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) };}
982
+ static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$3([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$3([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) };}
983
983
  } Trust.__initStatic(); Trust.__initStatic2();
984
984
 
985
- function _optionalChain$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
986
985
  const sendTransaction$2 = async ({ transaction, wallet })=> {
987
986
  transaction = new Transaction(transaction);
988
987
  if((await wallet.connectedTo(transaction.blockchain)) == false) {
@@ -1058,26 +1057,54 @@
1058
1057
 
1059
1058
  const submitContractInteraction$2 = async ({ transaction, wallet })=>{
1060
1059
  const provider = await web3Client.getProvider(transaction.blockchain);
1060
+ const gasPrice = await provider.getGasPrice();
1061
+ const gas = await web3Client.estimate(transaction);
1062
+ const data = await transaction.getData();
1063
+ const value = transaction.value ? ethers.ethers.utils.hexlify(ethers.ethers.BigNumber.from(transaction.value)) : undefined;
1064
+ const nonce = ethers.ethers.utils.hexlify(transaction.nonce);
1065
+ console.log({
1066
+ from: transaction.from,
1067
+ to: transaction.to,
1068
+ value,
1069
+ data,
1070
+ gas: gas.toHexString(),
1071
+ gasPrice: gasPrice.toHexString(),
1072
+ nonce,
1073
+ });
1061
1074
  return wallet.connector.sendTransaction({
1062
1075
  from: transaction.from,
1063
1076
  to: transaction.to,
1064
- value: _optionalChain$3([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]),
1065
- data: await transaction.getData(),
1066
- gas: (await web3Client.estimate(transaction)).toString(),
1067
- gasPrice: (await provider.getGasPrice()).toString(),
1068
- nonce: transaction.nonce,
1077
+ value,
1078
+ data,
1079
+ gas: gas.toHexString(),
1080
+ gasPrice: gasPrice.toHexString(),
1081
+ nonce,
1069
1082
  })
1070
1083
  };
1071
1084
 
1072
1085
  const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
1073
1086
  const provider = await web3Client.getProvider(transaction.blockchain);
1087
+ const gasPrice = await provider.getGasPrice();
1088
+ const gas = await web3Client.estimate(transaction);
1089
+ const value = ethers.ethers.utils.hexlify(ethers.ethers.BigNumber.from(transaction.value));
1090
+ const nonce = ethers.ethers.utils.hexlify(transaction.nonce);
1091
+ console.log({
1092
+ from: transaction.from,
1093
+ to: transaction.to,
1094
+ value,
1095
+ data: '0x',
1096
+ gas: gas.toHexString(),
1097
+ gasPrice: gasPrice.toHexString(),
1098
+ nonce,
1099
+ });
1074
1100
  return wallet.connector.sendTransaction({
1075
1101
  from: transaction.from,
1076
1102
  to: transaction.to,
1077
- value: _optionalChain$3([transaction, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]),
1078
- gas: (await web3Client.estimate(transaction)).toString(),
1079
- gasPrice: (await provider.getGasPrice()).toString(),
1080
- nonce: transaction.nonce,
1103
+ value,
1104
+ data: '0x',
1105
+ gas: gas.toHexString(),
1106
+ gasPrice: gasPrice.toHexString(),
1107
+ nonce,
1081
1108
  })
1082
1109
  };
1083
1110
 
@@ -1108,7 +1135,6 @@
1108
1135
  this.name = this.constructor.info.name;
1109
1136
  this.logo = this.constructor.info.logo;
1110
1137
  this.blockchains = this.constructor.info.blockchains;
1111
- this.connector = WalletConnectV1.instance || this.newWalletConnectInstance();
1112
1138
  this.sendTransaction = (transaction)=>{
1113
1139
  return sendTransaction$2({
1114
1140
  wallet: this,
@@ -1117,10 +1143,13 @@
1117
1143
  };
1118
1144
  }
1119
1145
 
1120
- newWalletConnectInstance() {
1146
+ newWalletConnectInstance(connect) {
1121
1147
  let instance = new walletconnectV1.WalletConnectClient({
1122
- bridge: "https://bridge.walletconnect.org",
1123
- qrcodeModal: walletconnectV1.QRCodeModal
1148
+ bridge: "https://walletconnect.depay.com",
1149
+ qrcodeModal: {
1150
+ open: async(uri)=>connect({ uri }),
1151
+ close: ()=>{},
1152
+ }
1124
1153
  });
1125
1154
 
1126
1155
  instance.on("connect", (error, payload) => {
@@ -1156,20 +1185,25 @@
1156
1185
  }
1157
1186
 
1158
1187
  async connect(options) {
1188
+ let connect = (options && options.connect) ? options.connect : ({uri})=>{};
1189
+ if(_optionalChain$2([options, 'optionalAccess', _ => _.name])) { this.name = options.name; }
1190
+ if(_optionalChain$2([options, 'optionalAccess', _2 => _2.logo])) { this.logo = options.logo; }
1159
1191
  try {
1160
1192
  window.localStorage.removeItem('walletconnect'); // https://github.com/WalletConnect/walletconnect-monorepo/issues/315
1161
1193
 
1194
+ this.connector = WalletConnectV1.instance;
1195
+
1162
1196
  if(this.connector == undefined){
1163
- this.connector = this.newWalletConnectInstance();
1197
+ this.connector = this.newWalletConnectInstance(connect);
1164
1198
  }
1165
1199
 
1166
1200
  if(this.connector.connected) {
1167
1201
  await this.connector.killSession();
1168
1202
  setConnectedInstance$2(undefined);
1169
- this.connector = this.newWalletConnectInstance();
1203
+ this.connector = this.newWalletConnectInstance(connect);
1170
1204
  }
1171
1205
 
1172
- let { accounts, chainId } = await this.connector.connect({ chainId: _optionalChain$2([options, 'optionalAccess', _ => _.chainId]) });
1206
+ let { accounts, chainId } = await this.connector.connect();
1173
1207
 
1174
1208
  if(accounts instanceof Array && accounts.length) {
1175
1209
  setConnectedInstance$2(this);
@@ -1475,6 +1509,8 @@
1475
1509
  methods: [
1476
1510
  "eth_sendTransaction",
1477
1511
  "personal_sign",
1512
+ "eth_chainId",
1513
+ "wallet_switchEthereumChain",
1478
1514
  ],
1479
1515
  chains: [`${blockchain.namespace}:${blockchain.networkId}`],
1480
1516
  events: [],
@@ -1514,7 +1550,28 @@
1514
1550
 
1515
1551
  switchTo(blockchainName) {
1516
1552
  return new Promise((resolve, reject)=>{
1517
- reject({ code: 'NOT_SUPPORTED' });
1553
+ let resolved, rejected;
1554
+ const blockchain = web3Blockchains.Blockchain.findByName(blockchainName);
1555
+ setTimeout(async()=>{
1556
+ if(!(await this.connectedTo(blockchainName)) && !resolved && !rejected){
1557
+ reject({ code: 'NOT_SUPPORTED' });
1558
+ } else {
1559
+ resolve();
1560
+ }
1561
+ }, 4000);
1562
+ this.connectedBlockchain = blockchain.name;
1563
+ this.signClient.request({
1564
+ topic: this.session.topic,
1565
+ chainId: this.session.chainId,
1566
+ request:{
1567
+ method: 'wallet_switchEthereumChain',
1568
+ params: [{ chainId: blockchain.id }],
1569
+ }
1570
+ }).then((result)=>{
1571
+ console.log('RESULT ', result);
1572
+ resolved = true;
1573
+ resolve();
1574
+ });
1518
1575
  })
1519
1576
  }
1520
1577
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@depay/web3-wallets-evm",
3
3
  "moduleName": "Web3Wallets",
4
- "version": "14.2.0",
4
+ "version": "14.5.0",
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",
@@ -25,7 +25,7 @@
25
25
  "private": false,
26
26
  "dependencies": {},
27
27
  "peerDependencies": {
28
- "@depay/coinbase-wallet-sdk": "^1.1.0",
28
+ "@depay/coinbase-wallet-sdk": "^3.6.4",
29
29
  "@depay/walletconnect-v1": "^1.8.0",
30
30
  "@depay/walletconnect-v2": "^2.4.2",
31
31
  "@depay/web3-blockchains": "^6.4.0",