@depay/web3-wallets-evm 15.16.2 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42138,7 +42138,7 @@
42138
42138
  lib.vec;
42139
42139
  lib.vecU8;
42140
42140
 
42141
- 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; }
42141
+ 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; }
42142
42142
  class Transaction {
42143
42143
 
42144
42144
  constructor({
@@ -42163,7 +42163,7 @@
42163
42163
  this.to = (to && to.match('0x')) ? ethers.ethers.utils.getAddress(to) : to;
42164
42164
 
42165
42165
  // optional
42166
- this.value = _optionalChain$k([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
42166
+ this.value = _optionalChain$l([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
42167
42167
  this.api = api;
42168
42168
  this.method = method;
42169
42169
  this.params = params;
@@ -42193,16 +42193,29 @@
42193
42193
  }
42194
42194
  }
42195
42195
 
42196
+ findFragment() {
42197
+ return this.getContract().interface.fragments.find((fragment) => {
42198
+ return(
42199
+ fragment.name == this.method &&
42200
+ (fragment.inputs && this.params && typeof(this.params) === 'object' ? fragment.inputs.length == Object.keys(this.params).length : true)
42201
+ )
42202
+ })
42203
+ }
42204
+
42205
+ getMethodNameWithSignature() {
42206
+ let fragment = this.findFragment();
42207
+ if(fragment.inputs) {
42208
+ return `${this.method}(${fragment.inputs.map((input)=>input.type).join(',')})`
42209
+ } else {
42210
+ return this.method
42211
+ }
42212
+ }
42213
+
42196
42214
  getContractArguments() {
42197
42215
  if(this.params instanceof Array) {
42198
42216
  return this.params
42199
42217
  } else if (this.params instanceof Object) {
42200
- let fragment = this.getContract().interface.fragments.find((fragment) => {
42201
- return(
42202
- fragment.name == this.method &&
42203
- fragment.inputs.length == Object.keys(this.params).length
42204
- )
42205
- });
42218
+ let fragment = this.findFragment();
42206
42219
 
42207
42220
  return fragment.inputs.map((input) => {
42208
42221
  return this.params[input.name]
@@ -42217,19 +42230,12 @@
42217
42230
  async getData() {
42218
42231
  let contractArguments = this.getContractArguments();
42219
42232
  let populatedTransaction;
42220
- let method = this.method;
42221
- if(this.getContract()[method] === undefined){
42222
- let fragment = this.getContract().interface.fragments.find((fragment) => {
42223
- return fragment.name == this.method
42224
- });
42225
- method = `${method}(${fragment.inputs.map((input)=>input.type).join(',')})`;
42226
- }
42227
42233
  if(contractArguments) {
42228
- populatedTransaction = await this.getContract().populateTransaction[method].apply(
42234
+ populatedTransaction = await this.getContract().populateTransaction[this.getMethodNameWithSignature()].apply(
42229
42235
  null, contractArguments
42230
42236
  );
42231
42237
  } else {
42232
- populatedTransaction = await this.getContract().populateTransaction[method].apply(null);
42238
+ populatedTransaction = await this.getContract().populateTransaction[this.getMethodNameWithSignature()].apply(null);
42233
42239
  }
42234
42240
 
42235
42241
  return populatedTransaction.data
@@ -42262,7 +42268,7 @@
42262
42268
  }
42263
42269
  }
42264
42270
 
42265
- 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; }
42271
+ 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; }
42266
42272
 
42267
42273
  const POLL_SPEED = 500; // 0.5 seconds
42268
42274
  const MAX_POLLS = 240; // 120 seconds
@@ -42283,14 +42289,14 @@
42283
42289
 
42284
42290
  const provider = await web3ClientEvm.getProvider(transaction.blockchain);
42285
42291
  const { value } = await provider.getSignatureStatus(signature);
42286
- const confirmationStatus = _optionalChain$j([value, 'optionalAccess', _ => _.confirmationStatus]);
42292
+ const confirmationStatus = _optionalChain$k([value, 'optionalAccess', _ => _.confirmationStatus]);
42287
42293
  if(confirmationStatus) {
42288
42294
  const hasReachedSufficientCommitment = confirmationStatus === 'confirmed' || confirmationStatus === 'finalized';
42289
42295
  if (hasReachedSufficientCommitment) {
42290
42296
  if(value.err) {
42291
42297
  transaction._failed = true;
42292
42298
  const confirmedTransaction = await provider.getConfirmedTransaction(signature);
42293
- const failedReason = _optionalChain$j([confirmedTransaction, 'optionalAccess', _2 => _2.meta, 'optionalAccess', _3 => _3.logMessages]) ? confirmedTransaction.meta.logMessages[confirmedTransaction.meta.logMessages.length - 1] : null;
42299
+ const failedReason = _optionalChain$k([confirmedTransaction, 'optionalAccess', _2 => _2.meta, 'optionalAccess', _3 => _3.logMessages]) ? confirmedTransaction.meta.logMessages[confirmedTransaction.meta.logMessages.length - 1] : null;
42294
42300
  if(transaction.failed) transaction.failed(transaction, failedReason);
42295
42301
  } else {
42296
42302
  transaction._succeeded = true;
@@ -42381,7 +42387,7 @@
42381
42387
  supported$2.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism'];
42382
42388
  supported$2.solana = [];
42383
42389
 
42384
- 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; }
42390
+ 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; }
42385
42391
  class WindowSolana {
42386
42392
 
42387
42393
  static __initStatic() {this.info = {
@@ -42392,7 +42398,7 @@
42392
42398
 
42393
42399
  static __initStatic2() {this.isAvailable = async()=>{
42394
42400
  return (
42395
- _optionalChain$i([window, 'optionalAccess', _2 => _2.solana]) &&
42401
+ _optionalChain$j([window, 'optionalAccess', _2 => _2.solana]) &&
42396
42402
  !(window.phantom && !window.glow && !window.solana.isGlow) &&
42397
42403
  !window.coin98 &&
42398
42404
  !window.solana.isGlow
@@ -42442,7 +42448,7 @@
42442
42448
  let internalCallback;
42443
42449
  switch (event) {
42444
42450
  case 'account':
42445
- internalCallback = (publicKey) => callback(_optionalChain$i([publicKey, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]));
42451
+ internalCallback = (publicKey) => callback(_optionalChain$j([publicKey, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]));
42446
42452
  this.getProvider().on('accountChanged', internalCallback);
42447
42453
  break
42448
42454
  }
@@ -43331,7 +43337,7 @@
43331
43337
  })
43332
43338
  };
43333
43339
 
43334
- 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; }
43340
+ 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; }
43335
43341
  class Backpack extends WindowSolana {
43336
43342
 
43337
43343
  static __initStatic() {this.info = {
@@ -43342,7 +43348,7 @@
43342
43348
 
43343
43349
  static __initStatic2() {this.isAvailable = async()=>{
43344
43350
  return (
43345
- _optionalChain$h([window, 'optionalAccess', _2 => _2.backpack]) &&
43351
+ _optionalChain$i([window, 'optionalAccess', _2 => _2.backpack]) &&
43346
43352
  window.backpack.isBackpack
43347
43353
  )
43348
43354
  };}
@@ -43418,14 +43424,7 @@
43418
43424
  const submitContractInteraction$3 = ({ transaction, signer, provider })=>{
43419
43425
  let contract = new ethers.ethers.Contract(transaction.to, transaction.api, provider);
43420
43426
  let contractArguments = transaction.getContractArguments({ contract });
43421
- let method = transaction.method;
43422
- if(contract[method] === undefined){
43423
- let fragment = contract.interface.fragments.find((fragment) => {
43424
- return fragment.name == transaction.method
43425
- });
43426
- method = `${method}(${fragment.inputs.map((input)=>input.type).join(',')})`;
43427
- }
43428
- method = contract.connect(signer)[method];
43427
+ let method = contract.connect(signer)[transaction.getMethodNameWithSignature()];
43429
43428
  if(contractArguments) {
43430
43429
  return method(...contractArguments, {
43431
43430
  value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
@@ -43444,7 +43443,7 @@
43444
43443
  })
43445
43444
  };
43446
43445
 
43447
- 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; }
43446
+ 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; }
43448
43447
  class WindowEthereum {
43449
43448
 
43450
43449
  static __initStatic() {this.info = {
@@ -43455,17 +43454,17 @@
43455
43454
 
43456
43455
  static __initStatic2() {this.isAvailable = async()=>{
43457
43456
  return (
43458
- _optionalChain$g([window, 'optionalAccess', _23 => _23.ethereum]) &&
43457
+ _optionalChain$h([window, 'optionalAccess', _23 => _23.ethereum]) &&
43459
43458
  Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length != 1 && // MetaMask
43460
- !_optionalChain$g([window, 'optionalAccess', _24 => _24.coin98]) && // Coin98
43461
- !(_optionalChain$g([window, 'optionalAccess', _25 => _25.ethereum, 'optionalAccess', _26 => _26.isTrust]) || _optionalChain$g([window, 'optionalAccess', _27 => _27.ethereum, 'optionalAccess', _28 => _28.isTrustWallet])) && // Trust Wallet
43462
- !_optionalChain$g([window, 'optionalAccess', _29 => _29.ethereum, 'optionalAccess', _30 => _30.isDeficonnectProvider]) && // crypto.com
43463
- !_optionalChain$g([window, 'optionalAccess', _31 => _31.ethereum, 'optionalAccess', _32 => _32.isHyperPay]) && // isHyperPay
43464
- !_optionalChain$g([window, 'optionalAccess', _33 => _33.ethereum, 'optionalAccess', _34 => _34.isPhantom]) && // Phantom
43465
- !_optionalChain$g([window, 'optionalAccess', _35 => _35.solana, 'optionalAccess', _36 => _36.isPhantom]) && // Phantom
43466
- !_optionalChain$g([window, 'optionalAccess', _37 => _37.ethereum, 'optionalAccess', _38 => _38.isRabby]) && // Rabby
43467
- !_optionalChain$g([window, 'optionalAccess', _39 => _39.backpack, 'optionalAccess', _40 => _40.isBackpack]) && // Backpack
43468
- !(_optionalChain$g([window, 'optionalAccess', _41 => _41.ethereum, 'optionalAccess', _42 => _42.isCoinbaseWallet]) || _optionalChain$g([window, 'optionalAccess', _43 => _43.ethereum, 'optionalAccess', _44 => _44.isWalletLink]))
43459
+ !_optionalChain$h([window, 'optionalAccess', _24 => _24.coin98]) && // Coin98
43460
+ !(_optionalChain$h([window, 'optionalAccess', _25 => _25.ethereum, 'optionalAccess', _26 => _26.isTrust]) || _optionalChain$h([window, 'optionalAccess', _27 => _27.ethereum, 'optionalAccess', _28 => _28.isTrustWallet])) && // Trust Wallet
43461
+ !_optionalChain$h([window, 'optionalAccess', _29 => _29.ethereum, 'optionalAccess', _30 => _30.isDeficonnectProvider]) && // crypto.com
43462
+ !_optionalChain$h([window, 'optionalAccess', _31 => _31.ethereum, 'optionalAccess', _32 => _32.isHyperPay]) && // isHyperPay
43463
+ !_optionalChain$h([window, 'optionalAccess', _33 => _33.ethereum, 'optionalAccess', _34 => _34.isPhantom]) && // Phantom
43464
+ !_optionalChain$h([window, 'optionalAccess', _35 => _35.solana, 'optionalAccess', _36 => _36.isPhantom]) && // Phantom
43465
+ !_optionalChain$h([window, 'optionalAccess', _37 => _37.ethereum, 'optionalAccess', _38 => _38.isRabby]) && // Rabby
43466
+ !_optionalChain$h([window, 'optionalAccess', _39 => _39.backpack, 'optionalAccess', _40 => _40.isBackpack]) && // Backpack
43467
+ !(_optionalChain$h([window, 'optionalAccess', _41 => _41.ethereum, 'optionalAccess', _42 => _42.isCoinbaseWallet]) || _optionalChain$h([window, 'optionalAccess', _43 => _43.ethereum, 'optionalAccess', _44 => _44.isWalletLink]))
43469
43468
  )
43470
43469
  };}
43471
43470
 
@@ -43591,7 +43590,7 @@
43591
43590
  }
43592
43591
  } WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
43593
43592
 
43594
- 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; }
43593
+ 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; }
43595
43594
  class Binance extends WindowEthereum {
43596
43595
 
43597
43596
  static __initStatic() {this.info = {
@@ -43601,7 +43600,7 @@
43601
43600
  };}
43602
43601
 
43603
43602
  static __initStatic2() {this.isAvailable = async()=>{
43604
- return _optionalChain$f([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
43603
+ return _optionalChain$g([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
43605
43604
  !window.coin98
43606
43605
  };}
43607
43606
 
@@ -43609,7 +43608,7 @@
43609
43608
 
43610
43609
  } Binance.__initStatic(); Binance.__initStatic2();
43611
43610
 
43612
- 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; }
43611
+ 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; }
43613
43612
  class Brave extends WindowEthereum {
43614
43613
 
43615
43614
  static __initStatic() {this.info = {
@@ -43618,10 +43617,10 @@
43618
43617
  blockchains: supported$2.evm
43619
43618
  };}
43620
43619
 
43621
- static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$e([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
43620
+ static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$f([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
43622
43621
  } Brave.__initStatic(); Brave.__initStatic2();
43623
43622
 
43624
- 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; }
43623
+ 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; }
43625
43624
  class Coin98 extends WindowEthereum {
43626
43625
 
43627
43626
  static __initStatic() {this.info = {
@@ -43630,10 +43629,10 @@
43630
43629
  blockchains: supported$2.evm
43631
43630
  };}
43632
43631
 
43633
- static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$d([window, 'optionalAccess', _2 => _2.coin98]) };}
43632
+ static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$e([window, 'optionalAccess', _2 => _2.coin98]) };}
43634
43633
  } Coin98.__initStatic(); Coin98.__initStatic2();
43635
43634
 
43636
- 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; }
43635
+ 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; }
43637
43636
  class Coinbase extends WindowEthereum {
43638
43637
 
43639
43638
  static __initStatic() {this.info = {
@@ -43642,10 +43641,10 @@
43642
43641
  blockchains: supported$2.evm
43643
43642
  };}
43644
43643
 
43645
- 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])) };}
43644
+ 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])) };}
43646
43645
  } Coinbase.__initStatic(); Coinbase.__initStatic2();
43647
43646
 
43648
- 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; }
43647
+ 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; }
43649
43648
  class CryptoCom extends WindowEthereum {
43650
43649
 
43651
43650
  static __initStatic() {this.info = {
@@ -43654,7 +43653,7 @@
43654
43653
  blockchains: supported$2.evm
43655
43654
  };}
43656
43655
 
43657
- static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$b([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
43656
+ static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$c([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
43658
43657
  } CryptoCom.__initStatic(); CryptoCom.__initStatic2();
43659
43658
 
43660
43659
  class Glow extends WindowSolana {
@@ -43673,7 +43672,7 @@
43673
43672
  };}
43674
43673
  } Glow.__initStatic(); Glow.__initStatic2();
43675
43674
 
43676
- 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; }
43675
+ 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; }
43677
43676
  class HyperPay extends WindowEthereum {
43678
43677
 
43679
43678
  static __initStatic() {this.info = {
@@ -43682,10 +43681,10 @@
43682
43681
  blockchains: supported$2.evm
43683
43682
  };}
43684
43683
 
43685
- static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$a([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isHyperPay]) };}
43684
+ static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$b([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isHyperPay]) };}
43686
43685
  } HyperPay.__initStatic(); HyperPay.__initStatic2();
43687
43686
 
43688
- 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; }
43687
+ 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; }
43689
43688
  class MetaMask extends WindowEthereum {
43690
43689
 
43691
43690
  static __initStatic() {this.info = {
@@ -43696,13 +43695,13 @@
43696
43695
 
43697
43696
  static __initStatic2() {this.isAvailable = async()=>{
43698
43697
  return(
43699
- _optionalChain$9([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMetaMask]) &&
43698
+ _optionalChain$a([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMetaMask]) &&
43700
43699
  Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length == 1
43701
43700
  )
43702
43701
  };}
43703
43702
  } MetaMask.__initStatic(); MetaMask.__initStatic2();
43704
43703
 
43705
- 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; }
43704
+ 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; }
43706
43705
  class Opera extends WindowEthereum {
43707
43706
 
43708
43707
  static __initStatic() {this.info = {
@@ -43711,7 +43710,7 @@
43711
43710
  blockchains: supported$2.evm
43712
43711
  };}
43713
43712
 
43714
- static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
43713
+ static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$9([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
43715
43714
  } Opera.__initStatic(); Opera.__initStatic2();
43716
43715
 
43717
43716
  class Phantom extends WindowSolana {
@@ -43729,7 +43728,7 @@
43729
43728
  };}
43730
43729
  } Phantom.__initStatic(); Phantom.__initStatic2();
