From 554356773aeabc10cb5d310ed9e2749fcb5da125 Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Sun, 23 Feb 2014 20:16:28 -0300 Subject: [PATCH 1/4] 1) fix rounded value for address of txout collapsed. 2) fix link of spent tx id. 3) hightlight outpoints and spents --- public/src/css/common.css | 18 +++++++++++++++--- public/src/js/config.js | 2 +- public/src/js/controllers/transactions.js | 12 ++++++++++-- public/views/transaction/tx.html | 21 ++++++++++----------- 4 files changed, 36 insertions(+), 17 deletions(-) diff --git a/public/src/css/common.css b/public/src/css/common.css index e3427952..ff5038b5 100644 --- a/public/src/css/common.css +++ b/public/src/css/common.css @@ -568,9 +568,6 @@ margin-left: 0; margin: 30px 0; } -.transaction-vin-vout .ellipsis { margin-bottom: 10px; } -.transaction-vin-vout .btc-value { margin-left: 15px; } - .page-header { margin-top: 0; } /* Index */ @@ -646,3 +643,18 @@ margin-left: 0; -webkit-animation-timing-function: linear; } +.transaction-vin-vout { + +} + +.v_hightlight { + background-color: #8DC429; + overflow: hidden; + color: #fff; +} + +a.v_hightlight_more { + background-color: #8DC429; + color: #fff; +} + diff --git a/public/src/js/config.js b/public/src/js/config.js index b1b66f83..a48a7f70 100644 --- a/public/src/js/config.js +++ b/public/src/js/config.js @@ -11,7 +11,7 @@ angular.module('insight').config(function($routeProvider) { controller: 'BlocksController', templateUrl: '/views/redirect.html' }). - when('/tx/:txId', { + when('/tx/:txId/:v_type?/:v_index?', { templateUrl: '/views/transaction.html', title: 'Bitcoin Transaction ' }). diff --git a/public/src/js/controllers/transactions.js b/public/src/js/controllers/transactions.js index e22897cb..9dbf48b4 100644 --- a/public/src/js/controllers/transactions.js +++ b/public/src/js/controllers/transactions.js @@ -58,14 +58,14 @@ function($scope, $rootScope, $routeParams, $location, Global, Transaction, Trans tmp[addr].doubleSpentIndex = tmp[addr].doubleSpentIndex || items[i].doubleSpentIndex; tmp[addr].unconfirmedInput += items[i].unconfirmedInput; tmp[addr].dbError = tmp[addr].dbError || items[i].dbError; - tmp[addr].valueSat += items[i].value * COIN; + tmp[addr].valueSat += Math.round(items[i].value * 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; + v.value = v.value || parseInt(v.valueSat) / COIN; ret.push(v); }); return ret; @@ -154,6 +154,14 @@ function($scope, $rootScope, $routeParams, $location, Global, Transaction, Trans } }; + // Highlighted txout + if ($routeParams.v_type == '>' || $routeParams.v_type == '<') { + $scope.from_vin = $routeParams.v_type == '<' ? true : false; + $scope.from_vout = $routeParams.v_type == '>' ? true : false; + $scope.v_index = $routeParams.v_index; + $scope.itemsExpanded = true; + } + //Init without txs $scope.txs = []; diff --git a/public/views/transaction/tx.html b/public/views/transaction/tx.html index cd6c2906..94910785 100644 --- a/public/views/transaction/tx.html +++ b/public/views/transaction/tx.html @@ -56,7 +56,7 @@

{{$root.currency.getConvertion(vin.value)}}

-    +    {{vin.addr}} {{vin.addr}}
@@ -65,11 +65,10 @@
Double spent attempt detected. From tx: {{vin.doubleSpentTxID}},{{vin.doubleSpentIndex}}
-
-
+
scriptSig {{vin.scriptSig.asm}} @@ -80,7 +79,7 @@
@@ -101,9 +100,9 @@

- {{$root.currency.getConvertion(vout.value)}} - (S) - (U) + {{$root.currency.getConvertion(vout.value)}} + (S) + (U)

@@ -126,8 +125,8 @@

{{$root.currency.getConvertion(vout.value)}} - (U) -    + (U) +   

@@ -136,7 +135,7 @@
-
+

Type @@ -153,7 +152,7 @@

From 4d5ac130ee4c5c077616a09605acda0342f4b3c2 Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Mon, 24 Feb 2014 02:30:47 -0300 Subject: [PATCH 2/4] show only highlighted items. added a link to show all items. --- public/src/js/controllers/transactions.js | 2 +- public/views/transaction/tx.html | 24 +++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/public/src/js/controllers/transactions.js b/public/src/js/controllers/transactions.js index 9dbf48b4..5dc9bc57 100644 --- a/public/src/js/controllers/transactions.js +++ b/public/src/js/controllers/transactions.js @@ -158,7 +158,7 @@ function($scope, $rootScope, $routeParams, $location, Global, Transaction, Trans if ($routeParams.v_type == '>' || $routeParams.v_type == '<') { $scope.from_vin = $routeParams.v_type == '<' ? true : false; $scope.from_vout = $routeParams.v_type == '>' ? true : false; - $scope.v_index = $routeParams.v_index; + $scope.v_index = parseInt($routeParams.v_index) + 1; $scope.itemsExpanded = true; } diff --git a/public/views/transaction/tx.html b/public/views/transaction/tx.html index 94910785..ca2e867b 100644 --- a/public/views/transaction/tx.html +++ b/public/views/transaction/tx.html @@ -51,8 +51,10 @@
-
-
+
+ only highlighted... + expand all... +

{{$root.currency.getConvertion(vin.value)}}

@@ -68,7 +70,7 @@
-
+
scriptSig {{vin.scriptSig.asm}} @@ -77,9 +79,9 @@
-
@@ -120,8 +122,10 @@
-
-
+
+ only highlighted... + expand all... +

{{$root.currency.getConvertion(vout.value)}} @@ -135,7 +139,7 @@

-
+

Type @@ -150,9 +154,9 @@

-
From 462867b4e0e7b76cd4237672f1b1054bde0eeb4c Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Mon, 24 Feb 2014 02:33:47 -0300 Subject: [PATCH 3/4] fix name -> highlight --- public/src/css/common.css | 4 ++-- public/views/transaction/tx.html | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/public/src/css/common.css b/public/src/css/common.css index ff5038b5..ad7e573c 100644 --- a/public/src/css/common.css +++ b/public/src/css/common.css @@ -647,13 +647,13 @@ margin-left: 0; } -.v_hightlight { +.v_highlight { background-color: #8DC429; overflow: hidden; color: #fff; } -a.v_hightlight_more { +a.v_highlight_more { background-color: #8DC429; color: #fff; } diff --git a/public/views/transaction/tx.html b/public/views/transaction/tx.html index ca2e867b..565ab5b6 100644 --- a/public/views/transaction/tx.html +++ b/public/views/transaction/tx.html @@ -70,7 +70,7 @@
-
+
scriptSig {{vin.scriptSig.asm}} @@ -81,7 +81,7 @@
@@ -139,7 +139,7 @@
-
+

Type @@ -156,7 +156,7 @@

From 576a1a896ece571b200200c3b1680b7f4faaf6bf Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Mon, 24 Feb 2014 10:45:14 -0300 Subject: [PATCH 4/4] fix names. reorder some layout `s elements. --- public/src/js/controllers/transactions.js | 2 +- public/views/block.html | 7 ++--- public/views/transaction.html | 31 +++++-------------- public/views/transaction/tx.html | 36 ++++++++++++----------- 4 files changed, 30 insertions(+), 46 deletions(-) diff --git a/public/src/js/controllers/transactions.js b/public/src/js/controllers/transactions.js index 5dc9bc57..de66b42e 100644 --- a/public/src/js/controllers/transactions.js +++ b/public/src/js/controllers/transactions.js @@ -158,7 +158,7 @@ function($scope, $rootScope, $routeParams, $location, Global, Transaction, Trans if ($routeParams.v_type == '>' || $routeParams.v_type == '<') { $scope.from_vin = $routeParams.v_type == '<' ? true : false; $scope.from_vout = $routeParams.v_type == '>' ? true : false; - $scope.v_index = parseInt($routeParams.v_index) + 1; + $scope.v_index = parseInt($routeParams.v_index); $scope.itemsExpanded = true; } diff --git a/public/views/block.html b/public/views/block.html index 8a062375..78f1a89d 100644 --- a/public/views/block.html +++ b/public/views/block.html @@ -2,7 +2,6 @@
-

Block

Loading Block...
@@ -16,7 +15,6 @@ {{block.hash}}
-

Hashes

@@ -35,7 +33,8 @@
-

Summary

+

Block #{{block.height}}

+

Summary

Loading Block Details... @@ -109,7 +108,7 @@
-

Transactions Transactions contained within this block

+

Transactions

diff --git a/public/views/transaction.html b/public/views/transaction.html index c36235f8..c0cf9bbd 100644 --- a/public/views/transaction.html +++ b/public/views/transaction.html @@ -3,7 +3,6 @@
-

Transaction

Loading Transaction...
@@ -41,10 +40,13 @@
-

- Details - View information about a bitcoin transaction -

+

Transaction + + Input + Output + {{v_index}} + +

Loading Transaction Details... @@ -53,25 +55,6 @@
-
-

Inputs and Outputs

-
- - - - - - - - - - - - - - -
Total Input{{$root.currency.getConvertion(tx.valueIn)}}
Total Output{{$root.currency.getConvertion(tx.valueOut)}}
Fees{{$root.currency.getConvertion(tx.fees)}}
-
diff --git a/public/views/transaction/tx.html b/public/views/transaction/tx.html index 565ab5b6..81a0bdc7 100644 --- a/public/views/transaction/tx.html +++ b/public/views/transaction/tx.html @@ -51,10 +51,10 @@
-
- only highlighted... - expand all... -
+
+ show input {{ v_index }} + show all +

{{$root.currency.getConvertion(vin.value)}}

@@ -70,7 +70,7 @@
-
+
scriptSig {{vin.scriptSig.asm}} @@ -81,16 +81,18 @@
- -