From f5fbc84dcb85d2d487431af912cdddfcfdb8c8ea Mon Sep 17 00:00:00 2001 From: Rob Lundie Hill Date: Tue, 20 Sep 2016 23:41:57 +0100 Subject: [PATCH 1/2] Added Tx receipt fields (so you can see the called contract addresses and how much gas was actually spent) --- app/scripts/controllers/blockInfosController.js | 17 ++++++++++++----- .../controllers/transactionInfosController.js | 9 ++++++++- app/views/blockInfos.html | 10 +++++++++- app/views/transactionInfos.html | 10 +++++++++- 4 files changed, 38 insertions(+), 8 deletions(-) diff --git a/app/scripts/controllers/blockInfosController.js b/app/scripts/controllers/blockInfosController.js index 6ef2207..aa49962 100644 --- a/app/scripts/controllers/blockInfosController.js +++ b/app/scripts/controllers/blockInfosController.js @@ -100,12 +100,19 @@ angular.module('ethExplorer') input: result.input, value: result.value } - $scope.$apply( - $scope.transactions.push(transaction) - ) - }) + + web3.eth.getTransactionReceipt(result.hash, function (err2, receipt) { + if(!err2) { + for (var attrname in receipt) { transaction[attrname] = receipt[attrname]; } + } + + $scope.$apply( + $scope.transactions.push(transaction) + ); + }); + }); } - }) + }); function hex2a(hexx) { diff --git a/app/scripts/controllers/transactionInfosController.js b/app/scripts/controllers/transactionInfosController.js index 468ceae..8deaf37 100644 --- a/app/scripts/controllers/transactionInfosController.js +++ b/app/scripts/controllers/transactionInfosController.js @@ -30,6 +30,8 @@ angular.module('ethExplorer') } $scope.from = result.from; $scope.gas = result.gas; + $scope.gasUsed = result.gasUsed; + $scope.contractAddress = result.contractAddress; $scope.gasPrice = result.gasPrice.c[0] + " WEI"; $scope.hash = result.hash; $scope.input = result.input; // that's a string @@ -68,7 +70,12 @@ angular.module('ethExplorer') web3.eth.getTransaction($scope.txId,function(error, result) { if(!error){ - deferred.resolve(result); + web3.eth.getTransactionReceipt($scope.txId,function(err2, receipt) { + if(!err2) { + for (var attrname in receipt) { result[attrname] = receipt[attrname]; } + } + deferred.resolve(result); + }); } else{ deferred.reject(error); diff --git a/app/views/blockInfos.html b/app/views/blockInfos.html index 03f8339..11dca38 100644 --- a/app/views/blockInfos.html +++ b/app/views/blockInfos.html @@ -90,9 +90,17 @@

{{tx.to}} - Gas + Contract Address + {{tx.contractAddress || '??'}} + + + Gas Sent {{tx.gas}} + + Gas Used + {{tx.gasUsed || '??'}} + Input {{tx.input}} diff --git a/app/views/transactionInfos.html b/app/views/transactionInfos.html index 40e59e9..2d2858b 100644 --- a/app/views/transactionInfos.html +++ b/app/views/transactionInfos.html @@ -53,9 +53,17 @@

Transaction - Gas Used + Contract Address + {{contractAddress || '??'}} + + + Gas Sent {{gas}} + + Gas Used + {{gasUsed || '??'}} + Gas Price {{gasPrice}} From ab9e0e4a2f82dae869e55a4cd45ca0f2c1850549 Mon Sep 17 00:00:00 2001 From: Rob Lundie Hill Date: Wed, 21 Sep 2016 00:26:10 +0100 Subject: [PATCH 2/2] added docker file and RPC switchability via WEB3_RPC envier --- Dockerfile | 11 +++++++++++ selectRpcAndRun.sh | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 Dockerfile create mode 100755 selectRpcAndRun.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cf81c83 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM iojs +ADD app /app +ADD .bowerrc / +ADD bower.json / +ADD karma.conf.js / +ADD package.json / +WORKDIR / +RUN npm install +ADD selectRpcAndRun.sh / +CMD /selectRpcAndRun.sh + diff --git a/selectRpcAndRun.sh b/selectRpcAndRun.sh new file mode 100755 index 0000000..3f060dd --- /dev/null +++ b/selectRpcAndRun.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ "$WEB3_RPC" != "" ]; then + mv app/app.js app/app.js.orig + cat app/app.js.orig | sed "s|http://localhost:8545|$WEB3_RPC|" > app/app.js +fi + +node_modules/http-server/bin/http-server ./app -a 0.0.0.0 -p 8000 -c-1 \ No newline at end of file