Merge pull request #3518 from ethcore/ng-solc-combined-fix

ABI can be empty and auto-fill contract name
This commit is contained in:
Gav Wood 2016-11-19 02:50:23 +08:00 committed by GitHub
commit c9d1eb085c
2 changed files with 6 additions and 2 deletions

View File

@ -103,7 +103,7 @@ export default class DetailsStep extends Component {
label='contract name'
hint='a name for the deployed contract'
error={ nameError }
value={ name }
value={ name || '' }
onChange={ this.onNameChange } />
<Input
@ -169,6 +169,10 @@ export default class DetailsStep extends Component {
const contractName = Object.keys(contracts)[index];
const contract = contracts[contractName];
if (!this.props.name || this.props.name.trim() === '') {
this.onNameChange(null, contractName);
}
const { abi, bin } = contract;
const code = /^0x/.test(bin) ? bin : `0x${bin}`;

View File

@ -37,7 +37,7 @@ export function validateAbi (abi, api) {
try {
abiParsed = JSON.parse(abi);
if (!api.util.isArray(abiParsed) || !abiParsed.length) {
if (!api.util.isArray(abiParsed)) {
abiError = ERRORS.invalidAbi;
return { abi, abiError, abiParsed };
}