Skip to content

Using ENSNode with `viem/chain`

Some libraries (for example, ENSjs) use a viem/chain object to identify the ENS Subgraph url. If you’re integrating with a library that expects a url in the subgraph key for your chain, you can update the Chain spec to use ENSNode like so:

import { mainnet } from 'viem/chains';
const mainnetWithENSNode = {
...mainnet,
subgraphs: { ens: { url: 'https://api.alpha.ensnode.io/subgraph' } },
}

Relevant Libraries

Libraries that use this pattern are: