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>
|
||||||
</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>
|
<h3>Last transactions</h3>
|
||||||
<div class="btransactions" ng-init="getTransactions()">
|
<div class="btransactions">
|
||||||
<div class="panel" ng-repeat="btx in blockchain_txs | orderBy: 'firstSeenTs':true"">
|
<div class="panel" ng-repeat="btx in blockchain_txs | orderBy: 'firstSeenTs':true">
|
||||||
<div class="txheader">
|
<div class="txheader">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="large-8 columns">
|
<div class="large-8 columns">
|
||||||
|
|
|
@ -69,13 +69,14 @@ console.log('[transactions.js.68:txid:] SENTTX CALLBACK',txid); //TODO
|
||||||
|
|
||||||
$scope.getTransactions = function() {
|
$scope.getTransactions = function() {
|
||||||
var w =$rootScope.wallet;
|
var w =$rootScope.wallet;
|
||||||
var addresses = w.getAddressesStr(true);
|
var addresses = w.getAddressesStr();
|
||||||
|
|
||||||
w.blockchain.getTransactions(addresses, function(txs) {
|
if (addresses.length > 0) {
|
||||||
$scope.blockchain_txs = txs;
|
w.blockchain.getTransactions(addresses, function(txs) {
|
||||||
$scope.$digest();
|
$scope.blockchain_txs = txs;
|
||||||
});
|
$rootScope.$digest();
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_updateTxs();
|
_updateTxs();
|
||||||
|
|
|
@ -27,7 +27,31 @@ function _asyncForEach(array, fn, callback) {
|
||||||
} else {
|
} else {
|
||||||
callback(); // Done!
|
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) {
|
Insight.prototype.getTransactions = function(addresses, cb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -56,7 +80,8 @@ Insight.prototype.getTransactions = function(addresses, cb) {
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
}, function() {
|
}, function() {
|
||||||
_asyncForEach(txids, function(txid, callback2) {
|
var clean_txids = removeRepeatedElements(txids);
|
||||||
|
_asyncForEach(clean_txids, function(txid, callback2) {
|
||||||
var options = {
|
var options = {
|
||||||
host: self.host,
|
host: self.host,
|
||||||
port: self.port,
|
port: self.port,
|
||||||
|
|
Loading…
Reference in New Issue