xpub-generator
TypeScript icon, indicating that this package has built-in type declarations

1.3.2 • Public • Published

Build Status Coverage Status MIT license

Using this module in other modules

Here is a quick example of how this module can be used in other modules. The TypeScript Module Resolution Logic makes it quite easy. The file src/index.ts is a barrel that re-exports selected exports from other files. The package.json file contains main attribute that points to the generated lib/index.js file and typings attribute that points to the generated lib/index.d.ts file.

If you are planning to have code in multiple files (which is quite natural for a NodeJS module) that users can import, make sure you update src/index.ts file appropriately.

Now assuming you have published this amazing module to npm with the name xpub-generator, and installed it in the module in which you need it -

  • To use the XPubGenerator class in a TypeScript file -
import Bitcoin = require('bitcoinjs-lib');
import { XPubGenerator } from 'xpub-generator';
 
const g = new XPubGenerator('xpub....');
g.nthReceiving(1);
 
const gTestnet = new XPubGenerator('tpub...', Bitcoin.networks.testnet);
gTestnet.nthReceiving(1);
 
const gLitecoin = new XPubGenerator('tpub...', Bitcoin.networks.litecoin);
gLitecoin.nthReceiving(1);
  • To use the XPubGenerator class in a JavaScript file -
const Bitcoin = require('bitcoinjs-lib')
const XPubGenerator = require('xpub-generator').XPubGenerator;
 
const g = new XPubGenerator('xpub...');
g.nthReceiving(1);
 
const gTestnet = new XPubGenerator('tpub...', Bitcoin.networks.testnet);
gTestnet.nthReceiving(1);
 
const gLitecoin = new XPubGenerator('tpub...', Bitcoin.networks.litecoin);
gLitecoin.nthReceiving(1);

Setting travis and coveralls badges

  1. Sign in to travis and activate the build for your project.
  2. Sign in to coveralls and activate the build for your project.
  3. Replace {{github-user-name}}/{{github-app-name}} with your repo details like: "ospatil/generator-node-typescript".

Readme

Keywords

none

Package Sidebar

Install

npm i xpub-generator

Weekly Downloads

3

Version

1.3.2

License

MIT

Unpacked Size

13.6 kB

Total Files

9

Last publish

Collaborators

  • mautematico