mirror of https://github.com/BTCPrivate/copay.git
Fix wording and function name
This commit is contained in:
parent
b799ed43b1
commit
4d23ae62c5
|
@ -107,23 +107,12 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $
|
|||
};
|
||||
};
|
||||
|
||||
root.getReductedAmountByFee = function(amount, cb) {
|
||||
// Fee Normal for a single transaction (450 bytes)
|
||||
var txNormalFeeKB = 450 / 1000;
|
||||
feeService.getFeeRate(null, 'normal', function(err, feePerKB) {
|
||||
if (err) return cb(err);
|
||||
var feeBTC = (feePerKB * txNormalFeeKB / 100000000).toFixed(8);
|
||||
|
||||
return cb(null, amount - feeBTC, feeBTC);
|
||||
});
|
||||
};
|
||||
|
||||
root.checkEnoughFundsForFee = function(amount, cb) {
|
||||
root.getReductedAmountByFee(amount, function(err, reductedAmount) {
|
||||
_getNetAmount(amount, function(err, reducedAmount) {
|
||||
if (err) return cb(err);
|
||||
|
||||
// Check if transaction has enough funds to transfer bitcoin from Coinbase to Copay
|
||||
if (reductedAmount < 0) {
|
||||
if (reducedAmount < 0) {
|
||||
return cb('Not enough funds for fee');
|
||||
}
|
||||
|
||||
|
@ -177,6 +166,17 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $
|
|||
});
|
||||
};
|
||||
|
||||
var _getNetAmount = function(amount, cb) {
|
||||
// Fee Normal for a single transaction (450 bytes)
|
||||
var txNormalFeeKB = 450 / 1000;
|
||||
feeService.getFeeRate(null, 'normal', function(err, feePerKB) {
|
||||
if (err) return cb(err);
|
||||
var feeBTC = (feePerKB * txNormalFeeKB / 100000000).toFixed(8);
|
||||
|
||||
return cb(null, amount - feeBTC, feeBTC);
|
||||
});
|
||||
};
|
||||
|
||||
var _refreshToken = function(refreshToken, cb) {
|
||||
var req = {
|
||||
method: 'POST',
|
||||
|
@ -681,7 +681,7 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $
|
|||
var _sendToWallet = function(tx, accessToken, accountId, coinbasePendingTransactions) {
|
||||
if (!tx) return;
|
||||
var desc = appConfigService.nameCase + ' Wallet';
|
||||
root.getReductedAmountByFee(tx.amount.amount, function(err, amountBTC, feeBTC) {
|
||||
_getNetAmount(tx.amount.amount, function(err, amountBTC, feeBTC) {
|
||||
if (err) {
|
||||
_savePendingTransaction(tx, {
|
||||
status: 'error',
|
||||
|
|
Loading…
Reference in New Issue