@depay/web3-wallets-evm 13.0.0 → 13.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 +9 -0
- package/dist/esm/index.evm.js +14 -1
- package/dist/esm/index.js +18 -4
- package/dist/umd/index.evm.js +14 -0
- package/dist/umd/index.js +18 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -99,6 +99,15 @@ if(foundWallets.length == 1) {
|
|
|
99
99
|
}
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
+
### getConnectedWallets
|
|
103
|
+
|
|
104
|
+
`getConnectedWallets`: Returns an array of currently connected wallets.
|
|
105
|
+
|
|
106
|
+
```javascript
|
|
107
|
+
let wallets = await getConnectedWallets();
|
|
108
|
+
// [<Wallet name='MetaMask'>, <Wallet name='Phantom'>]
|
|
109
|
+
```
|
|
110
|
+
|
|
102
111
|
### Name
|
|
103
112
|
|
|
104
113
|
`name:string`: Returns the name of the wallet.
|
package/dist/esm/index.evm.js
CHANGED
|
@@ -864,6 +864,19 @@ const getWallets = ()=>{
|
|
|
864
864
|
return availableWallets
|
|
865
865
|
};
|
|
866
866
|
|
|
867
|
+
const getConnectedWallets = async()=>{
|
|
868
|
+
|
|
869
|
+
let connectedWallets = (await Promise.all(
|
|
870
|
+
getWallets().map(async(wallet)=>{
|
|
871
|
+
if(await wallet.account()) {
|
|
872
|
+
return wallet
|
|
873
|
+
}
|
|
874
|
+
})
|
|
875
|
+
)).filter((value)=>!!value);
|
|
876
|
+
|
|
877
|
+
return connectedWallets
|
|
878
|
+
};
|
|
879
|
+
|
|
867
880
|
const supported = [
|
|
868
881
|
wallets.MetaMask,
|
|
869
882
|
wallets.Coinbase,
|
|
@@ -871,4 +884,4 @@ const supported = [
|
|
|
871
884
|
wallets.WalletLink
|
|
872
885
|
];
|
|
873
886
|
|
|
874
|
-
export { getWallets, supported, wallets };
|
|
887
|
+
export { getConnectedWallets, getWallets, supported, wallets };
|
package/dist/esm/index.js
CHANGED
|
@@ -444,9 +444,10 @@ class WindowSolana {
|
|
|
444
444
|
}
|
|
445
445
|
|
|
446
446
|
async account() {
|
|
447
|
-
if(_optionalChain$3([window, 'optionalAccess', _7 => _7.solana
|
|
448
|
-
if(_optionalChain$3([window, 'optionalAccess', _9 => _9.
|
|
449
|
-
let
|
|
447
|
+
if(_optionalChain$3([window, 'optionalAccess', _7 => _7.solana]) == undefined){ return }
|
|
448
|
+
if(_optionalChain$3([window, 'optionalAccess', _8 => _8.solana, 'optionalAccess', _9 => _9.publicKey])) { return window.solana.publicKey.toString() }
|
|
449
|
+
let publicKey;
|
|
450
|
+
try { ({ publicKey } = await window.solana.connect({ onlyIfTrusted: true })); } catch (e) {}
|
|
450
451
|
if(publicKey){ return publicKey.toString() }
|
|
451
452
|
}
|
|
452
453
|
|
|
@@ -1054,6 +1055,19 @@ const getWallets = ()=>{
|
|
|
1054
1055
|
return availableWallets
|
|
1055
1056
|
};
|
|
1056
1057
|
|
|
1058
|
+
const getConnectedWallets = async()=>{
|
|
1059
|
+
|
|
1060
|
+
let connectedWallets = (await Promise.all(
|
|
1061
|
+
getWallets().map(async(wallet)=>{
|
|
1062
|
+
if(await wallet.account()) {
|
|
1063
|
+
return wallet
|
|
1064
|
+
}
|
|
1065
|
+
})
|
|
1066
|
+
)).filter((value)=>!!value);
|
|
1067
|
+
|
|
1068
|
+
return connectedWallets
|
|
1069
|
+
};
|
|
1070
|
+
|
|
1057
1071
|
const supported = [
|
|
1058
1072
|
wallets.MetaMask,
|
|
1059
1073
|
wallets.Phantom,
|
|
@@ -1062,4 +1076,4 @@ const supported = [
|
|
|
1062
1076
|
wallets.WalletLink
|
|
1063
1077
|
];
|
|
1064
1078
|
|
|
1065
|
-
export { getWallets, supported, wallets };
|
|
1079
|
+
export { getConnectedWallets, getWallets, supported, wallets };
|
package/dist/umd/index.evm.js
CHANGED
|
@@ -863,6 +863,19 @@
|
|
|
863
863
|
return availableWallets
|
|
864
864
|
};
|
|
865
865
|
|
|
866
|
+
const getConnectedWallets = async()=>{
|
|
867
|
+
|
|
868
|
+
let connectedWallets = (await Promise.all(
|
|
869
|
+
getWallets().map(async(wallet)=>{
|
|
870
|
+
if(await wallet.account()) {
|
|
871
|
+
return wallet
|
|
872
|
+
}
|
|
873
|
+
})
|
|
874
|
+
)).filter((value)=>!!value);
|
|
875
|
+
|
|
876
|
+
return connectedWallets
|
|
877
|
+
};
|
|
878
|
+
|
|
866
879
|
const supported = [
|
|
867
880
|
wallets.MetaMask,
|
|
868
881
|
wallets.Coinbase,
|
|
@@ -870,6 +883,7 @@
|
|
|
870
883
|
wallets.WalletLink
|
|
871
884
|
];
|
|
872
885
|
|
|
886
|
+
exports.getConnectedWallets = getConnectedWallets;
|
|
873
887
|
exports.getWallets = getWallets;
|
|
874
888
|
exports.supported = supported;
|
|
875
889
|
exports.wallets = wallets;
|
package/dist/umd/index.js
CHANGED
|
@@ -442,9 +442,10 @@
|
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
async account() {
|
|
445
|
-
if(_optionalChain$3([window, 'optionalAccess', _7 => _7.solana
|
|
446
|
-
if(_optionalChain$3([window, 'optionalAccess', _9 => _9.
|
|
447
|
-
let
|
|
445
|
+
if(_optionalChain$3([window, 'optionalAccess', _7 => _7.solana]) == undefined){ return }
|
|
446
|
+
if(_optionalChain$3([window, 'optionalAccess', _8 => _8.solana, 'optionalAccess', _9 => _9.publicKey])) { return window.solana.publicKey.toString() }
|
|
447
|
+
let publicKey;
|
|
448
|
+
try { ({ publicKey } = await window.solana.connect({ onlyIfTrusted: true })); } catch (e) {}
|
|
448
449
|
if(publicKey){ return publicKey.toString() }
|
|
449
450
|
}
|
|
450
451
|
|
|
@@ -1052,6 +1053,19 @@
|
|
|
1052
1053
|
return availableWallets
|
|
1053
1054
|
};
|
|
1054
1055
|
|
|
1056
|
+
const getConnectedWallets = async()=>{
|
|
1057
|
+
|
|
1058
|
+
let connectedWallets = (await Promise.all(
|
|
1059
|
+
getWallets().map(async(wallet)=>{
|
|
1060
|
+
if(await wallet.account()) {
|
|
1061
|
+
return wallet
|
|
1062
|
+
}
|
|
1063
|
+
})
|
|
1064
|
+
)).filter((value)=>!!value);
|
|
1065
|
+
|
|
1066
|
+
return connectedWallets
|
|
1067
|
+
};
|
|
1068
|
+
|
|
1055
1069
|
const supported = [
|
|
1056
1070
|
wallets.MetaMask,
|
|
1057
1071
|
wallets.Phantom,
|
|
@@ -1060,6 +1074,7 @@
|
|
|
1060
1074
|
wallets.WalletLink
|
|
1061
1075
|
];
|
|
1062
1076
|
|
|
1077
|
+
exports.getConnectedWallets = getConnectedWallets;
|
|
1063
1078
|
exports.getWallets = getWallets;
|
|
1064
1079
|
exports.supported = supported;
|
|
1065
1080
|
exports.wallets = wallets;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depay/web3-wallets-evm",
|
|
3
3
|
"moduleName": "Web3Wallets",
|
|
4
|
-
"version": "13.
|
|
4
|
+
"version": "13.1.0",
|
|
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",
|