@depay/web3-wallets-evm 14.9.2 → 15.0.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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@depay/web3-blockchains'), require('ethers'), require('@depay/web3-constants'), require('@depay/web3-client-evm'), require('@depay/walletconnect-v1'), require('@depay/walletconnect-v2'), require('@depay/coinbase-wallet-sdk')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@depay/web3-blockchains', 'ethers', '@depay/web3-constants', '@depay/web3-client-evm', '@depay/walletconnect-v1', '@depay/walletconnect-v2', '@depay/coinbase-wallet-sdk'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Web3Wallets = {}, global.Web3Blockchains, global.ethers, global.Web3Constants, global.Web3Client, global.WalletConnect, global.WalletConnectV2, global.CoinbaseWalletSdk));
5
- }(this, (function (exports, web3Blockchains, ethers, web3Constants, web3ClientEvm, walletconnectV1, walletconnectV2, coinbaseWalletSdk) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@depay/web3-blockchains'), require('ethers'), require('@depay/web3-constants'), require('@depay/web3-client-evm'), require('@depay/walletconnect-v1'), require('@depay/coinbase-wallet-sdk')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@depay/web3-blockchains', 'ethers', '@depay/web3-constants', '@depay/web3-client-evm', '@depay/walletconnect-v1', '@depay/coinbase-wallet-sdk'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Web3Wallets = {}, global.Web3Blockchains, global.ethers, global.Web3Constants, global.Web3Client, global.WalletConnect, global.CoinbaseWalletSdk));
5
+ }(this, (function (exports, web3Blockchains, ethers, web3Constants, web3ClientEvm, walletconnectV1, coinbaseWalletSdk) { 'use strict';
6
6
 
7
7
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8
8
 
@@ -59483,7 +59483,7 @@
59483
59483
  }
59484
59484
  };
59485
59485
 
59486
- 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; }
59486
+ 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; }
59487
59487
  class Transaction {
59488
59488
 
59489
59489
  constructor({ blockchain, from, to, value, api, method, params, instructions, sent, succeeded, failed }) {
@@ -59494,7 +59494,7 @@
59494
59494
  this.to = (to && to.match('0x')) ? ethers.ethers.utils.getAddress(to) : to;
59495
59495
 
59496
59496
  // optional
59497
- this.value = _optionalChain$e([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
59497
+ this.value = _optionalChain$c([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
59498
59498
  this.api = api;
59499
59499
  this.method = method;
59500
59500
  this.params = params;
@@ -59581,7 +59581,7 @@
59581
59581
  }
59582
59582
  }
59583
59583
 
59584
- const sendTransaction$4 = async ({ transaction, wallet })=> {
59584
+ const sendTransaction$3 = async ({ transaction, wallet })=> {
59585
59585
  transaction = new Transaction(transaction);
59586
59586
  if((await wallet.connectedTo(transaction.blockchain)) == false) {
59587
59587
  await wallet.switchTo(transaction.blockchain);
@@ -59594,7 +59594,7 @@
59594
59594
  transaction.nonce = transactionCount;
59595
59595
  let provider = new ethers.ethers.providers.Web3Provider(wallet.getProvider(), 'any');
59596
59596
  let signer = provider.getSigner(0);
59597
- await submit$4({ transaction, provider, signer }).then((sentTransaction)=>{
59597
+ await submit$3({ transaction, provider, signer }).then((sentTransaction)=>{
59598
59598
  if (sentTransaction) {
59599
59599
  transaction.id = sentTransaction.hash;
59600
59600
  transaction.nonce = sentTransaction.nonce || transactionCount;
@@ -59628,15 +59628,15 @@
59628
59628
  return transaction
59629
59629
  };
59630
59630
 
59631
- const submit$4 = ({ transaction, provider, signer }) => {
59631
+ const submit$3 = ({ transaction, provider, signer }) => {
59632
59632
  if(transaction.method) {
59633
- return submitContractInteraction$3({ transaction, signer, provider })
59633
+ return submitContractInteraction$2({ transaction, signer, provider })
59634
59634
  } else {
59635
- return submitSimpleTransfer$4({ transaction, signer })
59635
+ return submitSimpleTransfer$3({ transaction, signer })
59636
59636
  }
59637
59637
  };
59638
59638
 
59639
- const submitContractInteraction$3 = ({ transaction, signer, provider })=>{
59639
+ const submitContractInteraction$2 = ({ transaction, signer, provider })=>{
59640
59640
  let contract = new ethers.ethers.Contract(transaction.to, transaction.api, provider);
59641
59641
  let contractArguments = transaction.getContractArguments({ contract });
59642
59642
  let method = contract.connect(signer)[transaction.method];
@@ -59651,7 +59651,7 @@
59651
59651
  }
59652
59652
  };
59653
59653
 
59654
- const submitSimpleTransfer$4 = ({ transaction, signer })=>{
59654
+ const submitSimpleTransfer$3 = ({ transaction, signer })=>{
59655
59655
  return signer.sendTransaction({
59656
59656
  to: transaction.to,
59657
59657
  value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
@@ -59662,7 +59662,7 @@
59662
59662
  supported$2.evm = ['ethereum', 'bsc', 'polygon', 'velas'];
59663
59663
  supported$2.solana = [];
59664
59664
 
59665
- 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; }
59665
+ 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; }
59666
59666
  class WindowEthereum {
59667
59667
 
59668
59668
  static __initStatic() {this.info = {
@@ -59673,12 +59673,12 @@
59673
59673
 
59674
59674
  static __initStatic2() {this.isAvailable = ()=>{
59675
59675
  return (
59676
- _optionalChain$d([window, 'optionalAccess', _13 => _13.ethereum]) &&
59676
+ _optionalChain$b([window, 'optionalAccess', _13 => _13.ethereum]) &&
59677
59677
  Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)/)).length != 1 && // MetaMask
59678
- !_optionalChain$d([window, 'optionalAccess', _14 => _14.coin98]) && // Coin98
59679
- !(_optionalChain$d([window, 'optionalAccess', _15 => _15.ethereum, 'optionalAccess', _16 => _16.isTrust]) || _optionalChain$d([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isTrustWallet])) && // Trust Wallet
59680
- !_optionalChain$d([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isDeficonnectProvider]) && // crypto.com
59681
- !(_optionalChain$d([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.isCoinbaseWallet]) || _optionalChain$d([window, 'optionalAccess', _23 => _23.ethereum, 'optionalAccess', _24 => _24.isWalletLink]))
59678
+ !_optionalChain$b([window, 'optionalAccess', _14 => _14.coin98]) && // Coin98
59679
+ !(_optionalChain$b([window, 'optionalAccess', _15 => _15.ethereum, 'optionalAccess', _16 => _16.isTrust]) || _optionalChain$b([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isTrustWallet])) && // Trust Wallet
59680
+ !_optionalChain$b([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isDeficonnectProvider]) && // crypto.com
59681
+ !(_optionalChain$b([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.isCoinbaseWallet]) || _optionalChain$b([window, 'optionalAccess', _23 => _23.ethereum, 'optionalAccess', _24 => _24.isWalletLink]))
59682
59682
  )
59683
59683
  };}
59684
59684
 
@@ -59687,7 +59687,7 @@
59687
59687
  this.logo = this.constructor.info.logo;
59688
59688
  this.blockchains = this.constructor.info.blockchains;
59689
59689
  this.sendTransaction = (transaction)=>{
59690
- return sendTransaction$4({
59690
+ return sendTransaction$3({
59691
59691
  wallet: this,
59692
59692
  transaction
59693
59693
  })
@@ -59789,7 +59789,7 @@
59789
59789
  }
59790
59790
  } WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
59791
59791
 
59792
- 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; }
59792
+ 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; }
59793
59793
  class Binance extends WindowEthereum {
59794
59794
 
59795
59795
  static __initStatic() {this.info = {
@@ -59799,7 +59799,7 @@
59799
59799
  };}
59800
59800
 
59801
59801
  static __initStatic2() {this.isAvailable = ()=>{
59802
- return _optionalChain$c([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
59802
+ return _optionalChain$a([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
59803
59803
  !window.coin98
59804
59804
  };}
59805
59805
 
@@ -59807,7 +59807,7 @@
59807
59807
 
59808
59808
  } Binance.__initStatic(); Binance.__initStatic2();
59809
59809
 
59810
- 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; }
59810
+ 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; }
59811
59811
  class Brave extends WindowEthereum {
59812
59812
 
59813
59813
  static __initStatic() {this.info = {
@@ -59816,10 +59816,10 @@
59816
59816
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
59817
59817
  };}
59818
59818
 
59819
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$b([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
59819
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$9([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
59820
59820
  } Brave.__initStatic(); Brave.__initStatic2();
59821
59821
 
59822
- 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; }
59822
+ 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; }
59823
59823
  class Coin98 extends WindowEthereum {
59824
59824
 
59825
59825
  static __initStatic() {this.info = {
@@ -59828,10 +59828,10 @@
59828
59828
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
59829
59829
  };}
59830
59830
 
59831
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$a([window, 'optionalAccess', _2 => _2.coin98]) };}
59831
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$8([window, 'optionalAccess', _2 => _2.coin98]) };}
59832
59832
  } Coin98.__initStatic(); Coin98.__initStatic2();
59833
59833
 
59834
- 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; }
59834
+ 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; }
59835
59835
  class Coinbase extends WindowEthereum {
59836
59836
 
59837
59837
  static __initStatic() {this.info = {
@@ -59840,10 +59840,10 @@
59840
59840
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
59841
59841
  };}
59842
59842
 
59843
- static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$9([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isCoinbaseWallet]) || _optionalChain$9([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isWalletLink])) };}
59843
+ static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$7([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isCoinbaseWallet]) || _optionalChain$7([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isWalletLink])) };}
59844
59844
  } Coinbase.__initStatic(); Coinbase.__initStatic2();
59845
59845
 
59846
- 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; }
59846
+ 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; }
59847
59847
  class CryptoCom extends WindowEthereum {
59848
59848
 
59849
59849
  static __initStatic() {this.info = {
@@ -59852,10 +59852,10 @@
59852
59852
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
59853
59853
  };}
59854
59854
 
59855
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
59855
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$6([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
59856
59856
  } CryptoCom.__initStatic(); CryptoCom.__initStatic2();
59857
59857
 
59858
- 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; }
59858
+ 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; }
59859
59859
  class MetaMask extends WindowEthereum {
59860
59860
 
59861
59861
  static __initStatic() {this.info = {
@@ -59865,11 +59865,11 @@
59865
59865
  };}
59866
59866
 
59867
59867
  static __initStatic2() {this.isAvailable = ()=>{
59868
- return _optionalChain$7([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMetaMask]) && Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)/)).length == 1
59868
+ return _optionalChain$5([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMetaMask]) && Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)/)).length == 1
59869
59869
  };}
