Documentation for agents: an index at /llms.txt, every docs page in one file at /llms-full.txt, and Markdown for any docs page by adding .md to its URL.

Skip to Content
ensforgeSDK

Installation

Install @ensforge/sdk with viem and Effect, and check that your runtime and TypeScript settings can load the package correctly.

@ensforge/sdk is the SDK for ENS. It builds on the viem clients your app already has, and works the same in a browser app and on a server.

Install the package

Install the SDK with its two required peer dependencies, viem and effect.

npm install @ensforge/sdk viem effect@^4
  • viem (2.57 or later) talks to the chain. You create the viem clients; ensforge uses them.
  • effect (4.1.4 or later, version 4 only) is required even if you never use it directly. ensforge runs on it internally. You never have to write Effect code: every action returns a Promise. See Ways to call actions if you want the Effect API.

Add wagmi support (optional)

Apps built on wagmi (RainbowKit, ConnectKit, Dynamic, Privy, Reown AppKit) can create the client from their wagmi config. ensforge supports wagmi 2.14 and later, and wagmi 3. There is nothing more to install: wagmi is an optional peer dependency, and apps without it never load that code. See Create a client.

Check your setup

ensforge ships ES modules only, with an exports map.

RequirementValue
Node.js20.19 or later
Module formatES modules ("type": "module", or a bundler)
TypeScript moduleResolution"bundler", "node16" or "nodenext"

The moduleResolution setting matters because ensforge has several entry points (@ensforge/sdk/indexer, @ensforge/sdk/wagmi, …). Older settings such as "node" cannot see them. See Entry points for the full list.

Verify the install

This script reads the address of nick.eth on Ethereum mainnet. If it prints an address, the SDK, viem and Effect are installed correctly.

Example (Checking the Install)

check.ts
import { Ensforge, ensActions } from "@ensforge/sdk";
import { createPublicClient, http } from "viem";
import { mainnet } from "viem/chains";

const ens = Ensforge.create({
  publicClient: createPublicClient({ chain: mainnet, transport: http() }),
}).extend(ensActions());

console.log(await ens.record.getAddress({ name: "nick.eth" }));
Output
0xb8c2C29ee19D8307cb7255e1Cd9CbDE883A267d5

http() without a URL uses the chain's public RPC, which is rate limited. Pass your own RPC URL in production. See Configure RPC and gateways.

Other packages

The SDK is the core. The other packages build on it and are installed only when you need them.

PackageWhat it adds
@ensforge/reactReact hooks and a provider. See React.
@ensforge/contractsENS ABIs, addresses and deployments. Installed with the SDK. See Contracts.
@ensforge/hcaWrites through an ENS smart account (experimental). See HCA.

Was this page helpful?