From 607c2657c4d3cab61cfa9237c0a4a7aea491aab5 Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Thu, 23 Aug 2018 09:23:51 +0100 Subject: [PATCH] Hide ENS Transaction log --- lib/modules/console_listener/index.js | 20 +++++++++++++++----- lib/modules/ens/index.js | 12 ++++++------ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/lib/modules/console_listener/index.js b/lib/modules/console_listener/index.js index 7d5082a6..6a6e557e 100644 --- a/lib/modules/console_listener/index.js +++ b/lib/modules/console_listener/index.js @@ -8,7 +8,11 @@ class ConsoleListener { this.addressToContract = []; this.contractsConfig = embark.config.contractsConfig; this.contractsDeployed = false; + this.outputDone = false; this._listenForLogRequests(); + this.events.on('outputDone', () => { + this.outputDone = true; + }); this.events.on("contractsDeployed", () => { this.contractsDeployed = true; @@ -44,7 +48,8 @@ class ConsoleListener { this.addressToContract[address] = { name: contract.className, - functions: funcSignatures + functions: funcSignatures, + silent: contract.silent }; } }); @@ -58,14 +63,19 @@ class ConsoleListener { if (!this.contractsDeployed) return; let {address, data, transactionHash, blockNumber, gasUsed, status} = request; - if (!this.addressToContract[address]) { + const contract = this.addressToContract[address]; + + if (!contract) { 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 = this.addressToContract[address].functions[data.substring(0, 10)]; + const func = contract.functions[data.substring(0, 10)]; const functionName = func.functionName; const decodedParameters = utils.decodeParams(func.abi.inputs, data.substring(10)); diff --git a/lib/modules/ens/index.js b/lib/modules/ens/index.js index 4d0bf70b..5f807a4b 100644 --- a/lib/modules/ens/index.js +++ b/lib/modules/ens/index.js @@ -291,12 +291,12 @@ class ENS { "args": ["$ENSRegistry", rootNode], "onDeploy": [ `ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send({from: web3.eth.defaultAccount}).then(() => { - ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send({from: web3.eth.defaultAccount}); - var reverseNode = web3.utils.soliditySha3(web3.eth.defaultAccount.toLowerCase().substr(2) + '${reverseAddrSuffix}'); - ENSRegistry.methods.setResolver(reverseNode, "$Resolver").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}); - })` + ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send({from: web3.eth.defaultAccount}); + var reverseNode = web3.utils.soliditySha3(web3.eth.defaultAccount.toLowerCase().substr(2) + '${reverseAddrSuffix}'); + ENSRegistry.methods.setResolver(reverseNode, "$Resolver").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}); + })` ] }; }