diff --git a/app/models/Transaction.js b/app/models/Transaction.js index 5e418ad..eaa0081 100644 --- a/app/models/Transaction.js +++ b/app/models/Transaction.js @@ -171,10 +171,13 @@ TransactionSchema.statics.explodeTransactionItems = function(txid, time, cb) { TransactionItem.create({ txid : txid, value_sat : o.valueSat, - addr : o.scriptPubKey.addresses[0], + addr : o.scriptPubKey.addresses[0], // TODO: only address 0? index : o.n, ts : time, }, next_out); + if (addrs.indexOf(o.scriptPubKey.addresses[0]) === -1) { + addrs.push(o.scriptPubKey.addresses[0]); + } } else { console.log ('WARN in TX: %s could not parse OUTPUT %d', txid, o.n); diff --git a/public/js/controllers/transactions.js b/public/js/controllers/transactions.js index 52b12c9..3d9f92c 100644 --- a/public/js/controllers/transactions.js +++ b/public/js/controllers/transactions.js @@ -22,7 +22,7 @@ angular.module('insight.transactions').controller('transactionsController', txId: txid }, function(tx) { $scope.tx = tx; - $scope.txs.push(tx); + $scope.txs.unshift(tx); }, function(e) { if (e.status === 400) { $rootScope.flashMessage = 'Invalid Transaction ID: ' + $routeParams.txId; @@ -54,7 +54,9 @@ angular.module('insight.transactions').controller('transactionsController', }; var socket = get_socket($scope); socket.on('atx', function(tx) { - console.log('Incoming transaction for address!', tx); + console.log('atx '+tx.txid); + var beep = new Audio('/sound/transaction.mp3'); + beep.play(); $scope.findTx(tx.txid); }); diff --git a/public/sound/transaction.mp3 b/public/sound/transaction.mp3 new file mode 100644 index 0000000..4841543 Binary files /dev/null and b/public/sound/transaction.mp3 differ diff --git a/public/views/transaction/list.html b/public/views/transaction/list.html index f8501c9..eb3a45c 100644 --- a/public/views/transaction/list.html +++ b/public/views/transaction/list.html @@ -1,6 +1,6 @@
Loading...
There are not transactions
-
+
{{tx.txid}} {{tx.time * 1000 | date:'medium'}}