aboutsummaryrefslogtreecommitdiffstats
path: root/packages/abi-gen
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-03-30 01:02:46 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-03-30 01:02:46 +0800
commit665011174bab7cfc6ec53e0044d60e1463222aee (patch)
tree44bc55bd390044d6cbfe8e0f7dddb621a8be7249 /packages/abi-gen
parentd106079d9b69191d9cdc6d9323dbae3e4b45daf2 (diff)
parentc4dd9658e791a9f821ea3b6eb4326bcba53b081a (diff)
downloaddexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar
dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.gz
dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.bz2
dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.lz
dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.xz
dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.zst
dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.zip
Merge branch 'development' into feature/website/wallet-wrap
* development: (35 commits) Fix CHANGELOG Update Yarn.lock Standardize changelog dates and format Fix stubbing of a non-existent property Remove redundant cast Move common types out of web3 types Add monorepo_scripts to npmignore Add typeRoots Add clean-state tests Remove nested .gitignore files since `yarn publish` gets confused by them and ignores their contents on the top-level scope Remove WETH hack now that updated WETH address is in TokenRegistry Revert TokenRegistry address on Kovan Improve rounding error message Portal fill with mixed decimals Add error popover if TokenRegistry on network user is browsing on don't include the requisite default tokens for 0x Portal to function Set timeout for compiler tests Remove redundant types Add missing param comments Fix a comment Add a comment ...
Diffstat (limited to 'packages/abi-gen')
-rw-r--r--packages/abi-gen/.npmignore1
-rw-r--r--packages/abi-gen/package.json6
-rw-r--r--packages/abi-gen/src/index.ts8
-rw-r--r--packages/abi-gen/src/types.ts6
-rw-r--r--packages/abi-gen/src/utils.ts11
-rw-r--r--packages/abi-gen/tsconfig.json2
6 files changed, 15 insertions, 19 deletions
diff --git a/packages/abi-gen/.npmignore b/packages/abi-gen/.npmignore
index 87bc30436..d645458f6 100644
--- a/packages/abi-gen/.npmignore
+++ b/packages/abi-gen/.npmignore
@@ -3,3 +3,4 @@ yarn-error.log
/src/
/scripts/
tsconfig.json
+/lib/monorepo_scripts/
diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json
index fc1adeb06..3c20249dd 100644
--- a/packages/abi-gen/package.json
+++ b/packages/abi-gen/package.json
@@ -24,13 +24,14 @@
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md",
"dependencies": {
"@0xproject/utils": "^0.4.3",
+ "@0xproject/types": "^0.4.1",
+ "@0xproject/typescript-typings": "^0.0.1",
"chalk": "^2.3.0",
"glob": "^7.1.2",
"handlebars": "^4.0.11",
"lodash": "^4.17.4",
"mkdirp": "^0.5.1",
"to-snake-case": "^1.0.0",
- "web3": "^0.20.0",
"yargs": "^10.0.3"
},
"devDependencies": {
@@ -45,8 +46,7 @@
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"tslint": "5.8.0",
- "typescript": "2.7.1",
- "web3-typescript-typings": "^0.10.2"
+ "typescript": "2.7.1"
},
"publishConfig": {
"access": "public"
diff --git a/packages/abi-gen/src/index.ts b/packages/abi-gen/src/index.ts
index 8932e4045..942bb12db 100644
--- a/packages/abi-gen/src/index.ts
+++ b/packages/abi-gen/src/index.ts
@@ -1,5 +1,6 @@
#!/usr/bin/env node
+import { AbiDefinition, ConstructorAbi, EventAbi, MethodAbi } from '@0xproject/types';
import { logUtils } from '@0xproject/utils';
import chalk from 'chalk';
import * as fs from 'fs';
@@ -10,7 +11,6 @@ import * as mkdirp from 'mkdirp';
import * as yargs from 'yargs';
import toSnakeCase = require('to-snake-case');
-import * as Web3 from 'web3';
import { ContextData, ContractsBackend, ParamKind } from './types';
import { utils } from './utils';
@@ -120,12 +120,12 @@ for (const abiFileName of abiFileNames) {
process.exit(1);
}
- let ctor = ABI.find((abi: Web3.AbiDefinition) => abi.type === ABI_TYPE_CONSTRUCTOR) as Web3.ConstructorAbi;
+ let ctor = ABI.find((abi: AbiDefinition) => abi.type === ABI_TYPE_CONSTRUCTOR) as 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[];
+ const methodAbis = ABI.filter((abi: AbiDefinition) => abi.type === ABI_TYPE_METHOD) as MethodAbi[];
const methodsData = _.map(methodAbis, methodAbi => {
_.map(methodAbi.inputs, (input, i: number) => {
if (_.isEmpty(input.name)) {
@@ -142,7 +142,7 @@ for (const abiFileName of abiFileNames) {
return methodData;
});
- const eventAbis = ABI.filter((abi: Web3.AbiDefinition) => abi.type === ABI_TYPE_EVENT) as Web3.EventAbi[];
+ const eventAbis = ABI.filter((abi: AbiDefinition) => abi.type === ABI_TYPE_EVENT) as EventAbi[];
const contextData = {
contractName: namedContent.name,
diff --git a/packages/abi-gen/src/types.ts b/packages/abi-gen/src/types.ts
index deddb1857..df5b1feaf 100644
--- a/packages/abi-gen/src/types.ts
+++ b/packages/abi-gen/src/types.ts
@@ -1,4 +1,4 @@
-import * as Web3 from 'web3';
+import { EventAbi, MethodAbi } from '@0xproject/types';
export enum ParamKind {
Input = 'input',
@@ -17,7 +17,7 @@ export enum ContractsBackend {
Ethers = 'ethers',
}
-export interface Method extends Web3.MethodAbi {
+export interface Method extends MethodAbi {
singleReturnValue: boolean;
hasReturnValue: boolean;
}
@@ -25,5 +25,5 @@ export interface Method extends Web3.MethodAbi {
export interface ContextData {
contractName: string;
methods: Method[];
- events: Web3.EventAbi[];
+ events: EventAbi[];
}
diff --git a/packages/abi-gen/src/utils.ts b/packages/abi-gen/src/utils.ts
index c4520ade0..755fbc71a 100644
--- a/packages/abi-gen/src/utils.ts
+++ b/packages/abi-gen/src/utils.ts
@@ -1,17 +1,12 @@
+import { ConstructorAbi, DataItem } from '@0xproject/types';
import * as fs from 'fs';
import * as _ from 'lodash';
import * as path from 'path';
-import * as Web3 from 'web3';
import { AbiType, ContractsBackend, ParamKind } from './types';
export const utils = {
- solTypeToTsType(
- paramKind: ParamKind,
- backend: ContractsBackend,
- solType: string,
- components?: Web3.DataItem[],
- ): string {
+ solTypeToTsType(paramKind: ParamKind, backend: ContractsBackend, solType: string, components?: DataItem[]): string {
const trailingArrayRegex = /\[\d*\]$/;
if (solType.match(trailingArrayRegex)) {
const arrayItemSolType = solType.replace(trailingArrayRegex, '');
@@ -89,7 +84,7 @@ export const utils = {
throw new Error(`Failed to read ${filename}: ${err}`);
}
},
- getEmptyConstructor(): Web3.ConstructorAbi {
+ getEmptyConstructor(): ConstructorAbi {
return {
type: AbiType.Constructor,
stateMutability: 'nonpayable',
diff --git a/packages/abi-gen/tsconfig.json b/packages/abi-gen/tsconfig.json
index 5e0c7c6d3..e35816553 100644
--- a/packages/abi-gen/tsconfig.json
+++ b/packages/abi-gen/tsconfig.json
@@ -3,5 +3,5 @@
"compilerOptions": {
"outDir": "lib"
},
- "include": ["./src/**/*", "./test/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"]
+ "include": ["./src/**/*", "./test/**/*"]
}