merge developmentx
This commit is contained in:
		@@ -27,6 +27,15 @@ jobs:
 | 
				
			|||||||
          key: repo-{{ .Environment.CIRCLE_SHA1 }}
 | 
					          key: repo-{{ .Environment.CIRCLE_SHA1 }}
 | 
				
			||||||
          paths:
 | 
					          paths:
 | 
				
			||||||
            - ~/repo
 | 
					            - ~/repo
 | 
				
			||||||
 | 
					  test-installation:
 | 
				
			||||||
 | 
					    docker:
 | 
				
			||||||
 | 
					      - image: circleci/node:6.12
 | 
				
			||||||
 | 
					    working_directory: ~/repo
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      - restore_cache:
 | 
				
			||||||
 | 
					          keys:
 | 
				
			||||||
 | 
					            - repo-{{ .Environment.CIRCLE_SHA1 }}
 | 
				
			||||||
 | 
					      - run: yarn test:installation
 | 
				
			||||||
  test-0xjs:
 | 
					  test-0xjs:
 | 
				
			||||||
    docker:
 | 
					    docker:
 | 
				
			||||||
      - image: circleci/node:6.12
 | 
					      - image: circleci/node:6.12
 | 
				
			||||||
@@ -174,6 +183,9 @@ workflows:
 | 
				
			|||||||
  main:
 | 
					  main:
 | 
				
			||||||
    jobs:
 | 
					    jobs:
 | 
				
			||||||
      - build
 | 
					      - build
 | 
				
			||||||
 | 
					      - test-installation:
 | 
				
			||||||
 | 
					          requires:
 | 
				
			||||||
 | 
					            - build
 | 
				
			||||||
      - test-0xjs:
 | 
					      - test-0xjs:
 | 
				
			||||||
          requires:
 | 
					          requires:
 | 
				
			||||||
            - build
 | 
					            - build
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										57
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										57
									
								
								README.md
									
									
									
									
									
								
							@@ -18,35 +18,27 @@ This repository is a monorepo including the 0x protocol smart contracts and nume
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
### Published Packages
 | 
					### Published Packages
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| Package                                                     | Version                                                                                                                           | Description                                                                 |
 | 
					| Package                                                         | Version                                                                                                                               | Description                                                                 |
 | 
				
			||||||
| ----------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
 | 
					| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
 | 
				
			||||||
