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 EVM methods require you to pass a EVM WalletAccount object. If you want to check if a certain wallet account is a
EVM WalletAccount, you can use the isEvmWalletAccount helper method to avoid type errors.
import { isEvmWalletAccount } from '@dynamic-labs-sdk/evm';
import { createWalletClientForWalletAccount } from '@dynamic-labs-sdk/evm/viem';
const sendTransaction = async (walletAccount, transaction) => {
if (!isEvmWalletAccount(walletAccount)) {
throw new Error('This wallet account is not a EVM wallet account');
}
const walletClient = await createWalletClientForWalletAccount({ walletAccount });
const result = await walletClient.sendTransaction(transaction);
console.log('Transaction sent:', result);
// ...
}
React
isEvmWalletAccount is a synchronous type guard that works the same in React. Use it inside callbacks or to filter wallet accounts reactively:
import { isEvmWalletAccount } from '@dynamic-labs-sdk/evm';
import { useWalletAccounts } from '@dynamic-labs-sdk/react-hooks';
function EvmWalletDisplay() {
const walletAccounts = useWalletAccounts();
const evmAccount = walletAccounts.find(isEvmWalletAccount);
if (!evmAccount) return <p>No EVM wallet connected</p>;
return <p>EVM address: {evmAccount.address}</p>;
}