diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-07 19:57:03 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-07 19:57:03 +0800 |
commit | 2d30183d658c9d178544e1c14fb779306e5d2778 (patch) | |
tree | ca12663ec8cf6ed879c43c7c6f09305ca8214a44 | |
parent | fcb0a05880f6217f5b5942ec419fcf4df490551d (diff) | |
download | dexon-sol-tools-2d30183d658c9d178544e1c14fb779306e5d2778.tar dexon-sol-tools-2d30183d658c9d178544e1c14fb779306e5d2778.tar.gz dexon-sol-tools-2d30183d658c9d178544e1c14fb779306e5d2778.tar.bz2 dexon-sol-tools-2d30183d658c9d178544e1c14fb779306e5d2778.tar.lz dexon-sol-tools-2d30183d658c9d178544e1c14fb779306e5d2778.tar.xz dexon-sol-tools-2d30183d658c9d178544e1c14fb779306e5d2778.tar.zst dexon-sol-tools-2d30183d658c9d178544e1c14fb779306e5d2778.zip |
CHeck if ABI exists
-rw-r--r-- | packages/deployer/src/deployer.ts | 6 |
1 files changed, 6 insertions, 0 deletions
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<void> { 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 = { |