Skip to main content
Some Solana methods require you to pass a Solana WalletAccount object. If you want to check if a certain wallet account is a Solana WalletAccount, you can use the isSolanaWalletAccount helper method to avoid type errors.
import { isSolanaWalletAccount, signAndSendTransaction } from '@dynamic-labs-sdk/solana';

const sendTransaction = async (walletAccount, transaction) => {
  if (!isSolanaWalletAccount(walletAccount)) {
    throw new Error('This wallet account is not a Solana wallet account');
  }

  const { signature } = await signAndSendTransaction({ transaction, walletAccount });

  // ...
}