mirror of https://github.com/BTCPrivate/copay.git
Get transactions of all addresses (the generated and the changes). Do not repeat txids on the front-end
This commit is contained in:
parent
df9b26fdde
commit
68fd916053
|
@ -328,10 +328,10 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="large-12 columns">
|
||||
<div class="large-12 columns" ng-init="getTransactions()" ng-show="blockchain_txs[0].txid">
|
||||
<h3>Last transactions</h3>
|
||||
<div class="btransactions" ng-init="getTransactions()">
|
||||
<div class="panel" ng-repeat="btx in blockchain_txs | orderBy: 'firstSeenTs':true"">
|
||||
<div class="btransactions">
|
||||
<div class="panel" ng-repeat="btx in blockchain_txs | orderBy: 'firstSeenTs':true">
|
||||
<div class="txheader">
|
||||
<div class="row">
|
||||
<div class="large-8 columns">
|
||||
|
|
|
@ -69,13 +69,14 @@ console.log('[transactions.js.68:txid:] SENTTX CALLBACK',txid); //TODO
|
|||
|
||||
$scope.getTransactions = function() {
|
||||
var w =$rootScope.wallet;
|
||||
var addresses = w.getAddressesStr(true);
|
||||
var addresses = w.getAddressesStr();
|
||||
|
||||
w.blockchain.getTransactions(addresses, function(txs) {
|
||||
$scope.blockchain_txs = txs;
|
||||
$scope.$digest();
|
||||
});
|
||||
|
||||
if (addresses.length > 0) {
|
||||
w.blockchain.getTransactions(addresses, function(txs) {
|
||||
$scope.blockchain_txs = txs;
|
||||
$rootScope.$digest();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
_updateTxs();
|
||||
|
|
|
@ -27,7 +27,31 @@ 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;
|
||||
|
@ -56,7 +80,8 @@ Insight.prototype.getTransactions = function(addresses, cb) {
|
|||
callback();
|
||||
});
|
||||
}, function() {
|
||||
_asyncForEach(txids, function(txid, callback2) {
|
||||
var clean_txids = removeRepeatedElements(txids);
|
||||
_asyncForEach(clean_txids, function(txid, callback2) {
|
||||
var options = {
|
||||
host: self.host,
|
||||
port: self.port,
|
||||
|
|
Loading…
Reference in New Issue