Add HTTP method to create a new wallet on request

This commit is contained in:
littlenaut 2019-03-03 17:34:00 +00:00 committed by Josh Harvey
parent 03288c4f5e
commit bbd76ba851

View file

@ -155,6 +155,16 @@ function postTx (req, res, next) {
.catch(next)
}
function createWallet (req, res, next) {
const pi = plugins(req.settings, req.deviceId)
pi.newAddress(req.tx)
.then(addr => {
console.log(JSON.stringify(addr))
respond(req, res, addr)
})
.catch(next)
}
function stateChange (req, res, next) {
helpers.stateChange(req.deviceId, req.deviceTime, req.body)
.then(() => respond(req, res))
@ -367,6 +377,7 @@ app.post('/phone_code', getCustomerWithPhoneCode)
app.patch('/customer/:id', updateCustomer)
app.post('/tx', postTx)
app.post('/tx/createWallet', createWallet)
app.get('/tx/:id', getTx)
app.get('/tx', getPhoneTx)
app.get('/logs', getLastSeen)