⚠️ ALPHA SOFTWARE: This code relies on the SUAVE protocol, and both are subject to change. Please use it with caution. The SUAVE spec has not yet stabilized, so we are refraining from merging this work upstream. We plan to do so when the time is right. Additionally, Confidential Compute Requests in their current form can only be signed with local accounts (using privateKey directly), or with EIP-1193 wallets usingeth_sign
.
TypeScript Interface for Ethereum
- 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 & Ganache
- Test suite running against forked Ethereum network
... and a lot lot more.
// 1. Import modules.
import { createPublicClient, http } from 'viem';
import { mainnet } from 'viem/chains';
// 2. Set up your client with desired chain & transport.
const client = createPublicClient({
chain: mainnet,
transport: http(),
});
// 3. Consume an action!
const blockNumber = await client.getBlockNumber();
Check out the following places for more viem-related content:
- Follow @wagmi_sh, @jakemoxey, and @awkweb on Twitter for project updates
- Join the discussions on GitHub
- Share your project/organization that uses viem
If you're interested in contributing, please read the contributing docs before submitting a pull request.
MIT License