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.
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 });
// ...
}
React
isSolanaWalletAccount is a synchronous type guard that works the same in React. Use it inside callbacks or to filter wallet accounts reactively:
import { isSolanaWalletAccount } from '@dynamic-labs-sdk/solana';
import { useWalletAccounts } from '@dynamic-labs-sdk/react-hooks';
function SolanaWalletDisplay() {
const walletAccounts = useWalletAccounts();
const solanaAccount = walletAccounts.find(isSolanaWalletAccount);
if (!solanaAccount) return <p>No Solana wallet connected</p>;
return <p>Solana address: {solanaAccount.address}</p>;
}