59870
59870
  } MetaMask.__initStatic(); MetaMask.__initStatic2();
59871
59871
 
59872
- 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; }
59872
+ 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; }
59873
59873
  class Opera extends WindowEthereum {
59874
59874
 
59875
59875
  static __initStatic() {this.info = {
@@ -59878,10 +59878,10 @@
59878
59878
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
59879
59879
  };}
59880
59880
 
59881
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$6([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
59881
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$4([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
59882
59882
  } Opera.__initStatic(); Opera.__initStatic2();
59883
59883
 
59884
- 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; }
59884
+ 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; }
59885
59885
  class Trust extends WindowEthereum {
59886
59886
 
59887
59887
  static __initStatic() {this.info = {
@@ -59890,7 +59890,7 @@
59890
59890
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
59891
59891
  };}
59892
59892
 
59893
- static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$5([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$5([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) };}
59893
+ 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])) };}
59894
59894
  } Trust.__initStatic(); Trust.__initStatic2();
59895
59895
 
59896
59896
  class Argent {
@@ -60005,7 +60005,7 @@
60005
60005
  }
60006
60006
  };
60007
60007
 
60008
- const sendTransaction$3 = async ({ transaction, wallet })=> {
60008
+ const sendTransaction$2 = async ({ transaction, wallet })=> {
60009
60009
  transaction = new Transaction(transaction);
60010
60010
  if((await wallet.connectedTo(transaction.blockchain)) == false) {
60011
60011
  await wallet.switchTo(transaction.blockchain);
@@ -60017,13 +60017,13 @@
60017
60017
  const smartContractWallet = await getSmartContractWallet(transaction.blockchain, transaction.from);
60018
60018
  let transactionCount = await wallet.transactionCount({ blockchain: transaction.blockchain, address: transaction.from });
60019
60019
  transaction.nonce = transactionCount;
60020
- await submit$3({ transaction, wallet }).then((tx)=>{
60020
+ await submit$2({ transaction, wallet }).then((tx)=>{
60021
60021
  if (tx) {
60022
60022
  let blockchain = web3Blockchains.Blockchain.findByName(transaction.blockchain);
60023
60023
  transaction.id = tx;
60024
60024
  transaction.url = smartContractWallet && smartContractWallet.explorerUrlFor ? smartContractWallet.explorerUrlFor({ transaction }) : blockchain.explorerUrlFor({ transaction });
60025
60025
  if (transaction.sent) transaction.sent(transaction);
60026
- retrieveTransaction$1({ blockchain: transaction.blockchain, tx, smartContractWallet }).then((sentTransaction)=>{
60026
+ retrieveTransaction({ blockchain: transaction.blockchain, tx, smartContractWallet }).then((sentTransaction)=>{
60027
60027
  transaction.id = sentTransaction.hash || transaction.id;
60028
60028
  transaction.url = blockchain.explorerUrlFor({ transaction });
60029
60029
  transaction.nonce = sentTransaction.nonce || transactionCount;
@@ -60054,7 +60054,7 @@
60054
60054
  return transaction
60055
60055
  };
60056
60056
 
60057
- const retrieveTransaction$1 = async ({ blockchain, tx, smartContractWallet })=>{
60057
+ const retrieveTransaction = async ({ blockchain, tx, smartContractWallet })=>{
60058
60058
  const provider = await getProvider(blockchain);
60059
60059
  let retrieve = async()=>{
60060
60060
  try {
@@ -60075,15 +60075,15 @@
60075
60075
  return sentTransaction
60076
60076
  };
60077
60077
 
60078
- const submit$3 = ({ transaction, wallet }) => {
60078
+ const submit$2 = ({ transaction, wallet }) => {
60079
60079
  if(transaction.method) {
60080
- return submitContractInteraction$2({ transaction, wallet })
60080
+ return submitContractInteraction$1({ transaction, wallet })
60081
60081
  } else {
60082
- return submitSimpleTransfer$3({ transaction, wallet })
60082
+ return submitSimpleTransfer$2({ transaction, wallet })
60083
60083
  }
60084
60084
  };
60085
60085
 
60086
- const submitContractInteraction$2 = async ({ transaction, wallet })=>{
60086
+ const submitContractInteraction$1 = async ({ transaction, wallet })=>{
60087
60087
  const provider = await getProvider(transaction.blockchain);
60088
60088
  const gasPrice = await provider.getGasPrice();
60089
60089
  const gas = await estimate(transaction);
@@ -60101,7 +60101,7 @@
60101
60101
  })
60102
60102
  };
60103
60103
 
60104
- const submitSimpleTransfer$3 = async ({ transaction, wallet })=>{
60104
+ const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
60105
60105
  const provider = await getProvider(transaction.blockchain);
60106
60106
  const gasPrice = await provider.getGasPrice();
60107
60107
  const gas = await estimate(transaction);
@@ -60118,15 +60118,30 @@
60118
60118
  })
60119
60119
  };
60120
60120
 
60121
- 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; }
60122
- const KEY$1 = '_DePayWeb3WalletsConnectedWalletConnectV1Instance';
60121
+ function _optionalChain$2(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; }
60122
+ const KEY = '_DePayWeb3WalletsConnectedWalletConnectV1Instance';
60123
+
60124
+ let currentPlainInstance;
60125
+
60126
+ const getPlainInstance = ()=>{
60127
+ if(currentPlainInstance) { return currentPlainInstance }
60128
+ currentPlainInstance = getWalletConnectInstance(()=>{});
60129
+ };
60123
60130
 
60124
- const getConnectedInstance$2 = ()=>{
60125
- return window[KEY$1]
60131
+ const isConnected = async()=>{
60132
+ let connector = getPlainInstance();
60133
+ let account;
60134
+ try { account = await connector.sendCustomRequest({ method: 'eth_chainId' }); } catch (e) {}
60135
+ return !!account
60126
60136
  };
60127
60137
 
60128
- const setConnectedInstance$2 = (value)=>{
60129
- window[KEY$1] = value;
60138
+ const getConnectedInstance$1 = async()=>{
60139
+ if(window[KEY]) { return window[KEY] }
60140
+ if(await isConnected()) { return new WalletConnectV1() }
60141
+ };
60142
+
60143
+ const setConnectedInstance$1 = (value)=>{
60144
+ window[KEY] = value;
60130
60145
  };
60131
60146
 
60132
60147
  const getWalletConnectInstance = (connect)=>{
@@ -60148,16 +60163,15 @@
60148
60163
  };}
60149
60164
 
60150
60165
  static __initStatic2() {this.isAvailable = ()=>{
60151
- let connector = getWalletConnectInstance(()=>{});
60152
- return getConnectedInstance$2() != undefined || connector.connected
60166
+ return getConnectedInstance$1() != undefined
60153
60167
  };}
60154
60168
 
60155
60169
  constructor() {
60156
- this.name = localStorage[KEY$1+'_name'] ? localStorage[KEY$1+'_name'] : this.constructor.info.name;
60157
- this.logo = localStorage[KEY$1+'_logo'] ? localStorage[KEY$1+'_logo'] : this.constructor.info.logo;
60170
+ this.name = (localStorage[KEY+'_name'] && localStorage[KEY+'_name'] != 'undefined') ? localStorage[KEY+'_name'] : this.constructor.info.name;
60171
+ this.logo = (localStorage[KEY+'_logo'] && localStorage[KEY+'_logo'] != 'undefined') ? localStorage[KEY+'_logo'] : this.constructor.info.logo;
60158
60172
  this.blockchains = this.constructor.info.blockchains;
60159
60173
  this.sendTransaction = (transaction)=>{
60160
- return sendTransaction$3({
60174
+ return sendTransaction$2({
60161
60175
  wallet: this,
60162
60176
  transaction
60163
60177
  })
@@ -60182,14 +60196,14 @@
60182
60196
  });
60183
60197
 
60184
60198
  instance.on("disconnect", (error, payload) => {
60185
- setConnectedInstance$2(undefined);
60186
- localStorage[KEY$1+'_name'] = undefined;
60187
- localStorage[KEY$1+'_logo'] = undefined;
60199
+ setConnectedInstance$1(undefined);
60200
+ localStorage[KEY+'_name'] = undefined;
60201
+ localStorage[KEY+'_logo'] = undefined;
60188
60202
  if (error) { throw error }
60189
60203
  });
60190
60204
 
60191
60205
  instance.on("modal_closed", ()=>{
60192
- setConnectedInstance$2(undefined);
60206
+ setConnectedInstance$1(undefined);
60193
60207
  this.connector = undefined;
60194
60208
  });
60195
60209
 
@@ -60222,11 +60236,11 @@
60222
60236
 
60223
60237
  let { accounts, chainId } = await this.connector.connect();
60224
60238
 
60225
- if(_optionalChain$4([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$1+'_name'] = this.name = options.name; }
60226
- if(_optionalChain$4([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$1+'_logo'] = this.logo = options.logo; }
60239
+ if(_optionalChain$2([options, 'optionalAccess', _ => _.name])) { localStorage[KEY+'_name'] = this.name = options.name; }
60240
+ if(_optionalChain$2([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY+'_logo'] = this.logo = options.logo; }
60227
60241
 
60228
60242
  if(accounts instanceof Array && accounts.length) {
60229
- setConnectedInstance$2(this);
60243
+ setConnectedInstance$1(this);
60230
60244
  accounts = accounts.map((account)=>ethers.ethers.utils.getAddress(account));
60231
60245
  this.connectedChainId = chainId;
60232
60246
 
@@ -60350,298 +60364,8 @@
60350
60364
  }
60351
60365
  } WalletConnectV1.__initStatic(); WalletConnectV1.__initStatic2();
60352
60366
 
60353
- WalletConnectV1.getConnectedInstance = getConnectedInstance$2;
60354
- WalletConnectV1.setConnectedInstance = setConnectedInstance$2;
60355
-
60356
- 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; }
60357
- const sendTransaction$2 = async ({ transaction, wallet })=> {
60358
- transaction = new Transaction(transaction);
60359
- if((await wallet.connectedTo(transaction.blockchain)) == false) {
60360
- await wallet.switchTo(transaction.blockchain);
60361
- }
60362
- if((await wallet.connectedTo(transaction.blockchain)) == false) {
60363
- throw({ code: 'WRONG_NETWORK' })
60364
- }
60365
- await transaction.prepare({ wallet });
60366
- let transactionCount = await request$1({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
60367
- transaction.nonce = transactionCount;
60368
- await submit$2({ transaction, wallet }).then(async (response)=>{
60369
- if(typeof response == 'string') {
60370
- let blockchain = web3Blockchains.Blockchain.findByName(transaction.blockchain);
60371
- transaction.id = response;
60372
- transaction.url = blockchain.explorerUrlFor({ transaction });
60373
- if (transaction.sent) transaction.sent(transaction);
60374
- let sentTransaction = await retrieveTransaction(transaction.id, transaction.blockchain);
60375
- transaction.nonce = sentTransaction.nonce || transactionCount;
60376
- if(!sentTransaction) {
60377
- transaction._failed = true;
60378
- console.log('Error retrieving transaction');
60379
- if(transaction.failed) transaction.failed(transaction, 'Error retrieving transaction');
60380
- } else {
60381
- sentTransaction.wait(1).then(() => {
60382
- transaction._succeeded = true;
60383
- if (transaction.succeeded) transaction.succeeded(transaction);
60384
- }).catch((error)=>{
60385
- if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
60386
- if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
60387
- transaction.id = error.replacement.hash;
60388
- transaction._succeeded = true;
60389
- if (transaction.succeeded) transaction.succeeded(transaction);
60390
- } else if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 0) {
60391
- transaction.id = error.replacement.hash;
60392
- transaction._failed = true;
60393
- if(transaction.failed) transaction.failed(transaction, error);
60394
- }
60395
- } else {
60396
- transaction._failed = true;
60397
- if(transaction.failed) transaction.failed(transaction, error);
60398
- }
60399
- });
60400
- }
60401
- } else {
60402
- throw(response)
60403
- }
60404
- });
60405
- return transaction
60406
- };
60407
-
60408
- const retrieveTransaction = async (tx, blockchain)=>{
60409
- let sentTransaction;
60410
- const provider = await getProvider(blockchain);
60411
- sentTransaction = await provider.getTransaction(tx);
60412
- const maxRetries = 120;
60413
- let attempt = 1;
60414
- while (attempt <= maxRetries && !sentTransaction) {
60415
- sentTransaction = await provider.getTransaction(tx);
60416
- await (new Promise((resolve)=>setTimeout(resolve, 5000)));
60417
- attempt++;
60418
- }
60419
- return sentTransaction
60420
- };
60421
-
60422
- const submit$2 = ({ transaction, wallet }) => {
60423
- if(transaction.method) {
60424
- return submitContractInteraction$1({ transaction, wallet })
60425
- } else {
60426
- return submitSimpleTransfer$2({ transaction, wallet })
60427
- }
60428
- };
60429
-
60430
- const submitContractInteraction$1 = async ({ transaction, wallet })=>{
60431
- const provider = await getProvider(transaction.blockchain);
60432
- return wallet.signClient.request({
60433
- topic: wallet.session.topic,
60434
- chainId: wallet.session.chainId,
60435
- request: {
60436
- method: 'eth_sendTransaction',
60437
- params: [{
60438
- from: transaction.from,
60439
- to: transaction.to,
60440
- value: _optionalChain$3([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]),
60441
- data: await transaction.getData(),
60442
- gas: (await estimate(transaction)).toString(),
60443
- gasPrice: (await provider.getGasPrice()).toString(),
60444
- nonce: transaction.nonce,
60445
- }]
60446
- }
60447
- })
60448
- };
60449
-
60450
- const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
60451
- const provider = await getProvider(transaction.blockchain);
60452
- let blockchain = web3Blockchains.Blockchain.findByName(transaction.blockchain);
60453
- return wallet.signClient.request({
60454
- topic: wallet.session.topic,
60455
- chainId: wallet.session.chainId,
60456
- request: {
60457
- method: 'eth_sendTransaction',
60458
- params: [{
60459
- chainId: blockchain.id,
60460
- from: transaction.from,
60461
- to: transaction.to,
60462
- value: _optionalChain$3([transaction, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]),
60463
- gas: (await estimate(transaction)).toString(),
60464
- gasPrice: (await provider.getGasPrice()).toString(),
60465
- nonce: transaction.nonce
60466
- }]
60467
- }
60468
- }).catch((e)=>{console.log('ERROR', e);})
60469
- };
60470
-
60471
- function _optionalChain$2(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; }
60472
- const KEY = '_DePayWeb3WalletsConnectedWalletConnectV2Instance';
60473
-
60474
- const getConnectedInstance$1 = ()=>{
60475
- return window[KEY]
60476
- };
60477
-
60478
- const setConnectedInstance$1 = (value)=>{
60479
- window[KEY] = value;
60480
- };
60481
-
60482
- class WalletConnectV2 {
60483
-
60484
- static __initStatic() {this.info = {
60485
- name: 'WalletConnect',
60486
- logo: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0ndXRmLTgnPz48IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMjUuNC4xLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAtLT48c3ZnIHZlcnNpb249JzEuMScgaWQ9J0xheWVyXzEnIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZycgeG1sbnM6eGxpbms9J2h0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsnIHg9JzBweCcgeT0nMHB4JyB2aWV3Qm94PScwIDAgNTAwIDUwMCcgc3R5bGU9J2VuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTAwIDUwMDsnIHhtbDpzcGFjZT0ncHJlc2VydmUnPjxzdHlsZSB0eXBlPSd0ZXh0L2Nzcyc+IC5zdDB7ZmlsbDojNTk5MUNEO30KPC9zdHlsZT48ZyBpZD0nUGFnZS0xJz48ZyBpZD0nd2FsbGV0Y29ubmVjdC1sb2dvLWFsdCc+PHBhdGggaWQ9J1dhbGxldENvbm5lY3QnIGNsYXNzPSdzdDAnIGQ9J00xMDIuNywxNjJjODEuNS03OS44LDIxMy42LTc5LjgsMjk1LjEsMGw5LjgsOS42YzQuMSw0LDQuMSwxMC41LDAsMTQuNEwzNzQsMjE4LjkgYy0yLDItNS4zLDItNy40LDBsLTEzLjUtMTMuMmMtNTYuOC01NS43LTE0OS01NS43LTIwNS44LDBsLTE0LjUsMTQuMWMtMiwyLTUuMywyLTcuNCwwTDkxLjksMTg3Yy00LjEtNC00LjEtMTAuNSwwLTE0LjQgTDEwMi43LDE2MnogTTQ2Ny4xLDIyOS45bDI5LjksMjkuMmM0LjEsNCw0LjEsMTAuNSwwLDE0LjRMMzYyLjMsNDA1LjRjLTQuMSw0LTEwLjcsNC0xNC44LDBjMCwwLDAsMCwwLDBMMjUyLDMxMS45IGMtMS0xLTIuNy0xLTMuNywwaDBsLTk1LjUsOTMuNWMtNC4xLDQtMTAuNyw0LTE0LjgsMGMwLDAsMCwwLDAsMEwzLjQsMjczLjZjLTQuMS00LTQuMS0xMC41LDAtMTQuNGwyOS45LTI5LjIgYzQuMS00LDEwLjctNCwxNC44LDBsOTUuNSw5My41YzEsMSwyLjcsMSwzLjcsMGMwLDAsMCwwLDAsMGw5NS41LTkzLjVjNC4xLTQsMTAuNy00LDE0LjgsMGMwLDAsMCwwLDAsMGw5NS41LDkzLjUgYzEsMSwyLjcsMSwzLjcsMGw5NS41LTkzLjVDNDU2LjQsMjI1LjksNDYzLDIyNS45LDQ2Ny4xLDIyOS45eicvPjwvZz48L2c+PC9zdmc+Cg==",
60487
- blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
60488
- };}
60489
-
60490
- static __initStatic2() {this.isAvailable = ()=>{
60491
- return getConnectedInstance$1() != undefined
60492
- };}
60493
-
60494
- constructor() {
60495
- this.name = this.constructor.info.name;
60496
- this.logo = this.constructor.info.logo;
60497
- this.blockchains = this.constructor.info.blockchains;
60498
- this.connector = WalletConnect.instance || this.newWalletConnectInstance();
60499
- WalletConnect.instance = this.connector;
60500
- this.sendTransaction = (transaction)=>{
60501
- return sendTransaction$2({
60502
- wallet: this,
60503
- transaction
60504
- })
60505
- };
60506
- }
60507
-
60508
- newWalletConnectInstance() {
60509
- return new walletconnectV2.Core({ projectId: window._walletConnectProjectId })
60510
- }
60511
-
60512
- async account() {
60513
- if(this.connectedAccount == undefined) { return }
60514
- return this.connectedAccount
60515
- }
60516
-
60517
- async connect({ connect, blockchain }) {
60518
-
60519
- if(!connect || typeof connect != 'function') { throw('Provided connect paremeters is not present or not a function!') }
60520
-
60521
- try {
60522
-
60523
- delete localStorage[`wc@2:core:${this.connector.pairing.version}//subscription`]; // DO NOT RECOVER AN OTHER SUBSCRIPTION!!!
60524
- this.signClient = await walletconnectV2.SignClient.init({ core: this.connector });
60525
-
60526
- this.signClient.on("session_delete", () => {
60527
- console.log('WALLETCONNECT DISCONNECT');
60528
- this.connector = undefined;
60529
- WalletConnect.instance = undefined;
60530
- this.connectedAccount = undefined;
60531
- this.signClient = undefined;
60532
- this.session = undefined;
60533
- });
60534
-
60535
- blockchain = web3Blockchains.Blockchain.findByName(blockchain);
60536
-
60537
- let namespaces = {};
60538
-
60539
- namespaces[blockchain.namespace] = {
60540
- methods: [
60541
- "eth_sendTransaction",
60542
- "personal_sign",
60543
- "eth_chainId",
60544
- "wallet_switchEthereumChain",
60545
- ],
60546
- chains: [`${blockchain.namespace}:${blockchain.networkId}`],
60547
- events: [],
60548
- };
60549
-
60550
- const { uri, approval } = await this.signClient.connect({ requiredNamespaces: namespaces });
60551
-
60552
- await connect({ uri });
60553
- this.session = await approval();
60554
- this.session.chainId = `${blockchain.namespace}:${blockchain.networkId}`;
60555
-
60556
- let meta = _optionalChain$2([this, 'access', _ => _.session, 'optionalAccess', _2 => _2.peer, 'optionalAccess', _3 => _3.metadata]);
60557
- if(meta && meta.name) {
60558
- this.name = meta.name;
60559
- if(_optionalChain$2([meta, 'optionalAccess', _4 => _4.icons]) && meta.icons.length) { this.logo = meta.icons[0]; }
60560
- }
60561
-
60562
- const account = Object.values(this.session.namespaces)[0].accounts[0].split(":")[2];
60563
- this.connectedAccount = account;
60564
- this.connectedBlockchain = blockchain.name;
60565
-
60566
- return account
60567
-
60568
- } catch (error) {
60569
- console.log('WALLETCONNECT ERROR', error);
60570
- }
60571
- }
60572
-
60573
- async connectedTo(input) {
60574
- if(input) {
60575
- return input === this.connectedBlockchain
60576
- } else {
60577
- const blockchain = web3Blockchains.Blockchain.findByName(this.connectedBlockchain);
60578
- return blockchain.name
60579
- }
60580
- }
60581
-
60582
- switchTo(blockchainName) {
60583
- return new Promise((resolve, reject)=>{
60584
- let resolved, rejected;
60585
- const blockchain = web3Blockchains.Blockchain.findByName(blockchainName);
60586
- setTimeout(async()=>{
60587
- if(!(await this.connectedTo(blockchainName)) && !resolved && !rejected){
60588
- reject({ code: 'NOT_SUPPORTED' });
60589
- } else {
60590
- resolve();
60591
- }
60592
- }, 4000);
60593
- this.connectedBlockchain = blockchain.name;
60594
- this.signClient.request({
60595
- topic: this.session.topic,
60596
- chainId: this.session.chainId,
60597
- request:{
60598
- method: 'wallet_switchEthereumChain',
60599
- params: [{ chainId: blockchain.id }],
60600
- }
60601
- }).then((result)=>{
60602
- console.log('RESULT ', result);
60603
- resolved = true;
60604
- resolve();
60605
- });
60606
- })
60607
- }
60608
-
60609
- addNetwork(blockchainName) {
60610
- return new Promise((resolve, reject)=>{
60611
- reject({ code: 'NOT_SUPPORTED' });
60612
- })
60613
- }
60614
-
60615
- on(event, callback) {
60616
- // currently not supported
60617
- }
60618
-
60619
- off(event, callback) {
60620
- // currently not supported
60621
- }
60622
-
60623
- async sign(message) {
60624
- let address = await this.account();
60625
- var params = [ethers.ethers.utils.hexlify(ethers.ethers.utils.toUtf8Bytes(message)), address];
60626
- let signature = await this.signClient.request({
60627
- topic: this.session.topic,
60628
- chainId: this.session.chainId,
60629
- request:{
60630
- id: 1,
60631
- jsonrpc: '2.0',
60632
- method: 'personal_sign',
60633
- params
60634
- }
60635
- });
60636
- if(typeof signature == 'object') {
60637
- signature = ethers.ethers.utils.hexlify(signature);
60638
- }
60639
- return signature
60640
- }
60641
- } WalletConnectV2.__initStatic(); WalletConnectV2.__initStatic2();
60642
-
60643
- WalletConnectV2.getConnectedInstance = getConnectedInstance$1;
60644
- WalletConnectV2.setConnectedInstance = setConnectedInstance$1;
60367
+ WalletConnectV1.getConnectedInstance = getConnectedInstance$1;
60368
+ WalletConnectV1.setConnectedInstance = setConnectedInstance$1;
60645
60369
 
60646
60370
  const sendTransaction$1 = async ({ transaction, wallet })=> {
60647
60371
  transaction = new Transaction(transaction);
@@ -61048,40 +60772,32 @@
61048
60772
  WindowEthereum,
61049
60773
  WindowSolana,
61050
60774
  WalletConnectV1,
61051
- WalletConnectV2,
61052
60775
  WalletLink
61053
60776
  };
61054
60777
 
61055
- const getWallets = ()=>{
61056
- let availableWallets = [];
60778
+ const getWallets = async()=>{
61057
60779
 
61058
- Object.keys(wallets).forEach((key)=>{
61059
- let wallet = wallets[key];
61060
- if(wallet.isAvailable()) {
61061
- let instance;
61062
- if(wallet.getConnectedInstance && wallet.getConnectedInstance()) {
61063
- instance = wallet.getConnectedInstance();
61064
- } else {
61065
- instance = new wallet;
61066
- }
61067
- availableWallets.push(instance);
61068
- }
61069
- });
61070
-
61071
- return availableWallets
61072
- };
61073
-
61074
- const getConnectedWallets = async()=>{
61075
-
61076
- let connectedWallets = (await Promise.all(
61077
- getWallets().map(async(wallet)=>{
61078
- if(await wallet.account()) {
61079
- return wallet
60780
+ let availableWallets = await Promise.all(
60781
+ Object.keys(wallets).map(
60782
+ async(key)=>{
60783
+
60784
+ let wallet = wallets[key];
60785
+
60786
+ if(wallet.isAvailable()) {
60787
+ let instance;
60788
+
60789
+ if(wallet.getConnectedInstance) {
60790
+ instance = await wallet.getConnectedInstance();
60791
+ return instance
60792
+ } else {
60793
+ return new wallet
60794
+ }
60795
+ }
61080
60796
  }
61081
- })
61082
- )).filter((value)=>!!value);
60797
+ )
60798
+ );
61083
60799
 
61084
- return connectedWallets
60800
+ return availableWallets.filter((wallet)=>wallet)
61085
60801
  };
61086
60802
 
61087
60803
  const supported = [
@@ -61094,11 +60810,9 @@
61094
60810
  wallets.Coin98,
61095
60811
  wallets.CryptoCom,
61096
60812
  wallets.WalletConnectV1,
61097
- wallets.WalletConnectV2,
61098
60813
  wallets.WalletLink
61099
60814
  ];
61100
60815
 
61101
- exports.getConnectedWallets = getConnectedWallets;
61102
60816
  exports.getWallets = getWallets;
61103
60817
  exports.supported = supported;
61104
60818
  exports.wallets = wallets;