Updates bitcore-wallet-client and fix functions

This commit is contained in:
Gustavo Maximiliano Cortez 2016-01-29 16:39:32 -03:00
commit 5dec3249d1
3 changed files with 45 additions and 47 deletions

View file

@ -40,7 +40,7 @@
"url": "https://github.com/bitpay/copay/issues" "url": "https://github.com/bitpay/copay/issues"
}, },
"dependencies": { "dependencies": {
"bitcore-wallet-client": "1.5.0", "bitcore-wallet-client": "2.1.0",
"express": "^4.11.2", "express": "^4.11.2",
"fs": "0.0.2", "fs": "0.0.2",
"grunt": "^0.4.5", "grunt": "^0.4.5",

View file

@ -808,11 +808,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
'message': comment 'message': comment
}); });
txSignService.prepare(function(err) {
if (err) {
return self.setSendError(err);
}
var opts = { var opts = {
toAddress: address, toAddress: address,
amount: amount, amount: amount,
@ -845,32 +840,35 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
} }
}); });
});
}, 100); }, 100);
}; };
this.acceptTx = function(txp) { this.acceptTx = function(txp) {
var self = this; var self = this;
this.confirmTxPopup = null; txSignService.prepare(function(err) {
this.setOngoingProcess(gettextCatalog.getString('Sending transaction'));
txSignService.publishTx(txp, function(err) {
self.setOngoingProcess();
if (err) { if (err) {
$log.debug(err); return self.setSendError(err);
}
self.setOngoingProcess(gettextCatalog.getString('Sending transaction'));
txSignService.publishTx(txp, function(err, txpPublished) {
if (err) {
self.setOngoingProcess();
self.setSendError(err); self.setSendError(err);
} else { } else {
self.resetForm(); self.prepareSignAndBroadcastTx(txpPublished);
// self.signAndBroadcastTx(txp);
} }
}); });
});
}; };
this.signAndBroadcastTx = function() { this.prepareSignAndBroadcastTx = function(txp) {
var fc = profileService.focusedClient;
var self = this; var self = this;
txSignService.signAndBroadcast(txp, { txSignService.prepareAndSignAndBroadcast(txp, {
reporterFn: self.setOngoingProcess.bind(self) reporterFn: self.setOngoingProcess.bind(self)
}, function(err, txp) { }, function(err, txp) {
self.resetForm(); self.resetForm();
if (err) { if (err) {
self.error = err.message ? err.message : gettext('The payment was created but could not be completed. Please try again from home screen'); self.error = err.message ? err.message : gettext('The payment was created but could not be completed. Please try again from home screen');
$scope.$emit('Local/TxProposalAction'); $scope.$emit('Local/TxProposalAction');
@ -882,7 +880,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
txStatus.notify(txp, function() { txStatus.notify(txp, function() {
$scope.$emit('Local/TxProposalAction', txp.status == 'broadcasted'); $scope.$emit('Local/TxProposalAction', txp.status == 'broadcasted');
}); });
}; }
}); });
}; };

View file

@ -120,9 +120,9 @@ angular.module('copayApp.services').factory('txSignService', function($rootScope
root.publishTx = function(txp, cb) { root.publishTx = function(txp, cb) {
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
fc.publishTxProposal({txp: txp}, function(err) { fc.publishTxProposal({txp: txp}, function(err, txp) {
if (err) return cb(err); if (err) return cb(err);
else return cb(); else return cb(null, txp);
}); });
}; };