The Official and agnostic library to wrap Lunes API.
- Coins: Get coins prices, history
- NodeJS - 8.x LTS
Using NPM
$ npm i --save lunes-lib
Using Yarn
$ yarn add lunes-lib
//CommonJS's require
const LunesCore = require("lunes-core");
const { users, coins } = LunesCore;
//Webpack/es6
import { users, coins } from "lunes-core";
Creates a new user into Firebase authentication and into realtime database. This user must to contain a valid email, password and fullname.
Returns an access token for current user.
User login into Lunes API, using email and password credentials.
Returns an access token for current user.
Request a password recovery e-mail.
Returns a confirmation object.
Get the personal info from current logged user.
Returns user's personal info object.
Update user's profile.
Returns the updated user profile.
Create a new PIN to current logged user.
Returns a confirmation and pinIsVerified = true.
Confirm the PIN code before some operation that it is asked.
Returns a confirmation.
Confirm the phone number.
Returns a confirmation and phoneIsVerified = true.
Obtain the realtime price of one or more currencies.
fromSymbol => e.g. one of BTC, USD, BRL toSymbol => a comma separated list e.g. BTC,ETC,USD,EUR,BRL exchange => Exchange's name, default is CCCAGG
Returns an object containg the asked currency prices.
e.g
{"BTC":0.009878,"USD":10.79,"EUR":10.37}
Obtain an history of some currency (fromSymbol) and its conversion to another (toSymbol) in a period from "fromDate" to "toDate".
If the period is smaller than 1 day, the history is by hour. Otherwise, it will by daily.
fromSymbol => e.g. one of BTC, USD, BRL toSymbol => e.g. one of BTC, USD, BRL range => e.g. one of [RANGE_1D, RANGE_1W, RANGE_1M, RANGE_3M, RANGE_6M, RANGE_1Y, RANGE_MAX]
Return an object containing history metadata and an array containing the low, high values and date.
{
"success": true,
"status": 200,
"message": "Historical chart - BTC to USD",
"range": "RANGE_1D",
"data": [
{
"close": 12787.35,
"time": 1516903200
},
{
"close": 11913.74,
"time": 1516906800
},
{
"close": 11388.52,
"time": "1516914000
}
]
}
The following functions are specific when the currency is Bitcoin (BTC).
Read address, request Lunes API and returns balance.
Read address, request Lunes API and returns transaction history.
Returns the user's wallet seed.
$ npm test
Always at branch "develop".
MIT.