added rates to tx history
This commit is contained in:
parent
3eb45e529f
commit
bdec000af5
7 changed files with 24 additions and 19 deletions
|
|
@ -140,19 +140,18 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
|||
}
|
||||
|
||||
var items = res.items;
|
||||
var now = new Date();
|
||||
_.each(items, function(tx) {
|
||||
tx.ts = tx.minedTs || tx.sentTs;
|
||||
tx.rateTs = Math.floor((tx.ts || now) / 1000);
|
||||
});
|
||||
|
||||
var index = _.indexBy(res.items, function(tx) {
|
||||
return Math.floor(tx.ts / 1000);
|
||||
});
|
||||
var index = _.indexBy(items, 'rateTs');
|
||||
rateService.getHistoricRates(w.settings.alternativeIsoCode, _.keys(index), function(err, res) {
|
||||
console.log(res);
|
||||
if (!err && res) {
|
||||
_.each(res, function(r) {
|
||||
var tx = index[r.ts];
|
||||
tx.alternativeAmount = tx.amountSat * rateService.SAT_TO_BTC * r.rate;
|
||||
tx.alternativeAmount = r.rate != null ? tx.amountSat * rateService.SAT_TO_BTC * r.rate : null;
|
||||
});
|
||||
setTimeout(function() {
|
||||
$scope.$digest();
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('SettingsController', function($scope, $rootScope, $window, $route, $location, $anchorScroll, controllerUtils, notification) {
|
||||
|
||||
|
||||
controllerUtils.redirIfLogged();
|
||||
|
||||
$scope.title = 'Settings';
|
||||
|
|
@ -93,6 +91,9 @@ angular.module('copayApp.controllers').controller('SettingsController', function
|
|||
EncryptedInsightStorage: _.extend(config.EncryptedInsightStorage, {
|
||||
url: insightSettings.livenet.url + '/api/email'
|
||||
}),
|
||||
rates: _.extend(config.rates, {
|
||||
url: insightSettings.livenet.url + '/api/rates'
|
||||
}),
|
||||
}));
|
||||
|
||||
// Go home reloading the application
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue