@depay/web3-wallets-evm 14.2.0 → 14.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,11 +2,11 @@ import { Blockchain } from '@depay/web3-blockchains';
2
2
  import { ethers } from 'ethers';
3
3
  import { CONSTANTS } from '@depay/web3-constants';
4
4
  import { request as request$3 } from '@depay/web3-client-evm';
5
- import { WalletConnectClient, QRCodeModal } from '@depay/walletconnect-v1';
5
+ import { WalletConnectClient } from '@depay/walletconnect-v1';
6
6
  import { Core, SignClient } from '@depay/walletconnect-v2';
7
7
  import { CoinbaseWalletSDK } from '@depay/coinbase-wallet-sdk';
8
8
 
9
- 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; }
9
+ 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; }
10
10
  class Transaction$1 {
11
11
 
12
12
  constructor({ blockchain, from, to, value, api, method, params, instructions, sent, succeeded, failed }) {
@@ -17,7 +17,7 @@ class Transaction$1 {
17
17
  this.to = (to && to.match('0x')) ? ethers.utils.getAddress(to) : to;
18
18
 
19
19
  // optional
20
- this.value = _optionalChain$f([Transaction$1, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
20
+ this.value = _optionalChain$e([Transaction$1, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
21
21
  this.api = api;
22
22
  this.method = method;
23
23
  this.params = params;
@@ -185,7 +185,7 @@ let supported$3 = ['ethereum', 'bsc', 'polygon', 'velas'];
185
185
  supported$3.evm = ['ethereum', 'bsc', 'polygon', 'velas'];
186
186
  supported$3.solana = [];
187
187
 
188
- 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; }
188
+ 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; }
189
189
  class WindowEthereum {
190
190
 
191
191
  static __initStatic() {this.info = {
@@ -196,12 +196,12 @@ class WindowEthereum {
196
196
 
197
197
  static __initStatic2() {this.isAvailable = ()=>{
198
198
  return (
199
- _optionalChain$e([window, 'optionalAccess', _13 => _13.ethereum]) &&
199
+ _optionalChain$d([window, 'optionalAccess', _13 => _13.ethereum]) &&
200
200
  Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)/)).length != 1 && // MetaMask
201
- !_optionalChain$e([window, 'optionalAccess', _14 => _14.coin98]) && // Coin98
202
- !(_optionalChain$e([window, 'optionalAccess', _15 => _15.ethereum, 'optionalAccess', _16 => _16.isTrust]) || _optionalChain$e([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isTrustWallet])) && // Trust Wallet
203
- !_optionalChain$e([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isDeficonnectProvider]) && // crypto.com
204
- !(_optionalChain$e([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.isCoinbaseWallet]) || _optionalChain$e([window, 'optionalAccess', _23 => _23.ethereum, 'optionalAccess', _24 => _24.isWalletLink]))
201
+ !_optionalChain$d([window, 'optionalAccess', _14 => _14.coin98]) && // Coin98
202
+ !(_optionalChain$d([window, 'optionalAccess', _15 => _15.ethereum, 'optionalAccess', _16 => _16.isTrust]) || _optionalChain$d([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isTrustWallet])) && // Trust Wallet
203
+ !_optionalChain$d([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isDeficonnectProvider]) && // crypto.com
204
+ !(_optionalChain$d([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.isCoinbaseWallet]) || _optionalChain$d([window, 'optionalAccess', _23 => _23.ethereum, 'optionalAccess', _24 => _24.isWalletLink]))
205
205
  )
206
206
  };}
207
207
 
@@ -308,7 +308,7 @@ class WindowEthereum {
308
308
  }
309
309
  } WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
310
310
 
311
- 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; }
311
+ 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; }
312
312
  class Binance extends WindowEthereum {
313
313
 
314
314
  static __initStatic() {this.info = {
@@ -318,7 +318,7 @@ class Binance extends WindowEthereum {
318
318
  };}
319
319
 
320
320
  static __initStatic2() {this.isAvailable = ()=>{
321
- return _optionalChain$d([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
321
+ return _optionalChain$c([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
322
322
  !window.coin98
323
323
  };}
324
324
 
@@ -326,7 +326,7 @@ class Binance extends WindowEthereum {
326
326
 
327
327
  } Binance.__initStatic(); Binance.__initStatic2();
328
328
 
329
- 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; }
329
+ 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; }
330
330
  class Brave extends WindowEthereum {
331
331
 
332
332
  static __initStatic() {this.info = {
@@ -335,10 +335,10 @@ class Brave extends WindowEthereum {
335
335
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
336
336
  };}
337
337
 
338
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$c([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
338
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$b([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
339
339
  } Brave.__initStatic(); Brave.__initStatic2();
340
340
 
341
- 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; }
341
+ 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; }
342
342
  class Coin98 extends WindowEthereum {
343
343
 
344
344
  static __initStatic() {this.info = {
@@ -347,10 +347,10 @@ class Coin98 extends WindowEthereum {
347
347
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
348
348
  };}
349
349
 
350
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$b([window, 'optionalAccess', _2 => _2.coin98]) };}
350
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$a([window, 'optionalAccess', _2 => _2.coin98]) };}
351
351
  } Coin98.__initStatic(); Coin98.__initStatic2();
352
352
 
353
- 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; }
353
+ 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; }
354
354
  class Coinbase extends WindowEthereum {
355
355
 
356
356
  static __initStatic() {this.info = {
@@ -359,10 +359,10 @@ class Coinbase extends WindowEthereum {
359
359
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
360
360
  };}
361
361
 
362
- static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$a([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isCoinbaseWallet]) || _optionalChain$a([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isWalletLink])) };}
362
+ static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$9([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isCoinbaseWallet]) || _optionalChain$9([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isWalletLink])) };}
363
363
  } Coinbase.__initStatic(); Coinbase.__initStatic2();
