diff options
author | Fabio Berger <me@fabioberger.com> | 2018-04-11 18:00:30 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-04-11 18:00:30 +0800 |
commit | 29dc22e208080fa8ff0871b98b530a2deb251a73 (patch) | |
tree | db372a34e85ac8caf4a3f3ed9d7591452df9cb1a /packages/abi-gen/src/index.ts | |
parent | 6f72fed8b5b37fac5096413b363b533e0a29f7b5 (diff) | |
parent | c44f9e56ada898ffd0d0e57aa228006977fb238c (diff) | |
download | dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar.gz dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar.bz2 dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar.lz dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar.xz dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar.zst dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.zip |
Merge branch 'development' into removeMigrateStep
* development:
Fix lint error
Fix documentation links in some READMEs
Fix relative link
Add step to publishing that upload staging doc jsons, deploys staging website, opens every docs page and asks the dev to confirm that each one renders properly before publishing
Fix web3Wrapper build command
Add top-level `yarn lerna:stage_docs` to upload docJsons to the staging S3 bucket for all packages with a docs page
Added a detailed description of `renameOverloadedMethods` (special thanks to @fabioberger). Updated Javascript styles in the Abi-Gen and Utils packages, around support for function overloading.
Updated deployer to accept a list of contract directories as input. Contract directories are namespaced to a void clashes. Also in this commit is a fix for overloading contract functions.
Refactor publish script to have it's main execution body be lean and discrete steps
# Conflicts:
# packages/contracts/package.json
# packages/deployer/package.json
Diffstat (limited to 'packages/abi-gen/src/index.ts')
-rw-r--r-- | packages/abi-gen/src/index.ts | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/packages/abi-gen/src/index.ts b/packages/abi-gen/src/index.ts index 942bb12db..ecef33b16 100644 --- a/packages/abi-gen/src/index.ts +++ b/packages/abi-gen/src/index.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node import { AbiDefinition, ConstructorAbi, EventAbi, MethodAbi } from '@0xproject/types'; -import { logUtils } from '@0xproject/utils'; +import { abiUtils, logUtils } from '@0xproject/utils'; import chalk from 'chalk'; import * as fs from 'fs'; import { sync as globSync } from 'glob'; @@ -12,7 +12,7 @@ import * as yargs from 'yargs'; import toSnakeCase = require('to-snake-case'); -import { ContextData, ContractsBackend, ParamKind } from './types'; +import { ContextData, ContractsBackend, Method, ParamKind } from './types'; import { utils } from './utils'; const ABI_TYPE_CONSTRUCTOR = 'constructor'; @@ -83,7 +83,6 @@ function writeOutputFile(name: string, renderedTsCode: string): void { Handlebars.registerHelper('parameterType', utils.solTypeToTsType.bind(utils, ParamKind.Input, args.backend)); Handlebars.registerHelper('returnType', utils.solTypeToTsType.bind(utils, ParamKind.Output, args.backend)); - if (args.partials) { registerPartials(args.partials); } @@ -126,11 +125,12 @@ for (const abiFileName of abiFileNames) { } const methodAbis = ABI.filter((abi: AbiDefinition) => abi.type === ABI_TYPE_METHOD) as MethodAbi[]; - const methodsData = _.map(methodAbis, methodAbi => { - _.map(methodAbi.inputs, (input, i: number) => { + const sanitizedMethodAbis = abiUtils.renameOverloadedMethods(methodAbis) as MethodAbi[]; + const methodsData = _.map(methodAbis, (methodAbi, methodAbiIndex: number) => { + _.forEach(methodAbi.inputs, (input, inputIndex: number) => { if (_.isEmpty(input.name)) { // Auto-generated getters don't have parameter names - input.name = `index_${i}`; + input.name = `index_${inputIndex}`; } }); // This will make templates simpler @@ -138,6 +138,8 @@ for (const abiFileName of abiFileNames) { ...methodAbi, singleReturnValue: methodAbi.outputs.length === 1, hasReturnValue: methodAbi.outputs.length !== 0, + tsName: sanitizedMethodAbis[methodAbiIndex].name, + functionSignature: abiUtils.getFunctionSignature(methodAbi), }; return methodData; }); |