Skip to main content
viem is a popular TypeScript library for interacting with EVM chains. This guide shows how to use viem with DFNS wallets.
See complete working examples in the dfns-sdk-ts repository, including account abstraction integrations with Alchemy, Biconomy, Pimlico, and ZeroDev.

Setup

Install the required packages:

Creating a DFNS-backed viem account

Use DfnsWallet and toAccount from the SDK to create a viem-compatible account:

Sending transactions

Simple ETH transfer

Contract interaction

EIP-712 typed data signing

Account abstraction (gasless transactions)

DFNS wallets work with account abstraction providers for gasless transactions. The SDK includes examples for:

Example with Alchemy

Multicall (batch transactions)

Batch multiple contract calls in a single transaction:
See the multicall example for complete implementation.

Reading contract data

Use a public client for read operations (no signing needed):

Using DFNS Broadcast API instead

For better policy integration, you may prefer using the DFNS Broadcast API directly:
This approach integrates with DFNS policies and provides consistent transaction tracking.

viem examples

Complete working examples

TypeScript SDK

DFNS TypeScript SDK documentation

EVM Signing

EVM signature types reference

EVM Broadcast

EVM transaction broadcast reference
Last modified on June 8, 2026