Documentation Index
Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
Use this file to discover all available pages before exploring further.
Checks whether a wallet account was connected via a hardware wallet (e.g., a Ledger device). Use this
to display hardware wallet indicators in your UI or apply hardware-wallet-specific logic.
Usage
import { isHardwareWalletAccount, getPrimaryWalletAccount } from '@dynamic-labs-sdk/client';
const walletAccount = getPrimaryWalletAccount();
if (walletAccount && isHardwareWalletAccount({ walletAccount })) {
console.log('Connected via hardware wallet');
console.log('Vendor:', walletAccount.hardwareWalletVendor); // 'ledger'
}
Parameters
| Parameter | Type | Description |
|---|
walletAccount | WalletAccount | The wallet account to inspect |
Returns
boolean — true if the wallet account was connected via a hardware wallet, false otherwise.
When true, the account’s hardwareWalletVendor field is set to the vendor name (e.g., 'ledger').
Examples
Check primary wallet
import {
isHardwareWalletAccount,
getPrimaryWalletAccount,
} from '@dynamic-labs-sdk/client';
const walletAccount = getPrimaryWalletAccount();
if (walletAccount) {
const isHardware = isHardwareWalletAccount({ walletAccount });
console.log('Hardware wallet:', isHardware);
}
Filter hardware wallet accounts
import {
isHardwareWalletAccount,
getWalletAccounts,
} from '@dynamic-labs-sdk/client';
const allAccounts = getWalletAccounts();
const hardwareAccounts = allAccounts.filter((account) =>
isHardwareWalletAccount({ walletAccount: account })
);
console.log('Hardware wallet accounts:', hardwareAccounts.length);
Display hardware wallet badge
import { isHardwareWalletAccount } from '@dynamic-labs-sdk/client';
const renderAccountLabel = (walletAccount) => {
const isHardware = isHardwareWalletAccount({ walletAccount });
const label = isHardware
? `${walletAccount.address} (${walletAccount.hardwareWalletVendor})`
: walletAccount.address;
console.log('Account label:', label);
};
React
isHardwareWalletAccount is synchronous and works the same in React. Use it to display hardware wallet indicators in your wallet list:
import { isHardwareWalletAccount } from '@dynamic-labs-sdk/client';
import { useWalletAccounts } from '@dynamic-labs-sdk/react-hooks';
function WalletList() {
const walletAccounts = useWalletAccounts();
return (
<ul>
{walletAccounts.map((account) => (
<li key={account.address}>
{account.address}
{isHardwareWalletAccount({ walletAccount: account }) && (
<span> ({account.hardwareWalletVendor} hardware wallet)</span>
)}
</li>
))}
</ul>
);
}