Browse Source

add client api for history

activeAddress
Ivan Socolsky 10 years ago
parent
commit
036cc88ba8
  1. 16
      lib/client/api.js
  2. 11
      lib/expressapp.js
  3. 5
      lib/server.js

16
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;

11
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();

5
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);
});

Loading…
Cancel
Save