Skip to content

Getting Started

Viem provides a set of experimental features through the viem/experimental entrypoint. Such features could include:

  • implementation of non-finalized EIP proposals.
  • features that have not been adopted by the wider ecosystem.
  • features that are not considered stable.

Quick Start

1. Set up your Client & Transport

Firstly, set up your Client with a desired Transport & Chain.

import { createWalletClient, custom } from 'viem'
import { mainnet } from 'viem/chains'
 
const client = createWalletClient({ 
  chain: mainnet, 
  transport: custom(window.ethereum!), 
}) 

2. Extend Client with Experimental Actions

Now that you have a Client set up, you can extend it with Experimental Actions! Read more.

import { createWalletClient, custom } from 'viem'
import { base } from 'viem/chains'
import { walletActionsEip5792 } from 'viem/experimental'
 
const client = createWalletClient({
  chain: base,
  transport: custom(window.ethereum!),
}).extend(walletActionsEip5792()) 

3. Consume Experimental Actions

Now that you have an Experimental Client set up, you can now and consume Actions!

import { createWalletClient, custom, parseEther } from 'viem'
import { mainnet } from 'viem/chains'
import { walletActionsEip5792 } from 'viem/experimental'
 
const client = createWalletClient({
  chain: mainnet,
  transport: custom(window.ethereum!),
}).extend(walletActionsEip5792()) 
 
const id = await client.sendCalls({ 
  account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', 
  calls: [
    {
      to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', 
      value: parseEther('1'), 
    },
    {
      data: '0xdeadbeef'
      to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', 
    }, 
  ] 
})