import { Component, OnInit, ViewEncapsulation, AfterViewInit } from '@angular/core'; import { Helpers } from '../../../helpers'; import Web3 from 'web3'; import { ActivatedRoute, Router } from '@angular/router'; import { GlobalsComponent } from '../../pages/default/globals/globals.component'; declare let mLayout: any; @Component({ selector: 'app-aside-nav-user', templateUrl: './aside-nav-user.component.html', encapsulation: ViewEncapsulation.None }) export class AsideNavUserComponent implements OnInit, AfterViewInit { public dAppNameArray = []; public masterAbi; public masterAddresses = []; public web3; public userObj; public gbtSTAbi; public GBTMasterAbi; public GBTMasterAddress; public dAppArray = []; public masterDappMap = {}; public memberAddress; constructor(private router: Router) {} ngOnInit() { let user = localStorage.getItem('currentUser'); this.userObj = JSON.parse(user); this.web3 = new Web3(window['web3'].currentProvider); this.web3.eth.defaultAccount = this.web3.eth.coinbase; if (this.web3.eth.accounts[0] == undefined) { this.memberAddress = '0x0000000000000000000000000000000000000000'; } else { this.memberAddress = this.web3.eth.accounts[0]; } this.GBTMasterAbi = [ { constant: true, inputs: [], name: 'getGBTCAddress', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function' }, { constant: false, inputs: [ { name: '_GDAddress', type: 'address' }, { name: '_SVAddress', type: 'address' }, { name: '_GOVAddress', type: 'address' } ], name: 'changeAllAddress', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: true, inputs: [], name: 'getAllDappLength', outputs: [{ name: '', type: 'uint256' }], payable: false, stateMutability: 'view', type: 'function' }, { constant: false, inputs: [{ name: '_memberAddress', type: 'address' }], name: 'changeAuthorizedGB', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: true, inputs: [{ name: '_gbUserName', type: 'bytes32' }], name: 'getGovBlocksUserDetails', outputs: [ { name: 'GbUserName', type: 'bytes32' }, { name: 'masterContractAddress', type: 'address' }, { name: 'allContractsbyteCodeHash', type: 'string' }, { name: 'allCcontractsAbiHash', type: 'string' }, { name: 'versionNo', type: 'uint256' } ], payable: false, stateMutability: 'view', type: 'function' }, { constant: true, inputs: [], name: 'getGOVAddress', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function' }, { constant: false, inputs: [ { name: '_gbUserName', type: 'bytes32' }, { name: '_memberAddress', type: 'address' }, { name: '_memberRoleId', type: 'uint256' }, { name: '_typeOf', type: 'uint8' } ], name: 'updateMemberRoleGB', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: true, inputs: [{ name: '_gbUserName', type: 'bytes32' }], name: 'getDappDescHash', outputs: [{ name: '', type: 'string' }], payable: false, stateMutability: 'view', type: 'function' }, { constant: true, inputs: [{ name: '_gbUserName', type: 'bytes32' }], name: 'getDappMasterAddress', outputs: [{ name: 'masterAddress', type: 'address' }], payable: false, stateMutability: 'view', type: 'function' }, { constant: true, inputs: [{ name: '_memberAddress', type: 'address' }], name: 'isAuthorizedGBOwner', outputs: [{ name: 'auth', type: 'uint256' }], payable: false, stateMutability: 'view', type: 'function' }, { constant: false, inputs: [ { name: '_GBTControllerAddress', type: 'address' }, { name: '_GBTAddress', type: 'address' } ], name: 'GovBlocksMasterInit', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: true, inputs: [{ name: '_Address', type: 'address' }], name: 'getGovBlocksUserDetails2', outputs: [ { name: 'dappName', type: 'bytes32' }, { name: 'masterContractAddress', type: 'address' }, { name: 'dappTokenAddress', type: 'address' } ], payable: false, stateMutability: 'view', type: 'function' }, { constant: true, inputs: [], name: 'getDappUser', outputs: [{ name: '', type: 'string' }], payable: false, stateMutability: 'view', type: 'function' }, { constant: true, inputs: [{ name: '_gbUserName', type: 'bytes32' }], name: 'getDappTokenAddress', outputs: [{ name: 'tokenAddres', type: 'address' }], payable: false, stateMutability: 'view', type: 'function' }, { constant: false, inputs: [{ name: '_GBTConrollerAddress', type: 'address' }], name: 'updateGBTControllerAddress', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: false, inputs: [ { name: '_gbUserName', type: 'bytes32' }, { name: '_categoryId', type: 'uint256' }, { name: '_categoryData', type: 'string' } ], name: 'updateCategoryGB', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: false, inputs: [ { name: '_gbUserName', type: 'bytes32' }, { name: '_dappDescriptionHash', type: 'string' } ], name: 'changeDappDescHash', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: true, inputs: [], name: 'getGBTandGBTC', outputs: [ { name: '_GBTController', type: 'address' }, { name: '_GBToken', type: 'address' } ], payable: false, stateMutability: 'view', type: 'function' }, { constant: true, inputs: [], name: 'owner', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function' }, { constant: true, inputs: [{ name: '_gbUserName', type: 'bytes32' }], name: 'getGovBlocksUserDetails1', outputs: [ { name: 'GbUserName', type: 'bytes32' }, { name: 'masterContractAddress', type: 'address' }, { name: 'dappTokenAddress', type: 'address' }, { name: 'allContractsbyteCodeHash', type: 'string' }, { name: 'allCcontractsAbiHash', type: 'string' }, { name: 'versionNo', type: 'uint256' } ], payable: false, stateMutability: 'view', type: 'function' }, { constant: true, inputs: [], name: 'getSVAddress', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function' }, { constant: true, inputs: [], name: 'getAllDappArray', outputs: [{ name: '', type: 'bytes32[]' }], payable: false, stateMutability: 'view', type: 'function' }, { constant: false, inputs: [ { name: '_gbUserName', type: 'bytes32' }, { name: '_descHash', type: 'string' } ], name: 'addNewCategoryGB', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: true, inputs: [], name: 'authGBOwner', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function' }, { constant: false, inputs: [ { name: '_GBTControllerAddress', type: 'address' }, { name: '_GBTokenAddress', type: 'address' } ], name: 'changeAllAddress1', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: true, inputs: [{ name: '_index', type: 'uint256' }], name: 'getGovBlocksUserDetailsByIndex', outputs: [ { name: 'index', type: 'uint256' }, { name: 'GbUserName', type: 'bytes32' }, { name: 'MasterContractAddress', type: 'address' } ], payable: false, stateMutability: 'view', type: 'function' }, { constant: true, inputs: [], name: 'getGDAddress', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function' }, { constant: false, inputs: [ { name: '_gbUserName', type: 'bytes32' }, { name: '_typeOf', type: 'bytes16' }, { name: '_value', type: 'uint256' } ], name: 'configureGlobalParameters', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: false, inputs: [{ name: '_hash', type: 'string' }], name: 'setDappUser', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: false, inputs: [ { name: '_byteCodeHash', type: 'string' }, { name: '_abiHash', type: 'string' } ], name: 'setByteCodeAndAbi', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: false, inputs: [ { name: '_gbUserName', type: 'bytes32' }, { name: '_newMasterAddress', type: 'address' } ], name: 'changeDappMasterAddress', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: true, inputs: [], name: 'getGBTAddress', outputs: [{ name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function' }, { constant: false, inputs: [ { name: '_gbUserName', type: 'bytes32' }, { name: '_dappTokenAddress', type: 'address' } ], name: 'changeDappTokenAddress', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: false, inputs: [ { name: '_gbUserName', type: 'bytes32' }, { name: '_dappTokenAddress', type: 'address' }, { name: '_dappDescriptionHash', type: 'string' } ], name: 'addGovBlocksUser', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: true, inputs: [], name: 'getByteCodeAndAbi', outputs: [ { name: 'byteCode', type: 'string' }, { name: 'abiHash', type: 'string' } ], payable: false, stateMutability: 'view', type: 'function' }, { constant: false, inputs: [ { name: '_gbUserName', type: 'bytes32' }, { name: '_newRoleName', type: 'bytes32' }, { name: '_newDescHash', type: 'string' } ], name: 'addNewMemberRoleGB', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: false, inputs: [{ name: '_newOwner', type: 'address' }], name: 'transferOwnership', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: true, inputs: [{ name: '_contractAddress', type: 'address' }], name: 'getDappNameByAddress', outputs: [{ name: '', type: 'bytes32' }], payable: false, stateMutability: 'view', type: 'function' }, { constant: true, inputs: [{ name: '_gbIndex', type: 'uint256' }], name: 'getAllDappById', outputs: [{ name: '_gbUserName', type: 'bytes32' }], payable: false, stateMutability: 'view', type: 'function' }, { constant: false, inputs: [{ name: '_GBTContractAddress', type: 'address' }], name: 'updateGBTAddress', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' } ]; this.GBTMasterAddress = this.userObj.GBMasterAddress; // if(this.userObj.allAbis.length == 13) // { // this.getInitialAddress(); // } // else{ // var timeoutVar = setInterval(function() // { // let user=localStorage.getItem('currentUser'); // this.userObj=JSON.parse(user); // if(this.userObj.allAbis.length == 13) // { this.getInitialAddress(); // clearInterval(timeoutVar);} // }.bind(this) , 3000); // } var timeoutVar = setInterval( function() { if (GlobalsComponent.gbmaster) { this.getInitialAddress(); clearInterval(timeoutVar); } }.bind(this), 500 ); } getInitialAddress() { var data = { masterAddress: '', userName: this.userObj.userName, companyName: '', GBMasterAddress: this.userObj.GBMasterAddress, allAbis: this.userObj.allAbis, email: this.userObj.email, token: 'token', authorized: this.userObj.authorized }; localStorage.setItem('currentUser', JSON.stringify(data)); // this.masterAbi=[{"constant":true,"inputs":[],"name":"DappName","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"changeOtherAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"switchToRecentVersion","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getGBTCAddress","outputs":[{"name":"_GBTCAddress","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_memberaddress","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"version","type":"uint256"}],"name":"callConstructorGDMRPC","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenAddress","type":"address"}],"name":"changeGBTAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_ownerAddress","type":"address"}],"name":"isOwner","outputs":[{"name":"check","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"contracts_active","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_contractAddresses","type":"address[9]"}],"name":"addNewVersion","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"allContractVersions","outputs":[{"name":"name","type":"bytes32"},{"name":"contractAddress","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_controllerAddress","type":"address"}],"name":"changeGBTControllerAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_contractAdd","type":"address"}],"name":"isInternal","outputs":[{"name":"check","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"GBMAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_contractAddress","type":"address"}],"name":"changeGBMAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_gbUserName","type":"bytes32"},{"name":"_newMasterAddress","type":"address"}],"name":"changeMasterin_GBM","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_gbUserName","type":"bytes32"},{"name":"_newTokenAddress","type":"address"}],"name":"changeDappTokenAddressin_GBM","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_masterAddress","type":"address"}],"name":"changeMasterAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"versionLength","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getDappTokenAddress","outputs":[{"name":"dappTokenAddress","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_version","type":"uint256"}],"name":"changeAddressInMaster","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_versionNo","type":"uint256"}],"name":"getLatestVersionData","outputs":[{"name":"versionNo","type":"uint256"},{"name":"contractsName","type":"bytes32[]"},{"name":"contractsAddress","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_memberaddress","type":"address"}],"name":"isAuthGB","outputs":[{"name":"check","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_date","type":"uint256"},{"name":"_versionNo","type":"uint256"}],"name":"addInContractChangeDate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getGBTokenAddress","outputs":[{"name":"_GBTAddress","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getCurrentVersion","outputs":[{"name":"versionNo","type":"uint256"},{"name":"masterAddress","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_GovBlocksMasterAddress","type":"address"},{"name":"_gbUserName","type":"bytes32"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]; // this.gbtSTAbi=this.userObj.allAbis[11]; // this.masterAbi = this.userObj.allAbis[0]; var length; GlobalsComponent.gbmaster.getAlldAppRegistered( function(error, result1) { length = result1.length; var length1 = 0; var i = 0; var companyName; this.getGBuserDetails(length, result1, 0, 0); }.bind(this) ); } getGBuserDetails(length, result1, index, length1) { for (let i = 0; i < length; i++) { this.dAppNameArray.push(this.hex_to_ascii(result1[i])); GlobalsComponent.gbmaster.getdAppDetails( this.dAppNameArray[i], function(error, result) { length1++; this.versionNum = result[5].toNumber(); if (this.versionNum > 0) { this.companyMasterAddress = result[1]; var companyName = this.hex_to_ascii(result[0]); this.masterAddresses.push(this.companyMasterAddress); this.masterDappMap[companyName] = this.companyMasterAddress; // this.web3.eth.contract(this.gbtSTAbi).at(result[2],function(errGBTST,resGBTST){ // let ans2=resGBTST.balanceOf(this.web3.eth.accounts[0],function(errBal,resBal){ // var balance; if (!this.hex_to_ascii(result[0]).startsWith('TEST')) this.dAppArray.push(this.hex_to_ascii(result[0])); // if(resBal != 0) // { // this.dAppArray.push(this.hex_to_ascii(result[0])); // if(resBal.e<10){ // balance=Math.round(resBal*100)/100; // } // else { // balance=Math.round((resBal/1e+18)*100)/100; // } // } // }.bind(this)); // }.bind(this)); } }.bind(this) ); } } onClickDapp(i) { var masterAddress = this.masterDappMap[this.dAppArray[i]]; // this.masterAbi=[{"constant":true,"inputs":[],"name":"DappName","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"changeOtherAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"switchToRecentVersion","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getGBTCAddress","outputs":[{"name":"_GBTCAddress","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_memberaddress","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"version","type":"uint256"}],"name":"callConstructorGDMRPC","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenAddress","type":"address"}],"name":"changeGBTAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_ownerAddress","type":"address"}],"name":"isOwner","outputs":[{"name":"check","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"contracts_active","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_contractAddresses","type":"address[9]"}],"name":"addNewVersion","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"allContractVersions","outputs":[{"name":"name","type":"bytes32"},{"name":"contractAddress","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_controllerAddress","type":"address"}],"name":"changeGBTControllerAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_contractAdd","type":"address"}],"name":"isInternal","outputs":[{"name":"check","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"GBMAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_contractAddress","type":"address"}],"name":"changeGBMAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_gbUserName","type":"bytes32"},{"name":"_newMasterAddress","type":"address"}],"name":"changeMasterin_GBM","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_gbUserName","type":"bytes32"},{"name":"_newTokenAddress","type":"address"}],"name":"changeDappTokenAddressin_GBM","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_masterAddress","type":"address"}],"name":"changeMasterAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"versionLength","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getDappTokenAddress","outputs":[{"name":"dappTokenAddress","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_version","type":"uint256"}],"name":"changeAddressInMaster","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_versionNo","type":"uint256"}],"name":"getLatestVersionData","outputs":[{"name":"versionNo","type":"uint256"},{"name":"contractsName","type":"bytes32[]"},{"name":"contractsAddress","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_memberaddress","type":"address"}],"name":"isAuthGB","outputs":[{"name":"check","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_date","type":"uint256"},{"name":"_versionNo","type":"uint256"}],"name":"addInContractChangeDate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getGBTokenAddress","outputs":[{"name":"_GBTAddress","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getCurrentVersion","outputs":[{"name":"versionNo","type":"uint256"},{"name":"masterAddress","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_GovBlocksMasterAddress","type":"address"},{"name":"_gbUserName","type":"bytes32"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]; // this.masterAbi = this.userObj.allAbis[0]; // this.web3.eth.contract(this.masterAbi).at(masterAddress,function(errMaster,resMaster){ // let ans=resMaster.getCurrentVersion(function(error,result){ // var versionNum=result[0].toNumber(); GlobalsComponent.gbmaster.getdAppContractAddresses( this.dAppArray[i], function(error1, result1) { this.gdAddress = result1['GovernanceData']; var mrAddress = result1['MemberRoles']; // var memberRolesAbi=this.userObj.allAbis[2]; // this.web3.eth.contract(memberRolesAbi).at(mrAddress,function(errorGD,resultGD){ GlobalsComponent.gbmaster.isMemberAuthorized( this.dAppArray[i], this.memberAddress, function(errorMR, resultMR) { var authorized = true; if (!resultMR.authorized) { authorized = false; } var masterAddress = this.masterDappMap[this.dAppArray[i]]; let user = localStorage.getItem('currentUser'); var userObj = JSON.parse(user); var data = { masterAddress: masterAddress, userName: userObj.userName, companyName: this.dAppArray[i], GBMasterAddress: userObj.GBMasterAddress, allAbis: userObj.allAbis, email: userObj.email, token: 'token', authorized: authorized }; localStorage.setItem('currentUser', JSON.stringify(data)); this.router.navigate(['/index/' + this.dAppArray[i]]); }.bind(this) ); // }.bind(this)); }.bind(this) ); // }.bind(this)); // }.bind(this)); } hex_to_ascii(str1) { var hex = str1.toString(); var str = ''; for (var n = 0; n < hex.length; n += 2) { str += String.fromCharCode(parseInt(hex.substr(n, 2), 16)); } str1 = ''; for (var i = 0; i < str.length; i++) { if (str.charCodeAt(i) != 0) { str1 += str[i]; } } return str1; } ngAfterViewInit() { mLayout.initAside(); let menu = mLayout.getAsideMenu(); let item = $(menu) .find('a[href="' + window.location.pathname + '"]') .parent('.m-menu__item'); ($(menu).data('menu')).setActiveItem(item); } }