aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/abi-gen/CHANGELOG.md1
-rw-r--r--packages/abi-gen/src/index.ts8
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,
};