<commit_before>function WalletController($scope, $http, $q) {

  $scope.footer = "FOOTER";
  $scope.title = "TITLE";
  
  $scope.addressArray = [];
  $scope.uuid = '';
  $scope.wallet = Wallet.GetWallet();

  $scope.DeleteAddress = function(addrIdx) {
  var newAddressArray = Wallet.DeleteIndex($scope.uuid, addrIdx);
  $scope.addressArray.splice(addrIdx,1);
  }
  
  $scope.CreateNewWallet = function() {
  Wallet.CreateNewWallet();
  }
  
  $scope.AddPrivKey = function() {
   Wallet.AddPrivKey();
  }
  $scope.getWalletData = function () {
  
  var myURLParams = BTCUtils.getQueryStringArgs();
  var uuid = myURLParams['uuid'];
  $scope.uuid = uuid;

    $scope.getAddress = function (addr, callback) {
      return $http.get("addr/" + addr + ".json").success(
        function (value) {
          return callback(value.data);
        }
      ).error( 
        function( value ) {
          return callback( '{ "0": {} }' );
        }
      );
    }

    $scope.getAddresses = function (callback) {

      var wallet = Wallet.GetWallet();

      var addresses = wallet.addresses;
      $scope.uuid = wallet.uuid;

      var prom = [];
      addresses.forEach(function (obj, i) {
          var addr = obj;

          prom.push($scope.getAddress(addr, function (value) {
            
          }));
      });

      $q.all(prom).then(function (data) {
          callback(data);
      });
    };

    //Get currencies
    $http.get('currencies.json', {}).success(function (data, status, headers, config) {
      //console.log('currencies');
      //console.log(data);

      $scope.currencies = data;

    }).then(function () {
      console.log( 'About to call getAddresses!' );
      //console.log('finished');

      $scope.getAddresses(function (data) {
        console.log( 'Addresses data: ' );
        console.log( data );

          data.forEach(function (obj, i) {

            //Sort currencies as in the table and show only needed
          
            var dataBalance = [];

            
            for (var i = 0; i < $scope.currencies.length; i++) {
              //For each currency in the currencies find the balance and add it to the array
              var currency = $scope.currencies[i].symbol;
            //    console.log(currency);

              var item = Wallet.FindItemInArray(obj.data.balance, currency);<commit_msg>Added error handling to the wallet address gets, so that we can carry on if any of the addresses are missing from the blockchain.<commit_after>function WalletController($scope, $http, $q) {

  $scope.footer = "FOOTER";
  $scope.title = "TITLE";
  
  $scope.addressArray = [];
  $scope.uuid = '';
  $scope.wallet = Wallet.GetWallet();

  $scope.DeleteAddress = function(addrIdx) {
  var newAddressArray = Wallet.DeleteIndex($scope.uuid, addrIdx);
  $scope.addressArray.splice(addrIdx,1);
  }
  
  $scope.CreateNewWallet = function() {
  Wallet.CreateNewWallet();
  }
  
  $scope.AddPrivKey = function() {
   Wallet.AddPrivKey();
  }
  $scope.getWalletData = function () {
  
  var myURLParams = BTCUtils.getQueryStringArgs();
  var uuid = myURLParams['uuid'];
  $scope.uuid = uuid;

    $scope.getAddress = function (addr, callback) {
      return returnval = $http.get("addr/" + addr + ".json").then(
        function (value) {
		return value.data;
        },
        function( value ) {
		// If the address can't be found in the blockchain, just make an empty dummy object.
		return {
			'0': {
				'address': addr
			}
		};
        }
      );
	return returnval;
    }

    $scope.getAddresses = function (callback) {

      var wallet = Wallet.GetWallet();

      var addresses = wallet.addresses;
      $scope.uuid = wallet.uuid;

      var prom = [];
      addresses.forEach(function (obj, i) {
          var addr = obj;

          prom.push($scope.getAddress(addr, function (value) {
          }));
      });

      $q.all(prom).then(
	function (data) {
          callback(data);
	},
	function( data ) {
	  callback( data );
	});
    };

    //Get currencies
    $http.get('currencies.json', {}).success(function (data, status, headers, config) {
      //console.log('currencies');
      //console.log(data);

      $scope.currencies = data;

    }).then(function () {
      //console.log('finished');

      $scope.getAddresses(function (data) {

          data.forEach(function (obj, i) {

            //Sort currencies as in the table and show only needed
          
            var dataBalance = [];

            
            for (var i = 0; i < $scope.currencies.length; i++) {
              //For each currency in the currencies find the balance and add it to the array
              var currency = $scope.currencies[i].symbol;
            //    console.log(currency);

              var item = Wallet.FindItemInArray(obj.data.balance, currency);
{'fraction_non_alphanumeric': 0.14279766860949208, 'fraction_numerical': 0.0012489592006661116, 'mean_word_length': 2.266485384092454, 'pattern_counts': {'":': 1, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6666798', 'n_tokens_mistral': 1503, 'n_tokens_neox': 1446, 'n_words': 333}