cashaddrjs
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/cashaddrjs package

0.4.4 • Public • Published

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-0.4.4.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@0.4.4/dist/cashaddrjs-0.4.4.min.js"></script>
  </head>
  ...
</html>

Documentation

Generate and Browse Locally

$ npm run docs

Online

Browse automatically generated jsdocs online.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.4.471,191latest

Version History

VersionDownloads (Last 7 Days)Published
0.4.471,191
0.4.35
0.4.21
0.3.122,418
0.3.115
0.3.105
0.3.92
0.3.8139
0.3.71
0.3.61
0.3.51
0.3.41
0.3.3323
0.3.21
0.3.11
0.3.01
0.2.93,536
0.2.82
0.2.70
0.2.61
0.2.51
0.2.41
0.2.31
0.2.21
0.2.11
0.2.01
0.1.101
0.1.91
0.1.81
0.1.51
0.1.41
0.1.31
0.1.11
0.1.01

Package Sidebar

Install

npm i cashaddrjs

Weekly Downloads

77,651

Version

0.4.4

License

MIT

Unpacked Size

110 kB

Total Files

14

Last publish

Collaborators

  • ealmansi