43731
43730
 
43732
- 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; }
43731
+ 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; }
43733
43732
  class Rabby extends WindowEthereum {
43734
43733
 
43735
43734
  static __initStatic() {this.info = {
@@ -43740,12 +43739,12 @@
43740
43739
 
43741
43740
  static __initStatic2() {this.isAvailable = async()=>{
43742
43741
  return(
43743
- _optionalChain$7([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isRabby])
43742
+ _optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isRabby])
43744
43743
  )
43745
43744
  };}
43746
43745
  } Rabby.__initStatic(); Rabby.__initStatic2();
43747
43746
 
43748
- 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; }
43747
+ 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; }
43749
43748
  const KEY$2 = '_DePayWeb3WalletsConnectedSolanaMobileWalletInstance';
43750
43749
 
43751
43750
  const base64StringToPublicKey = (base64String)=> {
@@ -43834,8 +43833,8 @@
43834
43833
  await transact(
43835
43834
  async (wallet) => {
43836
43835
  await this.authorize(wallet);
43837
- if(_optionalChain$6([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$2+'_name'] = this.name = options.name; }
43838
- if(_optionalChain$6([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$2+'_logo'] = this.logo = options.logo; }
43836
+ if(_optionalChain$7([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$2+'_name'] = this.name = options.name; }
43837
+ if(_optionalChain$7([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$2+'_logo'] = this.logo = options.logo; }
43839
43838
  }
43840
43839
  );
43841
43840
  return this._account
@@ -43894,7 +43893,7 @@
43894
43893
  }
43895
43894
  } SolanaMobileWalletAdapter.__initStatic(); SolanaMobileWalletAdapter.__initStatic2();
43896
43895
 
43897
- 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; }
43896
+ 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; }
43898
43897
  class Solflare extends WindowSolana {
43899
43898
 
43900
43899
  static __initStatic() {this.info = {
@@ -43905,7 +43904,7 @@
43905
43904
 
43906
43905
  static __initStatic2() {this.isAvailable = async()=>{
43907
43906
  return (
43908
- _optionalChain$5([window, 'optionalAccess', _2 => _2.solflare]) &&
43907
+ _optionalChain$6([window, 'optionalAccess', _2 => _2.solflare]) &&
43909
43908
  window.solflare.isSolflare
43910
43909
  )
43911
43910
  };}
@@ -43915,7 +43914,7 @@
43915
43914
  _sendTransaction(transaction) { return this.getProvider().signTransaction(transaction) }
43916
43915
  } Solflare.__initStatic(); Solflare.__initStatic2();
43917
43916
 
43918
- 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; }
43917
+ 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; }
43919
43918
  class Trust extends WindowEthereum {
43920
43919
 
43921
43920
  static __initStatic() {this.info = {
@@ -43924,7 +43923,7 @@
43924
43923
  blockchains: supported$2.evm
43925
43924
  };}
43926
43925
 
43927
- 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])) };}
43926
+ 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])) };}
43928
43927
  } Trust.__initStatic(); Trust.__initStatic2();
