Hide ENS Transaction log

This commit is contained in:
Anthony Laibe 2018-08-23 09:23:51 +01:00
parent fa551f67a3
commit 607c2657c4
2 changed files with 21 additions and 11 deletions

View File

@ -8,7 +8,11 @@ class ConsoleListener {
this.addressToContract = []; this.addressToContract = [];
this.contractsConfig = embark.config.contractsConfig; this.contractsConfig = embark.config.contractsConfig;
this.contractsDeployed = false; this.contractsDeployed = false;
this.outputDone = false;
this._listenForLogRequests(); this._listenForLogRequests();
this.events.on('outputDone', () => {
this.outputDone = true;
});
this.events.on("contractsDeployed", () => { this.events.on("contractsDeployed", () => {
this.contractsDeployed = true; this.contractsDeployed = true;
@ -44,7 +48,8 @@ class ConsoleListener {
this.addressToContract[address] = { this.addressToContract[address] = {
name: contract.className, name: contract.className,
functions: funcSignatures functions: funcSignatures,
silent: contract.silent
}; };
} }
}); });
@ -58,14 +63,19 @@ class ConsoleListener {
if (!this.contractsDeployed) return; if (!this.contractsDeployed) return;
let {address, data, transactionHash, blockNumber, gasUsed, status} = request; let {address, data, transactionHash, blockNumber, gasUsed, status} = request;
if (!this.addressToContract[address]) { const contract = this.addressToContract[address];
if (!contract) {
this._updateContractList(); this._updateContractList();
return;
} }
if (!this.addressToContract[address]) return;
const {name, silent} = contract;
if (silent && !this.outputDone) {
return;
}
const name = this.addressToContract[address].name; const func = contract.functions[data.substring(0, 10)];
const func = this.addressToContract[address].functions[data.substring(0, 10)];
const functionName = func.functionName; const functionName = func.functionName;
const decodedParameters = utils.decodeParams(func.abi.inputs, data.substring(10)); const decodedParameters = utils.decodeParams(func.abi.inputs, data.substring(10));