settings: fix references to unitToSatoshi

This commit is contained in:
Manuel Araoz 2014-09-04 11:12:08 -03:00
commit 7c582f4bd5
3 changed files with 8 additions and 5 deletions

View file

@ -4,6 +4,8 @@ var bitcore = require('bitcore');
angular.module('copayApp.controllers').controller('TransactionsController',
function($scope, $rootScope, $timeout, controllerUtils, notification) {
var w = $rootScope.wallet;
$scope.title = 'Transactions';
$scope.loading = false;
$scope.lastShowed = false;
@ -12,7 +14,7 @@ angular.module('copayApp.controllers').controller('TransactionsController',
$scope.txpItemsPerPage = 4;
$scope.blockchain_txs = [];
var satToUnit = 1 / config.unitToSatoshi;
var satToUnit = 1 / w.settings.unitToSatoshi;
$scope.update = function() {
$scope.loading = true;

View file

@ -47,13 +47,14 @@ angular.module('copayApp.directives')
.directive('enoughAmount', ['$rootScope',
function($rootScope) {
var bitcore = require('bitcore');
var w = $rootScope.wallet;
var feeSat = Number(bitcore.TransactionBuilder.FEE_PER_1000B_SAT);
return {
require: 'ngModel',
link: function(scope, element, attrs, ctrl) {
var val = function(value) {
var availableBalanceNum = Number(($rootScope.availableBalance * config.unitToSatoshi).toFixed(0));
var vNum = Number((value * config.unitToSatoshi).toFixed(0));
var availableBalanceNum = Number(($rootScope.availableBalance * w.settings.unitToSatoshi).toFixed(0));
var vNum = Number((value * w.settings.unitToSatoshi).toFixed(0));
if (typeof vNum == "number" && vNum > 0) {
vNum = vNum + feeSat;

View file

@ -175,7 +175,7 @@ angular.module('copayApp.services')
w.getBalance(function(err, balanceSat, balanceByAddrSat, safeBalanceSat) {
if (err) throw err;
var satToUnit = 1 / config.unitToSatoshi;
var satToUnit = 1 / w.settings.unitToSatoshi;
var COIN = bitcore.util.COIN;
$rootScope.totalBalance = balanceSat * satToUnit;
@ -210,7 +210,7 @@ angular.module('copayApp.services')
if (!w) return;
opts = opts || $rootScope.txsOpts || {};
var satToUnit = 1 / config.unitToSatoshi;
var satToUnit = 1 / w.settings.unitToSatoshi;
var myCopayerId = w.getMyCopayerId();
var pendingForUs = 0;
var inT = w.getTxProposals().sort(function(t1, t2) {