@depay/web3-wallets-evm 16.2.6 → 16.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.evm.js +16 -16
- package/dist/esm/index.js +16 -16
- package/dist/umd/index.evm.js +16 -16
- package/dist/umd/index.js +16 -16
- package/package.json +1 -1
package/dist/esm/index.evm.js
CHANGED
|
@@ -1294,7 +1294,7 @@ const CONFIGURATIONS = {
|
|
|
1294
1294
|
requiredNamespaces: {},
|
|
1295
1295
|
optionalNamespaces: {
|
|
1296
1296
|
eip155: {
|
|
1297
|
-
chains: Blockchains.map((blockchain)=>`eip155:${blockchain.networkId}`)
|
|
1297
|
+
chains: Blockchains.all.map((blockchain)=>`eip155:${blockchain.networkId}`)
|
|
1298
1298
|
}
|
|
1299
1299
|
},
|
|
1300
1300
|
},
|
|
@@ -1420,13 +1420,13 @@ class WalletConnectV2 {
|
|
|
1420
1420
|
}
|
|
1421
1421
|
|
|
1422
1422
|
async setSessionBlockchains() {
|
|
1423
|
-
if(!this.session) { return }
|
|
1424
|
-
if(_optionalChain$2([CONFIGURATIONS, 'access',
|
|
1425
|
-
this.blockchains = [this.session.namespaces.eip155.chains[this.session.namespaces.eip155.chains.length-1]].map((chainIdentifier)=>_optionalChain$2([Blockchains, 'access',
|
|
1423
|
+
if(!this.session || !_optionalChain$2([this, 'access', _27 => _27.session, 'optionalAccess', _28 => _28.namespaces, 'optionalAccess', _29 => _29.eip155])) { return }
|
|
1424
|
+
if(_optionalChain$2([CONFIGURATIONS, 'access', _30 => _30[this.walletName], 'optionalAccess', _31 => _31.methods, 'optionalAccess', _32 => _32.includes, 'call', _33 => _33('wallet_switchEthereumChain')])) {
|
|
1425
|
+
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);
|
|
1426
1426
|
} else if(this.session.namespaces.eip155.chains) {
|
|
1427
|
-
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$2([Blockchains, 'access',
|
|
1427
|
+
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);
|
|
1428
1428
|
} else if(this.session.namespaces.eip155.accounts) {
|
|
1429
|
-
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$2([Blockchains, 'access',
|
|
1429
|
+
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);
|
|
1430
1430
|
}
|
|
1431
1431
|
}
|
|
1432
1432
|
|
|
@@ -1436,13 +1436,13 @@ class WalletConnectV2 {
|
|
|
1436
1436
|
|
|
1437
1437
|
try {
|
|
1438
1438
|
|
|
1439
|
-
this.walletName = _optionalChain$2([options, 'optionalAccess',
|
|
1439
|
+
this.walletName = _optionalChain$2([options, 'optionalAccess', _43 => _43.name]);
|
|
1440
1440
|
|
|
1441
1441
|
// delete localStorage[`wc@2:client:0.3//session`] // DELETE WC SESSIONS
|
|
1442
1442
|
this.signClient = await getSignClient();
|
|
1443
1443
|
|
|
1444
1444
|
this.signClient.on("session_delete", (session)=> {
|
|
1445
|
-
if(_optionalChain$2([session, 'optionalAccess',
|
|
1445
|
+
if(_optionalChain$2([session, 'optionalAccess', _44 => _44.topic]) === _optionalChain$2([this, 'access', _45 => _45.session, 'optionalAccess', _46 => _46.topic])) {
|
|
1446
1446
|
localStorage[KEY+':name'] = undefined;
|
|
1447
1447
|
localStorage[KEY+':logo'] = undefined;
|
|
1448
1448
|
this.signClient = undefined;
|
|
@@ -1451,14 +1451,14 @@ class WalletConnectV2 {
|
|
|
1451
1451
|
});
|
|
1452
1452
|
|
|
1453
1453
|
this.signClient.on("session_update", async(session)=> {
|
|
1454
|
-
if(_optionalChain$2([session, 'optionalAccess',
|
|
1454
|
+
if(_optionalChain$2([session, 'optionalAccess', _47 => _47.topic]) === _optionalChain$2([this, 'access', _48 => _48.session, 'optionalAccess', _49 => _49.topic])) {
|
|
1455
1455
|
this.session = this.signClient.session.get(session.topic);
|
|
1456
1456
|
await this.setSessionBlockchains();
|
|
1457
1457
|
}
|
|
1458
1458
|
});
|
|
1459
1459
|
|
|
1460
1460
|
this.signClient.on("session_event", (event)=> {
|
|
1461
|
-
if(_optionalChain$2([event, 'optionalAccess',
|
|
1461
|
+
if(_optionalChain$2([event, 'optionalAccess', _50 => _50.topic]) === _optionalChain$2([this, 'access', _51 => _51.session, 'optionalAccess', _52 => _52.topic])) {}
|
|
1462
1462
|
});
|
|
1463
1463
|
|
|
1464
1464
|
const connectWallet = async()=>{
|
|
@@ -1469,24 +1469,24 @@ class WalletConnectV2 {
|
|
|
1469
1469
|
await new Promise(resolve=>setTimeout(resolve, 500)); // to prevent race condition within WalletConnect
|
|
1470
1470
|
};
|
|
1471
1471
|
|
|
1472
|
-
const lastSession = _optionalChain$2([this, 'optionalAccess',
|
|
1472
|
+
const lastSession = _optionalChain$2([this, 'optionalAccess', _53 => _53.walletName, 'optionalAccess', _54 => _54.length]) ? await getLastSession(this.walletName) : undefined;
|
|
1473
1473
|
if(lastSession) {
|
|
1474
1474
|
this.session = lastSession;
|
|
1475
1475
|
} else {
|
|
1476
1476
|
await connectWallet();
|
|
1477
1477
|
}
|
|
1478
1478
|
|
|
1479
|
-
let meta = _optionalChain$2([this, 'access',
|
|
1479
|
+
let meta = _optionalChain$2([this, 'access', _55 => _55.session, 'optionalAccess', _56 => _56.peer, 'optionalAccess', _57 => _57.metadata]);
|
|
1480
1480
|
if(meta && meta.name) {
|
|
1481
1481
|
this.name = meta.name;
|
|
1482
1482
|
localStorage[KEY+':name'] = meta.name;
|
|
1483
|
-
if(_optionalChain$2([meta, 'optionalAccess',
|
|
1483
|
+
if(_optionalChain$2([meta, 'optionalAccess', _58 => _58.icons]) && meta.icons.length) {
|
|
1484
1484
|
this.logo = meta.icons[0];
|
|
1485
1485
|
localStorage[KEY+':logo'] = this.logo;
|
|
1486
1486
|
}
|
|
1487
1487
|
}
|
|
1488
|
-
if(_optionalChain$2([options, 'optionalAccess',
|
|
1489
|
-
if(_optionalChain$2([options, 'optionalAccess',
|
|
1488
|
+
if(_optionalChain$2([options, 'optionalAccess', _59 => _59.name])) { localStorage[KEY+':name'] = this.name = options.name; }
|
|
1489
|
+
if(_optionalChain$2([options, 'optionalAccess', _60 => _60.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
|
|
1490
1490
|
|
|
1491
1491
|
await this.setSessionBlockchains();
|
|
1492
1492
|
|
|
@@ -1543,7 +1543,7 @@ class WalletConnectV2 {
|
|
|
1543
1543
|
switch (event) {
|
|
1544
1544
|
case 'account':
|
|
1545
1545
|
internalCallback = async(event)=> {
|
|
1546
|
-
if(_optionalChain$2([event, 'optionalAccess',
|
|
1546
|
+
if(_optionalChain$2([event, 'optionalAccess', _61 => _61.topic]) === _optionalChain$2([this, 'access', _62 => _62.session, 'optionalAccess', _63 => _63.topic]) && event.params.event.name === 'accountsChanged') {
|
|
1547
1547
|
callback(await this.account());
|
|
1548
1548
|
}
|
|
1549
1549
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1766,7 +1766,7 @@ const CONFIGURATIONS = {
|
|
|
1766
1766
|
requiredNamespaces: {},
|
|
1767
1767
|
optionalNamespaces: {
|
|
1768
1768
|
eip155: {
|
|
1769
|
-
chains: Blockchains.map((blockchain)=>`eip155:${blockchain.networkId}`)
|
|
1769
|
+
chains: Blockchains.all.map((blockchain)=>`eip155:${blockchain.networkId}`)
|
|
1770
1770
|
}
|
|
1771
1771
|
},
|
|
1772
1772
|
},
|
|
@@ -1892,13 +1892,13 @@ class WalletConnectV2 {
|
|
|
1892
1892
|
}
|
|
1893
1893
|
|
|
1894
1894
|
async setSessionBlockchains() {
|
|
1895
|
-
if(!this.session) { return }
|
|
1896
|
-
if(_optionalChain$2([CONFIGURATIONS, 'access',
|
|
1897
|
-
this.blockchains = [this.session.namespaces.eip155.chains[this.session.namespaces.eip155.chains.length-1]].map((chainIdentifier)=>_optionalChain$2([Blockchains, 'access',
|
|
1895
|
+
if(!this.session || !_optionalChain$2([this, 'access', _27 => _27.session, 'optionalAccess', _28 => _28.namespaces, 'optionalAccess', _29 => _29.eip155])) { return }
|
|
1896
|
+
if(_optionalChain$2([CONFIGURATIONS, 'access', _30 => _30[this.walletName], 'optionalAccess', _31 => _31.methods, 'optionalAccess', _32 => _32.includes, 'call', _33 => _33('wallet_switchEthereumChain')])) {
|
|
1897
|
+
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);
|
|
1898
1898
|
} else if(this.session.namespaces.eip155.chains) {
|
|
1899
|
-
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$2([Blockchains, 'access',
|
|
1899
|
+
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);
|
|
1900
1900
|
} else if(this.session.namespaces.eip155.accounts) {
|
|
1901
|
-
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$2([Blockchains, 'access',
|
|
1901
|
+
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);
|
|
1902
1902
|
}
|
|
1903
1903
|
}
|
|
1904
1904
|
|
|
@@ -1908,13 +1908,13 @@ class WalletConnectV2 {
|
|
|
1908
1908
|
|
|
1909
1909
|
try {
|
|
1910
1910
|
|
|
1911
|
-
this.walletName = _optionalChain$2([options, 'optionalAccess',
|
|
1911
|
+
this.walletName = _optionalChain$2([options, 'optionalAccess', _43 => _43.name]);
|
|
1912
1912
|
|
|
1913
1913
|
// delete localStorage[`wc@2:client:0.3//session`] // DELETE WC SESSIONS
|
|
1914
1914
|
this.signClient = await getSignClient();
|
|
1915
1915
|
|
|
1916
1916
|
this.signClient.on("session_delete", (session)=> {
|
|
1917
|
-
if(_optionalChain$2([session, 'optionalAccess',
|
|
1917
|
+
if(_optionalChain$2([session, 'optionalAccess', _44 => _44.topic]) === _optionalChain$2([this, 'access', _45 => _45.session, 'optionalAccess', _46 => _46.topic])) {
|
|
1918
1918
|
localStorage[KEY+':name'] = undefined;
|
|
1919
1919
|
localStorage[KEY+':logo'] = undefined;
|
|
1920
1920
|
this.signClient = undefined;
|
|
@@ -1923,14 +1923,14 @@ class WalletConnectV2 {
|
|
|
1923
1923
|
});
|
|
1924
1924
|
|
|
1925
1925
|
this.signClient.on("session_update", async(session)=> {
|
|
1926
|
-
if(_optionalChain$2([session, 'optionalAccess',
|
|
1926
|
+
if(_optionalChain$2([session, 'optionalAccess', _47 => _47.topic]) === _optionalChain$2([this, 'access', _48 => _48.session, 'optionalAccess', _49 => _49.topic])) {
|
|
1927
1927
|
this.session = this.signClient.session.get(session.topic);
|
|
1928
1928
|
await this.setSessionBlockchains();
|
|
1929
1929
|
}
|
|
1930
1930
|
});
|
|
1931
1931
|
|
|
1932
1932
|
this.signClient.on("session_event", (event)=> {
|
|
1933
|
-
if(_optionalChain$2([event, 'optionalAccess',
|
|
1933
|
+
if(_optionalChain$2([event, 'optionalAccess', _50 => _50.topic]) === _optionalChain$2([this, 'access', _51 => _51.session, 'optionalAccess', _52 => _52.topic])) {}
|
|
1934
1934
|
});
|
|
1935
1935
|
|
|
1936
1936
|
const connectWallet = async()=>{
|
|
@@ -1941,24 +1941,24 @@ class WalletConnectV2 {
|
|
|
1941
1941
|
await new Promise(resolve=>setTimeout(resolve, 500)); // to prevent race condition within WalletConnect
|
|
1942
1942
|
};
|
|
1943
1943
|
|
|
1944
|
-
const lastSession = _optionalChain$2([this, 'optionalAccess',
|
|
1944
|
+
const lastSession = _optionalChain$2([this, 'optionalAccess', _53 => _53.walletName, 'optionalAccess', _54 => _54.length]) ? await getLastSession(this.walletName) : undefined;
|
|
1945
1945
|
if(lastSession) {
|
|
1946
1946
|
this.session = lastSession;
|
|
1947
1947
|
} else {
|
|
1948
1948
|
await connectWallet();
|
|
1949
1949
|
}
|
|
1950
1950
|
|
|
1951
|
-
let meta = _optionalChain$2([this, 'access',
|
|
1951
|
+
let meta = _optionalChain$2([this, 'access', _55 => _55.session, 'optionalAccess', _56 => _56.peer, 'optionalAccess', _57 => _57.metadata]);
|
|
1952
1952
|
if(meta && meta.name) {
|
|
1953
1953
|
this.name = meta.name;
|
|
1954
1954
|
localStorage[KEY+':name'] = meta.name;
|
|
1955
|
-
if(_optionalChain$2([meta, 'optionalAccess',
|
|
1955
|
+
if(_optionalChain$2([meta, 'optionalAccess', _58 => _58.icons]) && meta.icons.length) {
|
|
1956
1956
|
this.logo = meta.icons[0];
|
|
1957
1957
|
localStorage[KEY+':logo'] = this.logo;
|
|
1958
1958
|
}
|
|
1959
1959
|
}
|
|
1960
|
-
if(_optionalChain$2([options, 'optionalAccess',
|
|
1961
|
-
if(_optionalChain$2([options, 'optionalAccess',
|
|
1960
|
+
if(_optionalChain$2([options, 'optionalAccess', _59 => _59.name])) { localStorage[KEY+':name'] = this.name = options.name; }
|
|
1961
|
+
if(_optionalChain$2([options, 'optionalAccess', _60 => _60.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
|
|
1962
1962
|
|
|
1963
1963
|
await this.setSessionBlockchains();
|
|
1964
1964
|
|
|
@@ -2015,7 +2015,7 @@ class WalletConnectV2 {
|
|
|
2015
2015
|
switch (event) {
|
|
2016
2016
|
case 'account':
|
|
2017
2017
|
internalCallback = async(event)=> {
|
|
2018
|
-
if(_optionalChain$2([event, 'optionalAccess',
|
|
2018
|
+
if(_optionalChain$2([event, 'optionalAccess', _61 => _61.topic]) === _optionalChain$2([this, 'access', _62 => _62.session, 'optionalAccess', _63 => _63.topic]) && event.params.event.name === 'accountsChanged') {
|
|
2019
2019
|
callback(await this.account());
|
|
2020
2020
|
}
|
|
2021
2021
|
};
|
package/dist/umd/index.evm.js
CHANGED
|
@@ -1297,7 +1297,7 @@
|
|
|
1297
1297
|
requiredNamespaces: {},
|
|
1298
1298
|
optionalNamespaces: {
|
|
1299
1299
|
eip155: {
|
|
1300
|
-
chains: Blockchains__default['default'].map((blockchain)=>`eip155:${blockchain.networkId}`)
|
|
1300
|
+
chains: Blockchains__default['default'].all.map((blockchain)=>`eip155:${blockchain.networkId}`)
|
|
1301
1301
|
}
|
|
1302
1302
|
},
|
|
1303
1303
|
},
|
|
@@ -1423,13 +1423,13 @@
|
|
|
1423
1423
|
}
|
|
1424
1424
|
|
|
1425
1425
|
async setSessionBlockchains() {
|
|
1426
|
-
if(!this.session) { return }
|
|
1427
|
-
if(_optionalChain$2([CONFIGURATIONS, 'access',
|
|
1428
|
-
this.blockchains = [this.session.namespaces.eip155.chains[this.session.namespaces.eip155.chains.length-1]].map((chainIdentifier)=>_optionalChain$2([Blockchains__default['default'], 'access',
|
|
1426
|
+
if(!this.session || !_optionalChain$2([this, 'access', _27 => _27.session, 'optionalAccess', _28 => _28.namespaces, 'optionalAccess', _29 => _29.eip155])) { return }
|
|
1427
|
+
if(_optionalChain$2([CONFIGURATIONS, 'access', _30 => _30[this.walletName], 'optionalAccess', _31 => _31.methods, 'optionalAccess', _32 => _32.includes, 'call', _33 => _33('wallet_switchEthereumChain')])) {
|
|
1428
|
+
this.blockchains = [this.session.namespaces.eip155.chains[this.session.namespaces.eip155.chains.length-1]].map((chainIdentifier)=>_optionalChain$2([Blockchains__default['default'], 'access', _34 => _34.findByNetworkId, 'call', _35 => _35(chainIdentifier.split(':')[1]), 'optionalAccess', _36 => _36.name])).filter(Boolean);
|
|
1429
1429
|
} else if(this.session.namespaces.eip155.chains) {
|
|
1430
|
-
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$2([Blockchains__default['default'], 'access',
|
|
1430
|
+
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$2([Blockchains__default['default'], 'access', _37 => _37.findByNetworkId, 'call', _38 => _38(chainIdentifier.split(':')[1]), 'optionalAccess', _39 => _39.name])).filter(Boolean);
|
|
1431
1431
|
} else if(this.session.namespaces.eip155.accounts) {
|
|
1432
|
-
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$2([Blockchains__default['default'], 'access',
|
|
1432
|
+
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$2([Blockchains__default['default'], 'access', _40 => _40.findByNetworkId, 'call', _41 => _41(accountIdentifier.split(':')[1]), 'optionalAccess', _42 => _42.name])).filter(Boolean);
|
|
1433
1433
|
}
|
|
1434
1434
|
}
|
|
1435
1435
|
|
|
@@ -1439,13 +1439,13 @@
|
|
|
1439
1439
|
|
|
1440
1440
|
try {
|
|
1441
1441
|
|
|
1442
|
-
this.walletName = _optionalChain$2([options, 'optionalAccess',
|
|
1442
|
+
this.walletName = _optionalChain$2([options, 'optionalAccess', _43 => _43.name]);
|
|
1443
1443
|
|
|
1444
1444
|
// delete localStorage[`wc@2:client:0.3//session`] // DELETE WC SESSIONS
|
|
1445
1445
|
this.signClient = await getSignClient();
|
|
1446
1446
|
|
|
1447
1447
|
this.signClient.on("session_delete", (session)=> {
|
|
1448
|
-
if(_optionalChain$2([session, 'optionalAccess',
|
|
1448
|
+
if(_optionalChain$2([session, 'optionalAccess', _44 => _44.topic]) === _optionalChain$2([this, 'access', _45 => _45.session, 'optionalAccess', _46 => _46.topic])) {
|
|
1449
1449
|
localStorage[KEY+':name'] = undefined;
|
|
1450
1450
|
localStorage[KEY+':logo'] = undefined;
|
|
1451
1451
|
this.signClient = undefined;
|
|
@@ -1454,14 +1454,14 @@
|
|
|
1454
1454
|
});
|
|
1455
1455
|
|
|
1456
1456
|
this.signClient.on("session_update", async(session)=> {
|
|
1457
|
-
if(_optionalChain$2([session, 'optionalAccess',
|
|
1457
|
+
if(_optionalChain$2([session, 'optionalAccess', _47 => _47.topic]) === _optionalChain$2([this, 'access', _48 => _48.session, 'optionalAccess', _49 => _49.topic])) {
|
|
1458
1458
|
this.session = this.signClient.session.get(session.topic);
|
|
1459
1459
|
await this.setSessionBlockchains();
|
|
1460
1460
|
}
|
|
1461
1461
|
});
|
|
1462
1462
|
|
|
1463
1463
|
this.signClient.on("session_event", (event)=> {
|
|
1464
|
-
if(_optionalChain$2([event, 'optionalAccess',
|
|
1464
|
+
if(_optionalChain$2([event, 'optionalAccess', _50 => _50.topic]) === _optionalChain$2([this, 'access', _51 => _51.session, 'optionalAccess', _52 => _52.topic])) {}
|
|
1465
1465
|
});
|
|
1466
1466
|
|
|
1467
1467
|
const connectWallet = async()=>{
|
|
@@ -1472,24 +1472,24 @@
|
|
|
1472
1472
|
await new Promise(resolve=>setTimeout(resolve, 500)); // to prevent race condition within WalletConnect
|
|
1473
1473
|
};
|
|
1474
1474
|
|
|
1475
|
-
const lastSession = _optionalChain$2([this, 'optionalAccess',
|
|
1475
|
+
const lastSession = _optionalChain$2([this, 'optionalAccess', _53 => _53.walletName, 'optionalAccess', _54 => _54.length]) ? await getLastSession(this.walletName) : undefined;
|
|
1476
1476
|
if(lastSession) {
|
|
1477
1477
|
this.session = lastSession;
|
|
1478
1478
|
} else {
|
|
1479
1479
|
await connectWallet();
|
|
1480
1480
|
}
|
|
1481
1481
|
|
|
1482
|
-
let meta = _optionalChain$2([this, 'access',
|
|
1482
|
+
let meta = _optionalChain$2([this, 'access', _55 => _55.session, 'optionalAccess', _56 => _56.peer, 'optionalAccess', _57 => _57.metadata]);
|
|
1483
1483
|
if(meta && meta.name) {
|
|
1484
1484
|
this.name = meta.name;
|
|
1485
1485
|
localStorage[KEY+':name'] = meta.name;
|
|
1486
|
-
if(_optionalChain$2([meta, 'optionalAccess',
|
|
1486
|
+
if(_optionalChain$2([meta, 'optionalAccess', _58 => _58.icons]) && meta.icons.length) {
|
|
1487
1487
|
this.logo = meta.icons[0];
|
|
1488
1488
|
localStorage[KEY+':logo'] = this.logo;
|
|
1489
1489
|
}
|
|
1490
1490
|
}
|
|
1491
|
-
if(_optionalChain$2([options, 'optionalAccess',
|
|
1492
|
-
if(_optionalChain$2([options, 'optionalAccess',
|
|
1491
|
+
if(_optionalChain$2([options, 'optionalAccess', _59 => _59.name])) { localStorage[KEY+':name'] = this.name = options.name; }
|
|
1492
|
+
if(_optionalChain$2([options, 'optionalAccess', _60 => _60.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
|
|
1493
1493
|
|
|
1494
1494
|
await this.setSessionBlockchains();
|
|
1495
1495
|
|
|
@@ -1546,7 +1546,7 @@
|
|
|
1546
1546
|
switch (event) {
|
|
1547
1547
|
case 'account':
|
|
1548
1548
|
internalCallback = async(event)=> {
|
|
1549
|
-
if(_optionalChain$2([event, 'optionalAccess',
|
|
1549
|
+
if(_optionalChain$2([event, 'optionalAccess', _61 => _61.topic]) === _optionalChain$2([this, 'access', _62 => _62.session, 'optionalAccess', _63 => _63.topic]) && event.params.event.name === 'accountsChanged') {
|
|
1550
1550
|
callback(await this.account());
|
|
1551
1551
|
}
|
|
1552
1552
|
};
|
package/dist/umd/index.js
CHANGED
|
@@ -1768,7 +1768,7 @@
|
|
|
1768
1768
|
requiredNamespaces: {},
|
|
1769
1769
|
optionalNamespaces: {
|
|
1770
1770
|
eip155: {
|
|
1771
|
-
chains: Blockchains__default['default'].map((blockchain)=>`eip155:${blockchain.networkId}`)
|
|
1771
|
+
chains: Blockchains__default['default'].all.map((blockchain)=>`eip155:${blockchain.networkId}`)
|
|
1772
1772
|
}
|
|
1773
1773
|
},
|
|
1774
1774
|
},
|
|
@@ -1894,13 +1894,13 @@
|
|
|
1894
1894
|
}
|
|
1895
1895
|
|
|
1896
1896
|
async setSessionBlockchains() {
|
|
1897
|
-
if(!this.session) { return }
|
|
1898
|
-
if(_optionalChain$2([CONFIGURATIONS, 'access',
|
|
1899
|
-
this.blockchains = [this.session.namespaces.eip155.chains[this.session.namespaces.eip155.chains.length-1]].map((chainIdentifier)=>_optionalChain$2([Blockchains__default['default'], 'access',
|
|
1897
|
+
if(!this.session || !_optionalChain$2([this, 'access', _27 => _27.session, 'optionalAccess', _28 => _28.namespaces, 'optionalAccess', _29 => _29.eip155])) { return }
|
|
1898
|
+
if(_optionalChain$2([CONFIGURATIONS, 'access', _30 => _30[this.walletName], 'optionalAccess', _31 => _31.methods, 'optionalAccess', _32 => _32.includes, 'call', _33 => _33('wallet_switchEthereumChain')])) {
|
|
1899
|
+
this.blockchains = [this.session.namespaces.eip155.chains[this.session.namespaces.eip155.chains.length-1]].map((chainIdentifier)=>_optionalChain$2([Blockchains__default['default'], 'access', _34 => _34.findByNetworkId, 'call', _35 => _35(chainIdentifier.split(':')[1]), 'optionalAccess', _36 => _36.name])).filter(Boolean);
|
|
1900
1900
|
} else if(this.session.namespaces.eip155.chains) {
|
|
1901
|
-
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$2([Blockchains__default['default'], 'access',
|
|
1901
|
+
this.blockchains = this.session.namespaces.eip155.chains.map((chainIdentifier)=>_optionalChain$2([Blockchains__default['default'], 'access', _37 => _37.findByNetworkId, 'call', _38 => _38(chainIdentifier.split(':')[1]), 'optionalAccess', _39 => _39.name])).filter(Boolean);
|
|
1902
1902
|
} else if(this.session.namespaces.eip155.accounts) {
|
|
1903
|
-
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$2([Blockchains__default['default'], 'access',
|
|
1903
|
+
this.blockchains = this.session.namespaces.eip155.accounts.map((accountIdentifier)=>_optionalChain$2([Blockchains__default['default'], 'access', _40 => _40.findByNetworkId, 'call', _41 => _41(accountIdentifier.split(':')[1]), 'optionalAccess', _42 => _42.name])).filter(Boolean);
|
|
1904
1904
|
}
|
|
1905
1905
|
}
|
|
1906
1906
|
|
|
@@ -1910,13 +1910,13 @@
|
|
|
1910
1910
|
|
|
1911
1911
|
try {
|
|
1912
1912
|
|
|
1913
|
-
this.walletName = _optionalChain$2([options, 'optionalAccess',
|
|
1913
|
+
this.walletName = _optionalChain$2([options, 'optionalAccess', _43 => _43.name]);
|
|
1914
1914
|
|
|
1915
1915
|
// delete localStorage[`wc@2:client:0.3//session`] // DELETE WC SESSIONS
|
|
1916
1916
|
this.signClient = await getSignClient();
|
|
1917
1917
|
|
|
1918
1918
|
this.signClient.on("session_delete", (session)=> {
|
|
1919
|
-
if(_optionalChain$2([session, 'optionalAccess',
|
|
1919
|
+
if(_optionalChain$2([session, 'optionalAccess', _44 => _44.topic]) === _optionalChain$2([this, 'access', _45 => _45.session, 'optionalAccess', _46 => _46.topic])) {
|
|
1920
1920
|
localStorage[KEY+':name'] = undefined;
|
|
1921
1921
|
localStorage[KEY+':logo'] = undefined;
|
|
1922
1922
|
this.signClient = undefined;
|
|
@@ -1925,14 +1925,14 @@
|
|
|
1925
1925
|
});
|
|
1926
1926
|
|
|
1927
1927
|
this.signClient.on("session_update", async(session)=> {
|
|
1928
|
-
if(_optionalChain$2([session, 'optionalAccess',
|
|
1928
|
+
if(_optionalChain$2([session, 'optionalAccess', _47 => _47.topic]) === _optionalChain$2([this, 'access', _48 => _48.session, 'optionalAccess', _49 => _49.topic])) {
|
|
1929
1929
|
this.session = this.signClient.session.get(session.topic);
|
|
1930
1930
|
await this.setSessionBlockchains();
|
|
1931
1931
|
}
|
|
1932
1932
|
});
|
|
1933
1933
|
|
|
1934
1934
|
this.signClient.on("session_event", (event)=> {
|
|
1935
|
-
if(_optionalChain$2([event, 'optionalAccess',
|
|
1935
|
+
if(_optionalChain$2([event, 'optionalAccess', _50 => _50.topic]) === _optionalChain$2([this, 'access', _51 => _51.session, 'optionalAccess', _52 => _52.topic])) {}
|
|
1936
1936
|
});
|
|
1937
1937
|
|
|
1938
1938
|
const connectWallet = async()=>{
|
|
@@ -1943,24 +1943,24 @@
|
|
|
1943
1943
|
await new Promise(resolve=>setTimeout(resolve, 500)); // to prevent race condition within WalletConnect
|
|
1944
1944
|
};
|
|
1945
1945
|
|
|
1946
|
-
const lastSession = _optionalChain$2([this, 'optionalAccess',
|
|
1946
|
+
const lastSession = _optionalChain$2([this, 'optionalAccess', _53 => _53.walletName, 'optionalAccess', _54 => _54.length]) ? await getLastSession(this.walletName) : undefined;
|
|
1947
1947
|
if(lastSession) {
|
|
1948
1948
|
this.session = lastSession;
|
|
1949
1949
|
} else {
|
|
1950
1950
|
await connectWallet();
|
|
1951
1951
|
}
|
|
1952
1952
|
|
|
1953
|
-
let meta = _optionalChain$2([this, 'access',
|
|
1953
|
+
let meta = _optionalChain$2([this, 'access', _55 => _55.session, 'optionalAccess', _56 => _56.peer, 'optionalAccess', _57 => _57.metadata]);
|
|
1954
1954
|
if(meta && meta.name) {
|
|
1955
1955
|
this.name = meta.name;
|
|
1956
1956
|
localStorage[KEY+':name'] = meta.name;
|
|
1957
|
-
if(_optionalChain$2([meta, 'optionalAccess',
|
|
1957
|
+
if(_optionalChain$2([meta, 'optionalAccess', _58 => _58.icons]) && meta.icons.length) {
|
|
1958
1958
|
this.logo = meta.icons[0];
|
|
1959
1959
|
localStorage[KEY+':logo'] = this.logo;
|
|
1960
1960
|
}
|
|
1961
1961
|
}
|
|
1962
|
-
if(_optionalChain$2([options, 'optionalAccess',
|
|
1963
|
-
if(_optionalChain$2([options, 'optionalAccess',
|
|
1962
|
+
if(_optionalChain$2([options, 'optionalAccess', _59 => _59.name])) { localStorage[KEY+':name'] = this.name = options.name; }
|
|
1963
|
+
if(_optionalChain$2([options, 'optionalAccess', _60 => _60.logo])) { localStorage[KEY+':logo'] = this.logo = options.logo; }
|
|
1964
1964
|
|
|
1965
1965
|
await this.setSessionBlockchains();
|
|
1966
1966
|
|
|
@@ -2017,7 +2017,7 @@
|
|
|
2017
2017
|
switch (event) {
|
|
2018
2018
|
case 'account':
|
|
2019
2019
|
internalCallback = async(event)=> {
|
|
2020
|
-
if(_optionalChain$2([event, 'optionalAccess',
|
|
2020
|
+
if(_optionalChain$2([event, 'optionalAccess', _61 => _61.topic]) === _optionalChain$2([this, 'access', _62 => _62.session, 'optionalAccess', _63 => _63.topic]) && event.params.event.name === 'accountsChanged') {
|
|
2021
2021
|
callback(await this.account());
|
|
2022
2022
|
}
|
|
2023
2023
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depay/web3-wallets-evm",
|
|
3
3
|
"moduleName": "Web3Wallets",
|
|
4
|
-
"version": "16.2.
|
|
4
|
+
"version": "16.2.8",
|
|
5
5
|
"description": "One-Stop-Shop JavaScript library to integrate various web3 crypto wallets and multiple blockchains at once with a single interface.",
|
|
6
6
|
"main": "dist/umd/index.evm.js",
|
|
7
7
|
"module": "dist/esm/index.evm.js",
|