<commit_before>/**
 * @fileOverview HistoryCtrl angular controller
 */
'use strict';

define(['./module', 'arcbit', 'frontend/port', 'model/TLWalletUtils'],
    function (controllers, ArcBit, Port, TLWalletUtils) {
        controllers.controller('HistoryCtrl', ['$scope', '$window', 'sounds', '$history', '$tabs', '$location', '$routeParams', '$route', 'modals', 'notify', '_Filter',
            function($scope, $window, sounds, $history, $tabs, $location, $routeParams, $route, modals, notify, _) {

                // Scope variables
                $scope.pocket = $history.getCurrentPocket();
                $scope.selectedPocket = $history.selectedPocket;

                // pages
                $scope.nPages = 0;
                $scope.page = 0;
                var limit = 10;

                $tabs.updateTabs();

                $scope.showTxInWeb = function(txid) {
                    var identity = ArcBit.getIdentity();
                    var idx = identity.appDelegate.preferences.getSelectedBlockExplorerURLIdx();
                    var api = identity.appDelegate.preferences.getSelectedBlockExplorerAPI();
                    $window.open(identity.appDelegate.preferences.getSelectedBlockExplorerURL(api, idx)+"tx/"+txid, '_blank');
                };

                $scope.deleteTag = function(hash) {
                    var identity = ArcBit.getIdentity();
                    identity.appDelegate.appWallet.deleteTransactionTag(hash);
                    $scope.currentRow.description = null;
                };

                $scope.setPage = function(page, updatePage) {
                    if (page >= $scope.nPages) {
                        page = $scope.nPages-1;
                    }
                    if (page < 0) {
                        page = 0;
                    }
                    if (updatePage) {
                        $scope.page = page;
                    }
                    $scope.historyRows = $scope.allHistoryRows.slice($scope.page*limit, ($scope.page*limit) + limit);
                };

                var setHistoryRowsHDAccount = function(accountObject) {
                    var identity = ArcBit.getIdentity();
                    for(var i = 0; i < accountObject.getTxObjectCount(); i++) {
                        var txObject = accountObject.getTxObject(i);
                        var hash = txObject.getHash();
                        var description = identity.appDelegate.appWallet.getTransactionTag(hash);
                        var amountType = accountObject.getAccountAmountChangeTypeForTx(hash);

                        if (amountType == TLWalletUtils.TLAccountTxType.SEND) {
                            var outputAddressToValueArray = txObject.getOutputAddressToValueArray();
                            for (var j = 0; j < outputAddressToValueArray.length; j++) {
                                var dict = outputAddressToValueArray[j];
                                var address = dict["addr"];
                                if (address != null) {
                                    if (accountObject.isAddressPartOfAccount(address)) {
                                        address = address;
                                    } else {
                                        address = address;
                                        break;
                                    }
                                }
                            }
                        } else if (amountType == TLWalletUtils.TLAccountTxType.RECEIVE) {
                            var inputAddressToValueArray = txObject.getInputAddressToValueArray();
                            for (var j = 0; j < inputAddressToValueArray.length; j++) {
                                var dict = inputAddressToValueArray[j];
                                var address = dict["addr"];
                                if (address != null) {
                                    if (accountObject.isAddressPartOfAccount(address)) {
                                        address = address;
                                    } else {
                                        address = address;
                                        break;
                                    }
                                }
                            }
                        } else {
                            address = _("Intra account transfer");
                        }

                        var amountString = accountObject.getAccountAmountChangeForTx(hash);

                        var timeText;
                        var conf = txObject.getConfirmations();
                        if (conf == 0 || conf == Number.MAX_SAFE_INTEGER) {
                            timeText = _('Unconfirmed');
                        } else if (conf > 6) {
                            timeText = txObject.getTime();
                        } else if (conf == 1) {
                            timeText = _('1 confirmation');
                        } else {
                            timeText = _('{0} confirmations', conf);
                        }

                        $scope.allHistoryRows.push({
                            hash: hash,
                            timeText: timeText,
                            amount: amountString,
                            balanceAsOfTx: accountObject.getBalanceAsOfTx(hash),
                            amountType: amountType,
                            address: address,
                            description: description
                        });
                    }
                }

                var setHistoryRowsAddress = function(importedAddress) {<commit_msg>do not display the received from address<commit_after>/**
 * @fileOverview HistoryCtrl angular controller
 */
'use strict';

define(['./module', 'arcbit', 'frontend/port', 'model/TLWalletUtils'],
    function (controllers, ArcBit, Port, TLWalletUtils) {
        controllers.controller('HistoryCtrl', ['$scope', '$window', 'sounds', '$history', '$tabs', '$location', '$routeParams', '$route', 'modals', 'notify', '_Filter',
            function($scope, $window, sounds, $history, $tabs, $location, $routeParams, $route, modals, notify, _) {

                // Scope variables
                $scope.pocket = $history.getCurrentPocket();
                $scope.selectedPocket = $history.selectedPocket;

                // pages
                $scope.nPages = 0;
                $scope.page = 0;
                var limit = 10;

                $tabs.updateTabs();

                $scope.showTxInWeb = function(txid) {
                    var identity = ArcBit.getIdentity();
                    var idx = identity.appDelegate.preferences.getSelectedBlockExplorerURLIdx();
                    var api = identity.appDelegate.preferences.getSelectedBlockExplorerAPI();
                    $window.open(identity.appDelegate.preferences.getSelectedBlockExplorerURL(api, idx)+"tx/"+txid, '_blank');
                };

                $scope.deleteTag = function(hash) {
                    var identity = ArcBit.getIdentity();
                    identity.appDelegate.appWallet.deleteTransactionTag(hash);
                    $scope.currentRow.description = null;
                };

                $scope.setPage = function(page, updatePage) {
                    if (page >= $scope.nPages) {
                        page = $scope.nPages-1;
                    }
                    if (page < 0) {
                        page = 0;
                    }
                    if (updatePage) {
                        $scope.page = page;
                    }
                    $scope.historyRows = $scope.allHistoryRows.slice($scope.page*limit, ($scope.page*limit) + limit);
                };

                var setHistoryRowsHDAccount = function(accountObject) {
                    var identity = ArcBit.getIdentity();
                    for(var i = 0; i < accountObject.getTxObjectCount(); i++) {
                        var txObject = accountObject.getTxObject(i);
                        var hash = txObject.getHash();
                        var description = identity.appDelegate.appWallet.getTransactionTag(hash);
                        var amountType = accountObject.getAccountAmountChangeTypeForTx(hash);

                        if (amountType == TLWalletUtils.TLAccountTxType.SEND) {
                            var outputAddressToValueArray = txObject.getOutputAddressToValueArray();
                            for (var j = 0; j < outputAddressToValueArray.length; j++) {
                                var dict = outputAddressToValueArray[j];
                                var address = dict["addr"];
                                if (address != null) {
                                    if (accountObject.isAddressPartOfAccount(address)) {
                                        address = address;
                                    } else {
                                        address = address;
                                        break;
                                    }
                                }
                            }
                        } else if (amountType == TLWalletUtils.TLAccountTxType.RECEIVE) {
                            address = "";
                        } else {
                            address = _("Intra account transfer");
                        }

                        var amountString = accountObject.getAccountAmountChangeForTx(hash);

                        var timeText;
                        var conf = txObject.getConfirmations();
                        if (conf == 0 || conf == Number.MAX_SAFE_INTEGER) {
                            timeText = _('Unconfirmed');
                        } else if (conf > 6) {
                            timeText = txObject.getTime();
                        } else if (conf == 1) {
                            timeText = _('1 confirmation');
                        } else {
                            timeText = _('{0} confirmations', conf);
                        }

                        $scope.allHistoryRows.push({
                            hash: hash,
                            timeText: timeText,
                            amount: amountString,
                            balanceAsOfTx: accountObject.getBalanceAsOfTx(hash),
                            amountType: amountType,
                            address: address,
                            description: description
                        });
                    }
                }

                var setHistoryRowsAddress = function(importedAddress) {
{'fraction_non_alphanumeric': 0.09235967711657593, 'fraction_numerical': 0.002721982354045429, 'mean_word_length': 1.0729571984435797, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6256355', 'n_tokens_mistral': 2412, 'n_tokens_neox': 2245, 'n_words': 454}