Reorder functions
This commit is contained in:
parent
aba3ff100d
commit
d56368afb0
|
@ -43,24 +43,6 @@ var getAddrs = function(req, res, next) {
|
|||
return as;
|
||||
};
|
||||
|
||||
var normalizeAddr = function(a) {
|
||||
// Normalize json address
|
||||
return {
|
||||
'addrStr': a.addrStr,
|
||||
'balance': a.balance,
|
||||
'balanceSat': a.balanceSat,
|
||||
'totalReceived': a.totalReceived,
|
||||
'totalReceivedSat': a.totalReceivedSat,
|
||||
'totalSent': a.totalSent,
|
||||
'totalSentSat': a.totalSentSat,
|
||||
'unconfirmedBalance': a.unconfirmedBalance,
|
||||
'unconfirmedBalanceSat': a.unconfirmedBalanceSat,
|
||||
'unconfirmedTxApperances': a.unconfirmedTxApperances,
|
||||
'txApperances': a.txApperances,
|
||||
'transactions': a.transactions
|
||||
};
|
||||
};
|
||||
|
||||
exports.show = function(req, res, next) {
|
||||
var a = getAddr(req, res, next);
|
||||
|
||||
|
@ -69,7 +51,7 @@ exports.show = function(req, res, next) {
|
|||
if (err) {
|
||||
return common.handleErrors(err, res);
|
||||
} else {
|
||||
return res.jsonp(normalizeAddr(a));
|
||||
return res.jsonp(a.getObj());
|
||||
}
|
||||
}, req.query.noTxList);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue