Fix conflicts:

js/controllers/transactions.js
This commit is contained in:
Gustavo Cortez 2014-04-23 15:10:42 -03:00
commit e17aed54b0
13 changed files with 196 additions and 94 deletions

View file

@ -1,6 +0,0 @@
'use strict';
angular.module('copay.peer').controller('PeerController',
function($scope, $rootScope, $location, $routeParams) {
});

View file

@ -23,16 +23,15 @@ angular.module('copay.send').controller('SendController',
var w = $rootScope.wallet;
w.createTx( address, amount,function() {
// reset fields
$scope.address = null;
$scope.amount = null;
form.address.$pristine = true;
form.amount.$pristine = true;
$rootScope.flashMessage = { message: 'The transaction proposal has been created', type: 'success'};
$rootScope.$digest();
});
// reset fields
$scope.address = null;
$scope.amount = null;
form.address.$pristine = true;
form.amount.$pristine = true;
// TODO: check if createTx has an error.
$rootScope.flashMessage = { message: 'Your transaction proposal has been sent successfully', type: 'success'};
};
});

View file

@ -5,8 +5,9 @@ angular.module('copay.transactions').controller('TransactionsController',
function($scope, $rootScope, $location) {
$scope.title = 'Transactions';
var _updateTxs = function() {
console.log('[transactions.js.10:_updateTxs:]'); //TODO
var w =$rootScope.wallet;
if (!w) return;
var inT = w.getTxProposals();
var txs = [];
@ -25,11 +26,10 @@ console.log('[transactions.js.10:_updateTxs:]'); //TODO
});
// extra fields
i.outs = outs;
i.fee = i.feeSat/bitcore.util.COIN;
i.fee = i.builder.feeSat/bitcore.util.COIN;
i.missingSignatures = tx.countInputMissingSignatures(0);
txs.push(i);
});
console.log('[transactions.js.35:txs:]',txs); //TODO
$scope.txs = txs;
w.removeListener('txProposalsUpdated',_updateTxs)
w.once('txProposalsUpdated',_updateTxs);
@ -38,7 +38,7 @@ console.log('[transactions.js.35:txs:]',txs); //TODO
$scope.send = function (ntxid) {
var w = $rootScope.wallet;
w.sendTx(ntxid, function(txid) {
console.log('[transactions.js.68:txid:] SENTTX CALLBACK',txid); //TODO
console.log('[transactions.js.68:txid:] SENTTX CALLBACK',txid); //TODO
$rootScope.flashMessage = txid
? {type:'success', message: 'Transactions SENT! txid:' + txid}
: {type:'error', message: 'There was an error sending the Transaction'}
@ -51,17 +51,20 @@ console.log('[transactions.js.68:txid:] SENTTX CALLBACK',txid); //TODO
$scope.sign = function (ntxid) {
var w = $rootScope.wallet;
var ret = w.sign(ntxid);
_updateTxs();
if (!ret) {
$rootScope.flashMessage = {type:'error', message: 'There was an error signing the Transaction'};
_updateTxs();
$rootScope.$digest();
return;
}
var p = w.getTxProposal(ntxid);
if (p.txp.builder.isFullySigned()) {
$scope.send(ntxid);
_updateTxs();
$rootScope.$digest();
}
else {
$rootScope.flashMessage = ret
? {type:'success', message: 'Transactions signed'}
: {type:'error', message: 'There was an error signing the Transaction'}
;
_updateTxs();
$rootScope.$digest();
}
@ -79,5 +82,13 @@ console.log('[transactions.js.68:txid:] SENTTX CALLBACK',txid); //TODO
}
};
$scope.reject = function (ntxid) {
var w = $rootScope.wallet;
w.reject(ntxid);
$rootScope.flashMessage = {type:'warning', message: 'Transaction rejected by you'};
_updateTxs();
$rootScope.$digest();
};
_updateTxs();
});