useWallets
Hook for managing connected wallets
Import
Usage
Return Type: UseWalletsReturnType
The hook returns an object with the following properties:
Properties
wallets
ConnectedWallet[]
Array of all connected wallets.
linkedWallets
LinkedWallet[] | undefined
Array of linked wallets for the active embedded wallet (if any). Only available when using a WaaS wallet.
setActiveWallet
(address: string) => Promise<void>
Function to set a wallet as active by its address.
Parameter | Type | Description |
---|---|---|
address | string | The Ethereum address of the wallet to set as active |
disconnectWallet
(address: string) => Promise<void>
Function to disconnect a wallet by its address.
Parameter | Type | Description |
---|---|---|
address | string | The Ethereum address of the wallet to disconnect |
refetchLinkedWallets
() => Promise<void>
Function to refresh the list of linked wallets. Useful after linking a new wallet.
Notes
This hook provides a unified interface for managing connected wallets, both embedded (WaaS) and external wallets.
Key features:
- Get information about all connected wallets
- Set a specific wallet as active
- Disconnect wallets
- View linked wallets for embedded wallets
- Refresh the list of linked wallets
For embedded wallets (Wallet-as-a-Service), the hook automatically fetches linked wallets if available. Linked wallets are additional wallets that have been connected to the primary embedded wallet.
Was this page helpful?