Skip to main content
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

ParameterTypeDescription
walletAccountWalletAccountThe wallet account to inspect

Returns

booleantrue 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);
};