@depay/web3-wallets-evm 14.2.0 → 14.3.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/esm/index.js CHANGED
@@ -3,11 +3,11 @@ import { ethers } from 'ethers';
3
3
  import { CONSTANTS } from '@depay/web3-constants';
4
4
  import { PublicKey, Transaction as Transaction$1, SystemProgram } from '@depay/solana-web3.js';
5
5
  import { getProvider, request as request$1, estimate } from '@depay/web3-client';
6
- import { WalletConnectClient, QRCodeModal } from '@depay/walletconnect-v1';
6
+ import { WalletConnectClient } from '@depay/walletconnect-v1';
7
7
  import { Core, SignClient } from '@depay/walletconnect-v2';
8
8
  import { CoinbaseWalletSDK } from '@depay/coinbase-wallet-sdk';
9
9
 
10
- 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; }
10
+ 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; }
11
11
  class Transaction {
12
12
 
13
13
  constructor({ blockchain, from, to, value, api, method, params, instructions, sent, succeeded, failed }) {
@@ -18,7 +18,7 @@ class Transaction {
18
18
  this.to = (to && to.match('0x')) ? ethers.utils.getAddress(to) : to;
19
19
 
20
20
  // optional
21
- this.value = _optionalChain$h([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
21
+ this.value = _optionalChain$f([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
22
22
  this.api = api;
23
23
  this.method = method;
24
24
  this.params = params;
@@ -296,7 +296,7 @@ var EVM = {
296
296
  setProvider: setProvider$1,
297
297
  };
298
298
 
299
- 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; }
299
+ 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; }
300
300
  let getCacheStore = () => {
301
301
  if (getWindow()._cacheStore == undefined) {
302
302
  resetCache();
@@ -326,7 +326,7 @@ let set = function ({ key, value, expires }) {
326
326
 
327
327
  let get = function ({ key, expires }) {
328
328
  let cachedEntry = getCacheStore()[key];
329
- if (_optionalChain$g([cachedEntry, 'optionalAccess', _ => _.expiresAt]) > Date.now()) {
329
+ if (_optionalChain$e([cachedEntry, 'optionalAccess', _ => _.expiresAt]) > Date.now()) {
330
330
  return cachedEntry.value
331
331
  }
332
332
  };
@@ -567,7 +567,7 @@ let supported$2 = ['ethereum', 'bsc', 'polygon', 'velas'];
567
567
  supported$2.evm = ['ethereum', 'bsc', 'polygon', 'velas'];
568
568
  supported$2.solana = [];
569
569
 
570
- 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; }
570
+ 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; }
571
571
  class WindowEthereum {
572
572
 
573
573
  static __initStatic() {this.info = {
@@ -578,12 +578,12 @@ class WindowEthereum {
578
578
 
579
579
  static __initStatic2() {this.isAvailable = ()=>{
580
580
  return (
581
- _optionalChain$f([window, 'optionalAccess', _13 => _13.ethereum]) &&
581
+ _optionalChain$d([window, 'optionalAccess', _13 => _13.ethereum]) &&
582
582
  Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)/)).length != 1 && // MetaMask
583
- !_optionalChain$f([window, 'optionalAccess', _14 => _14.coin98]) && // Coin98
584
- !(_optionalChain$f([window, 'optionalAccess', _15 => _15.ethereum, 'optionalAccess', _16 => _16.isTrust]) || _optionalChain$f([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isTrustWallet])) && // Trust Wallet
585
- !_optionalChain$f([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isDeficonnectProvider]) && // crypto.com
586
- !(_optionalChain$f([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.isCoinbaseWallet]) || _optionalChain$f([window, 'optionalAccess', _23 => _23.ethereum, 'optionalAccess', _24 => _24.isWalletLink]))
583
+ !_optionalChain$d([window, 'optionalAccess', _14 => _14.coin98]) && // Coin98
584
+ !(_optionalChain$d([window, 'optionalAccess', _15 => _15.ethereum, 'optionalAccess', _16 => _16.isTrust]) || _optionalChain$d([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isTrustWallet])) && // Trust Wallet
585
+ !_optionalChain$d([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isDeficonnectProvider]) && // crypto.com
586
+ !(_optionalChain$d([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.isCoinbaseWallet]) || _optionalChain$d([window, 'optionalAccess', _23 => _23.ethereum, 'optionalAccess', _24 => _24.isWalletLink]))
587
587
  )
588
588
  };}
589
589
 
@@ -690,7 +690,7 @@ class WindowEthereum {
690
690
  }
691
691
  } WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
692
692
 
693
- 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; }
693
+ 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; }
694
694
  class Binance extends WindowEthereum {
695
695
 
696
696
  static __initStatic() {this.info = {
@@ -700,7 +700,7 @@ class Binance extends WindowEthereum {
700
700
  };}
701
701
 
702
702
  static __initStatic2() {this.isAvailable = ()=>{
703
- return _optionalChain$e([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
703
+ return _optionalChain$c([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
704
704
  !window.coin98
705
705
  };}
706
706
 
@@ -708,7 +708,7 @@ class Binance extends WindowEthereum {
708
708
 
709
709
  } Binance.__initStatic(); Binance.__initStatic2();
710
710
 
711
- 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; }
711
+ 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; }
712
712
  class Brave extends WindowEthereum {
713
713
 
714
714
  static __initStatic() {this.info = {
@@ -717,10 +717,10 @@ class Brave extends WindowEthereum {
717
717
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
718
718
  };}
719
719
 
720
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$d([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
720
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$b([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
721
721
  } Brave.__initStatic(); Brave.__initStatic2();
722
722
 
723
- 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; }
723
+ 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; }
724
724
  class Coin98 extends WindowEthereum {
725
725
 
726
726
  static __initStatic() {this.info = {
@@ -729,10 +729,10 @@ class Coin98 extends WindowEthereum {
729
729
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
730
730
  };}
731
731
 
732
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$c([window, 'optionalAccess', _2 => _2.coin98]) };}
732
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$a([window, 'optionalAccess', _2 => _2.coin98]) };}
733
733
  } Coin98.__initStatic(); Coin98.__initStatic2();
734
734
 
735
- 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; }
735
+ 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; }
736
736
  class Coinbase extends WindowEthereum {
737
737
 
738
738
  static __initStatic() {this.info = {
@@ -741,10 +741,10 @@ class Coinbase extends WindowEthereum {
741
741
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
742
742
  };}
743
743
 
744
- 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])) };}
744
+ 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])) };}
745
745
  } Coinbase.__initStatic(); Coinbase.__initStatic2();
746
746
 
747
- 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; }
747
+ 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; }
748
748
  class CryptoCom extends WindowEthereum {
749
749
 
750
750
  static __initStatic() {this.info = {
@@ -753,10 +753,10 @@ class CryptoCom extends WindowEthereum {
753
753
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
754
754
  };}
755
755
 
756
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$a([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
756
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
757
757
  } CryptoCom.__initStatic(); CryptoCom.__initStatic2();
758
758
 
759
- 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; }
759
+ 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; }
760
760
  class MetaMask extends WindowEthereum {
761
761
 
762
762
  static __initStatic() {this.info = {
@@ -766,11 +766,11 @@ class MetaMask extends WindowEthereum {
766
766
  };}
767
767
 
768
768
  static __initStatic2() {this.isAvailable = ()=>{
769
- return _optionalChain$9([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMetaMask]) && Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)/)).length == 1
769
+ return _optionalChain$7([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMetaMask]) && Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)/)).length == 1
770
770
  };}
771
771
  } MetaMask.__initStatic(); MetaMask.__initStatic2();
772
772
 
773
- 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; }
773
+ 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; }
774
774
  class Opera extends WindowEthereum {
775
775
 
776
776
  static __initStatic() {this.info = {
@@ -779,10 +779,10 @@ class Opera extends WindowEthereum {
779
779
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
780
780
  };}
781
781
 
782
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
782
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$6([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
783
783
  } Opera.__initStatic(); Opera.__initStatic2();
784
784
 
785
- 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; }
785
+ 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; }
786
786
  const POLL_SPEED = 500; // 0.5 seconds
787
787
  const MAX_POLLS = 240; // 120 seconds
788
788
 
@@ -802,14 +802,14 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
802
802
 
803
803
  const provider = await getProvider(transaction.blockchain);
804
804
  const { value } = await provider.getSignatureStatus(signature);
805
- const confirmationStatus = _optionalChain$7([value, 'optionalAccess', _ => _.confirmationStatus]);
805
+ const confirmationStatus = _optionalChain$5([value, 'optionalAccess', _ => _.confirmationStatus]);
806
806
  if(confirmationStatus) {
807
807
  const hasReachedSufficientCommitment = confirmationStatus === 'confirmed' || confirmationStatus === 'finalized';
808
808
  if (hasReachedSufficientCommitment) {
809
809
  if(value.err) {
810
810
  transaction._failed = true;
811
811
  const confirmedTransaction = await provider.getConfirmedTransaction(signature);
812
- const failedReason = _optionalChain$7([confirmedTransaction, 'optionalAccess', _2 => _2.meta, 'optionalAccess', _3 => _3.logMessages]) ? confirmedTransaction.meta.logMessages[confirmedTransaction.meta.logMessages.length - 1] : null;
812
+ const failedReason = _optionalChain$5([confirmedTransaction, 'optionalAccess', _2 => _2.meta, 'optionalAccess', _3 => _3.logMessages]) ? confirmedTransaction.meta.logMessages[confirmedTransaction.meta.logMessages.length - 1] : null;
813
813
  if(transaction.failed) transaction.failed(transaction, failedReason);
814
814
  } else {
815
815
  transaction._succeeded = true;
@@ -872,7 +872,7 @@ let supported$1 = ['ethereum', 'bsc', 'polygon', 'solana', 'velas'];
872
872
  supported$1.evm = ['ethereum', 'bsc', 'polygon', 'velas'];
873
873
  supported$1.solana = ['solana'];
874
874
 
875
- 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; }
875
+ 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; }
876
876
  class WindowSolana {
877
877
 
878
878
  static __initStatic() {this.info = {
@@ -883,8 +883,8 @@ class WindowSolana {
883
883
 
884
884
  static __initStatic2() {this.isAvailable = ()=>{
885
885
  return (
886
- _optionalChain$6([window, 'optionalAccess', _4 => _4.solana]) &&
887
- !_optionalChain$6([window, 'optionalAccess', _5 => _5.solana, 'optionalAccess', _6 => _6.isPhantom]) &&
886
+ _optionalChain$4([window, 'optionalAccess', _4 => _4.solana]) &&
887
+ !_optionalChain$4([window, 'optionalAccess', _5 => _5.solana, 'optionalAccess', _6 => _6.isPhantom]) &&
888
888
  !window.coin98
889
889
  )
890
890
  };}
@@ -902,9 +902,9 @@ class WindowSolana {
902
902
  }
903
903
 
904
904
  async account() {
905
- if(_optionalChain$6([window, 'optionalAccess', _7 => _7.solana]) == undefined){ return }
906
- if(_optionalChain$6([window, 'optionalAccess', _8 => _8.solana, 'optionalAccess', _9 => _9.publicKey])) { return window.solana.publicKey.toString() }
907
- if(_optionalChain$6([window, 'optionalAccess', _10 => _10.solana, 'optionalAccess', _11 => _11.isBraveWallet]) != true) {
905
+ if(_optionalChain$4([window, 'optionalAccess', _7 => _7.solana]) == undefined){ return }
906
+ if(_optionalChain$4([window, 'optionalAccess', _8 => _8.solana, 'optionalAccess', _9 => _9.publicKey])) { return window.solana.publicKey.toString() }
907
+ if(_optionalChain$4([window, 'optionalAccess', _10 => _10.solana, 'optionalAccess', _11 => _11.isBraveWallet]) != true) {
908
908
  let publicKey;
909
909
  try { ({ publicKey } = await window.solana.connect({ onlyIfTrusted: true })); } catch (e) {}
910
910
  if(publicKey){ return publicKey.toString() }
@@ -912,7 +912,7 @@ class WindowSolana {
912
912
  }
913
913
 
914
914
  async connect() {
915
- if(!_optionalChain$6([window, 'optionalAccess', _12 => _12.solana])) { return undefined }
915
+ if(!_optionalChain$4([window, 'optionalAccess', _12 => _12.solana])) { return undefined }
916
916
  let { publicKey } = await window.solana.connect();
917
917
  return publicKey.toString()
918
918
  }
@@ -921,7 +921,7 @@ class WindowSolana {
921
921
  let internalCallback;
922
922
  switch (event) {
923
923
  case 'account':
924
- internalCallback = (publicKey) => callback(_optionalChain$6([publicKey, 'optionalAccess', _13 => _13.toString, 'call', _14 => _14()]));
924
+ internalCallback = (publicKey) => callback(_optionalChain$4([publicKey, 'optionalAccess', _13 => _13.toString, 'call', _14 => _14()]));
925
925
  window.solana.on('accountChanged', internalCallback);
926
926
  break
927
927
  }
@@ -961,7 +961,7 @@ class WindowSolana {
961
961
  }
962
962
  } WindowSolana.__initStatic(); WindowSolana.__initStatic2();
963
963
 
964
- 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; }
964
+ 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; }
965
965
  class Phantom extends WindowSolana {
966
966
 
967
967
  static __initStatic() {this.info = {
@@ -970,10 +970,10 @@ class Phantom extends WindowSolana {
970
970
  blockchains: supported$1.solana
971
971
  };}
972
972
 
973
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$5([window, 'optionalAccess', _3 => _3.solana, 'optionalAccess', _4 => _4.isPhantom]) };}
973
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$3([window, 'optionalAccess', _3 => _3.solana, 'optionalAccess', _4 => _4.isPhantom]) };}
974
974
  } Phantom.__initStatic(); Phantom.__initStatic2();
975
975
 
976
- 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; }
976
+ 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; }
977
977
  class Trust extends WindowEthereum {
978
978
 
979
979
  static __initStatic() {this.info = {
@@ -982,10 +982,9 @@ class Trust extends WindowEthereum {
982
982
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
983
983
  };}
984
984
 
985
- 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])) };}
985
+ static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$2([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$2([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) };}
986
986
  } Trust.__initStatic(); Trust.__initStatic2();
