diff --git a/app/controllers/addresses.js b/app/controllers/addresses.js index 562c3dac..4d5b984a 100644 --- a/app/controllers/addresses.js +++ b/app/controllers/addresses.js @@ -51,7 +51,7 @@ exports.show = function(req, res, next) { if (err) { return common.handleErrors(err, res); } else { - return res.jsonp(a); + return res.jsonp(a.getObj()); } }, req.query.noTxList); } diff --git a/app/models/Address.js b/app/models/Address.js index 7ec5ad1f..1e5e8b31 100644 --- a/app/models/Address.js +++ b/app/models/Address.js @@ -74,6 +74,24 @@ function Address(addrStr) { } +Address.prototype.getObj = function() { + // Normalize json address + return { + 'addrStr': this.addrStr, + 'balance': this.balance, + 'balanceSat': this.balanceSat, + 'totalReceived': this.totalReceived, + 'totalReceivedSat': this.totalReceivedSat, + 'totalSent': this.totalSent, + 'totalSentSat': this.totalSentSat, + 'unconfirmedBalance': this.unconfirmedBalance, + 'unconfirmedBalanceSat': this.unconfirmedBalanceSat, + 'unconfirmedTxApperances': this.unconfirmedTxApperances, + 'txApperances': this.txApperances, + 'transactions': this.transactions + }; +}; + Address.prototype.getUtxo = function(next) { var self = this; var tDb = TransactionDb;