For the complete documentation index, see llms.txt. This page is also available as Markdown.

ViemProvider

Provider adapter that wraps a viem PublicClient for read-only chain access.

Provider adapter that wraps a viem PublicClient for read-only chain access. Implements GenericProvider.

Import

import { ViemProvider } from "@zama-fhe/sdk/viem";

Usage

import { createPublicClient, http } from "viem";
import { sepolia } from "viem/chains";
import { ViemProvider } from "@zama-fhe/sdk/viem";

const publicClient = createPublicClient({
  chain: sepolia,
  transport: http("https://sepolia.infura.io/v3/YOUR_KEY"),
});

const provider = new ViemProvider({ publicClient });

You rarely need to instantiate ViemProvider directly. The viem createConfig builds one from the publicClient you pass. Use this class when constructing ZamaSDK manually or when using the generic createConfig.

Constructor

publicClient

PublicClient

Viem public client for reading chain data.

Methods

All methods are inherited from GenericProvider.

Last updated