add support for funding

This commit is contained in:
Josh Harvey 2017-06-17 01:38:51 +03:00
parent 8440fa3b1d
commit bf0dc3f7f3
15 changed files with 731 additions and 356 deletions

View file

@ -27,6 +27,7 @@ const login = require('./login')
const pairing = require('./pairing')
const server = require('./server')
const transactions = require('./transactions')
const funding = require('./funding')
const NEVER = new Date(Date.now() + 100 * T.years)
const REAUTHENTICATE_INTERVAL = T.minute
@ -122,6 +123,18 @@ app.post('/api/machines', (req, res) => {
.then(() => dbNotify())
})
app.get('/api/funding', (req, res) => {
return funding.getFunding()
.then(r => res.json(r))
})
app.get('/api/funding/:cryptoCode', (req, res) => {
const cryptoCode = req.params.cryptoCode
return funding.getFunding(cryptoCode)
.then(r => res.json(r))
})
app.get('/api/status', (req, res, next) => {
return Promise.all([server.status(), config.validateCurrentConfig()])
.then(([serverStatus, invalidConfigGroups]) => res.send({