The Payshares JavaScript Library
payshares-lib
connects to the Payshares network via the WebSocket protocol. It runs in Node.js or in the browser.
Use payshares-lib for:
- Connecting to a local or remote paysharesd in JavaScript (Node.js or browser)
- Issuing paysharesd API requests
- Listening to events on the payshares network (transaction, ledger, etc.)
- Signing and submitting transactions to the payshares network
In this file:
- Overview
- Getting
payshares-lib
- Quickstart
- Running tests
For additional documentation see:
Also see:
payshares-lib
Getting Via npm for Node.js
$ npm install payshares-lib
Build from the source using gulp
$ git clone https://github.com/payshares/payshares-lib
$ cd payshares-lib
$ npm install
$ gulp
Then use the minified build/payshares-*-min.js
in your webpage
Quickstart
Remote
(remote.js) is the module responsible for managing connections to paysharesd
servers:
/* Loading payshares-lib with Node.js */var Remote = Remote; /* Loading payshares-lib in a webpage */// var Remote = payshares.Remote; var remote = // see the API Reference for available options trusted: true local_signing: true local_fee: true fee_cushion: 15 servers: host: 'live.payshares.co' port: 9001 secure: true ; remote;
See The payshares-lib
Guides and The payshares-lib
API Reference for walkthroughs and details about all of the available functions and options.
Running tests
-
Clone the repository
-
cd
into the repository and install dependencies withnpm install
-
npm test
ormake test
ornode_modules\.bin\mocha test\*-test.js
Generating code coverage
payshares-lib uses istanbul
to generate code coverage. To create a code coverage report, run npm test --coverage
. The report will be created in coverage/lcov-report/
.