43929
43928
 
43930
43929
  const transactionApiBlockchainNames = {
@@ -44016,7 +44015,7 @@
44016
44015
  }
44017
44016
  };
44018
44017
 
44019
- 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; }
44018
+ 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; }
44020
44019
 
44021
44020
  const sendTransaction$3 = async ({ transaction, wallet })=> {
44022
44021
  transaction = new Transaction(transaction);
@@ -44096,7 +44095,7 @@
44096
44095
  const submitContractInteraction$2 = async ({ transaction, wallet })=>{
44097
44096
  const provider = await web3ClientEvm.getProvider(transaction.blockchain);
44098
44097
  let gasPrice = await provider.getGasPrice();
44099
- if(_optionalChain$3([wallet, 'access', _ => _.session, 'optionalAccess', _2 => _2.peerMeta, 'optionalAccess', _3 => _3.name]) === 'Uniswap Wallet') {
44098
+ if(_optionalChain$4([wallet, 'access', _ => _.session, 'optionalAccess', _2 => _2.peerMeta, 'optionalAccess', _3 => _3.name]) === 'Uniswap Wallet') {
44100
44099
  gasPrice = undefined;
44101
44100
  } else {
44102
44101
  gasPrice = gasPrice.toHexString();
@@ -44120,7 +44119,7 @@
44120
44119
  const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
44121
44120
  const provider = await web3ClientEvm.getProvider(transaction.blockchain);
44122
44121
  let gasPrice = await provider.getGasPrice();
44123
- if(_optionalChain$3([wallet, 'access', _4 => _4.session, 'optionalAccess', _5 => _5.peerMeta, 'optionalAccess', _6 => _6.name]) === 'Uniswap Wallet') {
44122
+ if(_optionalChain$4([wallet, 'access', _4 => _4.session, 'optionalAccess', _5 => _5.peerMeta, 'optionalAccess', _6 => _6.name]) === 'Uniswap Wallet') {
44124
44123
  gasPrice = undefined;
44125
44124
  } else {
44126
44125
  gasPrice = gasPrice.toHexString();
@@ -44139,7 +44138,7 @@
44139
44138
  })
44140
44139
  };
44141
44140
 
44142
- 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; }
44141
+ 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; }
44143
44142
 
44144
44143
  const KEY$1 = '_DePayWeb3WalletsConnectedWalletConnectV1Instance';
44145
44144
 
@@ -44188,7 +44187,7 @@
44188
44187
  if(await isConnected()) { return new WalletConnectV1() }
44189
44188
  };
44190
44189
 
44191
- const setConnectedInstance$2 = (value)=>{
44190
+ const setConnectedInstance$1 = (value)=>{
44192
44191
  window[KEY$1] = value;
44193
44192
  };
44194
44193
 
@@ -44227,7 +44226,7 @@
44227
44226
  }
44228
44227
 
44229
44228
  disconnect() {
44230
- setConnectedInstance$2(undefined);
44229
+ setConnectedInstance$1(undefined);
44231
44230
  localStorage[KEY$1+'_name'] = undefined;
44232
44231
  localStorage[KEY$1+'_logo'] = undefined;
44233
44232
  currentPlainInstance = undefined;
@@ -44243,7 +44242,7 @@
44243
44242
  });
44244
44243
 
44245
44244
  instance.on("modal_closed", ()=>{
44246
- setConnectedInstance$2(undefined);
44245
+ setConnectedInstance$1(undefined);
44247
44246
  this.connector = undefined;
44248
44247
  this.session = undefined;
44249
44248
  });
@@ -44282,11 +44281,11 @@
44282
44281
  let session = await this.connector.connect();
44283
44282
  this.session = session;
44284
44283
 
44285
- if(_optionalChain$2([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$1+'_name'] = this.name = options.name; }
44286
- if(_optionalChain$2([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$1+'_logo'] = this.logo = options.logo; }
44284
+ if(_optionalChain$3([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$1+'_name'] = this.name = options.name; }
44285
+ if(_optionalChain$3([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$1+'_logo'] = this.logo = options.logo; }
44287
44286
 
44288
44287
  if(session.accounts instanceof Array && session.accounts.length) {
44289
- setConnectedInstance$2(this);
44288
+ setConnectedInstance$1(this);
44290
44289
  return ethers.ethers.utils.getAddress(session.accounts[0])
44291
44290
  } else {
44292
44291
  return
@@ -44425,9 +44424,9 @@
44425
44424
  } WalletConnectV1.__initStatic(); WalletConnectV1.__initStatic2();
44426
44425
 
44427
44426
  WalletConnectV1.getConnectedInstance = getConnectedInstance$2;
44428
- WalletConnectV1.setConnectedInstance = setConnectedInstance$2;
44427
+ WalletConnectV1.setConnectedInstance = setConnectedInstance$1;
44429
44428
 
44430
- 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; }
44429
+ 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; }
44431
44430
  const sendTransaction$2 = async ({ transaction, wallet })=> {
44432
44431
  transaction = new Transaction(transaction);
44433
44432
  if((await wallet.connectedTo(transaction.blockchain)) == false) {
@@ -44511,14 +44510,14 @@
44511
44510
  params: [{
44512
44511
  from: transaction.from,
44513
44512
  to: transaction.to,
44514
- value: _optionalChain$1([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]),
44513
+ value: _optionalChain$2([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]),
44515
44514
  data: await transaction.getData(),
44516
44515
  gas: gas.toHexString(),
44517
44516
  gasPrice: gasPrice.toHexString(),
44518
44517
  nonce: transaction.nonce,
44519
44518
  }]
44520
44519
  }
44521
- })
44520
+ }).catch((e)=>{console.log('ERROR', e);})
44522
44521
  };
44523
44522
 
44524
44523
  const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
@@ -44534,7 +44533,7 @@
44534
44533
  params: [{
44535
44534
  from: transaction.from,
44536
44535
  to: transaction.to,
44537
- value: _optionalChain$1([transaction, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]),
44536
+ value: _optionalChain$2([transaction, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]),
44538
44537
  gas: gas.toHexString(),
44539
44538
  gasPrice: gasPrice.toHexString(),
44540
44539
  nonce: transaction.nonce
@@ -44543,76 +44542,106 @@
44543
44542
  }).catch((e)=>{console.log('ERROR', e);})
44544
44543
  };
44545
44544
 
44546
- 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; }
44545
+ 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; }
44547
44546
  const KEY = 'depay:wallets:wc2';
44548
44547
 
