viem

TypeScript Interface for Ethereum

README



viem logo


  TypeScript Interface for Ethereum


Version Code coverage MIT License Best of JS


Features


- Abstractions over the JSON-RPC API to make your life easier
- First-class APIs for interacting with Smart Contracts
- Language closely aligned to official Ethereum terminology
- Import your Browser Extension, WalletConnect or Private Key Wallet
- Browser native BigInt, instead of large BigNumber libraries
- Utilities for working with ABIs (encoding/decoding/inspection)
- TypeScript ready (infer types from ABIs and EIP-712 Typed Data)
- First-class support for Anvil & Hardhat
- Test suite running against forked Ethereum network

... and a lot lot more.

Overview


  1. ```ts
  2. // 1. Import modules.
  3. import { createPublicClient, http } from 'viem';
  4. import { mainnet } from 'viem/chains';

  5. // 2. Set up your client with desired chain & transport.
  6. const client = createPublicClient({
  7.   chain: mainnet,
  8.   transport: http(),
  9. });

  10. // 3. Consume an action!
  11. const blockNumber = await client.getBlockNumber();
  12. ```

Community


Check out the following places for more viem-related content:

- Follow @wagmi_sh, @jakemoxey, and @awkweb on Twitter for project updates

Support



Sponsors


paradigm logo



family logo context logo WalletConnect logo LooksRare logo PartyDAO logo Dynamic logo Sushi logo Stripe logo BitKeep logo

Contributing


If you're interested in contributing, please read the contributing docsbefore submitting a pull request.

Authors


- @jxom (jxom.eth, Twitter)
- @tmm (awkweb.eth, Twitter)

License


MIT License