@etn-sc/ensjs
v4.4.0
Published
ENS javascript library for contract interaction
Downloads
157
Readme
ENSjs for Electroneum
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 chains are Electroneum mainnet (electroneum, chain id 52014) and Electroneum testnet (electroneumTestnet, chain id 5201420). The companion contracts live in electroneum/ens-contracts and are published as @etn-sc/ens-contracts.
Features
- Super fast response times
- Easy call batchability
- Written in TypeScript
- Full tree-shaking support
Installation
Install @etn-sc/ensjs, alongside viem.
npm install @etn-sc/ensjs viemGetting Started
The 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 { electroneum } from 'viem/chains'
import { createEnsPublicClient } from '@etn-sc/ensjs'
// Create the client
const client = createEnsPublicClient({
chain: electroneum,
transport: http(),
})
// Use the client
const etnAddress = client.getAddressRecord({ name: 'ens.etn' })Note: the /subgraph functions are only usable on mainnet (served by the
graph-node at graph.electroneum.com); there is no ENS subgraph for the
testnet yet.
Docs
Docs can be found in the upstream repo here — the API is identical apart from the .etn TLD and supported chains.
