Skip to content

Repository files navigation


OP Viem

Viem Extension for OP Stack Chains


🚨 DEPRECATION WARNING 🚨

With the upstreaming of most op-viem features into Viem consider this library deprecated. We recommend using Viem's native OP Stack support instead.

Features

  • Simplifies cross L1 & L2 interactions
  • Seamless extension to Viem
  • TypeScript ready
  • Test suite running against forked Ethereum network

Overview

// import modulesimport{createWalletClient,createPublicClient,custom,http}from'viem'import{privateKeyToAccount}from'viem/accounts'import{mainnet,base}from'viem/chains'import{baseAddresses}from'op-viem/chains'import{walletL1OpStackActions,publicL1OpStackActions,publicL2OpStackActions}from'op-viem'// create clientsexportconstopStackL1WalletClient=createWalletClient({chain: mainnet,transport: custom(window.ethereum)}).extend(walletL1OpStackActions)exportconstopStackL1PublicClient=createPublicClient({chain: mainnet,transport: http()}).extend(publicL1OpStackActions)exportconstopStackL2PublicClient=createPublicClient({chain: base,transport: http()}).extend(publicL2OpStackActions)// perform an actionopStackL1PublicClient.getOutputForL2Block(blockNumber: 2725977n, ...baseAddresses)

Community

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

Contributing

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

Authors

License

MIT License

About

Viem extensions for the Op Stack

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages