Removing unused variables

This commit is contained in:
Richard Ramos 2018-06-08 17:22:53 -04:00
parent 0f853ba841
commit 09c11662aa
2 changed files with 34 additions and 30 deletions

View File

@ -14,7 +14,7 @@ exports.serve = function(ipc, host, port, ws){
ws: ws
});
proxy.on('error', function (err, req, res) {
proxy.on('error', function () {
proxy.close();
});
@ -37,7 +37,7 @@ exports.serve = function(ipc, host, port, ws){
ipc.request('log', commList[receipts[jsonO.id]]);
} else {
ipc.connecting = true;
ipc.connect((err) => {
ipc.connect(() => {
ipc.connecting = false;
});
}

View File

@ -41,36 +41,40 @@ class ConsoleListener {
}
listenForLogRequests(){
this.ipc.on('log', (request) => {
if(request.type == 'contract-log'){
try {
this.ipc.on('log', (request) => {
if(request.type == 'contract-log'){
let {address, data, transactionHash, blockNumber, gasUsed, status} = request;
if(!this.addressToContract[address]){
this._updateContractList();
let {address, data, transactionHash, blockNumber, gasUsed, status} = request;
if(!this.addressToContract[address]){
this._updateContractList();
}
let name = this.addressToContract[address].name;
let func = this.addressToContract[address].functions[data.substring(0, 10)];
let functionName = func.functionName;
let decodedParameters = utils.decodeParams(func.abi.inputs, data.substring(10));
let paramString = "";
if(func.abi.inputs){
func.abi.inputs.forEach((input) => {
let quote = input.type.indexOf("int") == -1 ? '"' : '';
paramString += quote + decodedParameters[input.name] + quote + ", ";
});
paramString = paramString.substring(0, paramString.length - 2);
}
gasUsed = utils.hexToNumber(gasUsed);
blockNumber = utils.hexToNumber(blockNumber);
this.logger.debug(`${name}.${functionName}(${paramString}) : ${transactionHash} | gas:${gasUsed} | blk:${blockNumber} | status:${status}`);
} else {
this.logger.debug(request);
}
let name = this.addressToContract[address].name;
let func = this.addressToContract[address].functions[data.substring(0, 10)];
let functionName = func.functionName;
let decodedParameters = utils.decodeParams(func.abi.inputs, data.substring(10));
let paramString = "";
if(func.abi.inputs){
func.abi.inputs.forEach((input) => {
let quote = input.type.indexOf("int") == -1 ? '"' : '';
paramString += quote + decodedParameters[input.name] + quote + ", ";
});
paramString = paramString.substring(0, paramString.length - 2);
}
gasUsed = utils.hexToNumber(gasUsed);
blockNumber = utils.hexToNumber(blockNumber);
this.logger.debug(`${name}.${functionName}(${paramString}) : ${transactionHash} | gas:${gasUsed} | blk:${blockNumber} | status:${status}`);
} else {
this.logger.debug(request);
}
});
});
} catch(e) {
//
}
}
}