Skip to main content
Skill — Copyable reference implementation. Use as-is or customize. See Skills Philosophy.

WalletClient Implementation

This Skill documents how to implement a viem-compatible WalletClient using Voltaire primitives. The implementation provides a drop-in replacement for viem’s wallet functionality.

Quick Start

Account Types

Local Account

Local accounts sign transactions and messages locally using a private key. The signed data is then sent to the network via eth_sendRawTransaction.

JSON-RPC Account

JSON-RPC accounts delegate signing to an external wallet (like MetaMask). The wallet handles signing via eth_sendTransaction, personal_sign, etc.

Wallet Actions

sendTransaction

Creates, signs, and sends a transaction to the network.

signMessage

Signs a message using EIP-191 format.

signTypedData

Signs EIP-712 typed data.

signTransaction

Signs a transaction without broadcasting it.

getAddresses / requestAddresses

Extend Pattern

Add custom actions to the client:

Transports

HTTP Transport

Custom Transport (EIP-1193 Provider)

Fallback Transport

Chain Configuration

Error Handling

Integration with PublicClient

WalletClient is typically used alongside PublicClient for read operations:

File Structure

Implementation Notes

  1. Account Hoisting: Account can be set on client creation, automatically used by all actions
  2. parseAccount: Converts string address to JSON-RPC account object
  3. Chain Validation: Validates connected chain matches expected chain before sending
  4. Fee Estimation: Automatically estimates EIP-1559 fees if not provided
  5. Transaction Preparation: Fills nonce, gas, fees automatically
  6. Extend Pattern: Allows adding custom actions while preserving base functionality