Skip to content

Commit

Permalink
Merge pull request bitpay#94 from maraoz/feature/tx-sound
Browse files Browse the repository at this point in the history
Feature/tx sound
  • Loading branch information
maraoz committed Jan 20, 2014
2 parents 0da8cde + c538d4c commit e3ccb18
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion app/models/Transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions public/js/controllers/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
});

Expand Down
Binary file added public/sound/transaction.mp3
Binary file not shown.
2 changes: 1 addition & 1 deletion public/views/transaction/list.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<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" data-ng-show="txs && txs[0].txid" data-ng-repeat="tx in txs">
<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>
Expand Down

0 comments on commit e3ccb18

Please sign in to comment.