@depay/web3-wallets-evm 13.1.2 → 14.1.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 +24 -1
- package/dist/esm/index.evm.js +60254 -208
- package/dist/esm/index.js +456 -84
- package/dist/umd/index.evm.js +60262 -216
- package/dist/umd/index.js +459 -88
- package/package.json +3 -1
package/dist/esm/index.js
CHANGED
|
@@ -4,9 +4,10 @@ import { CONSTANTS } from '@depay/web3-constants';
|
|
|
4
4
|
import { PublicKey, Transaction as Transaction$1, SystemProgram } from '@depay/solana-web3.js';
|
|
5
5
|
import { getProvider, request as request$1, estimate } from '@depay/web3-client';
|
|
6
6
|
import { WalletConnectClient, QRCodeModal } from '@depay/walletconnect-v1';
|
|
7
|
+
import { Core, SignClient } from '@depay/walletconnect-v2';
|
|
7
8
|
import { CoinbaseWalletSDK } from '@depay/coinbase-wallet-sdk';
|
|
8
9
|
|
|
9
|
-
function _optionalChain$
|
|
10
|
+
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; }
|
|
10
11
|
class Transaction {
|
|
11
12
|
|
|
12
13
|
constructor({ blockchain, from, to, value, api, method, params, instructions, sent, succeeded, failed }) {
|
|
@@ -17,7 +18,7 @@ class Transaction {
|
|
|
17
18
|
this.to = (to && to.match('0x')) ? ethers.utils.getAddress(to) : to;
|
|
18
19
|
|
|
19
20
|
// optional
|
|
20
|
-
this.value = _optionalChain$
|
|
21
|
+
this.value = _optionalChain$h([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
|
|
21
22
|
this.api = api;
|
|
22
23
|
this.method = method;
|
|
23
24
|
this.params = params;
|
|
@@ -295,7 +296,7 @@ var EVM = {
|
|
|
295
296
|
setProvider: setProvider$1,
|
|
296
297
|
};
|
|
297
298
|
|
|
298
|
-
function _optionalChain$
|
|
299
|
+
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; }
|
|
299
300
|
let getCacheStore = () => {
|
|
300
301
|
if (getWindow()._cacheStore == undefined) {
|
|
301
302
|
resetCache();
|
|
@@ -325,7 +326,7 @@ let set = function ({ key, value, expires }) {
|
|
|
325
326
|
|
|
326
327
|
let get = function ({ key, expires }) {
|
|
327
328
|
let cachedEntry = getCacheStore()[key];
|
|
328
|
-
if (_optionalChain$
|
|
329
|
+
if (_optionalChain$g([cachedEntry, 'optionalAccess', _ => _.expiresAt]) > Date.now()) {
|
|
329
330
|
return cachedEntry.value
|
|
330
331
|
}
|
|
331
332
|
};
|
|
@@ -485,7 +486,7 @@ let request = async function (url, options) {
|
|
|
485
486
|
})
|
|
486
487
|
};
|
|
487
488
|
|
|
488
|
-
const sendTransaction$
|
|
489
|
+
const sendTransaction$4 = async ({ transaction, wallet })=> {
|
|
489
490
|
transaction = new Transaction(transaction);
|
|
490
491
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
491
492
|
await wallet.switchTo(transaction.blockchain);
|
|
@@ -496,9 +497,9 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
496
497
|
await transaction.prepare({ wallet });
|
|
497
498
|
let transactionCount = await request({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
|
|
498
499
|
transaction.nonce = transactionCount;
|
|
499
|
-
let provider = new ethers.providers.Web3Provider(
|
|
500
|
+
let provider = new ethers.providers.Web3Provider(wallet.getProvider(), 'any');
|
|
500
501
|
let signer = provider.getSigner(0);
|
|
501
|
-
await submit$
|
|
502
|
+
await submit$4({ transaction, provider, signer }).then((sentTransaction)=>{
|
|
502
503
|
if (sentTransaction) {
|
|
503
504
|
transaction.id = sentTransaction.hash;
|
|
504
505
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
@@ -532,15 +533,15 @@ const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
|
532
533
|
return transaction
|
|
533
534
|
};
|
|
534
535
|
|
|
535
|
-
const submit$
|
|
536
|
+
const submit$4 = ({ transaction, provider, signer }) => {
|
|
536
537
|
if(transaction.method) {
|
|
537
|
-
return submitContractInteraction$
|
|
538
|
+
return submitContractInteraction$3({ transaction, signer, provider })
|
|
538
539
|
} else {
|
|
539
|
-
return submitSimpleTransfer$
|
|
540
|
+
return submitSimpleTransfer$4({ transaction, signer })
|
|
540
541
|
}
|
|
541
542
|
};
|
|
542
543
|
|
|
543
|
-
const submitContractInteraction$
|
|
544
|
+
const submitContractInteraction$3 = ({ transaction, signer, provider })=>{
|
|
544
545
|
let contract = new ethers.Contract(transaction.to, transaction.api, provider);
|
|
545
546
|
let contractArguments = transaction.getContractArguments({ contract });
|
|
546
547
|
let method = contract.connect(signer)[transaction.method];
|
|
@@ -555,7 +556,7 @@ const submitContractInteraction$2 = ({ transaction, signer, provider })=>{
|
|
|
555
556
|
}
|
|
556
557
|
};
|
|
557
558
|
|
|
558
|
-
const submitSimpleTransfer$
|
|
559
|
+
const submitSimpleTransfer$4 = ({ transaction, signer })=>{
|
|
559
560
|
return signer.sendTransaction({
|
|
560
561
|
to: transaction.to,
|
|
561
562
|
value: Transaction.bigNumberify(transaction.value, transaction.blockchain)
|
|
@@ -566,7 +567,7 @@ let supported$2 = ['ethereum', 'bsc', 'polygon', 'velas'];
|
|
|
566
567
|
supported$2.evm = ['ethereum', 'bsc', 'polygon', 'velas'];
|
|
567
568
|
supported$2.solana = [];
|
|
568
569
|
|
|
569
|
-
function _optionalChain$
|
|
570
|
+
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; }
|
|
570
571
|
class WindowEthereum {
|
|
571
572
|
|
|
572
573
|
static __initStatic() {this.info = {
|
|
@@ -577,9 +578,12 @@ class WindowEthereum {
|
|
|
577
578
|
|
|
578
579
|
static __initStatic2() {this.isAvailable = ()=>{
|
|
579
580
|
return (
|
|
580
|
-
_optionalChain$
|
|
581
|
-
|
|
582
|
-
!
|
|
581
|
+
_optionalChain$f([window, 'optionalAccess', _13 => _13.ethereum]) &&
|
|
582
|
+
Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)/)).length != 1 && // MetaMask
|
|
583
|
+
!_optionalChain$f([window, 'optionalAccess', _14 => _14.coin98]) && // Coin98
|
|
584
|
+
!(_optionalChain$f([window, 'optionalAccess', _15 => _15.ethereum, 'optionalAccess', _16 => _16.isTrust]) || _optionalChain$f([window, 'optionalAccess', _17 => _17.ethereum, 'optionalAccess', _18 => _18.isTrustWallet])) && // Trust Wallet
|
|
585
|
+
!_optionalChain$f([window, 'optionalAccess', _19 => _19.ethereum, 'optionalAccess', _20 => _20.isDeficonnectProvider]) && // crypto.com
|
|
586
|
+
!(_optionalChain$f([window, 'optionalAccess', _21 => _21.ethereum, 'optionalAccess', _22 => _22.isCoinbaseWallet]) || _optionalChain$f([window, 'optionalAccess', _23 => _23.ethereum, 'optionalAccess', _24 => _24.isWalletLink]))
|
|
583
587
|
)
|
|
584
588
|
};}
|
|
585
589
|
|
|
@@ -587,23 +591,25 @@ class WindowEthereum {
|
|
|
587
591
|
this.name = this.constructor.info.name;
|
|
588
592
|
this.logo = this.constructor.info.logo;
|
|
589
593
|
this.blockchains = this.constructor.info.blockchains;
|
|
590
|
-
this.sendTransaction = (transaction)=>{
|
|
591
|
-
return sendTransaction$
|
|
594
|
+
this.sendTransaction = (transaction)=>{
|
|
595
|
+
return sendTransaction$4({
|
|
592
596
|
wallet: this,
|
|
593
597
|
transaction
|
|
594
598
|
})
|
|
595
599
|
};
|
|
596
600
|
}
|
|
597
601
|
|
|
602
|
+
getProvider() { return window.ethereum }
|
|
603
|
+
|
|
598
604
|
async account() {
|
|
599
|
-
if(!
|
|
600
|
-
const accounts = (await
|
|
605
|
+
if(!this.getProvider()) { return undefined }
|
|
606
|
+
const accounts = (await this.getProvider().request({ method: 'eth_accounts' })).map((address)=>ethers.utils.getAddress(address));
|
|
601
607
|
return accounts[0]
|
|
602
608
|
}
|
|
603
609
|
|
|
604
610
|
async connect() {
|
|
605
|
-
if(!
|
|
606
|
-
const accounts = (await
|
|
611
|
+
if(!this.getProvider()) { return undefined }
|
|
612
|
+
const accounts = (await this.getProvider().request({ method: 'eth_requestAccounts' })).map((address)=>ethers.utils.getAddress(address));
|
|
607
613
|
return accounts[0]
|
|
608
614
|
}
|
|
609
615
|
|
|
@@ -612,7 +618,7 @@ class WindowEthereum {
|
|
|
612
618
|
switch (event) {
|
|
613
619
|
case 'account':
|
|
614
620
|
internalCallback = (accounts) => callback(ethers.utils.getAddress(accounts[0]));
|
|
615
|
-
|
|
621
|
+
this.getProvider().on('accountsChanged', internalCallback);
|
|
616
622
|
break
|
|
617
623
|
}
|
|
618
624
|
return internalCallback
|
|
@@ -621,14 +627,14 @@ class WindowEthereum {
|
|
|
621
627
|
off(event, internalCallback) {
|
|
622
628
|
switch (event) {
|
|
623
629
|
case 'account':
|
|
624
|
-
|
|
630
|
+
this.getProvider().removeListener('accountsChanged', internalCallback);
|
|
625
631
|
break
|
|
626
632
|
}
|
|
627
633
|
return internalCallback
|
|
628
634
|
}
|
|
629
635
|
|
|
630
636
|
async connectedTo(input) {
|
|
631
|
-
const blockchain = Blockchain.findById(await
|
|
637
|
+
const blockchain = Blockchain.findById(await this.getProvider().request({ method: 'eth_chainId' }));
|
|
632
638
|
if(input) {
|
|
633
639
|
return input === blockchain.name
|
|
634
640
|
} else {
|
|
@@ -639,7 +645,7 @@ class WindowEthereum {
|
|
|
639
645
|
addNetwork(blockchainName) {
|
|
640
646
|
return new Promise((resolve, reject)=>{
|
|
641
647
|
const blockchain = Blockchain.findByName(blockchainName);
|
|
642
|
-
|
|
648
|
+
this.getProvider().request({
|
|
643
649
|
method: 'wallet_addEthereumChain',
|
|
644
650
|
params: [{
|
|
645
651
|
chainId: blockchain.id,
|
|
@@ -660,7 +666,7 @@ class WindowEthereum {
|
|
|
660
666
|
switchTo(blockchainName) {
|
|
661
667
|
return new Promise((resolve, reject)=>{
|
|
662
668
|
const blockchain = Blockchain.findByName(blockchainName);
|
|
663
|
-
|
|
669
|
+
this.getProvider().request({
|
|
664
670
|
method: 'wallet_switchEthereumChain',
|
|
665
671
|
params: [{ chainId: blockchain.id }],
|
|
666
672
|
}).then(resolve).catch((error)=> {
|
|
@@ -677,14 +683,56 @@ class WindowEthereum {
|
|
|
677
683
|
|
|
678
684
|
async sign(message) {
|
|
679
685
|
await this.account();
|
|
680
|
-
let provider = new ethers.providers.Web3Provider(
|
|
686
|
+
let provider = new ethers.providers.Web3Provider(this.getProvider(), 'any');
|
|
681
687
|
let signer = provider.getSigner(0);
|
|
682
688
|
let signature = await signer.signMessage(message);
|
|
683
689
|
return signature
|
|
684
690
|
}
|
|
685
691
|
} WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
|
|
686
692
|
|
|
687
|
-
function _optionalChain$
|
|
693
|
+
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; }
|
|
694
|
+
class Binance extends WindowEthereum {
|
|
695
|
+
|
|
696
|
+
static __initStatic() {this.info = {
|
|
697
|
+
name: 'Binance',
|
|
698
|
+
logo: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOTIgMTkzLjY4Ij48cmVjdCB3aWR0aD0iMTkyIiBoZWlnaHQ9IjE5My42OCIgZmlsbD0iIzFlMjAyNCIvPjxwYXRoIGQ9Im01Ni45Miw0Ni41M2wzOS4wOC0yMi41NCwzOS4wOCwyMi41NC0xNC4zNSw4LjM2LTI0LjczLTE0LjE4LTI0LjczLDE0LjE4LTE0LjM1LTguMzZabTc4LjE3LDI4LjUzbC0xNC4zNS04LjM2LTI0LjczLDE0LjI3LTI0LjczLTE0LjI3LTE0LjM1LDguMzZ2MTYuNzFsMjQuNzMsMTQuMTh2MjguNDVsMTQuMzUsOC4zNiwxNC4zNS04LjM2di0yOC40NWwyNC43My0xNC4yN3YtMTYuNjNabTAsNDUuMTZ2LTE2LjcxbC0xNC4zNSw4LjM2djE2LjcxbDE0LjM1LTguMzZabTEwLjIxLDUuODJsLTI0LjczLDE0LjI3djE2LjcxbDM5LjA4LTIyLjU0di00NS4yNWwtMTQuMzUsOC4zNnYyOC40NVptLTE0LjM1LTY1LjI1bDE0LjM1LDguMzZ2MTYuNzFsMTQuMzUtOC4zNnYtMTYuNzFsLTE0LjM1LTguMzYtMTQuMzUsOC4zNlptLTQ5LjMsODUuNnYxNi43MWwxNC4zNSw4LjM2LDE0LjM1LTguMzZ2LTE2LjcxbC0xNC4zNSw4LjM2LTE0LjM1LTguMzZabS0yNC43My0yNi4xN2wxNC4zNSw4LjM2di0xNi43MWwtMTQuMzUtOC4zNnYxNi43MVptMjQuNzMtNTkuNDNsMTQuMzUsOC4zNiwxNC4zNS04LjM2LTE0LjM1LTguMzYtMTQuMzUsOC4zNlptLTM0Ljk1LDguMzZsMTQuMzUtOC4zNi0xNC4zNS04LjM2LTE0LjM1LDguMzZ2MTYuNzFsMTQuMzUsOC4zNnYtMTYuNzFabTAsMjguNDVsLTE0LjM1LTguMzZ2NDUuMTZsMzkuMDgsMjIuNTR2LTE2LjcxbC0yNC43My0xNC4yN3MwLTI4LjM2LDAtMjguMzZaIiBmaWxsPSIjZjBiOTBiIi8+PC9zdmc+",
|
|
699
|
+
blockchains: ['ethereum', 'bsc']
|
|
700
|
+
};}
|
|
701
|
+
|
|
702
|
+
static __initStatic2() {this.isAvailable = ()=>{
|
|
703
|
+
return _optionalChain$e([window, 'optionalAccess', _2 => _2.BinanceChain]) &&
|
|
704
|
+
!window.coin98
|
|
705
|
+
};}
|
|
706
|
+
|
|
707
|
+
getProvider() { return window.BinanceChain }
|
|
708
|
+
|
|
709
|
+
} Binance.__initStatic(); Binance.__initStatic2();
|
|
710
|
+
|
|
711
|
+
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; }
|
|
712
|
+
class Brave extends WindowEthereum {
|
|
713
|
+
|
|
714
|
+
static __initStatic() {this.info = {
|
|
715
|
+
name: 'Brave',
|
|
716
|
+
logo: "data:image/svg+xml;base64,PD94bWwgd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mwxOCA4LjVjMSAwLjUgMi41IDAuMyAzLjQtMC40bDUuNy00LjZjMy0yLjQgNS4zLTUuNyA2LjYtOS4zbDEuNi00LjNjMC40LTEgMC4zLTIuOC0wLjEtMy44bC01LjgtMTMuOGMtMC40LTEtMC4yLTIuNSAwLjYtMy40bDI3LjktMjkuN2MwLjgtMC44IDEuOS0yLjIgMi43LTMtMC40LTAuMyAxLjEtMi4xIDEuNi00LjF6Ii8+Cgo8L3N2Zz4K",
|
|
717
|
+
blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
|
|
718
|
+
};}
|
|
719
|
+
|
|
720
|
+
static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$d([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isBraveWallet]) };}
|
|
721
|
+
} Brave.__initStatic(); Brave.__initStatic2();
|
|
722
|
+
|
|
723
|
+
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; }
|
|
724
|
+
class Coin98 extends WindowEthereum {
|
|
725
|
+
|
|
726
|
+
static __initStatic() {this.info = {
|
|
727
|
+
name: 'Coin98',
|
|
728
|
+
logo: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0MC43IDQwIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA0MC43IDQwIiB4bWw6c3BhY2U9InByZXNlcnZlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBmaWxsP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DMuNy0zLjggMy43cy0zLjgtMS43LTMuOC0zLjdjMC0yLjEgMS43LTMuNyAzLjgtMy43IDIuMSAwLjEgMy44IDEuNyAzLjggMy43em0tMTMuNC03LjRjMCAyLjEtMS43IDMuNy0zLjggMy43cy0zLjgtMS43LTMuOC0zLjdjMC0yLjEgMS43LTMuNyAzLjgtMy43IDIuMiAwIDMuOCAxLjYgMy44IDMuN3oiLz4KPC9zdmc+Cg==",
|
|
729
|
+
blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
|
|
730
|
+
};}
|
|
731
|
+
|
|
732
|
+
static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$c([window, 'optionalAccess', _2 => _2.coin98]) };}
|
|
733
|
+
} Coin98.__initStatic(); Coin98.__initStatic2();
|
|
734
|
+
|
|
735
|
+
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; }
|
|
688
736
|
class Coinbase extends WindowEthereum {
|
|
689
737
|
|
|
690
738
|
static __initStatic() {this.info = {
|
|
@@ -693,10 +741,22 @@ class Coinbase extends WindowEthereum {
|
|
|
693
741
|
blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
|
|
694
742
|
};}
|
|
695
743
|
|
|
696
|
-
static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$
|
|
744
|
+
static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$b([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isCoinbaseWallet]) || _optionalChain$b([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isWalletLink])) };}
|
|
697
745
|
} Coinbase.__initStatic(); Coinbase.__initStatic2();
|
|
698
746
|
|
|
699
|
-
function _optionalChain$
|
|
747
|
+
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; }
|
|
748
|
+
class CryptoCom extends WindowEthereum {
|
|
749
|
+
|
|
750
|
+
static __initStatic() {this.info = {
|
|
751
|
+
name: 'Crypto.com',
|
|
752
|
+
logo: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA4OS45IDEwMi44IiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA4OS45IDEwMi44IiB4bWw6c3BhY2U9InByZXNlcnZlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtmaWxsOiNGRkZGRkY7fQoJLnN0MXtmaWxsOiMwMzMxNkM7fQo8L3N0eWxlPgoKPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTUuMzc1MSAtMTEzLjYxKSI+Cgk8ZyB0cmFuc2Zvcm09Im1hdHJpeCguMzE3OTQgMCAwIC4zMTQ2NSAtMS4wNDczIDMwLjQ0NykiPgoJCTxwYXRoIGNsYXNzPSJzdDAiIGQ9Im0xNjEuNiAyNjQuMy0xNDEuNCA4MS42djE2My4zbDE0MS40IDgxLjYgMTQxLjQtODEuNnYtMTYzLjNsLTE0MS40LTgxLjZ6bTAgMC0xNDEuNCA4MS42djE2My4zbDE0MS40IDgxLjYgMTQxLjQtODEuNnYtMTYzLjNsLTE0MS40LTgxLjZ6Ii8+CgkJPHBhdGggY2xhc3M9InN0MSIgZD0ibTIxNy41IDUyNy4xaC0yMC4xbC0yNC4xLTIyLjF2LTExLjNsMjQuOS0yMy44di0zNy43bDMyLjYtMjEuMyAzNy4xIDI4LjEtNTAuNCA4OC4xem0tODMuMy01OS42IDMuNy0zNS40LTEyLjItMzEuN2g3MmwtMTEuOSAzMS43IDMuNCAzNS40aC01NXptMTYuNCAzNy41LTI0LjEgMjIuNGgtMjAuNGwtNTAuNy04OC40IDM3LjQtMjcuOCAzMi45IDIxdjM3LjdsMjQuOSAyMy44djExLjN6bS00NC44LTE3MC4xaDExMS40bDEzLjMgNTYuN2gtMTM3LjdsMTMtNTYuN3ptNTUuOC03MC42LTE0MS40IDgxLjZ2MTYzLjNsMTQxLjQgODEuNiAxNDEuNC04MS42di0xNjMuM2wtMTQxLjQtODEuNnoiLz4KCTwvZz4KPC9nPgo8L3N2Zz4K",
|
|
753
|
+
blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
|
|
754
|
+
};}
|
|
755
|
+
|
|
756
|
+
static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$a([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isDeficonnectProvider]) };}
|
|
757
|
+
} CryptoCom.__initStatic(); CryptoCom.__initStatic2();
|
|
758
|
+
|
|
759
|
+
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; }
|
|
700
760
|
class MetaMask extends WindowEthereum {
|
|
701
761
|
|
|
702
762
|
static __initStatic() {this.info = {
|
|
@@ -705,17 +765,31 @@ class MetaMask extends WindowEthereum {
|
|
|
705
765
|
blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
|
|
706
766
|
};}
|
|
707
767
|
|
|
708
|
-
static __initStatic2() {this.isAvailable = ()=>{
|
|
768
|
+
static __initStatic2() {this.isAvailable = ()=>{
|
|
769
|
+
return _optionalChain$9([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isMetaMask]) && Object.keys(window.ethereum).filter((key)=>key.match(/^is(?!Connected)/)).length == 1
|
|
770
|
+
};}
|
|
709
771
|
} MetaMask.__initStatic(); MetaMask.__initStatic2();
|
|
710
772
|
|
|
711
|
-
function _optionalChain$
|
|
773
|
+
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; }
|
|
774
|
+
class Opera extends WindowEthereum {
|
|
775
|
+
|
|
776
|
+
static __initStatic() {this.info = {
|
|
777
|
+
name: 'Opera',
|
|
778
|
+
logo: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA3NS42IDc1LjYiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxnIHRyYW5zZm9ybT0ibWF0cml4KDEuMzMzMyAwIDAgLTEuMzMzMyAwIDEwNy4yKSI+CiAgCiAgPGxpbmVhckdyYWRpZW50IGlkPSJvcGVyYUxvZ28wMDAwMDAxMjM1MTEiIHgxPSItMTA3LjM0IiB4Mj0iLTEwNi4z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C02ODYwLjQpIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICA8c3RvcCBzdG9wLWNvbG9yPSIjOUMwMDAwIiBvZmZzZXQ9IjAiLz4KICAgIDxzdG9wIHN0b3AtY29sb3I9IiNGRjRCNEIiIG9mZnNldD0iLjciLz4KICAgIDxzdG9wIHN0b3AtY29sb3I9IiNGRjRCNEIiIG9mZnNldD0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHBhdGggZD0ibTE5IDY4YzIuNiAzLjEgNiA0LjkgOS42IDQuOSA4LjMgMCAxNC45LTkuNCAxNC45LTIwLjlzLTYuNy0yMC45LTE0LjktMjAuOWMtMy43IDAtNyAxLjktOS42IDQuOSA0LjEtNS4zIDEwLjEtOC42IDE2LjktOC42IDQuMiAwIDggMS4zIDExLjQgMy41IDUuOCA1LjIgOS41IDEyLjcgOS41IDIxLjFzLTMuNyAxNS45LTkuNSAyMS4xYy0zLjMgMi4yLTcuMiAzLjUtMTEuNCAzLjUtNi44IDAuMS0xMi44LTMuMy0xNi45LTguNiIgZmlsbD0idXJsKCNiKSIvPgo8L2c+Cjwvc3ZnPgo=",
|
|
779
|
+
blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
|
|
780
|
+
};}
|
|
781
|
+
|
|
782
|
+
static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$8([window, 'optionalAccess', _3 => _3.ethereum, 'optionalAccess', _4 => _4.isOpera]) };}
|
|
783
|
+
} Opera.__initStatic(); Opera.__initStatic2();
|
|
784
|
+
|
|
785
|
+
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; }
|
|
712
786
|
const POLL_SPEED = 500; // 0.5 seconds
|
|
713
787
|
const MAX_POLLS = 240; // 120 seconds
|
|
714
788
|
|
|
715
|
-
const sendTransaction$
|
|
789
|
+
const sendTransaction$3 = async ({ transaction, wallet })=> {
|
|
716
790
|
transaction = new Transaction(transaction);
|
|
717
791
|
await transaction.prepare({ wallet });
|
|
718
|
-
await submit$
|
|
792
|
+
await submit$3({ transaction, wallet }).then(({ signature })=>{
|
|
719
793
|
if(signature) {
|
|
720
794
|
transaction.id = signature;
|
|
721
795
|
transaction.url = Blockchain.findByName(transaction.blockchain).explorerUrlFor({ transaction });
|
|
@@ -728,14 +802,14 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
728
802
|
|
|
729
803
|
const provider = await getProvider(transaction.blockchain);
|
|
730
804
|
const { value } = await provider.getSignatureStatus(signature);
|
|
731
|
-
const confirmationStatus = _optionalChain$
|
|
805
|
+
const confirmationStatus = _optionalChain$7([value, 'optionalAccess', _ => _.confirmationStatus]);
|
|
732
806
|
if(confirmationStatus) {
|
|
733
807
|
const hasReachedSufficientCommitment = confirmationStatus === 'confirmed' || confirmationStatus === 'finalized';
|
|
734
808
|
if (hasReachedSufficientCommitment) {
|
|
735
809
|
if(value.err) {
|
|
736
810
|
transaction._failed = true;
|
|
737
811
|
const confirmedTransaction = await provider.getConfirmedTransaction(signature);
|
|
738
|
-
const failedReason = _optionalChain$
|
|
812
|
+
const failedReason = _optionalChain$7([confirmedTransaction, 'optionalAccess', _2 => _2.meta, 'optionalAccess', _3 => _3.logMessages]) ? confirmedTransaction.meta.logMessages[confirmedTransaction.meta.logMessages.length - 1] : null;
|
|
739
813
|
if(transaction.failed) transaction.failed(transaction, failedReason);
|
|
740
814
|
} else {
|
|
741
815
|
transaction._succeeded = true;
|
|
@@ -752,15 +826,15 @@ const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
|
752
826
|
return transaction
|
|
753
827
|
};
|
|
754
828
|
|
|
755
|
-
const submit$
|
|
829
|
+
const submit$3 = ({ transaction, wallet })=> {
|
|
756
830
|
if(transaction.instructions) {
|
|
757
831
|
return submitInstructions({ transaction, wallet })
|
|
758
832
|
} else {
|
|
759
|
-
return submitSimpleTransfer$
|
|
833
|
+
return submitSimpleTransfer$3({ transaction, wallet })
|
|
760
834
|
}
|
|
761
835
|
};
|
|
762
836
|
|
|
763
|
-
const submitSimpleTransfer$
|
|
837
|
+
const submitSimpleTransfer$3 = async ({ transaction, wallet })=> {
|
|
764
838
|
let fromPubkey = new PublicKey(await wallet.account());
|
|
765
839
|
let toPubkey = new PublicKey(transaction.to);
|
|
766
840
|
const provider = await getProvider(transaction.blockchain);
|
|
@@ -798,7 +872,7 @@ let supported$1 = ['ethereum', 'bsc', 'polygon', 'solana', 'velas'];
|
|
|
798
872
|
supported$1.evm = ['ethereum', 'bsc', 'polygon', 'velas'];
|
|
799
873
|
supported$1.solana = ['solana'];
|
|
800
874
|
|
|
801
|
-
function _optionalChain$
|
|
875
|
+
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; }
|
|
802
876
|
class WindowSolana {
|
|
803
877
|
|
|
804
878
|
static __initStatic() {this.info = {
|
|
@@ -809,8 +883,9 @@ class WindowSolana {
|
|
|
809
883
|
|
|
810
884
|
static __initStatic2() {this.isAvailable = ()=>{
|
|
811
885
|
return (
|
|
812
|
-
_optionalChain$
|
|
813
|
-
!_optionalChain$
|
|
886
|
+
_optionalChain$6([window, 'optionalAccess', _4 => _4.solana]) &&
|
|
887
|
+
!_optionalChain$6([window, 'optionalAccess', _5 => _5.solana, 'optionalAccess', _6 => _6.isPhantom]) &&
|
|
888
|
+
!window.coin98
|
|
814
889
|
)
|
|
815
890
|
};}
|
|
816
891
|
|
|
@@ -819,7 +894,7 @@ class WindowSolana {
|
|
|
819
894
|
this.logo = this.constructor.info.logo;
|
|
820
895
|
this.blockchains = this.constructor.info.blockchains;
|
|
821
896
|
this.sendTransaction = (transaction)=>{
|
|
822
|
-
return sendTransaction$
|
|
897
|
+
return sendTransaction$3({
|
|
823
898
|
wallet: this,
|
|
824
899
|
transaction
|
|
825
900
|
})
|
|
@@ -827,9 +902,9 @@ class WindowSolana {
|
|
|
827
902
|
}
|
|
828
903
|
|
|
829
904
|
async account() {
|
|
830
|
-
if(_optionalChain$
|
|
831
|
-
if(_optionalChain$
|
|
832
|
-
if(_optionalChain$
|
|
905
|
+
if(_optionalChain$6([window, 'optionalAccess', _7 => _7.solana]) == undefined){ return }
|
|
906
|
+
if(_optionalChain$6([window, 'optionalAccess', _8 => _8.solana, 'optionalAccess', _9 => _9.publicKey])) { return window.solana.publicKey.toString() }
|
|
907
|
+
if(_optionalChain$6([window, 'optionalAccess', _10 => _10.solana, 'optionalAccess', _11 => _11.isBraveWallet]) != true) {
|
|
833
908
|
let publicKey;
|
|
834
909
|
try { ({ publicKey } = await window.solana.connect({ onlyIfTrusted: true })); } catch (e) {}
|
|
835
910
|
if(publicKey){ return publicKey.toString() }
|
|
@@ -837,7 +912,7 @@ class WindowSolana {
|
|
|
837
912
|
}
|
|
838
913
|
|
|
839
914
|
async connect() {
|
|
840
|
-
if(!_optionalChain$
|
|
915
|
+
if(!_optionalChain$6([window, 'optionalAccess', _12 => _12.solana])) { return undefined }
|
|
841
916
|
let { publicKey } = await window.solana.connect();
|
|
842
917
|
return publicKey.toString()
|
|
843
918
|
}
|
|
@@ -846,7 +921,7 @@ class WindowSolana {
|
|
|
846
921
|
let internalCallback;
|
|
847
922
|
switch (event) {
|
|
848
923
|
case 'account':
|
|
849
|
-
internalCallback = (publicKey) => callback(_optionalChain$
|
|
924
|
+
internalCallback = (publicKey) => callback(_optionalChain$6([publicKey, 'optionalAccess', _13 => _13.toString, 'call', _14 => _14()]));
|
|
850
925
|
window.solana.on('accountChanged', internalCallback);
|
|
851
926
|
break
|
|
852
927
|
}
|
|
@@ -886,7 +961,7 @@ class WindowSolana {
|
|
|
886
961
|
}
|
|
887
962
|
} WindowSolana.__initStatic(); WindowSolana.__initStatic2();
|
|
888
963
|
|
|
889
|
-
function _optionalChain$
|
|
964
|
+
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; }
|
|
890
965
|
class Phantom extends WindowSolana {
|
|
891
966
|
|
|
892
967
|
static __initStatic() {this.info = {
|
|
@@ -895,11 +970,23 @@ class Phantom extends WindowSolana {
|
|
|
895
970
|
blockchains: supported$1.solana
|
|
896
971
|
};}
|
|
897
972
|
|
|
898
|
-
static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$
|
|
973
|
+
static __initStatic2() {this.isAvailable = ()=>{ return _optionalChain$5([window, 'optionalAccess', _3 => _3.solana, 'optionalAccess', _4 => _4.isPhantom]) };}
|
|
899
974
|
} Phantom.__initStatic(); Phantom.__initStatic2();
|
|
900
975
|
|
|
901
|
-
function _optionalChain$
|
|
902
|
-
|
|
976
|
+
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; }
|
|
977
|
+
class Trust extends WindowEthereum {
|
|
978
|
+
|
|
979
|
+
static __initStatic() {this.info = {
|
|
980
|
+
name: 'Trust',
|
|
981
|
+
logo: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA5Ni41IDk2LjUiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDk2LjUgOTYuNSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgZmlsbD0iI0ZGRkZGRiIgd2lkdGg9Ijk2LjUiIGhlaWdodD0iOTYuNSIvPgo8cGF0aCBzdHJva2U9IiMzMzc1QkIiIHN0cm9rZS13aWR0aD0iNi4wNjMiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLW1pdGVybGltaXQgPSIxMCIgZmlsbD0ibm9uZSIgZD0ibTQ4LjUgMjAuMWM5LjYgOCAyMC42IDcuNSAyMy43IDcuNS0wLjcgNDUuNS01LjkgMzYuNS0yMy43IDQ5LjMtMTcuOC0xMi44LTIzLTMuNy0yMy43LTQ5LjMgMy4yIDAgMTQuMSAwLjUgMjMuNy03LjV6Ii8+Cjwvc3ZnPgo=",
|
|
982
|
+
blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
|
|
983
|
+
};}
|
|
984
|
+
|
|
985
|
+
static __initStatic2() {this.isAvailable = ()=>{ return (_optionalChain$4([window, 'optionalAccess', _5 => _5.ethereum, 'optionalAccess', _6 => _6.isTrust]) || _optionalChain$4([window, 'optionalAccess', _7 => _7.ethereum, 'optionalAccess', _8 => _8.isTrustWallet])) };}
|
|
986
|
+
} Trust.__initStatic(); Trust.__initStatic2();
|
|
987
|
+
|
|
988
|
+
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; }
|
|
989
|
+
const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
903
990
|
transaction = new Transaction(transaction);
|
|
904
991
|
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
905
992
|
await wallet.switchTo(transaction.blockchain);
|
|
@@ -910,13 +997,13 @@ const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
|
910
997
|
await transaction.prepare({ wallet });
|
|
911
998
|
let transactionCount = await request$1({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
|
|
912
999
|
transaction.nonce = transactionCount;
|
|
913
|
-
await submit$
|
|
1000
|
+
await submit$2({ transaction, wallet }).then(async (tx)=>{
|
|
914
1001
|
if (tx) {
|
|
915
1002
|
let blockchain = Blockchain.findByName(transaction.blockchain);
|
|
916
1003
|
transaction.id = tx;
|
|
917
1004
|
transaction.url = blockchain.explorerUrlFor({ transaction });
|
|
918
1005
|
if (transaction.sent) transaction.sent(transaction);
|
|
919
|
-
let sentTransaction = await retrieveTransaction(tx, transaction.blockchain);
|
|
1006
|
+
let sentTransaction = await retrieveTransaction$1(tx, transaction.blockchain);
|
|
920
1007
|
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
921
1008
|
if(!sentTransaction) {
|
|
922
1009
|
transaction._failed = true;
|
|
@@ -950,7 +1037,7 @@ const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
|
950
1037
|
return transaction
|
|
951
1038
|
};
|
|
952
1039
|
|
|
953
|
-
const retrieveTransaction = async (tx, blockchain)=>{
|
|
1040
|
+
const retrieveTransaction$1 = async (tx, blockchain)=>{
|
|
954
1041
|
let sentTransaction;
|
|
955
1042
|
const provider = await getProvider(blockchain);
|
|
956
1043
|
sentTransaction = await provider.getTransaction(tx);
|
|
@@ -964,47 +1051,51 @@ const retrieveTransaction = async (tx, blockchain)=>{
|
|
|
964
1051
|
return sentTransaction
|
|
965
1052
|
};
|
|
966
1053
|
|
|
967
|
-
const submit$
|
|
1054
|
+
const submit$2 = ({ transaction, wallet }) => {
|
|
968
1055
|
if(transaction.method) {
|
|
969
|
-
return submitContractInteraction$
|
|
1056
|
+
return submitContractInteraction$2({ transaction, wallet })
|
|
970
1057
|
} else {
|
|
971
|
-
return submitSimpleTransfer$
|
|
1058
|
+
return submitSimpleTransfer$2({ transaction, wallet })
|
|
972
1059
|
}
|
|
973
1060
|
};
|
|
974
1061
|
|
|
975
|
-
const submitContractInteraction$
|
|
1062
|
+
const submitContractInteraction$2 = async ({ transaction, wallet })=>{
|
|
976
1063
|
const provider = await getProvider(transaction.blockchain);
|
|
977
1064
|
return wallet.connector.sendTransaction({
|
|
978
1065
|
from: transaction.from,
|
|
979
1066
|
to: transaction.to,
|
|
980
|
-
value: _optionalChain$
|
|
1067
|
+
value: _optionalChain$3([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]),
|
|
981
1068
|
data: await transaction.getData(),
|
|
982
1069
|
gas: (await estimate(transaction)).toString(),
|
|
983
|
-
gasPrice: (await provider.getGasPrice()).toString()
|
|
1070
|
+
gasPrice: (await provider.getGasPrice()).toString(),
|
|
1071
|
+
nonce: transaction.nonce,
|
|
984
1072
|
})
|
|
985
1073
|
};
|
|
986
1074
|
|
|
987
|
-
const submitSimpleTransfer$
|
|
1075
|
+
const submitSimpleTransfer$2 = async ({ transaction, wallet })=>{
|
|
988
1076
|
const provider = await getProvider(transaction.blockchain);
|
|
989
1077
|
return wallet.connector.sendTransaction({
|
|
990
1078
|
from: transaction.from,
|
|
991
1079
|
to: transaction.to,
|
|
992
|
-
value: _optionalChain$
|
|
1080
|
+
value: _optionalChain$3([transaction, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]),
|
|
993
1081
|
gas: (await estimate(transaction)).toString(),
|
|
994
|
-
gasPrice: (await provider.getGasPrice()).toString()
|
|
1082
|
+
gasPrice: (await provider.getGasPrice()).toString(),
|
|
1083
|
+
nonce: transaction.nonce,
|
|
995
1084
|
})
|
|
996
1085
|
};
|
|
997
1086
|
|
|
998
|
-
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; }
|
|
999
|
-
const
|
|
1000
|
-
|
|
1087
|
+
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; }
|
|
1088
|
+
const KEY$1 = '_DePayWeb3WalletsConnectedWalletConnectV1Instance';
|
|
1089
|
+
|
|
1090
|
+
const getConnectedInstance$2 = ()=>{
|
|
1091
|
+
return window[KEY$1]
|
|
1001
1092
|
};
|
|
1002
1093
|
|
|
1003
|
-
const setConnectedInstance$
|
|
1004
|
-
window
|
|
1094
|
+
const setConnectedInstance$2 = (value)=>{
|
|
1095
|
+
window[KEY$1] = value;
|
|
1005
1096
|
};
|
|
1006
1097
|
|
|
1007
|
-
class
|
|
1098
|
+
class WalletConnectV1 {
|
|
1008
1099
|
|
|
1009
1100
|
static __initStatic() {this.info = {
|
|
1010
1101
|
name: 'WalletConnect',
|
|
@@ -1013,16 +1104,16 @@ class WalletConnect {
|
|
|
1013
1104
|
};}
|
|
1014
1105
|
|
|
1015
1106
|
static __initStatic2() {this.isAvailable = ()=>{
|
|
1016
|
-
return getConnectedInstance$
|
|
1107
|
+
return getConnectedInstance$2() != undefined
|
|
1017
1108
|
};}
|
|
1018
1109
|
|
|
1019
1110
|
constructor() {
|
|
1020
1111
|
this.name = this.constructor.info.name;
|
|
1021
1112
|
this.logo = this.constructor.info.logo;
|
|
1022
1113
|
this.blockchains = this.constructor.info.blockchains;
|
|
1023
|
-
this.connector =
|
|
1114
|
+
this.connector = WalletConnectV1.instance || this.newWalletConnectInstance();
|
|
1024
1115
|
this.sendTransaction = (transaction)=>{
|
|
1025
|
-
return sendTransaction$
|
|
1116
|
+
return sendTransaction$2({
|
|
1026
1117
|
wallet: this,
|
|
1027
1118
|
transaction
|
|
1028
1119
|
})
|
|
@@ -1050,12 +1141,12 @@ class WalletConnect {
|
|
|
1050
1141
|
});
|
|
1051
1142
|
|
|
1052
1143
|
instance.on("disconnect", (error, payload) => {
|
|
1053
|
-
setConnectedInstance$
|
|
1144
|
+
setConnectedInstance$2(undefined);
|
|
1054
1145
|
if (error) { throw error }
|
|
1055
1146
|
});
|
|
1056
1147
|
|
|
1057
1148
|
instance.on("modal_closed", ()=>{
|
|
1058
|
-
setConnectedInstance$
|
|
1149
|
+
setConnectedInstance$2(undefined);
|
|
1059
1150
|
this.connector = undefined;
|
|
1060
1151
|
});
|
|
1061
1152
|
|
|
@@ -1077,14 +1168,14 @@ class WalletConnect {
|
|
|
1077
1168
|
|
|
1078
1169
|
if(this.connector.connected) {
|
|
1079
1170
|
await this.connector.killSession();
|
|
1080
|
-
setConnectedInstance$
|
|
1171
|
+
setConnectedInstance$2(undefined);
|
|
1081
1172
|
this.connector = this.newWalletConnectInstance();
|
|
1082
1173
|
}
|
|
1083
1174
|
|
|
1084
|
-
let { accounts, chainId } = await this.connector.connect({ chainId: _optionalChain([options, 'optionalAccess', _ => _.chainId]) });
|
|
1175
|
+
let { accounts, chainId } = await this.connector.connect({ chainId: _optionalChain$2([options, 'optionalAccess', _ => _.chainId]) });
|
|
1085
1176
|
|
|
1086
1177
|
if(accounts instanceof Array && accounts.length) {
|
|
1087
|
-
setConnectedInstance$
|
|
1178
|
+
setConnectedInstance$2(this);
|
|
1088
1179
|
}
|
|
1089
1180
|
|
|
1090
1181
|
accounts = accounts.map((account)=>ethers.utils.getAddress(account));
|
|
@@ -1195,10 +1286,277 @@ class WalletConnect {
|
|
|
1195
1286
|
let signature = await this.connector.signPersonalMessage(params);
|
|
1196
1287
|
return signature
|
|
1197
1288
|
}
|
|
1198
|
-
}
|
|
1289
|
+
} WalletConnectV1.__initStatic(); WalletConnectV1.__initStatic2();
|
|
1290
|
+
|
|
1291
|
+
WalletConnectV1.getConnectedInstance = getConnectedInstance$2;
|
|
1292
|
+
WalletConnectV1.setConnectedInstance = setConnectedInstance$2;
|
|
1293
|
+
|
|
1294
|
+
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; }
|
|
1295
|
+
const sendTransaction$1 = async ({ transaction, wallet })=> {
|
|
1296
|
+
transaction = new Transaction(transaction);
|
|
1297
|
+
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
1298
|
+
await wallet.switchTo(transaction.blockchain);
|
|
1299
|
+
}
|
|
1300
|
+
if((await wallet.connectedTo(transaction.blockchain)) == false) {
|
|
1301
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
1302
|
+
}
|
|
1303
|
+
await transaction.prepare({ wallet });
|
|
1304
|
+
let transactionCount = await request$1({ blockchain: transaction.blockchain, method: 'transactionCount', address: transaction.from });
|
|
1305
|
+
transaction.nonce = transactionCount;
|
|
1306
|
+
await submit$1({ transaction, wallet }).then(async (response)=>{
|
|
1307
|
+
if(typeof response == 'string') {
|
|
1308
|
+
let blockchain = Blockchain.findByName(transaction.blockchain);
|
|
1309
|
+
transaction.id = response;
|
|
1310
|
+
transaction.url = blockchain.explorerUrlFor({ transaction });
|
|
1311
|
+
if (transaction.sent) transaction.sent(transaction);
|
|
1312
|
+
let sentTransaction = await retrieveTransaction(transaction.id, transaction.blockchain);
|
|
1313
|
+
transaction.nonce = sentTransaction.nonce || transactionCount;
|
|
1314
|
+
if(!sentTransaction) {
|
|
1315
|
+
transaction._failed = true;
|
|
1316
|
+
console.log('Error retrieving transaction');
|
|
1317
|
+
if(transaction.failed) transaction.failed(transaction, 'Error retrieving transaction');
|
|
1318
|
+
} else {
|
|
1319
|
+
sentTransaction.wait(1).then(() => {
|
|
1320
|
+
transaction._succeeded = true;
|
|
1321
|
+
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
1322
|
+
}).catch((error)=>{
|
|
1323
|
+
if(error && error.code && error.code == 'TRANSACTION_REPLACED') {
|
|
1324
|
+
if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 1) {
|
|
1325
|
+
transaction.id = error.replacement.hash;
|
|
1326
|
+
transaction._succeeded = true;
|
|
1327
|
+
if (transaction.succeeded) transaction.succeeded(transaction);
|
|
1328
|
+
} else if(error.replacement && error.replacement.hash && error.receipt && error.receipt.status == 0) {
|
|
1329
|
+
transaction.id = error.replacement.hash;
|
|
1330
|
+
transaction._failed = true;
|
|
1331
|
+
if(transaction.failed) transaction.failed(transaction, error);
|
|
1332
|
+
}
|
|
1333
|
+
} else {
|
|
1334
|
+
transaction._failed = true;
|
|
1335
|
+
if(transaction.failed) transaction.failed(transaction, error);
|
|
1336
|
+
}
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
} else {
|
|
1340
|
+
throw(response)
|
|
1341
|
+
}
|
|
1342
|
+
});
|
|
1343
|
+
return transaction
|
|
1344
|
+
};
|
|
1345
|
+
|
|
1346
|
+
const retrieveTransaction = async (tx, blockchain)=>{
|
|
1347
|
+
let sentTransaction;
|
|
1348
|
+
const provider = await getProvider(blockchain);
|
|
1349
|
+
sentTransaction = await provider.getTransaction(tx);
|
|
1350
|
+
const maxRetries = 120;
|
|
1351
|
+
let attempt = 1;
|
|
1352
|
+
while (attempt <= maxRetries && !sentTransaction) {
|
|
1353
|
+
sentTransaction = await provider.getTransaction(tx);
|
|
1354
|
+
await (new Promise((resolve)=>setTimeout(resolve, 5000)));
|
|
1355
|
+
attempt++;
|
|
1356
|
+
}
|
|
1357
|
+
return sentTransaction
|
|
1358
|
+
};
|
|
1359
|
+
|
|
1360
|
+
const submit$1 = ({ transaction, wallet }) => {
|
|
1361
|
+
if(transaction.method) {
|
|
1362
|
+
return submitContractInteraction$1({ transaction, wallet })
|
|
1363
|
+
} else {
|
|
1364
|
+
return submitSimpleTransfer$1({ transaction, wallet })
|
|
1365
|
+
}
|
|
1366
|
+
};
|
|
1367
|
+
|
|
1368
|
+
const submitContractInteraction$1 = async ({ transaction, wallet })=>{
|
|
1369
|
+
const provider = await getProvider(transaction.blockchain);
|
|
1370
|
+
return wallet.signClient.request({
|
|
1371
|
+
topic: wallet.session.topic,
|
|
1372
|
+
chainId: wallet.session.chainId,
|
|
1373
|
+
request: {
|
|
1374
|
+
method: 'eth_sendTransaction',
|
|
1375
|
+
params: [{
|
|
1376
|
+
from: transaction.from,
|
|
1377
|
+
to: transaction.to,
|
|
1378
|
+
value: _optionalChain$1([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]),
|
|
1379
|
+
data: await transaction.getData(),
|
|
1380
|
+
gas: (await estimate(transaction)).toString(),
|
|
1381
|
+
gasPrice: (await provider.getGasPrice()).toString(),
|
|
1382
|
+
nonce: transaction.nonce,
|
|
1383
|
+
}]
|
|
1384
|
+
}
|
|
1385
|
+
})
|
|
1386
|
+
};
|
|
1387
|
+
|
|
1388
|
+
const submitSimpleTransfer$1 = async ({ transaction, wallet })=>{
|
|
1389
|
+
const provider = await getProvider(transaction.blockchain);
|
|
1390
|
+
let blockchain = Blockchain.findByName(transaction.blockchain);
|
|
1391
|
+
return wallet.signClient.request({
|
|
1392
|
+
topic: wallet.session.topic,
|
|
1393
|
+
chainId: wallet.session.chainId,
|
|
1394
|
+
request: {
|
|
1395
|
+
method: 'eth_sendTransaction',
|
|
1396
|
+
params: [{
|
|
1397
|
+
chainId: blockchain.id,
|
|
1398
|
+
from: transaction.from,
|
|
1399
|
+
to: transaction.to,
|
|
1400
|
+
value: _optionalChain$1([transaction, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]),
|
|
1401
|
+
gas: (await estimate(transaction)).toString(),
|
|
1402
|
+
gasPrice: (await provider.getGasPrice()).toString(),
|
|
1403
|
+
nonce: transaction.nonce
|
|
1404
|
+
}]
|
|
1405
|
+
}
|
|
1406
|
+
}).catch((e)=>{console.log('ERROR', e);})
|
|
1407
|
+
};
|
|
1408
|
+
|
|
1409
|
+
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; }
|
|
1410
|
+
const KEY = '_DePayWeb3WalletsConnectedWalletConnectV2Instance';
|
|
1411
|
+
|
|
1412
|
+
const getConnectedInstance$1 = ()=>{
|
|
1413
|
+
return window[KEY]
|
|
1414
|
+
};
|
|
1415
|
+
|
|
1416
|
+
const setConnectedInstance$1 = (value)=>{
|
|
1417
|
+
window[KEY] = value;
|
|
1418
|
+
};
|
|
1419
|
+
|
|
1420
|
+
class WalletConnectV2 {
|
|
1421
|
+
|
|
1422
|
+
static __initStatic() {this.info = {
|
|
1423
|
+
name: 'WalletConnect',
|
|
1424
|
+
logo: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0ndXRmLTgnPz48IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMjUuNC4xLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAtLT48c3ZnIHZlcnNpb249JzEuMScgaWQ9J0xheWVyXzEnIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZycgeG1sbnM6eGxpbms9J2h0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsnIHg9JzBweCcgeT0nMHB4JyB2aWV3Qm94PScwIDAgNTAwIDUwMCcgc3R5bGU9J2VuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTAwIDUwMDsnIHhtbDpzcGFjZT0ncHJlc2VydmUnPjxzdHlsZSB0eXBlPSd0ZXh0L2Nzcyc+IC5zdDB7ZmlsbDojNTk5MUNEO30KPC9zdHlsZT48ZyBpZD0nUGFnZS0xJz48ZyBpZD0nd2FsbGV0Y29ubmVjdC1sb2dvLWFsdCc+PHBhdGggaWQ9J1dhbGxldENvbm5lY3QnIGNsYXNzPSdzdDAnIGQ9J00xMDIuNywxNjJjODEuNS03OS44LDIxMy42LTc5LjgsMjk1LjEsMGw5LjgsOS42YzQuMSw0LDQuMSwxMC41LDAsMTQuNEwzNzQsMjE4LjkgYy0yLDItNS4zLDItNy40LDBsLTEzLjUtMTMuMmMtNTYuOC01NS43LTE0OS01NS43LTIwNS44LDBsLTE0LjUsMTQuMWMtMiwyLTUuMywyLTcuNCwwTDkxLjksMTg3Yy00LjEtNC00LjEtMTAuNSwwLTE0LjQgTDEwMi43LDE2MnogTTQ2Ny4xLDIyOS45bDI5LjksMjkuMmM0LjEsNCw0LjEsMTAuNSwwLDE0LjRMMzYyLjMsNDA1LjRjLTQuMSw0LTEwLjcsNC0xNC44LDBjMCwwLDAsMCwwLDBMMjUyLDMxMS45IGMtMS0xLTIuNy0xLTMuNywwaDBsLTk1LjUsOTMuNWMtNC4xLDQtMTAuNyw0LTE0LjgsMGMwLDAsMCwwLDAsMEwzLjQsMjczLjZjLTQuMS00LTQuMS0xMC41LDAtMTQuNGwyOS45LTI5LjIgYzQuMS00LDEwLjctNCwxNC44LDBsOTUuNSw5My41YzEsMSwyLjcsMSwzLjcsMGMwLDAsMCwwLDAsMGw5NS41LTkzLjVjNC4xLTQsMTAuNy00LDE0LjgsMGMwLDAsMCwwLDAsMGw5NS41LDkzLjUgYzEsMSwyLjcsMSwzLjcsMGw5NS41LTkzLjVDNDU2LjQsMjI1LjksNDYzLDIyNS45LDQ2Ny4xLDIyOS45eicvPjwvZz48L2c+PC9zdmc+Cg==",
|
|
1425
|
+
blockchains: ['ethereum', 'bsc', 'polygon', 'velas']
|
|
1426
|
+
};}
|
|
1427
|
+
|
|
1428
|
+
static __initStatic2() {this.isAvailable = ()=>{
|
|
1429
|
+
return getConnectedInstance$1() != undefined
|
|
1430
|
+
};}
|
|
1431
|
+
|
|
1432
|
+
constructor() {
|
|
1433
|
+
this.name = this.constructor.info.name;
|
|
1434
|
+
this.logo = this.constructor.info.logo;
|
|
1435
|
+
this.blockchains = this.constructor.info.blockchains;
|
|
1436
|
+
this.connector = WalletConnect.instance || this.newWalletConnectInstance();
|
|
1437
|
+
WalletConnect.instance = this.connector;
|
|
1438
|
+
this.sendTransaction = (transaction)=>{
|
|
1439
|
+
return sendTransaction$1({
|
|
1440
|
+
wallet: this,
|
|
1441
|
+
transaction
|
|
1442
|
+
})
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
newWalletConnectInstance() {
|
|
1447
|
+
return new Core({ projectId: window._walletConnectProjectId })
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
async account() {
|
|
1451
|
+
if(this.connectedAccount == undefined) { return }
|
|
1452
|
+
return this.connectedAccount
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
async connect({ connect, blockchain }) {
|
|
1456
|
+
|
|
1457
|
+
if(!connect || typeof connect != 'function') { throw('Provided connect paremeters is not present or not a function!') }
|
|
1458
|
+
|
|
1459
|
+
try {
|
|
1460
|
+
|
|
1461
|
+
delete localStorage[`wc@2:core:${this.connector.pairing.version}//subscription`]; // DO NOT RECOVER AN OTHER SUBSCRIPTION!!!
|
|
1462
|
+
this.signClient = await SignClient.init({ core: this.connector });
|
|
1463
|
+
|
|
1464
|
+
this.signClient.on("session_delete", () => {
|
|
1465
|
+
console.log('WALLETCONNECT DISCONNECT');
|
|
1466
|
+
this.connector = undefined;
|
|
1467
|
+
WalletConnect.instance = undefined;
|
|
1468
|
+
this.connectedAccount = undefined;
|
|
1469
|
+
this.signClient = undefined;
|
|
1470
|
+
this.session = undefined;
|
|
1471
|
+
});
|
|
1472
|
+
|
|
1473
|
+
blockchain = Blockchain.findByName(blockchain);
|
|
1474
|
+
|
|
1475
|
+
let namespaces = {};
|
|
1476
|
+
|
|
1477
|
+
namespaces[blockchain.namespace] = {
|
|
1478
|
+
methods: [
|
|
1479
|
+
"eth_sendTransaction",
|
|
1480
|
+
"personal_sign",
|
|
1481
|
+
],
|
|
1482
|
+
chains: [`${blockchain.namespace}:${blockchain.networkId}`],
|
|
1483
|
+
events: [],
|
|
1484
|
+
};
|
|
1485
|
+
|
|
1486
|
+
const { uri, approval } = await this.signClient.connect({ requiredNamespaces: namespaces });
|
|
1487
|
+
|
|
1488
|
+
await connect({ uri });
|
|
1489
|
+
this.session = await approval();
|
|
1490
|
+
this.session.chainId = `${blockchain.namespace}:${blockchain.networkId}`;
|
|
1491
|
+
|
|
1492
|
+
let meta = _optionalChain([this, 'access', _ => _.session, 'optionalAccess', _2 => _2.peer, 'optionalAccess', _3 => _3.metadata]);
|
|
1493
|
+
if(meta && meta.name) {
|
|
1494
|
+
this.name = meta.name;
|
|
1495
|
+
if(_optionalChain([meta, 'optionalAccess', _4 => _4.icons]) && meta.icons.length) { this.logo = meta.icons[0]; }
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
const account = Object.values(this.session.namespaces)[0].accounts[0].split(":")[2];
|
|
1499
|
+
this.connectedAccount = account;
|
|
1500
|
+
this.connectedBlockchain = blockchain.name;
|
|
1501
|
+
|
|
1502
|
+
return account
|
|
1503
|
+
|
|
1504
|
+
} catch (error) {
|
|
1505
|
+
console.log('WALLETCONNECT ERROR', error);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
async connectedTo(input) {
|
|
1510
|
+
if(input) {
|
|
1511
|
+
return input === this.connectedBlockchain
|
|
1512
|
+
} else {
|
|
1513
|
+
const blockchain = Blockchain.findByName(this.connectedBlockchain);
|
|
1514
|
+
return blockchain.name
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
switchTo(blockchainName) {
|
|
1519
|
+
return new Promise((resolve, reject)=>{
|
|
1520
|
+
reject({ code: 'NOT_SUPPORTED' });
|
|
1521
|
+
})
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
addNetwork(blockchainName) {
|
|
1525
|
+
return new Promise((resolve, reject)=>{
|
|
1526
|
+
reject({ code: 'NOT_SUPPORTED' });
|
|
1527
|
+
})
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
on(event, callback) {
|
|
1531
|
+
// currently not supported
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
off(event, callback) {
|
|
1535
|
+
// currently not supported
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
async sign(message) {
|
|
1539
|
+
let address = await this.account();
|
|
1540
|
+
var params = [ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)), address];
|
|
1541
|
+
let signature = await this.signClient.request({
|
|
1542
|
+
topic: this.session.topic,
|
|
1543
|
+
chainId: this.session.chainId,
|
|
1544
|
+
request:{
|
|
1545
|
+
id: 1,
|
|
1546
|
+
jsonrpc: '2.0',
|
|
1547
|
+
method: 'personal_sign',
|
|
1548
|
+
params
|
|
1549
|
+
}
|
|
1550
|
+
});
|
|
1551
|
+
if(typeof signature == 'object') {
|
|
1552
|
+
signature = ethers.utils.hexlify(signature);
|
|
1553
|
+
}
|
|
1554
|
+
return signature
|
|
1555
|
+
}
|
|
1556
|
+
} WalletConnectV2.__initStatic(); WalletConnectV2.__initStatic2();
|
|
1199
1557
|
|
|
1200
|
-
|
|
1201
|
-
|
|
1558
|
+
WalletConnectV2.getConnectedInstance = getConnectedInstance$1;
|
|
1559
|
+
WalletConnectV2.setConnectedInstance = setConnectedInstance$1;
|
|
1202
1560
|
|
|
1203
1561
|
const sendTransaction = async ({ transaction, wallet })=> {
|
|
1204
1562
|
transaction = new Transaction(transaction);
|
|
@@ -1414,9 +1772,16 @@ var wallets = {
|
|
|
1414
1772
|
MetaMask,
|
|
1415
1773
|
Phantom,
|
|
1416
1774
|
Coinbase,
|
|
1775
|
+
Binance,
|
|
1776
|
+
Trust,
|
|
1777
|
+
Brave,
|
|
1778
|
+
Opera,
|
|
1779
|
+
Coin98,
|
|
1780
|
+
CryptoCom,
|
|
1417
1781
|
WindowEthereum,
|
|
1418
1782
|
WindowSolana,
|
|
1419
|
-
|
|
1783
|
+
WalletConnectV1,
|
|
1784
|
+
WalletConnectV2,
|
|
1420
1785
|
WalletLink
|
|
1421
1786
|
};
|
|
1422
1787
|
|
|
@@ -1459,7 +1824,14 @@ const supported = [
|
|
|
1459
1824
|
wallets.MetaMask,
|
|
1460
1825
|
wallets.Phantom,
|
|
1461
1826
|
wallets.Coinbase,
|
|
1462
|
-
wallets.
|
|
1827
|
+
wallets.Binance,
|
|
1828
|
+
wallets.Trust,
|
|
1829
|
+
wallets.Brave,
|
|
1830
|
+
wallets.Opera,
|
|
1831
|
+
wallets.Coin98,
|
|
1832
|
+
wallets.CryptoCom,
|
|
1833
|
+
wallets.WalletConnectV1,
|
|
1834
|
+
wallets.WalletConnectV2,
|
|
1463
1835
|
wallets.WalletLink
|
|
1464
1836
|
];
|
|
1465
1837
|
|