diff options
author | Olaf Tomalka <olaf@tomalka.me> | 2018-01-05 09:07:25 +0800 |
---|---|---|
committer | Olaf Tomalka <olaf@tomalka.me> | 2018-01-05 19:48:17 +0800 |
commit | e019ae4aed610c4645894c2999871fd3c0b57388 (patch) | |
tree | c9acc3f7a1dbccaf10c8616289de61f2dc879236 /packages/abi-gen | |
parent | f3b8bac47787a13ea4360b992bbe550bec2c3e19 (diff) | |
download | dexon-0x-contracts-e019ae4aed610c4645894c2999871fd3c0b57388.tar dexon-0x-contracts-e019ae4aed610c4645894c2999871fd3c0b57388.tar.gz dexon-0x-contracts-e019ae4aed610c4645894c2999871fd3c0b57388.tar.bz2 dexon-0x-contracts-e019ae4aed610c4645894c2999871fd3c0b57388.tar.lz dexon-0x-contracts-e019ae4aed610c4645894c2999871fd3c0b57388.tar.xz dexon-0x-contracts-e019ae4aed610c4645894c2999871fd3c0b57388.tar.zst dexon-0x-contracts-e019ae4aed610c4645894c2999871fd3c0b57388.zip |
Changes to abi-gen after code review
* Added change to CHANGELOG
* Renamed variable and context to ctor to avoid keyword
* Used lodash' isUndefined to better check ctor
Diffstat (limited to 'packages/abi-gen')
-rw-r--r-- | packages/abi-gen/CHANGELOG.md | 1 | ||||
-rw-r--r-- | packages/abi-gen/src/index.ts | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/packages/abi-gen/CHANGELOG.md b/packages/abi-gen/CHANGELOG.md index 346bba4bf..0afd6abd4 100644 --- a/packages/abi-gen/CHANGELOG.md +++ b/packages/abi-gen/CHANGELOG.md @@ -4,3 +4,4 @@ v0.x.x - _TBD, 2018_ ------------------------ * Fixed array typings with union types (#295) * Add event ABIs to context data passed to templates (#302) +* Add constructor ABIs to context data passed to templates (#304)
\ No newline at end of file diff --git a/packages/abi-gen/src/index.ts b/packages/abi-gen/src/index.ts index 65dc1c607..527af32b1 100644 --- a/packages/abi-gen/src/index.ts +++ b/packages/abi-gen/src/index.ts @@ -76,9 +76,9 @@ for (const abiFileName of abiFileNames) { process.exit(1); } - let constructor = ABI.find((abi: Web3.AbiDefinition) => abi.type === ABI_TYPE_CONSTRUCTOR) as Web3.ConstructorAbi; - if (!constructor) { - constructor = utils.getEmptyConstructor(); // The constructor exists, but it's implicit in JSON's ABI definition + let ctor = ABI.find((abi: Web3.AbiDefinition) => abi.type === ABI_TYPE_CONSTRUCTOR) as Web3.ConstructorAbi; + if (_.isUndefined(ctor)) { + ctor = utils.getEmptyConstructor(); // The constructor exists, but it's implicit in JSON's ABI definition } const methodAbis = ABI.filter((abi: Web3.AbiDefinition) => abi.type === ABI_TYPE_METHOD) as Web3.MethodAbi[]; @@ -101,7 +101,7 @@ for (const abiFileName of abiFileNames) { const contextData = { contractName: namedContent.name, - constructor, + ctor, methods: methodsData, events: eventAbis, }; |