resolve conflics

This commit is contained in:
Matias Alejo Garcia 2014-01-20 23:54:59 -03:00
commit c665fe6eb1
6 changed files with 183 additions and 132 deletions

View File

@ -282,7 +282,7 @@ TransactionSchema.statics.queryInfo = function(txid, cb) {
else {
tx.ins.forEach(function(i) {
if (i.value) {
info.vin[c].value = util.formatValue(i.value);
info.vin[c].value = parseFloat(util.formatValue(i.value));
var n = util.valueToBigInt(i.value).toNumber();
info.vin[c].valueSat = n;
valueIn = valueIn.add( n );

View File

@ -334,4 +334,13 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
background-color: #1a1a1a;
}
.expanded-tx {
border-bottom: 1px dashed #444;
}
.expanded-tx small {
font-size: 80%;
}

View File

@ -8,11 +8,56 @@ angular.module('insight.transactions').controller('transactionsController',
$scope.findTx($routeParams.txId);
};
$scope.aggregateItems = function(items) {
var l = items.length;
var ret = [];
var tmp = {};
// TODO multiple output address
//
for(var i=0; i < l; i++) {
// non standard output
if (items[i].scriptPubKey && items[i].scriptPubKey.addresses.length > 1) {
item[i].addr = items[i].scriptPubKey.addresses.join(',');
ret.push(items[i]);
continue;
}
var addr = items[i].addr ||
(items[i].scriptPubKey && items[i].scriptPubKey.addresses[0] );
if (!tmp[addr]) {
tmp[addr] = {};
tmp[addr].valueSat = 0;
tmp[addr].count = 0;
tmp[addr].addr = addr;
tmp[addr].items = [];
}
tmp[addr].valueSat += items[i].valueSat;
tmp[addr].value = tmp[addr].valueSat / 100000000;
tmp[addr].items.push(items[i]);
tmp[addr].count++;
}
angular.forEach(tmp, function(v) {
ret.push(v);
});
return (ret);
};
$scope.processTX = function(tx) {
tx.vinSimple = $scope.aggregateItems(tx.vin);
tx.voutSimple = $scope.aggregateItems(tx.vout);
};
$scope.findTx = function(txid) {
Transaction.get({
txId: txid
}, function(tx) {
$scope.tx = tx;
$scope.processTX(tx);
$scope.txs.unshift(tx);
}, function(e) {
if (e.status === 400) {
@ -32,6 +77,9 @@ angular.module('insight.transactions').controller('transactionsController',
TransactionsByBlock.query({
block: bId
}, function(txs) {
angular.forEach(txs, function(tx) {
$scope.processTX(tx);
});
$scope.txs = txs;
});
};
@ -40,6 +88,9 @@ angular.module('insight.transactions').controller('transactionsController',
TransactionsByAddress.query({
address: aId
}, function(txs) {
angular.forEach(txs, function(tx) {
$scope.processTX(tx);
});
$scope.txs = txs;
});
};

View File

@ -5,72 +5,13 @@
</h1>
<div class="block-tx">
<div class="line-bot">
<a href="/#!/tx/{{tx.txid}}">{{tx.txid}}</a>
</div>
<div class="row m10b">
<div class="col-md-5">
<ul class="list-unstyled" data-ng-repeat="vin in tx.vin" data-ng-show="!tx.isCoinBase">
<li>
<a class="m10h vm lead glyphicon glyphicon-circle-arrow-left" href="/#!/tx/{{vin.txid}}" alt="Outpoint: {{vin.txid}},{{vin.vout}}" data-toggle="tooltip" title="Outpoint: {{vin.txid}},{{vin.vout}}">
</a>
<span data-ng-show="!vin.addr">Address could not be parsed</span>
<a data-ng-show="vin.addr" href="/#!/address/{{vin.addr}}">{{vin.addr}}</a>
<span class="pull-right badge">{{vin.value}} BTC</span>
</li>
</ul>
<div data-ng-show="tx.isCoinBase">
<ul class="list-unstyled" data-ng-repeat="vinn in tx.vin">
<li>
No Inputs (Newly Generated isCoinBasens)
<span class="pull-right badge">{{vinn.reward}} BTC</span>
</li>
</ul>
</div>
</div>
<div class="col-md-2 text-center">
<span class="glyphicon glyphicon-chevron-right lead"></span>
</div>
<div class="col-md-5" data-ng-repeat="vout in tx.vout">
<div class="row m10b">
<div class="col-md-3">
<b>{{vout.scriptPubKey.type}}</b>
</div>
<div class="col-md-9">
<ul class="list-unstyled" data-ng-repeat="addr in vout.scriptPubKey.addresses">
<li>
<a class="ellipsis pull-left" style="width:200px;" href="/#!/address/{{addr}}">{{addr}}</a>
<span class="pull-right badge">{{vout.value}} BTC</span>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="line-top">
<small class="text-muted">Feeds: {{tx.feeds}}</small>
<div class="pull-right">
<button data-ng-show="tx.confirmations" type="button" class="btn btn-success">
{{tx.confirmations}} Confirmations
</button>
<button data-ng-show="!tx.confirmations" type="button" class="btn btn-danger">
Unconfirmed Transaction!
</button>
<button type="button" class="btn btn-primary">{{tx.valueOut}} BTC</button>
</div>
</div>
<div data-ng-include src="'/views/transaction/tx.html'"></div>
</div><!-- END OF BLOCK-TX -->
<div class="row m50v">
<div data-ng-class="{'col-md-6':!tx.isCoinBase}">
<h3>Summary</h3>
<table class="table">
<table class="table" style="table-layout: fixed">
<tbody>
<tr>
<td><strong> Size </strong></td>
@ -81,9 +22,10 @@
<td class="text-muted text-right">{{tx.time * 1000|date:'medium'}}</td>
</tr>
<tr>
<td><strong>Block </strong></td>
<td class="text-muted text-right"><a href="/#!/block/{{tx.blockhash}}">Block</a></td>
</tr>
<td><strong>Block </strong>
<td class="text-muted text-right">
<a href="/#!/block/{{tx.blockhash}}" class=" ellipsis">{{tx.blockhash}}</a>
</tbody>
</table>
</div>
@ -106,6 +48,7 @@
</tbody>
</table>
</div>
</div>
</section>

View File

@ -1,71 +1,5 @@
<div data-ng-show="!txs || txs.lenght">Loading...</div>
<div class="alert alert-warning" data-ng-show="txs && !txs[0].txid">There are not transactions</div>
<div class="block-tx fader" data-ng-show="txs && txs[0].txid" data-ng-repeat="tx in txs">
<div class="line-bot">
<a href="/#!/tx/{{tx.txid}}">{{tx.txid}}</a>
<span class="pull-right">{{tx.time * 1000 | date:'medium'}}</span>
</div>
<div class="row">
<div class="col-md-5">
<div class="ellipsis row" data-ng-show="tx.isCoinBase" data-ng-repeat="vin in tx.vin">
<div class="col-md-10">
<p class="ellipsis">No Inputs (Newly Generated isCoinBasens)</p>
</div>
<p class="text-muted pull-right"> <small>{{vin.reward}} BTC</small></p>
</div>
<ul class="list-unstyled" data-ng-repeat="vin in tx.vin" data-ng-show="!tx.isCoinBase">
<li class="row">
<a class="col-md-1 glyphicon glyphicon-circle-arrow-left" href="/#!/tx/{{vin.txid}}" alt="Outpoint: {{vin.txid}},{{vin.vout}}" data-toggle="tooltip" title="Outpoint: {{vin.txid}},{{vin.vout}}">
</a>
<div class="col-md-8">
<div class="ellipsis">
<span data-ng-show="!vin.addr">Address could not be parsed</span>
<a data-ng-show="vin.addr" href="/#!/address/{{vin.addr}}">{{vin.addr}}</a>
</div>
</div>
<p class="text-right text-muted"><small>{{vin.value}} BTC</small></p>
</li>
</ul>
</div>
<div class="col-md-1 text-center">
<span class="glyphicon glyphicon-arrow-right lead">&nbsp;</span>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-3">
<div data-ng-repeat="vout in tx.vout">
<small data-ng-repeat="address in vout.scriptPubKey.addresses">{{vout.scriptPubKey.type}}</small>
</div>
</div>
<div data-ng-repeat="vout in tx.vout">
<div class="col-md-6">
<div class="ellipsis">
<a href="/#!/address/{{address}}" data-ng-repeat="address in vout.scriptPubKey.addresses" class="ellipsis">{{address}}</a>
</div>
</div>
<div class="col-md-3">
<p class="text-right text-muted"> <small>{{vout.value}} BTC</small></p>
</div>
</div>
</div>
</div>
</div>
<div class="line-top">
<div class="m5v">
<div class="pull-right">
<button data-ng-show="tx.confirmations" type="button" class="btn btn-success">
{{tx.confirmations}} Confirmations
</button>
<button data-ng-show="!tx.confirmations" type="button" class="btn btn-danger">
Unconfirmed Transaction!
</button>
<button type="button" class="btn btn-primary">{{tx.valueOut}} BTC</button>
</div>
<small data-ng-show="!tx.isCoinBase" class="text-muted">Feeds: {{tx.feeds}}</small>
</div>
</div>
<div data-ng-include src="'/views/transaction/tx.html'"></div>
</div>

View File

@ -0,0 +1,114 @@
<div class="line-bot">
<a href="/#!/tx/{{tx.txid}}">{{tx.txid}}</a>
<span class="pull-right">{{tx.time * 1000 | date:'medium'}}</span>
</div>
<div class="row">
<div class="col-md-5">
<div class="ellipsis row" data-ng-show="tx.isCoinBase" data-ng-repeat="vin in tx.vin">
<div class="col-md-10">
<p class="ellipsis">No Inputs (Newly Generated Coins)</p>
</div>
<p class="text-muted pull-right"> <small>{{vin.reward}} BTC</small></p>
</div>
<div data-ng-show="!tx.isCoinBase">
<ul class="list-unstyled" data-ng-repeat="vin in tx.vinSimple" data-ng-show="!inputsExpanded">
<li class="row">
<div class="col-md-8">
<div class="ellipsis">
<a data-ng-show="vin.addr" href="/#!/address/{{vin.addr}}">{{vin.addr}}</a>
</div>
</div>
<p class="text-right text-muted"><small>{{vin.value}} BTC</small></p>
</ul>
<ul class="list-unstyled" data-ng-repeat="vin in tx.vin" data-ng-show="inputsExpanded">
<li class="row expanded-tx">
<a class="col-md-1 glyphicon glyphicon-arrow-right" href="/#!/tx/{{vin.txid}}" alt="Outpoint: {{vin.txid}},{{vin.vout}}" tooltip="Outpoint: {{vin.txid}},{{vin.vout}}" tooltip-placement="right" >
</a>
<div class="col-md-8">
<div class="ellipsis">
<span data-ng-show="!vin.addr">Address could not be parsed</span>
<a data-ng-show="vin.addr" href="/#!/address/{{vin.addr}}">{{vin.addr}}</a>
</div>
<div style="word-wrap:break-word">
<small><strong>scriptSig</strong>{{vin.scriptSig.asm}}</small>
</div>
</div>
<p class="text-right text-muted"><small>{{vin.value}} BTC</small></p>
</ul>
<div class="text-center">
<a class="text-small" data-ng-click="inputsExpanded = !inputsExpanded">
<span data-ng-show="inputsExpanded">
<span class="glyphicon glyphicon-chevron-up"></span> Collapse Inputs
</span>
<span data-ng-show="!inputsExpanded">
<span class="glyphicon glyphicon-chevron-down"></span> Expand Inputs
</span>
</a>
</div>
</div>
</div>
<div class="col-md-1 text-center">
<span class="glyphicon glyphicon-arrow-right lead">&nbsp;</span>
</div>
<div class="col-md-6">
<div class="row">
<div data-ng-repeat="vout in tx.voutSimple" data-ng-show="!outputsExpanded">
<div class="col-md-9">
<div class="ellipsis">
<a href="/#!/address/{{address}}" data-ng-repeat="address in vout.addr.split(',')">{{address}}</a>
</div>
</div>
<div class="col-md-3">
<p class="text-right text-muted"> <small>{{vout.value}} BTC</small></p>
</div>
</div>
<div data-ng-repeat="vout in tx.vout" data-ng-show="outputsExpanded">
<div class="col-md-9 expanded-tx">
<div class="ellipsis">
<a href="/#!/address/{{address}}" data-ng-repeat="address in vout.scriptPubKey.addresses">{{address}}</a>
</div>
<small><strong>type</strong> {{vout.scriptPubKey.type}}</small>
<div>
<small><strong>scriptPubKey</strong> {{vout.scriptPubKey.asm}}</small>
</div>
</div>
<div class="col-md-3">
<p class="text-right text-muted"> <small>{{vout.value}} BTC</small></p>
</div>
</div>
</div>
<div class="text-center">
<a class="text-small" data-ng-click="outputsExpanded = !outputsExpanded">
<span data-ng-show="outputsExpanded">
<span class="glyphicon glyphicon-chevron-up"></span> Collapse Outputs
</span>
<span data-ng-show="!outputsExpanded">
<span class="glyphicon glyphicon-chevron-down"></span> Expand Outputs
</span>
</a>
</div>
</div>
</div>
<div class="line-top">
<div class="m5v">
<div class="pull-right">
<button data-ng-show="tx.confirmations" type="button" class="btn btn-success">
{{tx.confirmations}} Confirmations
</button>
<button data-ng-show="!tx.confirmations" type="button" class="btn btn-danger">
Unconfirmed Transaction!
</button>
<button type="button" class="btn btn-primary">{{tx.valueOut}} BTC</button>
</div>
<small data-ng-show="!tx.isCoinBase" class="text-muted">Feeds: {{tx.feeds}}</small>
</div>
</div>