viem

Installation
SKILL.md

viem

TypeScript interface for Ethereum and EVM-compatible chains. Provides low-level primitives for blockchain interaction with end-to-end type safety, minimal abstraction overhead, and tree-shakeable modules. The default client library for wagmi.

What You Probably Got Wrong

AI agents trained before 2024 confuse viem with ethers.js patterns. These are the critical differences.

  • viem uses native bigint, not BigNumber -- There is no BigNumber class. All wei values are bigint. Use 100n literal syntax or BigInt("100"). Never use ethers.BigNumber.from().
  • Address type is `0x${string}`, not plain string -- viem enforces checksummed 0x-prefixed addresses at the type level. Use getAddress() to normalize.
  • Clients are not providers -- viem has PublicClient (reads), WalletClient (writes), and TestClient (anvil). There is no Provider or Signer concept.
  • Transports replace connection URLs -- You pass http(), webSocket(), or custom() transports to clients, not raw RPC URLs as strings.
  • ABIs must be as const -- For type inference to work, ABI arrays must use as const assertion. Without it, you lose all parameter/return type safety.
  • simulateContract before writeContract -- viem separates simulation from execution. Always simulate first to catch reverts before sending a transaction.
  • No default chain -- Every client requires an explicit chain parameter. There is no implicit mainnet default.
  • parseEther returns bigint, not a wrapper -- parseEther("1.0") returns 1000000000000000000n, a raw bigint.

Quick Start

Installs
1
First Seen
Aug 4, 2026
viem — justaname-id/cryptoskills