From b1881719e06e8eb8296e29cf386aff13e5ce3f10 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Fri, 15 Mar 2019 16:22:24 -0400 Subject: [PATCH] Fix tests (CI) and debug button (#1443) * fix(embark/tests): fix tests by not tampering with the contract addr * fix(cockpit/debugButtong): use deployedAddress instead address --- packages/embark-ui/src/components/DebugButton.js | 4 ++-- .../src/lib/modules/blockchain_connector/index.js | 4 ++-- .../src/lib/modules/contracts_manager/index.js | 12 ------------ 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/packages/embark-ui/src/components/DebugButton.js b/packages/embark-ui/src/components/DebugButton.js index 7a45e482d..647d05e88 100644 --- a/packages/embark-ui/src/components/DebugButton.js +++ b/packages/embark-ui/src/components/DebugButton.js @@ -17,9 +17,9 @@ class DebugButton extends React.Component { this.props.contracts && this.props.contracts.find(contract => { const address = this.props.transaction.to || this.props.transaction.address; - return contract.address && + return contract.deployedAddress && address && - (contract.address.toLowerCase() === address.toLowerCase()); + (contract.deployedAddress.toLowerCase() === address.toLowerCase()); })); } diff --git a/packages/embark/src/lib/modules/blockchain_connector/index.js b/packages/embark/src/lib/modules/blockchain_connector/index.js index 2cc4db052..b6b4f6e02 100644 --- a/packages/embark/src/lib/modules/blockchain_connector/index.js +++ b/packages/embark/src/lib/modules/blockchain_connector/index.js @@ -771,11 +771,11 @@ class BlockchainConnector { this.contractsSubscriptions = []; this.events.request("contracts:list", (_err, contractsList) => { contractsList.forEach(contractObject => { - if (!contractObject.address){ + if (!contractObject.deployedAddress){ return; } - const contract = this.ContractObject({abi: contractObject.abiDefinition, address: contractObject.address}); + const contract = this.ContractObject({abi: contractObject.abiDefinition, address: contractObject.deployedAddress}); const eventEmitter = contract.events.allEvents(); this.contractsSubscriptions.push(eventEmitter); eventEmitter.on('data', (data) => { diff --git a/packages/embark/src/lib/modules/contracts_manager/index.js b/packages/embark/src/lib/modules/contracts_manager/index.js index 319bff119..a94dfbf09 100644 --- a/packages/embark/src/lib/modules/contracts_manager/index.js +++ b/packages/embark/src/lib/modules/contracts_manager/index.js @@ -61,18 +61,6 @@ class ContractsManager { }); self.events.on("deploy:contract:deployed", (_contract) => { - const contract = self.contracts[_contract.className]; - if (contract) { - if (!_contract.address && _contract.deployedAddress) { - _contract.address = _contract.deployedAddress; - } - if (!contract.address && _contract.address) { - contract.address = _contract.address; - } - if (!contract.deployedAddress && _contract.deployedAddress) { - contract.deployedAddress = _contract.deployedAddress; - } - } self.events.emit('contractsState', self.contractsState()); });