Viem is one of the most popular libraries for interacting with EVM blockchains. A WalletClient is an interface to interact with EVM accounts and provides the ability to retrieve accounts, execute transactions, sign messages, etc. We provide a helper method to allow you to create a Viem WalletClient for a given wallet account.

Usage

import { createWalletClientForWalletAccount } from '@dynamic-labs-sdk/evm/viem';

const sendTransaction = async (walletAccount, transaction) => {
  const walletClient = await createWalletClientForWalletAccount({
    walletAccount,
  });

  const result = await walletClient.sendTransaction(transaction);
  console.log('Transaction sent:', result);

  // ...
};