mirror of https://github.com/BTCPrivate/copay.git
This commit is contained in:
parent
392d8f7292
commit
410153a2da
|
@ -244,7 +244,6 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
||||||
}
|
}
|
||||||
|
|
||||||
walletService.signTx(wallet, publishedTxp, function(err, signedTxp) {
|
walletService.signTx(wallet, publishedTxp, function(err, signedTxp) {
|
||||||
walletService.lock(wallet);
|
|
||||||
if (err) {
|
if (err) {
|
||||||
$log.debug(err);
|
$log.debug(err);
|
||||||
walletService.removeTx(wallet, signedTxp, function(err) {
|
walletService.removeTx(wallet, signedTxp, function(err) {
|
||||||
|
|
|
@ -30,14 +30,6 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
||||||
];
|
];
|
||||||
$scope.selectedPriceSensitivity = $scope.priceSensitivity[1];
|
$scope.selectedPriceSensitivity = $scope.priceSensitivity[1];
|
||||||
|
|
||||||
var handleEncryptedWallet = function(client, cb) {
|
|
||||||
if (!walletService.isEncrypted(client)) return cb();
|
|
||||||
$rootScope.$emit('Local/NeedsPassword', false, function(err, password) {
|
|
||||||
if (err) return cb(err);
|
|
||||||
return cb(walletService.unlock(client, password));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
this.init = function(testnet) {
|
this.init = function(testnet) {
|
||||||
self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet', 1);
|
self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet', 1);
|
||||||
|
|
||||||
|
@ -263,66 +255,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
||||||
|
|
||||||
this.confirmTx = function(txp, cb) {
|
this.confirmTx = function(txp, cb) {
|
||||||
|
|
||||||
fingerprintService.check(client, function(err) {
|
// TODO see walletService createAndPublish
|
||||||
if (err) {
|
|
||||||
$log.debug(err);
|
|
||||||
return cb(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
handleEncryptedWallet(client, function(err) {
|
|
||||||
if (err) {
|
|
||||||
$log.debug(err);
|
|
||||||
return cb(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
ongoingProcess.set('Sending Bitcoin to Coinbase...', true);
|
|
||||||
walletService.publishTx(client, txp, function(err, publishedTxp) {
|
|
||||||
if (err) {
|
|
||||||
ongoingProcess.set('Sending Bitcoin to Coinbase...', false);
|
|
||||||
$log.debug(err);
|
|
||||||
return cb({
|
|
||||||
errors: [{
|
|
||||||
message: 'Transaction could not be published: ' + err.message
|
|
||||||
}]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
walletService.signTx(client, publishedTxp, function(err, signedTxp) {
|
|
||||||
walletService.lock(client);
|
|
||||||
if (err) {
|
|
||||||
ongoingProcess.set('Sending Bitcoin to Coinbase...', false);
|
|
||||||
$log.debug(err);
|
|
||||||
walletService.removeTx(client, signedTxp, function(err) {
|
|
||||||
if (err) $log.debug(err);
|
|
||||||
});
|
|
||||||
return cb({
|
|
||||||
errors: [{
|
|
||||||
message: 'The payment was created but could not be completed: ' + err.message
|
|
||||||
}]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
walletService.broadcastTx(client, signedTxp, function(err, broadcastedTxp) {
|
|
||||||
if (err) {
|
|
||||||
ongoingProcess.set('Sending Bitcoin to Coinbase...', false);
|
|
||||||
$log.debug(err);
|
|
||||||
walletService.removeTx(client, broadcastedTxp, function(err) {
|
|
||||||
if (err) $log.debug(err);
|
|
||||||
});
|
|
||||||
return cb({
|
|
||||||
errors: [{
|
|
||||||
message: 'The payment was created but could not be broadcasted: ' + err.message
|
|
||||||
}]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
$timeout(function() {
|
|
||||||
return cb(null, broadcastedTxp);
|
|
||||||
}, 5000);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue