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
ensforgeContracts

Installation

Install @ensforge/contracts, the ENS ABIs, addresses and constants for viem, and pick the entry point that fits what you need.

@ensforge/contracts holds the ENS contract ABIs, deployment addresses and protocol constants such as interface IDs and role bitmaps. It has no runtime dependencies beyond the viem peer, and it does not depend on Effect or on @ensforge/sdk, so you can use it alone.

Requirements

  • Node.js 20.19 or later.
  • viem version 2.57 or later.

1. Install the package

npm install @ensforge/contracts viem

2. Import what you need

The root entry point has four namespaces:

NamespaceWhat it holds
AbisABIs as as const arrays, in Abis.v1, Abis.v2 and Abis.shared.
DeploymentsAddresses, behaviour flags and provenance for mainnet and Sepolia.
InterfaceIdsERC-165 interface IDs of registries, resolvers and resolver profiles.
RolesENSv2 role bitmaps for registries and resolvers.

Example (Importing the Namespaces)

imports.ts
import { Abis, Deployments, InterfaceIds, Roles } from "@ensforge/contracts";

const registryAbi = Abis.v2.permissionedRegistry;
const ethRegistry = Deployments.mainnet.v2.contracts.ethRegistry;
const permissionedResolverId = InterfaceIds.resolver.permissionedResolver;
const renewRole = Roles.registry.renew;

Subpath entry points

The same ABIs and constants are also available as flat named exports, which suit bundlers that tree-shake by file.

ImportWhat it holds
@ensforge/contracts/v1ENSv1 ABIs and constants, such as baseRegistrarV1Abi.
@ensforge/contracts/v2ENSv2 ABIs, interfaces, role and interface-ID constants and helpers, such as permissionedRegistryV2Abi.
@ensforge/contracts/sharedABIs both protocol versions share: token standards, ERC-165, resolver profiles, errors, events.
@ensforge/contracts/v2/experimental/hcaThe experimental HCA (Hosted Contract Account) ABIs and session helpers.

See the entry points reference for every export.

Use it with the SDK

@ensforge/sdk depends on this package. Use @ensforge/contracts directly when you read or write contracts with viem yourself. See Use ABIs with viem.

Was this page helpful?