Skip to main content
When working with multiple blockchain types, you may need to check if a wallet account is specifically a Bitcoin wallet account. The isBitcoinWalletAccount type guard function helps you narrow down the type safely.

Usage

import { isBitcoinWalletAccount } from '@dynamic-labs-sdk/bitcoin';
import { getPrimaryWalletAccount } from '@dynamic-labs-sdk/client';

const walletAccount = getPrimaryWalletAccount();

if (walletAccount && isBitcoinWalletAccount(walletAccount)) {
  // walletAccount is now typed as BitcoinWalletAccount
  console.log('Bitcoin address:', walletAccount.address);
}

Parameters

ParameterTypeDescription
walletAccountWalletAccountThe wallet account to check

Returns

boolean - Returns true if the wallet account is a Bitcoin wallet account, false otherwise. Also acts as a TypeScript type guard, narrowing the type to BitcoinWalletAccount.