diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-04-10 19:44:15 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-04-12 18:50:38 +0800 |
commit | f2f9bd2e7ac1372073644a4e30a5d99e8c57fbb1 (patch) | |
tree | 98ff3c9137cdce1a44b65dc7dc89a7a72f70b9de /packages/abi-gen | |
parent | ed0c64fdcf5c180107f54ad916c11c4901a4c01c (diff) | |
download | dexon-sol-tools-f2f9bd2e7ac1372073644a4e30a5d99e8c57fbb1.tar dexon-sol-tools-f2f9bd2e7ac1372073644a4e30a5d99e8c57fbb1.tar.gz dexon-sol-tools-f2f9bd2e7ac1372073644a4e30a5d99e8c57fbb1.tar.bz2 dexon-sol-tools-f2f9bd2e7ac1372073644a4e30a5d99e8c57fbb1.tar.lz dexon-sol-tools-f2f9bd2e7ac1372073644a4e30a5d99e8c57fbb1.tar.xz dexon-sol-tools-f2f9bd2e7ac1372073644a4e30a5d99e8c57fbb1.tar.zst dexon-sol-tools-f2f9bd2e7ac1372073644a4e30a5d99e8c57fbb1.zip |
Revert "Merge pull request #493 from hysz/features/deployer/multipleCodebaseSupport"
This reverts commit 70d403e6f8c56bc70e6d3471a770b9bbff5d72e7, reversing
changes made to 073bf738ddb271b6b4158798baf4cac3cb0608e9.
Diffstat (limited to 'packages/abi-gen')
-rw-r--r-- | packages/abi-gen/src/index.ts | 14 | ||||
-rw-r--r-- | packages/abi-gen/src/types.ts | 9 | ||||
-rw-r--r-- | packages/abi-gen/src/utils.ts | 4 |
3 files changed, 15 insertions, 12 deletions
diff --git a/packages/abi-gen/src/index.ts b/packages/abi-gen/src/index.ts index ecef33b16..942bb12db 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 { abiUtils, logUtils } from '@0xproject/utils'; +import { 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, Method, ParamKind } from './types'; +import { ContextData, ContractsBackend, ParamKind } from './types'; import { utils } from './utils'; const ABI_TYPE_CONSTRUCTOR = 'constructor'; @@ -83,6 +83,7 @@ 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); } @@ -125,12 +126,11 @@ for (const abiFileName of abiFileNames) { } const methodAbis = ABI.filter((abi: AbiDefinition) => abi.type === ABI_TYPE_METHOD) as MethodAbi[]; - const sanitizedMethodAbis = abiUtils.renameOverloadedMethods(methodAbis) as MethodAbi[]; - const methodsData = _.map(methodAbis, (methodAbi, methodAbiIndex: number) => { - _.forEach(methodAbi.inputs, (input, inputIndex: number) => { + const methodsData = _.map(methodAbis, methodAbi => { + _.map(methodAbi.inputs, (input, i: number) => { if (_.isEmpty(input.name)) { // Auto-generated getters don't have parameter names - input.name = `index_${inputIndex}`; + input.name = `index_${i}`; } }); // This will make templates simpler @@ -138,8 +138,6 @@ 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; }); diff --git a/packages/abi-gen/src/types.ts b/packages/abi-gen/src/types.ts index 648281774..df5b1feaf 100644 --- a/packages/abi-gen/src/types.ts +++ b/packages/abi-gen/src/types.ts @@ -5,6 +5,13 @@ export enum ParamKind { Output = 'output', } +export enum AbiType { + Function = 'function', + Constructor = 'constructor', + Event = 'event', + Fallback = 'fallback', +} + export enum ContractsBackend { Web3 = 'web3', Ethers = 'ethers', @@ -13,8 +20,6 @@ export enum ContractsBackend { export interface Method extends MethodAbi { singleReturnValue: boolean; hasReturnValue: boolean; - tsName: string; - functionSignature: string; } export interface ContextData { diff --git a/packages/abi-gen/src/utils.ts b/packages/abi-gen/src/utils.ts index 20b734959..755fbc71a 100644 --- a/packages/abi-gen/src/utils.ts +++ b/packages/abi-gen/src/utils.ts @@ -1,9 +1,9 @@ -import { AbiType, ConstructorAbi, DataItem } from '@0xproject/types'; +import { ConstructorAbi, DataItem } from '@0xproject/types'; import * as fs from 'fs'; import * as _ from 'lodash'; import * as path from 'path'; -import { ContractsBackend, ParamKind } from './types'; +import { AbiType, ContractsBackend, ParamKind } from './types'; export const utils = { solTypeToTsType(paramKind: ParamKind, backend: ContractsBackend, solType: string, components?: DataItem[]): string { |