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

@permaweb/references

v0.1.3

Published

[email protected] js client: name resolution and management on the Permaweb

Readme

@permaweb/references

TypeScript SDK for Permaweb Names references.

The SDK reads [email protected] records from Arweave GraphQL, joins them with the current phase-2 namespace root reference, and can post reference updates through an Arweave bundler.

Install

npm install @permaweb/references

Read-only usage does not need wallet dependencies. Writing with the built-in signers needs the optional peer packages used by that signer:

npm install arweave arbundles

Quick Start

import { ReferenceClient } from '@permaweb/references';

const names = new ReferenceClient();

const refs = await names.findReferences(
  '8s8ABYc_1oDZ553UKXLIzsUie48xc6V88Q1hPtky4C8',
);

console.log(refs);
// [
//   {
//     referenceId: '_aY3NpheRlJ4y_MInEZpzCSBHXl1hL3osyfkOSQY6Ek',
//     name: '1984',
//     value: 'n2ITIV8xMI2JeeABVsyUyYK0jaOSSJwu9ekxioXGbeA'
//   }
// ]

Read References

Resolve a namespace name to its current reference value:

const value = await names.resolveName('ao');

Fetch full name state:

const name = await names.getName('ao');

// {
//   name: string,
//   referenceId: string,
//   authority?: string,
//   value: unknown,
//   timestamp: number,
//   source: 'init' | 'set'
// }

Resolve the current value of a reference:

const value = await names.resolveReference(referenceId);

Fetch full reference state:

const ref = await names.getReference(referenceId);

// {
//   id: string,
//   authority?: string,
//   value: unknown,
//   timestamp: number,
//   source: 'init' | 'set'
// }

List references controlled by a wallet:

const refs = await names.findReferences(authorityAddress);

// [
//   {
//     referenceId: string,
//     name: string | null,
//     value: unknown,
//     nameSource?: string,
//     dateRegistered?: string
//   }
// ]

findReferences returns references controlled by an authority. It is not an "all names" or "all subdomains" listing API. All-name discovery should read the namespace manifest/state directly.

Update References

Browser Wallet

import { ReferenceClient, fromWallet } from '@permaweb/references';

const names = new ReferenceClient({
  signer: fromWallet(window.arweaveWallet),
});

await names.updateReference(referenceId, {
  value: 'NEW_TARGET_TX_ID',
});

JWK

import { ReferenceClient, fromJwk } from '@permaweb/references';

const names = new ReferenceClient({
  signer: fromJwk(jwk),
  bundler: 'https://up.arweave.net',
});

await names.updateReference(referenceId, {
  value: 'NEW_TARGET_TX_ID',
});

The signer must be the reference authority. The SDK checks the current reference authority before posting and throws without sending if the signer does not match.

When timestamp is not supplied, updateReference reads the current reference state and uses:

Math.max(Date.now(), latestTimestamp + 1)

This keeps updates strictly newer even if the latest reference timestamp is ahead of the local clock or multiple updates happen close together. Pass timestamp explicitly only when you need to control the nonce yourself.

Create References

const { referenceId } = await names.createReference({
  value: targetTxId,
});

For user-created references, authority defaults to the signer address. Pass an explicit authority when a bootstrap publisher is creating the reference on behalf of another wallet. The resulting data item ID is the reference ID.

Configuration

const names = new ReferenceClient({
  gateway: 'https://arweave.net',
  graphql: 'https://arweave.net/graphql',
  bundler: 'https://up.arweave.net',
  namespace: 'w0eqd43OMzzXr-5yhFC-LkgifQqih8YEPb4mLt6VSZo',
  trustedPublishers: [
    'uAaRGha_a1ni_VjLf9Be2SFB7NJw1PWnjevdfeuJ_7c',
  ],
  fetch,
});

| Option | Default | Description | | --- | --- | --- | | gateway | https://arweave.net | Gateway used for tx reads and raw namespace fetches. | | graphql | ${gateway}/graphql | GraphQL endpoint used for reference discovery. | | bundler | https://up.arweave.net | Bundler endpoint used by the JWK signer. | | namespace | phase-2 namespace root | Namespace root reference or manifest ID used to attach names to references. Set null to skip name lookup. | | trustedPublishers | phase-2 bootstrap publisher | Publishers accepted for authority-tagged bootstrap reference inits. | | signer | none | Required only for create/update operations. | | fetch | global fetch | Custom fetch implementation for runtimes or tests. |

Phase-2 Trust Model

Phase-2 references are bootstrap-published, but user-controlled:

owner.address = trusted bootstrap publisher
authority tag = user wallet

By default, the trusted bootstrap publisher is:

uAaRGha_a1ni_VjLf9Be2SFB7NJw1PWnjevdfeuJ_7c

findReferences(authority) accepts a reference init when:

authority tag == requested authority
AND
owner.address is either:
  - a trusted bootstrap publisher, or
  - the requested authority

This supports the current phase-2 bootstrap and future direct user-published references while rejecting authority-tagged references from unknown publishers.

Reference and update discovery request 100 GraphQL edges per page and scan up to 100 pages by default. Low-level discovery helpers accept maxPages when a caller wants a different scan cap.

Low-Level Exports

The package also exports the pure pieces used by ReferenceClient:

import {
  buildInit,
  buildSet,
  currentState,
  effectiveValue,
  discoverSets,
  discoverReferencesByAuthority,
  fetchMessageById,
} from '@permaweb/references';

Development

npm install
npm run typecheck
npm test
npm run build

License

This repository is license under the MIT License