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

@libid/contracts

v0.5.0

Published

Typed viem-ready ABIs for the libid contracts, plus the identity helper layer (handle normalization, bind, resolve).

Readme

@libid/contracts

Typed, viem-ready ABIs for every libid contract, plus the identity helper layer: handle normalization, proof encoding for bind, and name resolution.

The ABIs in src/abis/ are generated from the forge artifacts (solidity/out) by scripts/codegen.mjs and committed; each is exported as const satisfies Abi, so viem infers argument and return types from them. The handle vector table in src/identity/handleVectors.ts is generated from solidity/contracts/identity/handles.json by scripts/regen-identity-handles.py.

pnpm add @libid/contracts viem

Reading a contract with viem

import { createPublicClient, http } from 'viem'
import { registryAbi, bankAbi } from '@libid/contracts/abis'

const client = createPublicClient({ transport: http(RPC_URL) })

// Fully typed: viem infers the argument and return types from the ABI.
const wallet = await client.readContract({
  address: REGISTRY,
  abi: registryAbi,
  functionName: 'walletOf',
  args: ['github', '583231'],
})

const tokens = await client.readContract({
  address: BANK,
  abi: bankAbi,
  functionName: 'getRegisteredTokens',
})

Resolving a name

import {
  platformId,
  resolveHandle,
  resolvePair,
  primaryName,
  PLATFORM_X_DOMAIN,
} from '@libid/contracts/identity'

const reader = { client, address: IDENTITY_NAMES }
const x = platformId(PLATFORM_X_DOMAIN)

// The wallet that last proved a handle, or null. Pass what the user typed —
// normalization happens on chain.
const owner = await resolveHandle(reader, x, '@Alice')

// Before sending funds: does the account id still agree with the handle?
const { wallet, idAgrees } = await resolvePair(reader, x, 'alice', '42')

// The display name for a wallet, forward-checked on chain.
const name = await primaryName(reader, wallet!, x)

Binding a name

bindCall builds calldata and nothing more — an EOA sends it directly, a smart account wraps it in its own execute:

import { bindCall, encodeGitHubProof, platformId, PLATFORM_GITHUB_DOMAIN } from '@libid/contracts/identity'

const proof = encodeGitHubProof(gitHubProof) // from the notarization flow
const call = bindCall(IDENTITY_NAMES, platformId(PLATFORM_GITHUB_DOMAIN), proof, true)
// call = { to, data } — sign and send from the address the proof names.

Normalizing a handle locally

import { normalize, RULES_X, HandleError } from '@libid/contracts/identity'

normalize(' @Alice_1 ', RULES_X) // 'alice_1'
// Throws HandleError (with a kind matching the on-chain error) on refusal.

Development

cd solidity && forge build   # codegen reads the artifacts
pnpm -C ts install
pnpm -C ts codegen           # regenerate src/abis/ (codegen:check diffs)
pnpm -C ts build             # tsc → dist/ (ESM + .d.ts)
pnpm -C ts test              # vitest
pnpm -C ts lint && pnpm -C ts fmt:check