diff --git a/README.md b/README.md index 80515c3..333dfa2 100644 --- a/README.md +++ b/README.md @@ -173,7 +173,7 @@ All you have to do now is to instanciate a `LNMarketsRest` object this way: ```JS const { LNMarketsRest } = require('@ln-markets/api') const lnm = new LNMarketsRest() - const info = await lnm.nodeState() + const info = await lnm.appNode() ``` After this, you'll be able to use all the documented `API` methods below. @@ -195,6 +195,7 @@ These methods are designed to fill the gaps if the API evolves and the future bu ### Methods +- [`futuresGetTicker`](#futuresGetTicker) - [`futuresNewPosition`](#futuresNewPosition) - [`futuresGetPositions`](#futuresGetPositions) - [`futuresUpdatePosition`](#futuresUpdatePosition) @@ -214,12 +215,24 @@ These methods are designed to fill the gaps if the API evolves and the future bu - [`getAnnouncements`](#getAnnouncements) - [`getLeaderboard`](#getLeaderboard) - [`getUser`](#getUser) -- [`apiState`](#apiState) -- [`nodeState`](#nodeState) +- [`appConfiguration`](#appConfiguration) +- [`appNode`](#appNode) - [`updateUser`](#updateUser) - [`withdraw`](#withdraw) - [`withdrawHistory`](#withdrawHistory) +#### futuresGetTicker + +Get the ticker of LN Markets + +Example: + +```JS + await lnm.futuresGetTicker() +``` + +[`GET /futures/ticker`](https://docs.lnmarkets.com/api/v1/#ticker) documentation for more details. + #### futuresNewPosition Open a new position on the market. @@ -640,7 +653,7 @@ Example: await lnm.getAnnouncements() ``` -[`GET /state/announcemenets`](https://docs.lnmarkets.com/api/v1/#get-the-ln-markets-announcements) documentation for more details. +[`GET /app/announcemenets`](https://docs.lnmarkets.com/api/v1/#get-the-ln-markets-announcements) documentation for more details. #### getLeaderboard @@ -674,9 +687,9 @@ Example: [`GET /user`](https://docs.lnmarkets.com/api/v1/#informations) documentation for more details. -#### apiState +#### appConfiguration -Retrieve informations related to LN Markets lnm. +Retrieve informations related to LN Markets. ```yaml # No parameters @@ -685,12 +698,12 @@ Retrieve informations related to LN Markets lnm. Example: ```JS - await lnm.apiState() + await lnm.appConfiguration() ``` -[`GET /state`](https://docs.lnmarkets.com/api/v1/#api-informations) documentation for more details. +[`GET /app/configuration`](https://docs.lnmarkets.com/api/v1/#api-informations) documentation for more details. -#### nodeState +#### appNode Show informations about LN Markets lightning node. @@ -701,10 +714,10 @@ Show informations about LN Markets lightning node. Example: ```JS - await lnm.nodeState() + await lnm.appNode() ``` -[`GET /state/node`](https://docs.lnmarkets.com/api/v1/#node-informations) documentation for more details. +[`GET /app/node`](https://docs.lnmarkets.com/api/v1/#node-informations) documentation for more details. #### updateUser diff --git a/examples/rest/basic.js b/examples/rest/basic.js index 395dc25..de32f5d 100644 --- a/examples/rest/basic.js +++ b/examples/rest/basic.js @@ -2,6 +2,6 @@ const { LNMarketsRest } = require('../../index.js') ;(async () => { const lnm = new LNMarketsRest() - const info = await lnm.nodeState() + const info = await lnm.futuresGetTicker() console.log(info) })() diff --git a/src/rest.js b/src/rest.js index d0ca7e9..cc03af6 100644 --- a/src/rest.js +++ b/src/rest.js @@ -176,6 +176,16 @@ module.exports = class LNMarketsRest { return this.requestAPI(options) } + futuresGetTicker(params = {}) { + const options = { + method: 'GET', + path: '/futures/ticker', + params, + } + + return this.beforeRequestApi(options) + } + futuresNewPosition(params) { const options = { method: 'POST', @@ -378,19 +388,19 @@ module.exports = class LNMarketsRest { return this.beforeRequestApi(options) } - apiState() { + appConfiguration() { const options = { method: 'GET', - path: '/state', + path: '/app/configuration', } return this.beforeRequestApi(options) } - nodeState() { + appNode() { const options = { method: 'GET', - path: '/state/node', + path: '/app/node', } return this.beforeRequestApi(options) @@ -408,7 +418,7 @@ module.exports = class LNMarketsRest { getAnnouncements() { const options = { method: 'GET', - path: '/state/announcements', + path: '/app/announcements', } return this.beforeRequestApi(options) diff --git a/test/rest/basics.js b/test/rest/basics.js index 2e65c54..2d7368c 100644 --- a/test/rest/basics.js +++ b/test/rest/basics.js @@ -22,7 +22,7 @@ module.exports = () => { const lnm = new LNMarketsRest() - lnm.nodeState().catch((error) => { + lnm.appNode().catch((error) => { expect(error).to.be.instanceOf(Error) expect(error.message).to.be.equal( 'getaddrinfo ENOTFOUND api.lnmarkets.lol' @@ -74,7 +74,7 @@ module.exports = () => { it('Good request', async () => { const lnm = new LNMarketsRest() - const info = await lnm.nodeState() + const info = await lnm.appNode() expect(info).to.be.an('object') })