@@ -164,7 +164,7 @@ A common UX pattern is to remember the wallet(s) that a user has previously conn
164
164
You could enable this in your app by first syncing the ` wallets ` array to localStorage:
165
165
166
166
``` javascript
167
- const walletsSub = onboard .selectState (' wallets' )
167
+ const walletsSub = onboard .state . select (' wallets' )
168
168
const { unsubscribe } = walletsSub .subscribe (wallets => {
169
169
const connectedWallets = wallets .map (({ label }) => label)
170
170
window .localStorage .setItem (
@@ -186,12 +186,12 @@ const previouslyConnectedWallets = JSON.parse(
186
186
187
187
if (previouslyConnectedWallets) {
188
188
// Connect the most recently connected wallet (first in the array)
189
- await onboard .connectWallet (previouslyConnectedWallets[0 ])
189
+ await onboard .connectWallet ({ autoSelect : previouslyConnectedWallets[0 ] } )
190
190
191
191
// OR - loop through and initiate connection for all previously connected wallets
192
192
// note: This UX might not be great as the user may need to login to each wallet one after the other
193
193
// for (walletLabel in previouslyConnectedWallets) {
194
- // await onboard.connectWallet(walletLabel)
194
+ // await onboard.connectWallet({ autoSelect: walletLabel } )
195
195
// }
196
196
}
197
197
```
@@ -203,7 +203,7 @@ A wallet can be disconnected, which will cleanup any background operations the w
203
203
``` javascript
204
204
// disconnect the first wallet in the wallets array
205
205
const [primaryWallet ] = onboard .state .get ().wallets
206
- await onboard .disconnectWallet (primaryWallet .label )
206
+ await onboard .disconnectWallet ({ label : primaryWallet .label } )
207
207
```
208
208
209
209
The ` disconnectWallet ` method takes the ` wallet.label ` value and returns a ` Promise ` that resolves to the current state of the ` wallets ` array.
0 commit comments