npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

wns-utils

v0.2.1

Published

Utilities for the Wei Name Service (WNS) — resolve .wei names, reverse resolve addresses, and more.

Readme

wns-utils

Utilities for the Wei Name Service (WNS). Resolve .wei names to Ethereum addresses, reverse resolve addresses to names, and more.

Zero runtime dependencies. Works in Node.js, browsers, and edge runtimes.

Install

npm install wns-utils

Usage

import { createWnsClient } from 'wns-utils'

const wns = createWnsClient()

// Resolve a .wei name to an address
const addr = await wns.resolve('name.wei')
// => '0x...' or null

// Reverse resolve an address to its primary .wei name
const name = await wns.reverseResolve('0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045')
// => 'name.wei' or null

// Smart resolve — passes addresses through, resolves .wei names
const result = await wns.resolveAny('name.wei')
const same = await wns.resolveAny('0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045')

The .wei suffix is optional — wns.resolve('name') and wns.resolve('name.wei') are equivalent.

Custom RPC

By default, the client uses free public RPC endpoints with automatic fallback. You can provide your own:

// Single RPC
const wns = createWnsClient({ rpc: 'https://my-paid-rpc.com' })

// Multiple RPCs — tries in order, falls back on failure
const wns = createWnsClient({
  rpc: ['https://primary-rpc.com', 'https://fallback-rpc.com']
})

Helpers

Standalone utility functions that don't make any RPC calls:

import { isWei, isAddress, normalizeName, parseLabel } from 'wns-utils'

isWei('alice.wei')       // true
isWei('alice.eth')       // false

isAddress('0xd8dA...')   // true

normalizeName('Alice')   // 'alice.wei'
normalizeName('ALICE.WEI') // 'alice.wei'

parseLabel('alice.wei')  // 'alice'

Constants

import { WNS_CONTRACT, BASE_PORTAL, wnsAbi } from 'wns-utils'

WNS_CONTRACT // '0x0000000000696760E15f265e828DB644A0c242EB'
BASE_PORTAL  // '0x49048044D57e1C92A77f79988d21Fa8fAF74E97e'

The full contract ABI is exported as wnsAbi for use with viem, ethers, wagmi, or any other web3 library:

import { wnsAbi, WNS_CONTRACT } from 'wns-utils'
import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = createPublicClient({ chain: mainnet, transport: http() })

const owner = await client.readContract({
  address: WNS_CONTRACT,
  abi: wnsAbi,
  functionName: 'ownerOf',
  args: [tokenId],
})

API

createWnsClient(config?)

Creates a WNS client instance.

| Option | Type | Description | |--------|------|-------------| | rpc | string \| string[] | Custom RPC endpoint(s). Defaults to free public endpoints with fallback. | | contract | `0x${string}` | Override the WNS contract address. Defaults to WNS_CONTRACT. |

Returns a WnsClient with the following methods:

| Method | Returns | Description | |--------|---------|-------------| | resolve(name) | Promise<\0x${string}` | null>| Resolve a.weiname to an address. | |reverseResolve(address)|Promise<string | null>| Reverse resolve an address to its primary.weiname. | |resolveAny(input)|Promise<`0x${string}` | null>| Smart resolve — addresses pass through,.wei` names get resolved. |

License

MIT