Skip to main content

Check if a wallet is an Ethereum wallet

      const wallet = dynamicClient.wallets.primary

      if (!wallet) {
        throw new Error('Wallet is not found')
      }

      if (wallet.chain !== 'EVM') {
        throw new Error('Wallet is not a EVM wallet')
      }

Read only actions/Viem Public Client

If you want to read data from the blockchain, you will want a “Public Client” (Viem terminology)
import { ViemExtension } from '@dynamic-labs/viem-extension'

export const dynamicClient = createClient({
  environmentId: 'YOUR-ENVIRONMENT-ID',
}).extend(ViemExtension())

Write actions/Viem Wallet Client

If you want to write data to the blockchain, you will need a “Wallet Client” (Viem terminology), or a “Signer” (Ethers terminology). Both allow you to sign transactions with the private key.
import { createClient } from '@dynamic-labs/client'
import { ViemExtension } from '@dynamic-labs/viem-extension'

export const dynamicClient = createClient({
  environmentId: 'YOUR-ENVIRONMENT-ID',
}).extend(ViemExtension())

Send multiple transactions atomically

If you want to send multiple transactions atomically, you can use the sendCalls method. This requires the wallet to support EIP-5792. Coming soon.

Examples

We’ve included a few examples of how to use the EVM wallet connector in this section: