xdb-digitalbits-sdk v8.2.2
xdb-digitalbits-sdk is a Javascript library for communicating with a DigitalBits Frontier server. It is used for building DigitalBits apps either on Node.js or in the browser.
It provides:
- a networking layer API for Frontier endpoints.
- facilities for building and signing transactions, for communicating with a DigitalBits Frontier instance, and for submitting transactions or querying network history.
xdb-digitalbits-sdk vs xdb-digitalbits-base
xdb-digitalbits-sdk is a high-level library that serves as client-side API for Frontier. xdb-digitalbits-base is lower-level library for creating DigitalBits primitive constructs via XDR helpers and wrappers.
Most people will want xdb-digitalbits-sdk instead of digitalbits-base. You should only use digitalbits-base if you know what you're doing!
Important! The Node.js version of the
xdb-digitalbits-base(xdb-digitalbits-sdkdependency) package uses thesodium-nativepackage as an optional dependency.sodium-nativeis a low level binding to libsodium, (an implementation of Ed25519 signatures). If installation ofsodium-nativefails, or it is unavailable,xdb-digitalbits-base(andxdb-digitalbits-sdk) will fallback to using thetweetnaclpackage implementation.If you are using
xdb-digitalbits-sdk/xdb-digitalbits-basein a browser you can ignore this. However, for production backend deployments you should be usingsodium-native. Ifsodium-nativeis successfully installed and working theDigitalBitsSdk.FastSigningvariable will returntrue.
Install
- Add lib to your project:
npm install xdb-digitalbits-sdk --save- require/import it in your JavaScript:
var DigitalBitsSdk = require('xdb-digitalbits-sdk');Usage
For information on how to use xdb-digitalbits-sdk, take a look at the docs.
There is also API Documentation here.
Testing
Build before testing:
yarn gulp buildTo run all tests:
yarn gulp testTo run a specific set of tests:
yarn gulp test:unit
yarn gulp test:browserTo generate and check the documentation site:
# install the `serve` command if you don't have it already
yarn global add serve
# generate the docs files
yarn docs
# get these files working in a browser
serve jsdocs/
# you'll be able to browse the docs at http://localhost:5000Documentation
Documentation for this repo lives in docs.
License
xdb-digitalbits-sdk is licensed under an Apache-2.0 license. See the LICENSE file for details.