@depay/web3-wallets-evm 14.9.2 → 15.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -39
- package/dist/esm/index.evm.js +96 -382
- package/dist/esm/index.js +117 -403
- package/dist/umd/index.evm.js +99 -385
- package/dist/umd/index.js +120 -406
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,25 +72,25 @@ import { getWallets } from '@depay/web3-wallets-evm'
|
|
|
72
72
|
`getWallets`: Returns an array of available/connectable wallets.
|
|
73
73
|
|
|
74
74
|
```javascript
|
|
75
|
-
let
|
|
75
|
+
let availableWallets = await getWallets();
|
|
76
76
|
// [<Wallet name='MetaMask'>, <Wallet name='Phantom'>]
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
```javascript
|
|
80
|
-
let
|
|
80
|
+
let availableWallets = await getWallets();
|
|
81
81
|
// [] no wallets detected. (you can still try WalletConnect or WalletLink)
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
```javascript
|
|
85
85
|
import { getWallets, wallets } from "@depay/web3-wallets"
|
|
86
86
|
|
|
87
|
-
let
|
|
87
|
+
let availableWallets = await getWallets()
|
|
88
88
|
|
|
89
89
|
let wallet
|
|
90
|
-
if(
|
|
91
|
-
wallet =
|
|
92
|
-
} else if(
|
|
93
|
-
wallet =
|
|
90
|
+
if(availableWallets.length == 1) {
|
|
91
|
+
wallet = availableWallets[0]
|
|
92
|
+
} else if(availableWallets.length > 1) {
|
|
93
|
+
wallet = availableWallets[parseInt(prompt('Which wallet do you want to connect?'), 10)]
|
|
94
94
|
} else {
|
|
95
95
|
// Let the user choose:
|
|
96
96
|
// you can still try to connect via wallets.WalletConnect.connect()
|
|
@@ -99,38 +99,6 @@ 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
|
-
|
|
111
|
-
### WalletConnectV2
|
|
112
|
-
|
|
113
|
-
```javascript
|
|
114
|
-
import { wallets } from "@depay/web3-wallets"
|
|
115
|
-
import QRCodeStyling from "qr-code-styling"
|
|
116
|
-
|
|
117
|
-
let wallet = new wallets.WalletConnectV2()
|
|
118
|
-
|
|
119
|
-
await wallet.connect({
|
|
120
|
-
blockchain: 'ethereum',
|
|
121
|
-
connect: ({ uri })=>{
|
|
122
|
-
const qrCode = new QRCodeStyling({
|
|
123
|
-
width: 300,
|
|
124
|
-
height: 300,
|
|
125
|
-
type: "svg",
|
|
126
|
-
data: uri,
|
|
127
|
-
});
|
|
128
|
-
qrCode.append(document.getElementById("walletConnectQRCode"));
|
|
129
|
-
}
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
```
|
|
133
|
-
|
|
134
102
|
### Name
|
|
135
103
|
|
|
136
104
|
`name:string`: Returns the name of the wallet.
|