44549
- const getLastSession = async()=>{
44550
- if(!localStorage[KEY+":projectId"]) { return }
44551
- let signClient = await getSignClient();
44552
- const existingSessions = signClient.find(getWalletConnectV2Config());
44553
- const lastSession = existingSessions ? existingSessions[existingSessions.length-1] : undefined;
44554
- if(lastSession && lastSession.expiry > Math.ceil(Date.now()/1000)) {
44555
- try {
44556
- if(await getConnectedChainId(signClient, lastSession)) {
44557
- return lastSession
44548
+ // configurations for wallets that require special handling
44549
+ const CONFIGURATIONS = {
44550
+
44551
+ "MetaMask": {
44552
+ methods: [
44553
+ "eth_sendTransaction",
44554
+ "personal_sign",
44555
+ "eth_chainId", // only add eth_chainId if you do not trust the wallet provided chainIds!
44556
+ "eth_signTypedData",
44557
+ "eth_signTypedData_v4",
44558
+ "wallet_switchEthereumChain"
44559
+ ]
44560
+ },
44561
+
44562
+ "Uniswap Wallet": {
44563
+ methods: [
44564
+ "eth_sendTransaction",
44565
+ "personal_sign",
44566
+ "eth_signTypedData",
44567
+ "eth_signTypedData_v4",
44568
+ ],
44569
+ requiredNamespaces: {
44570
+ eip155: {
44571
+ chains: ['ethereum', 'polygon', 'arbitrum', 'optimism'].map((blockchainName)=>`eip155:${Blockchains__default['default'][blockchainName].networkId}`)
44558
44572
  }
44559
- } catch (e) {}
44560
- }
44573
+ },
44574
+ optionalNamespaces: {},
44575
+ },
44576
+
44577
+ "Enjin Wallet": {
44578
+ methods: [
44579
+ "eth_sendTransaction",
44580
+ "personal_sign",
44581
+ "eth_signTypedData",
44582
+ ]
44583
+ },
44584
+
44561
44585
  };
44562
44586
 
44563
- const getConnectedChainId = async(signClient, session)=>{
44564
- let results = (await Promise.all(session.namespaces.eip155.chains.map((identifier)=>{
44565
- return Promise.race([
44566
- new Promise((resolve)=>{setTimeout(resolve, 1500);}),
44567
- signClient.request({
44568
- topic: session.topic,
44569
- chainId: identifier,
44570
- request: {
44571
- method: 'eth_chainId'
44572
- }
44573
- })
44574
- ])
44575
- })));
44576
- return results.filter(Boolean)[0]
44587
+ const DEFAULT_CONFIGURATION = {
44588
+ events: ['accountsChanged'],
44589
+ methods: [
44590
+ "eth_sendTransaction",
44591
+ "personal_sign",
44592
+ "eth_signTypedData",
44593
+ "eth_signTypedData_v4",
44594
+ ]
44577
44595
  };
44578
44596
 
44579
44597
  const getConnectedInstance$1 = async()=>{
44580
- if(localStorage[KEY+":projectId"]) {
44581
- const lastSession = await getLastSession();
44582
- if(lastSession) {
44583
- return new WalletConnectV2()
44584
- }
44585
- }
44598
+ if(await WalletConnectV2.isAvailable()) { return new WalletConnectV2() }
44586
44599
  };
44587
44600
 
44588
- const setConnectedInstance$1 = (value)=>{
44601
+ const getLastSession = async(walletName)=>{
44602
+ if(!localStorage[KEY+":projectId"]) { return }
44603
+ if(walletName !== localStorage[KEY+":lastSessionWalletName"]) { return }
44604
+ let signClient = await getSignClient();
44605
+ const existingSessions = signClient.find(getWalletConnectV2Config(walletName));
44606
+ const lastSession = existingSessions ? existingSessions[existingSessions.length-1] : undefined;
44607
+ if(lastSession && localStorage[KEY+":lastExpiredSessionTopic"] !== lastSession.topic && lastSession.expiry > Math.ceil(Date.now()/1000)) {
44608
+ const result = await Promise.race([signClient.ping({ topic: lastSession.topic }), new Promise((resolve)=>setTimeout(resolve, 1500))]);
44609
+ if(result) {
44610
+ return lastSession
44611
+ } else {
44612
+ localStorage[KEY+":lastExpiredSessionTopic"] = lastSession.topic;
44613
+ return
44614
+ }
44615
+ }
44589
44616
  };
44590
44617
 
44591
- const getWalletConnectV2Config = ()=>{
44592
- const methods = [
44593
- "eth_sendTransaction",
44594
- "personal_sign",
44595
- "eth_signTypedData_v4",
44596
- "eth_chainId",
44597
- "eth_accounts",
44598
- "wallet_switchEthereumChain",
44599
- ];
44600
-
44601
- const events = ['accountsChanged'];
44618
+ const getWalletConnectV2Config = (walletName)=>{
44619
+ const methods = _optionalChain$1([CONFIGURATIONS, 'access', _ => _[walletName], 'optionalAccess', _2 => _2.methods]) || DEFAULT_CONFIGURATION.methods;
44620
+ const events = _optionalChain$1([CONFIGURATIONS, 'access', _3 => _3[walletName], 'optionalAccess', _4 => _4.events]) || DEFAULT_CONFIGURATION.events;
44602
44621
 
44603
44622
  let requiredNamespaces = {};
44604
- requiredNamespaces['eip155'] = {
44605
- methods,
44606
- events,
44607
- chains: [`eip155:1`],
44608
- };
44623
+ if(_optionalChain$1([CONFIGURATIONS, 'access', _5 => _5[walletName], 'optionalAccess', _6 => _6.requiredNamespaces])) {
44624
+ requiredNamespaces = CONFIGURATIONS[walletName].requiredNamespaces;
44625
+ } else {
44626
+ requiredNamespaces['eip155'] = {
44627
+ chains: [`eip155:1`],
44628
+ };
44629
+ }
44630
+ requiredNamespaces['eip155'].methods = methods;
44631
+ requiredNamespaces['eip155'].events = events;
44609
44632
 
44610
44633
  let optionalNamespaces = {};
44611
- optionalNamespaces['eip155'] = {
44612
- methods,
44613
- events,
44614
- chains: supported$2.evm.map((blockchain)=>`${Blockchains__default['default'][blockchain].namespace}:${Blockchains__default['default'][blockchain].networkId}`),
44615
- };
44634
+ if(_optionalChain$1([CONFIGURATIONS, 'access', _7 => _7[walletName], 'optionalAccess', _8 => _8.optionalNamespaces])) {
44635
+ optionalNamespaces = CONFIGURATIONS[walletName].optionalNamespaces;
44636
+ } else {
44637
+ optionalNamespaces['eip155'] = {
44638
+ chains: supported$2.evm.map((blockchain)=>`${Blockchains__default['default'][blockchain].namespace}:${Blockchains__default['default'][blockchain].networkId}`),
44639
+ };
44640
+ }
44641
+ if(_optionalChain$1([optionalNamespaces, 'optionalAccess', _9 => _9.eip155]) && _optionalChain$1([optionalNamespaces, 'optionalAccess', _10 => _10.eip155, 'optionalAccess', _11 => _11.chains, 'optionalAccess', _12 => _12.length])) {
44642
+ optionalNamespaces['eip155'].methods = methods;
44643
+ optionalNamespaces['eip155'].events = events;
44644
+ }
44616
44645
 
44617
44646
  return { requiredNamespaces, optionalNamespaces }
44618
44647
  };
@@ -44621,18 +44650,18 @@
44621
44650
  if(window.getSignClientPromise) { return window.getSignClientPromise }
44622
44651
  window.getSignClientPromise = new Promise(async(resolve)=>{
44623
44652
  const signClient = await walletconnectV2.SignClient.init({
44624
- core: new walletconnectV2.Core({ projectId: localStorage[KEY+":projectId"] }),
44653
+ projectId: localStorage[KEY+":projectId"],
44625
44654
  metadata: {
44626
44655
  name: document.title || 'dApp',
44627
- description: _optionalChain([document, 'access', _ => _.querySelector, 'call', _2 => _2('meta[name="description"]'), 'optionalAccess', _3 => _3.getAttribute, 'call', _4 => _4('content')]) || document.title || 'dApp',
44656
+ 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',
44628
44657
  url: location.href,
44629
- 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`]
44658
+ 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`]
44630
44659
  }
44631
44660
  });
44632
44661
  resolve(signClient);
44633
44662
  });
44634
44663
 
44635
- return window.getSignClientPromise
44664
+ return window.getSignClientPromise
44636
44665
  };
44637
44666
 
44638
44667
  class WalletConnectV2 {
@@ -44643,14 +44672,13 @@
44643
44672
  blockchains: supported$2.evm
44644
44673
  };}
44645
44674
 
44646
- static __initStatic2() {this.isAvailable = ()=>{
44647
- return getConnectedInstance$1() != undefined
44675
+ static __initStatic2() {this.isAvailable = async(options)=>{
44676
+ return !! await getLastSession(_optionalChain$1([options, 'optionalAccess', _21 => _21.walletName]))
44648
44677
  };}
44649
44678
 
44650
44679
  constructor() {
44651
44680
  this.name = (localStorage[KEY+':name'] && localStorage[KEY+':name'] != undefined) ? localStorage[KEY+':name'] : this.constructor.info.name;
44652
44681
  this.logo = (localStorage[KEY+':logo'] && localStorage[KEY+':logo'] != undefined) ? localStorage[KEY+':logo'] : this.constructor.info.logo;
44653
- this.blockchains = this.constructor.info.blockchains;
44654
44682
  this.sendTransaction = (transaction)=>{
44655
44683
  return sendTransaction$2({
44656
44684
  wallet: this,
@@ -44660,17 +44688,57 @@
44660
44688
  }
44661
44689
 
44662
44690
  async account() {
44663
- const connectedChainId = await getConnectedChainId(this.signClient, this.session);
44664
- const connectedBlockchain = Blockchains__default['default'].findById(connectedChainId);
44665
- const accounts = await this.signClient.request({
44666
- topic: this.session.topic,
44667
- chainId: `${connectedBlockchain.namespace}:${connectedBlockchain.networkId}`,
44668
- request:{
44669
- method: 'eth_accounts',
44670
- params: [{ chainId: connectedBlockchain.id }],
44671
- }
44672
- });
44673
- return accounts ? accounts[0] : undefined
44691
+ if(_optionalChain$1([this, 'access', _22 => _22.session, 'optionalAccess', _23 => _23.namespaces, 'optionalAccess', _24 => _24.eip155, 'optionalAccess', _25 => _25.accounts, 'optionalAccess', _26 => _26.length])) {
44692
+ return this.session.namespaces.eip155.accounts[0].split(':')[2]
44693
+ }
44694
+ }
44695
+
44696
+ async getAllAvailableBlockchains() {
44697
+ let timeTillResponse = new Date();
44698
+ await Promise.race([...
44699
+ this.session.namespaces.eip155.chains.map((chainIdentifier)=>{
44700
+ return new Promise((resolve)=>{
44701
+ try {
44702
+ this.signClient.request({
44703
+ topic: this.session.topic,
44704
+ chainId: chainIdentifier,
44705
+ request:{
44706
+ method: 'eth_chainId',
44707
+ }
44708
+ }).then(resolve);
44709
+ } catch (e) {}
44710
+ })
44711
+ }),
44712
+ new Promise(resolve=>setTimeout(resolve, 6000))
44713
+ ]);
44714
+ timeTillResponse = new Date() - timeTillResponse;
44715
+
44716
+ let blockchains = [];
44717
+ await Promise.race([
44718
+ Promise.all(this.session.namespaces.eip155.chains.map((chainIdentifier)=>{
44719
+ try {
44720
+ return this.signClient.request({
44721
+ topic: this.session.topic,
44722
+ chainId: chainIdentifier,
44723
+ request:{
44724
+ method: 'eth_chainId',
44725
+ }
44726
+ }).then(()=> blockchains.push(Blockchains__default['default'].findByNetworkId(chainIdentifier.split(':')[1]).name))
44727
+ } catch (e2) {}
44728
+ })),
44729
+ new Promise(resolve => setTimeout(resolve, timeTillResponse*2))
44730
+ ]);
44731
+ return blockchains
44732
+ }
44733
+
44734
+ async setSessionBlockchains() {
44735
+ if(_optionalChain$1([CONFIGURATIONS, 'access', _27 => _27[this.walletName], 'optionalAccess', _28 => _28.methods, 'optionalAccess', _29 => _29.includes, 'call', _30 => _30('eth_chainId')])) {
44736
+ this.blockchains = await this.getAllAvailableBlockchains();
44737
+ } else if(this.session.namespaces.eip155.chains) {
44738
+ this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$1([Blockchains__default['default'], 'access', _31 => _31.findByNetworkId, 'call', _32 => _32(chainIdentifier.split(':')[1]), 'optionalAccess', _33 => _33.name])).filter(Boolean);
44739
+ } else if(this.session.namespaces.eip155.accounts) {
44740
+ this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$1([Blockchains__default['default'], 'access', _34 => _34.findByNetworkId, 'call', _35 => _35(accountIdentifier.split(':')[1]), 'optionalAccess', _36 => _36.name])).filter(Boolean);
44741
+ }
44674
44742
  }
44675
44743
 
44676
44744
  async connect(options) {
@@ -44679,65 +44747,59 @@
44679
44747
 
44680
44748
  try {
44681
44749
 
44682
- // delete localStorage[`wc@2:client:0.3//session`] // DO NOT RECOVER AN OTHER SUBSCRIPTION!!!
44750
+ this.walletName = _optionalChain$1([options, 'optionalAccess', _37 => _37.walletName]);
44751
+
44752
+ // delete localStorage[`wc@2:client:0.3//session`] // DELETE WC SESSIONS
44683
44753
  this.signClient = await getSignClient();
44684
44754
 
44685
44755
  this.signClient.on("session_delete", (session)=> {
44686
- if(_optionalChain([session, 'optionalAccess', _8 => _8.topic]) === _optionalChain([this, 'access', _9 => _9.session, 'optionalAccess', _10 => _10.topic])) {
44756
+ if(_optionalChain$1([session, 'optionalAccess', _38 => _38.topic]) === _optionalChain$1([this, 'access', _39 => _39.session, 'optionalAccess', _40 => _40.topic])) {
44687
44757
  localStorage[KEY+':name'] = undefined;
44688
44758
  localStorage[KEY+':logo'] = undefined;
44689
- WalletConnect.instance = undefined;
44690
44759
  this.signClient = undefined;
44691
44760
  this.session = undefined;
44692
44761
  }
44693
44762
  });
44694
44763
 
44695
44764
  this.signClient.on("session_update", async(session)=> {
44696
- if(_optionalChain([session, 'optionalAccess', _11 => _11.topic]) === _optionalChain([this, 'access', _12 => _12.session, 'optionalAccess', _13 => _13.topic])) {
44765
+ if(_optionalChain$1([session, 'optionalAccess', _41 => _41.topic]) === _optionalChain$1([this, 'access', _42 => _42.session, 'optionalAccess', _43 => _43.topic])) {
44697
44766
  this.session = this.signClient.session.get(session.topic);
44767
+ await this.setSessionBlockchains();
44698
44768
  }
44699
44769
  });
44700
44770
 
44701
44771
  this.signClient.on("session_event", (event)=> {
44702
- if(_optionalChain([event, 'optionalAccess', _14 => _14.topic]) === _optionalChain([this, 'access', _15 => _15.session, 'optionalAccess', _16 => _16.topic])) {
44703
- }
44772
+ if(_optionalChain$1([event, 'optionalAccess', _44 => _44.topic]) === _optionalChain$1([this, 'access', _45 => _45.session, 'optionalAccess', _46 => _46.topic])) {}
44704
44773
  });
44705
44774
 
44706
- const lastSession = await getLastSession();
44707
- if(lastSession) {
44708
- this.session = lastSession;
44709
- }
44710
-
44711
44775
  const connectWallet = async()=>{
44712
- const { uri, approval } = await this.signClient.connect(getWalletConnectV2Config());
44776
+ const { uri, approval } = await this.signClient.connect(getWalletConnectV2Config(this.walletName));
44713
44777
  await connect({ uri });
44714
44778
  this.session = await approval();
44779
+ localStorage[KEY+":lastSessionWalletName"] = this.walletName;
44780
+ await new Promise(resolve=>setTimeout(resolve, 500)); // to prevent race condition within WalletConnect
44715
44781
  };
44716
44782
 
44717
- if(!this.session){ await connectWallet(); }
44783
+ const lastSession = _optionalChain$1([this, 'optionalAccess', _47 => _47.walletName, 'optionalAccess', _48 => _48.length]) ? await getLastSession(this.walletName) : undefined;
44784
+ if(lastSession) {
44785
+ this.session = lastSession;
44786
+ } else {
44787
+ await connectWallet();
44788
+ }
44718
44789
 
44719
- let meta = _optionalChain([this, 'access', _17 => _17.session, 'optionalAccess', _18 => _18.peer, 'optionalAccess', _19 => _19.metadata]);
44790
+ let meta = _optionalChain$1([this, 'access', _49 => _49.session, 'optionalAccess', _50 => _50.peer, 'optionalAccess', _51 => _51.metadata]);
44720
44791
  if(meta && meta.name) {
44721
44792
  this.name = meta.name;
44722
44793
  localStorage[KEY+':name'] = meta.name;
44723
- if(_optionalChain([meta, 'optionalAccess', _20 => _20.icons]) && meta.icons.length) {
44794
+ if(_optionalChain$1([meta, 'optionalAccess', _52 => _52.icons]) && meta.icons.length) {
44724
44795
  this.logo = meta.icons[0];
44725
44796
  localStorage[KEY+':logo'] = this.logo;
44726
44797
  }
44727
44798
  }
44728
- if(_optionalChain([options, 'optionalAccess', _21 => _21.name])) { localStorage[KEY+':name'] = this.name = options.name; }
44729
- if(_optionalChain([options, 'optionalAccess', _22 => _22.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
44730
-
44731
- let connectedChainId;
44732
- for(var i = 0; i<3; i++) {
44733
- await new Promise((resolve)=>{setTimeout(resolve, 500);});
44734
- connectedChainId = await getConnectedChainId(this.signClient, this.session);
44735
- if(connectedChainId){ break }
44736
- }
44737
-
44738
- if(!connectedChainId) { await connectWallet(); }
44799
+ if(_optionalChain$1([options, 'optionalAccess', _53 => _53.name])) { localStorage[KEY+':name'] = this.name = options.name; }
44800
+ if(_optionalChain$1([options, 'optionalAccess', _54 => _54.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
44739
44801
 
44740
- let connectedBlockchain = Blockchains__default['default'].findById(connectedChainId);
44802
+ await this.setSessionBlockchains();
44741
44803
 
44742
44804
  return await this.account()
44743
44805
 
@@ -44747,42 +44809,37 @@
44747
44809
  }
44748
44810
 
44749
44811
  async connectedTo(input) {
44750
- let chainId = await getConnectedChainId(this.signClient, this.session);
44751
- if(!chainId) { return false }
44752
- const blockchain = Blockchains__default['default'].findById(chainId);
44753
- if(!blockchain) { return false }
44754
44812
  if(input) {
44755
- return input === blockchain.name
44813
+ return this.blockchains.indexOf(input) > -1
44756
44814
  } else {
44757
- return blockchain.name
44815
+ return this.blockchains
44758
44816
  }
44759
44817
  }
44760
44818
 
44819
+ getValidChainId() {
44820
+ return `eip155:${Blockchains__default['default'][this.blockchains[0]].networkId}`
44821
+ }
44822
+
44761
44823
  switchTo(blockchainName) {
44762
44824
  return new Promise((resolve, reject)=>{
44763
- let resolved, rejected;
44825
+
44764
44826
  const blockchain = Blockchains__default['default'][blockchainName];
44765
- setTimeout(async()=>{
44766
- if(!(await this.connectedTo(blockchainName)) && !resolved && !rejected){
44767
- reject({ code: 'NOT_SUPPORTED' });
44768
- } else {
44769
- this.connectedChainId = `${blockchain.namespace}:${blockchain.networkId}`;
44770
- resolve();
44771
- }
44772
- }, 4000);
44773
- this.session.namespaces.eip155.chains.map((identifier)=>{
44774
- return Promise.race([
44775
- new Promise((resolve)=>{setTimeout(resolve, 1500);}),
44776
- this.signClient.request({
44777
- topic: this.session.topic,
44778
- chainId: identifier,
44779
- request:{
44780
- method: 'wallet_switchEthereumChain',
44781
- params: [{ chainId: blockchain.id }],
44782
- }
44783
- })
44784
- ])
44785
- });
44827
+
44828
+ Promise.race([
44829
+ this.signClient.request({
44830
+ topic: this.session.topic,
44831
+ chainId: this.getValidChainId(),
44832
+ request:{
44833
+ method: 'wallet_switchEthereumChain',
44834
+ params: [{ chainId: blockchain.id }],
44835
+ }
44836
+ }),
44837
+ new Promise((resolve, reject)=>setTimeout(()=>{
44838
+ if(this.blockchains.indexOf(blockchainName) === -1) {
44839
+ reject({ code: 'NOT_SUPPORTED' });
44840
+ }
44841
+ } , 8000))
44842
+ ]).catch(reject);
44786
44843
  })
44787
44844
  }
44788
44845
 
@@ -44797,7 +44854,7 @@
44797
44854
  switch (event) {
44798
44855
  case 'account':
44799
44856
  internalCallback = async(event)=> {
44800
- if(_optionalChain([event, 'optionalAccess', _23 => _23.topic]) === _optionalChain([this, 'access', _24 => _24.session, 'optionalAccess', _25 => _25.topic]) && event.params.event.name === 'accountsChanged') {
44857
+ if(_optionalChain$1([event, 'optionalAccess', _55 => _55.topic]) === _optionalChain$1([this, 'access', _56 => _56.session, 'optionalAccess', _57 => _57.topic]) && event.params.event.name === 'accountsChanged') {
44801
44858
  callback(await this.account());
44802
44859
  }
44803
44860
  };
@@ -44818,13 +44875,9 @@
44818
44875
  async sign(message) {
44819
44876
  if(typeof message === 'object') {
44820
44877
  let account = await this.account();
44821
- const blockchain = Blockchains__default['default'].findByNetworkId(message.domain.chainId);
44822
- if((await this.connectedTo(blockchain.name)) === false) {
44823
- throw({ code: 'WRONG_NETWORK' })
44824
- }
44825
44878
  let signature = await this.signClient.request({
44826
44879
  topic: this.session.topic,
44827
- chainId: `${blockchain.namespace}:${blockchain.networkId}`,
44880
+ chainId: this.getValidChainId(),
44828
44881
  request:{
44829
44882
  method: 'eth_signTypedData_v4',
44830
44883
  params: [account, JSON.stringify(message)],
@@ -44834,11 +44887,9 @@
44834
44887
  } else if (typeof message === 'string') {
44835
44888
  const address = await this.account();
44836
44889
  const params = [ethers.ethers.utils.hexlify(ethers.ethers.utils.toUtf8Bytes(message)), address];
44837
- const connectedChainId = await getConnectedChainId(this.signClient, this.session);
44838
- const blockchain = Blockchains__default['default'].findById(connectedChainId);
44839
44890
  let signature = await this.signClient.request({
44840
44891
  topic: this.session.topic,
44841
- chainId: `${blockchain.namespace}:${blockchain.networkId}`,
44892
+ chainId: this.getValidChainId(),
44842
44893
  request:{
44843
44894
  method: 'personal_sign',
44844
44895
  params
@@ -44853,7 +44904,6 @@
44853
44904
  } WalletConnectV2.__initStatic(); WalletConnectV2.__initStatic2();
44854
44905
 
44855
44906
  WalletConnectV2.getConnectedInstance = getConnectedInstance$1;
44856
- WalletConnectV2.setConnectedInstance = setConnectedInstance$1;
44857
44907
 
44858
44908
  const sendTransaction$1 = async ({ transaction, wallet })=> {
44859
44909
  transaction = new Transaction(transaction);
@@ -44911,14 +44961,7 @@
44911
44961
  const submitContractInteraction = ({ transaction, signer, provider })=>{
44912
44962
  let contract = new ethers.ethers.Contract(transaction.to, transaction.api, provider);
44913
44963
  let contractArguments = transaction.getContractArguments({ contract });
44914
- let method = transaction.method;
44915
- if(contract[method] === undefined){
44916
- let fragment = contract.interface.fragments.find((fragment) => {
44917
- return fragment.name == transaction.method
44918
- });
44919
- method = `${method}(${fragment.inputs.map((input)=>input.type).join(',')})`;
44920
- }
44921
- method = contract.connect(signer)[method];
44964
+ let method = contract.connect(signer)[transaction.getMethodNameWithSignature()];
44922
44965
  if(contractArguments) {
44923
44966
  return method(...contractArguments, {
44924
44967
  value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
@@ -44937,6 +44980,7 @@
44937
44980
  })
44938
44981
  };
44939
44982
 
44983
+ 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; }
44940
44984
  const getConnectedInstance = ()=>{
44941
44985
  return window._connectedWalletLinkInstance
44942
44986
  };
@@ -44979,8 +45023,20 @@
44979
45023
  }
44980
45024
 
44981
45025
  async connect(options) {
45026
+ let connect = (options && options.connect) ? options.connect : ({uri})=>{};
45027
+
45028
+ await connect({ uri: this.connector.qrUrl });
45029
+
45030
+ _optionalChain([document, 'access', _ => _.querySelector, 'call', _2 => _2('.-cbwsdk-extension-dialog-container'), 'optionalAccess', _3 => _3.setAttribute, 'call', _4 => _4('style', 'display: none;')]);
45031
+ setTimeout(()=>{
45032
+ if(_optionalChain([this, 'optionalAccess', _5 => _5.connector, 'optionalAccess', _6 => _6._relay, 'optionalAccess', _7 => _7.ui, 'optionalAccess', _8 => _8.linkFlow, 'optionalAccess', _9 => _9.isOpen])){
45033
+ this.connector._relay.ui.linkFlow.isOpen = false;
45034
+ }
45035
+ }, 10);
45036
+
44982
45037
  let relay = await this.connector._relayProvider();
44983
45038
  relay.setConnectDisabled(false);
45039
+
44984
45040
  let accounts = await this.connector.enable();
44985
45041
  if(accounts instanceof Array && accounts.length) {
44986
45042
  setConnectedInstance(this);