The Mobius Node.js Client provides simple access to the Mobius API for applications written on Node.js
Install the package with npm
:
$ npm install @mobius-network/mobius-node --save
or with yarn
$ yarn add @mobius-network/mobius-node
For importing library use:
const Mobius = require('@mobius-network/mobius-node');
On ES6 it's look like:
import Mobius from '@mobius-network/mobius-node';
The library need to be configured with your API secret key which you can create in Mobius DApp Store
const mobius = new Mobius({
apiKey: 'your_api_key',
});
Every method returns a chainable promise which can be used like this:
mobius.appStore
.balance({ appUid: 'f9e5e943', email: 'mail@example.com' })
.then(balance => {
if (balance.numCredits > 0) {
mobius.appStore.use({ appUid: '581d1351', email: 'mail@example.com', numCredits: 1 });
}
})
.catch(error => console.error(error));
-
Get balance of credits for email.
-
Use numCredits from user with email.
-
Register a token.
-
Query the number of tokens specified by the token.
-
Create an address for the token.
-
Register an address for the token.
-
Transfer tokens from a Mobius managed address to a specified address.
-
Get the status and transaction hash of a Mobius managed token transfer.
See the REST API docs
Run all tests
$ yarn install
$ yarn run test