aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid <logvinov.leon@gmail.com>2018-01-03 19:02:06 +0800
committerGitHub <noreply@github.com>2018-01-03 19:02:06 +0800
commiteb0dd6b6e99e9c80060923ceb648ec13ac54816a (patch)
tree54262dca747141f79bdc98c855fdb9d01f011430
parent1c542c3e0df30eb5522c20e6cb6d577214eaf096 (diff)
parent161a9d6ad20d7b127ef41a55dc12892e809127e5 (diff)
downloaddexon-0x-contracts-eb0dd6b6e99e9c80060923ceb648ec13ac54816a.tar.gz
dexon-0x-contracts-eb0dd6b6e99e9c80060923ceb648ec13ac54816a.tar.zst
dexon-0x-contracts-eb0dd6b6e99e9c80060923ceb648ec13ac54816a.zip
Merge pull request #302 from joincivil/ritave/feature/abi-gen-events
Added Event generation to abi-gen
-rw-r--r--packages/abi-gen/src/index.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/abi-gen/src/index.ts b/packages/abi-gen/src/index.ts
index a74bdf8c4..bcb4a468b 100644
--- a/packages/abi-gen/src/index.ts
+++ b/packages/abi-gen/src/index.ts
@@ -15,6 +15,7 @@ import { ContextData, ParamKind } from './types';
import { utils } from './utils';
const ABI_TYPE_METHOD = 'function';
+const ABI_TYPE_EVENT = 'event';
const MAIN_TEMPLATE_NAME = 'contract.mustache';
const args = yargs
@@ -73,6 +74,7 @@ for (const abiFileName of abiFileNames) {
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[];
const methodsData = _.map(methodAbis, methodAbi => {
_.map(methodAbi.inputs, input => {
@@ -88,9 +90,13 @@ for (const abiFileName of abiFileNames) {
};
return methodData;
});
+
+ const eventAbis = ABI.filter((abi: Web3.AbiDefinition) => abi.type === ABI_TYPE_EVENT) as Web3.MethodAbi[];
+
const contextData = {
contractName: namedContent.name,
methods: methodsData,
+ events: eventAbis,
};
const renderedTsCode = template(contextData);
writeOutputFile(namedContent.name, renderedTsCode);