mirror of https://github.com/BTCPrivate/copay.git
parent
85716f72f3
commit
8ffb01a355
|
@ -42,7 +42,7 @@
|
|||
"url": "https://github.com/bitpay/copay/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"bitcore-wallet-client": "2.2.2",
|
||||
"bitcore-wallet-client": "2.3.0",
|
||||
"express": "^4.11.2",
|
||||
"fs": "0.0.2",
|
||||
"grunt": "^0.4.5",
|
||||
|
|
|
@ -24,6 +24,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
ret.isMobile = isMobile.any();
|
||||
ret.isWindowsPhoneApp = isMobile.Windows() && isCordova;
|
||||
ret.countDown = null;
|
||||
ret.sendMaxInfo = {};
|
||||
var vanillaScope = ret;
|
||||
|
||||
var disableScannerListener = $rootScope.$on('dataScanned', function(event, data) {
|
||||
|
@ -909,14 +910,21 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
'message': comment
|
||||
});
|
||||
|
||||
var opts = {
|
||||
toAddress: address,
|
||||
amount: amount,
|
||||
outputs: outputs,
|
||||
message: comment,
|
||||
payProUrl: paypro ? paypro.url : null,
|
||||
lockedCurrentFeePerKb: self.lockedCurrentFeePerKb
|
||||
};
|
||||
var opts = {};
|
||||
|
||||
if (self.sendMaxInfo) {
|
||||
opts.sendMax = true;
|
||||
opts.inputs = self.sendMaxInfo.inputs;
|
||||
opts.fee = self.sendMaxInfo.fee;
|
||||
}else {
|
||||
opts.amount = amount;
|
||||
}
|
||||
|
||||
opts.toAddress = address;
|
||||
opts.outputs = outputs;
|
||||
opts.message = comment;
|
||||
opts.payProUrl = paypro ? paypro.url : null;
|
||||
opts.lockedCurrentFeePerKb = self.lockedCurrentFeePerKb;
|
||||
|
||||
self.setOngoingProcess(gettextCatalog.getString('Creating transaction'));
|
||||
txService.createTx(opts, function(err, txp) {
|
||||
|
@ -1004,6 +1012,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
|
||||
this.resetForm = function() {
|
||||
this.resetError();
|
||||
this.sendMaxInfo = {};
|
||||
if (this.countDown) $interval.cancel(this.countDown);
|
||||
this._paypro = null;
|
||||
this.lockedCurrentFeePerKb = null;
|
||||
|
@ -1246,10 +1255,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
return actions.hasOwnProperty('create');
|
||||
};
|
||||
|
||||
this._doSendMax = function(amount) {
|
||||
this.setForm(null, amount, null);
|
||||
};
|
||||
|
||||
this.sendMax = function(availableBalanceSat) {
|
||||
if (availableBalanceSat == 0) {
|
||||
this.error = gettext("Cannot create transaction. Insufficient funds");
|
||||
|
@ -1300,7 +1305,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
|
||||
confirmDialog.show(msg, function(confirmed) {
|
||||
if (confirmed) {
|
||||
self._doSendMax(parseFloat((resp.amount * self.satToUnit).toFixed(self.unitDecimals)));
|
||||
self.sendMaxInfo = resp;
|
||||
var amount = parseFloat((resp.amount * self.satToUnit).toFixed(self.unitDecimals));
|
||||
self.setForm(null, amount, null);
|
||||
} else {
|
||||
self.resetForm();
|
||||
}
|
||||
|
|
|
@ -115,16 +115,23 @@ angular.module('copayApp.services').factory('txService', function($rootScope, pr
|
|||
}
|
||||
};
|
||||
|
||||
getFee(function(err, feePerKb) {
|
||||
if (err) return cb(err);
|
||||
|
||||
opts.feePerKb = feePerKb;
|
||||
opts.excludeUnconfirmedUtxos = currentSpendUnconfirmed ? false : true;
|
||||
if (opts.sendMax) {
|
||||
fc.createTxProposal(opts, function(err, txp) {
|
||||
if (err) return cb(err);
|
||||
else return cb(null, txp);
|
||||
});
|
||||
});
|
||||
}else {
|
||||
getFee(function(err, feePerKb) {
|
||||
if (err) return cb(err);
|
||||
|
||||
opts.feePerKb = feePerKb;
|
||||
opts.excludeUnconfirmedUtxos = currentSpendUnconfirmed ? false : true;
|
||||
fc.createTxProposal(opts, function(err, txp) {
|
||||
if (err) return cb(err);
|
||||
else return cb(null, txp);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
root.publishTx = function(txp, opts, cb) {
|
||||
|
|
Loading…
Reference in New Issue