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)}
|
showFatalFiddleDeploy={Boolean(fiddleDeployError)}
|
||||||
onDeployClick={(e) => this._onDeployClick(e)}
|
onDeployClick={(e) => this._onDeployClick(e)}
|
||||||
isVisible={Boolean(fatalError || hasResult || loading)}
|
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)}
|
onWarningsClick={(e) => this._onErrorSummaryClick(e, this.errorsCardRef)}
|
||||||
onErrorsClick={(e) => this._onErrorSummaryClick(e, this.warningsCardRef)}
|
onErrorsClick={(e) => this._onErrorSummaryClick(e, this.warningsCardRef)}
|
||||||
onFatalClick={(e) => this._onErrorSummaryClick(e, this.fatalCardRef)}
|
onFatalClick={(e) => this._onErrorSummaryClick(e, this.fatalCardRef)}
|
||||||
|
@ -221,7 +221,7 @@ class FiddleContainer extends Component {
|
||||||
fatalErrorCard={this._renderFatalCard("Fatal error", fatalError)}
|
fatalErrorCard={this._renderFatalCard("Fatal error", fatalError)}
|
||||||
fatalFiddleCard={this._renderFatalCard("Failed to compile", fiddleCompileError)}
|
fatalFiddleCard={this._renderFatalCard("Failed to compile", fiddleCompileError)}
|
||||||
fatalFiddleDeployCard={this._renderFatalCard("Failed to deploy", fiddleDeployError)}
|
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}
|
profiledFiddle && <ContractFunctions contractProfile={profiledFiddle}
|
||||||
contractFunctions={[]}
|
contractFunctions={[]}
|
||||||
onlyConstructor
|
onlyConstructor
|
||||||
|
|
|
@ -110,7 +110,10 @@ class Profiler {
|
||||||
return res.status(204).send(); // send emptry response
|
return res.status(204).send(); // send emptry response
|
||||||
}
|
}
|
||||||
if (typeof contract !== 'object') {
|
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
|
// use the first child of the object
|
||||||
const className = Object.keys(contract)[0];
|
const className = Object.keys(contract)[0];
|
||||||
|
|
|
@ -32,7 +32,8 @@ class Solidity {
|
||||||
if (error) res.status(500).send({error: error.message});
|
if (error) res.status(500).send({error: error.message});
|
||||||
|
|
||||||
// write code to filesystem so we can view the source after page refresh
|
// 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) => {
|
this._writeFiddleToFile(sourceCode, className, Boolean(compilationResult), (err) => {
|
||||||
if (err) this.logger.trace('Error writing fiddle to filesystem: ', err);
|
if (err) this.logger.trace('Error writing fiddle to filesystem: ', err);
|
||||||
}); // async, do not need to wait
|
}); // async, do not need to wait
|
||||||
|
|
Loading…
Reference in New Issue