diff --git a/js/controllers/history.js b/js/controllers/history.js
index af6bacbe1..34fba24a4 100644
--- a/js/controllers/history.js
+++ b/js/controllers/history.js
@@ -28,9 +28,15 @@ angular.module('copayApp.controllers').controller('HistoryController',
$scope.generating = true;
w.getTransactionHistory(function(err, res) {
- if (err) throw err;
+ if (err) {
+ $scope.generating = false;
+ throw err;
+ }
- if (!res) return;
+ if (!res) {
+ $scope.generating = false;
+ return;
+ }
var unit = w.settings.unitName;
var data = res.items;
@@ -45,6 +51,13 @@ angular.module('copayApp.controllers').controller('HistoryController',
}
data.forEach(function(it, index) {
+ if (!it) {
+ console.log('Error on tx with index ', index);
+ return;
+ } else {
+ console.log('Txid with index ', it.txid, index);
+
+ }
var dataString = formatDate(it.minedTs || it.sentTs) + ',' + it.amount + ',' + it.action + ',' + formatString(it.addressTo) + ',' + formatString(it.comment);
if (it.actionList) {
dataString += ',' + formatSigners(it.actionList);
diff --git a/js/models/Wallet.js b/js/models/Wallet.js
index 1414ddf8f..a4d604ff4 100644
--- a/js/models/Wallet.js
+++ b/js/models/Wallet.js
@@ -1368,7 +1368,31 @@ Wallet.prototype.generateAddress = function(isChange) {
};
/**
- * TODO: get this out of here
+ * @desc Retrieve all the Transaction proposals (see {@link TxProposals})
+ * @return {Object[]} each object returned represents a transaction proposal, with two additional
+ * booleans: signedByUs and rejectedByUs. An optional third boolean signals
+ * whether the transaction was finally rejected (finallyRejected set to true).
+ */
+Wallet.prototype.getTxProposals = function() {
+ var ret = [];
+ var self = this;
+ var copayers = self.getRegisteredCopayerIds();
+ var myId = self.getMyCopayerId();
+
+ _.each(self.txProposals.txps, function(txp, ntxid) {
+ txp.signedByUs = txp.signedBy[myId] ? true : false;
+ txp.rejectedByUs = txp.rejectedBy[self.getMyCopayerId()] ? true : false;
+ txp.finallyRejected = self.totalCopayers - txp.rejectCount < self.requiredCopayers;
+ txp.isPending = !txp.finallyRejected && !txp.sentTxid;
+
+ if (!txp.readonly || txp.finallyRejected || txp.sentTs) {
+ ret.push(txp);
+ }
+ });
+ return ret;
+};
+
+/**
* @desc get list of actions (see {@link getPendingTxProposals})
*/
Wallet.prototype._getActionList = function(txp) {
@@ -2568,6 +2592,7 @@ Wallet.prototype.getTransactionHistory = function(opts, cb) {
function extractInsOuts(tx) {
// Inputs
+ console.log('extractInsOuts');
var inputs = _.map(tx.vin, function(item) {
return {
type: 'in',
@@ -2690,8 +2715,11 @@ Wallet.prototype.getTransactionHistory = function(opts, cb) {
self.blockchain.getTransactions(addresses, from, to, function(err, res) {
if (err) return cb(err);
+ console.log(res.items);
_.each(res.items, function(tx) {
- decorateTx(tx);
+ if (tx) {
+ decorateTx(tx);
+ }
});
return cb(null, paginate(res, opts.currentPage, opts.itemsPerPage));