364
364
 
365
- 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; }
365
+ 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; }
366
366
  class CryptoCom extends WindowEthereum {
367
367
 
368
368
  static __initStatic() {this.info = {
@@ -371,10 +371,10 @@ class CryptoCom extends WindowEthereum {
371
371
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
372
372
  };}
373
373
 
374
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$9([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
374
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
375
375
  } CryptoCom.__initStatic(); CryptoCom.__initStatic2();
376
376
 
377
- 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; }
377
+ 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; }
378
378
  class MetaMask extends WindowEthereum {
379
379
 
380
380
  static __initStatic() {this.info = {
@@ -384,11 +384,11 @@ class MetaMask extends WindowEthereum {
384
384
  };}
385
385
 
386
386
  static __initStatic2() {this.isAvailable = ()=>{
387
- return _optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMetaMask]) && Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)/)).length == 1
387
+ return _optionalChain$7([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMetaMask]) && Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)/)).length == 1
388
388
  };}
389
389
  } MetaMask.__initStatic(); MetaMask.__initStatic2();
390
390
 
391
- 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; }
391
+ 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; }
392
392
  class Opera extends WindowEthereum {
393
393
 
394
394
  static __initStatic() {this.info = {
@@ -397,10 +397,10 @@ class Opera extends WindowEthereum {
397
397
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
398
398
  };}
399
399
 
400
- static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$7([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
400
+ static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$6([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
401
401
  } Opera.__initStatic(); Opera.__initStatic2();
402
402
 
403
- 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; }
403
+ 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; }
404
404
  class Trust extends WindowEthereum {
405
405
 
406
406
  static __initStatic() {this.info = {
@@ -409,7 +409,7 @@ class Trust extends WindowEthereum {
409
409
  blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
410
410
  };}
411
411
 
412
- static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$6([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$6([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) };}
412
+ static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$5([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$5([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) };}
413
413
  } Trust.__initStatic(); Trust.__initStatic2();
414
414
 
415
415
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -59891,7 +59891,6 @@ const getProvider = async (blockchain)=>{
59891
59891
  }
59892
59892
  };
59893
59893
 
59894
- 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; }
59895
59894
  const sendTransaction$3 = async ({ transaction, wallet })=> {
59896
59895
  transaction = new Transaction$1(transaction);
59897
59896
  if((await wallet.connectedTo(transaction.blockchain)) == false) {
@@ -59967,26 +59966,54 @@ const submit$3 = ({ transaction, wallet }) => {
59967
59966
 
59968
59967
  const submitContractInteraction$2 = async ({ transaction, wallet })=>{
59969
59968
  const provider = await getProvider(transaction.blockchain);
59969
+ const gasPrice = await provider.getGasPrice();
59970
+ const gas = await estimate(transaction);
59971
+ const data = await transaction.getData();
59972
+ const value = transaction.value ? ethers.utils.hexlify(ethers.BigNumber.from(transaction.value)) : undefined;
59973
+ const nonce = ethers.utils.hexlify(transaction.nonce);
59974
+ console.log({
59975
+ from: transaction.from,
59976
+ to: transaction.to,
59977
+ value,
59978
+ data,
59979
+ gas: gas.toHexString(),
59980
+ gasPrice: gasPrice.toHexString(),
59981
+ nonce,
59982
+ });
59970
59983
  return wallet.connector.sendTransaction({
59971
59984
  from: transaction.from,
59972
59985
  to: transaction.to,
59973
- value: _optionalChain$5([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]),
59974
- data: await transaction.getData(),
59975
- gas: (await estimate(transaction)).toString(),
59976
- gasPrice: (await provider.getGasPrice()).toString(),
59977
- nonce: transaction.nonce,
59986
+ value,
59987
+ data,
59988
+ gas: gas.toHexString(),
59989
+ gasPrice: gasPrice.toHexString(),
59990
+ nonce,
59978
59991
  })
59979
59992
  };
59980
59993
 
59981
59994
  const submitSimpleTransfer$3 = async ({ transaction, wallet })=>{
59982
59995
  const provider = await getProvider(transaction.blockchain);
59996
+ const gasPrice = await provider.getGasPrice();
59997
+ const gas = await estimate(transaction);
59998
+ const value = ethers.utils.hexlify(ethers.BigNumber.from(transaction.value));
59999
+ const nonce = ethers.utils.hexlify(transaction.nonce);
60000
+ console.log({
60001
+ from: transaction.from,
60002
+ to: transaction.to,
60003
+ value,
60004
+ data: '0x',
60005
+ gas: gas.toHexString(),
60006
+ gasPrice: gasPrice.toHexString(),
60007
+ nonce,
60008
+ });
59983
60009
  return wallet.connector.sendTransaction({
59984
60010
  from: transaction.from,
59985
60011
  to: transaction.to,
59986
- value: _optionalChain$5([transaction, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]),
59987
- gas: (await estimate(transaction)).toString(),
59988
- gasPrice: (await provider.getGasPrice()).toString(),
59989
- nonce: transaction.nonce,
60012
+ value,
60013
+ data: '0x',
60014
+ gas: gas.toHexString(),
60015
+ gasPrice: gasPrice.toHexString(),
60016
+ nonce,
59990
60017
  })
59991
60018
  };
59992
60019
 
@@ -60017,7 +60044,6 @@ class WalletConnectV1 {
60017
60044
  this.name = this.constructor.info.name;
60018
60045
  this.logo = this.constructor.info.logo;
60019
60046
  this.blockchains = this.constructor.info.blockchains;
60020
- this.connector = WalletConnectV1.instance || this.newWalletConnectInstance();
60021
60047
  this.sendTransaction = (transaction)=>{
60022
60048
  return sendTransaction$3({
60023
60049
  wallet: this,
@@ -60026,10 +60052,13 @@ class WalletConnectV1 {
60026
60052
  };
60027
60053
  }
60028
60054
 
60029
- newWalletConnectInstance() {
60055
+ newWalletConnectInstance(connect) {
60030
60056
  let instance = new WalletConnectClient({
60031
- bridge: "https://bridge.walletconnect.org",
60032
- qrcodeModal: QRCodeModal
60057
+ bridge: "https://walletconnect.depay.com",
60058
+ qrcodeModal: {
60059
+ open: async(uri)=>connect({ uri }),
60060
+ close: ()=>{},
60061
+ }
60033
60062
  });
60034
60063
 
60035
60064
  instance.on("connect", (error, payload) => {
@@ -60065,20 +60094,25 @@ class WalletConnectV1 {
60065
60094
  }
60066
60095
 
60067
60096
  async connect(options) {
60097
+ let connect = (options && options.connect) ? options.connect : ({uri})=>{};
60098
+ if(_optionalChain$4([options, 'optionalAccess', _ => _.name])) { this.name = options.name; }
60099
+ if(_optionalChain$4([options, 'optionalAccess', _2 => _2.logo])) { this.logo = options.logo; }
60068
60100
  try {
60069
60101
  window.localStorage.removeItem('walletconnect'); // https://github.com/WalletConnect/walletconnect-monorepo/issues/315
60070
60102
 
60103
+ this.connector = WalletConnectV1.instance;
60104
+
60071
60105
  if(this.connector == undefined){
60072
- this.connector = this.newWalletConnectInstance();
60106
+ this.connector = this.newWalletConnectInstance(connect);
60073
60107
  }
60074
60108
 
60075
60109
  if(this.connector.connected) {
60076
60110
  await this.connector.killSession();
60077
60111
  setConnectedInstance$2(undefined);
60078
- this.connector = this.newWalletConnectInstance();
60112
+ this.connector = this.newWalletConnectInstance(connect);
60079
60113
  }
60080
60114
 
60081
- let { accounts, chainId } = await this.connector.connect({ chainId: _optionalChain$4([options, 'optionalAccess', _ => _.chainId]) });
60115
+ let { accounts, chainId } = await this.connector.connect();
60082
60116
 
60083
60117
  if(accounts instanceof Array && accounts.length) {
60084
60118
  setConnectedInstance$2(this);
@@ -60384,6 +60418,8 @@ class WalletConnectV2 {
60384
60418
  methods: [
60385
60419
  "eth_sendTransaction",
60386
60420
  "personal_sign",
60421
+ "eth_chainId",
60422
+ "wallet_switchEthereumChain",
60387
60423
  ],
60388
60424
  chains: [`${blockchain.namespace}:${blockchain.networkId}`],
60389
60425
  events: [],
@@ -60423,7 +60459,28 @@ class WalletConnectV2 {
60423
60459
 
60424
60460
  switchTo(blockchainName) {
60425
60461
  return new Promise((resolve, reject)=>{
60426
- reject({ code: 'NOT_SUPPORTED' });
60462
+ let resolved, rejected;
60463
+ const blockchain = Blockchain.findByName(blockchainName);
60464
+ setTimeout(async()=>{
60465
+ if(!(await this.connectedTo(blockchainName)) && !resolved && !rejected){
60466
+ reject({ code: 'NOT_SUPPORTED' });
60467
+ } else {
60468
+ resolve();
60469
+ }
60470
+ }, 4000);
60471
+ this.connectedBlockchain = blockchain.name;
60472
+ this.signClient.request({
60473
+ topic: this.session.topic,
60474
+ chainId: this.session.chainId,
60475
+ request:{
60476
+ method: 'wallet_switchEthereumChain',
60477
+ params: [{ chainId: blockchain.id }],
60478
+ }
60479
+ }).then((result)=>{
60480
+ console.log('RESULT ', result);
60481
+ resolved = true;
60482
+ resolve();
60483
+ });
60427
60484
  })
60428
60485
  }
60429
60486