Coinlib
A unified nodejs API for sending and receiving crypto payments
Install / Use
/learn @bitaccess/CoinlibREADME
coinlib monorepo
A nodejs library providing a unified API for sending and receiving crypto payments for multiple coin networks.
Setting Up
- Install required compiler tools
brew install autoconf automake libtool
- Install root dependencies:
npm install
- Set environment variables
export BITCOIN_SERVER_URL="btc1.<my-blockbook-url>,btc2.<my-blockbook-url>"
export BITCOIN_TESTNET_SERVER_URL="tbtc1.<my-blockbook-url>"
- Execute tests (done by Jest)
npm run test
- Dependency management
- To remove dependency from leaf package, remove it from its
package.jsonand runlerna bootstrap - To regenerate
package-lock.jsonfor package, runnpm install --package-lock-only
Contribution guide
Pull Request process
- Ensure following branch naming conventions
<tag>/<subject_message>; - Ensure following commit message conventions (templated);
- Ensure test and linting are executed successfully;
- You may merge the Pull Request in once you have the sign-off of other developers, or if you do not have permission to do that, you may request the reviewer to merge it for you;
Commit message template
Run
git config commit.template ./.gitmessage
Adding new assets
Importing packages
Use lerna to import packages (More info in lerna docs)
Configuring assets
Add payment factory to packages/coinlib/src/constants.ts
Registering assets
Add payment config to packages/coinlib/src/types.ts
Abstractions to implement
Find types and interfaces at packages/coinlib-types/src/
Usage
npm i @bitaccess/coinlib
See @bitaccess/coinlib README for usage.
Packages
- @bitaccess/coinlib - Wrapper for all coins
- @bitaccess/coinlib-types - Common types
- @bitaccess/coinlib-common - Common utilities and classes
- @bitaccess/coinlib-bitcoin - BTC
- @bitaccess/coinlib-ethereum - ETH & ERC20
- @bitaccess/coinlib-litecoin - LTC
- @bitaccess/coinlib-doge - DOGE
- @bitaccess/coinlib-bitcoin-cash - BCH
- @bitaccess/coinlib-tron - TRX
- @bitaccess/coinlib-stellar - XLM
- @bitaccess/coinlib-ripple - XRP
Publishing new version
Note: Never use npm version, it doesn't work with lerna monorepo
Version types
patch- fixes only, no feature or breaking changesminor- feature changesmajor- breaking changes
Steps to version & publish
- Run tests
npm run test - Create release candidate PR
bin/version.sh - Have someone review & approve new release. Merge PR, pull master
- Publish to npm
bin/publish.sh
