add REST endpoint

This commit is contained in:
Ivan Socolsky 2017-05-18 11:28:23 -03:00
parent 8df8327395
commit da6e61b7e7
No known key found for this signature in database
GPG Key ID: FAECE6A05FAA4F56
1 changed files with 23 additions and 1 deletions

View File

@ -711,6 +711,28 @@ ExpressApp.prototype.start = function(opts, cb) {
});
});
router.post('/v1/txconfirmations/', function(req, res) {
getServerWithAuth(req, res, function(server) {
server.txConfirmationSubscribe(req.body, function(err, response) {
if (err) return returnError(err, res, req);
res.json(response);
});
});
});
router.delete('/v1/txconfirmations/:txid', function(req, res) {
var opts = {
txid: req.params['txid'],
};
getServerWithAuth(req, res, function(server) {
server.txConfirmationUnsubscribe(opts, function(err, response) {
if (err) return returnError(err, res, req);
res.json(response);
});
});
});
this.app.use(opts.basePath || '/bws/api', router);
WalletService.initialize(opts, cb);