dvtaddrjs

0.3.10 • Public • Published

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

Build Status Coverage Status

NPM

JavaScript implementation for the new CashAddr address format for DeVault.

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 DeVault address translation library, check out the easy-to-use and well-tested BchAddr.js.

Installation

Using NPM

$ npm install --save dvtaddrjs

Using Bower

$ bower install --save dvtaddrjs

Manually

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

Usage

In Node.js

const cashaddr = require('dvtaddrjs');
const address = 'devault: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)); // 'devault: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://cdn.rawgit.com/bitcoincashjs/dvtaddrjs/master/dist/dvtaddrjs-0.3.9.min.js"></script> 
  </head>
  ...
</html>

Documentation

Generate and Browse Locally

$ npm run docs

Online

Browse automatically generated jsdocs online.

Package Sidebar

Install

npm i dvtaddrjs

Weekly Downloads

1

Version

0.3.10

License

MIT

Unpacked Size

117 kB

Total Files

11

Last publish

Collaborators

  • protean