Using getTransactionHistory from wallet
This commit is contained in:
parent
36b6636ce4
commit
f8fb165630
1 changed files with 37 additions and 29 deletions
|
|
@ -33,13 +33,22 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
||||||
log.info('Not available on mobile');
|
log.info('Not available on mobile');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var w = $rootScope.wallet;
|
||||||
|
if (!w) return;
|
||||||
|
|
||||||
var data = $scope.blockchain_txs;
|
var data = w.getTransactionHistory(null, function(err, res) {
|
||||||
|
if (err) throw err;
|
||||||
|
|
||||||
|
if (!res) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = res.items;
|
||||||
var filename = "copay_history.csv";
|
var filename = "copay_history.csv";
|
||||||
var csvContent = "data:text/csv;charset=utf-8,Date,Amount,Action,AddressTo,Comment\n";
|
var csvContent = "data:text/csv;charset=utf-8,Date,Amount,Action,AddressTo,Comment\n";
|
||||||
|
|
||||||
data.forEach(function(it, index) {
|
data.forEach(function(it, index) {
|
||||||
var dataString = formatDate(it.ts) + ',' + it.amount + ',' + it.action + ',' + it.addressTo + ',' + formatString(it.comment);
|
var dataString = formatDate(it.minedTs || it.sentTs) + ',' + it.amount + ',' + it.action + ',' + it.addressTo + ',' + formatString(it.comment);
|
||||||
csvContent += index < data.length ? dataString + "\n" : dataString;
|
csvContent += index < data.length ? dataString + "\n" : dataString;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -64,11 +73,12 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
||||||
return dateObj.toJSON().substring(0, 10);
|
return dateObj.toJSON().substring(0, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function formatString(str) {
|
function formatString(str) {
|
||||||
if (!str) return '';
|
if (!str) return '';
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -122,8 +132,6 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
||||||
|
|
||||||
|
|
||||||
$scope.hasAction = function(actions, action) {
|
$scope.hasAction = function(actions, action) {
|
||||||
|
|
||||||
|
|
||||||
return actions.hasOwnProperty('create');
|
return actions.hasOwnProperty('create');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue