From 7f20106d71178affd2029ef46fe7bb81869ebdb5 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 21 Apr 2014 11:28:25 -0300 Subject: [PATCH] fix callback in sent --- index.html | 6 +++++- js/controllers/addresses.js | 3 ++- js/models/blockchain/Insight.js | 12 +++--------- js/models/core/PublicKeyRing.js | 1 + js/models/core/TxProposals.js | 4 ++-- js/models/core/Wallet.js | 19 ++++++++++++++----- 6 files changed, 27 insertions(+), 18 deletions(-) diff --git a/index.html b/index.html index f9d0510eb..75226ba8f 100644 --- a/index.html +++ b/index.html @@ -215,7 +215,11 @@

Address

diff --git a/js/controllers/addresses.js b/js/controllers/addresses.js index d7955ef80..e8d2da812 100644 --- a/js/controllers/addresses.js +++ b/js/controllers/addresses.js @@ -9,9 +9,10 @@ angular.module('copay.addresses').controller('AddressesController', var w = $rootScope.wallet; var _updateBalance = function () { - w.getBalance(function (balance, balanceByAddr) { + w.getBalance(function (balance, balanceByAddr, isMain) { if (balanceByAddr && Object.keys(balanceByAddr).length) { $scope.balanceByAddr = balanceByAddr; + $scope.isMain = isMain; $scope.addrs = Object.keys(balanceByAddr); $scope.selectedAddr = $scope.addrs[0]; $scope.$digest(); diff --git a/js/models/blockchain/Insight.js b/js/models/blockchain/Insight.js index fb77b7d73..85c5e156b 100644 --- a/js/models/blockchain/Insight.js +++ b/js/models/blockchain/Insight.js @@ -100,15 +100,9 @@ Insight.prototype._request = function(options, callback) { if (request.readyState === 4) { console.log('[Insight.js.102]', request); //TODO if (request.status === 200) { - try { - return callback(null, JSON.parse(request.responseText)); - } catch (e) { - -console.log('[Insight.js.106]'); //TODO - return callback({message: 'Wrong response from insight'}); - } - } else { - + return callback(null, JSON.parse(request.responseText)); + } + else { console.log('[Insight.js.111]'); //TODO return callback({message: 'Error ' + request.status}); } diff --git a/js/models/core/PublicKeyRing.js b/js/models/core/PublicKeyRing.js index 32cd4d5c9..a2a26ce58 100644 --- a/js/models/core/PublicKeyRing.js +++ b/js/models/core/PublicKeyRing.js @@ -212,6 +212,7 @@ PublicKeyRing.prototype.getAddresses = function(onlyMain) { PublicKeyRing.prototype.getRedeemScriptMap = function () { var ret = {}; +console.log('[PublicKeyRing.js.216]', this.changeAddressIndex, this.addressIndex); //TODO for (var i=0; i