diff --git a/lib/client/api.js b/lib/client/api.js index db61edb..5d1b14a 100644 --- a/lib/client/api.js +++ b/lib/client/api.js @@ -768,4 +768,20 @@ API.prototype.removeTxProposal = function(txp, cb) { }); }; +API.prototype.getTxHistory = function(opts, cb) { + var self = this; + + this._loadAndCheck(function(err, data) { + if (err) return cb(err); + var url = '/v1/txhistory/'; + self._doGetRequest(url, data, function(err, txs) { + if (err) return cb(err); + + _processTxps(txs, data.sharedEncryptingKey); + + return cb(null, txs); + }); + }); +}; + module.exports = API; diff --git a/lib/expressapp.js b/lib/expressapp.js index 083ab5b..6e88da0 100644 --- a/lib/expressapp.js +++ b/lib/expressapp.js @@ -263,6 +263,17 @@ ExpressApp.start = function(opts) { }); }); + router.get('/v1/txhistory/', function(req, res) { + getServerWithAuth(req, res, function(server) { + server.getTxHistory({}, function(err, txs) { + if (err) return returnError(err, res, req); + res.json(txs); + }); + }); + }); + + + // TODO: DEBUG only! router.get('/v1/dump', function(req, res) { var server = WalletService.getInstance(); diff --git a/lib/server.js b/lib/server.js index af8c9fb..e211872 100644 --- a/lib/server.js +++ b/lib/server.js @@ -945,7 +945,9 @@ WalletService.prototype.getTxHistory = function(opts, cb) { }); }; - + function paginate(txs) { + // TODO + }; // Get addresses for this wallet self.storage.fetchAddresses(self.walletId, function(err, addresses) { @@ -978,6 +980,7 @@ WalletService.prototype.getTxHistory = function(opts, cb) { var txs = res[1]; decorate(txs, addresses, proposals); + paginate(txs); return cb(null, txs); });