@depay/web3-wallets-evm 15.16.3 → 16.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -3,10 +3,10 @@ import Blockchains from '@depay/web3-blockchains';
3
3
  import { PublicKey, SystemProgram, TransactionMessage, VersionedTransaction, transact } from '@depay/solana-web3.js';
4
4
  import { ethers } from 'ethers';
5
5
  import { WalletConnectClient } from '@depay/walletconnect-v1';
6
- import { SignClient, Core } from '@depay/walletconnect-v2';
6
+ import { SignClient } from '@depay/walletconnect-v2';
7
7
  import { CoinbaseWalletSDK } from '@depay/coinbase-wallet-sdk';
8
8
 
9
- function _optionalChain$k(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; }
9
+ function _optionalChain$l(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
10
  class Transaction {
11
11
 
12
12
  constructor({
@@ -31,7 +31,7 @@ class Transaction {
31
31
  this.to = (to && to.match('0x')) ? ethers.utils.getAddress(to) : to;
32
32
 
33
33
  // optional
34
- this.value = _optionalChain$k([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
34
+ this.value = _optionalChain$l([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
35
35
  this.api = api;
36
36
  this.method = method;
37
37
  this.params = params;
@@ -136,7 +136,7 @@ class Transaction {
136
136
  }
137
137
  }
138
138
 
139
- function _optionalChain$j(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; }
139
+ function _optionalChain$k(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; }
140
140
 
141
141
  const POLL_SPEED = 500; // 0.5 seconds
142
142
  const MAX_POLLS = 240; // 120 seconds
@@ -157,14 +157,14 @@ const sendTransaction$4 = async ({ transaction, wallet })=> {
157
157
 
158
158
  const provider = await getProvider(transaction.blockchain);
159
159
  const { value } = await provider.getSignatureStatus(signature);
160
- const confirmationStatus = _optionalChain$j([value, 'optionalAccess', _ => _.confirmationStatus]);
160
+ const confirmationStatus = _optionalChain$k([value, 'optionalAccess', _ => _.confirmationStatus]);
161
161
  if(confirmationStatus) {
162
162
  const hasReachedSufficientCommitment = confirmationStatus === 'confirmed' || confirmationStatus === 'finalized';
163
163
  if (hasReachedSufficientCommitment) {
164
164
  if(value.err) {
165
165
  transaction._failed = true;
166
166
  const confirmedTransaction = await provider.getConfirmedTransaction(signature);
167
- const failedReason = _optionalChain$j([confirmedTransaction, 'optionalAccess', _2 => _2.meta, 'optionalAccess', _3 => _3.logMessages]) ? confirmedTransaction.meta.logMessages[confirmedTransaction.meta.logMessages.length - 1] : null;
167
+ const failedReason = _optionalChain$k([confirmedTransaction, 'optionalAccess', _2 => _2.meta, 'optionalAccess', _3 => _3.logMessages]) ? confirmedTransaction.meta.logMessages[confirmedTransaction.meta.logMessages.length - 1] : null;
168
168
  if(transaction.failed) transaction.failed(transaction, failedReason);
169
169
  } else {
170
170
  transaction._succeeded = true;
@@ -255,7 +255,7 @@ let supported$1 = ['ethereum', 'bsc', 'polygon', 'solana', 'fantom', 'arbitrum',
255
255
  supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism'];
256
256
  supported$1.solana = ['solana'];
257
257
 
258
- function _optionalChain$i(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; }
258
+ function _optionalChain$j(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; }
259
259
  class WindowSolana {
260
260
 
261
261
  static __initStatic() {this.info = {
@@ -266,7 +266,7 @@ class WindowSolana {
266
266
 
267
267
  static __initStatic2() {this.isAvailable = async()=>{
268
268
  return (
269
- _optionalChain$i([window, 'optionalAccess', _2 => _2.solana]) &&
269
+ _optionalChain$j([window, 'optionalAccess', _2 => _2.solana]) &&
270
270
  !(window.phantom && !window.glow && !window.solana.isGlow) &&
271
271
  !window.coin98 &&
272
272
  !window.solana.isGlow
@@ -316,7 +316,7 @@ class WindowSolana {
316
316
  let internalCallback;
317
317
  switch (event) {
318
318
  case 'account':
319
- internalCallback = (publicKey) => callback(_optionalChain$i([publicKey, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]));
319
+ internalCallback = (publicKey) => callback(_optionalChain$j([publicKey, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]));
320
320
  this.getProvider().on('accountChanged', internalCallback);
321
321
  break
322
322
  }
@@ -369,7 +369,7 @@ class WindowSolana {
369
369
  }
370
370
  } WindowSolana.__initStatic(); WindowSolana.__initStatic2();
371
371
 
372
- 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; }
372
+ function _optionalChain$i(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; }
373
373
  class Backpack extends WindowSolana {
374
374
 
375
375
  static __initStatic() {this.info = {
@@ -380,7 +380,7 @@ class Backpack extends WindowSolana {
380
380
 
381
381
  static __initStatic2() {this.isAvailable = async()=>{
382
382
  return (
383
- _optionalChain$h([window, 'optionalAccess', _2 => _2.backpack]) &&
383
+ _optionalChain$i([window, 'optionalAccess', _2 => _2.backpack]) &&
384
384
  window.backpack.isBackpack
385
385
  )
386
386
  };}
@@ -475,7 +475,7 @@ const submitSimpleTransfer$3 = ({ transaction, signer })=>{
475
475
  })
476
476
  };
477
477
 
478
- 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; }
478
+ 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; }
479
479
  class WindowEthereum {
480
480
 
481
481
  static __initStatic() {this.info = {
@@ -486,17 +486,17 @@ class WindowEthereum {
486
486
 
487
487
  static __initStatic2() {this.isAvailable = async()=>{
488
488
  return (
489
- _optionalChain$g([window, 'optionalAccess', _23 => _23.ethereum]) &&
489
+ _optionalChain$h([window, 'optionalAccess', _23 => _23.ethereum]) &&
490
490
  Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length != 1 && // MetaMask
491
- !_optionalChain$g([window, 'optionalAccess', _24 => _24.coin98]) && // Coin98
492
- !(_optionalChain$g([window, 'optionalAccess', _25 => _25.ethereum, 'optionalAccess', _26 => _26.isTrust]) || _optionalChain$g([window, 'optionalAccess', _27 => _27.ethereum, 'optionalAccess', _28 => _28.isTrustWallet])) && // Trust Wallet
493
- !_optionalChain$g([window, 'optionalAccess', _29 => _29.ethereum, 'optionalAccess', _30 => _30.isDeficonnectProvider]) && // crypto.com
494
- !_optionalChain$g([window, 'optionalAccess', _31 => _31.ethereum, 'optionalAccess', _32 => _32.isHyperPay]) && // isHyperPay
495
- !_optionalChain$g([window, 'optionalAccess', _33 => _33.ethereum, 'optionalAccess', _34 => _34.isPhantom]) && // Phantom
496
- !_optionalChain$g([window, 'optionalAccess', _35 => _35.solana, 'optionalAccess', _36 => _36.isPhantom]) && // Phantom
497
- !_optionalChain$g([window, 'optionalAccess', _37 => _37.ethereum, 'optionalAccess', _38 => _38.isRabby]) && // Rabby
498
- !_optionalChain$g([window, 'optionalAccess', _39 => _39.backpack, 'optionalAccess', _40 => _40.isBackpack]) && // Backpack
499
- !(_optionalChain$g([window, 'optionalAccess', _41 => _41.ethereum, 'optionalAccess', _42 => _42.isCoinbaseWallet]) || _optionalChain$g([window, 'optionalAccess', _43 => _43.ethereum, 'optionalAccess', _44 => _44.isWalletLink]))
491
+ !_optionalChain$h([window, 'optionalAccess', _24 => _24.coin98]) && // Coin98
492
+ !(_optionalChain$h([window, 'optionalAccess', _25 => _25.ethereum, 'optionalAccess', _26 => _26.isTrust]) || _optionalChain$h([window, 'optionalAccess', _27 => _27.ethereum, 'optionalAccess', _28 => _28.isTrustWallet])) && // Trust Wallet
493
+ !_optionalChain$h([window, 'optionalAccess', _29 => _29.ethereum, 'optionalAccess', _30 => _30.isDeficonnectProvider]) && // crypto.com
494
+ !_optionalChain$h([window, 'optionalAccess', _31 => _31.ethereum, 'optionalAccess', _32 => _32.isHyperPay]) && // isHyperPay
495
+ !_optionalChain$h([window, 'optionalAccess', _33 => _33.ethereum, 'optionalAccess', _34 => _34.isPhantom]) && // Phantom
496
+ !_optionalChain$h([window, 'optionalAccess', _35 => _35.solana, 'optionalAccess', _36 => _36.isPhantom]) && // Phantom
497
+ !_optionalChain$h([window, 'optionalAccess', _37 => _37.ethereum, 'optionalAccess', _38 => _38.isRabby]) && // Rabby
498
+ !_optionalChain$h([window, 'optionalAccess', _39 => _39.backpack, 'optionalAccess', _40 => _40.isBackpack]) && // Backpack
499
+ !(_optionalChain$h([window, 'optionalAccess', _41 => _41.ethereum, 'optionalAccess', _42 => _42.isCoinbaseWallet]) || _optionalChain$h([window, 'optionalAccess', _43 => _43.ethereum, 'optionalAccess', _44 => _44.isWalletLink]))
500
500
  )
501
501
  };}
502
502
 
@@ -622,7 +622,7 @@ class WindowEthereum {
622
622
  }
623
623
  } WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
624
624
 
625
- 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; }
625
+ 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; }
626
626
  class Binance extends WindowEthereum {
627
627
 
628
628
  static __initStatic() {this.info = {
@@ -632,7 +632,7 @@ class Binance extends WindowEthereum {
632
632
  };}
633
633
 
634
634
  static __initStatic2() {this.isAvailable = async()=>{
635
- return _optionalChain$f([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
635
+ return _optionalChain$g([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
636
636
  !window.coin98
637
637
  };}
638
638
 
@@ -640,7 +640,7 @@ class Binance extends WindowEthereum {
640
640
 
641
641
  } Binance.__initStatic(); Binance.__initStatic2();
642
642
 
643
- 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; }
643
+ 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; }
644
644
  class Brave extends WindowEthereum {
645
645
 
646
646
  static __initStatic() {this.info = {
@@ -649,10 +649,10 @@ class Brave extends WindowEthereum {
649
649
  blockchains: supported$1.evm
650
650
  };}
651
651
 
652
- static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$e([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
652
+ static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$f([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
653
653
  } Brave.__initStatic(); Brave.__initStatic2();
654
654
 
655
- 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; }
655
+ 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; }
656
656
  class Coin98 extends WindowEthereum {
657
657
 
658
658
  static __initStatic() {this.info = {
@@ -661,10 +661,10 @@ class Coin98 extends WindowEthereum {
661
661
  blockchains: supported$1.evm
662
662
  };}
663
663
 
664
- static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$d([window, 'optionalAccess', _2 => _2.coin98]) };}
664
+ static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$e([window, 'optionalAccess', _2 => _2.coin98]) };}
665
665
  } Coin98.__initStatic(); Coin98.__initStatic2();
666
666
 
667
- 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; }
667
+ 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; }
668
668
  class Coinbase extends WindowEthereum {
669
669
 
670
670
  static __initStatic() {this.info = {
@@ -673,10 +673,10 @@ class Coinbase extends WindowEthereum {
673
673
  blockchains: supported$1.evm
674
674
  };}
675
675
 
676
- static __initStatic2() {this.isAvailable = async()=>{ return (_optionalChain$c([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isCoinbaseWallet]) || _optionalChain$c([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isWalletLink])) };}
676
+ static __initStatic2() {this.isAvailable = async()=>{ return (_optionalChain$d([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isCoinbaseWallet]) || _optionalChain$d([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isWalletLink])) };}
677
677
  } Coinbase.__initStatic(); Coinbase.__initStatic2();
678
678
 
679
- 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; }
679
+ 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; }
680
680
  class CryptoCom extends WindowEthereum {
681
681
 
682
682
  static __initStatic() {this.info = {
@@ -685,7 +685,7 @@ class CryptoCom extends WindowEthereum {
685
685
  blockchains: supported$1.evm
686
686
  };}
687
687
 
688
- static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$b([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
688
+ static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$c([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
689
689
  } CryptoCom.__initStatic(); CryptoCom.__initStatic2();
690
690
 
691
691
  class Glow extends WindowSolana {
@@ -704,7 +704,7 @@ class Glow extends WindowSolana {
704
704
  };}
705
705
  } Glow.__initStatic(); Glow.__initStatic2();
706
706
 
707
- 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; }
707
+ 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; }
708
708
  class HyperPay extends WindowEthereum {
709
709
 
710
710
  static __initStatic() {this.info = {
@@ -713,10 +713,10 @@ class HyperPay extends WindowEthereum {
713
713
  blockchains: supported$1.evm
714
714
  };}
715
715
 
716
- static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$a([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isHyperPay]) };}
716
+ static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$b([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isHyperPay]) };}
717
717
  } HyperPay.__initStatic(); HyperPay.__initStatic2();
718
718
 
719
- 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; }
719
+ 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; }
720
720
  class MetaMask extends WindowEthereum {
721
721
 
722
722
  static __initStatic() {this.info = {
@@ -727,13 +727,13 @@ class MetaMask extends WindowEthereum {
727
727
 
728
728
  static __initStatic2() {this.isAvailable = async()=>{
729
729
  return(
730
- _optionalChain$9([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMetaMask]) &&
730
+ _optionalChain$a([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMetaMask]) &&
731
731
  Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length == 1
732
732
  )
733
733
  };}
734
734
  } MetaMask.__initStatic(); MetaMask.__initStatic2();
735
735
 
736
- 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; }
736
+ 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; }
737
737
  class Opera extends WindowEthereum {
738
738
 
739
739
  static __initStatic() {this.info = {
@@ -742,7 +742,7 @@ class Opera extends WindowEthereum {
742
742
  blockchains: supported$1.evm
743
743
  };}
744
744
 
745
- static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
745
+ static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$9([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
746
746
  } Opera.__initStatic(); Opera.__initStatic2();
747
747
 
748
748
  class Phantom extends WindowSolana {
@@ -760,7 +760,7 @@ class Phantom extends WindowSolana {
760
760
  };}
761
761
  } Phantom.__initStatic(); Phantom.__initStatic2();
762
762
 
763
- 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; }
763
+ 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; }
764
764
  class Rabby extends WindowEthereum {
765
765
 
766
766
  static __initStatic() {this.info = {
@@ -771,12 +771,12 @@ class Rabby extends WindowEthereum {
771
771
 
772
772
  static __initStatic2() {this.isAvailable = async()=>{
773
773
  return(
774
- _optionalChain$7([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isRabby])
774
+ _optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isRabby])
775
775
  )
776
776
  };}
777
777
  } Rabby.__initStatic(); Rabby.__initStatic2();
778
778
 
779
- 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; }
779
+ 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; }
780
780
 
781
781
 
782
782
  const KEY$2 = '_DePayWeb3WalletsConnectedSolanaMobileWalletInstance';
@@ -867,8 +867,8 @@ class SolanaMobileWalletAdapter {
867
867
  await transact(
868
868
  async (wallet) => {
869
869
  await this.authorize(wallet);
870
- if(_optionalChain$6([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$2+'_name'] = this.name = options.name; }
871
- if(_optionalChain$6([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$2+'_logo'] = this.logo = options.logo; }
870
+ if(_optionalChain$7([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$2+'_name'] = this.name = options.name; }
871
+ if(_optionalChain$7([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$2+'_logo'] = this.logo = options.logo; }
872
872
  }
873
873
  );
874
874
  return this._account
@@ -927,7 +927,7 @@ class SolanaMobileWalletAdapter {
927
927
  }
928
928
  } SolanaMobileWalletAdapter.__initStatic(); SolanaMobileWalletAdapter.__initStatic2();
929
929
 
930
- 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; }
930
+ 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; }
931
931
  class Solflare extends WindowSolana {
932
932
 
933
933
  static __initStatic() {this.info = {
@@ -938,7 +938,7 @@ class Solflare extends WindowSolana {
938
938
 
939
939
  static __initStatic2() {this.isAvailable = async()=>{
940
940
  return (
941
- _optionalChain$5([window, 'optionalAccess', _2 => _2.solflare]) &&
941
+ _optionalChain$6([window, 'optionalAccess', _2 => _2.solflare]) &&
942
942
  window.solflare.isSolflare
943
943
  )
944
944
  };}
@@ -948,7 +948,7 @@ class Solflare extends WindowSolana {
948
948
  _sendTransaction(transaction) { return this.getProvider().signTransaction(transaction) }
949
949
  } Solflare.__initStatic(); Solflare.__initStatic2();
950
950
 
951
- 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; }
951
+ 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; }
952
952
  class Trust extends WindowEthereum {
953
953
 
954
954
  static __initStatic() {this.info = {
@@ -957,7 +957,7 @@ class Trust extends WindowEthereum {
957
957
  blockchains: supported$1.evm
958
958
  };}
959
959
 
960
- static __initStatic2() {this.isAvailable = async()=>{ return (_optionalChain$4([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$4([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) };}
960
+ static __initStatic2() {this.isAvailable = async()=>{ return (_optionalChain$5([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$5([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) };}
961
961
  } Trust.__initStatic(); Trust.__initStatic2();
962
962
 
963
963
  const transactionApiBlockchainNames = {
@@ -1049,7 +1049,7 @@ const getSmartContractWallet = async(blockchain, address)=> {
1049
1049
  }
1050
1050
  };
1051
1051
 
1052
- 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; }
1052
+ 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; }
1053
1053
 
1054
1054
  const sendTransaction$2 = async ({ transaction, wallet })=> {
1055
1055
  transaction = new Transaction(transaction);
@@ -1129,7 +1129,7 @@ const submit$2 = ({ transaction, wallet }) => {
1129
1129
  const submitContractInteraction$2 = async ({ transaction, wallet })=>{
1130
1130
  const provider = await getProvider(transaction.blockchain);
1131
1131
  let gasPrice = await provider.getGasPrice();
1132
- if(_optionalChain$3([wallet, 'access', _ => _.session, 'optionalAccess', _2 => _2.peerMeta, 'optionalAccess', _3 => _3.name]) === 'Uniswap Wallet') {
1132
+ if(_optionalChain$4([wallet, 'access', _ => _.session, 'optionalAccess', _2 => _2.peerMeta, 'optionalAccess', _3 => _3.name]) === 'Uniswap Wallet') {
1133
1133
  gasPrice = undefined;
1134
1134
  } else {
1135
1135
  gasPrice = gasPrice.toHexString();
@@ -1153,7 +1153,7 @@ const submitContractInteraction$2 = async ({ transaction, wallet })=>{
1153
1153
  const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
1154
1154
  const provider = await getProvider(transaction.blockchain);
1155
1155
  let gasPrice = await provider.getGasPrice();
1156
- if(_optionalChain$3([wallet, 'access', _4 => _4.session, 'optionalAccess', _5 => _5.peerMeta, 'optionalAccess', _6 => _6.name]) === 'Uniswap Wallet') {
1156
+ if(_optionalChain$4([wallet, 'access', _4 => _4.session, 'optionalAccess', _5 => _5.peerMeta, 'optionalAccess', _6 => _6.name]) === 'Uniswap Wallet') {
1157
1157
  gasPrice = undefined;
1158
1158
  } else {
1159
1159
  gasPrice = gasPrice.toHexString();
@@ -1172,7 +1172,7 @@ const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
1172
1172
  })
1173
1173
  };
1174
1174
 
1175
- 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; }
1175
+ 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; }
1176
1176
 
1177
1177
  const KEY$1 = '_DePayWeb3WalletsConnectedWalletConnectV1Instance';
1178
1178
 
@@ -1221,7 +1221,7 @@ const getConnectedInstance$2 = async()=>{
1221
1221
  if(await isConnected()) { return new WalletConnectV1() }
1222
1222
  };
1223
1223
 
1224
- const setConnectedInstance$2 = (value)=>{
1224
+ const setConnectedInstance$1 = (value)=>{
1225
1225
  window[KEY$1] = value;
1226
1226
  };
1227
1227
 
@@ -1260,7 +1260,7 @@ class WalletConnectV1 {
1260
1260
  }
1261
1261
 
1262
1262
  disconnect() {
1263
- setConnectedInstance$2(undefined);
1263
+ setConnectedInstance$1(undefined);
1264
1264
  localStorage[KEY$1+'_name'] = undefined;
1265
1265
  localStorage[KEY$1+'_logo'] = undefined;
1266
1266
  currentPlainInstance = undefined;
@@ -1276,7 +1276,7 @@ class WalletConnectV1 {
1276
1276
  });
1277
1277
 
1278
1278
  instance.on("modal_closed", ()=>{
1279
- setConnectedInstance$2(undefined);
1279
+ setConnectedInstance$1(undefined);
1280
1280
  this.connector = undefined;
1281
1281
  this.session = undefined;
1282
1282
  });
@@ -1315,11 +1315,11 @@ class WalletConnectV1 {
1315
1315
  let session = await this.connector.connect();
1316
1316
  this.session = session;
1317
1317
 
1318
- if(_optionalChain$2([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$1+'_name'] = this.name = options.name; }
1319
- if(_optionalChain$2([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$1+'_logo'] = this.logo = options.logo; }
1318
+ if(_optionalChain$3([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$1+'_name'] = this.name = options.name; }
1319
+ if(_optionalChain$3([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$1+'_logo'] = this.logo = options.logo; }
1320
1320
 
1321
1321
  if(session.accounts instanceof Array && session.accounts.length) {
1322
- setConnectedInstance$2(this);
1322
+ setConnectedInstance$1(this);
1323
1323
  return ethers.utils.getAddress(session.accounts[0])
1324
1324
  } else {
1325
1325
  return
@@ -1458,9 +1458,9 @@ class WalletConnectV1 {
1458
1458
  } WalletConnectV1.__initStatic(); WalletConnectV1.__initStatic2();
1459
1459
 
1460
1460
  WalletConnectV1.getConnectedInstance = getConnectedInstance$2;
1461
- WalletConnectV1.setConnectedInstance = setConnectedInstance$2;
1461
+ WalletConnectV1.setConnectedInstance = setConnectedInstance$1;
1462
1462
 
1463
- function _optionalChain$1(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; }
1463
+ 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; }
1464
1464
  const sendTransaction$1 = async ({ transaction, wallet })=> {
1465
1465
  transaction = new Transaction(transaction);
1466
1466
  if((await wallet.connectedTo(transaction.blockchain)) == false) {
@@ -1544,14 +1544,14 @@ const submitContractInteraction$1 = async ({ transaction, wallet })=>{
1544
1544
  params: [{
1545
1545
  from: transaction.from,
1546
1546
  to: transaction.to,
1547
- value: _optionalChain$1([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]),
1547
+ value: _optionalChain$2([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]),
1548
1548
  data: await transaction.getData(),
1549
1549
  gas: gas.toHexString(),
1550
1550
  gasPrice: gasPrice.toHexString(),
1551
1551
  nonce: transaction.nonce,
1552
1552
  }]
1553
1553
  }
1554
- })
1554
+ }).catch((e)=>{console.log('ERROR', e);})
1555
1555
  };
1556
1556
 
1557
1557
  const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
@@ -1567,7 +1567,7 @@ const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
1567
1567
  params: [{
1568
1568
  from: transaction.from,
1569
1569
  to: transaction.to,
1570
- value: _optionalChain$1([transaction, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]),
1570
+ value: _optionalChain$2([transaction, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]),
1571
1571
  gas: gas.toHexString(),
1572
1572
  gasPrice: gasPrice.toHexString(),
1573
1573
  nonce: transaction.nonce
@@ -1576,76 +1576,106 @@ const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
1576
1576
  }).catch((e)=>{console.log('ERROR', e);})
1577
1577
  };
1578
1578
 
1579
- function _optionalChain(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; }
1579
+ function _optionalChain$1(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; }
1580
1580
  const KEY = 'depay:wallets:wc2';
1581
1581
 
1582
- const getLastSession = async()=>{
1583
- if(!localStorage[KEY+":projectId"]) { return }
1584
- let signClient = await getSignClient();
1585
- const existingSessions = signClient.find(getWalletConnectV2Config());
1586
- const lastSession = existingSessions ? existingSessions[existingSessions.length-1] : undefined;
1587
- if(lastSession && lastSession.expiry > Math.ceil(Date.now()/1000)) {
1588
- try {
1589
- if(await getConnectedChainId(signClient, lastSession)) {
1590
- return lastSession
1582
+ // configurations for wallets that require special handling
1583
+ const CONFIGURATIONS = {
1584
+
1585
+ "MetaMask": {
1586
+ methods: [
1587
+ "eth_sendTransaction",
1588
+ "personal_sign",
1589
+ "eth_chainId", // only add eth_chainId if you do not trust the wallet provided chainIds!
1590
+ "eth_signTypedData",
1591
+ "eth_signTypedData_v4",
1592
+ "wallet_switchEthereumChain"
1593
+ ]
1594
+ },
1595
+
1596
+ "Uniswap Wallet": {
1597
+ methods: [
1598
+ "eth_sendTransaction",
1599
+ "personal_sign",
1600
+ "eth_signTypedData",
1601
+ "eth_signTypedData_v4",
1602
+ ],
1603
+ requiredNamespaces: {
1604
+ eip155: {
1605
+ chains: ['ethereum', 'polygon', 'arbitrum', 'optimism'].map((blockchainName)=>`eip155:${Blockchains[blockchainName].networkId}`)
1591
1606
  }
1592
- } catch (e) {}
1593
- }
1607
+ },
1608
+ optionalNamespaces: {},
1609
+ },
1610
+
1611
+ "Enjin Wallet": {
1612
+ methods: [
1613
+ "eth_sendTransaction",
1614
+ "personal_sign",
1615
+ "eth_signTypedData",
1616
+ ]
1617
+ },
1618
+
1594
1619
  };
1595
1620
 
1596
- const getConnectedChainId = async(signClient, session)=>{
1597
- let results = (await Promise.all(session.namespaces.eip155.chains.map((identifier)=>{
1598
- return Promise.race([
1599
- new Promise((resolve)=>{setTimeout(resolve, 1500);}),
1600
- signClient.request({
1601
- topic: session.topic,
1602
- chainId: identifier,
1603
- request: {
1604
- method: 'eth_chainId'
1605
- }
1606
- })
1607
- ])
1608
- })));
1609
- return results.filter(Boolean)[0]
1621
+ const DEFAULT_CONFIGURATION = {
1622
+ events: ['accountsChanged'],
1623
+ methods: [
1624
+ "eth_sendTransaction",
1625
+ "personal_sign",
1626
+ "eth_signTypedData",
1627
+ "eth_signTypedData_v4",
1628
+ ]
1610
1629
  };
1611
1630
 
1612
1631
  const getConnectedInstance$1 = async()=>{
1613
- if(localStorage[KEY+":projectId"]) {
1614
- const lastSession = await getLastSession();
1615
- if(lastSession) {
1616
- return new WalletConnectV2()
1632
+ if(await WalletConnectV2.isAvailable()) { return new WalletConnectV2() }
1633
+ };
1634
+
1635
+ const getLastSession = async(walletName)=>{
1636
+ if(!localStorage[KEY+":projectId"]) { return }
1637
+ if(walletName !== localStorage[KEY+":lastSessionWalletName"]) { return }
1638
+ let signClient = await getSignClient();
1639
+ const existingSessions = signClient.find(getWalletConnectV2Config(walletName));
1640
+ const lastSession = existingSessions ? existingSessions[existingSessions.length-1] : undefined;
1641
+ if(lastSession && localStorage[KEY+":lastExpiredSessionTopic"] !== lastSession.topic && lastSession.expiry > Math.ceil(Date.now()/1000)) {
1642
+ const result = await Promise.race([signClient.ping({ topic: lastSession.topic }), new Promise((resolve)=>setTimeout(resolve, 1500))]);
1643
+ if(result) {
1644
+ return lastSession
1645
+ } else {
1646
+ localStorage[KEY+":lastExpiredSessionTopic"] = lastSession.topic;
1647
+ return
1617
1648
  }
1618
1649
  }
1619
1650
  };
1620
1651
 
1621
- const setConnectedInstance$1 = (value)=>{
1622
- };
1623
-
1624
- const getWalletConnectV2Config = ()=>{
1625
- const methods = [
1626
- "eth_sendTransaction",
1627
- "personal_sign",
1628
- "eth_signTypedData_v4",
1629
- "eth_chainId",
1630
- "eth_accounts",
1631
- "wallet_switchEthereumChain",
1632
- ];
1633
-
1634
- const events = ['accountsChanged'];
1652
+ const getWalletConnectV2Config = (walletName)=>{
1653
+ const methods = _optionalChain$1([CONFIGURATIONS, 'access', _ => _[walletName], 'optionalAccess', _2 => _2.methods]) || DEFAULT_CONFIGURATION.methods;
1654
+ const events = _optionalChain$1([CONFIGURATIONS, 'access', _3 => _3[walletName], 'optionalAccess', _4 => _4.events]) || DEFAULT_CONFIGURATION.events;
1635
1655
 
1636
1656
  let requiredNamespaces = {};
1637
- requiredNamespaces['eip155'] = {
1638
- methods,
1639
- events,
1640
- chains: [`eip155:1`],
1641
- };
1657
+ if(_optionalChain$1([CONFIGURATIONS, 'access', _5 => _5[walletName], 'optionalAccess', _6 => _6.requiredNamespaces])) {
1658
+ requiredNamespaces = CONFIGURATIONS[walletName].requiredNamespaces;
1659
+ } else {
1660
+ requiredNamespaces['eip155'] = {
1661
+ chains: [`eip155:1`],
1662
+ };
1663
+ }
1664
+ requiredNamespaces['eip155'].methods = methods;
1665
+ requiredNamespaces['eip155'].events = events;
1642
1666
 
1643
1667
  let optionalNamespaces = {};
1644
- optionalNamespaces['eip155'] = {
1645
- methods,
1646
- events,
1647
- chains: supported$1.evm.map((blockchain)=>`${Blockchains[blockchain].namespace}:${Blockchains[blockchain].networkId}`),
1648
- };
1668
+ if(_optionalChain$1([CONFIGURATIONS, 'access', _7 => _7[walletName], 'optionalAccess', _8 => _8.optionalNamespaces])) {
1669
+ optionalNamespaces = CONFIGURATIONS[walletName].optionalNamespaces;
1670
+ } else {
1671
+ optionalNamespaces['eip155'] = {
1672
+ chains: supported$1.evm.map((blockchain)=>`${Blockchains[blockchain].namespace}:${Blockchains[blockchain].networkId}`),
1673
+ };
1674
+ }
1675
+ if(_optionalChain$1([optionalNamespaces, 'optionalAccess', _9 => _9.eip155]) && _optionalChain$1([optionalNamespaces, 'optionalAccess', _10 => _10.eip155, 'optionalAccess', _11 => _11.chains, 'optionalAccess', _12 => _12.length])) {
1676
+ optionalNamespaces['eip155'].methods = methods;
1677
+ optionalNamespaces['eip155'].events = events;
1678
+ }
1649
1679
 
1650
1680
  return { requiredNamespaces, optionalNamespaces }
1651
1681
  };
@@ -1654,18 +1684,18 @@ const getSignClient = ()=>{
1654
1684
  if(window.getSignClientPromise) { return window.getSignClientPromise }
1655
1685
  window.getSignClientPromise = new Promise(async(resolve)=>{
1656
1686
  const signClient = await SignClient.init({
1657
- core: new Core({ projectId: localStorage[KEY+":projectId"] }),
1687
+ projectId: localStorage[KEY+":projectId"],
1658
1688
  metadata: {
1659
1689
  name: document.title || 'dApp',
1660
- description: _optionalChain([document, 'access', _ => _.querySelector, 'call', _2 => _2('meta[name="description"]'), 'optionalAccess', _3 => _3.getAttribute, 'call', _4 => _4('content')]) || document.title || 'dApp',
1690
+ description: _optionalChain$1([document, 'access', _13 => _13.querySelector, 'call', _14 => _14('meta[name="description"]'), 'optionalAccess', _15 => _15.getAttribute, 'call', _16 => _16('content')]) || document.title || 'dApp',
1661
1691
  url: location.href,
1662
- icons: [_optionalChain([document, 'access', _5 => _5.querySelector, 'call', _6 => _6("link[rel~='icon'], link[rel~='shortcut icon']"), 'optionalAccess', _7 => _7.href]) || `${location.origin}/favicon.ico`]
1692
+ icons: [_optionalChain$1([document, 'access', _17 => _17.querySelector, 'call', _18 => _18("link[rel~='icon'], link[rel~='shortcut icon']"), 'optionalAccess', _19 => _19.href]) || `${location.origin}/favicon.ico`]
1663
1693
  }
1664
1694
  });
1665
1695
  resolve(signClient);
1666
1696
  });
1667
1697
 
1668
- return window.getSignClientPromise
1698
+ return window.getSignClientPromise
1669
1699
  };
1670
1700
 
1671
1701
  class WalletConnectV2 {
@@ -1676,14 +1706,13 @@ class WalletConnectV2 {
1676
1706
  blockchains: supported$1.evm
1677
1707
  };}
1678
1708
 
1679
- static __initStatic2() {this.isAvailable = ()=>{
1680
- return getConnectedInstance$1() != undefined
1709
+ static __initStatic2() {this.isAvailable = async(options)=>{
1710
+ return !! await getLastSession(_optionalChain$1([options, 'optionalAccess', _21 => _21.walletName]))
1681
1711
  };}
1682
1712
 
1683
1713
  constructor() {
1684
1714
  this.name = (localStorage[KEY+':name'] && localStorage[KEY+':name'] != undefined) ? localStorage[KEY+':name'] : this.constructor.info.name;
1685
1715
  this.logo = (localStorage[KEY+':logo'] && localStorage[KEY+':logo'] != undefined) ? localStorage[KEY+':logo'] : this.constructor.info.logo;
1686
- this.blockchains = this.constructor.info.blockchains;
1687
1716
  this.sendTransaction = (transaction)=>{
1688
1717
  return sendTransaction$1({
1689
1718
  wallet: this,
@@ -1693,17 +1722,57 @@ class WalletConnectV2 {
1693
1722
  }
1694
1723
 
1695
1724
  async account() {
1696
- const connectedChainId = await getConnectedChainId(this.signClient, this.session);
1697
- const connectedBlockchain = Blockchains.findById(connectedChainId);
1698
- const accounts = await this.signClient.request({
1699
- topic: this.session.topic,
1700
- chainId: `${connectedBlockchain.namespace}:${connectedBlockchain.networkId}`,
1701
- request:{
1702
- method: 'eth_accounts',
1703
- params: [{ chainId: connectedBlockchain.id }],
1704
- }
1705
- });
1706
- return accounts ? accounts[0] : undefined
1725
+ if(_optionalChain$1([this, 'access', _22 => _22.session, 'optionalAccess', _23 => _23.namespaces, 'optionalAccess', _24 => _24.eip155, 'optionalAccess', _25 => _25.accounts, 'optionalAccess', _26 => _26.length])) {
1726
+ return this.session.namespaces.eip155.accounts[0].split(':')[2]
1727
+ }
1728
+ }
1729
+
1730
+ async getAllAvailableBlockchains() {
1731
+ let timeTillResponse = new Date();
1732
+ await Promise.race([...
1733
+ this.session.namespaces.eip155.chains.map((chainIdentifier)=>{
1734
+ return new Promise((resolve)=>{
1735
+ try {
1736
+ this.signClient.request({
1737
+ topic: this.session.topic,
1738
+ chainId: chainIdentifier,
1739
+ request:{
1740
+ method: 'eth_chainId',
1741
+ }
1742
+ }).then(resolve);
1743
+ } catch (e) {}
1744
+ })
1745
+ }),
1746
+ new Promise(resolve=>setTimeout(resolve, 6000))
1747
+ ]);
1748
+ timeTillResponse = new Date() - timeTillResponse;
1749
+
1750
+ let blockchains = [];
1751
+ await Promise.race([
1752
+ Promise.all(this.session.namespaces.eip155.chains.map((chainIdentifier)=>{
1753
+ try {
1754
+ return this.signClient.request({
1755
+ topic: this.session.topic,
1756
+ chainId: chainIdentifier,
1757
+ request:{
1758
+ method: 'eth_chainId',
1759
+ }
1760
+ }).then(()=> blockchains.push(Blockchains.findByNetworkId(chainIdentifier.split(':')[1]).name))
1761
+ } catch (e2) {}
1762
+ })),
1763
+ new Promise(resolve => setTimeout(resolve, timeTillResponse*2))
1764
+ ]);
1765
+ return blockchains
1766
+ }
1767
+
1768
+ async setSessionBlockchains() {
1769
+ if(_optionalChain$1([CONFIGURATIONS, 'access', _27 => _27[this.walletName], 'optionalAccess', _28 => _28.methods, 'optionalAccess', _29 => _29.includes, 'call', _30 => _30('eth_chainId')])) {
1770
+ this.blockchains = await this.getAllAvailableBlockchains();
1771
+ } else if(this.session.namespaces.eip155.chains) {
1772
+ this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$1([Blockchains, 'access', _31 => _31.findByNetworkId, 'call', _32 => _32(chainIdentifier.split(':')[1]), 'optionalAccess', _33 => _33.name])).filter(Boolean);
1773
+ } else if(this.session.namespaces.eip155.accounts) {
1774
+ this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$1([Blockchains, 'access', _34 => _34.findByNetworkId, 'call', _35 => _35(accountIdentifier.split(':')[1]), 'optionalAccess', _36 => _36.name])).filter(Boolean);
1775
+ }
1707
1776
  }
1708
1777
 
1709
1778
  async connect(options) {
@@ -1712,65 +1781,59 @@ class WalletConnectV2 {
1712
1781
 
1713
1782
  try {
1714
1783
 
1715
- // delete localStorage[`wc@2:client:0.3//session`] // DO NOT RECOVER AN OTHER SUBSCRIPTION!!!
1784
+ this.walletName = _optionalChain$1([options, 'optionalAccess', _37 => _37.name]);
1785
+
1786
+ // delete localStorage[`wc@2:client:0.3//session`] // DELETE WC SESSIONS
1716
1787
  this.signClient = await getSignClient();
1717
1788
 
1718
1789
  this.signClient.on("session_delete", (session)=> {
1719
- if(_optionalChain([session, 'optionalAccess', _8 => _8.topic]) === _optionalChain([this, 'access', _9 => _9.session, 'optionalAccess', _10 => _10.topic])) {
1790
+ if(_optionalChain$1([session, 'optionalAccess', _38 => _38.topic]) === _optionalChain$1([this, 'access', _39 => _39.session, 'optionalAccess', _40 => _40.topic])) {
1720
1791
  localStorage[KEY+':name'] = undefined;
1721
1792
  localStorage[KEY+':logo'] = undefined;
1722
- WalletConnect.instance = undefined;
1723
1793
  this.signClient = undefined;
1724
1794
  this.session = undefined;
1725
1795
  }
1726
1796
  });
1727
1797
 
1728
1798
  this.signClient.on("session_update", async(session)=> {
1729
- if(_optionalChain([session, 'optionalAccess', _11 => _11.topic]) === _optionalChain([this, 'access', _12 => _12.session, 'optionalAccess', _13 => _13.topic])) {
1799
+ if(_optionalChain$1([session, 'optionalAccess', _41 => _41.topic]) === _optionalChain$1([this, 'access', _42 => _42.session, 'optionalAccess', _43 => _43.topic])) {
1730
1800
  this.session = this.signClient.session.get(session.topic);
1801
+ await this.setSessionBlockchains();
1731
1802
  }
1732
1803
  });
1733
1804
 
1734
1805
  this.signClient.on("session_event", (event)=> {
1735
- if(_optionalChain([event, 'optionalAccess', _14 => _14.topic]) === _optionalChain([this, 'access', _15 => _15.session, 'optionalAccess', _16 => _16.topic])) {
1736
- }
1806
+ if(_optionalChain$1([event, 'optionalAccess', _44 => _44.topic]) === _optionalChain$1([this, 'access', _45 => _45.session, 'optionalAccess', _46 => _46.topic])) {}
1737
1807
  });
1738
1808
 
1739
- const lastSession = await getLastSession();
1740
- if(lastSession) {
1741
- this.session = lastSession;
1742
- }
1743
-
1744
1809
  const connectWallet = async()=>{
1745
- const { uri, approval } = await this.signClient.connect(getWalletConnectV2Config());
1810
+ const { uri, approval } = await this.signClient.connect(getWalletConnectV2Config(this.walletName));
1746
1811
  await connect({ uri });
1747
1812
  this.session = await approval();
1813
+ localStorage[KEY+":lastSessionWalletName"] = this.walletName;
1814
+ await new Promise(resolve=>setTimeout(resolve, 500)); // to prevent race condition within WalletConnect
1748
1815
  };
1749
1816
 
1750
- if(!this.session){ await connectWallet(); }
1817
+ const lastSession = _optionalChain$1([this, 'optionalAccess', _47 => _47.walletName, 'optionalAccess', _48 => _48.length]) ? await getLastSession(this.walletName) : undefined;
1818
+ if(lastSession) {
1819
+ this.session = lastSession;
1820
+ } else {
1821
+ await connectWallet();
1822
+ }
1751
1823
 
1752
- let meta = _optionalChain([this, 'access', _17 => _17.session, 'optionalAccess', _18 => _18.peer, 'optionalAccess', _19 => _19.metadata]);
1824
+ let meta = _optionalChain$1([this, 'access', _49 => _49.session, 'optionalAccess', _50 => _50.peer, 'optionalAccess', _51 => _51.metadata]);
1753
1825
  if(meta && meta.name) {
1754
1826
  this.name = meta.name;
1755
1827
  localStorage[KEY+':name'] = meta.name;
1756
- if(_optionalChain([meta, 'optionalAccess', _20 => _20.icons]) && meta.icons.length) {
1828
+ if(_optionalChain$1([meta, 'optionalAccess', _52 => _52.icons]) && meta.icons.length) {
1757
1829
  this.logo = meta.icons[0];
1758
1830
  localStorage[KEY+':logo'] = this.logo;
1759
1831
  }
1760
1832
  }
1761
- if(_optionalChain([options, 'optionalAccess', _21 => _21.name])) { localStorage[KEY+':name'] = this.name = options.name; }
1762
- if(_optionalChain([options, 'optionalAccess', _22 => _22.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
1763
-
1764
- let connectedChainId;
1765
- for(var i = 0; i<3; i++) {
1766
- await new Promise((resolve)=>{setTimeout(resolve, 500);});
1767
- connectedChainId = await getConnectedChainId(this.signClient, this.session);
1768
- if(connectedChainId){ break }
1769
- }
1770
-
1771
- if(!connectedChainId) { await connectWallet(); }
1833
+ if(_optionalChain$1([options, 'optionalAccess', _53 => _53.name])) { localStorage[KEY+':name'] = this.name = options.name; }
1834
+ if(_optionalChain$1([options, 'optionalAccess', _54 => _54.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
1772
1835
 
1773
- let connectedBlockchain = Blockchains.findById(connectedChainId);
1836
+ await this.setSessionBlockchains();
1774
1837
 
1775
1838
  return await this.account()
1776
1839
 
@@ -1780,42 +1843,37 @@ class WalletConnectV2 {
1780
1843
  }
1781
1844
 
1782
1845
  async connectedTo(input) {
1783
- let chainId = await getConnectedChainId(this.signClient, this.session);
1784
- if(!chainId) { return false }
1785
- const blockchain = Blockchains.findById(chainId);
1786
- if(!blockchain) { return false }
1787
1846
  if(input) {
1788
- return input === blockchain.name
1847
+ return this.blockchains.indexOf(input) > -1
1789
1848
  } else {
1790
- return blockchain.name
1849
+ return this.blockchains
1791
1850
  }
1792
1851
  }
1793
1852
 
1853
+ getValidChainId() {
1854
+ return `eip155:${Blockchains[this.blockchains[0]].networkId}`
1855
+ }
1856
+
1794
1857
  switchTo(blockchainName) {
1795
1858
  return new Promise((resolve, reject)=>{
1796
- let resolved, rejected;
1859
+
1797
1860
  const blockchain = Blockchains[blockchainName];
1798
- setTimeout(async()=>{
1799
- if(!(await this.connectedTo(blockchainName)) && !resolved && !rejected){
1800
- reject({ code: 'NOT_SUPPORTED' });
1801
- } else {
1802
- this.connectedChainId = `${blockchain.namespace}:${blockchain.networkId}`;
1803
- resolve();
1804
- }
1805
- }, 4000);
1806
- this.session.namespaces.eip155.chains.map((identifier)=>{
1807
- return Promise.race([
1808
- new Promise((resolve)=>{setTimeout(resolve, 1500);}),
1809
- this.signClient.request({
1810
- topic: this.session.topic,
1811
- chainId: identifier,
1812
- request:{
1813
- method: 'wallet_switchEthereumChain',
1814
- params: [{ chainId: blockchain.id }],
1815
- }
1816
- })
1817
- ])
1818
- });
1861
+
1862
+ Promise.race([
1863
+ this.signClient.request({
1864
+ topic: this.session.topic,
1865
+ chainId: this.getValidChainId(),
1866
+ request:{
1867
+ method: 'wallet_switchEthereumChain',
1868
+ params: [{ chainId: blockchain.id }],
1869
+ }
1870
+ }),
1871
+ new Promise((resolve, reject)=>setTimeout(()=>{
1872
+ if(this.blockchains.indexOf(blockchainName) === -1) {
1873
+ reject({ code: 'NOT_SUPPORTED' });
1874
+ }
1875
+ } , 8000))
1876
+ ]).catch(reject);
1819
1877
  })
1820
1878
  }
1821
1879
 
@@ -1830,7 +1888,7 @@ class WalletConnectV2 {
1830
1888
  switch (event) {
1831
1889
  case 'account':
1832
1890
  internalCallback = async(event)=> {
1833
- if(_optionalChain([event, 'optionalAccess', _23 => _23.topic]) === _optionalChain([this, 'access', _24 => _24.session, 'optionalAccess', _25 => _25.topic]) && event.params.event.name === 'accountsChanged') {
1891
+ if(_optionalChain$1([event, 'optionalAccess', _55 => _55.topic]) === _optionalChain$1([this, 'access', _56 => _56.session, 'optionalAccess', _57 => _57.topic]) && event.params.event.name === 'accountsChanged') {
1834
1892
  callback(await this.account());
1835
1893
  }
1836
1894
  };
@@ -1851,13 +1909,9 @@ class WalletConnectV2 {
1851
1909
  async sign(message) {
1852
1910
  if(typeof message === 'object') {
1853
1911
  let account = await this.account();
1854
- const blockchain = Blockchains.findByNetworkId(message.domain.chainId);
1855
- if((await this.connectedTo(blockchain.name)) === false) {
1856
- throw({ code: 'WRONG_NETWORK' })
1857
- }
1858
1912
  let signature = await this.signClient.request({
1859
1913
  topic: this.session.topic,
1860
- chainId: `${blockchain.namespace}:${blockchain.networkId}`,
1914
+ chainId: this.getValidChainId(),
1861
1915
  request:{
1862
1916
  method: 'eth_signTypedData_v4',
1863
1917
  params: [account, JSON.stringify(message)],
@@ -1867,11 +1921,9 @@ class WalletConnectV2 {
1867
1921
  } else if (typeof message === 'string') {
1868
1922
  const address = await this.account();
1869
1923
  const params = [ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)), address];
1870
- const connectedChainId = await getConnectedChainId(this.signClient, this.session);
1871
- const blockchain = Blockchains.findById(connectedChainId);
1872
1924
  let signature = await this.signClient.request({
1873
1925
  topic: this.session.topic,
1874
- chainId: `${blockchain.namespace}:${blockchain.networkId}`,
1926
+ chainId: this.getValidChainId(),
1875
1927
  request:{
1876
1928
  method: 'personal_sign',
1877
1929
  params
@@ -1886,7 +1938,6 @@ class WalletConnectV2 {
1886
1938
  } WalletConnectV2.__initStatic(); WalletConnectV2.__initStatic2();
1887
1939
 
1888
1940
  WalletConnectV2.getConnectedInstance = getConnectedInstance$1;
1889
- WalletConnectV2.setConnectedInstance = setConnectedInstance$1;
1890
1941
 
1891
1942
  const sendTransaction = async ({ transaction, wallet })=> {
1892
1943
  transaction = new Transaction(transaction);
@@ -1963,6 +2014,7 @@ const submitSimpleTransfer = ({ transaction, signer })=>{
1963
2014
  })
1964
2015
  };
1965
2016
 
2017
+ function _optionalChain(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; }
1966
2018
  const getConnectedInstance = ()=>{
1967
2019
  return window._connectedWalletLinkInstance
1968
2020
  };
@@ -2005,8 +2057,20 @@ class WalletLink {
2005
2057
  }
2006
2058
 
2007
2059
  async connect(options) {
2060
+ let connect = (options && options.connect) ? options.connect : ({uri})=>{};
2061
+
2062
+ await connect({ uri: this.connector.qrUrl });
2063
+
2064
+ _optionalChain([document, 'access', _ => _.querySelector, 'call', _2 => _2('.-cbwsdk-extension-dialog-container'), 'optionalAccess', _3 => _3.setAttribute, 'call', _4 => _4('style', 'display: none;')]);
2065
+ setTimeout(()=>{
2066
+ if(_optionalChain([this, 'optionalAccess', _5 => _5.connector, 'optionalAccess', _6 => _6._relay, 'optionalAccess', _7 => _7.ui, 'optionalAccess', _8 => _8.linkFlow, 'optionalAccess', _9 => _9.isOpen])){
2067
+ this.connector._relay.ui.linkFlow.isOpen = false;
2068
+ }
2069
+ }, 10);
2070
+
2008
2071
  let relay = await this.connector._relayProvider();
2009
2072
  relay.setConnectDisabled(false);
2073
+
2010
2074
  let accounts = await this.connector.enable();
2011
2075
  if(accounts instanceof Array && accounts.length) {
2012
2076
  setConnectedInstance(this);