useWallets
The useWallets
hook returns an array of wallets that are available to the user. The wallets are
sorted by their priority, with the highest priority wallet being the first in the array.
import { useWallets } from '@mysten/dapp-kit';
function MyComponent() {
const wallets = useWallets();
return (
<div>
<h2>Installed wallets</h2>
{wallets.length === 0 && <div>No wallets installed</div>}
<ul>
{wallets.map((wallet) => (
<li key={wallet.name}>{wallet.name}</li>
))}
</ul>
</div>
);
}
Example
Wallet properties
name
- The name of the wallet.version
- The version of the wallet as a string.icon
- A data URL of the wallet icon as an SVG.accounts
- An array of accounts that are available in the wallet.features
- An object with all the wallet-standard (opens in a new tab) features implemented by the wallet.chains
- An array of chain identifiers that the wallet supports.