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

@varnir/network-codes

v0.1.0

Published

Zero-dependency network-code mapper (toCanonical / toLedgerCode / toRegistryNetworkKey) shared across the monorepo. Compiled to CommonJS with declarations so node10/CommonJS services (minigate, l1-relay) can require() the same source of truth the bundler

Readme

@varnir/network-codes

A zero-dependency mapper between the network-name spellings a Varnir chain can show up as: the ledger's own credit code, the code services use in config and pool lookups, and the ad-hoc provider chain ids seen on the wire. No custody or signing logic lives here — it does not touch keys, it just keeps one chain from being silently treated as another.

Why this exists

The same chain gets spelled differently depending on where you look: 'tBNB' at rest on the ledger, 'tbnb' in pool/config code, 'bnbchain-testnet' from a provider, and stray variants like 'trx-niles' seen in the wild. Four conventions for the same set of chains means a naive toLowerCase() compare or a locally-grown alias list can silently fold two different networks together — or fail to fold the same network to itself — and a deposit or lookup for the wrong chain goes missing without an error. This package is the single place that mapping lives, so every consumer folds through it instead of re-deriving its own (and drifting).

Install

npm install @varnir/network-codes

Usage

import {toCanonical, toLedgerCode, toRegistryNetworkKey} from '@varnir/network-codes';

toCanonical('bnbchain-testnet');   // 'tbnb'   — lower-case, for display/compare
toLedgerCode('tbnb');              // 'tBNB'   — the mixed-case form stored at rest
toRegistryNetworkKey('tbnb');      // 'TBNB'   — upper-case, for registry-keyed lookups

Three functions, three different output forms — pick the one that matches where the result is going, not the one that looks closest to your input:

  • toCanonical — folds any spelling to the lower-case display/compare form ('niles', 'tbnb', 'sep'). Use this for reads, comparisons, and anywhere a pool or config keys on network name.
  • toLedgerCode — folds to the code a chain is stored under at rest, exactly as configured (including mixed case, e.g. 'tBNB').
  • toRegistryNetworkKey — folds to the upper-case form a raw, case-sensitive registry key is seeded with. Not interchangeable with toLedgerCode: some registries are seeded upper-case even when the ledger code itself is mixed-case.

An unrecognised spelling degrades to a trimmed pass-through (lower-cased for toCanonical, upper-cased for the other two) rather than throwing, matching the lenient behavior of the ad-hoc folds this package replaces.

Covers the full network set a Varnir token registry can name: Ethereum (mainnet/Sepolia), Tron (mainnet/Nile/Shasta), BNB Chain (mainnet/testnet), and Solana (mainnet/devnet).

Pure TypeScript, no runtime dependencies, and no Node/browser-specific APIs — safe to import from a browser bundle, React Native, or a plain Node script. Ships as compiled CommonJS with type declarations so require()-based services can consume the same source of truth as bundler and React Native consumers, with no drift between copies.

License

MIT