Viem Documentation

website·Indexed 38 days ago

https://viem.sh

A lightweight and type-safe TypeScript interface for building Ethereum applications. Viem provides low-level abstractions for wallet actions, transaction management, ABI encoding/decoding, and JSON-RPC API interaction via Public, Wallet, and Test clients. It supports modern browsers and Node.js, featuring specialized transports (HTTP, WebSocket, IPC, Fallback) and support for EIP-7702 and Blob Transactions.

Tokens
311.5K
Snippets
1.5K
Records
2K
Agent score
72%

What's inside Viem

  1. Overview of TIP-20 Token Standard

    TIP-20 is Tempo's native token standard specifically designed for stablecoins. Creating a TIP-20 token involves deploying a contract, assigning an admin for role and supply management, and establishing the token's identity via an address and ID.
  2. Overview of viem TypeScript Interface for Ethereum

    viem is a low-level, stateless TypeScript interface for interacting with Ethereum. It is designed as an alternative to ethers.js and web3.js, focusing on reliability, efficiency, and developer experience. Key architectural goals include:

    • Type Safety: Provides strongly typed APIs with automatic type inference and static validation.
    • Modularity: Uses composable APIs that are tree-shakable, ensuring only used modules are included in the final bundle to minimize load times.
    • Performance: Optimized encoding/parsing algorithms and deferred execution of heavy asynchronous tasks.
    • Stability: APIs are built to be deterministic and pure, with test suites run against forked Ethereum nodes.
    • Flexibility: Provides sensible and secure defaults without imposing strict opinions, allowing developers to build their own opinionated layers (e.g., wagmi) on top of it.
  3. Overview of Tempo Zones

    Zones are private, account-scoped chains on Tempo. They provide isolated execution environments where balances, transfers, and history remain invisible to the public chain while maintaining the security guarantees of the Tempo Mainnet.

    Important: Tempo Zones are currently in early development and available only on Tempo Testnet. They are subject to breaking changes and should not be used in production.

  4. Overview of Passkey accounts in viem/tempo

    Passkeys allow users to sign in and authorize transactions using WebAuthn credentials (e.g., Face ID, Touch ID, or hardware keys) instead of traditional private keys. These credentials are bound to the user's device and origin, eliminating the need for seed phrases. In viem/tempo, these accounts are managed using Account.fromWebAuthnP256.
  5. Overview of Witnesses in viem/tempo

    A witness is an optional 32-byte value bound into a key authorization's signing hash. It serves two primary purposes: tying a single authorization to an arbitrary offchain context (such as a server-issued challenge) or acting as a revocation handle. Burning a witness onchain invalidates any authorization carrying that witness before the authorization is submitted.
  6. Overview of Tempo Payment Vouchers

    A voucher is a signed, off-chain promise from a payer stating that a channel has paid a specific cumulative amount. Vouchers allow for instant and free payments because they occur off-chain; the payee can then settle the latest voucher on-chain to claim the funds. Each new payment requires a new voucher with a higher cumulative amount.
  7. Overview of Circle Bridge Kit

    Bridge Kit is a high-level SDK by Circle designed to simplify cross-chain bridging. It supports hundreds of bridge routes across dozens of blockchains and allows developers to monetize applications by collecting fees from end-users. Key features include custom configurations for transfer speeds and RPC endpoints, support for multiple wallet clients (Viem, Ethers, MetaMask, Phantom), and smart retry capabilities to recover stuck transactions.
  8. Overview of withdrawing funds from a Tempo Zone

    Funds are moved from a Tempo Zone back to a Tempo Mainnet account by requesting a withdrawal from within the zone. Tempo Zones are currently in early development and available only on Tempo Testnet; they are not suitable for production use due to potential breaking changes.
  9. Overview of Tempo Concurrent Transactions

    Tempo's concurrent nonce system allows a single account to send multiple transactions in parallel without waiting for sequential confirmation. By utilizing different nonce keys, non-conflicting transactions can execute simultaneously, increasing throughput for high-activity accounts.
  10. Overview of the Tempo Fee AMM

    The Fee AMM is designed to convert a user's fee token into the specific token a validator prefers to be paid in. Liquidity providers (LPs) supply both sides of a pool and earn from the conversions that occur within the pool.
  11. Overview of Local Accounts in viem

    A Local Account is an account where signing keys are stored on the user's local machine. Signing of transactions and messages occurs with a private key locally before the resulting payload is broadcast over JSON-RPC. viem supports three types of Local Accounts: Private Key Accounts, Mnemonic Accounts, and Hierarchical Deterministic (HD) Accounts.
  12. Overview of the Tempo Stablecoin Exchange

    Tempo features an enshrined Stablecoin DEX built directly into the protocol for trading USD-denominated TIP-20 tokens. Key capabilities include swapping at the best available price, managing limit and flip orders, and creating new trading pairs. The exchange utilizes internal balances for settlement, which users must withdraw back to their wallets. Additionally, a separate Fee AMM provides the necessary liquidity for stablecoin fee conversions.