@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.js
CHANGED
|
@@ -6,7 +6,7 @@ import { WalletConnectClient } from '@depay/walletconnect-v1';
|
|
|
6
6
|
import { SignClient } from '@depay/walletconnect-v2';
|
|
7
7
|
import { CoinbaseWalletSDK } from '@depay/coinbase-wallet-sdk';
|
|
8
8
|
|
|
9
|
-
function _optionalChain$
|
|
9
|
+
function _optionalChain$o(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
10
10
|
class Transaction {
|
|
11
11
|
|
|
12
12
|
constructor({
|
|
@@ -31,7 +31,7 @@ class Transaction {
|
|
|
31
31
|
this.to = (to && to.match('0x')) ? ethers.utils.getAddress(to) : to;
|
|
32
32
|
|
|
33
33
|
// optional
|
|
34
|
-
this.value = _optionalChain$
|
|
34
|
+
this.value = _optionalChain$o([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
|
|
35
35
|
this.api = api;
|
|
36
36
|
this.method = method;
|
|
37
37
|
this.params = params;
|
|
@@ -71,7 +71,7 @@ class Transaction {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
getParamType(param) {
|
|
74
|
-
if(_optionalChain$
|
|
74
|
+
if(_optionalChain$o([param, 'optionalAccess', _5 => _5.components, 'optionalAccess', _6 => _6.length])) {
|
|
75
75
|
return `(${param.components.map((param)=>this.getParamType(param)).join(',')})`
|
|
76
76
|
} else {
|
|
77
77
|
return param.type
|
|
@@ -144,7 +144,7 @@ class Transaction {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
function _optionalChain$
|
|
147
|
+
function _optionalChain$n(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; }
|
|
148
148
|
|
|
149
149
|
const POLL_SPEED = 500; // 0.5 seconds
|
|
150
150
|
const MAX_POLLS = 240; // 120 seconds
|
|
@@ -165,14 +165,14 @@ const sendTransaction$4 = async ({ transaction, wallet })=> {
|
|
|
165
165
|
|
|
166
166
|
const provider = await getProvider(transaction.blockchain);
|
|
167
167
|
const { value } = await provider.getSignatureStatus(signature);
|
|
168
|
-
const confirmationStatus = _optionalChain$
|
|
168
|
+
const confirmationStatus = _optionalChain$n([value, 'optionalAccess', _ => _.confirmationStatus]);
|
|
169
169
|
if(confirmationStatus) {
|
|
170
170
|
const hasReachedSufficientCommitment = confirmationStatus === 'confirmed' || confirmationStatus === 'finalized';
|
|
171
171
|
if (hasReachedSufficientCommitment) {
|
|
172
172
|
if(value.err) {
|
|
173
173
|
transaction._failed = true;
|
|
174
174
|
const confirmedTransaction = await provider.getConfirmedTransaction(signature);
|
|
175
|
-
const failedReason = _optionalChain$
|
|
175
|
+
const failedReason = _optionalChain$n([confirmedTransaction, 'optionalAccess', _2 => _2.meta, 'optionalAccess', _3 => _3.logMessages]) ? confirmedTransaction.meta.logMessages[confirmedTransaction.meta.logMessages.length - 1] : null;
|
|
176
176
|
if(transaction.failed) transaction.failed(transaction, failedReason);
|
|
177
177
|
} else {
|
|
178
178
|
transaction._succeeded = true;
|
|
@@ -263,7 +263,7 @@ let supported$1 = ['ethereum', 'bsc', 'polygon', 'solana', 'fantom', 'arbitrum',
|
|
|
263
263
|
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'gnosis', 'optimism', 'base'];
|
|
264
264
|
supported$1.solana = ['solana'];
|
|
265
265
|
|
|
266
|
-
function _optionalChain$
|
|
266
|
+
function _optionalChain$m(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; }
|
|
267
267
|
class WindowSolana {
|
|
268
268
|
|
|
269
269
|
static __initStatic() {this.info = {
|
|
@@ -274,13 +274,13 @@ class WindowSolana {
|
|
|
274
274
|
|
|
275
275
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
276
276
|
return (
|
|
277
|
-
_optionalChain$
|
|
277
|
+
_optionalChain$m([window, 'optionalAccess', _5 => _5.solana]) &&
|
|
278
278
|
// not Phantom
|
|
279
279
|
!(window.phantom && !window.glow && !window.solana.isGlow && !['isBitKeep'].some((identifier)=>window.solana && window.solana[identifier])) &&
|
|
280
280
|
// not Coin98
|
|
281
281
|
!window.coin98 &&
|
|
282
282
|
// not BitKeep
|
|
283
|
-
!(_optionalChain$
|
|
283
|
+
!(_optionalChain$m([window, 'optionalAccess', _6 => _6.solana]) && _optionalChain$m([window, 'optionalAccess', _7 => _7.solana, 'access', _8 => _8.isBitKeep])) &&
|
|
284
284
|
// not Glow
|
|
285
285
|
!window.solana.isGlow
|
|
286
286
|
)
|
|
@@ -329,7 +329,7 @@ class WindowSolana {
|
|
|
329
329
|
let internalCallback;
|
|
330
330
|
switch (event) {
|
|
331
331
|
case 'account':
|
|
332
|
-
internalCallback = (publicKey) => callback(_optionalChain$
|
|
332
|
+
internalCallback = (publicKey) => callback(_optionalChain$m([publicKey, 'optionalAccess', _9 => _9.toString, 'call', _10 => _10()]));
|
|
333
333
|
this.getProvider().on('accountChanged', internalCallback);
|
|
334
334
|
break
|
|
335
335
|
}
|
|
@@ -382,7 +382,7 @@ class WindowSolana {
|
|
|
382
382
|
}
|
|
383
383
|
} WindowSolana.__initStatic(); WindowSolana.__initStatic2();
|
|
384
384
|
|
|
385
|
-
function _optionalChain$
|
|
385
|
+
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; }
|
|
386
386
|
|
|
387
387
|
class Backpack extends WindowSolana {
|
|
388
388
|
|
|
@@ -394,7 +394,7 @@ class Backpack extends WindowSolana {
|
|
|
394
394
|
|
|
395
395
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
396
396
|
return (
|
|
397
|
-
_optionalChain$
|
|
397
|
+
_optionalChain$l([window, 'optionalAccess', _2 => _2.backpack]) &&
|
|
398
398
|
window.backpack.isBackpack
|
|
399
399
|
)
|
|
400
400
|
};}
|
|
@@ -489,7 +489,7 @@ const submitSimpleTransfer$3 = ({ transaction, signer })=>{
|
|
|
489
489
|
})
|
|
490
490
|
};
|
|
491
491
|
|
|
492
|
-
function _optionalChain$
|
|
492
|
+
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; }
|
|
493
493
|
|
|
494
494
|
class WindowEthereum {
|
|
495
495
|
|
|
@@ -501,29 +501,31 @@ class WindowEthereum {
|
|
|
501
501
|
|
|
502
502
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
503
503
|
return (
|
|
504
|
-
_optionalChain$
|
|
504
|
+
_optionalChain$k([window, 'optionalAccess', _31 => _31.ethereum]) &&
|
|
505
505
|
// not MetaMask
|
|
506
|
-
!(_optionalChain$
|
|
506
|
+
!(_optionalChain$k([window, 'optionalAccess', _32 => _32.ethereum, 'optionalAccess', _33 => _33.isMetaMask]) && Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length == 1) &&
|
|
507
507
|
// not Coin98
|
|
508
|
-
!_optionalChain$
|
|
508
|
+
!_optionalChain$k([window, 'optionalAccess', _34 => _34.coin98]) &&
|
|
509
509
|
// not Trust Wallet
|
|
510
|
-
!(_optionalChain$
|
|
510
|
+
!(_optionalChain$k([window, 'optionalAccess', _35 => _35.ethereum, 'optionalAccess', _36 => _36.isTrust]) || _optionalChain$k([window, 'optionalAccess', _37 => _37.ethereum, 'optionalAccess', _38 => _38.isTrustWallet])) &&
|
|
511
511
|
// not crypto.com
|
|
512
|
-
!_optionalChain$
|
|
512
|
+
!_optionalChain$k([window, 'optionalAccess', _39 => _39.ethereum, 'optionalAccess', _40 => _40.isDeficonnectProvider]) &&
|
|
513
513
|
// not HyperPay
|
|
514
|
-
!_optionalChain$
|
|
514
|
+
!_optionalChain$k([window, 'optionalAccess', _41 => _41.ethereum, 'optionalAccess', _42 => _42.isHyperPay]) &&
|
|
515
515
|
// not Phantom
|
|
516
|
-
!(window.phantom && !window.glow && !_optionalChain$
|
|
516
|
+
!(window.phantom && !window.glow && !_optionalChain$k([window, 'optionalAccess', _43 => _43.solana, 'optionalAccess', _44 => _44.isGlow]) && !['isBitKeep'].some((identifier)=>window.solana && window.solana[identifier])) &&
|
|
517
517
|
// not Rabby
|
|
518
|
-
!_optionalChain$
|
|
518
|
+
!_optionalChain$k([window, 'optionalAccess', _45 => _45.ethereum, 'optionalAccess', _46 => _46.isRabby]) &&
|
|
519
519
|
// not Backpack
|
|
520
|
-
!_optionalChain$
|
|
520
|
+
!_optionalChain$k([window, 'optionalAccess', _47 => _47.backpack, 'optionalAccess', _48 => _48.isBackpack]) &&
|
|
521
521
|
// not TokenPocket
|
|
522
|
-
!_optionalChain$
|
|
522
|
+
!_optionalChain$k([window, 'optionalAccess', _49 => _49.ethereum, 'optionalAccess', _50 => _50.isTokenPocket]) &&
|
|
523
523
|
// not BitKeep
|
|
524
|
-
!_optionalChain$
|
|
524
|
+
!_optionalChain$k([window, 'optionalAccess', _51 => _51.ethereum, 'optionalAccess', _52 => _52.isBitKeep]) &&
|
|
525
525
|
// not Coinbase
|
|
526
|
-
!(_optionalChain$
|
|
526
|
+
!(_optionalChain$k([window, 'optionalAccess', _53 => _53.ethereum, 'optionalAccess', _54 => _54.isCoinbaseWallet]) || _optionalChain$k([window, 'optionalAccess', _55 => _55.ethereum, 'optionalAccess', _56 => _56.isWalletLink])) &&
|
|
527
|
+
// MetaMask through ProviderMap
|
|
528
|
+
!_optionalChain$k([window, 'optionalAccess', _57 => _57.ethereum, 'optionalAccess', _58 => _58.providerMap, 'optionalAccess', _59 => _59.has, 'call', _60 => _60('MetaMask')])
|
|
527
529
|
)
|
|
528
530
|
};}
|
|
529
531
|
|
|
@@ -649,7 +651,7 @@ class WindowEthereum {
|
|
|
649
651
|
}
|
|
650
652
|
} WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
|
|
651
653
|
|
|
652
|
-
function _optionalChain$
|
|
654
|
+
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; }
|
|
653
655
|
class Binance extends WindowEthereum {
|
|
654
656
|
|
|
655
657
|
static __initStatic() {this.info = {
|
|
@@ -659,7 +661,7 @@ class Binance extends WindowEthereum {
|
|
|
659
661
|
};}
|
|
660
662
|
|
|
661
663
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
662
|
-
return _optionalChain$
|
|
664
|
+
return _optionalChain$j([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
|
|
663
665
|
!window.coin98
|
|
664
666
|
};}
|
|
665
667
|
|
|
@@ -667,7 +669,7 @@ class Binance extends WindowEthereum {
|
|
|
667
669
|
|
|
668
670
|
} Binance.__initStatic(); Binance.__initStatic2();
|
|
669
671
|
|
|
670
|
-
function _optionalChain$
|
|
672
|
+
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; }
|
|
671
673
|
class Brave extends WindowEthereum {
|
|
672
674
|
|
|
673
675
|
static __initStatic() {this.info = {
|
|
@@ -676,10 +678,10 @@ class Brave extends WindowEthereum {
|
|
|
676
678
|
blockchains: supported$1.evm
|
|
677
679
|
};}
|
|
678
680
|
|
|
679
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
681
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$i([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
|
|
680
682
|
} Brave.__initStatic(); Brave.__initStatic2();
|
|
681
683
|
|
|
682
|
-
function _optionalChain$
|
|
684
|
+
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; }
|
|
683
685
|
class Coin98 extends WindowEthereum {
|
|
684
686
|
|
|
685
687
|
static __initStatic() {this.info = {
|
|
@@ -688,10 +690,10 @@ class Coin98 extends WindowEthereum {
|
|
|
688
690
|
blockchains: supported$1.evm
|
|
689
691
|
};}
|
|
690
692
|
|
|
691
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
693
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$h([window, 'optionalAccess', _2 => _2.coin98]) };}
|
|
692
694
|
} Coin98.__initStatic(); Coin98.__initStatic2();
|
|
693
695
|
|
|
694
|
-
function _optionalChain$
|
|
696
|
+
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; }
|
|
695
697
|
class Coinbase extends WindowEthereum {
|
|
696
698
|
|
|
697
699
|
static __initStatic() {this.info = {
|
|
@@ -700,10 +702,26 @@ class Coinbase extends WindowEthereum {
|
|
|
700
702
|
blockchains: supported$1.evm
|
|
701
703
|
};}
|
|
702
704
|
|
|
703
|
-
|
|
705
|
+
getProvider() {
|
|
706
|
+
if(_optionalChain$g([window, 'optionalAccess', _9 => _9.ethereum, 'optionalAccess', _10 => _10.providerMap, 'optionalAccess', _11 => _11.has, 'call', _12 => _12('CoinbaseWallet')])) {
|
|
707
|
+
return _optionalChain$g([window, 'optionalAccess', _13 => _13.ethereum, 'optionalAccess', _14 => _14.providerMap, 'optionalAccess', _15 => _15.get, 'call', _16 => _16('CoinbaseWallet')])
|
|
708
|
+
} else {
|
|
709
|
+
return window.ethereum
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
static __initStatic2() {this.isAvailable = async()=>{
|
|
714
|
+
return(
|
|
715
|
+
(
|
|
716
|
+
_optionalChain$g([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isCoinbaseWallet]) || _optionalChain$g([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isWalletLink])
|
|
717
|
+
) || (
|
|
718
|
+
_optionalChain$g([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.providerMap, 'optionalAccess', _23 => _23.has, 'call', _24 => _24('CoinbaseWallet')])
|
|
719
|
+
)
|
|
720
|
+
)
|
|
721
|
+
};}
|
|
704
722
|
} Coinbase.__initStatic(); Coinbase.__initStatic2();
|
|
705
723
|
|
|
706
|
-
function _optionalChain$
|
|
724
|
+
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; }
|
|
707
725
|
class CryptoCom extends WindowEthereum {
|
|
708
726
|
|
|
709
727
|
static __initStatic() {this.info = {
|
|
@@ -712,7 +730,7 @@ class CryptoCom extends WindowEthereum {
|
|
|
712
730
|
blockchains: supported$1.evm
|
|
713
731
|
};}
|
|
714
732
|
|
|
715
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
733
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$f([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
|
|
716
734
|
} CryptoCom.__initStatic(); CryptoCom.__initStatic2();
|
|
717
735
|
|
|
718
736
|
class Glow extends WindowSolana {
|
|
@@ -731,7 +749,7 @@ class Glow extends WindowSolana {
|
|
|
731
749
|
};}
|
|
732
750
|
} Glow.__initStatic(); Glow.__initStatic2();
|
|
733
751
|
|
|
734
|
-
function _optionalChain$
|
|
752
|
+
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; }
|
|
735
753
|
class HyperPay extends WindowEthereum {
|
|
736
754
|
|
|
737
755
|
static __initStatic() {this.info = {
|
|
@@ -740,10 +758,10 @@ class HyperPay extends WindowEthereum {
|
|
|
740
758
|
blockchains: supported$1.evm
|
|
741
759
|
};}
|
|
742
760
|
|
|
743
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
761
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$e([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isHyperPay]) };}
|
|
744
762
|
} HyperPay.__initStatic(); HyperPay.__initStatic2();
|
|
745
763
|
|
|
746
|
-
function _optionalChain$
|
|
764
|
+
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; }
|
|
747
765
|
class MetaMask extends WindowEthereum {
|
|
748
766
|
|
|
749
767
|
static __initStatic() {this.info = {
|
|
@@ -752,15 +770,27 @@ class MetaMask extends WindowEthereum {
|
|
|
752
770
|
blockchains: supported$1.evm
|
|
753
771
|
};}
|
|
754
772
|
|
|
755
|
-
|
|
773
|
+
getProvider() {
|
|
774
|
+
if(_optionalChain$d([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.providerMap, 'optionalAccess', _9 => _9.has, 'call', _10 => _10('MetaMask')])) {
|
|
775
|
+
return _optionalChain$d([window, 'optionalAccess', _11 => _11.ethereum, 'optionalAccess', _12 => _12.providerMap, 'optionalAccess', _13 => _13.get, 'call', _14 => _14('MetaMask')])
|
|
776
|
+
} else {
|
|
777
|
+
return window.ethereum
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
static __initStatic2() {this.isAvailable = async()=>{
|
|
756
782
|
return(
|
|
757
|
-
|
|
758
|
-
|
|
783
|
+
(
|
|
784
|
+
_optionalChain$d([window, 'optionalAccess', _15 => _15.ethereum, 'optionalAccess', _16 => _16.isMetaMask]) &&
|
|
785
|
+
Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!PocketUniverse)(?!RevokeCash)/)).length == 1
|
|
786
|
+
) || (
|
|
787
|
+
_optionalChain$d([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.providerMap, 'optionalAccess', _19 => _19.has, 'call', _20 => _20('MetaMask')])
|
|
788
|
+
)
|
|
759
789
|
)
|
|
760
790
|
};}
|
|
761
791
|
} MetaMask.__initStatic(); MetaMask.__initStatic2();
|
|
762
792
|
|
|
763
|
-
function _optionalChain$
|
|
793
|
+
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; }
|
|
764
794
|
class Opera extends WindowEthereum {
|
|
765
795
|
|
|
766
796
|
static __initStatic() {this.info = {
|
|
@@ -769,10 +799,10 @@ class Opera extends WindowEthereum {
|
|
|
769
799
|
blockchains: supported$1.evm
|
|
770
800
|
};}
|
|
771
801
|
|
|
772
|
-
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$
|
|
802
|
+
static __initStatic2() {this.isAvailable = async()=>{ return _optionalChain$c([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
|
|
773
803
|
} Opera.__initStatic(); Opera.__initStatic2();
|
|
774
804
|
|
|
775
|
-
function _optionalChain$
|
|
805
|
+
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; }
|
|
776
806
|
class Phantom extends WindowSolana {
|
|
777
807
|
|
|
778
808
|
static __initStatic() {this.info = {
|
|
@@ -785,13 +815,13 @@ class Phantom extends WindowSolana {
|
|
|
785
815
|
return (
|
|
786
816
|
window.phantom &&
|
|
787
817
|
!window.glow &&
|
|
788
|
-
!_optionalChain$
|
|
818
|
+
!_optionalChain$b([window, 'optionalAccess', _3 => _3.solana, 'optionalAccess', _4 => _4.isGlow]) &&
|
|
789
819
|
!['isBitKeep'].some((identifier)=>window.solana && window.solana[identifier])
|
|
790
820
|
)
|
|
791
821
|
};}
|
|
792
822
|
} Phantom.__initStatic(); Phantom.__initStatic2();
|
|
793
823
|
|
|
794
|
-
function _optionalChain$
|
|
824
|
+
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; }
|
|
795
825
|
class Rabby extends WindowEthereum {
|
|
796
826
|
|
|
797
827
|
static __initStatic() {this.info = {
|
|
@@ -802,12 +832,12 @@ class Rabby extends WindowEthereum {
|
|
|
802
832
|
|
|
803
833
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
804
834
|
return(
|
|
805
|
-
_optionalChain$
|
|
835
|
+
_optionalChain$a([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isRabby])
|
|
806
836
|
)
|
|
807
837
|
};}
|
|
808
838
|
} Rabby.__initStatic(); Rabby.__initStatic2();
|
|
809
839
|
|
|
810
|
-
function _optionalChain$
|
|
840
|
+
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; }
|
|
811
841
|
|
|
812
842
|
|
|
813
843
|
const KEY$2 = '_DePayWeb3WalletsConnectedSolanaMobileWalletInstance';
|
|
@@ -898,8 +928,8 @@ class SolanaMobileWalletAdapter {
|
|
|
898
928
|
await transact(
|
|
899
929
|
async (wallet) => {
|
|
900
930
|
await this.authorize(wallet);
|
|
901
|
-
if(_optionalChain$
|
|
902
|
-
if(_optionalChain$
|
|
931
|
+
if(_optionalChain$9([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$2+'_name'] = this.name = options.name; }
|
|
932
|
+
if(_optionalChain$9([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$2+'_logo'] = this.logo = options.logo; }
|
|
903
933
|
}
|
|
904
934
|
);
|
|
905
935
|
return this._account
|
|
@@ -958,7 +988,7 @@ class SolanaMobileWalletAdapter {
|
|
|
958
988
|
}
|
|
959
989
|
} SolanaMobileWalletAdapter.__initStatic(); SolanaMobileWalletAdapter.__initStatic2();
|
|
960
990
|
|
|
961
|
-
function _optionalChain$
|
|
991
|
+
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; }
|
|
962
992
|
class Solflare extends WindowSolana {
|
|
963
993
|
|
|
964
994
|
static __initStatic() {this.info = {
|
|
@@ -969,7 +999,7 @@ class Solflare extends WindowSolana {
|
|
|
969
999
|
|
|
970
1000
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
971
1001
|
return (
|
|
972
|
-
_optionalChain$
|
|
1002
|
+
_optionalChain$8([window, 'optionalAccess', _2 => _2.solflare]) &&
|
|
973
1003
|
window.solflare.isSolflare
|
|
974
1004
|
)
|
|
975
1005
|
};}
|
|
@@ -979,7 +1009,7 @@ class Solflare extends WindowSolana {
|
|
|
979
1009
|
_sendTransaction(transaction) { return this.getProvider().signTransaction(transaction) }
|
|
980
1010
|
} Solflare.__initStatic(); Solflare.__initStatic2();
|
|
981
1011
|
|
|
982
|
-
function _optionalChain$
|
|
1012
|
+
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; }
|
|
983
1013
|
class TokenPocket extends WindowEthereum {
|
|
984
1014
|
|
|
985
1015
|
static __initStatic() {this.info = {
|
|
@@ -990,12 +1020,12 @@ class TokenPocket extends WindowEthereum {
|
|
|
990
1020
|
|
|
991
1021
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
992
1022
|
return (
|
|
993
|
-
_optionalChain$
|
|
1023
|
+
_optionalChain$7([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isTokenPocket])
|
|
994
1024
|
)
|
|
995
1025
|
};}
|
|
996
1026
|
} TokenPocket.__initStatic(); TokenPocket.__initStatic2();
|
|
997
1027
|
|
|
998
|
-
function _optionalChain$
|
|
1028
|
+
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; }
|
|
999
1029
|
class Trust extends WindowEthereum {
|
|
1000
1030
|
|
|
1001
1031
|
static __initStatic() {this.info = {
|
|
@@ -1006,7 +1036,7 @@ class Trust extends WindowEthereum {
|
|
|
1006
1036
|
|
|
1007
1037
|
static __initStatic2() {this.isAvailable = async()=>{
|
|
1008
1038
|
return (
|
|
1009
|
-
(_optionalChain$
|
|
1039
|
+
(_optionalChain$6([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$6([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) &&
|
|
1010
1040
|
Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)(?!Debug)(?!TrustWallet)(?!MetaMask)(?!PocketUniverse)(?!RevokeCash)/)).length == 1
|
|
1011
1041
|
)
|
|
1012
1042
|
};}
|
|
@@ -1101,7 +1131,7 @@ const getSmartContractWallet = async(blockchain, address)=> {
|
|
|
1101
1131
|
}
|
|
1102
1132
|
};
|
|
1103
1133
|
|
|
1104
|
-
function _optionalChain$
|
|
1134
|
+
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; }
|
|
1105
1135
|
|
|
1106
1136
|
const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
1107
1137
|
transaction = new Transaction(transaction);
|
|
@@ -1113,6 +1143,7 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
1113
1143
|
let transactionCount = await wallet.transactionCount({ blockchain: transaction.blockchain, address: transaction.from });
|
|
1114
1144
|
transaction.nonce = transactionCount;
|
|
1115
1145
|
await submit$2({ transaction, wallet }).then((tx)=>{
|
|
1146
|
+
console.log('tx', tx);
|
|
1116
1147
|
if (tx) {
|
|
1117
1148
|
let blockchain = Blockchains.findByName(transaction.blockchain);
|
|
1118
1149
|
transaction.id = tx;
|
|
@@ -1122,7 +1153,7 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
1122
1153
|
transaction.id = sentTransaction.hash || transaction.id;
|
|
1123
1154
|
transaction.url = blockchain.explorerUrlFor({ transaction });
|
|
1124
1155
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
1125
|
-
sentTransaction
|
|
1156
|
+
retrieveConfirmedTransaction$2(sentTransaction).then(()=>{
|
|
1126
1157
|
transaction._succeeded = true;
|
|
1127
1158
|
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
1128
1159
|
}).catch((error)=>{
|
|
@@ -1149,6 +1180,23 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
1149
1180
|
return transaction
|
|
1150
1181
|
};
|
|
1151
1182
|
|
|
1183
|
+
const retrieveConfirmedTransaction$2 = (sentTransaction)=>{
|
|
1184
|
+
return new Promise((resolve, reject)=>{
|
|
1185
|
+
|
|
1186
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1187
|
+
if(_optionalChain$5([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]) === "TypeError: Cannot read properties of undefined (reading 'message')") {
|
|
1188
|
+
setTimeout(()=>{
|
|
1189
|
+
retrieveConfirmedTransaction$2(sentTransaction)
|
|
1190
|
+
.then(resolve)
|
|
1191
|
+
.catch(reject);
|
|
1192
|
+
}, 500);
|
|
1193
|
+
} else {
|
|
1194
|
+
reject(error);
|
|
1195
|
+
}
|
|
1196
|
+
});
|
|
1197
|
+
})
|
|
1198
|
+
};
|
|
1199
|
+
|
|
1152
1200
|
const retrieveTransaction$1 = async ({ blockchain, tx, smartContractWallet })=>{
|
|
1153
1201
|
const provider = await getProvider(blockchain);
|
|
1154
1202
|
let retrieve = async()=>{
|
|
@@ -1181,7 +1229,7 @@ const submit$2 = ({ transaction, wallet }) => {
|
|
|
1181
1229
|
const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
1182
1230
|
const provider = await getProvider(transaction.blockchain);
|
|
1183
1231
|
let gasPrice = await provider.getGasPrice();
|
|
1184
|
-
if(_optionalChain$
|
|
1232
|
+
if(_optionalChain$5([wallet, 'access', _3 => _3.session, 'optionalAccess', _4 => _4.peerMeta, 'optionalAccess', _5 => _5.name]) === 'Uniswap Wallet') {
|
|
1185
1233
|
gasPrice = undefined;
|
|
1186
1234
|
} else {
|
|
1187
1235
|
gasPrice = gasPrice.toHexString();
|
|
@@ -1205,7 +1253,7 @@ const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
|
1205
1253
|
const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
1206
1254
|
const provider = await getProvider(transaction.blockchain);
|
|
1207
1255
|
let gasPrice = await provider.getGasPrice();
|
|
1208
|
-
if(_optionalChain$
|
|
1256
|
+
if(_optionalChain$5([wallet, 'access', _6 => _6.session, 'optionalAccess', _7 => _7.peerMeta, 'optionalAccess', _8 => _8.name]) === 'Uniswap Wallet') {
|
|
1209
1257
|
gasPrice = undefined;
|
|
1210
1258
|
} else {
|
|
1211
1259
|
gasPrice = gasPrice.toHexString();
|
|
@@ -1224,7 +1272,7 @@ const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
|
1224
1272
|
})
|
|
1225
1273
|
};
|
|
1226
1274
|
|
|
1227
|
-
function _optionalChain$
|
|
1275
|
+
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; }
|
|
1228
1276
|
|
|
1229
1277
|
const KEY$1 = '_DePayWeb3WalletsConnectedWalletConnectV1Instance';
|
|
1230
1278
|
|
|
@@ -1367,8 +1415,8 @@ class WalletConnectV1 {
|
|
|
1367
1415
|
let session = await this.connector.connect();
|
|
1368
1416
|
this.session = session;
|
|
1369
1417
|
|
|
1370
|
-
if(_optionalChain$
|
|
1371
|
-
if(_optionalChain$
|
|
1418
|
+
if(_optionalChain$4([options, 'optionalAccess', _ => _.name])) { localStorage[KEY$1+'_name'] = this.name = options.name; }
|
|
1419
|
+
if(_optionalChain$4([options, 'optionalAccess', _2 => _2.logo])) { localStorage[KEY$1+'_logo'] = this.logo = options.logo; }
|
|
1372
1420
|
|
|
1373
1421
|
if(session.accounts instanceof Array && session.accounts.length) {
|
|
1374
1422
|
setConnectedInstance$1(this);
|
|
@@ -1512,7 +1560,7 @@ class WalletConnectV1 {
|
|
|
1512
1560
|
WalletConnectV1.getConnectedInstance = getConnectedInstance$2;
|
|
1513
1561
|
WalletConnectV1.setConnectedInstance = setConnectedInstance$1;
|
|
1514
1562
|
|
|
1515
|
-
function _optionalChain$
|
|
1563
|
+
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; }
|
|
1516
1564
|
|
|
1517
1565
|
const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
1518
1566
|
transaction = new Transaction(transaction);
|
|
@@ -1535,7 +1583,7 @@ const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
|
1535
1583
|
console.log('Error retrieving transaction');
|
|
1536
1584
|
if(transaction.failed) transaction.failed(transaction, 'Error retrieving transaction');
|
|
1537
1585
|
} else {
|
|
1538
|
-
sentTransaction
|
|
1586
|
+
retrieveConfirmedTransaction$1(sentTransaction).then(() => {
|
|
1539
1587
|
transaction._succeeded = true;
|
|
1540
1588
|
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
1541
1589
|
}).catch((error)=>{
|
|
@@ -1562,6 +1610,23 @@ const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
|
1562
1610
|
return transaction
|
|
1563
1611
|
};
|
|
1564
1612
|
|
|
1613
|
+
const retrieveConfirmedTransaction$1 = (sentTransaction)=>{
|
|
1614
|
+
return new Promise((resolve, reject)=>{
|
|
1615
|
+
|
|
1616
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
1617
|
+
if(_optionalChain$3([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]) === "TypeError: Cannot read properties of undefined (reading 'message')") {
|
|
1618
|
+
setTimeout(()=>{
|
|
1619
|
+
retrieveConfirmedTransaction$1(sentTransaction)
|
|
1620
|
+
.then(resolve)
|
|
1621
|
+
.catch(reject);
|
|
1622
|
+
}, 500);
|
|
1623
|
+
} else {
|
|
1624
|
+
reject(error);
|
|
1625
|
+
}
|
|
1626
|
+
});
|
|
1627
|
+
})
|
|
1628
|
+
};
|
|
1629
|
+
|
|
1565
1630
|
const retrieveTransaction = async (tx, blockchain)=>{
|
|
1566
1631
|
let sentTransaction;
|
|
1567
1632
|
const provider = await getProvider(blockchain);
|
|
@@ -1597,7 +1662,7 @@ const submitContractInteraction$1 = async ({ transaction, wallet })=>{
|
|
|
1597
1662
|
params: [{
|
|
1598
1663
|
from: transaction.from,
|
|
1599
1664
|
to: transaction.to,
|
|
1600
|
-
value: _optionalChain$
|
|
1665
|
+
value: _optionalChain$3([transaction, 'access', _3 => _3.value, 'optionalAccess', _4 => _4.toString, 'call', _5 => _5()]),
|
|
1601
1666
|
data: await transaction.getData(),
|
|
1602
1667
|
gas: gas.toHexString(),
|
|
1603
1668
|
gasPrice: gasPrice.toHexString(),
|
|
@@ -1620,7 +1685,7 @@ const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
|
1620
1685
|
params: [{
|
|
1621
1686
|
from: transaction.from,
|
|
1622
1687
|
to: transaction.to,
|
|
1623
|
-
value: _optionalChain$
|
|
1688
|
+
value: _optionalChain$3([transaction, 'access', _6 => _6.value, 'optionalAccess', _7 => _7.toString, 'call', _8 => _8()]),
|
|
1624
1689
|
gas: gas.toHexString(),
|
|
1625
1690
|
gasPrice: gasPrice.toHexString(),
|
|
1626
1691
|
nonce: transaction.nonce
|
|
@@ -1629,7 +1694,7 @@ const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
|
1629
1694
|
}).catch((e)=>{console.log('ERROR', e);})
|
|
1630
1695
|
};
|
|
1631
1696
|
|
|
1632
|
-
function _optionalChain$
|
|
1697
|
+
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; }
|
|
1633
1698
|
|
|
1634
1699
|
const KEY = 'depay:wallets:wc2';
|
|
1635
1700
|
|
|
@@ -1732,11 +1797,11 @@ const getLastSession = async(walletName)=>{
|
|
|
1732
1797
|
};
|
|
1733
1798
|
|
|
1734
1799
|
const getWalletConnectV2Config = (walletName)=>{
|
|
1735
|
-
const methods = _optionalChain$
|
|
1736
|
-
const events = _optionalChain$
|
|
1800
|
+
const methods = _optionalChain$2([CONFIGURATIONS, 'access', _ => _[walletName], 'optionalAccess', _2 => _2.methods]) || DEFAULT_CONFIGURATION.methods;
|
|
1801
|
+
const events = _optionalChain$2([CONFIGURATIONS, 'access', _3 => _3[walletName], 'optionalAccess', _4 => _4.events]) || DEFAULT_CONFIGURATION.events;
|
|
1737
1802
|
|
|
1738
1803
|
let requiredNamespaces = {};
|
|
1739
|
-
if(_optionalChain$
|
|
1804
|
+
if(_optionalChain$2([CONFIGURATIONS, 'access', _5 => _5[walletName], 'optionalAccess', _6 => _6.requiredNamespaces])) {
|
|
1740
1805
|
requiredNamespaces = CONFIGURATIONS[walletName].requiredNamespaces;
|
|
1741
1806
|
} else {
|
|
1742
1807
|
requiredNamespaces['eip155'] = {
|
|
@@ -1747,14 +1812,14 @@ const getWalletConnectV2Config = (walletName)=>{
|
|
|
1747
1812
|
requiredNamespaces['eip155'].events = events;
|
|
1748
1813
|
|
|
1749
1814
|
let optionalNamespaces = {};
|
|
1750
|
-
if(_optionalChain$
|
|
1815
|
+
if(_optionalChain$2([CONFIGURATIONS, 'access', _7 => _7[walletName], 'optionalAccess', _8 => _8.optionalNamespaces])) {
|
|
1751
1816
|
optionalNamespaces = CONFIGURATIONS[walletName].optionalNamespaces;
|
|
1752
1817
|
} else {
|
|
1753
1818
|
optionalNamespaces['eip155'] = {
|
|
1754
1819
|
chains: supported$1.evm.map((blockchain)=>`${Blockchains[blockchain].namespace}:${Blockchains[blockchain].networkId}`),
|
|
1755
1820
|
};
|
|
1756
1821
|
}
|
|
1757
|
-
if(_optionalChain$
|
|
1822
|
+
if(_optionalChain$2([optionalNamespaces, 'optionalAccess', _9 => _9.eip155]) && _optionalChain$2([optionalNamespaces, 'optionalAccess', _10 => _10.eip155, 'optionalAccess', _11 => _11.chains, 'optionalAccess', _12 => _12.length])) {
|
|
1758
1823
|
optionalNamespaces['eip155'].methods = methods;
|
|
1759
1824
|
optionalNamespaces['eip155'].events = events;
|
|
1760
1825
|
}
|
|
@@ -1769,9 +1834,9 @@ const getSignClient = ()=>{
|
|
|
1769
1834
|
projectId: localStorage[KEY+":projectId"],
|
|
1770
1835
|
metadata: {
|
|
1771
1836
|
name: document.title || 'dApp',
|
|
1772
|
-
description: _optionalChain$
|
|
1837
|
+
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',
|
|
1773
1838
|
url: location.href,
|
|
1774
|
-
icons: [_optionalChain$
|
|
1839
|
+
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`]
|
|
1775
1840
|
}
|
|
1776
1841
|
});
|
|
1777
1842
|
resolve(signClient);
|
|
@@ -1789,7 +1854,7 @@ class WalletConnectV2 {
|
|
|
1789
1854
|
};}
|
|
1790
1855
|
|
|
1791
1856
|
static __initStatic2() {this.isAvailable = async(options)=>{
|
|
1792
|
-
return !! await getLastSession(_optionalChain$
|
|
1857
|
+
return !! await getLastSession(_optionalChain$2([options, 'optionalAccess', _21 => _21.walletName]))
|
|
1793
1858
|
};}
|
|
1794
1859
|
|
|
1795
1860
|
constructor() {
|
|
@@ -1804,19 +1869,19 @@ class WalletConnectV2 {
|
|
|
1804
1869
|
}
|
|
1805
1870
|
|
|
1806
1871
|
async account() {
|
|
1807
|
-
if(_optionalChain$
|
|
1872
|
+
if(_optionalChain$2([this, 'access', _22 => _22.session, 'optionalAccess', _23 => _23.namespaces, 'optionalAccess', _24 => _24.eip155, 'optionalAccess', _25 => _25.accounts, 'optionalAccess', _26 => _26.length])) {
|
|
1808
1873
|
return this.session.namespaces.eip155.accounts[0].split(':')[2]
|
|
1809
1874
|
}
|
|
1810
1875
|
}
|
|
1811
1876
|
|
|
1812
1877
|
async setSessionBlockchains() {
|
|
1813
1878
|
if(!this.session) { return }
|
|
1814
|
-
if(_optionalChain$
|
|
1815
|
-
this.blockchains = [this.session.namespaces.eip155.chains[this.session.namespaces.eip155.chains.length-1]].map((chainIdentifier)=>_optionalChain$
|
|
1879
|
+
if(_optionalChain$2([CONFIGURATIONS, 'access', _27 => _27[this.walletName], 'optionalAccess', _28 => _28.methods, 'optionalAccess', _29 => _29.includes, 'call', _30 => _30('wallet_switchEthereumChain')])) {
|
|
1880
|
+
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);
|
|
1816
1881
|
} else if(this.session.namespaces.eip155.chains) {
|
|
1817
|
-
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$
|
|
1882
|
+
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);
|
|
1818
1883
|
} else if(this.session.namespaces.eip155.accounts) {
|
|
1819
|
-
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$
|
|
1884
|
+
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);
|
|
1820
1885
|
}
|
|
1821
1886
|
}
|
|
1822
1887
|
|
|
@@ -1826,13 +1891,13 @@ class WalletConnectV2 {
|
|
|
1826
1891
|
|
|
1827
1892
|
try {
|
|
1828
1893
|
|
|
1829
|
-
this.walletName = _optionalChain$
|
|
1894
|
+
this.walletName = _optionalChain$2([options, 'optionalAccess', _40 => _40.name]);
|
|
1830
1895
|
|
|
1831
1896
|
// delete localStorage[`wc@2:client:0.3//session`] // DELETE WC SESSIONS
|
|
1832
1897
|
this.signClient = await getSignClient();
|
|
1833
1898
|
|
|
1834
1899
|
this.signClient.on("session_delete", (session)=> {
|
|
1835
|
-
if(_optionalChain$
|
|
1900
|
+
if(_optionalChain$2([session, 'optionalAccess', _41 => _41.topic]) === _optionalChain$2([this, 'access', _42 => _42.session, 'optionalAccess', _43 => _43.topic])) {
|
|
1836
1901
|
localStorage[KEY+':name'] = undefined;
|
|
1837
1902
|
localStorage[KEY+':logo'] = undefined;
|
|
1838
1903
|
this.signClient = undefined;
|
|
@@ -1841,14 +1906,14 @@ class WalletConnectV2 {
|
|
|
1841
1906
|
});
|
|
1842
1907
|
|
|
1843
1908
|
this.signClient.on("session_update", async(session)=> {
|
|
1844
|
-
if(_optionalChain$
|
|
1909
|
+
if(_optionalChain$2([session, 'optionalAccess', _44 => _44.topic]) === _optionalChain$2([this, 'access', _45 => _45.session, 'optionalAccess', _46 => _46.topic])) {
|
|
1845
1910
|
this.session = this.signClient.session.get(session.topic);
|
|
1846
1911
|
await this.setSessionBlockchains();
|
|
1847
1912
|
}
|
|
1848
1913
|
});
|
|
1849
1914
|
|
|
1850
1915
|
this.signClient.on("session_event", (event)=> {
|
|
1851
|
-
if(_optionalChain$
|
|
1916
|
+
if(_optionalChain$2([event, 'optionalAccess', _47 => _47.topic]) === _optionalChain$2([this, 'access', _48 => _48.session, 'optionalAccess', _49 => _49.topic])) {}
|
|
1852
1917
|
});
|
|
1853
1918
|
|
|
1854
1919
|
const connectWallet = async()=>{
|
|
@@ -1859,24 +1924,24 @@ class WalletConnectV2 {
|
|
|
1859
1924
|
await new Promise(resolve=>setTimeout(resolve, 500)); // to prevent race condition within WalletConnect
|
|
1860
1925
|
};
|
|
1861
1926
|
|
|
1862
|
-
const lastSession = _optionalChain$
|
|
1927
|
+
const lastSession = _optionalChain$2([this, 'optionalAccess', _50 => _50.walletName, 'optionalAccess', _51 => _51.length]) ? await getLastSession(this.walletName) : undefined;
|
|
1863
1928
|
if(lastSession) {
|
|
1864
1929
|
this.session = lastSession;
|
|
1865
1930
|
} else {
|
|
1866
1931
|
await connectWallet();
|
|
1867
1932
|
}
|
|
1868
1933
|
|
|
1869
|
-
let meta = _optionalChain$
|
|
1934
|
+
let meta = _optionalChain$2([this, 'access', _52 => _52.session, 'optionalAccess', _53 => _53.peer, 'optionalAccess', _54 => _54.metadata]);
|
|
1870
1935
|
if(meta && meta.name) {
|
|
1871
1936
|
this.name = meta.name;
|
|
1872
1937
|
localStorage[KEY+':name'] = meta.name;
|
|
1873
|
-
if(_optionalChain$
|
|
1938
|
+
if(_optionalChain$2([meta, 'optionalAccess', _55 => _55.icons]) && meta.icons.length) {
|
|
1874
1939
|
this.logo = meta.icons[0];
|
|
1875
1940
|
localStorage[KEY+':logo'] = this.logo;
|
|
1876
1941
|
}
|
|
1877
1942
|
}
|
|
1878
|
-
if(_optionalChain$
|
|
1879
|
-
if(_optionalChain$
|
|
1943
|
+
if(_optionalChain$2([options, 'optionalAccess', _56 => _56.name])) { localStorage[KEY+':name'] = this.name = options.name; }
|
|
1944
|
+
if(_optionalChain$2([options, 'optionalAccess', _57 => _57.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
|
|
1880
1945
|
|
|
1881
1946
|
await this.setSessionBlockchains();
|
|
1882
1947
|
|
|
@@ -1933,7 +1998,7 @@ class WalletConnectV2 {
|
|
|
1933
1998
|
switch (event) {
|
|
1934
1999
|
case 'account':
|
|
1935
2000
|
internalCallback = async(event)=> {
|
|
1936
|
-
if(_optionalChain$
|
|
2001
|
+
if(_optionalChain$2([event, 'optionalAccess', _58 => _58.topic]) === _optionalChain$2([this, 'access', _59 => _59.session, 'optionalAccess', _60 => _60.topic]) && event.params.event.name === 'accountsChanged') {
|
|
1937
2002
|
callback(await this.account());
|
|
1938
2003
|
}
|
|
1939
2004
|
};
|
|
@@ -1993,6 +2058,7 @@ class WalletConnectV2 {
|
|
|
1993
2058
|
|
|
1994
2059
|
WalletConnectV2.getConnectedInstance = getConnectedInstance$1;
|
|
1995
2060
|
|
|
2061
|
+
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; }
|
|
1996
2062
|
const sendTransaction = async ({ transaction, wallet })=> {
|
|
1997
2063
|
transaction = new Transaction(transaction);
|
|
1998
2064
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
@@ -2010,7 +2076,7 @@ const sendTransaction = async ({ transaction, wallet })=> {
|
|
|
2010
2076
|
transaction.nonce = sentTransaction.nonce;
|
|
2011
2077
|
transaction.url = Blockchains.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
2012
2078
|
if (transaction.sent) transaction.sent(transaction);
|
|
2013
|
-
sentTransaction
|
|
2079
|
+
retrieveConfirmedTransaction(sentTransaction).then(() => {
|
|
2014
2080
|
transaction._succeeded = true;
|
|
2015
2081
|
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
2016
2082
|
}).catch((error)=>{
|
|
@@ -2038,6 +2104,23 @@ const sendTransaction = async ({ transaction, wallet })=> {
|
|
|
2038
2104
|
return transaction
|
|
2039
2105
|
};
|
|
2040
2106
|
|
|
2107
|
+
const retrieveConfirmedTransaction = (sentTransaction)=>{
|
|
2108
|
+
return new Promise((resolve, reject)=>{
|
|
2109
|
+
|
|
2110
|
+
sentTransaction.wait(1).then(resolve).catch((error)=>{
|
|
2111
|
+
if(_optionalChain$1([error, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]) === "TypeError: Cannot read properties of undefined (reading 'message')") {
|
|
2112
|
+
setTimeout(()=>{
|
|
2113
|
+
retrieveConfirmedTransaction(sentTransaction)
|
|
2114
|
+
.then(resolve)
|
|
2115
|
+
.catch(reject);
|
|
2116
|
+
}, 500);
|
|
2117
|
+
} else {
|
|
2118
|
+
reject(error);
|
|
2119
|
+
}
|
|
2120
|
+
});
|
|
2121
|
+
})
|
|
2122
|
+
};
|
|
2123
|
+
|
|
2041
2124
|
const submit = ({ transaction, provider, signer }) => {
|
|
2042
2125
|
if(transaction.method) {
|
|
2043
2126
|
return submitContractInteraction({ transaction, signer, provider })
|