Skip to content

Commit

Permalink
v16.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
10xSebastian committed Sep 15, 2023
1 parent 7954654 commit b06a849
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 64 deletions.
30 changes: 15 additions & 15 deletions dist/esm/index.evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -1420,13 +1420,13 @@ class WalletConnectV2 {
}

async setSessionBlockchains() {
if(!this.session) { return }
if(_optionalChain$2([CONFIGURATIONS, 'access', _27 => _27[this.walletName], 'optionalAccess', _28 => _28.methods, 'optionalAccess', _29 => _29.includes, 'call', _30 => _30('wallet_switchEthereumChain')])) {
this.blockchains = [this.session.namespaces.eip155.chains[this.session.namespaces.eip155.chains.length-1]].map((chainIdentifier)=>_optionalChain$2([Blockchains, 'access', _31 => _31.findByNetworkId, 'call', _32 => _32(chainIdentifier.split(':')[1]), 'optionalAccess', _33 => _33.name])).filter(Boolean);
if(!this.session || !_optionalChain$2([this, 'access', _27 => _27.session, 'optionalAccess', _28 => _28.namespaces, 'optionalAccess', _29 => _29.eip155])) { return }
if(_optionalChain$2([CONFIGURATIONS, 'access', _30 => _30[this.walletName], 'optionalAccess', _31 => _31.methods, 'optionalAccess', _32 => _32.includes, 'call', _33 => _33('wallet_switchEthereumChain')])) {
this.blockchains = [this.session.namespaces.eip155.chains[this.session.namespaces.eip155.chains.length-1]].map((chainIdentifier)=>_optionalChain$2([Blockchains, 'access', _34 => _34.findByNetworkId, 'call', _35 => _35(chainIdentifier.split(':')[1]), 'optionalAccess', _36 => _36.name])).filter(Boolean);
} else if(this.session.namespaces.eip155.chains) {
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$2([Blockchains, 'access', _34 => _34.findByNetworkId, 'call', _35 => _35(chainIdentifier.split(':')[1]), 'optionalAccess', _36 => _36.name])).filter(Boolean);
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$2([Blockchains, 'access', _37 => _37.findByNetworkId, 'call', _38 => _38(chainIdentifier.split(':')[1]), 'optionalAccess', _39 => _39.name])).filter(Boolean);
} else if(this.session.namespaces.eip155.accounts) {
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$2([Blockchains, 'access', _37 => _37.findByNetworkId, 'call', _38 => _38(accountIdentifier.split(':')[1]), 'optionalAccess', _39 => _39.name])).filter(Boolean);
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$2([Blockchains, 'access', _40 => _40.findByNetworkId, 'call', _41 => _41(accountIdentifier.split(':')[1]), 'optionalAccess', _42 => _42.name])).filter(Boolean);
}
}

Expand All @@ -1436,13 +1436,13 @@ class WalletConnectV2 {

try {

this.walletName = _optionalChain$2([options, 'optionalAccess', _40 => _40.name]);
this.walletName = _optionalChain$2([options, 'optionalAccess', _43 => _43.name]);

// delete localStorage[`wc@2:client:0.3//session`] // DELETE WC SESSIONS
this.signClient = await getSignClient();

this.signClient.on("session_delete", (session)=> {
if(_optionalChain$2([session, 'optionalAccess', _41 => _41.topic]) === _optionalChain$2([this, 'access', _42 => _42.session, 'optionalAccess', _43 => _43.topic])) {
if(_optionalChain$2([session, 'optionalAccess', _44 => _44.topic]) === _optionalChain$2([this, 'access', _45 => _45.session, 'optionalAccess', _46 => _46.topic])) {
localStorage[KEY+':name'] = undefined;
localStorage[KEY+':logo'] = undefined;
this.signClient = undefined;
Expand All @@ -1451,14 +1451,14 @@ class WalletConnectV2 {
});

this.signClient.on("session_update", async(session)=> {
if(_optionalChain$2([session, 'optionalAccess', _44 => _44.topic]) === _optionalChain$2([this, 'access', _45 => _45.session, 'optionalAccess', _46 => _46.topic])) {
if(_optionalChain$2([session, 'optionalAccess', _47 => _47.topic]) === _optionalChain$2([this, 'access', _48 => _48.session, 'optionalAccess', _49 => _49.topic])) {
this.session = this.signClient.session.get(session.topic);
await this.setSessionBlockchains();
}
});

this.signClient.on("session_event", (event)=> {
if(_optionalChain$2([event, 'optionalAccess', _47 => _47.topic]) === _optionalChain$2([this, 'access', _48 => _48.session, 'optionalAccess', _49 => _49.topic])) {}
if(_optionalChain$2([event, 'optionalAccess', _50 => _50.topic]) === _optionalChain$2([this, 'access', _51 => _51.session, 'optionalAccess', _52 => _52.topic])) {}
});

const connectWallet = async()=>{
Expand All @@ -1469,24 +1469,24 @@ class WalletConnectV2 {
await new Promise(resolve=>setTimeout(resolve, 500)); // to prevent race condition within WalletConnect
};

const lastSession = _optionalChain$2([this, 'optionalAccess', _50 => _50.walletName, 'optionalAccess', _51 => _51.length]) ? await getLastSession(this.walletName) : undefined;
const lastSession = _optionalChain$2([this, 'optionalAccess', _53 => _53.walletName, 'optionalAccess', _54 => _54.length]) ? await getLastSession(this.walletName) : undefined;
if(lastSession) {
this.session = lastSession;
} else {
await connectWallet();
}

let meta = _optionalChain$2([this, 'access', _52 => _52.session, 'optionalAccess', _53 => _53.peer, 'optionalAccess', _54 => _54.metadata]);
let meta = _optionalChain$2([this, 'access', _55 => _55.session, 'optionalAccess', _56 => _56.peer, 'optionalAccess', _57 => _57.metadata]);
if(meta && meta.name) {
this.name = meta.name;
localStorage[KEY+':name'] = meta.name;
if(_optionalChain$2([meta, 'optionalAccess', _55 => _55.icons]) && meta.icons.length) {
if(_optionalChain$2([meta, 'optionalAccess', _58 => _58.icons]) && meta.icons.length) {
this.logo = meta.icons[0];
localStorage[KEY+':logo'] = this.logo;
}
}
if(_optionalChain$2([options, 'optionalAccess', _56 => _56.name])) { localStorage[KEY+':name'] = this.name = options.name; }
if(_optionalChain$2([options, 'optionalAccess', _57 => _57.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
if(_optionalChain$2([options, 'optionalAccess', _59 => _59.name])) { localStorage[KEY+':name'] = this.name = options.name; }
if(_optionalChain$2([options, 'optionalAccess', _60 => _60.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }

await this.setSessionBlockchains();

Expand Down Expand Up @@ -1543,7 +1543,7 @@ class WalletConnectV2 {
switch (event) {
case 'account':
internalCallback = async(event)=> {
if(_optionalChain$2([event, 'optionalAccess', _58 => _58.topic]) === _optionalChain$2([this, 'access', _59 => _59.session, 'optionalAccess', _60 => _60.topic]) && event.params.event.name === 'accountsChanged') {
if(_optionalChain$2([event, 'optionalAccess', _61 => _61.topic]) === _optionalChain$2([this, 'access', _62 => _62.session, 'optionalAccess', _63 => _63.topic]) && event.params.event.name === 'accountsChanged') {
callback(await this.account());
}
};
Expand Down
30 changes: 15 additions & 15 deletions dist/esm/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b06a849

Please sign in to comment.