api: create address.

This commit is contained in:
Christopher Jeffrey 2016-06-16 15:37:22 -07:00
parent edbd42b2c2
commit f494762a67
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -148,8 +148,10 @@ HTTPServer.prototype._init = function _init() {
}
}
if (params.account != null)
if (typeof params.account === 'string')
options.account = params.account || null;
else if (typeof params.account === 'number')
options.account = params.account;
if (params.name)
options.name = params.name;
@ -520,6 +522,18 @@ HTTPServer.prototype._init = function _init() {
});
});
// Create address
this.post('/wallet/:id/address', function(req, res, next, send) {
var id = req.options.id;
var account = req.options.account;
self.walletdb.createAddress(id, account, false, function(err, address) {
if (err)
return next(err);
send(200, address.toJSON());
});
});
// Wallet Balance
this.get('/wallet/:id/balance', function(req, res, next, send) {
var id = req.options.id;