diff --git a/css/main.css b/css/main.css index 0df6831d4..6ab5b4587 100644 --- a/css/main.css +++ b/css/main.css @@ -117,6 +117,24 @@ body { font-size: 12px; } +.btransactions .panel { + background: #fff; +} + +.btransactions .txheader { + font-size: 12px; + margin-bottom: 10px; + padding-bottom: 10px; + border-bottom: 1px solid #eee; +} + +.btransactions .txbottom { + margin-top: 10px; + padding-top: 10px; + border-top: 1px solid #eee; + font-size: 12px; +} + .pending table { width: 100%; border: none; diff --git a/index.html b/index.html index 16b278635..5ad74b5a6 100644 --- a/index.html +++ b/index.html @@ -338,40 +338,54 @@ -
-
diff --git a/js/controllers/transactions.js b/js/controllers/transactions.js index 59f58f150..82b1f2a1a 100644 --- a/js/controllers/transactions.js +++ b/js/controllers/transactions.js @@ -70,6 +70,17 @@ angular.module('copay.transactions').controller('TransactionsController', } }; + $scope.getTransactions = function() { + var w =$rootScope.wallet; + var addresses = w.getAddressesStr(); + + if (addresses.length > 0) { + w.blockchain.getTransactions(addresses, function(txs) { + $scope.blockchain_txs = txs; + $rootScope.$digest(); + }); + } + }; $scope.reject = function (ntxid) { var w = $rootScope.wallet; diff --git a/js/models/blockchain/Insight.js b/js/models/blockchain/Insight.js index 67097f2ce..7fa1b275f 100644 --- a/js/models/blockchain/Insight.js +++ b/js/models/blockchain/Insight.js @@ -27,7 +27,78 @@ function _asyncForEach(array, fn, callback) { } else { callback(); // Done! } -}; +}; + +function removeRepeatedElements(ar){ + var ya=false,v="",aux=[].concat(ar),r=Array(); + for (var i in aux){ // + v=aux[i]; + ya=false; + for (var a in aux){ + if (v==aux[a]){ + if (ya==false){ + ya=true; + } + else{ + aux[a]=""; + } + } + } + } + for (var a in aux){ + if (aux[a]!=""){ + r.push(aux[a]); + } + } + return r; +} + +Insight.prototype.getTransactions = function(addresses, cb) { + var self = this; + + if (!addresses || !addresses.length) return cb([]); + + var txids = []; + var txs = []; + + _asyncForEach(addresses, function(addr, callback) { + var options = { + host: self.host, + port: self.port, + scheme: self.scheme, + method: 'GET', + path: '/api/addr/' + addr, + + headers: { 'Access-Control-Request-Headers' : '' } + }; + + self._request(options, function(err, res) { + var txids_tmp = res.transactions; + for(var i=0; i