Viem SDK
Interact with the Lens Network using Viem.
The Lens Network SDK offers first-class support for Viem, a popular TypeScript Interface for Ethereum. Specifically, it adopts Viem paradigms and provides stateless, low-level primitives for interacting with the Lens Network.
This section presumes that you are familiar with the client-action architecture of Viem.
Getting Started
First, install Viem package:
Next, configure your Client by selecting the desired Transport and a Lens Network Chain.
With your Clients now set up, you're ready to interact with the Lens Network and consume Actions.
- Lens Public Actions
- Lens Wallet Actions
- EIP-712 Actions
- L2 Public Actions
- L1 Public Actions
Example
import { getBlockNumberByTime } from "@lens-network/sdk/viem";
import { publicClient } from "./publicClient";
const blockNumber = await getBlockNumberByTime(publicClient, { closest: "before", timestamp: Math.floor(Date.now() / 1000),});
Actions
The Lens Network SDK is designed to enable you to consume standard Viem Actions for general EVM features, as well as ZKsync-specific Actions, such as:
ZKsync EIP-712 Actions for enhanced transaction signing.
ZKsync L2 Public Actions for Layer 2 operations.
ZKsync L1 Public Actions for Layer 1 interactions.
Custom RPC Node
If you want to use a Lens Network RPC node other than the default one, you can specify the custom RPC node URL in the http transport.