aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-12-05 22:51:47 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-12-05 22:51:47 +0800
commit43983f1bb3660a7a7650d947de4bc1a2a9fb8c09 (patch)
tree5443cd08af713af47e270691a3a2d796e830e9bf
parenteb4adcf797cab80b9fa7c08083978be5514df8b9 (diff)
downloaddexon-sol-tools-43983f1bb3660a7a7650d947de4bc1a2a9fb8c09.tar.gz
dexon-sol-tools-43983f1bb3660a7a7650d947de4bc1a2a9fb8c09.tar.zst
dexon-sol-tools-43983f1bb3660a7a7650d947de4bc1a2a9fb8c09.zip
Check ABI is defined
-rw-r--r--packages/typed-contracts/src/index.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/typed-contracts/src/index.ts b/packages/typed-contracts/src/index.ts
index 0a74e1594..9461ca8ca 100644
--- a/packages/typed-contracts/src/index.ts
+++ b/packages/typed-contracts/src/index.ts
@@ -69,6 +69,11 @@ for (const abiFileName of abiFileNames) {
const ABI = _.isArray(parsedContent) ?
parsedContent : // ABI file
parsedContent.abi; // Truffle contracts file
+ if (_.isUndefined(ABI)) {
+ utils.log(`${chalk.red(`ABI not found in ${abiFileName}.`)}`);
+ utils.log(`Please make sure your ABI file is either an array with ABI entries or an object with the abi key`);
+ process.exit(1);
+ }
const methodAbis = ABI.filter((abi: Web3.AbiDefinition) => abi.type === ABI_TYPE_METHOD) as Web3.MethodAbi[];
_.map(methodAbis, methodAbi => {
_.map(methodAbi.inputs, input => {