Small fixes
fix for showing compiled in compilation summary fix for className in compilation api endpoint For profile of non-deployed contract, return empty response if the compiled contract has no classname (ie probably not a successful compilation).
This commit is contained in:
parent
bd3ac7c8ec
commit
c64b007d98
|
@ -196,7 +196,7 @@ class FiddleContainer extends Component {
|
|||
showFatalFiddleDeploy={Boolean(fiddleDeployError)}
|
||||
onDeployClick={(e) => this._onDeployClick(e)}
|
||||
isVisible={Boolean(fatalError || hasResult || loading)}
|
||||
showDeploy={hasResult && Boolean(compiledFiddle.compilationResult)}
|
||||
showDeploy={hasResult && Object.keys(compiledFiddle.compilationResult).length > 0}
|
||||
onWarningsClick={(e) => this._onErrorSummaryClick(e, this.errorsCardRef)}
|
||||
onErrorsClick={(e) => this._onErrorSummaryClick(e, this.warningsCardRef)}
|
||||
onFatalClick={(e) => this._onErrorSummaryClick(e, this.fatalCardRef)}
|
||||
|
@ -221,7 +221,7 @@ class FiddleContainer extends Component {
|
|||
fatalErrorCard={this._renderFatalCard("Fatal error", fatalError)}
|
||||
fatalFiddleCard={this._renderFatalCard("Failed to compile", fiddleCompileError)}
|
||||
fatalFiddleDeployCard={this._renderFatalCard("Failed to deploy", fiddleDeployError)}
|
||||
compiledContractsCard={compiledFiddle && compiledFiddle.compilationResult && this._renderSuccessCard("Contract(s) compiled!",
|
||||
compiledContractsCard={compiledFiddle && Object.keys(compiledFiddle.compilationResult).length > 0 && this._renderSuccessCard("Contract(s) compiled!",
|
||||
profiledFiddle && <ContractFunctions contractProfile={profiledFiddle}
|
||||
contractFunctions={[]}
|
||||
onlyConstructor
|
||||
|
|
|
@ -110,7 +110,10 @@ class Profiler {
|
|||
return res.status(204).send(); // send emptry response
|
||||
}
|
||||
if (typeof contract !== 'object') {
|
||||
return res.status(422).send({error: 'Body parameter \'compiledCode\' must be a string'});
|
||||
return res.status(422).send({error: 'Body parameter \'compilationResult\' must be an object'});
|
||||
}
|
||||
if(Object.keys(contract).length === 0){
|
||||
return res.status(204).send(); // send emptry response
|
||||
}
|
||||
// use the first child of the object
|
||||
const className = Object.keys(contract)[0];
|
||||
|
|
|
@ -32,7 +32,8 @@ class Solidity {
|
|||
if (error) res.status(500).send({error: error.message});
|
||||
|
||||
// write code to filesystem so we can view the source after page refresh
|
||||
const className = !compilationResult ? 'temp' : Object.keys(compilationResult).join('_');
|
||||
const compilationClasses = Object.keys(compilationResult);
|
||||
const className = compilationClasses.length === 0 ? 'temp' : compilationClasses.join('_');
|
||||
this._writeFiddleToFile(sourceCode, className, Boolean(compilationResult), (err) => {
|
||||
if (err) this.logger.trace('Error writing fiddle to filesystem: ', err);
|
||||
}); // async, do not need to wait
|
||||
|
|
Loading…
Reference in New Issue