From 2d30183d658c9d178544e1c14fb779306e5d2778 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 7 May 2018 13:57:03 +0200 Subject: CHeck if ABI exists --- packages/deployer/src/deployer.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'packages/deployer') diff --git a/packages/deployer/src/deployer.ts b/packages/deployer/src/deployer.ts index fe959e405..c8c3a9a06 100644 --- a/packages/deployer/src/deployer.ts +++ b/packages/deployer/src/deployer.ts @@ -82,6 +82,9 @@ export class Deployer { data, gas, }; + if (_.isUndefined(compilerOutput.abi)) { + throw new Error(`ABI not found in ${contractName} artifacts`); + } const abi = compilerOutput.abi; const constructorAbi = _.find(abi, { type: AbiType.Constructor }) as ConstructorAbi; const constructorArgs = _.isUndefined(constructorAbi) ? [] : constructorAbi.inputs; @@ -151,6 +154,9 @@ export class Deployer { ): Promise { const contractArtifactIfExists: ContractArtifact = this._loadContractArtifactIfExists(contractName); const compilerOutput = Deployer._getContractCompilerOutputFromArtifactIfExists(contractArtifactIfExists); + if (_.isUndefined(compilerOutput.abi)) { + throw new Error(`ABI not found in ${contractName} artifacts`); + } const abi = compilerOutput.abi; const encodedConstructorArgs = encoder.encodeConstructorArgsFromAbi(args, abi); const newContractData: ContractNetworkData = { -- cgit v1.2.3