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