MCPcopy Index your code
hub / github.com/ealmansi/cashaddrjs

github.com/ealmansi/cashaddrjs @v0.4.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.4.4 ↗ · + Follow
36 symbols 84 edges 11 files 19 documented · 53% updated 3mo agov0.1.2 · 2018-01-01★ 38
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

CashAddr.js: The new Bitcoin Cash address format for Node.js and web browsers.

Build Status Coverage Status

NPM

JavaScript implementation for the new CashAddr address format for Bitcoin Cash.

Compliant with the original CashAddr specification which improves upon BIP 173.

Note: This is a JavaScript implementation of the CashAddr format specification. If you are looking for a general purpose Bitcoin Cash address translation library, check out the easy-to-use and well-tested BchAddr.js.

Installation

Using NPM

$ npm install --save cashaddrjs

Using Bower

$ bower install --save cashaddrjs

Manually

You may also download the distribution file manually and place it within your third-party scripts directory: dist/cashaddrjs-{{ version }}.min.js.

Usage

In Node.js

const cashaddr = require('cashaddrjs');
const address = 'bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a';
const { prefix, type, hash } = cashaddr.decode(address);
console.log(prefix); // 'bitcoincash'
console.log(type); // 'P2PKH'
console.log(hash); // Uint8Array [ 118, 160, ..., 115 ]
console.log(cashaddr.encode(prefix, type, hash)); // 'bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a'

Note: This is a JavaScript implementation of the CashAddr format specification. If you are looking for an easy-to-use and well-tested library to translate between different formats, check out BchAddr.js.

Browser

Script Tag

You may include a script tag in your HTML and the cashaddr module will be defined globally on subsequent scripts.

<html>
  <head>
    ...
    <script src="https://unpkg.com/cashaddrjs@{{ version }}/dist/cashaddrjs-{{ version }}.min.js"></script>
  </head>
  ...
</html>

Documentation

Generate and Browse Locally

$ npm run docs

Online

Browse automatically generated jsdocs online.

Core symbols most depended-on inside this repo

k
called by 15
docs/scripts/prettify/prettify.js
validate
called by 13
src/validation.js
u
called by 11
docs/scripts/prettify/prettify.js
concat
called by 7
src/cashaddr.js
getRandomHash
called by 5
test/cashaddr.js
x
called by 5
docs/scripts/prettify/prettify.js
m
called by 4
docs/scripts/prettify/prettify.js
e
called by 4
docs/scripts/prettify/prettify.js

Shape

Function 36

Languages

TypeScript100%

Modules by API surface

src/cashaddr.js15 symbols
docs/scripts/prettify/prettify.js14 symbols
src/validation.js2 symbols
src/base32.js2 symbols
test/convertBits.js1 symbols
test/cashaddr.js1 symbols
test/base32.js1 symbols

For agents

$ claude mcp add cashaddrjs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact