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-sdk
dependency) package uses thesodium-native
package as an optional dependency.sodium-native
is a low level binding to libsodium, (an implementation of Ed25519 signatures). If installation ofsodium-native
fails, or it is unavailable,xdb-digitalbits-base
(andxdb-digitalbits-sdk
) will fallback to using thetweetnacl
package implementation.If you are using
xdb-digitalbits-sdk
/xdb-digitalbits-base
in a browser you can ignore this. However, for production backend deployments you should be usingsodium-native
. Ifsodium-native
is successfully installed and working theDigitalBitsSdk.FastSigning
variable 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 build
To run all tests:
yarn gulp test
To run a specific set of tests:
yarn gulp test:unit
yarn gulp test:browser
To 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:5000
Documentation
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.