987
987
 
988
- 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; }
989
988
  const sendTransaction$2 = async ({ transaction, wallet })=> {
990
989
  transaction = new Transaction(transaction);
991
990
  if((await wallet.connectedTo(transaction.blockchain)) == false) {
@@ -1061,30 +1060,57 @@ const submit$2 = ({ transaction, wallet }) => {
1061
1060
 
1062
1061
  const submitContractInteraction$2 = async ({ transaction, wallet })=>{
1063
1062
  const provider = await getProvider(transaction.blockchain);
1063
+ const gasPrice = await provider.getGasPrice();
1064
+ const gas = await estimate(transaction);
1065
+ const data = await transaction.getData();
1066
+ const value = transaction.value ? ethers.utils.hexlify(ethers.BigNumber.from(transaction.value)) : undefined;
1067
+ const nonce = ethers.utils.hexlify(transaction.nonce);
1068
+ console.log({
1069
+ from: transaction.from,
1070
+ to: transaction.to,
1071
+ value,
1072
+ data,
1073
+ gas: gas.toHexString(),
1074
+ gasPrice: gasPrice.toHexString(),
1075
+ nonce,
1076
+ });
1064
1077
  return wallet.connector.sendTransaction({
1065
1078
  from: transaction.from,
1066
1079
  to: transaction.to,
1067
- value: _optionalChain$3([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]),
1068
- data: await transaction.getData(),
1069
- gas: (await estimate(transaction)).toString(),
1070
- gasPrice: (await provider.getGasPrice()).toString(),
1071
- nonce: transaction.nonce,
1080
+ value,
1081
+ data,
1082
+ gas: gas.toHexString(),
1083
+ gasPrice: gasPrice.toHexString(),
1084
+ nonce,
1072
1085
  })
1073
1086
  };
1074
1087
 
1075
1088
  const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
1076
1089
  const provider = await getProvider(transaction.blockchain);
1090
+ const gasPrice = await provider.getGasPrice();
1091
+ const gas = await estimate(transaction);
1092
+ const value = ethers.utils.hexlify(ethers.BigNumber.from(transaction.value));
1093
+ const nonce = ethers.utils.hexlify(transaction.nonce);
1094
+ console.log({
1095
+ from: transaction.from,
1096
+ to: transaction.to,
1097
+ value,
1098
+ data: '0x',
1099
+ gas: gas.toHexString(),
1100
+ gasPrice: gasPrice.toHexString(),
1101
+ nonce,
1102
+ });
1077
1103
  return wallet.connector.sendTransaction({
1078
1104
  from: transaction.from,
1079
1105
  to: transaction.to,
1080
- value: _optionalChain$3([transaction, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]),
1081
- gas: (await estimate(transaction)).toString(),
1082
- gasPrice: (await provider.getGasPrice()).toString(),
1083
- nonce: transaction.nonce,
1106
+ value,
1107
+ data: '0x',
1108
+ gas: gas.toHexString(),
1109
+ gasPrice: gasPrice.toHexString(),
1110
+ nonce,
1084
1111
  })
1085
1112
  };
1086
1113
 
1087
- 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; }
1088
1114
  const KEY$1 = '_DePayWeb3WalletsConnectedWalletConnectV1Instance';
1089
1115
 
1090
1116
  const getConnectedInstance$2 = ()=>{
@@ -1111,7 +1137,6 @@ class WalletConnectV1 {
1111
1137
  this.name = this.constructor.info.name;
1112
1138
  this.logo = this.constructor.info.logo;
1113
1139
  this.blockchains = this.constructor.info.blockchains;
1114
- this.connector = WalletConnectV1.instance || this.newWalletConnectInstance();
1115
1140
  this.sendTransaction = (transaction)=>{
1116
1141
  return sendTransaction$2({
1117
1142
  wallet: this,
@@ -1120,10 +1145,13 @@ class WalletConnectV1 {
1120
1145
  };
1121
1146
  }
1122
1147
 
1123
- newWalletConnectInstance() {
1148
+ newWalletConnectInstance(connect) {
1124
1149
  let instance = new WalletConnectClient({
1125
- bridge: "https://bridge.walletconnect.org",
1126
- qrcodeModal: QRCodeModal
1150
+ bridge: "https://walletconnect.depay.com",
1151
+ qrcodeModal: {
1152
+ open: async(uri)=>connect({ uri }),
1153
+ close: ()=>{},
1154
+ }
1127
1155
  });
1128
1156
 
1129
1157
  instance.on("connect", (error, payload) => {
@@ -1159,20 +1187,23 @@ class WalletConnectV1 {
1159
1187
  }
1160
1188
 
1161
1189
  async connect(options) {
1190
+ let connect = (options && options.connect) ? options.connect : ({uri})=>{};
1162
1191
  try {
1163
1192
  window.localStorage.removeItem('walletconnect'); // https://github.com/WalletConnect/walletconnect-monorepo/issues/315
1164
1193
 
1194
+ this.connector = WalletConnectV1.instance;
1195
+
1165
1196
  if(this.connector == undefined){
1166
- this.connector = this.newWalletConnectInstance();
1197
+ this.connector = this.newWalletConnectInstance(connect);
1167
1198
  }
1168
1199
 
1169
1200
  if(this.connector.connected) {
1170
1201
  await this.connector.killSession();
1171
1202
  setConnectedInstance$2(undefined);
1172
- this.connector = this.newWalletConnectInstance();
1203
+ this.connector = this.newWalletConnectInstance(connect);
1173
1204
  }
1174
1205
 
1175
- let { accounts, chainId } = await this.connector.connect({ chainId: _optionalChain$2([options, 'optionalAccess', _ => _.chainId]) });
1206
+ let { accounts, chainId } = await this.connector.connect();
1176
1207
 
1177
1208
  if(accounts instanceof Array && accounts.length) {
1178
1209
  setConnectedInstance$2(this);
@@ -1478,6 +1509,8 @@ class WalletConnectV2 {
1478
1509
  methods: [
1479
1510
  "eth_sendTransaction",
1480
1511
  "personal_sign",
1512
+ "eth_chainId",
1513
+ "wallet_switchEthereumChain",
1481
1514
  ],
1482
1515
  chains: [`${blockchain.namespace}:${blockchain.networkId}`],
1483
1516
  events: [],
@@ -1517,7 +1550,28 @@ class WalletConnectV2 {
1517
1550
 
1518
1551
  switchTo(blockchainName) {
1519
1552
  return new Promise((resolve, reject)=>{
1520
- reject({ code: 'NOT_SUPPORTED' });
1553
+ let resolved, rejected;
1554
+ const blockchain = 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
+ });
1521
1575
  })
1522
1576
  }
1523
1577