The Electroneum ENS javascript library, with viem under the hood.
This is the electroneum/ensjs fork of ensdomains/ensjs, adapted for Electroneum ENS: the registrar TLD is .etn and the supported chain is Electroneum testnet (electroneumTestnet, chain id 5201420). The companion contracts live in electroneum/ens-contracts and are published as @etn-sc/ens-contracts.
- Super fast response times
- Easy call batchability
- Written in TypeScript
- Full tree-shaking support
Install @etn-sc/ensjs, alongside viem.
npm install @etn-sc/ensjs viemThe most simple way to get started is to create a public ENS client, with the Electroneum chain and a transport imported from viem. The public client has all the read functions available on it.
// Import viem transport, viem chain, and ENSjs
import { http } from 'viem'
import { electroneumTestnet } from 'viem/chains'
import { createEnsPublicClient } from '@etn-sc/ensjs'
// Create the client
const client = createEnsPublicClient({
chain: electroneumTestnet,
transport: http(),
})
// Use the client
const etnAddress = client.getAddressRecord({ name: 'ens.etn' })Note: there is no ENS subgraph for Electroneum yet, so the /subgraph
functions are not usable until one is deployed.
Docs can be found in the upstream repo here — the API is identical apart from the .etn TLD and supported chains.