<commit_before>angular.module("omniControllers")
	.controller("DExSaleController", ["$scope", "PropertyManager", "Account", "Transaction", "MIN_MINER_FEE", "OMNI_PROTOCOL_COST", "ModalManager",
		function DExSaleController($scope,PropertyManager,Account,Transaction,MIN_MINER_FEE,PROTOCOL_FEE,ModalManager ){

			$scope.editTransactionCost = function(){
				$scope.modalManager.openTransactionCostModal($scope, function(){return;});
			}

			$scope.feeType = 'normal';
			$scope.protocolFee = PROTOCOL_FEE;
			$scope.setAddress = function(address){
				$scope.selectedAddress = address;
				$scope.setAsset($scope.wallet.getAsset($scope.selectedAddress.assets[0].id));
				$scope.selectedAddress.estimateFee().then(function(result){
					$scope.feeData=result;
					if($scope.feeType != 'custom'){
						$scope.minersFee = new Big(result.class_c[$scope.feeType]);
					}
				});
			};

			$scope.setAsset = function(asset){
				$scope.sellingAsset = asset;
				let nextEco = (asset.id < 2147483648 && asset.id != 2) ? 1 : 2;
				if($scope.ecosystem != nextEco){
					$scope.ecosystem = nextEco;
					$scope.loadCurrencies();	
				}
			}

			$scope.setDesiredAsset = function(asset){
				$scope.desiredAsset = asset;
			}

			$scope.loadCurrencies = function(){
				PropertyManager.listByEcosystem($scope.ecosystem).then(function(result){
			      $scope.availableTokens = result.data.properties.sort(function(a, b) {
			          var currencyA = a.name.toUpperCase();
			          var currencyB = b.name.toUpperCase();
			          return (currencyA < currencyB) ? -1 : (currencyA > currencyB) ? 1 : 0;
			      });
			      $scope.desiredAsset = $scope.availableTokens[0];
			  	});
			}

			$scope.validateDexSaleForm = function(){
				// TODO: Validations
				var fee = Account.settings.minerFee || $scope.minersFee;
				var dexOffer = new Transaction(25,$scope.selectedAddress,fee,{
						transaction_version:0,
						propertyidforsale:$scope.sellingAsset.id,
						amountforsale: new Big($scope.sellingAmount).valueOf(),
						propertiddesired:$scope.desiredAsset.propertyid,
						amountdesired: new Big($scope.desiredAmount).valueOf()
					});
				let redirectUrl = "/dex/overview";
				ModalManager.openConfirmationModal({
					dataTemplate: '/views/modals/partials/dex_offer.html',
					scope: {
						title:"Confirm DEx Transaction",
						address:$scope.selectedAddress,
						saleCurrency:$scope.sellingAsset.id,
						saleAmount:$scope.sellingAmount,
						desiredCurrency:$scope.desiredAsset.propertyid,
						desiredAmount:$scope.desiredAmount,
						totalCost:dexOffer.totalCost,
						confirmText: "Create Transaction",
						successMessage: "Your order was placed successfully",
						successRedirect:redirectUrl
					},
					transaction:dexOffer
				});

			};

			$scope.setAddress($scope.wallet.omniTradableAddresses()[0])
			$scope.showtesteco = $scope.account.getSetting('showtesteco');
		}])
<commit_msg>remove use of new js let<commit_after>angular.module("omniControllers")
	.controller("DExSaleController", ["$scope", "PropertyManager", "Account", "Transaction", "MIN_MINER_FEE", "OMNI_PROTOCOL_COST", "ModalManager",
		function DExSaleController($scope,PropertyManager,Account,Transaction,MIN_MINER_FEE,PROTOCOL_FEE,ModalManager ){

			$scope.editTransactionCost = function(){
				$scope.modalManager.openTransactionCostModal($scope, function(){return;});
			}

			$scope.feeType = 'normal';
			$scope.protocolFee = PROTOCOL_FEE;
			$scope.setAddress = function(address){
				$scope.selectedAddress = address;
				$scope.setAsset($scope.wallet.getAsset($scope.selectedAddress.assets[0].id));
				$scope.selectedAddress.estimateFee().then(function(result){
					$scope.feeData=result;
					if($scope.feeType != 'custom'){
						$scope.minersFee = new Big(result.class_c[$scope.feeType]);
					}
				});
			};

			$scope.setAsset = function(asset){
				$scope.sellingAsset = asset;
				nextEco = (asset.id < 2147483648 && asset.id != 2) ? 1 : 2;
				if($scope.ecosystem != nextEco){
					$scope.ecosystem = nextEco;
					$scope.loadCurrencies();	
				}
			}

			$scope.setDesiredAsset = function(asset){
				$scope.desiredAsset = asset;
			}

			$scope.loadCurrencies = function(){
				PropertyManager.listByEcosystem($scope.ecosystem).then(function(result){
			      $scope.availableTokens = result.data.properties.sort(function(a, b) {
			          var currencyA = a.name.toUpperCase();
			          var currencyB = b.name.toUpperCase();
			          return (currencyA < currencyB) ? -1 : (currencyA > currencyB) ? 1 : 0;
			      });
			      $scope.desiredAsset = $scope.availableTokens[0];
			  	});
			}

			$scope.validateDexSaleForm = function(){
				// TODO: Validations
				var fee = Account.settings.minerFee || $scope.minersFee;
				var dexOffer = new Transaction(25,$scope.selectedAddress,fee,{
						transaction_version:0,
						propertyidforsale:$scope.sellingAsset.id,
						amountforsale: new Big($scope.sellingAmount).valueOf(),
						propertiddesired:$scope.desiredAsset.propertyid,
						amountdesired: new Big($scope.desiredAmount).valueOf()
					});
				redirectUrl = "/dex/overview";
				ModalManager.openConfirmationModal({
					dataTemplate: '/views/modals/partials/dex_offer.html',
					scope: {
						title:"Confirm DEx Transaction",
						address:$scope.selectedAddress,
						saleCurrency:$scope.sellingAsset.id,
						saleAmount:$scope.sellingAmount,
						desiredCurrency:$scope.desiredAsset.propertyid,
						desiredAmount:$scope.desiredAmount,
						totalCost:dexOffer.totalCost,
						confirmText: "Create Transaction",
						successMessage: "Your order was placed successfully",
						successRedirect:redirectUrl
					},
					transaction:dexOffer
				});

			};

			$scope.setAddress($scope.wallet.omniTradableAddresses()[0])
			$scope.showtesteco = $scope.account.getSetting('showtesteco');
		}])

{'fraction_non_alphanumeric': 0.13927291346646187, 'fraction_numerical': 0.007509813961426865, 'mean_word_length': 3.771986970684039, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '2753201', 'n_tokens_mistral': 2328, 'n_tokens_neox': 1819, 'n_words': 253}