| [`0x.js`](/packages/0x.js)                                  | [](https://www.npmjs.com/package/0x.js)                                             | A Javascript library for interacting with the 0x protocol                   |
 | 
					| [`0x.js`](/packages/0x.js)                                      | [](https://www.npmjs.com/package/0x.js)                                                 | A Javascript library for interacting with the 0x protocol                   |
 | 
				
			||||||
| [`@0xproject/abi-gen`](/packages/abi-gen)                   | [](https://www.npmjs.com/package/@0xproject/abi-gen)                   | Tool to generate TS wrappers from smart contract ABIs                       |
 | 
					| [`@0xproject/abi-gen`](/packages/abi-gen)                       | [](https://www.npmjs.com/package/@0xproject/abi-gen)                       | Tool to generate TS wrappers from smart contract ABIs                       |
 | 
				
			||||||
| [`@0xproject/assert`](/packages/assert)                     | [](https://www.npmjs.com/package/@0xproject/assert)                     | Type and schema assertions used by our packages                             |
 | 
					| [`@0xproject/assert`](/packages/assert)                         | [](https://www.npmjs.com/package/@0xproject/assert)                         | Type and schema assertions used by our packages                             |
 | 
				
			||||||
| [`@0xproject/base-contract`](/packages/base-contract)       | [](https://www.npmjs.com/package/@0xproject/base-contract)       | BaseContract used by auto-generated `abi-gen` wrapper contracts             |
 | 
					| [`@0xproject/base-contract`](/packages/base-contract)           | [](https://www.npmjs.com/package/@0xproject/base-contract)           | BaseContract used by auto-generated `abi-gen` wrapper contracts             |
 | 
				
			||||||
| [`@0xproject/connect`](/packages/connect)                   | [](https://www.npmjs.com/package/@0xproject/connect)                   | A Javascript library for interacting with the Standard Relayer API          |
 | 
					| [`@0xproject/connect`](/packages/connect)                       | [](https://www.npmjs.com/package/@0xproject/connect)                       | A Javascript library for interacting with the Standard Relayer API          |
 | 
				
			||||||
| [`@0xproject/deployer`](/packages/deployer)                 | [](https://www.npmjs.com/package/@0xproject/deployer)                 | Solidity project compiler and deployer framework                            |
 | 
					| [`@0xproject/deployer`](/packages/deployer)                     | [](https://www.npmjs.com/package/@0xproject/deployer)                     | Solidity project compiler and deployer framework                            |
 | 
				
			||||||
| [`@0xproject/dev-utils`](/packages/dev-utils)               | [](https://www.npmjs.com/package/@0xproject/dev-utils)               | Dev utils to be shared across 0x projects and packages                      |
 | 
					| [`@0xproject/dev-utils`](/packages/dev-utils)                   | [](https://www.npmjs.com/package/@0xproject/dev-utils)                   | Dev utils to be shared across 0x projects and packages                      |
 | 
				
			||||||
| [`@0xproject/json-schemas`](/packages/json-schemas)         | [](https://www.npmjs.com/package/@0xproject/json-schemas)         | 0x-related json schemas                                                     |
 | 
					| [`@0xproject/json-schemas`](/packages/json-schemas)             | [](https://www.npmjs.com/package/@0xproject/json-schemas)             | 0x-related json schemas                                                     |
 | 
				
			||||||
| [`@0xproject/monorepo-scripts`](/packages/monorepo-scripts) | [](https://www.npmjs.com/package/@0xproject/monorepo-scripts) | Monorepo scripts                                                            |
 | 
					| [`@0xproject/monorepo-scripts`](/packages/monorepo-scripts)     | [](https://www.npmjs.com/package/@0xproject/monorepo-scripts)     | Monorepo scripts                                                            |
 | 
				
			||||||
| [`@0xproject/react-docs`](/packages/react-docs)             | [](https://www.npmjs.com/package/@0xproject/react-docs)             | React documentation component for rendering TypeDoc & Doxity generated JSON |
 | 
					| [`@0xproject/react-docs`](/packages/react-docs)                 | [](https://www.npmjs.com/package/@0xproject/react-docs)                 | React documentation component for rendering TypeDoc & Doxity generated JSON |
 | 
				
			||||||
| [`@0xproject/react-shared`](/packages/react-shared)         | [](https://www.npmjs.com/package/@0xproject/react-shared)         | 0x shared react components                                                  |
 | 
					| [`@0xproject/react-shared`](/packages/react-shared)             | [](https://www.npmjs.com/package/@0xproject/react-shared)             | 0x shared react components                                                  |
 | 
				
			||||||
| [`@0xproject/sra-report`](/packages/sra-report)             | [](https://www.npmjs.com/package/@0xproject/sra-report)             | Generate reports for standard relayer API compliance                        |
 | 
					| [`@0xproject/sra-report`](/packages/sra-report)                 | [](https://www.npmjs.com/package/@0xproject/sra-report)                 | Generate reports for standard relayer API compliance                        |
 | 
				
			||||||
| [`@0xproject/sol-cov`](/packages/sol-cov)                   | [](https://www.npmjs.com/package/@0xproject/sol-cov)                   | Solidity test coverage tool tool                                            |
 | 
					| [`@0xproject/sol-cov`](/packages/sol-cov)                       | [](https://www.npmjs.com/package/@0xproject/sol-cov)                       | Solidity test coverage tool tool                                            |
 | 
				
			||||||
| [`@0xproject/subproviders`](/packages/subproviders)         | [](https://www.npmjs.com/package/@0xproject/subproviders)         | Useful web3 subproviders (e.g LedgerSubprovider)                            |
 | 
					| [`@0xproject/subproviders`](/packages/subproviders)             | [](https://www.npmjs.com/package/@0xproject/subproviders)             | Useful web3 subproviders (e.g LedgerSubprovider)                            |
 | 
				
			||||||
| [`@0xproject/tslint-config`](/packages/tslint-config)       | [](https://www.npmjs.com/package/@0xproject/tslint-config)       | Custom 0x development TSLint rules                                          |
 | 
					| [`@0xproject/tslint-config`](/packages/tslint-config)           | [](https://www.npmjs.com/package/@0xproject/tslint-config)           | Custom 0x development TSLint rules                                          |
 | 
				
			||||||
| [`@0xproject/types`](/packages/types)                       | [](https://www.npmjs.com/package/@0xproject/types)                       | Shared type declarations                                                    |
 | 
					| [`@0xproject/types`](/packages/types)                           | [](https://www.npmjs.com/package/@0xproject/types)                           | Shared type declarations                                                    |
 | 
				
			||||||
| [`@0xproject/utils`](/packages/utils)                       | [](https://www.npmjs.com/package/@0xproject/utils)                       | Shared utilities                                                            |
 | 
					| [`@0xproject/typescript-typings`](/packages/typescript-typings) | [](https://www.npmjs.com/package/@0xproject/typescript-typings) | Repository of types for external packages                                   |
 | 
				
			||||||
| [`@0xproject/web3-wrapper`](/packages/web3-wrapper)         | [](https://www.npmjs.com/package/@0xproject/web3-wrapper)         | Web3 wrapper                                                                |
 | 
					| [`@0xproject/utils`](/packages/utils)                           | [](https://www.npmjs.com/package/@0xproject/utils)                           | Shared utilities                                                            |
 | 
				
			||||||
 | 
					| [`@0xproject/web3-wrapper`](/packages/web3-wrapper)             | [](https://www.npmjs.com/package/@0xproject/web3-wrapper)             | Web3 wrapper                                                                |
 | 
				
			||||||
### TypeScript Typings
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
| Package                                                                                | Version                                                                                                                                           | Description                                                             |
 | 
					 | 
				
			||||||
| -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
 | 
					 | 
				
			||||||
| [`chai-as-promised-typescript-typings`](/packages/chai-as-promised-typescript-typings) | [](https://www.npmjs.com/package/chai-as-promised-typescript-typings) | Chai as promised typescript typings                                     |
 | 
					 | 
				
			||||||
| [`chai-typescript-typings`](/packages/chai-typescript-typings)                         | [](https://www.npmjs.com/package/chai-typescript-typings)                         | Chai typescript typings                                                 |
 | 
					 | 
				
			||||||
| [`ethers-typescript-typings`](/packages/ethers-typescript-typings)                     | [](https://www.npmjs.com/package/ethers-typescript-typings)                           | [Ethers.js](https://github.com/ethers-io/ethers.js/) typescript typings |
 | 
					 | 
				
			||||||
| [`web3-typescript-typings`](/packages/web3-typescript-typings)                         | [](https://www.npmjs.com/package/web3-typescript-typings)                         | Web3 typescript typings                                                 |
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Private Packages
 | 
					### Private Packages
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -66,6 +58,13 @@ Dedicated documentation pages:
 | 
				
			|||||||
*   [Smart contracts](https://0xproject.com/docs/contracts)
 | 
					*   [Smart contracts](https://0xproject.com/docs/contracts)
 | 
				
			||||||
*   [Standard Relayer API](https://github.com/0xProject/standard-relayer-api/blob/master/README.md)
 | 
					*   [Standard Relayer API](https://github.com/0xProject/standard-relayer-api/blob/master/README.md)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Most of the packages require additional typings for external dependencies.
 | 
				
			||||||
 | 
					You can include those by prepending @0xproject/typescript-typings package to your [`typeRoots`](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) config.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```json
 | 
				
			||||||
 | 
					"typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Contributing
 | 
					## Contributing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
 | 
					We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,7 @@
 | 
				
			|||||||
        "prettier": "prettier --write '**/*.{ts,tsx,json,md}' --config .prettierrc",
 | 
					        "prettier": "prettier --write '**/*.{ts,tsx,json,md}' --config .prettierrc",
 | 
				
			||||||
        "prettier:ci": "prettier --list-different '**/*.{ts,tsx,json,md}' --config .prettierrc",
 | 
					        "prettier:ci": "prettier --list-different '**/*.{ts,tsx,json,md}' --config .prettierrc",
 | 
				
			||||||
        "report_coverage": "lcov-result-merger 'packages/*/coverage/lcov.info' | coveralls",
 | 
					        "report_coverage": "lcov-result-merger 'packages/*/coverage/lcov.info' | coveralls",
 | 
				
			||||||
 | 
					        "test:installation": "node ./packages/monorepo-scripts/lib/test_installation.js",
 | 
				
			||||||
        "lerna:run": "lerna run",
 | 
					        "lerna:run": "lerna run",
 | 
				
			||||||
        "lerna:rebuild": "lerna run clean; lerna run build;",
 | 
					        "lerna:rebuild": "lerna run clean; lerna run build;",
 | 
				
			||||||
        "lerna:publish":
 | 
					        "lerna:publish":
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,11 +20,10 @@ import { ZeroEx } from '0x.js';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
					If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```json
 | 
				
			||||||
"include": [
 | 
					"compilerOptions": {
 | 
				
			||||||
    "./node_modules/web3-typescript-typings/index.d.ts",
 | 
					    "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
 | 
				
			||||||
    "./node_modules/ethers-typescript-typings/index.d.ts"
 | 
					}
 | 
				
			||||||
]
 | 
					 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### UMD:
 | 
					#### UMD:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -68,9 +68,7 @@
 | 
				
			|||||||
        "awesome-typescript-loader": "^3.1.3",
 | 
					        "awesome-typescript-loader": "^3.1.3",
 | 
				
			||||||
        "chai": "^4.0.1",
 | 
					        "chai": "^4.0.1",
 | 
				
			||||||
        "chai-as-promised": "^7.1.0",
 | 
					        "chai-as-promised": "^7.1.0",
 | 
				
			||||||
        "chai-as-promised-typescript-typings": "^0.0.12",
 | 
					 | 
				
			||||||
        "chai-bignumber": "^2.0.1",
 | 
					        "chai-bignumber": "^2.0.1",
 | 
				
			||||||
        "chai-typescript-typings": "^0.0.6",
 | 
					 | 
				
			||||||
        "copyfiles": "^1.2.0",
 | 
					        "copyfiles": "^1.2.0",
 | 
				
			||||||
        "dirty-chai": "^2.0.1",
 | 
					        "dirty-chai": "^2.0.1",
 | 
				
			||||||
        "json-loader": "^0.5.4",
 | 
					        "json-loader": "^0.5.4",
 | 
				
			||||||
@@ -99,18 +97,17 @@
 | 
				
			|||||||
        "@0xproject/types": "^0.4.1",
 | 
					        "@0xproject/types": "^0.4.1",
 | 
				
			||||||
        "@0xproject/utils": "^0.4.3",
 | 
					        "@0xproject/utils": "^0.4.3",
 | 
				
			||||||
        "@0xproject/web3-wrapper": "^0.3.1",
 | 
					        "@0xproject/web3-wrapper": "^0.3.1",
 | 
				
			||||||
 | 
					        "@0xproject/typescript-typings": "^0.0.1",
 | 
				
			||||||
        "bintrees": "^1.0.2",
 | 
					        "bintrees": "^1.0.2",
 | 
				
			||||||
        "bn.js": "^4.11.8",
 | 
					        "bn.js": "^4.11.8",
 | 
				
			||||||
        "ethereumjs-abi": "^0.6.4",
 | 
					        "ethereumjs-abi": "^0.6.4",
 | 
				
			||||||
        "ethereumjs-blockstream": "^2.0.6",
 | 
					        "ethereumjs-blockstream": "^2.0.6",
 | 
				
			||||||
        "ethereumjs-util": "^5.1.1",
 | 
					        "ethereumjs-util": "^5.1.1",
 | 
				
			||||||
        "ethers-contracts": "^2.2.1",
 | 
					        "ethers-contracts": "^2.2.1",
 | 
				
			||||||
        "ethers-typescript-typings": "^0.0.4",
 | 
					 | 
				
			||||||
        "js-sha3": "^0.7.0",
 | 
					        "js-sha3": "^0.7.0",
 | 
				
			||||||
        "lodash": "^4.17.4",
 | 
					        "lodash": "^4.17.4",
 | 
				
			||||||
        "uuid": "^3.1.0",
 | 
					        "uuid": "^3.1.0",
 | 
				
			||||||
        "web3": "^0.20.0",
 | 
					        "web3": "^0.20.0"
 | 
				
			||||||
        "web3-typescript-typings": "^0.10.2"
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "publishConfig": {
 | 
					    "publishConfig": {
 | 
				
			||||||
        "access": "public"
 | 
					        "access": "public"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -216,7 +216,7 @@ describe('ZeroEx library', () => {
 | 
				
			|||||||
                s: '0x050aa3cc1f2c435e67e114cdce54b9527b4f50548342401bc5d2b77adbdacb02',
 | 
					                s: '0x050aa3cc1f2c435e67e114cdce54b9527b4f50548342401bc5d2b77adbdacb02',
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
            stubs = [
 | 
					            stubs = [
 | 
				
			||||||
                Sinon.stub((zeroEx as any)._web3Wrapper, 'signTransactionAsync').returns(Promise.resolve(signature)),
 | 
					                Sinon.stub((zeroEx as any)._web3Wrapper, 'signMessageAsync').returns(Promise.resolve(signature)),
 | 
				
			||||||
                Sinon.stub(ZeroEx, 'isValidSignature').returns(true),
 | 
					                Sinon.stub(ZeroEx, 'isValidSignature').returns(true),
 | 
				
			||||||
            ];
 | 
					            ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,10 +8,6 @@
 | 
				
			|||||||
        "./src/**/*",
 | 
					        "./src/**/*",
 | 
				
			||||||
        "./test/**/*",
 | 
					        "./test/**/*",
 | 
				
			||||||
        "../../node_modules/types-bn/index.d.ts",
 | 
					        "../../node_modules/types-bn/index.d.ts",
 | 
				
			||||||
        "../../node_modules/types-ethereumjs-util/index.d.ts",
 | 
					        "../../node_modules/types-ethereumjs-util/index.d.ts"
 | 
				
			||||||
        "../../node_modules/ethers-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/web3-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/chai-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/chai-as-promised-typescript-typings/index.d.ts"
 | 
					 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,6 +24,7 @@
 | 
				
			|||||||
    "homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md",
 | 
					    "homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md",
 | 
				
			||||||
    "dependencies": {
 | 
					    "dependencies": {
 | 
				
			||||||
        "@0xproject/utils": "^0.4.3",
 | 
					        "@0xproject/utils": "^0.4.3",
 | 
				
			||||||
 | 
					        "@0xproject/typescript-typings": "^0.0.1",
 | 
				
			||||||
        "chalk": "^2.3.0",
 | 
					        "chalk": "^2.3.0",
 | 
				
			||||||
        "glob": "^7.1.2",
 | 
					        "glob": "^7.1.2",
 | 
				
			||||||
        "handlebars": "^4.0.11",
 | 
					        "handlebars": "^4.0.11",
 | 
				
			||||||
@@ -45,8 +46,7 @@
 | 
				
			|||||||
        "npm-run-all": "^4.1.2",
 | 
					        "npm-run-all": "^4.1.2",
 | 
				
			||||||
        "shx": "^0.2.2",
 | 
					        "shx": "^0.2.2",
 | 
				
			||||||
        "tslint": "5.8.0",
 | 
					        "tslint": "5.8.0",
 | 
				
			||||||
        "typescript": "2.7.1",
 | 
					        "typescript": "2.7.1"
 | 
				
			||||||
        "web3-typescript-typings": "^0.10.2"
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "publishConfig": {
 | 
					    "publishConfig": {
 | 
				
			||||||
        "access": "public"
 | 
					        "access": "public"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,5 +3,5 @@
 | 
				
			|||||||
    "compilerOptions": {
 | 
					    "compilerOptions": {
 | 
				
			||||||
        "outDir": "lib"
 | 
					        "outDir": "lib"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "include": ["./src/**/*", "./test/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"]
 | 
					    "include": ["./src/**/*", "./test/**/*"]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,14 +8,6 @@ Standard type and schema assertions to be used across all 0x projects and packag
 | 
				
			|||||||
yarn add @0xproject/assert
 | 
					yarn add @0xproject/assert
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
"include": [
 | 
					 | 
				
			||||||
    "./node_modules/web3-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
]
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Usage
 | 
					## Usage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```typescript
 | 
					```typescript
 | 
				
			||||||
@@ -24,6 +16,14 @@ import { assert } from '@0xproject/assert';
 | 
				
			|||||||
assert.isValidBaseUnitAmount('baseUnitAmount', baseUnitAmount);
 | 
					assert.isValidBaseUnitAmount('baseUnitAmount', baseUnitAmount);
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```json
 | 
				
			||||||
 | 
					"compilerOptions": {
 | 
				
			||||||
 | 
					    "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Contributing
 | 
					## Contributing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
We strongly encourage that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
 | 
					We strongly encourage that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,6 @@
 | 
				
			|||||||
        "@types/mocha": "^2.2.42",
 | 
					        "@types/mocha": "^2.2.42",
 | 
				
			||||||
        "@types/valid-url": "^1.0.2",
 | 
					        "@types/valid-url": "^1.0.2",
 | 
				
			||||||
        "chai": "^4.0.1",
 | 
					        "chai": "^4.0.1",
 | 
				
			||||||
        "chai-typescript-typings": "^0.0.6",
 | 
					 | 
				
			||||||
        "copyfiles": "^1.2.0",
 | 
					        "copyfiles": "^1.2.0",
 | 
				
			||||||
        "dirty-chai": "^2.0.1",
 | 
					        "dirty-chai": "^2.0.1",
 | 
				
			||||||
        "mocha": "^4.0.1",
 | 
					        "mocha": "^4.0.1",
 | 
				
			||||||
@@ -45,6 +44,7 @@
 | 
				
			|||||||
    "dependencies": {
 | 
					    "dependencies": {
 | 
				
			||||||
        "@0xproject/json-schemas": "^0.7.17",
 | 
					        "@0xproject/json-schemas": "^0.7.17",
 | 
				
			||||||
        "@0xproject/utils": "^0.4.3",
 | 
					        "@0xproject/utils": "^0.4.3",
 | 
				
			||||||
 | 
					        "@0xproject/typescript-typings": "^0.0.1",
 | 
				
			||||||
        "lodash": "^4.17.4",
 | 
					        "lodash": "^4.17.4",
 | 
				
			||||||
        "valid-url": "^1.0.9"
 | 
					        "valid-url": "^1.0.9"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,10 +3,5 @@
 | 
				
			|||||||
    "compilerOptions": {
 | 
					    "compilerOptions": {
 | 
				
			||||||
        "outDir": "lib"
 | 
					        "outDir": "lib"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "include": [
 | 
					    "include": ["./src/**/*", "./test/**/*"]
 | 
				
			||||||
        "./src/**/*",
 | 
					 | 
				
			||||||
        "./test/**/*",
 | 
					 | 
				
			||||||
        "../../node_modules/web3-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/chai-typescript-typings/index.d.ts"
 | 
					 | 
				
			||||||
    ]
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,11 +10,10 @@ yarn add @0xproject/base-contract
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
					If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```json
 | 
				
			||||||
"include": [
 | 
					"compilerOptions": {
 | 
				
			||||||
    "./node_modules/web3-typescript-typings/index.d.ts",
 | 
					    "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
 | 
				
			||||||
    "./node_modules/ethers-typescript-typings/index.d.ts"
 | 
					}
 | 
				
			||||||
]
 | 
					 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Usage
 | 
					## Usage
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,11 +32,10 @@
 | 
				
			|||||||
    "dependencies": {
 | 
					    "dependencies": {
 | 
				
			||||||
        "@0xproject/types": "^0.4.1",
 | 
					        "@0xproject/types": "^0.4.1",
 | 
				
			||||||
        "@0xproject/web3-wrapper": "^0.3.1",
 | 
					        "@0xproject/web3-wrapper": "^0.3.1",
 | 
				
			||||||
 | 
					        "@0xproject/typescript-typings": "^0.0.1",
 | 
				
			||||||
        "ethers-contracts": "^2.2.1",
 | 
					        "ethers-contracts": "^2.2.1",
 | 
				
			||||||
        "ethers-typescript-typings": "^0.0.4",
 | 
					 | 
				
			||||||
        "lodash": "^4.17.4",
 | 
					        "lodash": "^4.17.4",
 | 
				
			||||||
        "web3": "^0.20.0",
 | 
					        "web3": "^0.20.0"
 | 
				
			||||||
        "web3-typescript-typings": "^0.10.2"
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "publishConfig": {
 | 
					    "publishConfig": {
 | 
				
			||||||
        "access": "public"
 | 
					        "access": "public"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,9 +3,5 @@
 | 
				
			|||||||
    "compilerOptions": {
 | 
					    "compilerOptions": {
 | 
				
			||||||
        "outDir": "lib"
 | 
					        "outDir": "lib"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "include": [
 | 
					    "include": ["./src/**/*"]
 | 
				
			||||||
        "./src/**/*",
 | 
					 | 
				
			||||||
        "../../node_modules/web3-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/ethers-typescript-typings/index.d.ts"
 | 
					 | 
				
			||||||
    ]
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +0,0 @@
 | 
				
			|||||||
.*
 | 
					 | 
				
			||||||
yarn-error.log
 | 
					 | 
				
			||||||
/scripts/
 | 
					 | 
				
			||||||
/lib/monorepo_scripts/
 | 
					 | 
				
			||||||
@@ -1,3 +0,0 @@
 | 
				
			|||||||
# CHANGELOG
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## v0.x.x - _TBD, 2018_
 | 
					 | 
				
			||||||
@@ -1,43 +0,0 @@
 | 
				
			|||||||
## chai-typescript-typings
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Fork of type definitions for chai that includes changes made by dirty-chai
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Installation
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```bash
 | 
					 | 
				
			||||||
yarn add -D chai-typescript-typings
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Usage
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Add the following line within an `include` section of your `tsconfig.json`
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```json
 | 
					 | 
				
			||||||
"./node_modules/chai-typescript-typings/index.d.ts"
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Contributing
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
We strongly encourage that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Install Dependencies
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```bash
 | 
					 | 
				
			||||||
yarn config set workspaces-experimental true
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Then install dependencies
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```bash
 | 
					 | 
				
			||||||
yarn install
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Lint
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```bash
 | 
					 | 
				
			||||||
yarn lint
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
@@ -1,6 +0,0 @@
 | 
				
			|||||||
declare module '*.json' {
 | 
					 | 
				
			||||||
    const json: any;
 | 
					 | 
				
			||||||
    /* tslint:disable */
 | 
					 | 
				
			||||||
    export default json;
 | 
					 | 
				
			||||||
    /* tslint:enable */
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,8 +0,0 @@
 | 
				
			|||||||
import { postpublishUtils } from '@0xproject/monorepo-scripts';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import * as packageJSON from '../package.json';
 | 
					 | 
				
			||||||
import * as tsConfigJSON from '../tsconfig.json';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const cwd = `${__dirname}/..`;
 | 
					 | 
				
			||||||
// tslint:disable-next-line:no-floating-promises
 | 
					 | 
				
			||||||
postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
 | 
					 | 
				
			||||||
@@ -1,28 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
    "name": "chai-typescript-typings",
 | 
					 | 
				
			||||||
    "version": "0.0.6",
 | 
					 | 
				
			||||||
    "description": "Typescript type definitions for chai",
 | 
					 | 
				
			||||||
    "main": "index.d.ts",
 | 
					 | 
				
			||||||
    "types": "index.d.ts",
 | 
					 | 
				
			||||||
    "scripts": {
 | 
					 | 
				
			||||||
        "build": "tsc && copyfiles -u 1 './lib/**/*' ./scripts",
 | 
					 | 
				
			||||||
        "clean": "shx rm -rf scripts"
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "repository": {
 | 
					 | 
				
			||||||
        "type": "git",
 | 
					 | 
				
			||||||
        "url": "git+https://github.com/0xProject/0x-monorepo.git"
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "license": "Apache-2.0",
 | 
					 | 
				
			||||||
    "bugs": {
 | 
					 | 
				
			||||||
        "url": "https://github.com/0xProject/0x-monorepo/issues"
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "homepage": "https://github.com/0xProject/0x-monorepo/packages/chai-typescript-typings#readme",
 | 
					 | 
				
			||||||
    "devDependencies": {
 | 
					 | 
				
			||||||
        "@0xproject/monorepo-scripts": "^0.1.14",
 | 
					 | 
				
			||||||
        "copyfiles": "^1.2.0",
 | 
					 | 
				
			||||||
        "shx": "^0.2.2"
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "publishConfig": {
 | 
					 | 
				
			||||||
        "access": "public"
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,7 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
    "extends": "../../tsconfig",
 | 
					 | 
				
			||||||
    "compilerOptions": {
 | 
					 | 
				
			||||||
        "outDir": "lib"
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "include": ["./monorepo_scripts/**/*"]
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,3 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
    "extends": ["tslint-config-0xproject"]
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -10,10 +10,10 @@ yarn add @0xproject/connect
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
					If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```json
 | 
				
			||||||
"include": [
 | 
					"compilerOptions": {
 | 
				
			||||||
    "./node_modules/web3-typescript-typings/index.d.ts",
 | 
					    "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
 | 
				
			||||||
]
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Usage
 | 
					## Usage
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,6 +53,7 @@
 | 
				
			|||||||
        "@0xproject/json-schemas": "^0.7.17",
 | 
					        "@0xproject/json-schemas": "^0.7.17",
 | 
				
			||||||
        "@0xproject/types": "^0.4.1",
 | 
					        "@0xproject/types": "^0.4.1",
 | 
				
			||||||
        "@0xproject/utils": "^0.4.3",
 | 
					        "@0xproject/utils": "^0.4.3",
 | 
				
			||||||
 | 
					        "@0xproject/typescript-typings": "^0.0.1",
 | 
				
			||||||
        "isomorphic-fetch": "^2.2.1",
 | 
					        "isomorphic-fetch": "^2.2.1",
 | 
				
			||||||
        "lodash": "^4.17.4",
 | 
					        "lodash": "^4.17.4",
 | 
				
			||||||
        "query-string": "^5.0.1",
 | 
					        "query-string": "^5.0.1",
 | 
				
			||||||
@@ -69,8 +70,6 @@
 | 
				
			|||||||
        "async-child-process": "^1.1.1",
 | 
					        "async-child-process": "^1.1.1",
 | 
				
			||||||
        "chai": "^4.0.1",
 | 
					        "chai": "^4.0.1",
 | 
				
			||||||
        "chai-as-promised": "^7.1.0",
 | 
					        "chai-as-promised": "^7.1.0",
 | 
				
			||||||
        "chai-as-promised-typescript-typings": "^0.0.12",
 | 
					 | 
				
			||||||
        "chai-typescript-typings": "^0.0.6",
 | 
					 | 
				
			||||||
        "copyfiles": "^1.2.0",
 | 
					        "copyfiles": "^1.2.0",
 | 
				
			||||||
        "dirty-chai": "^2.0.1",
 | 
					        "dirty-chai": "^2.0.1",
 | 
				
			||||||
        "fetch-mock": "^5.13.1",
 | 
					        "fetch-mock": "^5.13.1",
 | 
				
			||||||
@@ -80,8 +79,7 @@
 | 
				
			|||||||
        "shx": "^0.2.2",
 | 
					        "shx": "^0.2.2",
 | 
				
			||||||
        "tslint": "5.8.0",
 | 
					        "tslint": "5.8.0",
 | 
				
			||||||
        "typedoc": "~0.8.0",
 | 
					        "typedoc": "~0.8.0",
 | 
				
			||||||
        "typescript": "2.7.1",
 | 
					        "typescript": "2.7.1"
 | 
				
			||||||
        "web3-typescript-typings": "^0.10.2"
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "publishConfig": {
 | 
					    "publishConfig": {
 | 
				
			||||||
        "access": "public"
 | 
					        "access": "public"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,11 +3,5 @@
 | 
				
			|||||||
    "compilerOptions": {
 | 
					    "compilerOptions": {
 | 
				
			||||||
        "outDir": "lib"
 | 
					        "outDir": "lib"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "include": [
 | 
					    "include": ["./src/**/*", "./test/**/*"]
 | 
				
			||||||
        "./src/**/*",
 | 
					 | 
				
			||||||
        "./test/**/*",
 | 
					 | 
				
			||||||
        "../../node_modules/web3-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/chai-as-promised-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/chai-typescript-typings/index.d.ts"
 | 
					 | 
				
			||||||
    ]
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,12 +49,9 @@
 | 
				
			|||||||
        "@types/yargs": "^10.0.0",
 | 
					        "@types/yargs": "^10.0.0",
 | 
				
			||||||
        "chai": "^4.0.1",
 | 
					        "chai": "^4.0.1",
 | 
				
			||||||
        "chai-as-promised": "^7.1.0",
 | 
					        "chai-as-promised": "^7.1.0",
 | 
				
			||||||
        "chai-as-promised-typescript-typings": "^0.0.12",
 | 
					 | 
				
			||||||
        "chai-bignumber": "^2.0.1",
 | 
					        "chai-bignumber": "^2.0.1",
 | 
				
			||||||
        "chai-typescript-typings": "^0.0.6",
 | 
					 | 
				
			||||||
        "copyfiles": "^1.2.0",
 | 
					        "copyfiles": "^1.2.0",
 | 
				
			||||||
        "dirty-chai": "^2.0.1",
 | 
					        "dirty-chai": "^2.0.1",
 | 
				
			||||||
        "ethers-typescript-typings": "^0.0.4",
 | 
					 | 
				
			||||||
        "mocha": "^4.0.1",
 | 
					        "mocha": "^4.0.1",
 | 
				
			||||||
        "npm-run-all": "^4.1.2",
 | 
					        "npm-run-all": "^4.1.2",
 | 
				
			||||||
        "prettier": "^1.11.1",
 | 
					        "prettier": "^1.11.1",
 | 
				
			||||||
@@ -64,7 +61,6 @@
 | 
				
			|||||||
        "types-bn": "^0.0.1",
 | 
					        "types-bn": "^0.0.1",
 | 
				
			||||||
        "types-ethereumjs-util": "0xProject/types-ethereumjs-util",
 | 
					        "types-ethereumjs-util": "0xProject/types-ethereumjs-util",
 | 
				
			||||||
        "typescript": "2.7.1",
 | 
					        "typescript": "2.7.1",
 | 
				
			||||||
        "web3-typescript-typings": "^0.10.2",
 | 
					 | 
				
			||||||
        "yargs": "^10.0.3"
 | 
					        "yargs": "^10.0.3"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "dependencies": {
 | 
					    "dependencies": {
 | 
				
			||||||
@@ -74,6 +70,7 @@
 | 
				
			|||||||
        "@0xproject/types": "^0.4.1",
 | 
					        "@0xproject/types": "^0.4.1",
 | 
				
			||||||
        "@0xproject/utils": "^0.4.3",
 | 
					        "@0xproject/utils": "^0.4.3",
 | 
				
			||||||
        "@0xproject/web3-wrapper": "^0.3.1",
 | 
					        "@0xproject/web3-wrapper": "^0.3.1",
 | 
				
			||||||
 | 
					        "@0xproject/typescript-typings": "^0.0.1",
 | 
				
			||||||
        "bluebird": "^3.5.0",
 | 
					        "bluebird": "^3.5.0",
 | 
				
			||||||
        "bn.js": "^4.11.8",
 | 
					        "bn.js": "^4.11.8",
 | 
				
			||||||
        "ethereumjs-abi": "^0.6.4",
 | 
					        "ethereumjs-abi": "^0.6.4",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,11 +8,6 @@
 | 
				
			|||||||
        "allowJs": true
 | 
					        "allowJs": true
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "include": [
 | 
					    "include": [
 | 
				
			||||||
        "../../node_modules/types-ethereumjs-util/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/chai-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/web3-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/ethers-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/chai-as-promised-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/types-ethereumjs-util/index.d.ts",
 | 
					        "../../node_modules/types-ethereumjs-util/index.d.ts",
 | 
				
			||||||
        "../../node_modules/types-bn/index.d.ts",
 | 
					        "../../node_modules/types-bn/index.d.ts",
 | 
				
			||||||
        "./globals.d.ts",
 | 
					        "./globals.d.ts",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,6 +18,14 @@ yarn global add @0xproject/deployer
 | 
				
			|||||||
yarn add @0xproject/deployer
 | 
					yarn add @0xproject/deployer
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```json
 | 
				
			||||||
 | 
					"compilerOptions": {
 | 
				
			||||||
 | 
					    "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Import**
 | 
					**Import**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```typescript
 | 
					```typescript
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,8 @@
 | 
				
			|||||||
    "scripts": {
 | 
					    "scripts": {
 | 
				
			||||||
        "build:watch": "tsc -w",
 | 
					        "build:watch": "tsc -w",
 | 
				
			||||||
        "build": "yarn clean && copyfiles 'test/fixtures/contracts/**/*' ./lib && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
 | 
					        "build": "yarn clean && copyfiles 'test/fixtures/contracts/**/*' ./lib && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
 | 
				
			||||||
        "test": "npm run build; mocha lib/test/*_test.js",
 | 
					        "test": "run-s build run_mocha",
 | 
				
			||||||
 | 
					        "run_mocha": "mocha lib/test/*_test.js",
 | 
				
			||||||
        "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
 | 
					        "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
 | 
				
			||||||
        "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
 | 
					        "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
 | 
				
			||||||
        "compile": "npm run build; node lib/src/cli.js compile",
 | 
					        "compile": "npm run build; node lib/src/cli.js compile",
 | 
				
			||||||
@@ -46,10 +47,12 @@
 | 
				
			|||||||
        "@0xproject/monorepo-scripts": "^0.1.14",
 | 
					        "@0xproject/monorepo-scripts": "^0.1.14",
 | 
				
			||||||
        "@0xproject/tslint-config": "^0.4.12",
 | 
					        "@0xproject/tslint-config": "^0.4.12",
 | 
				
			||||||
        "@types/require-from-string": "^1.2.0",
 | 
					        "@types/require-from-string": "^1.2.0",
 | 
				
			||||||
 | 
					        "@types/semver": "^5.5.0",
 | 
				
			||||||
        "@types/yargs": "^11.0.0",
 | 
					        "@types/yargs": "^11.0.0",
 | 
				
			||||||
 | 
					        "npm-run-all": "^4.1.2",
 | 
				
			||||||
        "chai": "^4.0.1",
 | 
					        "chai": "^4.0.1",
 | 
				
			||||||
        "copyfiles": "^1.2.0",
 | 
					        "copyfiles": "^1.2.0",
 | 
				
			||||||
        "ethers-typescript-typings": "^0.0.4",
 | 
					        "dirty-chai": "^2.0.1",
 | 
				
			||||||
        "mocha": "^4.0.1",
 | 
					        "mocha": "^4.0.1",
 | 
				
			||||||
        "nyc": "^11.0.1",
 | 
					        "nyc": "^11.0.1",
 | 
				
			||||||
        "shx": "^0.2.2",
 | 
					        "shx": "^0.2.2",
 | 
				
			||||||
@@ -64,10 +67,12 @@
 | 
				
			|||||||
        "@0xproject/types": "^0.4.1",
 | 
					        "@0xproject/types": "^0.4.1",
 | 
				
			||||||
        "@0xproject/utils": "^0.4.3",
 | 
					        "@0xproject/utils": "^0.4.3",
 | 
				
			||||||
        "@0xproject/web3-wrapper": "^0.3.1",
 | 
					        "@0xproject/web3-wrapper": "^0.3.1",
 | 
				
			||||||
 | 
					        "@0xproject/typescript-typings": "^0.0.1",
 | 
				
			||||||
        "ethereumjs-util": "^5.1.1",
 | 
					        "ethereumjs-util": "^5.1.1",
 | 
				
			||||||
        "isomorphic-fetch": "^2.2.1",
 | 
					        "isomorphic-fetch": "^2.2.1",
 | 
				
			||||||
        "lodash": "^4.17.4",
 | 
					        "lodash": "^4.17.4",
 | 
				
			||||||
        "require-from-string": "^2.0.1",
 | 
					        "require-from-string": "^2.0.1",
 | 
				
			||||||
 | 
					        "semver": "^5.5.0",
 | 
				
			||||||
        "solc": "^0.4.18",
 | 
					        "solc": "^0.4.18",
 | 
				
			||||||
        "web3": "^0.20.0",
 | 
					        "web3": "^0.20.0",
 | 
				
			||||||
        "web3-eth-abi": "^1.0.0-beta.24",
 | 
					        "web3-eth-abi": "^1.0.0-beta.24",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,6 +10,7 @@ import * as yargs from 'yargs';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import { commands } from './commands';
 | 
					import { commands } from './commands';
 | 
				
			||||||
import { constants } from './utils/constants';
 | 
					import { constants } from './utils/constants';
 | 
				
			||||||
 | 
					import { consoleReporter } from './utils/error_reporter';
 | 
				
			||||||
import { CliOptions, CompilerOptions, DeployerOptions } from './utils/types';
 | 
					import { CliOptions, CompilerOptions, DeployerOptions } from './utils/types';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const DEFAULT_OPTIMIZER_ENABLED = false;
 | 
					const DEFAULT_OPTIMIZER_ENABLED = false;
 | 
				
			||||||
@@ -24,11 +25,11 @@ const DEFAULT_CONTRACTS_LIST = '*';
 | 
				
			|||||||
 * Compiles all contracts with options passed in through CLI.
 | 
					 * Compiles all contracts with options passed in through CLI.
 | 
				
			||||||
 * @param argv Instance of process.argv provided by yargs.
 | 
					 * @param argv Instance of process.argv provided by yargs.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
async function onCompileCommand(argv: CliOptions): Promise<void> {
 | 
					async function onCompileCommandAsync(argv: CliOptions): Promise<void> {
 | 
				
			||||||
    const opts: CompilerOptions = {
 | 
					    const opts: CompilerOptions = {
 | 
				
			||||||
        contractsDir: argv.contractsDir,
 | 
					        contractsDir: argv.contractsDir,
 | 
				
			||||||
        networkId: argv.networkId,
 | 
					        networkId: argv.networkId,
 | 
				
			||||||
        optimizerEnabled: argv.shouldOptimize ? 1 : 0,
 | 
					        optimizerEnabled: argv.shouldOptimize,
 | 
				
			||||||
        artifactsDir: argv.artifactsDir,
 | 
					        artifactsDir: argv.artifactsDir,
 | 
				
			||||||
        specifiedContracts: getContractsSetFromList(argv.contracts),
 | 
					        specifiedContracts: getContractsSetFromList(argv.contracts),
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
@@ -38,7 +39,7 @@ async function onCompileCommand(argv: CliOptions): Promise<void> {
 | 
				
			|||||||
 * Deploys a single contract with provided name and args.
 | 
					 * Deploys a single contract with provided name and args.
 | 
				
			||||||
 * @param argv Instance of process.argv provided by yargs.
 | 
					 * @param argv Instance of process.argv provided by yargs.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
async function onDeployCommand(argv: CliOptions): Promise<void> {
 | 
					async function onDeployCommandAsync(argv: CliOptions): Promise<void> {
 | 
				
			||||||
    const url = argv.jsonrpcUrl;
 | 
					    const url = argv.jsonrpcUrl;
 | 
				
			||||||
    const web3Provider = new Web3.providers.HttpProvider(url);
 | 
					    const web3Provider = new Web3.providers.HttpProvider(url);
 | 
				
			||||||
    const web3Wrapper = new Web3Wrapper(web3Provider);
 | 
					    const web3Wrapper = new Web3Wrapper(web3Provider);
 | 
				
			||||||
@@ -46,7 +47,7 @@ async function onDeployCommand(argv: CliOptions): Promise<void> {
 | 
				
			|||||||
    const compilerOpts: CompilerOptions = {
 | 
					    const compilerOpts: CompilerOptions = {
 | 
				
			||||||
        contractsDir: argv.contractsDir,
 | 
					        contractsDir: argv.contractsDir,
 | 
				
			||||||
        networkId,
 | 
					        networkId,
 | 
				
			||||||
        optimizerEnabled: argv.shouldOptimize ? 1 : 0,
 | 
					        optimizerEnabled: argv.shouldOptimize,
 | 
				
			||||||
        artifactsDir: argv.artifactsDir,
 | 
					        artifactsDir: argv.artifactsDir,
 | 
				
			||||||
        specifiedContracts: getContractsSetFromList(argv.contracts),
 | 
					        specifiedContracts: getContractsSetFromList(argv.contracts),
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
@@ -62,9 +63,9 @@ async function onDeployCommand(argv: CliOptions): Promise<void> {
 | 
				
			|||||||
        networkId,
 | 
					        networkId,
 | 
				
			||||||
        defaults,
 | 
					        defaults,
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    const deployerArgsString = argv.args;
 | 
					    const deployerArgsString = argv.args as string;
 | 
				
			||||||
    const deployerArgs = deployerArgsString.split(',');
 | 
					    const deployerArgs = deployerArgsString.split(',');
 | 
				
			||||||
    await commands.deployAsync(argv.contract, deployerArgs, deployerOpts);
 | 
					    await commands.deployAsync(argv.contract as string, deployerArgs, deployerOpts);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Creates a set of contracts to compile.
 | 
					 * Creates a set of contracts to compile.
 | 
				
			||||||
@@ -142,7 +143,12 @@ function deployCommandBuilder(yargsInstance: any) {
 | 
				
			|||||||
            default: DEFAULT_CONTRACTS_LIST,
 | 
					            default: DEFAULT_CONTRACTS_LIST,
 | 
				
			||||||
            description: 'comma separated list of contracts to compile',
 | 
					            description: 'comma separated list of contracts to compile',
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
        .command('compile', 'compile contracts', identityCommandBuilder, onCompileCommand)
 | 
					        .command('compile', 'compile contracts', identityCommandBuilder, consoleReporter(onCompileCommandAsync))
 | 
				
			||||||
        .command('deploy', 'deploy a single contract with provided arguments', deployCommandBuilder, onDeployCommand)
 | 
					        .command(
 | 
				
			||||||
 | 
					            'deploy',
 | 
				
			||||||
 | 
					            'deploy a single contract with provided arguments',
 | 
				
			||||||
 | 
					            deployCommandBuilder,
 | 
				
			||||||
 | 
					            consoleReporter(onDeployCommandAsync),
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        .help().argv;
 | 
					        .help().argv;
 | 
				
			||||||
})();
 | 
					})();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@ import { CompilerOptions, DeployerOptions } from './utils/types';
 | 
				
			|||||||
export const commands = {
 | 
					export const commands = {
 | 
				
			||||||
    async compileAsync(opts: CompilerOptions): Promise<void> {
 | 
					    async compileAsync(opts: CompilerOptions): Promise<void> {
 | 
				
			||||||
        const compiler = new Compiler(opts);
 | 
					        const compiler = new Compiler(opts);
 | 
				
			||||||
        await compiler.compileAllAsync();
 | 
					        await compiler.compileAsync();
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    async deployAsync(contractName: string, args: any[], opts: DeployerOptions): Promise<void> {
 | 
					    async deployAsync(contractName: string, args: any[], opts: DeployerOptions): Promise<void> {
 | 
				
			||||||
        const deployer = new Deployer(opts);
 | 
					        const deployer = new Deployer(opts);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,10 +5,19 @@ import 'isomorphic-fetch';
 | 
				
			|||||||
import * as _ from 'lodash';
 | 
					import * as _ from 'lodash';
 | 
				
			||||||
import * as path from 'path';
 | 
					import * as path from 'path';
 | 
				
			||||||
import * as requireFromString from 'require-from-string';
 | 
					import * as requireFromString from 'require-from-string';
 | 
				
			||||||
 | 
					import * as semver from 'semver';
 | 
				
			||||||
import solc = require('solc');
 | 
					import solc = require('solc');
 | 
				
			||||||
import * as Web3 from 'web3';
 | 
					import * as Web3 from 'web3';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { binPaths } from './solc/bin_paths';
 | 
					import { binPaths } from './solc/bin_paths';
 | 
				
			||||||
 | 
					import {
 | 
				
			||||||
 | 
					    createArtifactsDirIfDoesNotExistAsync,
 | 
				
			||||||
 | 
					    findImportIfExist,
 | 
				
			||||||
 | 
					    getContractArtifactIfExistsAsync,
 | 
				
			||||||
 | 
					    getNormalizedErrMsg,
 | 
				
			||||||
 | 
					    parseDependencies,
 | 
				
			||||||
 | 
					    parseSolidityVersionRange,
 | 
				
			||||||
 | 
					} from './utils/compiler';
 | 
				
			||||||
import { constants } from './utils/constants';
 | 
					import { constants } from './utils/constants';
 | 
				
			||||||
import { fsWrapper } from './utils/fs_wrapper';
 | 
					import { fsWrapper } from './utils/fs_wrapper';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
@@ -23,10 +32,6 @@ import {
 | 
				
			|||||||
import { utils } from './utils/utils';
 | 
					import { utils } from './utils/utils';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const ALL_CONTRACTS_IDENTIFIER = '*';
 | 
					const ALL_CONTRACTS_IDENTIFIER = '*';
 | 
				
			||||||
const SOLIDITY_VERSION_REGEX = /(?:solidity\s\^?)(\d+\.\d+\.\d+)/;
 | 
					 | 
				
			||||||
const SOLIDITY_FILE_EXTENSION_REGEX = /(.*\.sol)/;
 | 
					 | 
				
			||||||
const IMPORT_REGEX = /(import\s)/;
 | 
					 | 
				
			||||||
const DEPENDENCY_PATH_REGEX = /"([^"]+)"/; // Source: https://github.com/BlockChainCompany/soljitsu/blob/master/lib/shared.js
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * The Compiler facilitates compiling Solidity smart contracts and saves the results
 | 
					 * The Compiler facilitates compiling Solidity smart contracts and saves the results
 | 
				
			||||||
@@ -35,9 +40,10 @@ const DEPENDENCY_PATH_REGEX = /"([^"]+)"/; // Source: https://github.com/BlockCh
 | 
				
			|||||||
export class Compiler {
 | 
					export class Compiler {
 | 
				
			||||||
    private _contractsDir: string;
 | 
					    private _contractsDir: string;
 | 
				
			||||||
    private _networkId: number;
 | 
					    private _networkId: number;
 | 
				
			||||||
    private _optimizerEnabled: number;
 | 
					    private _optimizerEnabled: boolean;
 | 
				
			||||||
    private _artifactsDir: string;
 | 
					    private _artifactsDir: string;
 | 
				
			||||||
    private _contractSources?: ContractSources;
 | 
					    // This get's set in the beggining of `compileAsync` function. It's not called from a constructor, but it's the only public method of that class and could as well be.
 | 
				
			||||||
 | 
					    private _contractSources!: ContractSources;
 | 
				
			||||||
    private _solcErrors: Set<string> = new Set();
 | 
					    private _solcErrors: Set<string> = new Set();
 | 
				
			||||||
    private _specifiedContracts: Set<string> = new Set();
 | 
					    private _specifiedContracts: Set<string> = new Set();
 | 
				
			||||||
    private _contractSourceData: ContractSourceData = {};
 | 
					    private _contractSourceData: ContractSourceData = {};
 | 
				
			||||||
@@ -81,64 +87,6 @@ export class Compiler {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        return sources;
 | 
					        return sources;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets contract dependendencies and keccak256 hash from source.
 | 
					 | 
				
			||||||
     * @param source Source code of contract.
 | 
					 | 
				
			||||||
     * @return Object with contract dependencies and keccak256 hash of source.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private static _getContractSpecificSourceData(source: string): ContractSpecificSourceData {
 | 
					 | 
				
			||||||
        const dependencies: string[] = [];
 | 
					 | 
				
			||||||
        const sourceHash = ethUtil.sha3(source);
 | 
					 | 
				
			||||||
        const solcVersion = Compiler._parseSolidityVersion(source);
 | 
					 | 
				
			||||||
        const contractSpecificSourceData: ContractSpecificSourceData = {
 | 
					 | 
				
			||||||
            dependencies,
 | 
					 | 
				
			||||||
            solcVersion,
 | 
					 | 
				
			||||||
            sourceHash,
 | 
					 | 
				
			||||||
        };
 | 
					 | 
				
			||||||
        const lines = source.split('\n');
 | 
					 | 
				
			||||||
        _.forEach(lines, line => {
 | 
					 | 
				
			||||||
            if (!_.isNull(line.match(IMPORT_REGEX))) {
 | 
					 | 
				
			||||||
                const dependencyMatch = line.match(DEPENDENCY_PATH_REGEX);
 | 
					 | 
				
			||||||
                if (!_.isNull(dependencyMatch)) {
 | 
					 | 
				
			||||||
                    const dependencyPath = dependencyMatch[1];
 | 
					 | 
				
			||||||
                    const fileName = path.basename(dependencyPath);
 | 
					 | 
				
			||||||
                    contractSpecificSourceData.dependencies.push(fileName);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
        return contractSpecificSourceData;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Searches Solidity source code for compiler version.
 | 
					 | 
				
			||||||
     * @param  source Source code of contract.
 | 
					 | 
				
			||||||
     * @return Solc compiler version.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private static _parseSolidityVersion(source: string): string {
 | 
					 | 
				
			||||||
        const solcVersionMatch = source.match(SOLIDITY_VERSION_REGEX);
 | 
					 | 
				
			||||||
        if (_.isNull(solcVersionMatch)) {
 | 
					 | 
				
			||||||
            throw new Error('Could not find Solidity version in source');
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        const solcVersion = solcVersionMatch[1];
 | 
					 | 
				
			||||||
        return solcVersion;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Normalizes the path found in the error message.
 | 
					 | 
				
			||||||
     * Example: converts 'base/Token.sol:6:46: Warning: Unused local variable'
 | 
					 | 
				
			||||||
     *          to 'Token.sol:6:46: Warning: Unused local variable'
 | 
					 | 
				
			||||||
     * This is used to prevent logging the same error multiple times.
 | 
					 | 
				
			||||||
     * @param  errMsg An error message from the compiled output.
 | 
					 | 
				
			||||||
     * @return The error message with directories truncated from the contract path.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private static _getNormalizedErrMsg(errMsg: string): string {
 | 
					 | 
				
			||||||
        const errPathMatch = errMsg.match(SOLIDITY_FILE_EXTENSION_REGEX);
 | 
					 | 
				
			||||||
        if (_.isNull(errPathMatch)) {
 | 
					 | 
				
			||||||
            throw new Error('Could not find a path in error message');
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        const errPath = errPathMatch[0];
 | 
					 | 
				
			||||||
        const baseContract = path.basename(errPath);
 | 
					 | 
				
			||||||
        const normalizedErrMsg = errMsg.replace(errPath, baseContract);
 | 
					 | 
				
			||||||
        return normalizedErrMsg;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Instantiates a new instance of the Compiler class.
 | 
					     * Instantiates a new instance of the Compiler class.
 | 
				
			||||||
     * @param opts Options specifying directories, network, and optimization settings.
 | 
					     * @param opts Options specifying directories, network, and optimization settings.
 | 
				
			||||||
@@ -152,21 +100,18 @@ export class Compiler {
 | 
				
			|||||||
        this._specifiedContracts = opts.specifiedContracts;
 | 
					        this._specifiedContracts = opts.specifiedContracts;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Compiles all Solidity files found in `contractsDir` and writes JSON artifacts to `artifactsDir`.
 | 
					     * Compiles selected Solidity files found in `contractsDir` and writes JSON artifacts to `artifactsDir`.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public async compileAllAsync(): Promise<void> {
 | 
					    public async compileAsync(): Promise<void> {
 | 
				
			||||||
        await this._createArtifactsDirIfDoesNotExistAsync();
 | 
					        await createArtifactsDirIfDoesNotExistAsync(this._artifactsDir);
 | 
				
			||||||
        this._contractSources = await Compiler._getContractSourcesAsync(this._contractsDir);
 | 
					        this._contractSources = await Compiler._getContractSourcesAsync(this._contractsDir);
 | 
				
			||||||
        _.forIn(this._contractSources, (source, fileName) => {
 | 
					        _.forIn(this._contractSources, this._setContractSpecificSourceData.bind(this));
 | 
				
			||||||
            this._contractSourceData[fileName] = Compiler._getContractSpecificSourceData(source);
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
        const fileNames = this._specifiedContracts.has(ALL_CONTRACTS_IDENTIFIER)
 | 
					        const fileNames = this._specifiedContracts.has(ALL_CONTRACTS_IDENTIFIER)
 | 
				
			||||||
            ? _.keys(this._contractSources)
 | 
					            ? _.keys(this._contractSources)
 | 
				
			||||||
            : Array.from(this._specifiedContracts.values());
 | 
					            : Array.from(this._specifiedContracts.values());
 | 
				
			||||||
        _.forEach(fileNames, fileName => {
 | 
					        for (const fileName of fileNames) {
 | 
				
			||||||
            this._setSourceTreeHash(fileName);
 | 
					            await this._compileContractAsync(fileName);
 | 
				
			||||||
        });
 | 
					        }
 | 
				
			||||||
        await Promise.all(_.map(fileNames, async fileName => this._compileContractAsync(fileName)));
 | 
					 | 
				
			||||||
        this._solcErrors.forEach(errMsg => {
 | 
					        this._solcErrors.forEach(errMsg => {
 | 
				
			||||||
            logUtils.log(errMsg);
 | 
					            logUtils.log(errMsg);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
@@ -180,19 +125,28 @@ export class Compiler {
 | 
				
			|||||||
            throw new Error('Contract sources not yet initialized');
 | 
					            throw new Error('Contract sources not yet initialized');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        const contractSpecificSourceData = this._contractSourceData[fileName];
 | 
					        const contractSpecificSourceData = this._contractSourceData[fileName];
 | 
				
			||||||
        const currentArtifactIfExists = (await this._getContractArtifactIfExistsAsync(fileName)) as ContractArtifact;
 | 
					        const currentArtifactIfExists = await getContractArtifactIfExistsAsync(this._artifactsDir, fileName);
 | 
				
			||||||
        const sourceHash = `0x${contractSpecificSourceData.sourceHash.toString('hex')}`;
 | 
					        const sourceHash = `0x${contractSpecificSourceData.sourceHash.toString('hex')}`;
 | 
				
			||||||
        const sourceTreeHash = `0x${contractSpecificSourceData.sourceTreeHashIfExists.toString('hex')}`;
 | 
					        const sourceTreeHash = `0x${contractSpecificSourceData.sourceTreeHash.toString('hex')}`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const shouldCompile =
 | 
					        let shouldCompile = false;
 | 
				
			||||||
            _.isUndefined(currentArtifactIfExists) ||
 | 
					        if (_.isUndefined(currentArtifactIfExists)) {
 | 
				
			||||||
            currentArtifactIfExists.networks[this._networkId].optimizer_enabled !== this._optimizerEnabled ||
 | 
					            shouldCompile = true;
 | 
				
			||||||
            currentArtifactIfExists.networks[this._networkId].source_tree_hash !== sourceTreeHash;
 | 
					        } else {
 | 
				
			||||||
 | 
					            const currentArtifact = currentArtifactIfExists as ContractArtifact;
 | 
				
			||||||
 | 
					            shouldCompile =
 | 
				
			||||||
 | 
					                currentArtifact.networks[this._networkId].optimizer_enabled !== this._optimizerEnabled ||
 | 
				
			||||||
 | 
					                currentArtifact.networks[this._networkId].source_tree_hash !== sourceTreeHash;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        if (!shouldCompile) {
 | 
					        if (!shouldCompile) {
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        const availableCompilerVersions = _.keys(binPaths);
 | 
				
			||||||
        const fullSolcVersion = binPaths[contractSpecificSourceData.solcVersion];
 | 
					        const solcVersion = semver.maxSatisfying(
 | 
				
			||||||
 | 
					            availableCompilerVersions,
 | 
				
			||||||
 | 
					            contractSpecificSourceData.solcVersionRange,
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					        const fullSolcVersion = binPaths[solcVersion];
 | 
				
			||||||
        const compilerBinFilename = path.join(__dirname, '../../solc_bin', fullSolcVersion);
 | 
					        const compilerBinFilename = path.join(__dirname, '../../solc_bin', fullSolcVersion);
 | 
				
			||||||
        let solcjs: string;
 | 
					        let solcjs: string;
 | 
				
			||||||
        const isCompilerAvailableLocally = fs.existsSync(compilerBinFilename);
 | 
					        const isCompilerAvailableLocally = fs.existsSync(compilerBinFilename);
 | 
				
			||||||
@@ -210,7 +164,7 @@ export class Compiler {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename));
 | 
					        const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        logUtils.log(`Compiling ${fileName}...`);
 | 
					        logUtils.log(`Compiling ${fileName} with Solidity v${solcVersion}...`);
 | 
				
			||||||
        const source = this._contractSources[fileName];
 | 
					        const source = this._contractSources[fileName];
 | 
				
			||||||
        const input = {
 | 
					        const input = {
 | 
				
			||||||
            [fileName]: source,
 | 
					            [fileName]: source,
 | 
				
			||||||
@@ -218,20 +172,23 @@ export class Compiler {
 | 
				
			|||||||
        const sourcesToCompile = {
 | 
					        const sourcesToCompile = {
 | 
				
			||||||
            sources: input,
 | 
					            sources: input,
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        const compiled = solcInstance.compile(
 | 
					        const compiled = solcInstance.compile(sourcesToCompile, Number(this._optimizerEnabled), importPath =>
 | 
				
			||||||
            sourcesToCompile,
 | 
					            findImportIfExist(this._contractSources, importPath),
 | 
				
			||||||
            this._optimizerEnabled,
 | 
					 | 
				
			||||||
            this._findImportsIfSourcesExist.bind(this),
 | 
					 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!_.isUndefined(compiled.errors)) {
 | 
					        if (!_.isUndefined(compiled.errors)) {
 | 
				
			||||||
            _.forEach(compiled.errors, errMsg => {
 | 
					            _.forEach(compiled.errors, errMsg => {
 | 
				
			||||||
                const normalizedErrMsg = Compiler._getNormalizedErrMsg(errMsg);
 | 
					                const normalizedErrMsg = getNormalizedErrMsg(errMsg);
 | 
				
			||||||
                this._solcErrors.add(normalizedErrMsg);
 | 
					                this._solcErrors.add(normalizedErrMsg);
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        const contractName = path.basename(fileName, constants.SOLIDITY_FILE_EXTENSION);
 | 
					        const contractName = path.basename(fileName, constants.SOLIDITY_FILE_EXTENSION);
 | 
				
			||||||
        const contractIdentifier = `${fileName}:${contractName}`;
 | 
					        const contractIdentifier = `${fileName}:${contractName}`;
 | 
				
			||||||
 | 
					        if (_.isUndefined(compiled.contracts[contractIdentifier])) {
 | 
				
			||||||
 | 
					            throw new Error(
 | 
				
			||||||
 | 
					                `Contract ${contractName} not found in ${fileName}. Please make sure your contract has the same name as it's file name`,
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        const abi: Web3.ContractAbi = JSON.parse(compiled.contracts[contractIdentifier].interface);
 | 
					        const abi: Web3.ContractAbi = JSON.parse(compiled.contracts[contractIdentifier].interface);
 | 
				
			||||||
        const bytecode = `0x${compiled.contracts[contractIdentifier].bytecode}`;
 | 
					        const bytecode = `0x${compiled.contracts[contractIdentifier].bytecode}`;
 | 
				
			||||||
        const runtimeBytecode = `0x${compiled.contracts[contractIdentifier].runtimeBytecode}`;
 | 
					        const runtimeBytecode = `0x${compiled.contracts[contractIdentifier].runtimeBytecode}`;
 | 
				
			||||||
@@ -240,7 +197,7 @@ export class Compiler {
 | 
				
			|||||||
        const sources = _.keys(compiled.sources);
 | 
					        const sources = _.keys(compiled.sources);
 | 
				
			||||||
        const updated_at = Date.now();
 | 
					        const updated_at = Date.now();
 | 
				
			||||||
        const contractNetworkData: ContractNetworkData = {
 | 
					        const contractNetworkData: ContractNetworkData = {
 | 
				
			||||||
            solc_version: contractSpecificSourceData.solcVersion,
 | 
					            solc_version: solcVersion,
 | 
				
			||||||
            keccak256: sourceHash,
 | 
					            keccak256: sourceHash,
 | 
				
			||||||
            source_tree_hash: sourceTreeHash,
 | 
					            source_tree_hash: sourceTreeHash,
 | 
				
			||||||
            optimizer_enabled: this._optimizerEnabled,
 | 
					            optimizer_enabled: this._optimizerEnabled,
 | 
				
			||||||
@@ -255,10 +212,11 @@ export class Compiler {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        let newArtifact: ContractArtifact;
 | 
					        let newArtifact: ContractArtifact;
 | 
				
			||||||
        if (!_.isUndefined(currentArtifactIfExists)) {
 | 
					        if (!_.isUndefined(currentArtifactIfExists)) {
 | 
				
			||||||
 | 
					            const currentArtifact = currentArtifactIfExists as ContractArtifact;
 | 
				
			||||||
            newArtifact = {
 | 
					            newArtifact = {
 | 
				
			||||||
                ...currentArtifactIfExists,
 | 
					                ...currentArtifact,
 | 
				
			||||||
                networks: {
 | 
					                networks: {
 | 
				
			||||||
                    ...currentArtifactIfExists.networks,
 | 
					                    ...currentArtifact.networks,
 | 
				
			||||||
                    [this._networkId]: contractNetworkData,
 | 
					                    [this._networkId]: contractNetworkData,
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
@@ -277,79 +235,42 @@ export class Compiler {
 | 
				
			|||||||
        logUtils.log(`${fileName} artifact saved!`);
 | 
					        logUtils.log(`${fileName} artifact saved!`);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Sets the source tree hash for a file and its dependencies.
 | 
					     * Gets contract dependendencies and keccak256 hash from source.
 | 
				
			||||||
     * @param fileName Name of contract file.
 | 
					     * @param source Source code of contract.
 | 
				
			||||||
 | 
					     * @return Object with contract dependencies and keccak256 hash of source.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private _setSourceTreeHash(fileName: string): void {
 | 
					    private _setContractSpecificSourceData(source: string, fileName: string): void {
 | 
				
			||||||
        const contractSpecificSourceData = this._contractSourceData[fileName];
 | 
					        if (!_.isUndefined(this._contractSourceData[fileName])) {
 | 
				
			||||||
        if (_.isUndefined(contractSpecificSourceData)) {
 | 
					            return;
 | 
				
			||||||
            throw new Error(`Contract data for ${fileName} not yet set`);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (_.isUndefined(contractSpecificSourceData.sourceTreeHashIfExists)) {
 | 
					        const sourceHash = ethUtil.sha3(source);
 | 
				
			||||||
            const dependencies = contractSpecificSourceData.dependencies;
 | 
					        const solcVersionRange = parseSolidityVersionRange(source);
 | 
				
			||||||
            if (dependencies.length === 0) {
 | 
					        const dependencies = parseDependencies(source);
 | 
				
			||||||
                contractSpecificSourceData.sourceTreeHashIfExists = contractSpecificSourceData.sourceHash;
 | 
					        const sourceTreeHash = this._getSourceTreeHash(fileName, sourceHash, dependencies);
 | 
				
			||||||
            } else {
 | 
					        this._contractSourceData[fileName] = {
 | 
				
			||||||
                _.forEach(dependencies, dependency => {
 | 
					            dependencies,
 | 
				
			||||||
                    this._setSourceTreeHash(dependency);
 | 
					            solcVersionRange,
 | 
				
			||||||
                });
 | 
					            sourceHash,
 | 
				
			||||||
                const dependencySourceTreeHashes = _.map(
 | 
					            sourceTreeHash,
 | 
				
			||||||
                    dependencies,
 | 
					 | 
				
			||||||
                    dependency => this._contractSourceData[dependency].sourceTreeHashIfExists,
 | 
					 | 
				
			||||||
                );
 | 
					 | 
				
			||||||
                const sourceTreeHashesBuffer = Buffer.concat([
 | 
					 | 
				
			||||||
                    contractSpecificSourceData.sourceHash,
 | 
					 | 
				
			||||||
                    ...dependencySourceTreeHashes,
 | 
					 | 
				
			||||||
                ]);
 | 
					 | 
				
			||||||
                contractSpecificSourceData.sourceTreeHashIfExists = ethUtil.sha3(sourceTreeHashesBuffer);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Callback to resolve dependencies with `solc.compile`.
 | 
					 | 
				
			||||||
     * Throws error if contractSources not yet initialized.
 | 
					 | 
				
			||||||
     * @param  importPath Path to an imported dependency.
 | 
					 | 
				
			||||||
     * @return Import contents object containing source code of dependency.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private _findImportsIfSourcesExist(importPath: string): solc.ImportContents {
 | 
					 | 
				
			||||||
        const fileName = path.basename(importPath);
 | 
					 | 
				
			||||||
        const source = this._contractSources[fileName];
 | 
					 | 
				
			||||||
        if (_.isUndefined(source)) {
 | 
					 | 
				
			||||||
            throw new Error(`Contract source not found for ${fileName}`);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        const importContents: solc.ImportContents = {
 | 
					 | 
				
			||||||
            contents: source,
 | 
					 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        return importContents;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Creates the artifacts directory if it does not already exist.
 | 
					     * Gets the source tree hash for a file and its dependencies.
 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private async _createArtifactsDirIfDoesNotExistAsync(): Promise<void> {
 | 
					 | 
				
			||||||
        if (!fsWrapper.doesPathExistSync(this._artifactsDir)) {
 | 
					 | 
				
			||||||
            logUtils.log('Creating artifacts directory...');
 | 
					 | 
				
			||||||
            await fsWrapper.mkdirAsync(this._artifactsDir);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets contract data on network or returns if an artifact does not exist.
 | 
					 | 
				
			||||||
     * @param fileName Name of contract file.
 | 
					     * @param fileName Name of contract file.
 | 
				
			||||||
     * @return Contract data on network or undefined.
 | 
					 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private async _getContractArtifactIfExistsAsync(fileName: string): Promise<ContractArtifact | void> {
 | 
					    private _getSourceTreeHash(fileName: string, sourceHash: Buffer, dependencies: string[]): Buffer {
 | 
				
			||||||
        let contractArtifact;
 | 
					        if (dependencies.length === 0) {
 | 
				
			||||||
        const contractName = path.basename(fileName, constants.SOLIDITY_FILE_EXTENSION);
 | 
					            return sourceHash;
 | 
				
			||||||
        const currentArtifactPath = `${this._artifactsDir}/${contractName}.json`;
 | 
					        } else {
 | 
				
			||||||
        try {
 | 
					            const dependencySourceTreeHashes = _.map(dependencies, dependency => {
 | 
				
			||||||
            const opts = {
 | 
					                const source = this._contractSources[dependency];
 | 
				
			||||||
                encoding: 'utf8',
 | 
					                this._setContractSpecificSourceData(source, dependency);
 | 
				
			||||||
            };
 | 
					                const sourceData = this._contractSourceData[dependency];
 | 
				
			||||||
            const contractArtifactString = await fsWrapper.readFileAsync(currentArtifactPath, opts);
 | 
					                return this._getSourceTreeHash(dependency, sourceData.sourceHash, sourceData.dependencies);
 | 
				
			||||||
            contractArtifact = JSON.parse(contractArtifactString);
 | 
					            });
 | 
				
			||||||
            return contractArtifact;
 | 
					            const sourceTreeHashesBuffer = Buffer.concat([sourceHash, ...dependencySourceTreeHashes]);
 | 
				
			||||||
        } catch (err) {
 | 
					            const sourceTreeHash = ethUtil.sha3(sourceTreeHashesBuffer);
 | 
				
			||||||
            logUtils.log(`Artifact for ${fileName} does not exist`);
 | 
					            return sourceTreeHash;
 | 
				
			||||||
            return undefined;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								packages/deployer/src/globals.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								packages/deployer/src/globals.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -1,3 +1,5 @@
 | 
				
			|||||||
 | 
					declare module 'dirty-chai';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// tslint:disable:completed-docs
 | 
					// tslint:disable:completed-docs
 | 
				
			||||||
declare module 'solc' {
 | 
					declare module 'solc' {
 | 
				
			||||||
    import * as Web3 from 'web3';
 | 
					    import * as Web3 from 'web3';
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										123
									
								
								packages/deployer/src/utils/compiler.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										123
									
								
								packages/deployer/src/utils/compiler.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,123 @@
 | 
				
			|||||||
 | 
					import { logUtils } from '@0xproject/utils';
 | 
				
			||||||
 | 
					import * as _ from 'lodash';
 | 
				
			||||||
 | 
					import * as path from 'path';
 | 
				
			||||||
 | 
					import * as solc from 'solc';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { constants } from './constants';
 | 
				
			||||||
 | 
					import { fsWrapper } from './fs_wrapper';
 | 
				
			||||||
 | 
					import { ContractArtifact, ContractSources } from './types';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Gets contract data on network or returns if an artifact does not exist.
 | 
				
			||||||
 | 
					 * @param artifactsDir Path to the artifacts directory.
 | 
				
			||||||
 | 
					 * @param fileName Name of contract file.
 | 
				
			||||||
 | 
					 * @return Contract data on network or undefined.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					export async function getContractArtifactIfExistsAsync(
 | 
				
			||||||
 | 
					    artifactsDir: string,
 | 
				
			||||||
 | 
					    fileName: string,
 | 
				
			||||||
 | 
					): Promise<ContractArtifact | void> {
 | 
				
			||||||
 | 
					    let contractArtifact;
 | 
				
			||||||
 | 
					    const contractName = path.basename(fileName, constants.SOLIDITY_FILE_EXTENSION);
 | 
				
			||||||
 | 
					    const currentArtifactPath = `${artifactsDir}/${contractName}.json`;
 | 
				
			||||||
 | 
					    try {
 | 
				
			||||||
 | 
					        const opts = {
 | 
				
			||||||
 | 
					            encoding: 'utf8',
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					        const contractArtifactString = await fsWrapper.readFileAsync(currentArtifactPath, opts);
 | 
				
			||||||
 | 
					        contractArtifact = JSON.parse(contractArtifactString);
 | 
				
			||||||
 | 
					        return contractArtifact;
 | 
				
			||||||
 | 
					    } catch (err) {
 | 
				
			||||||
 | 
					        logUtils.log(`Artifact for ${fileName} does not exist`);
 | 
				
			||||||
 | 
					        return undefined;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Creates the artifacts directory if it does not already exist.
 | 
				
			||||||
 | 
					 * @param artifactsDir Path to the artifacts directory.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					export async function createArtifactsDirIfDoesNotExistAsync(artifactsDir: string): Promise<void> {
 | 
				
			||||||
 | 
					    if (!fsWrapper.doesPathExistSync(artifactsDir)) {
 | 
				
			||||||
 | 
					        logUtils.log('Creating artifacts directory...');
 | 
				
			||||||
 | 
					        await fsWrapper.mkdirAsync(artifactsDir);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Searches Solidity source code for compiler version range.
 | 
				
			||||||
 | 
					 * @param  source Source code of contract.
 | 
				
			||||||
 | 
					 * @return Solc compiler version range.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					export function parseSolidityVersionRange(source: string): string {
 | 
				
			||||||
 | 
					    const SOLIDITY_VERSION_RANGE_REGEX = /pragma\s+solidity\s+(.*);/;
 | 
				
			||||||
 | 
					    const solcVersionRangeMatch = source.match(SOLIDITY_VERSION_RANGE_REGEX);
 | 
				
			||||||
 | 
					    if (_.isNull(solcVersionRangeMatch)) {
 | 
				
			||||||
 | 
					        throw new Error('Could not find Solidity version range in source');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    const solcVersionRange = solcVersionRangeMatch[1];
 | 
				
			||||||
 | 
					    return solcVersionRange;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Normalizes the path found in the error message.
 | 
				
			||||||
 | 
					 * Example: converts 'base/Token.sol:6:46: Warning: Unused local variable'
 | 
				
			||||||
 | 
					 *          to 'Token.sol:6:46: Warning: Unused local variable'
 | 
				
			||||||
 | 
					 * This is used to prevent logging the same error multiple times.
 | 
				
			||||||
 | 
					 * @param  errMsg An error message from the compiled output.
 | 
				
			||||||
 | 
					 * @return The error message with directories truncated from the contract path.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					export function getNormalizedErrMsg(errMsg: string): string {
 | 
				
			||||||
 | 
					    const SOLIDITY_FILE_EXTENSION_REGEX = /(.*\.sol)/;
 | 
				
			||||||
 | 
					    const errPathMatch = errMsg.match(SOLIDITY_FILE_EXTENSION_REGEX);
 | 
				
			||||||
 | 
					    if (_.isNull(errPathMatch)) {
 | 
				
			||||||
 | 
					        throw new Error('Could not find a path in error message');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    const errPath = errPathMatch[0];
 | 
				
			||||||
 | 
					    const baseContract = path.basename(errPath);
 | 
				
			||||||
 | 
					    const normalizedErrMsg = errMsg.replace(errPath, baseContract);
 | 
				
			||||||
 | 
					    return normalizedErrMsg;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Parses the contract source code and extracts the dendencies
 | 
				
			||||||
 | 
					 * @param  source Contract source code
 | 
				
			||||||
 | 
					 * @return List of dependendencies
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					export function parseDependencies(source: string): string[] {
 | 
				
			||||||
 | 
					    // TODO: Use a proper parser
 | 
				
			||||||
 | 
					    const IMPORT_REGEX = /(import\s)/;
 | 
				
			||||||
 | 
					    const DEPENDENCY_PATH_REGEX = /"([^"]+)"/; // Source: https://github.com/BlockChainCompany/soljitsu/blob/master/lib/shared.js
 | 
				
			||||||
 | 
					    const dependencies: string[] = [];
 | 
				
			||||||
 | 
					    const lines = source.split('\n');
 | 
				
			||||||
 | 
					    _.forEach(lines, line => {
 | 
				
			||||||
 | 
					        if (!_.isNull(line.match(IMPORT_REGEX))) {
 | 
				
			||||||
 | 
					            const dependencyMatch = line.match(DEPENDENCY_PATH_REGEX);
 | 
				
			||||||
 | 
					            if (!_.isNull(dependencyMatch)) {
 | 
				
			||||||
 | 
					                const dependencyPath = dependencyMatch[1];
 | 
				
			||||||
 | 
					                const basenName = path.basename(dependencyPath);
 | 
				
			||||||
 | 
					                dependencies.push(basenName);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    return dependencies;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Callback to resolve dependencies with `solc.compile`.
 | 
				
			||||||
 | 
					 * Throws error if contractSources not yet initialized.
 | 
				
			||||||
 | 
					 * @param  contractSources Source codes of contracts.
 | 
				
			||||||
 | 
					 * @param  importPath Path to an imported dependency.
 | 
				
			||||||
 | 
					 * @return Import contents object containing source code of dependency.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					export function findImportIfExist(contractSources: ContractSources, importPath: string): solc.ImportContents {
 | 
				
			||||||
 | 
					    const fileName = path.basename(importPath);
 | 
				
			||||||
 | 
					    const source = contractSources[fileName];
 | 
				
			||||||
 | 
					    if (_.isUndefined(source)) {
 | 
				
			||||||
 | 
					        throw new Error(`Contract source not found for ${fileName}`);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    const importContents: solc.ImportContents = {
 | 
				
			||||||
 | 
					        contents: source,
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    return importContents;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										18
									
								
								packages/deployer/src/utils/error_reporter.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								packages/deployer/src/utils/error_reporter.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					import { logUtils } from '@0xproject/utils';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Makes an async function no-throw printing errors to the console
 | 
				
			||||||
 | 
					 * @param asyncFn async function to wrap
 | 
				
			||||||
 | 
					 * @return Wrapped version of the passed function
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					export function consoleReporter<T>(asyncFn: (arg: T) => Promise<void>): (arg: T) => Promise<void> {
 | 
				
			||||||
 | 
					    const noThrowFnAsync = async (arg: T) => {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            const result = await asyncFn(arg);
 | 
				
			||||||
 | 
					            return result;
 | 
				
			||||||
 | 
					        } catch (err) {
 | 
				
			||||||
 | 
					            logUtils.log(`${err}`);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    return noThrowFnAsync;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -7,5 +7,6 @@ export const fsWrapper = {
 | 
				
			|||||||
    writeFileAsync: promisify<undefined>(fs.writeFile),
 | 
					    writeFileAsync: promisify<undefined>(fs.writeFile),
 | 
				
			||||||
    mkdirAsync: promisify<undefined>(fs.mkdir),
 | 
					    mkdirAsync: promisify<undefined>(fs.mkdir),
 | 
				
			||||||
    doesPathExistSync: fs.existsSync,
 | 
					    doesPathExistSync: fs.existsSync,
 | 
				
			||||||
 | 
					    rmdirSync: fs.rmdirSync,
 | 
				
			||||||
    removeFileAsync: promisify<undefined>(fs.unlink),
 | 
					    removeFileAsync: promisify<undefined>(fs.unlink),
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,7 @@ export interface ContractNetworks {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export interface ContractNetworkData {
 | 
					export interface ContractNetworkData {
 | 
				
			||||||
    solc_version: string;
 | 
					    solc_version: string;
 | 
				
			||||||
    optimizer_enabled: number;
 | 
					    optimizer_enabled: boolean;
 | 
				
			||||||
    keccak256: string;
 | 
					    keccak256: string;
 | 
				
			||||||
    source_tree_hash: string;
 | 
					    source_tree_hash: string;
 | 
				
			||||||
    abi: Web3.ContractAbi;
 | 
					    abi: Web3.ContractAbi;
 | 
				
			||||||
@@ -53,7 +53,7 @@ export interface CliOptions extends yargs.Arguments {
 | 
				
			|||||||
export interface CompilerOptions {
 | 
					export interface CompilerOptions {
 | 
				
			||||||
    contractsDir: string;
 | 
					    contractsDir: string;
 | 
				
			||||||
    networkId: number;
 | 
					    networkId: number;
 | 
				
			||||||
    optimizerEnabled: number;
 | 
					    optimizerEnabled: boolean;
 | 
				
			||||||
    artifactsDir: string;
 | 
					    artifactsDir: string;
 | 
				
			||||||
    specifiedContracts: Set<string>;
 | 
					    specifiedContracts: Set<string>;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -84,27 +84,9 @@ export interface ContractSourceData {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export interface ContractSpecificSourceData {
 | 
					export interface ContractSpecificSourceData {
 | 
				
			||||||
    dependencies: string[];
 | 
					    dependencies: string[];
 | 
				
			||||||
    solcVersion: string;
 | 
					    solcVersionRange: string;
 | 
				
			||||||
    sourceHash: Buffer;
 | 
					    sourceHash: Buffer;
 | 
				
			||||||
    sourceTreeHashIfExists?: Buffer;
 | 
					    sourceTreeHash: Buffer;
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// TODO: Consolidate with 0x.js definitions once types are moved into a separate package.
 | 
					 | 
				
			||||||
export enum ZeroExError {
 | 
					 | 
				
			||||||
    ContractDoesNotExist = 'CONTRACT_DOES_NOT_EXIST',
 | 
					 | 
				
			||||||
    ExchangeContractDoesNotExist = 'EXCHANGE_CONTRACT_DOES_NOT_EXIST',
 | 
					 | 
				
			||||||
    UnhandledError = 'UNHANDLED_ERROR',
 | 
					 | 
				
			||||||
    UserHasNoAssociatedAddress = 'USER_HAS_NO_ASSOCIATED_ADDRESSES',
 | 
					 | 
				
			||||||
    InvalidSignature = 'INVALID_SIGNATURE',
 | 
					 | 
				
			||||||
    ContractNotDeployedOnNetwork = 'CONTRACT_NOT_DEPLOYED_ON_NETWORK',
 | 
					 | 
				
			||||||
    InsufficientAllowanceForTransfer = 'INSUFFICIENT_ALLOWANCE_FOR_TRANSFER',
 | 
					 | 
				
			||||||
    InsufficientBalanceForTransfer = 'INSUFFICIENT_BALANCE_FOR_TRANSFER',
 | 
					 | 
				
			||||||
    InsufficientEthBalanceForDeposit = 'INSUFFICIENT_ETH_BALANCE_FOR_DEPOSIT',
 | 
					 | 
				
			||||||
    InsufficientWEthBalanceForWithdrawal = 'INSUFFICIENT_WETH_BALANCE_FOR_WITHDRAWAL',
 | 
					 | 
				
			||||||
    InvalidJump = 'INVALID_JUMP',
 | 
					 | 
				
			||||||
    OutOfGas = 'OUT_OF_GAS',
 | 
					 | 
				
			||||||
    NoNetworkId = 'NO_NETWORK_ID',
 | 
					 | 
				
			||||||
    SubscriptionNotFound = 'SUBSCRIPTION_NOT_FOUND',
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface Token {
 | 
					export interface Token {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										47
									
								
								packages/deployer/test/compiler_test.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								packages/deployer/test/compiler_test.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					import * as chai from 'chai';
 | 
				
			||||||
 | 
					import 'mocha';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { Compiler } from '../src/compiler';
 | 
				
			||||||
 | 
					import { fsWrapper } from '../src/utils/fs_wrapper';
 | 
				
			||||||
 | 
					import { CompilerOptions, ContractArtifact, ContractNetworkData, DoneCallback } from '../src/utils/types';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { exchange_binary } from './fixtures/exchange_bin';
 | 
				
			||||||
 | 
					import { constants } from './util/constants';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const expect = chai.expect;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('#Compiler', function() {
 | 
				
			||||||
 | 
					    this.timeout(constants.timeoutMs);
 | 
				
			||||||
 | 
					    const artifactsDir = `${__dirname}/fixtures/artifacts`;
 | 
				
			||||||
 | 
					    const contractsDir = `${__dirname}/fixtures/contracts`;
 | 
				
			||||||
 | 
					    const exchangeArtifactPath = `${artifactsDir}/Exchange.json`;
 | 
				
			||||||
 | 
					    const compilerOpts: CompilerOptions = {
 | 
				
			||||||
 | 
					        artifactsDir,
 | 
				
			||||||
 | 
					        contractsDir,
 | 
				
			||||||
 | 
					        networkId: constants.networkId,
 | 
				
			||||||
 | 
					        optimizerEnabled: constants.optimizerEnabled,
 | 
				
			||||||
 | 
					        specifiedContracts: new Set(constants.specifiedContracts),
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    const compiler = new Compiler(compilerOpts);
 | 
				
			||||||
 | 
					    beforeEach((done: DoneCallback) => {
 | 
				
			||||||
 | 
					        (async () => {
 | 
				
			||||||
 | 
					            if (fsWrapper.doesPathExistSync(exchangeArtifactPath)) {
 | 
				
			||||||
 | 
					                await fsWrapper.removeFileAsync(exchangeArtifactPath);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            await compiler.compileAsync();
 | 
				
			||||||
 | 
					            done();
 | 
				
			||||||
 | 
					        })().catch(done);
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    it('should create an Exchange artifact with the correct unlinked binary', async () => {
 | 
				
			||||||
 | 
					        const opts = {
 | 
				
			||||||
 | 
					            encoding: 'utf8',
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					        const exchangeArtifactString = await fsWrapper.readFileAsync(exchangeArtifactPath, opts);
 | 
				
			||||||
 | 
					        const exchangeArtifact: ContractArtifact = JSON.parse(exchangeArtifactString);
 | 
				
			||||||
 | 
					        const exchangeContractData: ContractNetworkData = exchangeArtifact.networks[constants.networkId];
 | 
				
			||||||
 | 
					        // The last 43 bytes of the binaries are metadata which may not be equivalent
 | 
				
			||||||
 | 
					        const unlinkedBinaryWithoutMetadata = exchangeContractData.bytecode.slice(0, -86);
 | 
				
			||||||
 | 
					        const exchangeBinaryWithoutMetadata = exchange_binary.slice(0, -86);
 | 
				
			||||||
 | 
					        expect(unlinkedBinaryWithoutMetadata).to.equal(exchangeBinaryWithoutMetadata);
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
							
								
								
									
										74
									
								
								packages/deployer/test/compiler_utils_test.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								packages/deployer/test/compiler_utils_test.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,74 @@
 | 
				
			|||||||
 | 
					import * as chai from 'chai';
 | 
				
			||||||
 | 
					import * as dirtyChai from 'dirty-chai';
 | 
				
			||||||
 | 
					import 'mocha';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import {
 | 
				
			||||||
 | 
					    createArtifactsDirIfDoesNotExistAsync,
 | 
				
			||||||
 | 
					    getNormalizedErrMsg,
 | 
				
			||||||
 | 
					    parseDependencies,
 | 
				
			||||||
 | 
					    parseSolidityVersionRange,
 | 
				
			||||||
 | 
					} from '../src/utils/compiler';
 | 
				
			||||||
 | 
					import { fsWrapper } from '../src/utils/fs_wrapper';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					chai.use(dirtyChai);
 | 
				
			||||||
 | 
					const expect = chai.expect;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('Compiler utils', () => {
 | 
				
			||||||
 | 
					    describe('#getNormalizedErrorMessage', () => {
 | 
				
			||||||
 | 
					        it('normalizes the error message', () => {
 | 
				
			||||||
 | 
					            const errMsg = 'base/Token.sol:6:46: Warning: Unused local variable';
 | 
				
			||||||
 | 
					            const normalizedErrMsg = getNormalizedErrMsg(errMsg);
 | 
				
			||||||
 | 
					            expect(normalizedErrMsg).to.be.equal('Token.sol:6:46: Warning: Unused local variable');
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    describe('#createArtifactsDirIfDoesNotExistAsync', () => {
 | 
				
			||||||
 | 
					        it('creates artifacts dir', async () => {
 | 
				
			||||||
 | 
					            const artifactsDir = `${__dirname}/artifacts`;
 | 
				
			||||||
 | 
					            expect(fsWrapper.doesPathExistSync(artifactsDir)).to.be.false();
 | 
				
			||||||
 | 
					            await createArtifactsDirIfDoesNotExistAsync(artifactsDir);
 | 
				
			||||||
 | 
					            expect(fsWrapper.doesPathExistSync(artifactsDir)).to.be.true();
 | 
				
			||||||
 | 
					            fsWrapper.rmdirSync(artifactsDir);
 | 
				
			||||||
 | 
					            expect(fsWrapper.doesPathExistSync(artifactsDir)).to.be.false();
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    describe('#parseSolidityVersionRange', () => {
 | 
				
			||||||
 | 
					        it('correctly parses the version range', () => {
 | 
				
			||||||
 | 
					            expect(parseSolidityVersionRange('pragma solidity ^0.0.1;')).to.be.equal('^0.0.1');
 | 
				
			||||||
 | 
					            expect(parseSolidityVersionRange('\npragma solidity 0.0.1;')).to.be.equal('0.0.1');
 | 
				
			||||||
 | 
					            expect(parseSolidityVersionRange('pragma solidity <=1.0.1;')).to.be.equal('<=1.0.1');
 | 
				
			||||||
 | 
					            expect(parseSolidityVersionRange('pragma solidity   ~1.0.1;')).to.be.equal('~1.0.1');
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        // TODO: For now that doesn't work. This will work after we switch to a grammar-based parser
 | 
				
			||||||
 | 
					        it.skip('correctly parses the version range with comments', () => {
 | 
				
			||||||
 | 
					            expect(parseSolidityVersionRange('// pragma solidity ~1.0.1;\npragma solidity ~1.0.2;')).to.be.equal(
 | 
				
			||||||
 | 
					                '~1.0.2',
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    describe('#parseDependencies', () => {
 | 
				
			||||||
 | 
					        it('correctly parses Exchange dependencies', async () => {
 | 
				
			||||||
 | 
					            const exchangeSource = await fsWrapper.readFileAsync(`${__dirname}/fixtures/contracts/Exchange.sol`, {
 | 
				
			||||||
 | 
					                encoding: 'utf8',
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            expect(parseDependencies(exchangeSource)).to.be.deep.equal([
 | 
				
			||||||
 | 
					                'TokenTransferProxy.sol',
 | 
				
			||||||
 | 
					                'Token.sol',
 | 
				
			||||||
 | 
					                'SafeMath.sol',
 | 
				
			||||||
 | 
					            ]);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        it('correctly parses TokenTransferProxy dependencies', async () => {
 | 
				
			||||||
 | 
					            const exchangeSource = await fsWrapper.readFileAsync(
 | 
				
			||||||
 | 
					                `${__dirname}/fixtures/contracts/TokenTransferProxy.sol`,
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    encoding: 'utf8',
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					            expect(parseDependencies(exchangeSource)).to.be.deep.equal(['Token.sol', 'Ownable.sol']);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        // TODO: For now that doesn't work. This will work after we switch to a grammar-based parser
 | 
				
			||||||
 | 
					        it.skip('correctly parses commented out dependencies', async () => {
 | 
				
			||||||
 | 
					            const contractWithCommentedOutDependencies = `// import "./TokenTransferProxy.sol";`;
 | 
				
			||||||
 | 
					            expect(parseDependencies(contractWithCommentedOutDependencies)).to.be.deep.equal([]);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
@@ -10,55 +10,38 @@ import { constructor_args, exchange_binary } from './fixtures/exchange_bin';
 | 
				
			|||||||
import { constants } from './util/constants';
 | 
					import { constants } from './util/constants';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const expect = chai.expect;
 | 
					const expect = chai.expect;
 | 
				
			||||||
const artifactsDir = `${__dirname}/fixtures/artifacts`;
 | 
					 | 
				
			||||||
const contractsDir = `${__dirname}/fixtures/contracts`;
 | 
					 | 
				
			||||||
const exchangeArtifactPath = `${artifactsDir}/Exchange.json`;
 | 
					 | 
				
			||||||
const compilerOpts: CompilerOptions = {
 | 
					 | 
				
			||||||
    artifactsDir,
 | 
					 | 
				
			||||||
    contractsDir,
 | 
					 | 
				
			||||||
    networkId: constants.networkId,
 | 
					 | 
				
			||||||
    optimizerEnabled: constants.optimizerEnabled,
 | 
					 | 
				
			||||||
    specifiedContracts: new Set(constants.specifiedContracts),
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
const compiler = new Compiler(compilerOpts);
 | 
					 | 
				
			||||||
const deployerOpts = {
 | 
					 | 
				
			||||||
    artifactsDir,
 | 
					 | 
				
			||||||
    networkId: constants.networkId,
 | 
					 | 
				
			||||||
    jsonrpcUrl: constants.jsonrpcUrl,
 | 
					 | 
				
			||||||
    defaults: {
 | 
					 | 
				
			||||||
        gasPrice: constants.gasPrice,
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
const deployer = new Deployer(deployerOpts);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* tslint:disable */
 | 
					 | 
				
			||||||
beforeEach(function(done: DoneCallback) {
 | 
					 | 
				
			||||||
    this.timeout(constants.timeoutMs);
 | 
					 | 
				
			||||||
    (async () => {
 | 
					 | 
				
			||||||
        if (fsWrapper.doesPathExistSync(exchangeArtifactPath)) {
 | 
					 | 
				
			||||||
            await fsWrapper.removeFileAsync(exchangeArtifactPath);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        await compiler.compileAllAsync();
 | 
					 | 
				
			||||||
        done();
 | 
					 | 
				
			||||||
    })().catch(done);
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
/* tslint:enable */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
describe('#Compiler', () => {
 | 
					 | 
				
			||||||
    it('should create an Exchange artifact with the correct unlinked binary', async () => {
 | 
					 | 
				
			||||||
        const opts = {
 | 
					 | 
				
			||||||
            encoding: 'utf8',
 | 
					 | 
				
			||||||
        };
 | 
					 | 
				
			||||||
        const exchangeArtifactString = await fsWrapper.readFileAsync(exchangeArtifactPath, opts);
 | 
					 | 
				
			||||||
        const exchangeArtifact: ContractArtifact = JSON.parse(exchangeArtifactString);
 | 
					 | 
				
			||||||
        const exchangeContractData: ContractNetworkData = exchangeArtifact.networks[constants.networkId];
 | 
					 | 
				
			||||||
        // The last 43 bytes of the binaries are metadata which may not be equivalent
 | 
					 | 
				
			||||||
        const unlinkedBinaryWithoutMetadata = exchangeContractData.bytecode.slice(0, -86);
 | 
					 | 
				
			||||||
        const exchangeBinaryWithoutMetadata = exchange_binary.slice(0, -86);
 | 
					 | 
				
			||||||
        expect(unlinkedBinaryWithoutMetadata).to.equal(exchangeBinaryWithoutMetadata);
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
describe('#Deployer', () => {
 | 
					describe('#Deployer', () => {
 | 
				
			||||||
 | 
					    const artifactsDir = `${__dirname}/fixtures/artifacts`;
 | 
				
			||||||
 | 
					    const contractsDir = `${__dirname}/fixtures/contracts`;
 | 
				
			||||||
 | 
					    const exchangeArtifactPath = `${artifactsDir}/Exchange.json`;
 | 
				
			||||||
 | 
					    const compilerOpts: CompilerOptions = {
 | 
				
			||||||
 | 
					        artifactsDir,
 | 
				
			||||||
 | 
					        contractsDir,
 | 
				
			||||||
 | 
					        networkId: constants.networkId,
 | 
				
			||||||
 | 
					        optimizerEnabled: constants.optimizerEnabled,
 | 
				
			||||||
 | 
					        specifiedContracts: new Set(constants.specifiedContracts),
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    const compiler = new Compiler(compilerOpts);
 | 
				
			||||||
 | 
					    const deployerOpts = {
 | 
				
			||||||
 | 
					        artifactsDir,
 | 
				
			||||||
 | 
					        networkId: constants.networkId,
 | 
				
			||||||
 | 
					        jsonrpcUrl: constants.jsonrpcUrl,
 | 
				
			||||||
 | 
					        defaults: {
 | 
				
			||||||
 | 
					            gasPrice: constants.gasPrice,
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    const deployer = new Deployer(deployerOpts);
 | 
				
			||||||
 | 
					    beforeEach(function(done: DoneCallback) {
 | 
				
			||||||
 | 
					        this.timeout(constants.timeoutMs);
 | 
				
			||||||
 | 
					        (async () => {
 | 
				
			||||||
 | 
					            if (fsWrapper.doesPathExistSync(exchangeArtifactPath)) {
 | 
				
			||||||
 | 
					                await fsWrapper.removeFileAsync(exchangeArtifactPath);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            await compiler.compileAsync();
 | 
				
			||||||
 | 
					            done();
 | 
				
			||||||
 | 
					        })().catch(done);
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
    describe('#deployAsync', () => {
 | 
					    describe('#deployAsync', () => {
 | 
				
			||||||
        it('should deploy the Exchange contract without updating the Exchange artifact', async () => {
 | 
					        it('should deploy the Exchange contract without updating the Exchange artifact', async () => {
 | 
				
			||||||
            const exchangeConstructorArgs = [constants.zrxTokenAddress, constants.tokenTransferProxyAddress];
 | 
					            const exchangeConstructorArgs = [constants.zrxTokenAddress, constants.tokenTransferProxyAddress];
 | 
				
			||||||
@@ -3,7 +3,7 @@ import { BigNumber } from '@0xproject/utils';
 | 
				
			|||||||
export const constants = {
 | 
					export const constants = {
 | 
				
			||||||
    networkId: 0,
 | 
					    networkId: 0,
 | 
				
			||||||
    jsonrpcUrl: 'http://localhost:8545',
 | 
					    jsonrpcUrl: 'http://localhost:8545',
 | 
				
			||||||
    optimizerEnabled: 0,
 | 
					    optimizerEnabled: false,
 | 
				
			||||||
    gasPrice: new BigNumber(20000000000),
 | 
					    gasPrice: new BigNumber(20000000000),
 | 
				
			||||||
    timeoutMs: 20000,
 | 
					    timeoutMs: 20000,
 | 
				
			||||||
    zrxTokenAddress: '0xe41d2489571d322189246dafa5ebde1f4699f498',
 | 
					    zrxTokenAddress: '0xe41d2489571d322189246dafa5ebde1f4699f498',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,16 +2,12 @@
 | 
				
			|||||||
    "extends": "../../tsconfig",
 | 
					    "extends": "../../tsconfig",
 | 
				
			||||||
    "compilerOptions": {
 | 
					    "compilerOptions": {
 | 
				
			||||||
        "outDir": "lib",
 | 
					        "outDir": "lib",
 | 
				
			||||||
        "strictFunctionTypes": false,
 | 
					        "strictFunctionTypes": false
 | 
				
			||||||
        "strictNullChecks": false
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "include": [
 | 
					    "include": [
 | 
				
			||||||
        "./src/**/*",
 | 
					        "./src/**/*",
 | 
				
			||||||
        "./test/**/*",
 | 
					        "./test/**/*",
 | 
				
			||||||
        "../../node_modules/types-bn/index.d.ts",
 | 
					        "../../node_modules/types-bn/index.d.ts",
 | 
				
			||||||
        "../../node_modules/types-ethereumjs-util/index.d.ts",
 | 
					        "../../node_modules/types-ethereumjs-util/index.d.ts"
 | 
				
			||||||
        "../../node_modules/chai-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/ethers-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/web3-typescript-typings/index.d.ts"
 | 
					 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,8 +21,8 @@ yarn add @0xproject/dev-utils
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
					If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```json
 | 
				
			||||||
"include": [
 | 
					"compilerOptions": {
 | 
				
			||||||
    "./node_modules/web3-typescript-typings/index.d.ts",
 | 
					    "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
 | 
				
			||||||
]
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,7 +30,6 @@
 | 
				
			|||||||
        "@types/lodash": "4.14.104",
 | 
					        "@types/lodash": "4.14.104",
 | 
				
			||||||
        "@types/mocha": "^2.2.42",
 | 
					        "@types/mocha": "^2.2.42",
 | 
				
			||||||
        "chai": "^4.0.1",
 | 
					        "chai": "^4.0.1",
 | 
				
			||||||
        "chai-typescript-typings": "^0.0.6",
 | 
					 | 
				
			||||||
        "copyfiles": "^1.2.0",
 | 
					        "copyfiles": "^1.2.0",
 | 
				
			||||||
        "mocha": "^4.0.1",
 | 
					        "mocha": "^4.0.1",
 | 
				
			||||||
        "npm-run-all": "^4.1.2",
 | 
					        "npm-run-all": "^4.1.2",
 | 
				
			||||||
@@ -47,6 +46,7 @@
 | 
				
			|||||||
        "@0xproject/types": "^0.4.1",
 | 
					        "@0xproject/types": "^0.4.1",
 | 
				
			||||||
        "@0xproject/utils": "^0.4.3",
 | 
					        "@0xproject/utils": "^0.4.3",
 | 
				
			||||||
        "@0xproject/web3-wrapper": "^0.3.1",
 | 
					        "@0xproject/web3-wrapper": "^0.3.1",
 | 
				
			||||||
 | 
					        "@0xproject/typescript-typings": "^0.0.1",
 | 
				
			||||||
        "ethereumjs-util": "^5.1.2",
 | 
					        "ethereumjs-util": "^5.1.2",
 | 
				
			||||||
        "lodash": "^4.17.4",
 | 
					        "lodash": "^4.17.4",
 | 
				
			||||||
        "request-promise-native": "^1.0.5",
 | 
					        "request-promise-native": "^1.0.5",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,9 +7,6 @@
 | 
				
			|||||||
        "./src/**/*",
 | 
					        "./src/**/*",
 | 
				
			||||||
        "./test/**/*",
 | 
					        "./test/**/*",
 | 
				
			||||||
        "../../node_modules/types-bn/index.d.ts",
 | 
					        "../../node_modules/types-bn/index.d.ts",
 | 
				
			||||||
        "../../node_modules/chai-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/ethers-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/web3-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/types-ethereumjs-util/index.d.ts"
 | 
					        "../../node_modules/types-ethereumjs-util/index.d.ts"
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +0,0 @@
 | 
				
			|||||||
.*
 | 
					 | 
				
			||||||
yarn-error.log
 | 
					 | 
				
			||||||
/scripts/
 | 
					 | 
				
			||||||
/lib/monorepo_scripts/
 | 
					 | 
				
			||||||
@@ -1,5 +0,0 @@
 | 
				
			|||||||
# CHANGELOG
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## v0.0.2 - _March 4, 2018_
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    * Initial types (#413)
 | 
					 | 
				
			||||||
@@ -1,49 +0,0 @@
 | 
				
			|||||||
## ethers-typescript-typings
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
There currently isn't an official [Ethers][ethers]
 | 
					 | 
				
			||||||
type definition included in the [DefinitelyTyped][definitelytyped] project.
 | 
					 | 
				
			||||||
Until that happens, we will continue to improve our own type definition.
 | 
					 | 
				
			||||||
If it get's close to comprehensive, we'll add it to [DefinitelyTyped][definitelytyped].
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[ethers]: https://github.com/ethers-io/ethers.js
 | 
					 | 
				
			||||||
[definitelytyped]: https://github.com/DefinitelyTyped/DefinitelyTyped
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Installation
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```bash
 | 
					 | 
				
			||||||
yarn add -D ethers-typescript-typings
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Usage
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Add the following line within an `include` section of your `tsconfig.json`
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```json
 | 
					 | 
				
			||||||
"./node_modules/ethers-typescript-typings/index.d.ts"
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Contributing
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
We strongly encourage that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Install Dependencies
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```bash
 | 
					 | 
				
			||||||
yarn config set workspaces-experimental true
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Then install dependencies
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```bash
 | 
					 | 
				
			||||||
yarn install
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Lint
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```bash
 | 
					 | 
				
			||||||
yarn lint
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
@@ -1,6 +0,0 @@
 | 
				
			|||||||
declare module '*.json' {
 | 
					 | 
				
			||||||
    const json: any;
 | 
					 | 
				
			||||||
    /* tslint:disable */
 | 
					 | 
				
			||||||
    export default json;
 | 
					 | 
				
			||||||
    /* tslint:enable */
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,8 +0,0 @@
 | 
				
			|||||||
import { postpublishUtils } from '@0xproject/monorepo-scripts';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import * as packageJSON from '../package.json';
 | 
					 | 
				
			||||||
import * as tsConfigJSON from '../tsconfig.json';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const cwd = `${__dirname}/..`;
 | 
					 | 
				
			||||||
// tslint:disable-next-line:no-floating-promises
 | 
					 | 
				
			||||||
postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
 | 
					 | 
				
			||||||
@@ -1,36 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
    "name": "ethers-typescript-typings",
 | 
					 | 
				
			||||||
    "version": "0.0.4",
 | 
					 | 
				
			||||||
    "description": "Typescript type definitions for ethers.js",
 | 
					 | 
				
			||||||
    "main": "index.d.ts",
 | 
					 | 
				
			||||||
    "types": "index.d.ts",
 | 
					 | 
				
			||||||
    "scripts": {
 | 
					 | 
				
			||||||
        "lint": "tslint index.d.ts",
 | 
					 | 
				
			||||||
        "build": "tsc && copyfiles -u 1 './lib/**/*' ./scripts",
 | 
					 | 
				
			||||||
        "clean": "shx rm -rf scripts"
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "repository": {
 | 
					 | 
				
			||||||
        "type": "git",
 | 
					 | 
				
			||||||
        "url": "git+https://github.com/0xProject/0x-monorepo.git"
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "author": "Fabio Berger",
 | 
					 | 
				
			||||||
    "contributors": [
 | 
					 | 
				
			||||||
        "Leonid Logvinov <logvinov.leon@gmail.com>"
 | 
					 | 
				
			||||||
    ],
 | 
					 | 
				
			||||||
    "license": "Apache-2.0",
 | 
					 | 
				
			||||||
    "bugs": {
 | 
					 | 
				
			||||||
        "url": "https://github.com/0xProject/0x-monorepo/issues"
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "homepage": "https://github.com/0xProject/0x-monorepo/packages/ethers-typescript-typings#readme",
 | 
					 | 
				
			||||||
    "devDependencies": {
 | 
					 | 
				
			||||||
        "@0xproject/monorepo-scripts": "^0.1.14",
 | 
					 | 
				
			||||||
        "copyfiles": "^1.2.0",
 | 
					 | 
				
			||||||
        "shx": "^0.2.2",
 | 
					 | 
				
			||||||
        "tslint": "5.8.0",
 | 
					 | 
				
			||||||
        "tslint-config-0xproject": "^0.0.2",
 | 
					 | 
				
			||||||
        "typescript": "2.7.1"
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "publishConfig": {
 | 
					 | 
				
			||||||
        "access": "public"
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,7 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
    "extends": "../../tsconfig",
 | 
					 | 
				
			||||||
    "compilerOptions": {
 | 
					 | 
				
			||||||
        "outDir": "lib"
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "include": ["./monorepo_scripts/**/*"]
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,3 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
    "extends": ["tslint-config-0xproject"]
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -12,8 +12,8 @@ yarn add @0xproject/json-schemas
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
**Import**
 | 
					**Import**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```javascript
 | 
					```typescript
 | 
				
			||||||
import { schemas } from '@0xproject/json-schemas';
 | 
					import { SchemaValidator, ValidatorResult, schemas } from '@0xproject/json-schemas';
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
or
 | 
					or
 | 
				
			||||||
@@ -22,6 +22,14 @@ or
 | 
				
			|||||||
var schemas = require('@0xproject/json-schemas').schemas;
 | 
					var schemas = require('@0xproject/json-schemas').schemas;
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```json
 | 
				
			||||||
 | 
					"compilerOptions": {
 | 
				
			||||||
 | 
					    "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Contributing
 | 
					## Contributing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
We strongly encourage that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
 | 
					We strongly encourage that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,6 +39,7 @@
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    "homepage": "https://github.com/0xProject/0x-monorepo/packages/json-schemas/README.md",
 | 
					    "homepage": "https://github.com/0xProject/0x-monorepo/packages/json-schemas/README.md",
 | 
				
			||||||
    "dependencies": {
 | 
					    "dependencies": {
 | 
				
			||||||
 | 
					        "@0xproject/typescript-typings": "^0.0.1",
 | 
				
			||||||
        "jsonschema": "^1.2.0",
 | 
					        "jsonschema": "^1.2.0",
 | 
				
			||||||
        "lodash.values": "^4.3.0"
 | 
					        "lodash.values": "^4.3.0"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
@@ -50,7 +51,6 @@
 | 
				
			|||||||
        "@types/lodash.values": "^4.3.3",
 | 
					        "@types/lodash.values": "^4.3.3",
 | 
				
			||||||
        "@types/mocha": "^2.2.42",
 | 
					        "@types/mocha": "^2.2.42",
 | 
				
			||||||
        "chai": "^4.0.1",
 | 
					        "chai": "^4.0.1",
 | 
				
			||||||
        "chai-typescript-typings": "^0.0.6",
 | 
					 | 
				
			||||||
        "copyfiles": "^1.2.0",
 | 
					        "copyfiles": "^1.2.0",
 | 
				
			||||||
        "dirty-chai": "^2.0.1",
 | 
					        "dirty-chai": "^2.0.1",
 | 
				
			||||||
        "lodash.foreach": "^4.5.0",
 | 
					        "lodash.foreach": "^4.5.0",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,10 +3,5 @@
 | 
				
			|||||||
    "compilerOptions": {
 | 
					    "compilerOptions": {
 | 
				
			||||||
        "outDir": "lib"
 | 
					        "outDir": "lib"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "include": [
 | 
					    "include": ["./src/**/*", "./test/**/*"]
 | 
				
			||||||
        "./src/**/*",
 | 
					 | 
				
			||||||
        "./test/**/*",
 | 
					 | 
				
			||||||
        "../../node_modules/web3-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/chai-typescript-typings/index.d.ts"
 | 
					 | 
				
			||||||
    ]
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,6 +25,8 @@
 | 
				
			|||||||
        "@0xproject/tslint-config": "0.4.8",
 | 
					        "@0xproject/tslint-config": "0.4.8",
 | 
				
			||||||
        "@types/glob": "^5.0.33",
 | 
					        "@types/glob": "^5.0.33",
 | 
				
			||||||
        "@types/node": "^8.0.53",
 | 
					        "@types/node": "^8.0.53",
 | 
				
			||||||
 | 
					        "@types/rimraf": "^2.0.2",
 | 
				
			||||||
 | 
					        "lerna-get-packages": "^1.0.0",
 | 
				
			||||||
        "shx": "^0.2.2",
 | 
					        "shx": "^0.2.2",
 | 
				
			||||||
        "tslint": "5.8.0",
 | 
					        "tslint": "5.8.0",
 | 
				
			||||||
        "typescript": "2.7.1"
 | 
					        "typescript": "2.7.1"
 | 
				
			||||||
@@ -35,7 +37,9 @@
 | 
				
			|||||||
        "es6-promisify": "^5.0.0",
 | 
					        "es6-promisify": "^5.0.0",
 | 
				
			||||||
        "glob": "^7.1.2",
 | 
					        "glob": "^7.1.2",
 | 
				
			||||||
        "lodash": "^4.17.4",
 | 
					        "lodash": "^4.17.4",
 | 
				
			||||||
 | 
					        "promisify-child-process": "^1.0.5",
 | 
				
			||||||
        "publish-release": "0xproject/publish-release",
 | 
					        "publish-release": "0xproject/publish-release",
 | 
				
			||||||
 | 
					        "rimraf": "^2.6.2",
 | 
				
			||||||
        "semver-sort": "^0.0.4"
 | 
					        "semver-sort": "^0.0.4"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "publishConfig": {
 | 
					    "publishConfig": {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										19
									
								
								packages/monorepo-scripts/src/globals.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								packages/monorepo-scripts/src/globals.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -6,3 +6,22 @@ declare module 'es6-promisify';
 | 
				
			|||||||
declare module 'semver-sort' {
 | 
					declare module 'semver-sort' {
 | 
				
			||||||
    const desc: (versions: string[]) => string[];
 | 
					    const desc: (versions: string[]) => string[];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					declare interface LernaPackage {
 | 
				
			||||||
 | 
					    location: string;
 | 
				
			||||||
 | 
					    package: {
 | 
				
			||||||
 | 
					        private?: boolean;
 | 
				
			||||||
 | 
					        name: string;
 | 
				
			||||||
 | 
					        main?: string;
 | 
				
			||||||
 | 
					        config?: {
 | 
				
			||||||
 | 
					            additionalTsTypings?: string[];
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					declare function lernaGetPackages(path: string): LernaPackage[];
 | 
				
			||||||
 | 
					// lerna-get-packages declarations
 | 
				
			||||||
 | 
					declare module 'lerna-get-packages' {
 | 
				
			||||||
 | 
					    export = lernaGetPackages;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					declare module 'promisify-child-process';
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										58
									
								
								packages/monorepo-scripts/src/test_installation.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								packages/monorepo-scripts/src/test_installation.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,58 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env node
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import * as fs from 'fs';
 | 
				
			||||||
 | 
					import lernaGetPackages = require('lerna-get-packages');
 | 
				
			||||||
 | 
					import * as _ from 'lodash';
 | 
				
			||||||
 | 
					import * as path from 'path';
 | 
				
			||||||
 | 
					import { exec as execAsync } from 'promisify-child-process';
 | 
				
			||||||
 | 
					import * as rimraf from 'rimraf';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { utils } from './utils';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(async () => {
 | 
				
			||||||
 | 
					    const monorepoRootPath = path.join(__dirname, '../../..');
 | 
				
			||||||
 | 
					    const lernaPackages = lernaGetPackages(monorepoRootPath);
 | 
				
			||||||
 | 
					    const installablePackages = _.filter(
 | 
				
			||||||
 | 
					        lernaPackages,
 | 
				
			||||||
 | 
					        lernaPackage =>
 | 
				
			||||||
 | 
					            !lernaPackage.package.private &&
 | 
				
			||||||
 | 
					            !_.isUndefined(lernaPackage.package.main) &&
 | 
				
			||||||
 | 
					            lernaPackage.package.main.endsWith('.js'),
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					    for (const installableLernaPackage of installablePackages) {
 | 
				
			||||||
 | 
					        const packagePath = installableLernaPackage.location;
 | 
				
			||||||
 | 
					        const packageName = installableLernaPackage.package.name;
 | 
				
			||||||
 | 
					        utils.log(`Testing ${packageName}`);
 | 
				
			||||||
 | 
					        let result = await execAsync('npm pack', { cwd: packagePath });
 | 
				
			||||||
 | 
					        const packedPackageFileName = result.stdout.trim();
 | 
				
			||||||
 | 
					        const testDirectory = path.join(monorepoRootPath, '../test-env');
 | 
				
			||||||
 | 
					        fs.mkdirSync(testDirectory);
 | 
				
			||||||
 | 
					        result = await execAsync('yarn init --yes', { cwd: testDirectory });
 | 
				
			||||||
 | 
					        utils.log(`Installing ${packedPackageFileName}`);
 | 
				
			||||||
 | 
					        result = await execAsync(`yarn add ${packagePath}/${packedPackageFileName}`, { cwd: testDirectory });
 | 
				
			||||||
 | 
					        const indexFilePath = path.join(testDirectory, 'index.ts');
 | 
				
			||||||
 | 
					        fs.writeFileSync(indexFilePath, `import * as Package from '${packageName}'`);
 | 
				
			||||||
 | 
					        const tsConfig = {
 | 
				
			||||||
 | 
					            compilerOptions: {
 | 
				
			||||||
 | 
					                typeRoots: ['node_modules/@0xproject/typescript-typings/types', 'node_modules/@types'],
 | 
				
			||||||
 | 
					                module: 'commonjs',
 | 
				
			||||||
 | 
					                target: 'es5',
 | 
				
			||||||
 | 
					                lib: ['es2017', 'dom'],
 | 
				
			||||||
 | 
					                declaration: true,
 | 
				
			||||||
 | 
					                noImplicitReturns: true,
 | 
				
			||||||
 | 
					                pretty: true,
 | 
				
			||||||
 | 
					                strict: true,
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            include: ['index.ts'],
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					        const tsconfigFilePath = path.join(testDirectory, 'tsconfig.json');
 | 
				
			||||||
 | 
					        fs.writeFileSync(tsconfigFilePath, JSON.stringify(tsConfig, null, 4));
 | 
				
			||||||
 | 
					        utils.log(`Compiling ${packageName}`);
 | 
				
			||||||
 | 
					        await execAsync('../node_modules/typescript/bin/tsc', { cwd: testDirectory });
 | 
				
			||||||
 | 
					        utils.log(`Successfully compiled with ${packageName} as a dependency`);
 | 
				
			||||||
 | 
					        rimraf.sync(testDirectory);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					})().catch(err => {
 | 
				
			||||||
 | 
					    utils.log(err.stdout);
 | 
				
			||||||
 | 
					    process.exit(1);
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
@@ -3,5 +3,5 @@
 | 
				
			|||||||
    "compilerOptions": {
 | 
					    "compilerOptions": {
 | 
				
			||||||
        "outDir": "lib"
 | 
					        "outDir": "lib"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "include": ["./src/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"]
 | 
					    "include": ["./src/**/*"]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,8 +27,8 @@
 | 
				
			|||||||
        "@types/lodash": "4.14.104",
 | 
					        "@types/lodash": "4.14.104",
 | 
				
			||||||
        "@types/material-ui": "0.18.0",
 | 
					        "@types/material-ui": "0.18.0",
 | 
				
			||||||
        "@types/node": "^8.0.53",
 | 
					        "@types/node": "^8.0.53",
 | 
				
			||||||
        "@types/react": "^15.0.15",
 | 
					        "@types/react": "^16.0.34",
 | 
				
			||||||
        "@types/react-dom": "^0.14.23",
 | 
					        "@types/react-dom": "^16.0.3",
 | 
				
			||||||
        "@types/react-tap-event-plugin": "0.0.30",
 | 
					        "@types/react-tap-event-plugin": "0.0.30",
 | 
				
			||||||
        "awesome-typescript-loader": "^3.1.3",
 | 
					        "awesome-typescript-loader": "^3.1.3",
 | 
				
			||||||
        "copyfiles": "^1.2.0",
 | 
					        "copyfiles": "^1.2.0",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,6 +33,14 @@ This package exposes both a single `Documentation` react component that will ren
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Currently this package still has some external dependencies outside of the `Documentation` component, so please start your project off by copying the [react-docs-example](https://github.com/0xProject/0x-monorepo/tree/development/packages/react-docs-example) directory and modifying it there. If you need changes in the [react-docs](https://github.com/0xProject/0x-monorepo/tree/development/packages/react-docs) package, fork the 0x monorepo, make the required changes and submit a PR. Until we merge it, you can have your project depend on your own custom fork.
 | 
					Currently this package still has some external dependencies outside of the `Documentation` component, so please start your project off by copying the [react-docs-example](https://github.com/0xProject/0x-monorepo/tree/development/packages/react-docs-example) directory and modifying it there. If you need changes in the [react-docs](https://github.com/0xProject/0x-monorepo/tree/development/packages/react-docs) package, fork the 0x monorepo, make the required changes and submit a PR. Until we merge it, you can have your project depend on your own custom fork.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```json
 | 
				
			||||||
 | 
					"compilerOptions": {
 | 
				
			||||||
 | 
					    "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Future improvements
 | 
					## Future improvements
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Feel free to contribute to these improvements!
 | 
					Feel free to contribute to these improvements!
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,8 +35,8 @@
 | 
				
			|||||||
        "@types/lodash": "4.14.104",
 | 
					        "@types/lodash": "4.14.104",
 | 
				
			||||||
        "@types/material-ui": "0.18.0",
 | 
					        "@types/material-ui": "0.18.0",
 | 
				
			||||||
        "@types/node": "^8.0.53",
 | 
					        "@types/node": "^8.0.53",
 | 
				
			||||||
        "@types/react": "^15.0.15",
 | 
					        "@types/react": "^16.0.34",
 | 
				
			||||||
        "@types/react-dom": "^0.14.23",
 | 
					        "@types/react-dom": "^16.0.3",
 | 
				
			||||||
        "@types/react-scroll": "0.0.31",
 | 
					        "@types/react-scroll": "0.0.31",
 | 
				
			||||||
        "@types/react-tap-event-plugin": "0.0.30",
 | 
					        "@types/react-tap-event-plugin": "0.0.30",
 | 
				
			||||||
        "basscss": "^8.0.3",
 | 
					        "basscss": "^8.0.3",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,5 +9,5 @@
 | 
				
			|||||||
            "*": ["node_modules/@types/*", "*"]
 | 
					            "*": ["node_modules/@types/*", "*"]
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "include": ["./src/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"]
 | 
					    "include": ["./src/**/*"]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,14 @@ Contains React components & frontend types/utils shared between 0x projects.
 | 
				
			|||||||
yarn add @0xproject/react-shared
 | 
					yarn add @0xproject/react-shared
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```json
 | 
				
			||||||
 | 
					"compilerOptions": {
 | 
				
			||||||
 | 
					    "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Contributing
 | 
					## Contributing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
We strongly encourage that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
 | 
					We strongly encourage that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,8 +33,8 @@
 | 
				
			|||||||
        "@types/lodash": "4.14.104",
 | 
					        "@types/lodash": "4.14.104",
 | 
				
			||||||
        "@types/material-ui": "0.18.0",
 | 
					        "@types/material-ui": "0.18.0",
 | 
				
			||||||
        "@types/node": "^8.0.53",
 | 
					        "@types/node": "^8.0.53",
 | 
				
			||||||
        "@types/react": "^15.0.15",
 | 
					        "@types/react": "^16.0.34",
 | 
				
			||||||
        "@types/react-dom": "^0.14.23",
 | 
					        "@types/react-dom": "^16.0.3",
 | 
				
			||||||
        "@types/react-scroll": "0.0.31",
 | 
					        "@types/react-scroll": "0.0.31",
 | 
				
			||||||
        "basscss": "^8.0.3",
 | 
					        "basscss": "^8.0.3",
 | 
				
			||||||
        "is-mobile": "^0.2.2",
 | 
					        "is-mobile": "^0.2.2",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -40,6 +40,7 @@
 | 
				
			|||||||
    "dependencies": {
 | 
					    "dependencies": {
 | 
				
			||||||
        "@0xproject/subproviders": "^0.8.2",
 | 
					        "@0xproject/subproviders": "^0.8.2",
 | 
				
			||||||
        "@0xproject/utils": "^0.3.4",
 | 
					        "@0xproject/utils": "^0.3.4",
 | 
				
			||||||
 | 
					        "@0xproject/typescript-typings": "^0.0.1",
 | 
				
			||||||
        "ethereumjs-util": "^5.1.1",
 | 
					        "ethereumjs-util": "^5.1.1",
 | 
				
			||||||
        "glob": "^7.1.2",
 | 
					        "glob": "^7.1.2",
 | 
				
			||||||
        "istanbul": "^0.4.5",
 | 
					        "istanbul": "^0.4.5",
 | 
				
			||||||
@@ -57,7 +58,6 @@
 | 
				
			|||||||
        "@types/mocha": "^2.2.42",
 | 
					        "@types/mocha": "^2.2.42",
 | 
				
			||||||
        "@types/node": "^8.0.53",
 | 
					        "@types/node": "^8.0.53",
 | 
				
			||||||
        "chai": "^4.0.1",
 | 
					        "chai": "^4.0.1",
 | 
				
			||||||
        "chai-typescript-typings": "^0.0.6",
 | 
					 | 
				
			||||||
        "copyfiles": "^1.2.0",
 | 
					        "copyfiles": "^1.2.0",
 | 
				
			||||||
        "dirty-chai": "^2.0.1",
 | 
					        "dirty-chai": "^2.0.1",
 | 
				
			||||||
        "mocha": "^4.0.1",
 | 
					        "mocha": "^4.0.1",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,8 +7,6 @@
 | 
				
			|||||||
        "./src/**/*",
 | 
					        "./src/**/*",
 | 
				
			||||||
        "./test/**/*",
 | 
					        "./test/**/*",
 | 
				
			||||||
        "../../node_modules/types-bn/index.d.ts",
 | 
					        "../../node_modules/types-bn/index.d.ts",
 | 
				
			||||||
        "../../node_modules/web3-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/chai-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/types-ethereumjs-util/index.d.ts"
 | 
					        "../../node_modules/types-ethereumjs-util/index.d.ts"
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,6 +33,7 @@
 | 
				
			|||||||
        "@0xproject/connect": "^0.6.6",
 | 
					        "@0xproject/connect": "^0.6.6",
 | 
				
			||||||
        "@0xproject/json-schemas": "^0.7.17",
 | 
					        "@0xproject/json-schemas": "^0.7.17",
 | 
				
			||||||
        "@0xproject/utils": "^0.4.3",
 | 
					        "@0xproject/utils": "^0.4.3",
 | 
				
			||||||
 | 
					        "@0xproject/typescript-typings": "^0.0.1",
 | 
				
			||||||
        "chalk": "^2.3.0",
 | 
					        "chalk": "^2.3.0",
 | 
				
			||||||
        "lodash": "^4.17.4",
 | 
					        "lodash": "^4.17.4",
 | 
				
			||||||
        "newman": "^3.9.3",
 | 
					        "newman": "^3.9.3",
 | 
				
			||||||
@@ -48,8 +49,6 @@
 | 
				
			|||||||
        "@types/yargs": "^10.0.0",
 | 
					        "@types/yargs": "^10.0.0",
 | 
				
			||||||
        "chai": "^4.0.1",
 | 
					        "chai": "^4.0.1",
 | 
				
			||||||
        "chai-as-promised": "^7.1.0",
 | 
					        "chai-as-promised": "^7.1.0",
 | 
				
			||||||
        "chai-as-promised-typescript-typings": "^0.0.10",
 | 
					 | 
				
			||||||
        "chai-typescript-typings": "^0.0.4",
 | 
					 | 
				
			||||||
        "copyfiles": "^1.2.0",
 | 
					        "copyfiles": "^1.2.0",
 | 
				
			||||||
        "dirty-chai": "^2.0.1",
 | 
					        "dirty-chai": "^2.0.1",
 | 
				
			||||||
        "mocha": "^4.0.1",
 | 
					        "mocha": "^4.0.1",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,12 +3,5 @@
 | 
				
			|||||||
    "compilerOptions": {
 | 
					    "compilerOptions": {
 | 
				
			||||||
        "outDir": "lib"
 | 
					        "outDir": "lib"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "include": [
 | 
					    "include": ["./src/**/*", "./test/**/*"]
 | 
				
			||||||
        "./src/**/*",
 | 
					 | 
				
			||||||
        "./test/**/*",
 | 
					 | 
				
			||||||
        "../../node_modules/chai-as-promised-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/chai-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/web3-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/ethers-typescript-typings/index.d.ts"
 | 
					 | 
				
			||||||
    ]
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,10 +14,10 @@ yarn add @0xproject/subproviders
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
					If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```json
 | 
				
			||||||
"include": [
 | 
					"compilerOptions": {
 | 
				
			||||||
    "./node_modules/web3-typescript-typings/index.d.ts",
 | 
					    "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
 | 
				
			||||||
]
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Contributing
 | 
					## Contributing
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,6 +36,7 @@
 | 
				
			|||||||
        "@0xproject/assert": "^0.2.3",
 | 
					        "@0xproject/assert": "^0.2.3",
 | 
				
			||||||
        "@0xproject/types": "^0.4.1",
 | 
					        "@0xproject/types": "^0.4.1",
 | 
				
			||||||
        "@0xproject/utils": "^0.4.3",
 | 
					        "@0xproject/utils": "^0.4.3",
 | 
				
			||||||
 | 
					        "@0xproject/typescript-typings": "^0.0.1",
 | 
				
			||||||
        "@ledgerhq/hw-app-eth": "^4.3.0",
 | 
					        "@ledgerhq/hw-app-eth": "^4.3.0",
 | 
				
			||||||
        "@ledgerhq/hw-transport-u2f": "^4.3.0",
 | 
					        "@ledgerhq/hw-transport-u2f": "^4.3.0",
 | 
				
			||||||
        "bn.js": "^4.11.8",
 | 
					        "bn.js": "^4.11.8",
 | 
				
			||||||
@@ -47,8 +48,7 @@
 | 
				
			|||||||
        "lodash": "^4.17.4",
 | 
					        "lodash": "^4.17.4",
 | 
				
			||||||
        "semaphore-async-await": "^1.5.1",
 | 
					        "semaphore-async-await": "^1.5.1",
 | 
				
			||||||
        "web3": "^0.20.0",
 | 
					        "web3": "^0.20.0",
 | 
				
			||||||
        "web3-provider-engine": "^13.0.1",
 | 
					        "web3-provider-engine": "^13.0.1"
 | 
				
			||||||
        "web3-typescript-typings": "^0.10.2"
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "devDependencies": {
 | 
					    "devDependencies": {
 | 
				
			||||||
        "@0xproject/monorepo-scripts": "^0.1.14",
 | 
					        "@0xproject/monorepo-scripts": "^0.1.14",
 | 
				
			||||||
@@ -59,8 +59,6 @@
 | 
				
			|||||||
        "@types/node": "^8.0.53",
 | 
					        "@types/node": "^8.0.53",
 | 
				
			||||||
        "chai": "^4.0.1",
 | 
					        "chai": "^4.0.1",
 | 
				
			||||||
        "chai-as-promised": "^7.1.0",
 | 
					        "chai-as-promised": "^7.1.0",
 | 
				
			||||||
        "chai-as-promised-typescript-typings": "^0.0.12",
 | 
					 | 
				
			||||||
        "chai-typescript-typings": "^0.0.6",
 | 
					 | 
				
			||||||
        "copyfiles": "^1.2.0",
 | 
					        "copyfiles": "^1.2.0",
 | 
				
			||||||
        "dirty-chai": "^2.0.1",
 | 
					        "dirty-chai": "^2.0.1",
 | 
				
			||||||
        "mocha": "^4.0.1",
 | 
					        "mocha": "^4.0.1",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,10 +6,7 @@
 | 
				
			|||||||
    "include": [
 | 
					    "include": [
 | 
				
			||||||
        "./src/**/*",
 | 
					        "./src/**/*",
 | 
				
			||||||
        "./test/**/*",
 | 
					        "./test/**/*",
 | 
				
			||||||
        "../../node_modules/chai-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/web3-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/types-bn/index.d.ts",
 | 
					        "../../node_modules/types-bn/index.d.ts",
 | 
				
			||||||
        "../../node_modules/types-ethereumjs-util/index.d.ts",
 | 
					        "../../node_modules/types-ethereumjs-util/index.d.ts"
 | 
				
			||||||
        "../../node_modules/chai-as-promised-typescript-typings/index.d.ts"
 | 
					 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,6 +18,7 @@
 | 
				
			|||||||
        "0x.js": "^0.33.6",
 | 
					        "0x.js": "^0.33.6",
 | 
				
			||||||
        "@0xproject/subproviders": "^0.8.2",
 | 
					        "@0xproject/subproviders": "^0.8.2",
 | 
				
			||||||
        "@0xproject/utils": "^0.4.3",
 | 
					        "@0xproject/utils": "^0.4.3",
 | 
				
			||||||
 | 
					        "@0xproject/typescript-typings": "^0.0.1",
 | 
				
			||||||
        "body-parser": "^1.17.1",
 | 
					        "body-parser": "^1.17.1",
 | 
				
			||||||
        "ethereumjs-tx": "^1.3.3",
 | 
					        "ethereumjs-tx": "^1.3.3",
 | 
				
			||||||
        "ethereumjs-util": "^5.1.1",
 | 
					        "ethereumjs-util": "^5.1.1",
 | 
				
			||||||
@@ -41,7 +42,6 @@
 | 
				
			|||||||
        "types-bn": "^0.0.1",
 | 
					        "types-bn": "^0.0.1",
 | 
				
			||||||
        "types-ethereumjs-util": "0xProject/types-ethereumjs-util",
 | 
					        "types-ethereumjs-util": "0xProject/types-ethereumjs-util",
 | 
				
			||||||
        "typescript": "2.7.1",
 | 
					        "typescript": "2.7.1",
 | 
				
			||||||
        "web3-typescript-typings": "^0.10.2",
 | 
					 | 
				
			||||||
        "webpack": "^3.1.0",
 | 
					        "webpack": "^3.1.0",
 | 
				
			||||||
        "webpack-node-externals": "^1.6.0"
 | 
					        "webpack-node-externals": "^1.6.0"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,9 +6,7 @@
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    "include": [
 | 
					    "include": [
 | 
				
			||||||
        "./src/ts/**/*",
 | 
					        "./src/ts/**/*",
 | 
				
			||||||
        "../../node_modules/ethers-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/types-bn/index.d.ts",
 | 
					        "../../node_modules/types-bn/index.d.ts",
 | 
				
			||||||
        "../../node_modules/types-ethereumjs-util/index.d.ts",
 | 
					        "../../node_modules/types-ethereumjs-util/index.d.ts"
 | 
				
			||||||
        "../../node_modules/web3-typescript-typings/index.d.ts"
 | 
					 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,5 +3,5 @@
 | 
				
			|||||||
    "compilerOptions": {
 | 
					    "compilerOptions": {
 | 
				
			||||||
        "outDir": "lib"
 | 
					        "outDir": "lib"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "include": ["./rules/**/*", "./monorepo_scripts/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"]
 | 
					    "include": ["./rules/**/*", "./monorepo_scripts/**/*"]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,10 +10,10 @@ yarn add -D @0xproject/types
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
					If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```json
 | 
				
			||||||
"include": [
 | 
					"compilerOptions": {
 | 
				
			||||||
    "./node_modules/web3-typescript-typings/index.d.ts",
 | 
					    "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
 | 
				
			||||||
]
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Usage
 | 
					## Usage
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,9 +28,9 @@
 | 
				
			|||||||
        "typescript": "2.7.1"
 | 
					        "typescript": "2.7.1"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "dependencies": {
 | 
					    "dependencies": {
 | 
				
			||||||
 | 
					        "@0xproject/typescript-typings": "^0.0.1",
 | 
				
			||||||
        "bignumber.js": "~4.1.0",
 | 
					        "bignumber.js": "~4.1.0",
 | 
				
			||||||
        "web3": "^0.20.0",
 | 
					        "web3": "^0.20.0"
 | 
				
			||||||
        "web3-typescript-typings": "^0.10.2"
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "publishConfig": {
 | 
					    "publishConfig": {
 | 
				
			||||||
        "access": "public"
 | 
					        "access": "public"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,5 +3,5 @@
 | 
				
			|||||||
    "compilerOptions": {
 | 
					    "compilerOptions": {
 | 
				
			||||||
        "outDir": "lib"
 | 
					        "outDir": "lib"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "include": ["./src/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"]
 | 
					    "include": ["./src/**/*"]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,21 +1,23 @@
 | 
				
			|||||||
## chai-as-promised-typescript-typings
 | 
					## @0xproject/typescript-typings
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Fork of type definitions for chai-as-promised that includes changes made by dirty-chai
 | 
					Type repository for external packages used by 0x. This is like our small version of [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Installation
 | 
					## Installation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```bash
 | 
					```bash
 | 
				
			||||||
yarn add -D chai-as-promised-typescript-typings
 | 
					yarn add -D @0xproject/typescript-typings
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Usage
 | 
					## Usage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Add the following line within an `include` section of your `tsconfig.json`
 | 
					Add the following line within an `compilerOptions` section of your `tsconfig.json`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```json
 | 
					```json
 | 
				
			||||||
"./node_modules/chai-as-promised-typescript-typings/index.d.ts"
 | 
					"typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"]
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This will allow the TS compiler to first look into that repo and then fallback to DT types.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Contributing
 | 
					## Contributing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
We strongly encourage that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
 | 
					We strongly encourage that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
 | 
				
			||||||
@@ -1,9 +1,7 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    "name": "chai-as-promised-typescript-typings",
 | 
					    "name": "@0xproject/typescript-typings",
 | 
				
			||||||
    "version": "0.0.12",
 | 
					    "version": "0.0.1",
 | 
				
			||||||
    "description": "Typescript type definitions for chai-as-promised",
 | 
					    "description": "0x project typescript type definitions",
 | 
				
			||||||
    "main": "index.d.ts",
 | 
					 | 
				
			||||||
    "types": "index.d.ts",
 | 
					 | 
				
			||||||
    "scripts": {
 | 
					    "scripts": {
 | 
				
			||||||
        "build": "tsc && copyfiles -u 1 './lib/**/*' ./scripts",
 | 
					        "build": "tsc && copyfiles -u 1 './lib/**/*' ./scripts",
 | 
				
			||||||
        "clean": "shx rm -rf scripts"
 | 
					        "clean": "shx rm -rf scripts"
 | 
				
			||||||
@@ -20,9 +18,9 @@
 | 
				
			|||||||
    "bugs": {
 | 
					    "bugs": {
 | 
				
			||||||
        "url": "https://github.com/0xProject/0x-monorepo/issues"
 | 
					        "url": "https://github.com/0xProject/0x-monorepo/issues"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "homepage": "https://github.com/0xProject/0x-monorepo/packages/chai-as-promised-typescript-typings#readme",
 | 
					    "homepage": "https://github.com/0xProject/0x-monorepo/packages/typescript-typings#readme",
 | 
				
			||||||
    "dependencies": {
 | 
					    "dependencies": {
 | 
				
			||||||
        "chai-typescript-typings": "^0.0.6"
 | 
					        "bignumber.js": "~4.1.0"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "devDependencies": {
 | 
					    "devDependencies": {
 | 
				
			||||||
        "@0xproject/monorepo-scripts": "^0.1.14",
 | 
					        "@0xproject/monorepo-scripts": "^0.1.14",
 | 
				
			||||||
@@ -10,10 +10,10 @@ yarn add @0xproject/utils
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
					If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```json
 | 
				
			||||||
"include": [
 | 
					"compilerOptions": {
 | 
				
			||||||
    "./node_modules/web3-typescript-typings/index.d.ts",
 | 
					    "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
 | 
				
			||||||
]
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Usage
 | 
					## Usage
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,14 +31,13 @@
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    "dependencies": {
 | 
					    "dependencies": {
 | 
				
			||||||
        "@0xproject/types": "^0.4.1",
 | 
					        "@0xproject/types": "^0.4.1",
 | 
				
			||||||
 | 
					        "@0xproject/typescript-typings": "^0.0.1",
 | 
				
			||||||
        "@types/node": "^8.0.53",
 | 
					        "@types/node": "^8.0.53",
 | 
				
			||||||
        "bignumber.js": "~4.1.0",
 | 
					        "bignumber.js": "~4.1.0",
 | 
				
			||||||
        "ethers-contracts": "^2.2.1",
 | 
					        "ethers-contracts": "^2.2.1",
 | 
				
			||||||
        "ethers-typescript-typings": "^0.0.4",
 | 
					 | 
				
			||||||
        "js-sha3": "^0.7.0",
 | 
					        "js-sha3": "^0.7.0",
 | 
				
			||||||
        "lodash": "^4.17.4",
 | 
					        "lodash": "^4.17.4",
 | 
				
			||||||
        "web3": "^0.20.0",
 | 
					        "web3": "^0.20.0"
 | 
				
			||||||
        "web3-typescript-typings": "^0.10.2"
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "publishConfig": {
 | 
					    "publishConfig": {
 | 
				
			||||||
        "access": "public"
 | 
					        "access": "public"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,9 +3,5 @@
 | 
				
			|||||||
    "compilerOptions": {
 | 
					    "compilerOptions": {
 | 
				
			||||||
        "outDir": "lib"
 | 
					        "outDir": "lib"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "include": [
 | 
					    "include": ["./src/**/*"]
 | 
				
			||||||
        "./src/**/*",
 | 
					 | 
				
			||||||
        "../../node_modules/web3-typescript-typings/index.d.ts",
 | 
					 | 
				
			||||||
        "../../node_modules/ethers-typescript-typings/index.d.ts"
 | 
					 | 
				
			||||||
    ]
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +0,0 @@
 | 
				
			|||||||
.*
 | 
					 | 
				
			||||||
yarn-error.log
 | 
					 | 
				
			||||||
/scripts/
 | 
					 | 
				
			||||||
/lib/monorepo_scripts/
 | 
					 | 
				
			||||||
@@ -1,16 +0,0 @@
 | 
				
			|||||||
# CHANGELOG
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## v0.10.0 - _March 4, 2018_
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    * Support ABIv2 (#401)
 | 
					 | 
				
			||||||
    * Add types for transaction traces (#426)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## v0.9.11 - _February 16, 2018_
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    * Fix `web3.net.peerCount` to be of type number instead of boolean (#397)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## v0.9.3 - _January 11, 2018_
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    * Fix `getTransactionReceipt` not returning null (#338)
 | 
					 | 
				
			||||||
    * Add type for getData on a contract
 | 
					 | 
				
			||||||
    * Fixed the `defaultAccount` not allowing for `undefined` value (#320)
 | 
					 | 
				
			||||||
@@ -1,49 +0,0 @@
 | 
				
			|||||||
## web3-typescript-typings
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
There currently isn't an official [Web3][web3]
 | 
					 | 
				
			||||||
type definition included in the [DefinitelyTyped][definitelytyped] project.
 | 
					 | 
				
			||||||
Until that happens, we will continue to improve our own type definition.
 | 
					 | 
				
			||||||
If it get's close to comprehensive, we'll add it to [DefinitelyTyped][definitelytyped].
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[web3]: https://github.com/ethereum/web3.js/
 | 
					 | 
				
			||||||
[definitelytyped]: https://github.com/DefinitelyTyped/DefinitelyTyped
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Installation
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```bash
 | 
					 | 
				
			||||||
yarn add -D web3-typescript-typings
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Usage
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Add the following line within an `include` section of your `tsconfig.json`
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```json
 | 
					 | 
				
			||||||
"./node_modules/web3-typescript-typings/index.d.ts"
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Contributing
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
We strongly encourage that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Install Dependencies
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```bash
 | 
					 | 
				
			||||||
yarn config set workspaces-experimental true
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Then install dependencies
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```bash
 | 
					 | 
				
			||||||
yarn install
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Lint
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```bash
 | 
					 | 
				
			||||||
yarn lint
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
@@ -1,6 +0,0 @@
 | 
				
			|||||||
declare module '*.json' {
 | 
					 | 
				
			||||||
    const json: any;
 | 
					 | 
				
			||||||
    /* tslint:disable */
 | 
					 | 
				
			||||||
    export default json;
 | 
					 | 
				
			||||||
    /* tslint:enable */
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,8 +0,0 @@
 | 
				
			|||||||
import { postpublishUtils } from '@0xproject/monorepo-scripts';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import * as packageJSON from '../package.json';
 | 
					 | 
				
			||||||
import * as tsConfigJSON from '../tsconfig.json';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const cwd = `${__dirname}/..`;
 | 
					 | 
				
			||||||
// tslint:disable-next-line:no-floating-promises
 | 
					 | 
				
			||||||
postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
 | 
					 | 
				
			||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user