Merge pull request #732 from embark-framework/feature/hide-ens-transaction-log

Hide ENS Transaction log
This commit is contained in:
Iuri Matias 2018-08-23 14:57:36 -04:00 committed by GitHub
commit 26cde59fcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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));

View File

@ -291,12 +291,12 @@ class ENS {
"args": ["$ENSRegistry", rootNode], "args": ["$ENSRegistry", rootNode],
"onDeploy": [ "onDeploy": [
`ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send({from: web3.eth.defaultAccount}).then(() => { `ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send({from: web3.eth.defaultAccount}).then(() => {
ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send({from: web3.eth.defaultAccount}); ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send({from: web3.eth.defaultAccount});
var reverseNode = web3.utils.soliditySha3(web3.eth.defaultAccount.toLowerCase().substr(2) + '${reverseAddrSuffix}'); var reverseNode = web3.utils.soliditySha3(web3.eth.defaultAccount.toLowerCase().substr(2) + '${reverseAddrSuffix}');
ENSRegistry.methods.setResolver(reverseNode, "$Resolver").send({from: web3.eth.defaultAccount}); ENSRegistry.methods.setResolver(reverseNode, "$Resolver").send({from: web3.eth.defaultAccount});
Resolver.methods.setAddr('${rootNode}', web3.eth.defaultAccount).send({from: web3.eth.defaultAccount}); Resolver.methods.setAddr('${rootNode}', web3.eth.defaultAccount).send({from: web3.eth.defaultAccount});
Resolver.methods.setName(reverseNode, '${this.registration.rootDomain}').send({from: web3.eth.defaultAccount}); Resolver.methods.setName(reverseNode, '${this.registration.rootDomain}').send({from: web3.eth.defaultAccount});
})` })`
] ]
}; };
} }