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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@pharosnames/address-encoder

v1.0.2

Published

Encodes and decodes address formats for various cryptocurrencies with Pharos network support

Readme

@pharosnames/address-encoder

A cryptocurrency address encoder/decoder in TypeScript for the Pharos Name Service (PNS).

Text-format addresses are decoded into their native binary representations, and vice-versa. In the case of Bitcoin-derived chains, this means their scriptPubKey; for Ethereum-derived chains this is their hash.

This library was written for use with the Pharos Name Service, enabling .phrs domains to resolve to cryptocurrency addresses across multiple blockchain networks.

Installation

npm install @pharosnames/address-encoder

Getting Started

import { getCoderByCoinName } from "@pharosnames/address-encoder";

// Get the coder for the address you want to encode/decode
const coder = getCoderByCoinName("phrs");

// Decode the address
const decodedAddress = coder.decode(
  "0x1234567890123456789012345678901234567890"
);
// Uint8Array(25) [ 118, 169, 20, 98, 233, 7, 177, 92, 191, 39, 213, 66, 83, 153, 235, 246, 240, 251, 80, 235, 184, 143, 24, 136, 172 ]

// Encode the address
const encodedAddress = coder.encode(decodedAddress);
// 0x1234567890123456789012345678901234567890

Note: If your data is a hex string, use hexToBytes() from @pharosnames/address-encoder/utils to convert it to Uint8Array before encoding.

Supported Cryptocurrencies

The library supports 100+ cryptocurrencies including Bitcoin, Litecoin, Dogecoin, Monero, and many others. For a complete list, check the supported coins in the source code.

Alternative Import Methods

Async Coder Getter

import { getCoderByCoinNameAsync } from "@pharosnames/address-encoder/async";

const phrsCoder = await getCoderByCoinNameAsync("phrs");

Individual Coin Imports

import { phrs } from "@pharosnames/address-encoder/coins";
// Use phrs.decode() and phrs.encode() methods

Individual Coder Function Imports

import {
  decodePHRSAddress,
  encodePHRSAddress,
} from "@pharosnames/address-encoder/coders";

Using with Pharos Name Service

import { http } from "viem";
import { createEnsPublicClient } from "@pharosnames/pnsjs";
import { pharosTestnetChain } from "@pharosnames/pnsjs/contracts";
import { evmCoinNameToTypeMap } from "@pharosnames/address-encoder";

const PHAROS_COIN_TYPE = evmCoinNameToTypeMap["phrs"];

// continue to use createEnsPublicClient for better compatibility with ensjs
const client = createEnsPublicClient({
  chain: pharosTestnetChain,
  transport: http(),
});

// Get a Pharos address for a .phrs domain
const address = await client.getAddressRecord({
  name: "example.phrs",
  coin: PHAROS_COIN_TYPE,
});

// Retrieve the address
const retrievedAddress = await client.getAddressRecord({
  name: "example.phrs",
  coinType: 2148172336,
});

const decodedAddress = phrsCoder.encode(retrievedAddress);
console.log(decodedAddress); // 0x1234567890123456789012345678901234567890

License

MIT License - see the LICENSE file for details.