add a new record for network fees
This commit is contained in:
parent
4fa62b0e4e
commit
c7caf71e93
1 changed files with 12 additions and 12 deletions
|
|
@ -608,8 +608,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
if (txs && txs.length > 0) {
|
if (txs && txs.length > 0) {
|
||||||
allTxs.push(txs);
|
allTxs.push(txs);
|
||||||
return getHistory(skip + 100, cb);
|
return getHistory(skip + 100, cb);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return cb(null, lodash.flatten(allTxs));
|
return cb(null, lodash.flatten(allTxs));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -637,7 +636,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
self.satToUnit = 1 / self.unitToSatoshi;
|
self.satToUnit = 1 / self.unitToSatoshi;
|
||||||
var data = txs;
|
var data = txs;
|
||||||
var satToBtc = 1 / 100000000;
|
var satToBtc = 1 / 100000000;
|
||||||
var filename = 'Copay-' + (self.alias || self.walletName ) + '.csv';
|
var filename = 'Copay-' + (self.alias || self.walletName) + '.csv';
|
||||||
var csvContent = '';
|
var csvContent = '';
|
||||||
if (!isNode) csvContent = 'data:text/csv;charset=utf-8,';
|
if (!isNode) csvContent = 'data:text/csv;charset=utf-8,';
|
||||||
csvContent += 'Date,Destination,Note,Amount,Currency,Spot Value,Total Value,Tax Type,Category\n';
|
csvContent += 'Date,Destination,Note,Amount,Currency,Spot Value,Total Value,Tax Type,Category\n';
|
||||||
|
|
@ -650,23 +649,24 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
if (it.action == 'moved')
|
if (it.action == 'moved')
|
||||||
amount = 0;
|
amount = 0;
|
||||||
|
|
||||||
if (it.action == 'sent' || it.action=='moved')
|
_amount = (it.action == 'sent' ? '-' : '') + (amount * satToBtc).toFixed(8);
|
||||||
amount += it.fees;
|
_note = formatString((it.message ? it.message : '') + ' TxId: ' + it.txid + ' Fee:' + (it.fees * satToBtc).toFixed(8));
|
||||||
|
|
||||||
_amount = (it.action == 'sent' ? '-' : '') + (amount * satToBtc).toFixed(8);
|
|
||||||
_note = formatString((it.message ? 'Note: ' + it.message + ' - ' : '') + 'TxId: ' + it.txid + ' Fee'+ (it.fees * satToBtc).toFixed(8)) ;
|
|
||||||
|
|
||||||
if (it.action == 'moved')
|
if (it.action == 'moved')
|
||||||
_note += ' Moved:' + (it.amount * satToBtc).toFixed(8)
|
_note += ' Moved:' + (it.amount * satToBtc).toFixed(8)
|
||||||
|
|
||||||
dataString = formatDate(it.time * 1000) + ',' + formatString(it.addressTo) + ',' + _note + ',' + _amount + ',BTC,,,,';
|
dataString = formatDate(it.time * 1000) + ',' + formatString(it.addressTo) + ',' + _note + ',' + _amount + ',BTC,,,,';
|
||||||
csvContent += index < data.length ? dataString + "\n" : dataString;
|
csvContent += dataString + "\n";
|
||||||
|
|
||||||
|
if (it.fees && (it.action == 'moved' || it.action == 'sent')) {
|
||||||
|
var _fee = (it.fees * satToBtc).toFixed(8)
|
||||||
|
csvContent += formatDate(it.time * 1000) + ',Bitcoin Network Fees,, -' + _fee + ',BTC,,,,' + "\n";
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isNode) {
|
if (isNode) {
|
||||||
saveFile('#export_file', csvContent);
|
saveFile('#export_file', csvContent);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
var encodedUri = encodeURI(csvContent);
|
var encodedUri = encodeURI(csvContent);
|
||||||
var link = document.createElement("a");
|
var link = document.createElement("a");
|
||||||
link.setAttribute("href", encodedUri);
|
link.setAttribute("href", encodedUri);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue