From dc6294ad84d153f73d9c9d9de084b04a7951a465 Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Tue, 30 Oct 2018 20:51:23 +0100 Subject: [PATCH] Do no show interface on injected web3 --- .../src/components/ContractsDeployment.js | 20 +++++++++---------- .../containers/TextEditorAsideContainer.js | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/embark-ui/src/components/ContractsDeployment.js b/embark-ui/src/components/ContractsDeployment.js index 9458dd70a..22f1ff915 100644 --- a/embark-ui/src/components/ContractsDeployment.js +++ b/embark-ui/src/components/ContractsDeployment.js @@ -112,26 +112,26 @@ class Web3Contract extends React.Component { } inputsAsArray() { - return findConstructor(this.props.contract.abiDefinition).inputs + const constructor = findConstructor(this.props.contract.abiDefinition); + if (!constructor) return []; + + return constructor.inputs .map(input => this.state.inputs[input.name]) .filter(value => value); } actionDisabled() { - return this.inputsAsArray().length !== findConstructor(this.props.contract.abiDefinition).inputs.length; + const constructor = findConstructor(this.props.contract.abiDefinition); + if (!constructor) return false; + + return this.inputsAsArray().length !== constructor.inputs.length; } render() { const abiConstructor = findConstructor(this.props.contract.abiDefinition); - const isInterface = !abiConstructor; const argumentsRequired = abiConstructor && abiConstructor.inputs.length > 0; return ( - - {isInterface && `${this.props.contract.className} is an interface`} - {!isInterface && this.props.contract.className} - - }> + {argumentsRequired && @@ -148,7 +148,7 @@ class Web3Contract extends React.Component { {!this.props.web3 && } - {this.props.web3 && !isInterface && + {this.props.web3 &&