Skip to main content

npm npm:

npm i @lavanet/lava-viem
import { createViemClientWithLavaSDK } from "@lavanet/lava-viem";

async function printLatestBlock() {
const viem = await createViemClientWithLavaSDK({
// subscribed private key or badge must be supplied
badge: {
badgeServerAddress: "https://badges.lavanet.xyz", // Or your own Badge-Server URL
projectId: "//", // Fetch your project ID from https://gateway.lavanet.xyz
},
chainIds: "ETH1",
logLevel: "info",
geolocation: "2", // OPTIONAL
});

const latestBlock = await viem.request({
method: "eth_blockNumber",
});

console.log(latestBlock);
}

❓ Looking for more examples? Check out the examples folder on our repository.