0.0.7 • Published 11 months ago

@justaname.id/hybrid-primary-name v0.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

Hybrid Primary Name

Hybrid Primary Name is a Viem extension package that enables reverse ENS resolution to fetch the primary ENS name associated with a given Ethereum address. It integrates seamlessly with both Viem's createPublicClient and ENS's createEnsPublicClient.

Table of Contents

Installation

Install the package via npm or yarn:

npm install @justaname.id/hybrid-primary-name
# or
yarn add @justaname.id/hybrid-primary-name

Initialization

Using Viem's createPublicClient with ENS Contracts

import { createPublicClient, http } from 'viem';
import { addEnsContracts } from '@ensdomains/ensjs';
import { mainnet, sepolia } from 'viem/chains';
import { primaryName } from '@justaname.id/hybrid-primary-name';

const client = createPublicClient({
        chain: addEnsContracts(**mainnet or sepolia**),
        transport: http(**Provider URL**),
    }).extend(primaryName())

Using ENS's createEnsPublicClient

import { http } from 'viem';
import { createEnsPublicClient } from '@ensdomains/ensjs'
import { mainnet, sepolia } from 'viem/chains';
import { primaryName } from '@justaname.id/hybrid-primary-name';

const client = createEnsPublicClient({
        chain: **mainnet or sepolia**,
        transport: http(**Provider URL**),
    }).extend(primaryName())

Usage

The getEnsFromAddress method returns the primary ENS name associated with the given Ethereum address.

await client.getEnsFromAddress(**Address**),
0.0.7

11 months ago

0.0.6

11 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago