Skip to content

Commit ff28f1c

Browse files
committed
doc: update desc for switchAccount
1 parent 4ceb4c0 commit ff28f1c

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

website/docs/Hooks/useWallet.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,19 @@ function YourComponent() {
240240
const wallet = useWallet();
241241

242242
function handleGetAccounts() {
243-
if (!wallet.connected) return
244-
const accounts = getAccounts()
243+
if (!wallet.connected) return;
244+
const accounts = wallet.getAccounts();
245+
console.log('Permitted accounts of this wallet:', accounts)
245246
}
246247
}
247248
```
248249

249250
### switchAccount
250251

251-
Switches the current main `account` to the one with the given address. Accepts optional callbacks for success and error handling.
252+
Switches the current main `account` to the one with the given address.
253+
254+
Make sure the address you're switching to is available in the wallet's accounts. You can use `wallet.getAccounts()` to get the list of available accounts.
255+
252256

253257
| Type | Default |
254258
| --------------------------------------------------------------------------------------------------------- | ------- |
@@ -280,14 +284,6 @@ function YourComponent() {
280284
}
281285
```
282286

283-
:::caution
284-
Make sure the address you're switching to is available in the wallet's accounts. You can use `getAccounts()` to get the list of available addresses first.
285-
:::
286-
287-
:::tip
288-
The `opts` parameter is optional. You can provide either both callbacks, just one, or none at all depending on your needs.
289-
:::
290-
291287
### chains
292288

293289
Configuration of supported chains from WalletProvider

0 commit comments

Comments
 (0)