@depay/web3-wallets-evm 16.2.1 → 16.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.evm.js +159 -76
- package/dist/esm/index.js +175 -92
- package/dist/umd/index.evm.js +159 -76
- package/dist/umd/index.js +175 -92
- package/package.json +2 -2
package/dist/esm/index.evm.js
CHANGED
|
@@ -9,7 +9,7 @@ let supported$1 = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanch
|
|
|
9
9
|
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base'];
|
|
10
10
|
supported$1.solana = [];
|
|
11
11
|
|
|
12
|
-
function _optionalChain$
|
|
12
|
+
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; }
|
|
13
13
|
class Transaction {
|
|
14
14
|
|
|
15
15
|
constructor({
|
|
@@ -34,7 +34,7 @@ class Transaction {
|
|
|
34
34
|
this.to = (to && to.match('0x')) ? ethers.utils.getAddress(to) : to;
|
|
35
35
|
|
|
36
36
|
// optional
|
|
37
|
-
this.value = _optionalChain$
|
|
37
|
+
this.value = _optionalChain$i([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
|
|
38
38
|
this.api = api;
|
|
39
39
|
this.method = method;
|
|
40
40
|
this.params = params;
|
|
@@ -74,7 +74,7 @@ class Transaction {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
getParamType(param) {
|
|
77
|
-
if(_optionalChain$
|
|
77
|
+
if(_optionalChain$i([param, 'optionalAccess', _5 => _5.components, 'optionalAccess', _6 => _6.length])) {
|
|
78
78
|
return `(${param.components.map((param)=>this.getParamType(param)).join(',')})`
|
|
79
79
|
} else {
|
|
80
80
|
return param.type
|
|
@@ -224,7 +224,7 @@ const submitSimpleTransfer$3 = ({ transaction, signer })=>{
|
|
|
224
224
|
})
|
|
225
225
|
};
|
|
226
226
|
|
|
227
|
-
function _optionalChain$
|
|
227
|
+
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; }
|
|
228
228
|
|
|
229
229
|
class WindowEthereum {
|
|
230
230
|
|
|
@@ -236,29 +236,31 @@ class WindowEthereum {
|
|
|
236
236
|
|
|
237
237
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
238
238
|
return (
|
|
239
|
-
_optionalChain$
|
|
239
|
+
_optionalChain$h([window, 'optionalAccess', _31 => _31.ethereum]) &&
|
|
240
240
|
// not MetaMask
|
|
241
|
-
!(_optionalChain$
|
|
241
|
+
!(_optionalChain$h([window, 'optionalAccess', _32 => _32.ethereum, 'optionalAccess', _33 => _33.isMetaMask]) && Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length == 1) &&
|
|
242
242
|
// not Coin98
|
|
243
|
-
!_optionalChain$
|
|
243
|
+
!_optionalChain$h([window, 'optionalAccess', _34 => _34.coin98]) &&
|
|
244
244
|
// not Trust Wallet
|
|
245
|
-
!(_optionalChain$
|
|
245
|
+
!(_optionalChain$h([window, 'optionalAccess', _35 => _35.ethereum, 'optionalAccess', _36 => _36.isTrust]) || _optionalChain$h([window, 'optionalAccess', _37 => _37.ethereum, 'optionalAccess', _38 => _38.isTrustWallet])) &&
|
|
246
246
|
// not crypto.com
|
|
247
|
-
!_optionalChain$
|
|
247
|
+
!_optionalChain$h([window, 'optionalAccess', _39 => _39.ethereum, 'optionalAccess', _40 => _40.isDeficonnectProvider]) &&
|
|
248
248
|
// not HyperPay
|
|
249
|
-
!_optionalChain$
|
|
249
|
+
!_optionalChain$h([window, 'optionalAccess', _41 => _41.ethereum, 'optionalAccess', _42 => _42.isHyperPay]) &&
|
|
250
250
|
// not Phantom
|
|
251
|
-
!(window.phantom && !window.glow && !_optionalChain$
|
|
251
|
+
!(window.phantom && !window.glow && !_optionalChain$h([window, 'optionalAccess', _43 => _43.solana, 'optionalAccess', _44 => _44.isGlow]) && !['isBitKeep'].some((identifier)=>window.solana && window.solana[identifier])) &&
|
|
252
252
|
// not Rabby
|
|
253
|
-
!_optionalChain$
|
|
253
|
+
!_optionalChain$h([window, 'optionalAccess', _45 => _45.ethereum, 'optionalAccess', _46 => _46.isRabby]) &&
|
|
254
254
|
// not Backpack
|
|
255
|
-
!_optionalChain$
|
|
255
|
+
!_optionalChain$h([window, 'optionalAccess', _47 => _47.backpack, 'optionalAccess', _48 => _48.isBackpack]) &&
|
|
256
256
|
// not TokenPocket
|
|
257
|
-
!_optionalChain$
|
|
257
|
+
!_optionalChain$h([window, 'optionalAccess', _49 => _49.ethereum, 'optionalAccess', _50 => _50.isTokenPocket]) &&
|
|
258
258
|
// not BitKeep
|
|
259
|
-
!_optionalChain$
|
|
259
|
+
!_optionalChain$h([window, 'optionalAccess', _51 => _51.ethereum, 'optionalAccess', _52 => _52.isBitKeep]) &&
|
|
260
260
|
// not Coinbase
|
|
261
|
-
!(_optionalChain$
|
|
261
|
+
!(_optionalChain$h([window, 'optionalAccess', _53 => _53.ethereum, 'optionalAccess', _54 => _54.isCoinbaseWallet]) || _optionalChain$h([window, 'optionalAccess', _55 => _55.ethereum, 'optionalAccess', _56 => _56.isWalletLink])) &&
|
|
262
|
+
// MetaMask through ProviderMap
|
|
263
|
+
!_optionalChain$h([window, 'optionalAccess', _57 => _57.ethereum, 'optionalAccess', _58 => _58.providerMap, 'optionalAccess', _59 => _59.has, 'call', _60 => _60('MetaMask')])
|
|
262
264
|
)
|
|
263
265
|
};}
|
|
264
266
|
|
|
@@ -384,7 +386,7 @@ class WindowEthereum {
|
|
|
384
386
|
}
|
|
385
387
|
} WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
|
|
386
388
|
|
|
387
|
-
function _optionalChain$
|
|
389
|
+
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; }
|
|
388
390
|
class Binance extends WindowEthereum {
|
|
389
391
|
|
|
390
392
|
static __initStatic() {this.info = {
|
|
@@ -394,7 +396,7 @@ class Binance extends WindowEthereum {
|
|
|
394
396
|
};}
|
|
395
397
|
|
|
396
398
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
397
|
-
return _optionalChain$
|
|
399
|
+
return _optionalChain$g([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
|
|
398
400
|
!window.coin98
|
|
399
401
|
};}
|
|
400
402
|
|
|
@@ -402,7 +404,7 @@ class Binance extends WindowEthereum {
|
|
|
402
404
|
|
|
403
405
|
} Binance.__initStatic(); Binance.__initStatic2();
|
|
404
406
|
|
|
405
|
-
function _optionalChain$
|
|
407
|
+
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; }
|
|
406
408
|
class Brave extends WindowEthereum {
|
|
407
409
|
|
|
408
410
|
static __initStatic() {this.info = {
|
|
@@ -411,10 +413,10 @@ class Brave extends WindowEthereum {
|
|
|
411
413
|
blockchains: supported$1.evm
|
|
412
414
|
};}
|
|
413
415
|
|
|
414
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
416
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$f([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
|
|
415
417
|
} Brave.__initStatic(); Brave.__initStatic2();
|
|
416
418
|
|
|
417
|
-
function _optionalChain$
|
|
419
|
+
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; }
|
|
418
420
|
class Coin98 extends WindowEthereum {
|
|
419
421
|
|
|
420
422
|
static __initStatic() {this.info = {
|
|
@@ -423,10 +425,10 @@ class Coin98 extends WindowEthereum {
|
|
|
423
425
|
blockchains: supported$1.evm
|
|
424
426
|
};}
|
|
425
427
|
|
|
426
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
428
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$e([window, 'optionalAccess', _2 => _2.coin98]) };}
|
|
427
429
|
} Coin98.__initStatic(); Coin98.__initStatic2();
|
|
428
430
|
|
|
429
|
-
function _optionalChain$
|
|
431
|
+
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; }
|
|
430
432
|
class Coinbase extends WindowEthereum {
|
|
431
433
|
|
|
432
434
|
static __initStatic() {this.info = {
|
|
@@ -435,10 +437,26 @@ class Coinbase extends WindowEthereum {
|
|
|
435
437
|
blockchains: supported$1.evm
|
|
436
438
|
};}
|
|
437
439
|
|
|
438
|
-
|
|
440
|
+
getProvider() {
|
|
441
|
+
if(_optionalChain$d([window, 'optionalAccess', _9 => _9.ethereum, 'optionalAccess', _10 => _10.providerMap, 'optionalAccess', _11 => _11.has, 'call', _12 => _12('CoinbaseWallet')])) {
|
|
442
|
+
return _optionalChain$d([window, 'optionalAccess', _13 => _13.ethereum, 'optionalAccess', _14 => _14.providerMap, 'optionalAccess', _15 => _15.get, 'call', _16 => _16('CoinbaseWallet')])
|
|
443
|
+
} else {
|
|
444
|
+
return window.ethereum
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
static __initStatic2() {this.isAvailable = async()=>{
|
|
449
|
+
return(
|
|
450
|
+
(
|
|
451
|
+
_optionalChain$d([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isCoinbaseWallet]) || _optionalChain$d([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isWalletLink])
|
|
452
|
+
) || (
|
|
453
|
+
_optionalChain$d([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.providerMap, 'optionalAccess', _23 => _23.has, 'call', _24 => _24('CoinbaseWallet')])
|
|
454
|
+
)
|
|
455
|
+
)
|
|
456
|
+
};}
|
|
439
457
|
} Coinbase.__initStatic(); Coinbase.__initStatic2();
|
|
440
458
|
|
|
441
|
-
function _optionalChain$
|
|
459
|
+
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; }
|
|
442
460
|
class CryptoCom extends WindowEthereum {
|
|
443
461
|
|
|
444
462
|
static __initStatic() {this.info = {
|
|
@@ -447,10 +465,10 @@ class CryptoCom extends WindowEthereum {
|
|
|
447
465
|
blockchains: supported$1.evm
|
|
448
466
|
};}
|
|
449
467
|
|
|
450
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
468
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$c([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
|
|
451
469
|
} CryptoCom.__initStatic(); CryptoCom.__initStatic2();
|
|
452
470
|
|
|
453
|
-
function _optionalChain$
|
|
471
|
+
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; }
|
|
454
472
|
class HyperPay extends WindowEthereum {
|
|
455
473
|
|
|
456
474
|
static __initStatic() {this.info = {
|
|
@@ -459,10 +477,10 @@ class HyperPay extends WindowEthereum {
|
|
|
459
477
|
blockchains: supported$1.evm
|
|
460
478
|
};}
|
|
461
479
|
|
|
462
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
480
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$b([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isHyperPay]) };}
|
|
463
481
|
} HyperPay.__initStatic(); HyperPay.__initStatic2();
|
|
464
482
|
|
|
465
|
-
function _optionalChain$
|
|
483
|
+
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; }
|
|
466
484
|
class MetaMask extends WindowEthereum {
|
|
467
485
|
|
|
468
486
|
static __initStatic() {this.info = {
|
|
@@ -471,15 +489,27 @@ class MetaMask extends WindowEthereum {
|
|
|
471
489
|
blockchains: supported$1.evm
|
|
472
490
|
};}
|
|
473
491
|
|
|
474
|
-
|
|
492
|
+
getProvider() {
|
|
493
|
+
if(_optionalChain$a([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.providerMap, 'optionalAccess', _9 => _9.has, 'call', _10 => _10('MetaMask')])) {
|
|
494
|
+
return _optionalChain$a([window, 'optionalAccess', _11 => _11.ethereum, 'optionalAccess', _12 => _12.providerMap, 'optionalAccess', _13 => _13.get, 'call', _14 => _14('MetaMask')])
|
|
495
|
+
} else {
|
|
496
|
+
return window.ethereum
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
static __initStatic2() {this.isAvailable = async()=>{
|
|
475
501
|
return(
|
|
476
|
-
|
|
477
|
-
|
|
502
|
+
(
|
|
503
|
+
_optionalChain$a([window, 'optionalAccess', _15 => _15.ethereum, 'optionalAccess', _16 => _16.isMetaMask]) &&
|
|
504
|
+
Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length == 1
|
|
505
|
+
) || (
|
|
506
|
+
_optionalChain$a([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.providerMap, 'optionalAccess', _19 => _19.has, 'call', _20 => _20('MetaMask')])
|
|
507
|
+
)
|
|
478
508
|
)
|
|
479
509
|
};}
|
|
480
510
|
} MetaMask.__initStatic(); MetaMask.__initStatic2();
|
|
481
511
|
|
|
482
|
-
function _optionalChain$
|
|
512
|
+
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; }
|
|
483
513
|
class Opera extends WindowEthereum {
|
|
484
514
|
|
|
485
515
|
static __initStatic() {this.info = {
|
|
@@ -488,10 +518,10 @@ class Opera extends WindowEthereum {
|
|
|
488
518
|
blockchains: supported$1.evm
|
|
489
519
|
};}
|
|
490
520
|
|
|
491
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
521
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$9([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
|
|
492
522
|
} Opera.__initStatic(); Opera.__initStatic2();
|
|
493
523
|
|
|
494
|
-
function _optionalChain$
|
|
524
|
+
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; }
|
|
495
525
|
class Rabby extends WindowEthereum {
|
|
496
526
|
|
|
497
527
|
static __initStatic() {this.info = {
|
|
@@ -502,12 +532,12 @@ class Rabby extends WindowEthereum {
|
|
|
502
532
|
|
|
503
533
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
504
534
|
return(
|
|
505
|
-
_optionalChain$
|
|
535
|
+
_optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isRabby])
|
|
506
536
|
)
|
|
507
537
|
};}
|
|
508
538
|
} Rabby.__initStatic(); Rabby.__initStatic2();
|
|
509
539
|
|
|
510
|
-
function _optionalChain$
|
|
540
|
+
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; }
|
|
511
541
|
class TokenPocket extends WindowEthereum {
|
|
512
542
|
|
|
513
543
|
static __initStatic() {this.info = {
|
|
@@ -518,12 +548,12 @@ class TokenPocket extends WindowEthereum {
|
|
|
518
548
|
|
|
519
549
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
520
550
|
return (
|
|
521
|
-
_optionalChain$
|
|
551
|
+
_optionalChain$7([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isTokenPocket])
|
|
522
552
|
)
|
|
523
553
|
};}
|
|
524
554
|
} TokenPocket.__initStatic(); TokenPocket.__initStatic2();
|
|
525
555
|
|
|
526
|
-
function _optionalChain$
|
|
556
|
+
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; }
|
|
527
557
|
class Trust extends WindowEthereum {
|
|
528
558
|
|
|
529
559
|
static __initStatic() {this.info = {
|
|
@@ -534,7 +564,7 @@ class Trust extends WindowEthereum {
|
|
|
534
564
|
|
|
535
565
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
536
566
|
return (
|
|
537
|
-
(_optionalChain$
|
|
567
|
+
(_optionalChain$6([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$6([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) &&
|
|
538
568
|
Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!Debug)(?!TrustWallet)(?!MetaMask)(?!PocketUniverse)(?!RevokeCash)/)).length == 1
|
|
539
569
|
)
|
|
540
570
|
};}
|
|
@@ -629,7 +659,7 @@ const getSmartContractWallet = async(blockchain, address)=> {
|
|
|
629
659
|
}
|
|
630
660
|
};
|
|
631
661
|
|
|
632
|
-
function _optionalChain$
|
|
662
|
+
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; }
|
|
633
663
|
|
|
634
664
|
const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
635
665
|
transaction = new Transaction(transaction);
|
|
@@ -641,6 +671,7 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
641
671
|
let transactionCount = await wallet.transactionCount({ blockchain: transaction.blockchain, address: transaction.from });
|
|
642
672
|
transaction.nonce = transactionCount;
|
|
643
673
|
await submit$2({ transaction, wallet }).then((tx)=>{
|
|
674
|
+
console.log('tx', tx);
|
|
644
675
|
if (tx) {
|
|
645
676
|
let blockchain = Blockchains.findByName(transaction.blockchain);
|
|
646
677
|
transaction.id = tx;
|
|
@@ -650,7 +681,7 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
650
681
|
transaction.id = sentTransaction.hash || transaction.id;
|
|
651
682
|
transaction.url = blockchain.explorerUrlFor({ transaction });
|
|
652
683
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
653
|
-
sentTransaction
|
|
684
|
+
retrieveConfirmedTransaction$2(sentTransaction).then(()=>{
|
|
654
685
|
transaction._succeeded = true;
|
|
655
686
|
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
656
687
|
}).catch((error)=>{
|
|
@@ -677,6 +708,23 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
677
708
|
return transaction
|
|
678
709
|
};
|
|
679
710
|
|
|
711
|
+
const retrieveConfirmedTransaction$2 = (sentTransaction)=>{
|
|
712
|
+
return new Promise((resolve, reject)=>{
|
|
713
|
+
|
|
714
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
715
|
+
if(_optionalChain$5([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]) === "TypeError: Cannot read properties of undefined (reading 'message')") {
|
|
716
|
+
setTimeout(()=>{
|
|
717
|
+
retrieveConfirmedTransaction$2(sentTransaction)
|
|
718
|
+
.then(resolve)
|
|
719
|
+
.catch(reject);
|
|
720
|
+
}, 500);
|
|
721
|
+
} else {
|
|
722
|
+
reject(error);
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
})
|
|
726
|
+
};
|
|
727
|
+
|
|
680
728
|
const retrieveTransaction$1 = async ({ blockchain, tx, smartContractWallet })=>{
|
|
681
729
|
const provider = await getProvider(blockchain);
|
|
682
730
|
let retrieve = async()=>{
|
|
@@ -709,7 +757,7 @@ const submit$2 = ({ transaction, wallet }) => {
|
|
|
709
757
|
const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
710
758
|
const provider = await getProvider(transaction.blockchain);
|
|
711
759
|
let gasPrice = await provider.getGasPrice();
|
|
712
|
-
if(_optionalChain$
|
|
760
|
+
if(_optionalChain$5([wallet, 'access', _3 => _3.session, 'optionalAccess', _4 => _4.peerMeta, 'optionalAccess', _5 => _5.name]) === 'Uniswap Wallet') {
|
|
713
761
|
gasPrice = undefined;
|
|
714
762
|
} else {
|
|
715
763
|
gasPrice = gasPrice.toHexString();
|
|
@@ -733,7 +781,7 @@ const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
|
733
781
|
const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
734
782
|
const provider = await getProvider(transaction.blockchain);
|
|
735
783
|
let gasPrice = await provider.getGasPrice();
|
|
736
|
-
if(_optionalChain$
|
|
784
|
+
if(_optionalChain$5([wallet, 'access', _6 => _6.session, 'optionalAccess', _7 => _7.peerMeta, 'optionalAccess', _8 => _8.name]) === 'Uniswap Wallet') {
|
|
737
785
|
gasPrice = undefined;
|
|
738
786
|
} else {
|
|
739
787
|
gasPrice = gasPrice.toHexString();
|
|
@@ -752,7 +800,7 @@ const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
|
752
800
|
})
|
|
753
801
|
};
|
|
754
802
|
|
|
755
|
-
function _optionalChain$
|
|
803
|
+
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; }
|
|
756
804
|
|
|
757
805
|
const KEY$1 = '_DePayWeb3WalletsConnectedWalletConnectV1Instance';
|
|
758
806
|
|
|
@@ -895,8 +943,8 @@ class WalletConnectV1 {
|
|
|
895
943
|
let session = await this.connector.connect();
|
|
896
944
|
this.session = session;
|
|
897
945
|
|
|
898
|
-
if(_optionalChain$
|
|
899
|
-
if(_optionalChain$
|
|
946
|
+
if(_optionalChain$4([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$1+'_name'] = this.name = options.name; }
|
|
947
|
+
if(_optionalChain$4([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$1+'_logo'] = this.logo = options.logo; }
|
|
900
948
|
|
|
901
949
|
if(session.accounts instanceof Array && session.accounts.length) {
|
|
902
950
|
setConnectedInstance$1(this);
|
|
@@ -1040,7 +1088,7 @@ class WalletConnectV1 {
|
|
|
1040
1088
|
WalletConnectV1.getConnectedInstance = getConnectedInstance$2;
|
|
1041
1089
|
WalletConnectV1.setConnectedInstance = setConnectedInstance$1;
|
|
1042
1090
|
|
|
1043
|
-
function _optionalChain$
|
|
1091
|
+
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; }
|
|
1044
1092
|
|
|
1045
1093
|
const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
1046
1094
|
transaction = new Transaction(transaction);
|
|
@@ -1063,7 +1111,7 @@ const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
|
1063
1111
|
console.log('Error retrieving transaction');
|
|
1064
1112
|
if(transaction.failed) transaction.failed(transaction, 'Error retrieving transaction');
|
|
1065
1113
|
} else {
|
|
1066
|
-
sentTransaction
|
|
1114
|
+
retrieveConfirmedTransaction$1(sentTransaction).then(() => {
|
|
1067
1115
|
transaction._succeeded = true;
|
|
1068
1116
|
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
1069
1117
|
}).catch((error)=>{
|
|
@@ -1090,6 +1138,23 @@ const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
|
1090
1138
|
return transaction
|
|
1091
1139
|
};
|
|
1092
1140
|
|
|
1141
|
+
const retrieveConfirmedTransaction$1 = (sentTransaction)=>{
|
|
1142
|
+
return new Promise((resolve, reject)=>{
|
|
1143
|
+
|
|
1144
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1145
|
+
if(_optionalChain$3([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]) === "TypeError: Cannot read properties of undefined (reading 'message')") {
|
|
1146
|
+
setTimeout(()=>{
|
|
1147
|
+
retrieveConfirmedTransaction$1(sentTransaction)
|
|
1148
|
+
.then(resolve)
|
|
1149
|
+
.catch(reject);
|
|
1150
|
+
}, 500);
|
|
1151
|
+
} else {
|
|
1152
|
+
reject(error);
|
|
1153
|
+
}
|
|
1154
|
+
});
|
|
1155
|
+
})
|
|
1156
|
+
};
|
|
1157
|
+
|
|
1093
1158
|
const retrieveTransaction = async (tx, blockchain)=>{
|
|
1094
1159
|
let sentTransaction;
|
|
1095
1160
|
const provider = await getProvider(blockchain);
|
|
@@ -1125,7 +1190,7 @@ const submitContractInteraction$1 = async ({ transaction, wallet })=>{
|
|
|
1125
1190
|
params: [{
|
|
1126
1191
|
from: transaction.from,
|
|
1127
1192
|
to: transaction.to,
|
|
1128
|
-
value: _optionalChain$
|
|
1193
|
+
value: _optionalChain$3([transaction, 'access', _3 => _3.value, 'optionalAccess', _4 => _4.toString, 'call', _5 => _5()]),
|
|
1129
1194
|
data: await transaction.getData(),
|
|
1130
1195
|
gas: gas.toHexString(),
|
|
1131
1196
|
gasPrice: gasPrice.toHexString(),
|
|
@@ -1148,7 +1213,7 @@ const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
|
1148
1213
|
params: [{
|
|
1149
1214
|
from: transaction.from,
|
|
1150
1215
|
to: transaction.to,
|
|
1151
|
-
value: _optionalChain$
|
|
1216
|
+
value: _optionalChain$3([transaction, 'access', _6 => _6.value, 'optionalAccess', _7 => _7.toString, 'call', _8 => _8()]),
|
|
1152
1217
|
gas: gas.toHexString(),
|
|
1153
1218
|
gasPrice: gasPrice.toHexString(),
|
|
1154
1219
|
nonce: transaction.nonce
|
|
@@ -1157,7 +1222,7 @@ const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
|
1157
1222
|
}).catch((e)=>{console.log('ERROR', e);})
|
|
1158
1223
|
};
|
|
1159
1224
|
|
|
1160
|
-
function _optionalChain$
|
|
1225
|
+
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; }
|
|
1161
1226
|
|
|
1162
1227
|
const KEY = 'depay:wallets:wc2';
|
|
1163
1228
|
|
|
@@ -1260,11 +1325,11 @@ const getLastSession = async(walletName)=>{
|
|
|
1260
1325
|
};
|
|
1261
1326
|
|
|
1262
1327
|
const getWalletConnectV2Config = (walletName)=>{
|
|
1263
|
-
const methods = _optionalChain$
|
|
1264
|
-
const events = _optionalChain$
|
|
1328
|
+
const methods = _optionalChain$2([CONFIGURATIONS, 'access', _ => _[walletName], 'optionalAccess', _2 => _2.methods]) || DEFAULT_CONFIGURATION.methods;
|
|
1329
|
+
const events = _optionalChain$2([CONFIGURATIONS, 'access', _3 => _3[walletName], 'optionalAccess', _4 => _4.events]) || DEFAULT_CONFIGURATION.events;
|
|
1265
1330
|
|
|
1266
1331
|
let requiredNamespaces = {};
|
|
1267
|
-
if(_optionalChain$
|
|
1332
|
+
if(_optionalChain$2([CONFIGURATIONS, 'access', _5 => _5[walletName], 'optionalAccess', _6 => _6.requiredNamespaces])) {
|
|
1268
1333
|
requiredNamespaces = CONFIGURATIONS[walletName].requiredNamespaces;
|
|
1269
1334
|
} else {
|
|
1270
1335
|
requiredNamespaces['eip155'] = {
|
|
@@ -1275,14 +1340,14 @@ const getWalletConnectV2Config = (walletName)=>{
|
|
|
1275
1340
|
requiredNamespaces['eip155'].events = events;
|
|
1276
1341
|
|
|
1277
1342
|
let optionalNamespaces = {};
|
|
1278
|
-
if(_optionalChain$
|
|
1343
|
+
if(_optionalChain$2([CONFIGURATIONS, 'access', _7 => _7[walletName], 'optionalAccess', _8 => _8.optionalNamespaces])) {
|
|
1279
1344
|
optionalNamespaces = CONFIGURATIONS[walletName].optionalNamespaces;
|
|
1280
1345
|
} else {
|
|
1281
1346
|
optionalNamespaces['eip155'] = {
|
|
1282
1347
|
chains: supported$1.evm.map((blockchain)=>`${Blockchains[blockchain].namespace}:${Blockchains[blockchain].networkId}`),
|
|
1283
1348
|
};
|
|
1284
1349
|
}
|
|
1285
|
-
if(_optionalChain$
|
|
1350
|
+
if(_optionalChain$2([optionalNamespaces, 'optionalAccess', _9 => _9.eip155]) && _optionalChain$2([optionalNamespaces, 'optionalAccess', _10 => _10.eip155, 'optionalAccess', _11 => _11.chains, 'optionalAccess', _12 => _12.length])) {
|
|
1286
1351
|
optionalNamespaces['eip155'].methods = methods;
|
|
1287
1352
|
optionalNamespaces['eip155'].events = events;
|
|
1288
1353
|
}
|
|
@@ -1297,9 +1362,9 @@ const getSignClient = ()=>{
|
|
|
1297
1362
|
projectId: localStorage[KEY+":projectId"],
|
|
1298
1363
|
metadata: {
|
|
1299
1364
|
name: document.title || 'dApp',
|
|
1300
|
-
description: _optionalChain$
|
|
1365
|
+
description: _optionalChain$2([document, 'access', _13 => _13.querySelector, 'call', _14 => _14('meta[name="description"]'), 'optionalAccess', _15 => _15.getAttribute, 'call', _16 => _16('content')]) || document.title || 'dApp',
|
|
1301
1366
|
url: location.href,
|
|
1302
|
-
icons: [_optionalChain$
|
|
1367
|
+
icons: [_optionalChain$2([document, 'access', _17 => _17.querySelector, 'call', _18 => _18("link[rel~='icon'], link[rel~='shortcut icon']"), 'optionalAccess', _19 => _19.href]) || `${location.origin}/favicon.ico`]
|
|
1303
1368
|
}
|
|
1304
1369
|
});
|
|
1305
1370
|
resolve(signClient);
|
|
@@ -1317,7 +1382,7 @@ class WalletConnectV2 {
|
|
|
1317
1382
|
};}
|
|
1318
1383
|
|
|
1319
1384
|
static __initStatic2() {this.isAvailable = async(options)=>{
|
|
1320
|
-
return !! await getLastSession(_optionalChain$
|
|
1385
|
+
return !! await getLastSession(_optionalChain$2([options, 'optionalAccess', _21 => _21.walletName]))
|
|
1321
1386
|
};}
|
|
1322
1387
|
|
|
1323
1388
|
constructor() {
|
|
@@ -1332,19 +1397,19 @@ class WalletConnectV2 {
|
|
|
1332
1397
|
}
|
|
1333
1398
|
|
|
1334
1399
|
async account() {
|
|
1335
|
-
if(_optionalChain$
|
|
1400
|
+
if(_optionalChain$2([this, 'access', _22 => _22.session, 'optionalAccess', _23 => _23.namespaces, 'optionalAccess', _24 => _24.eip155, 'optionalAccess', _25 => _25.accounts, 'optionalAccess', _26 => _26.length])) {
|
|
1336
1401
|
return this.session.namespaces.eip155.accounts[0].split(':')[2]
|
|
1337
1402
|
}
|
|
1338
1403
|
}
|
|
1339
1404
|
|
|
1340
1405
|
async setSessionBlockchains() {
|
|
1341
1406
|
if(!this.session) { return }
|
|
1342
|
-
if(_optionalChain$
|
|
1343
|
-
this.blockchains = [this.session.namespaces.eip155.chains[this.session.namespaces.eip155.chains.length-1]].map((chainIdentifier)=>_optionalChain$
|
|
1407
|
+
if(_optionalChain$2([CONFIGURATIONS, 'access', _27 => _27[this.walletName], 'optionalAccess', _28 => _28.methods, 'optionalAccess', _29 => _29.includes, 'call', _30 => _30('wallet_switchEthereumChain')])) {
|
|
1408
|
+
this.blockchains = [this.session.namespaces.eip155.chains[this.session.namespaces.eip155.chains.length-1]].map((chainIdentifier)=>_optionalChain$2([Blockchains, 'access', _31 => _31.findByNetworkId, 'call', _32 => _32(chainIdentifier.split(':')[1]), 'optionalAccess', _33 => _33.name])).filter(Boolean);
|
|
1344
1409
|
} else if(this.session.namespaces.eip155.chains) {
|
|
1345
|
-
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$
|
|
1410
|
+
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$2([Blockchains, 'access', _34 => _34.findByNetworkId, 'call', _35 => _35(chainIdentifier.split(':')[1]), 'optionalAccess', _36 => _36.name])).filter(Boolean);
|
|
1346
1411
|
} else if(this.session.namespaces.eip155.accounts) {
|
|
1347
|
-
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$
|
|
1412
|
+
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$2([Blockchains, 'access', _37 => _37.findByNetworkId, 'call', _38 => _38(accountIdentifier.split(':')[1]), 'optionalAccess', _39 => _39.name])).filter(Boolean);
|
|
1348
1413
|
}
|
|
1349
1414
|
}
|
|
1350
1415
|
|
|
@@ -1354,13 +1419,13 @@ class WalletConnectV2 {
|
|
|
1354
1419
|
|
|
1355
1420
|
try {
|
|
1356
1421
|
|
|
1357
|
-
this.walletName = _optionalChain$
|
|
1422
|
+
this.walletName = _optionalChain$2([options, 'optionalAccess', _40 => _40.name]);
|
|
1358
1423
|
|
|
1359
1424
|
// delete localStorage[`wc@2:client:0.3//session`] // DELETE WC SESSIONS
|
|
1360
1425
|
this.signClient = await getSignClient();
|
|
1361
1426
|
|
|
1362
1427
|
this.signClient.on("session_delete", (session)=> {
|
|
1363
|
-
if(_optionalChain$
|
|
1428
|
+
if(_optionalChain$2([session, 'optionalAccess', _41 => _41.topic]) === _optionalChain$2([this, 'access', _42 => _42.session, 'optionalAccess', _43 => _43.topic])) {
|
|
1364
1429
|
localStorage[KEY+':name'] = undefined;
|
|
1365
1430
|
localStorage[KEY+':logo'] = undefined;
|
|
1366
1431
|
this.signClient = undefined;
|
|
@@ -1369,14 +1434,14 @@ class WalletConnectV2 {
|
|
|
1369
1434
|
});
|
|
1370
1435
|
|
|
1371
1436
|
this.signClient.on("session_update", async(session)=> {
|
|
1372
|
-
if(_optionalChain$
|
|
1437
|
+
if(_optionalChain$2([session, 'optionalAccess', _44 => _44.topic]) === _optionalChain$2([this, 'access', _45 => _45.session, 'optionalAccess', _46 => _46.topic])) {
|
|
1373
1438
|
this.session = this.signClient.session.get(session.topic);
|
|
1374
1439
|
await this.setSessionBlockchains();
|
|
1375
1440
|
}
|
|
1376
1441
|
});
|
|
1377
1442
|
|
|
1378
1443
|
this.signClient.on("session_event", (event)=> {
|
|
1379
|
-
if(_optionalChain$
|
|
1444
|
+
if(_optionalChain$2([event, 'optionalAccess', _47 => _47.topic]) === _optionalChain$2([this, 'access', _48 => _48.session, 'optionalAccess', _49 => _49.topic])) {}
|
|
1380
1445
|
});
|
|
1381
1446
|
|
|
1382
1447
|
const connectWallet = async()=>{
|
|
@@ -1387,24 +1452,24 @@ class WalletConnectV2 {
|
|
|
1387
1452
|
await new Promise(resolve=>setTimeout(resolve, 500)); // to prevent race condition within WalletConnect
|
|
1388
1453
|
};
|
|
1389
1454
|
|
|
1390
|
-
const lastSession = _optionalChain$
|
|
1455
|
+
const lastSession = _optionalChain$2([this, 'optionalAccess', _50 => _50.walletName, 'optionalAccess', _51 => _51.length]) ? await getLastSession(this.walletName) : undefined;
|
|
1391
1456
|
if(lastSession) {
|
|
1392
1457
|
this.session = lastSession;
|
|
1393
1458
|
} else {
|
|
1394
1459
|
await connectWallet();
|
|
1395
1460
|
}
|
|
1396
1461
|
|
|
1397
|
-
let meta = _optionalChain$
|
|
1462
|
+
let meta = _optionalChain$2([this, 'access', _52 => _52.session, 'optionalAccess', _53 => _53.peer, 'optionalAccess', _54 => _54.metadata]);
|
|
1398
1463
|
if(meta && meta.name) {
|
|
1399
1464
|
this.name = meta.name;
|
|
1400
1465
|
localStorage[KEY+':name'] = meta.name;
|
|
1401
|
-
if(_optionalChain$
|
|
1466
|
+
if(_optionalChain$2([meta, 'optionalAccess', _55 => _55.icons]) && meta.icons.length) {
|
|
1402
1467
|
this.logo = meta.icons[0];
|
|
1403
1468
|
localStorage[KEY+':logo'] = this.logo;
|
|
1404
1469
|
}
|
|
1405
1470
|
}
|
|
1406
|
-
if(_optionalChain$
|
|
1407
|
-
if(_optionalChain$
|
|
1471
|
+
if(_optionalChain$2([options, 'optionalAccess', _56 => _56.name])) { localStorage[KEY+':name'] = this.name = options.name; }
|
|
1472
|
+
if(_optionalChain$2([options, 'optionalAccess', _57 => _57.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
|
|
1408
1473
|
|
|
1409
1474
|
await this.setSessionBlockchains();
|
|
1410
1475
|
|
|
@@ -1461,7 +1526,7 @@ class WalletConnectV2 {
|
|
|
1461
1526
|
switch (event) {
|
|
1462
1527
|
case 'account':
|
|
1463
1528
|
internalCallback = async(event)=> {
|
|
1464
|
-
if(_optionalChain$
|
|
1529
|
+
if(_optionalChain$2([event, 'optionalAccess', _58 => _58.topic]) === _optionalChain$2([this, 'access', _59 => _59.session, 'optionalAccess', _60 => _60.topic]) && event.params.event.name === 'accountsChanged') {
|
|
1465
1530
|
callback(await this.account());
|
|
1466
1531
|
}
|
|
1467
1532
|
};
|
|
@@ -1521,6 +1586,7 @@ class WalletConnectV2 {
|
|
|
1521
1586
|
|
|
1522
1587
|
WalletConnectV2.getConnectedInstance = getConnectedInstance$1;
|
|
1523
1588
|
|
|
1589
|
+
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; }
|
|
1524
1590
|
const sendTransaction = async ({ transaction, wallet })=> {
|
|
1525
1591
|
transaction = new Transaction(transaction);
|
|
1526
1592
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
@@ -1538,7 +1604,7 @@ const sendTransaction = async ({ transaction, wallet })=> {
|
|
|
1538
1604
|
transaction.nonce = sentTransaction.nonce;
|
|
1539
1605
|
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
1540
1606
|
if (transaction.sent) transaction.sent(transaction);
|
|
1541
|
-
sentTransaction
|
|
1607
|
+
retrieveConfirmedTransaction(sentTransaction).then(() => {
|
|
1542
1608
|
transaction._succeeded = true;
|
|
1543
1609
|
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
1544
1610
|
}).catch((error)=>{
|
|
@@ -1566,6 +1632,23 @@ const sendTransaction = async ({ transaction, wallet })=> {
|
|
|
1566
1632
|
return transaction
|
|
1567
1633
|
};
|
|
1568
1634
|
|
|
1635
|
+
const retrieveConfirmedTransaction = (sentTransaction)=>{
|
|
1636
|
+
return new Promise((resolve, reject)=>{
|
|
1637
|
+
|
|
1638
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1639
|
+
if(_optionalChain$1([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]) === "TypeError: Cannot read properties of undefined (reading 'message')") {
|
|
1640
|
+
setTimeout(()=>{
|
|
1641
|
+
retrieveConfirmedTransaction(sentTransaction)
|
|
1642
|
+
.then(resolve)
|
|
1643
|
+
.catch(reject);
|
|
1644
|
+
}, 500);
|
|
1645
|
+
} else {
|
|
1646
|
+
reject(error);
|
|
1647
|
+
}
|
|
1648
|
+
});
|
|
1649
|
+
})
|
|
1650
|
+
};
|
|
1651
|
+
|
|
1569
1652
|
const submit = ({ transaction, provider, signer }) => {
|
|
1570
1653
|
if(transaction.method) {
|
|
1571
1654
|
return submitContractInteraction({ transaction, signer, provider })
|