commit
da43ca9231
|
@ -77,20 +77,27 @@ function spec() {
|
|||
var db = new TransactionDb();
|
||||
async.series([
|
||||
function (cb) {
|
||||
var seen={};
|
||||
db.fromAddr(self.addrStr, function(err,txOut){
|
||||
if (err) return cb(err);
|
||||
txOut.forEach(function(txItem){
|
||||
|
||||
var add=0, addSpend=0;
|
||||
var v = txItem.value_sat;
|
||||
|
||||
if ( !seen[txItem.txid] ) {
|
||||
txs.push({txid: txItem.txid, ts: txItem.ts});
|
||||
seen[txItem.txid]=1;
|
||||
add=1;
|
||||
}
|
||||
|
||||
if (txItem.spentTxId) {
|
||||
if (txItem.spentTxId && !seen[txItem.spentTxId] ) {
|
||||
txs.push({txid: txItem.spentTxId, ts: txItem.spentTs});
|
||||
seen[txItem.spentTxId]=1;
|
||||
addSpend=1;
|
||||
}
|
||||
|
||||
if (txItem.isConfirmed) {
|
||||
self.txApperances += 1;
|
||||
self.txApperances += add;
|
||||
self.totalReceivedSat += v;
|
||||
if (! txItem.spentTxId ) {
|
||||
//unspent
|
||||
|
@ -100,17 +107,17 @@ function spec() {
|
|||
// unspent
|
||||
self.balanceSat += v;
|
||||
self.unconfirmedBalanceSat -= v;
|
||||
self.unconfirmedTxApperances += 1;
|
||||
self.unconfirmedTxApperances += addSpend;
|
||||
}
|
||||
else {
|
||||
// spent
|
||||
self.totalSentSat += v;
|
||||
self.txApperances += 1;
|
||||
self.txApperances += addSpend;
|
||||
}
|
||||
}
|
||||
else {
|
||||
self.unconfirmedBalanceSat += v;
|
||||
self.unconfirmedTxApperances += 1;
|
||||
self.unconfirmedTxApperances += add;
|
||||
}
|
||||
});
|
||||
return cb();
|
||||
|
|
|
@ -137,7 +137,7 @@ function spec(b) {
|
|||
})
|
||||
.on('end', function() {
|
||||
|
||||
var k = SPENT_PREFIX + txid;
|
||||
var k = SPENT_PREFIX + txid + '-';
|
||||
db.createReadStream({
|
||||
start: k,
|
||||
end: k + '~'
|
||||
|
@ -166,7 +166,7 @@ function spec(b) {
|
|||
|
||||
if (!info) return cb();
|
||||
|
||||
var k = SPENT_PREFIX + info.txid;
|
||||
var k = SPENT_PREFIX + info.txid + '-';
|
||||
db.createReadStream({
|
||||
start: k,
|
||||
end: k + '~'
|
||||
|
@ -311,7 +311,7 @@ isspent
|
|||
*/
|
||||
|
||||
// spent?
|
||||
var k = SPENT_PREFIX + txid + '-' + n;
|
||||
var k = SPENT_PREFIX + txid + '-' + n + '-';
|
||||
db.createReadStream({
|
||||
start: k,
|
||||
end: k + '~'
|
||||
|
@ -365,7 +365,7 @@ isspent
|
|||
TransactionDb.prototype.fromAddr = function(addr, cb) {
|
||||
var self = this;
|
||||
|
||||
var k = ADDR_PREFIX + addr;
|
||||
var k = ADDR_PREFIX + addr + '-';
|
||||
var ret = [];
|
||||
|
||||
db.createReadStream({
|
||||
|
@ -388,7 +388,7 @@ isspent
|
|||
.on('end', function() {
|
||||
|
||||
async.eachLimit(ret, CONCURRENCY, function(o, e_c) {
|
||||
var k = SPENT_PREFIX + o.txid + '-' + o.index;
|
||||
var k = SPENT_PREFIX + o.txid + '-' + o.index + '-';
|
||||
db.createReadStream({
|
||||
start: k,
|
||||
end: k + '~'
|
||||
|
@ -415,14 +415,13 @@ isspent
|
|||
};
|
||||
|
||||
|
||||
|
||||
TransactionDb.prototype.removeFromTxId = function(txid, cb) {
|
||||
|
||||
async.series([
|
||||
|
||||
function(c) {
|
||||
db.createReadStream({
|
||||
start: OUTS_PREFIX + txid,
|
||||
start: OUTS_PREFIX + txid + '-',
|
||||
end: OUTS_PREFIX + txid + '~',
|
||||
}).pipe(
|
||||
db.createWriteStream({
|
||||
|
@ -432,7 +431,7 @@ isspent
|
|||
},
|
||||
function(c) {
|
||||
db.createReadStream({
|
||||
start: SPENT_PREFIX + txid,
|
||||
start: SPENT_PREFIX + txid + '-',
|
||||
end: SPENT_PREFIX + txid + '~'
|
||||
})
|
||||
.pipe(
|
||||
|
|
|
@ -59,16 +59,15 @@ function($scope, $rootScope, $routeParams, $location, Global, Transaction, Trans
|
|||
tmp[addr].unconfirmedInput += items[i].unconfirmedInput;
|
||||
tmp[addr].dbError = tmp[addr].dbError || items[i].dbError;
|
||||
tmp[addr].valueSat += items[i].value * COIN;
|
||||
tmp[addr].value = tmp[addr].valueSat / COIN;
|
||||
tmp[addr].items.push(items[i]);
|
||||
tmp[addr].notAddr = notAddr;
|
||||
tmp[addr].count++;
|
||||
}
|
||||
|
||||
angular.forEach(tmp, function(v) {
|
||||
v.value = parseInt(v.valueSat) / COIN;
|
||||
ret.push(v);
|
||||
});
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row" data-ng-show="!tx.isCoinBase">
|
||||
<div data-ng-repeat="vin in tx.vinSimple" data-ng-show="!itemsExpanded">
|
||||
<div data-ng-if="!itemsExpanded">
|
||||
<div data-ng-repeat="vin in tx.vinSimple">
|
||||
<div class="col-md-12 transaction-vin-vout">
|
||||
<div class="text-muted pull-right btc-value" data-ng-class="{'text-danger': $root.currentAddr == vin.addr}"><small>{{$root.currency.getConvertion(vin.value)}}</small></div>
|
||||
<div class="ellipsis">
|
||||
|
@ -41,7 +42,10 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div data-ng-repeat="vin in tx.vin" data-ng-show="itemsExpanded">
|
||||
</div><!-- if -->
|
||||
<div
|
||||
<div data-ng-if="itemsExpanded">
|
||||
<div data-ng-repeat="vin in tx.vin">
|
||||
<div class="col-md-12 transaction-vin-vout">
|
||||
<div class="text-muted pull-right btc-value"><small>{{$root.currency.getConvertion(vin.value)}}</small></div>
|
||||
<div class="ellipsis">
|
||||
|
@ -69,6 +73,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1 text-center hidden-xs hidden-sm">
|
||||
<span class="glyphicon glyphicon-chevron-right text-primary"></span>
|
||||
</div>
|
||||
|
@ -77,7 +82,8 @@
|
|||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<div data-ng-repeat="vout in tx.voutSimple" data-ng-show="!itemsExpanded">
|
||||
<div data-ng-if="!itemsExpanded">
|
||||
<div data-ng-repeat="vout in tx.voutSimple">
|
||||
<div class="col-md-12 transaction-vin-vout">
|
||||
<div class="text-muted pull-right btc-value" data-ng-class="{'text-success': $root.currentAddr == vout.addr}">
|
||||
|
||||
|
@ -97,7 +103,9 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
<div data-ng-repeat="vout in tx.vout" data-ng-show="itemsExpanded">
|
||||
</div><!-- if -->
|
||||
<div data-ng-if="itemsExpanded">
|
||||
<div data-ng-repeat="vout in tx.vout">
|
||||
<div class="col-md-12 transaction-vin-vout">
|
||||
<div class="text-muted pull-right btc-value"><small>{{$root.currency.getConvertion(vout.value)}}
|
||||
<span class="text-success" data-ng-show="!vout.spentTxId" tooltip="Output is unspent" tooltip-placement="left">(U)</span>
|
||||
|
@ -126,6 +134,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- if-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
[
|
||||
|
||||
{
|
||||
"addr": "mp3Rzxx9s1A21SY3sjJ3CQoa2Xjph7e5eS",
|
||||
"balance": 0,
|
||||
|
@ -37,7 +36,7 @@
|
|||
},
|
||||
{
|
||||
"addr": "mgqvRGJMwR9JU5VhJ3x9uX9MTkzTsmmDgQ",
|
||||
"txApperances": 28,
|
||||
"txApperances": 27,
|
||||
"balance": 0,
|
||||
"totalReceived": 54.81284116
|
||||
},
|
||||
|
@ -46,11 +45,11 @@
|
|||
"balance": 1199.74393853,
|
||||
"totalReceived": 1199.74393853,
|
||||
"totalSent": 0,
|
||||
"txApperances": 6049
|
||||
"txApperances": 6048
|
||||
},
|
||||
{
|
||||
"addr": "mjRmkmYzvZN3cA3aBKJgYJ65epn3WCG84H",
|
||||
"txApperances": 13343,
|
||||
"txApperances": 7164,
|
||||
"balance": 46413.0,
|
||||
"totalReceived": 357130.17644359,
|
||||
"totalSent": 310717.17644359
|
||||
|
@ -68,7 +67,7 @@
|
|||
"balance": 10580.50027254,
|
||||
"totalReceived": 12157.65075053,
|
||||
"totalSent": 1577.15047799,
|
||||
"txApperances": 459,
|
||||
"txApperances": 441,
|
||||
"transactions": [
|
||||
"91800d80bb4c69b238c9bfd94eb5155ab821e6b25cae5c79903d12853bbb4ed5",
|
||||
"f6e80d4fd1a2377406856c67d0cee5ac7e5120993ff97e617ca9aac33b4c6b1e",
|
||||
|
@ -111,7 +110,20 @@
|
|||
"a3789e113041db907a1217ddb5c3aaf0eff905cc3d913e68d977e1ab4d19acea",
|
||||
"80b460922faf0ad1e8b8a55533654c9a9f3039bfff0fff2bcf8536b8adf95939"
|
||||
]
|
||||
},
|
||||
{
|
||||
"addr": "mtA6woo1wjCeu1dLkWgpSD3tRnRfrHt3FL",
|
||||
"balance": 349.845,
|
||||
"totalReceived": 349.845,
|
||||
"totalSent": 0,
|
||||
"txApperances": 13,
|
||||
"transactions": [
|
||||
"794eafc0ad68a3576034eb137d7d20d3bdf1777ecf27e0e20e96e1adcfc66659",
|
||||
"0130721f29f50b773858c3c9081678bdddebcd18078c5fa2436d979b54ed5cef",
|
||||
"fb1024947b48d90255aedd3f0f1df3673a7e98d06346bb2ac89b116aa19c5db4"
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue