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

@simplepg/common

v1.2.2

Published

Common utilities for SimplePage packages

Readme

@simplepg/common

Common utilities for SimplePage packages, providing shared functionality for ENS resolution, IPLD operations, and contract interactions.

Installation

npm install @simplepg/common

Exports

contracts

Contract ABIs and deployment addresses for the SimplePage ecosystem.

import { contracts } from '@simplepg/common'

// Access contract deployments by chain ID
const mainnetDeployments = contracts.deployments["1"]
const sepoliaDeployments = contracts.deployments["11155111"]

// Access contract ABIs
const simplePageAbi = contracts.abis.SimplePage
const simplePageManagerAbi = contracts.abis.SimplePageManager
const tokenRendererAbi = contracts.abis.TokenRenderer
const ensResolverAbi = contracts.abis.EnsResolver

// Access Universal Resolver addresses
const mainnetResolver = contracts.universalResolver["1"]
const sepoliaResolver = contracts.universalResolver["11155111"]

ENS Utilities

ensContentHashToCID(contentHash)

Converts an ENS contenthash to a CID (Content Identifier).

import { ensContentHashToCID } from '@simplepg/common'

const contentHash = '0xe30101701220bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqnbk6key6wmqkhq6m'
const cid = ensContentHashToCID(contentHash)
console.log(cid.toString()) // bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqnbk6key6wmqkhq6m

cidToENSContentHash(cid)

Converts a CID to an ENS contenthash format.

import { cidToENSContentHash } from '@simplepg/common'
import { CID } from 'multiformats/cid'

const cid = CID.parse('bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqnbk6key6wmqkhq6m')
const contentHash = cidToENSContentHash(cid)
console.log(contentHash) // 0xe30101701220bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqnbk6key6wmqkhq6m

resolveEnsDomain(viemClient, ensName, universalResolver)

Resolves an ENS domain to get its contenthash and resolver address.

import { resolveEnsDomain } from '@simplepg/common'
import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'

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

const result = await resolveEnsDomain(
  client,
  'example.eth',
  '0xaBd80E8a13596fEeA40Fd26fD6a24c3fe76F05fB'
)

console.log(result)
// {
//   cid: CID('bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqnbk6key6wmqkhq6m'),
//   resolverAddress: '0x1234...'
// }

IPLD Utilities

emptyUnixfs()

Creates an empty UnixFS filesystem with a memory blockstore. Use this for server-side operations or tests.

import { emptyUnixfs } from '@simplepg/common'

const { fs, blockstore } = emptyUnixfs()

browserUnixfs(storage)

Creates a UnixFS filesystem with a hybrid blockstore that combines memory, IndexedDB storage and localStorage for WAL. Use this for browser applications.

import { browserUnixfs } from '@simplepg/common'

const { fs, blockstore } = browserUnixfs(localStorage)

emptyCar()

Creates an empty CAR (Content Addressable aRchive).

import { emptyCar } from '@simplepg/common'

const car = emptyCar()

walkDag(blockstore, cid, seen)

Walks through a DAG (Directed Acyclic Graph) starting from a given CID and returns an array of blocks, which can be added to a CAR-file.

import { walkDag } from '@simplepg/common'

const blocks = await walkDag(blockstore, cid)
// Returns array of CarBlock objects representing the DAG

DService

DService

A service for interacting with decentralized service endpoints. Fetches endpoints from ENS 'dservice' text record.

import { DService } from '@simplepg/common'
import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'

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

const dservice = new DService('example.eth')

// Initialize with viem client
await dservice.init(client)

// Fetch data from dservice endpoints
const response = await dservice.fetch('/api/data', {
  method: 'GET'
})

Development

# Install dependencies
pnpm install

# Run tests
pnpm test

# Lint code
pnpm run lint

License

GPL-3.0-only