aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-utils
diff options
context:
space:
mode:
authorHsuan Lee <hsuan@cobinhood.com>2019-01-19 18:42:04 +0800
committerHsuan Lee <hsuan@cobinhood.com>2019-01-19 18:42:04 +0800
commit7ae38906926dc09bc10670c361af0d2bf0050426 (patch)
tree5fb10ae366b987db09e4ddb4bc3ba0f75404ad08 /packages/dev-utils
parentb5fd3c72a08aaa6957917d74c333387a16edf66b (diff)
downloaddexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar
dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.gz
dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.bz2
dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.lz
dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.xz
dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.zst
dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.zip
Update dependency packages
Diffstat (limited to 'packages/dev-utils')
-rw-r--r--packages/dev-utils/.npmignore7
-rw-r--r--packages/dev-utils/CHANGELOG.json408
-rw-r--r--packages/dev-utils/CHANGELOG.md175
-rw-r--r--packages/dev-utils/README.md95
-rw-r--r--packages/dev-utils/coverage/.gitkeep0
-rw-r--r--packages/dev-utils/package.json57
-rw-r--r--packages/dev-utils/src/blockchain_lifecycle.ts98
-rw-r--r--packages/dev-utils/src/callback_error_reporter.ts77
-rw-r--r--packages/dev-utils/src/constants.ts6
-rw-r--r--packages/dev-utils/src/env.ts26
-rw-r--r--packages/dev-utils/src/globals.d.ts6
-rw-r--r--packages/dev-utils/src/index.ts5
-rw-r--r--packages/dev-utils/src/web3_factory.ts71
-rw-r--r--packages/dev-utils/test/.npmignore5
-rw-r--r--packages/dev-utils/test/blockchain_lifecycle_test.ts26
-rw-r--r--packages/dev-utils/test/rpc_test.ts43
-rw-r--r--packages/dev-utils/tsconfig.json8
-rw-r--r--packages/dev-utils/tslint.json6
18 files changed, 0 insertions, 1119 deletions
diff --git a/packages/dev-utils/.npmignore b/packages/dev-utils/.npmignore
deleted file mode 100644
index 44df80fad..000000000
--- a/packages/dev-utils/.npmignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.*
-yarn-error.log
-/src/
-/scripts/
-test/
-tsconfig.json
-/lib/src/monorepo_scripts/
diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json
deleted file mode 100644
index d05e41d2d..000000000
--- a/packages/dev-utils/CHANGELOG.json
+++ /dev/null
@@ -1,408 +0,0 @@
-[
- {
- "version": "2.0.0",
- "changes": [
- {
- "note": "Upgrade the bignumber.js to v8.0.2",
- "pr": 1517
- }
- ]
- },
- {
- "timestamp": 1547561734,
- "version": "1.0.24",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1547225310,
- "version": "1.0.23",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1547040760,
- "version": "1.0.22",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "1.0.21",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ],
- "timestamp": 1544739608
- },
- {
- "version": "1.0.20",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ],
- "timestamp": 1544570656
- },
- {
- "timestamp": 1543401373,
- "version": "1.0.19",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1542821676,
- "version": "1.0.18",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1542208198,
- "version": "1.0.17",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1542134075,
- "version": "1.0.16",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1542028948,
- "version": "1.0.15",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "1.0.14",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ],
- "timestamp": 1541740904
- },
- {
- "version": "1.0.13",
- "changes": [
- {
- "note": "Make web3-provider-engine types a 'dependency' so it's available to users of the library",
- "pr": 1105
- }
- ],
- "timestamp": 1539871071
- },
- {
- "version": "1.0.12",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ],
- "timestamp": 1538693146
- },
- {
- "timestamp": 1538157789,
- "version": "1.0.11",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1537907159,
- "version": "1.0.10",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1537875740,
- "version": "1.0.9",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1537541580,
- "version": "1.0.8",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1536142250,
- "version": "1.0.7",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1535377027,
- "version": "1.0.6",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1535133899,
- "version": "1.0.5",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1534210131,
- "version": "1.0.4",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "1.0.3",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ],
- "timestamp": 1532619515
- },
- {
- "timestamp": 1532605697,
- "version": "1.0.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1532357734,
- "version": "1.0.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1532043000,
- "version": "1.0.0",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1531919263,
- "version": "0.4.6",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1531149657,
- "version": "0.4.5",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1529397769,
- "version": "0.4.4",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "0.4.3",
- "changes": [
- {
- "note": "Add optional parameter shouldUseFakeGasEstimate to Web3Config",
- "pr": 622
- },
- {
- "note": "Add SolidityProfiler to EnvVars",
- "pr": 675
- }
- ],
- "timestamp": 1527008544
- },
- {
- "version": "0.4.2",
- "changes": [
- {
- "note": "Pass SolCompilerArtifactAdapter to CoverageSubprovider",
- "pr": 589
- },
- {
- "note": "Move callbackErrorReporter over from 0x.js",
- "pr": 579
- }
- ],
- "timestamp": 1527008544
- },
- {
- "timestamp": 1525477860,
- "version": "0.4.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "0.4.0",
- "changes": [
- {
- "note": "Update web3 provider engine to 14.0.4",
- "pr": 555
- }
- ],
- "timestamp": 1525428773
- },
- {
- "version": "0.3.6",
- "changes": [
- {
- "note": "Allow an rpcURL to be set in Web3Config (for testnet RPC endpoints)",
- "pr": 524
- }
- ],
- "timestamp": 1524044013
- },
- {
- "timestamp": 1523462196,
- "version": "0.3.5",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1522673609,
- "version": "0.3.4",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1522658513,
- "version": "0.3.3",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "0.3.1",
- "changes": [
- {
- "note": "Reduce npm package size by adding an `.npmignore` file."
- },
- {
- "note": "Move `@0xproject/web3-wrapper` to dependencies from devDependencies."
- }
- ],
- "timestamp": 1521298800
- },
- {
- "version": "0.3.0",
- "changes": [
- {
- "note": "Add coverage subprovider if SOLIDITY_COVERAGE env variable is true",
- "pr": 426
- },
- {
- "note": "Refactor `BlockchainLifecycle` to work with in-process ganache",
- "pr": 426
- },
- {
- "note": "Remove `RPC` class and move it's logic to `Web3Wrapper`",
- "pr": 426
- }
- ],
- "timestamp": 1521298800
- },
- {
- "version": "0.2.0",
- "changes": [
- {
- "note": "Remove subproviders",
- "pr": 392
- }
- ],
- "timestamp": 1518706800
- },
- {
- "version": "0.0.12",
- "changes": [
- {
- "note": "Fix publishing issue where .npmignore was not properly excluding undesired content",
- "pr": 389
- }
- ],
- "timestamp": 1518102000
- },
- {
- "version": "0.0.11",
- "changes": [
- {
- "note": "Updated `types-ethereumjs-util` dev dependency",
- "pr": 352
- }
- ],
- "timestamp": 1517929200
- }
-]
diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md
deleted file mode 100644
index 958fded86..000000000
--- a/packages/dev-utils/CHANGELOG.md
+++ /dev/null
@@ -1,175 +0,0 @@
-<!--
-changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
-Edit the package's CHANGELOG.json file only.
--->
-
-CHANGELOG
-
-## v1.0.24 - _January 15, 2019_
-
- * Dependencies updated
-
-## v1.0.23 - _January 11, 2019_
-
- * Dependencies updated
-
-## v1.0.22 - _January 9, 2019_
-
- * Dependencies updated
-
-## v1.0.21 - _December 13, 2018_
-
- * Dependencies updated
-
-## v1.0.20 - _December 11, 2018_
-
- * Dependencies updated
-
-## v1.0.19 - _November 28, 2018_
-
- * Dependencies updated
-
-## v1.0.18 - _November 21, 2018_
-
- * Dependencies updated
-
-## v1.0.17 - _November 14, 2018_
-
- * Dependencies updated
-
-## v1.0.16 - _November 13, 2018_
-
- * Dependencies updated
-
-## v1.0.15 - _November 12, 2018_
-
- * Dependencies updated
-
-## v1.0.14 - _November 9, 2018_
-
- * Dependencies updated
-
-## v1.0.13 - _October 18, 2018_
-
- * Make web3-provider-engine types a 'dependency' so it's available to users of the library (#1105)
-
-## v1.0.12 - _October 4, 2018_
-
- * Dependencies updated
-
-## v1.0.11 - _September 28, 2018_
-
- * Dependencies updated
-
-## v1.0.10 - _September 25, 2018_
-
- * Dependencies updated
-
-## v1.0.9 - _September 25, 2018_
-
- * Dependencies updated
-
-## v1.0.8 - _September 21, 2018_
-
- * Dependencies updated
-
-## v1.0.7 - _September 5, 2018_
-
- * Dependencies updated
-
-## v1.0.6 - _August 27, 2018_
-
- * Dependencies updated
-
-## v1.0.5 - _August 24, 2018_
-
- * Dependencies updated
-
-## v1.0.4 - _August 14, 2018_
-
- * Dependencies updated
-
-## v1.0.3 - _July 26, 2018_
-
- * Dependencies updated
-
-## v1.0.2 - _July 26, 2018_
-
- * Dependencies updated
-
-## v1.0.1 - _July 23, 2018_
-
- * Dependencies updated
-
-## v1.0.0 - _July 19, 2018_
-
- * Dependencies updated
-
-## v0.4.6 - _July 18, 2018_
-
- * Dependencies updated
-
-## v0.4.5 - _July 9, 2018_
-
- * Dependencies updated
-
-## v0.4.4 - _June 19, 2018_
-
- * Dependencies updated
-
-## v0.4.3 - _May 22, 2018_
-
- * Add optional parameter shouldUseFakeGasEstimate to Web3Config (#622)
- * Add SolidityProfiler to EnvVars (#675)
-
-## v0.4.2 - _May 22, 2018_
-
- * Pass SolCompilerArtifactAdapter to CoverageSubprovider (#589)
- * Move callbackErrorReporter over from 0x.js (#579)
-
-## v0.4.1 - _May 4, 2018_
-
- * Dependencies updated
-
-## v0.4.0 - _May 4, 2018_
-
- * Update web3 provider engine to 14.0.4 (#555)
-
-## v0.3.6 - _April 18, 2018_
-
- * Allow an rpcURL to be set in Web3Config (for testnet RPC endpoints) (#524)
-
-## v0.3.5 - _April 11, 2018_
-
- * Dependencies updated
-
-## v0.3.4 - _April 2, 2018_
-
- * Dependencies updated
-
-## v0.3.3 - _April 2, 2018_
-
- * Dependencies updated
-
-## v0.3.1 - _March 17, 2018_
-
- * Reduce npm package size by adding an `.npmignore` file.
- * Move `@0xproject/web3-wrapper` to dependencies from devDependencies.
-
-## v0.3.0 - _March 17, 2018_
-
- * Add coverage subprovider if SOLIDITY_COVERAGE env variable is true (#426)
- * Refactor `BlockchainLifecycle` to work with in-process ganache (#426)
- * Remove `RPC` class and move it's logic to `Web3Wrapper` (#426)
-
-## v0.2.0 - _February 15, 2018_
-
- * Remove subproviders (#392)
-
-## v0.0.12 - _February 8, 2018_
-
- * Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
-
-## v0.0.11 - _February 6, 2018_
-
- * Updated `types-ethereumjs-util` dev dependency (#352)
diff --git a/packages/dev-utils/README.md b/packages/dev-utils/README.md
deleted file mode 100644
index b85159dd8..000000000
--- a/packages/dev-utils/README.md
+++ /dev/null
@@ -1,95 +0,0 @@
-## Dev utils
-
-Dev utils to be shared across 0x projects and packages
-
-## Configuration
-
-Some env variables might be set to change the behaviour of created web3 providers/instances.
-
-```
-VERBOSE_GANACHE: boolean. Enables verbose Ganache logging. Every request/response payload. Slightly slower, but useful for testing.
-SOLIDITY_COVERAGE: boolean. If set - adds coverage subprovider which intercepts all calls/transactions and can be later used to compute code coverage.
-```
-
-Boolean env variables should be either `true` or `false`. Defaults to `false` if not set.
-
-## Install
-
-```bash
-yarn add @0x/dev-utils
-```
-
-If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
-
-```json
-"compilerOptions": {
- "typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
-}
-```
-
-## Troubleshooting
-
-If you are still seeing TS type errors complaining about missing DOM types such as `Response`:
-
-```
-error TS2304: Cannot find name 'Response'.
-```
-
-Then you need to explicitly add the `dom` lib to your compiler options in `tsconfig.json`. The `dom` library is included by default, but customizing the `lib` option can cause it to be dropped.
-
-```
-"compilerOptions": {
- "lib": [..., "dom"],
-```
-
-## Contributing
-
-We welcome improvements and fixes from the wider community! 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
-```
-
-### Build
-
-To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
-
-```bash
-PKG=@0x/dev-utils yarn build
-```
-
-Or continuously rebuild on change:
-
-```bash
-PKG=@0x/dev-utils yarn watch
-```
-
-### Clean
-
-```bash
-yarn clean
-```
-
-### Lint
-
-```bash
-yarn lint
-```
-
-### Run Tests
-
-```bash
-yarn test
-```
diff --git a/packages/dev-utils/coverage/.gitkeep b/packages/dev-utils/coverage/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
--- a/packages/dev-utils/coverage/.gitkeep
+++ /dev/null
diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json
deleted file mode 100644
index 4ab1d6439..000000000
--- a/packages/dev-utils/package.json
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- "name": "@0x/dev-utils",
- "version": "1.0.24",
- "engines": {
- "node": ">=6.12"
- },
- "description": "0x dev TS utils",
- "main": "lib/src/index.js",
- "types": "lib/src/index.d.ts",
- "scripts": {
- "build": "tsc -b",
- "build:ci": "yarn build",
- "test": "yarn run_mocha",
- "rebuild_and_test": "run-s clean build test",
- "test:circleci": "yarn test:coverage",
- "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --bail --exit",
- "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
- "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
- "clean": "shx rm -rf lib",
- "lint": "tslint --format stylish --project ."
- },
- "license": "Apache-2.0",
- "repository": {
- "type": "git",
- "url": "https://github.com/0xProject/0x-monorepo.git"
- },
- "bugs": {
- "url": "https://github.com/0xProject/0x-monorepo/issues"
- },
- "homepage": "https://github.com/0xProject/0x-monorepo/packages/dev-utils/README.md",
- "devDependencies": {
- "@0x/tslint-config": "^2.0.2",
- "@types/lodash": "4.14.104",
- "@types/mocha": "^2.2.42",
- "make-promises-safe": "^1.1.0",
- "mocha": "^4.1.0",
- "npm-run-all": "^4.1.2",
- "nyc": "^11.0.1",
- "shx": "^0.2.2",
- "tslint": "5.11.0",
- "typescript": "3.0.1"
- },
- "dependencies": {
- "@0x/subproviders": "^2.1.11",
- "@0x/types": "^1.5.2",
- "@0x/typescript-typings": "^3.0.8",
- "@0x/utils": "^3.0.1",
- "@0x/web3-wrapper": "^3.2.4",
- "@types/web3-provider-engine": "^14.0.0",
- "chai": "^4.0.1",
- "ethereum-types": "^1.1.6",
- "lodash": "^4.17.5"
- },
- "publishConfig": {
- "access": "public"
- }
-}
diff --git a/packages/dev-utils/src/blockchain_lifecycle.ts b/packages/dev-utils/src/blockchain_lifecycle.ts
deleted file mode 100644
index e9687787f..000000000
--- a/packages/dev-utils/src/blockchain_lifecycle.ts
+++ /dev/null
@@ -1,98 +0,0 @@
-import { logUtils } from '@0x/utils';
-import { NodeType, Web3Wrapper } from '@0x/web3-wrapper';
-import * as _ from 'lodash';
-
-// HACK(albrow): 🐉 We have to do this so that debug.setHead works correctly.
-// (Geth does not seem to like debug.setHead(0), so by sending some transactions
-// we increase the current block number beyond 0). Additionally, some tests seem
-// to break when there are fewer than 3 blocks in the chain. (We have no idea
-// why, but it was consistently reproducible).
-const MINIMUM_BLOCKS = 3;
-
-export class BlockchainLifecycle {
- private readonly _web3Wrapper: Web3Wrapper;
- private readonly _snapshotIdsStack: number[];
- private _addresses: string[] = [];
- private _nodeType: NodeType | undefined;
- constructor(web3Wrapper: Web3Wrapper) {
- this._web3Wrapper = web3Wrapper;
- this._snapshotIdsStack = [];
- }
- public async startAsync(): Promise<void> {
- const nodeType = await this._getNodeTypeAsync();
- switch (nodeType) {
- case NodeType.Ganache:
- const snapshotId = await this._web3Wrapper.takeSnapshotAsync();
- this._snapshotIdsStack.push(snapshotId);
- break;
- case NodeType.Geth:
- let blockNumber = await this._web3Wrapper.getBlockNumberAsync();
- if (blockNumber < MINIMUM_BLOCKS) {
- // If the minimum block number is not met, force Geth to
- // mine some blocks by sending some dummy transactions.
- await this._mineMinimumBlocksAsync();
- blockNumber = await this._web3Wrapper.getBlockNumberAsync();
- }
- this._snapshotIdsStack.push(blockNumber);
- // HACK(albrow) It's possible that we applied a time offset but
- // the transaction we mined to put that time offset into the
- // blockchain was reverted. As a workaround, we mine a new dummy
- // block so that the latest block timestamp accounts for any
- // possible time offsets.
- await this._mineDummyBlockAsync();
- break;
- default:
- throw new Error(`Unknown node type: ${nodeType}`);
- }
- }
- public async revertAsync(): Promise<void> {
- const nodeType = await this._getNodeTypeAsync();
- switch (nodeType) {
- case NodeType.Ganache:
- const snapshotId = this._snapshotIdsStack.pop() as number;
- const didRevert = await this._web3Wrapper.revertSnapshotAsync(snapshotId);
- if (!didRevert) {
- throw new Error(`Snapshot with id #${snapshotId} failed to revert`);
- }
- break;
- case NodeType.Geth:
- const blockNumber = this._snapshotIdsStack.pop() as number;
- await this._web3Wrapper.setHeadAsync(blockNumber);
- break;
- default:
- throw new Error(`Unknown node type: ${nodeType}`);
- }
- }
- private async _mineMinimumBlocksAsync(): Promise<void> {
- logUtils.warn('WARNING: minimum block number for tests not met. Mining additional blocks...');
- while ((await this._web3Wrapper.getBlockNumberAsync()) < MINIMUM_BLOCKS) {
- logUtils.warn('Mining block...');
- await this._mineDummyBlockAsync();
- }
- logUtils.warn('Done mining the minimum number of blocks.');
- }
- private async _getNodeTypeAsync(): Promise<NodeType> {
- if (_.isUndefined(this._nodeType)) {
- this._nodeType = await this._web3Wrapper.getNodeTypeAsync();
- }
- return this._nodeType;
- }
- // Sends a transaction that has no real effect on the state and waits for it
- // to be mined.
- private async _mineDummyBlockAsync(): Promise<void> {
- if (this._addresses.length === 0) {
- this._addresses = await this._web3Wrapper.getAvailableAddressesAsync();
- if (this._addresses.length === 0) {
- throw new Error('No accounts found');
- }
- }
- await this._web3Wrapper.awaitTransactionMinedAsync(
- await this._web3Wrapper.sendTransactionAsync({
- from: this._addresses[0],
- to: this._addresses[0],
- value: '0',
- }),
- 0,
- );
- }
-}
diff --git a/packages/dev-utils/src/callback_error_reporter.ts b/packages/dev-utils/src/callback_error_reporter.ts
deleted file mode 100644
index b993bf22a..000000000
--- a/packages/dev-utils/src/callback_error_reporter.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-import * as chai from 'chai';
-import * as _ from 'lodash';
-
-import { DoneCallback } from '@0x/types';
-
-const expect = chai.expect;
-
-export const callbackErrorReporter = {
- reportNoErrorCallbackErrors(
- done: DoneCallback,
- expectToBeCalledOnce: boolean = true,
- ): <T>(f?: ((value: T) => void) | undefined) => (value: T) => void {
- const callback = <T>(f?: (value: T) => void) => {
- const wrapped = (value: T) => {
- if (_.isUndefined(f)) {
- done();
- return;
- }
- try {
- f(value);
- if (expectToBeCalledOnce) {
- done();
- }
- } catch (err) {
- done(err);
- }
- };
- return wrapped;
- };
- return callback;
- },
- reportNodeCallbackErrors(
- done: DoneCallback,
- expectToBeCalledOnce: boolean = true,
- ): <T>(f?: ((value: T) => void) | undefined) => (error: Error | null, value: T | undefined) => void {
- const callback = <T>(f?: (value: T) => void) => {
- const wrapped = (error: Error | null, value: T | undefined) => {
- if (!_.isNull(error)) {
- done(error);
- } else {
- if (_.isUndefined(f)) {
- done();
- return;
- }
- try {
- f(value as T);
- if (expectToBeCalledOnce) {
- done();
- }
- } catch (err) {
- done(err);
- }
- }
- };
- return wrapped;
- };
- return callback;
- },
- assertNodeCallbackError(
- done: DoneCallback,
- errMsg: string,
- ): <T>(error: Error | null, value: T | undefined) => void {
- const wrapped = <T>(error: Error | null, _value: T | undefined) => {
- if (_.isNull(error)) {
- done(new Error('Expected callback to receive an error'));
- } else {
- try {
- expect(error.message).to.be.equal(errMsg);
- done();
- } catch (err) {
- done(err);
- }
- }
- };
- return wrapped;
- },
-};
diff --git a/packages/dev-utils/src/constants.ts b/packages/dev-utils/src/constants.ts
deleted file mode 100644
index 56e87d764..000000000
--- a/packages/dev-utils/src/constants.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-export const constants = {
- RPC_URL: 'http://localhost:8545',
- RPC_PORT: 8545,
- GAS_LIMIT: 7000000,
- TESTRPC_FIRST_ADDRESS: '0x5409ed021d9299bf6814279a6a1411a7e866a631',
-};
diff --git a/packages/dev-utils/src/env.ts b/packages/dev-utils/src/env.ts
deleted file mode 100644
index 024162c2f..000000000
--- a/packages/dev-utils/src/env.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import * as _ from 'lodash';
-import * as process from 'process';
-
-export enum EnvVars {
- SolidityCoverage = 'SOLIDITY_COVERAGE',
- SolidityProfiler = 'SOLIDITY_PROFILER',
- SolidityRevertTrace = 'SOLIDITY_REVERT_TRACE',
- VerboseGanache = 'VERBOSE_GANACHE',
-}
-
-export const env = {
- parseBoolean(key: string): boolean {
- let isTrue: boolean;
- const envVarValue = process.env[key];
- if (envVarValue === 'true') {
- isTrue = true;
- } else if (envVarValue === 'false' || _.isUndefined(envVarValue)) {
- isTrue = false;
- } else {
- throw new Error(
- `Failed to parse ENV variable ${key} as boolean. Please make sure it's either true or false. Defaults to false`,
- );
- }
- return isTrue;
- },
-};
diff --git a/packages/dev-utils/src/globals.d.ts b/packages/dev-utils/src/globals.d.ts
deleted file mode 100644
index 94e63a32d..000000000
--- a/packages/dev-utils/src/globals.d.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-declare module '*.json' {
- const json: any;
- /* tslint:disable */
- export default json;
- /* tslint:enable */
-}
diff --git a/packages/dev-utils/src/index.ts b/packages/dev-utils/src/index.ts
deleted file mode 100644
index d4c19f1bf..000000000
--- a/packages/dev-utils/src/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export { BlockchainLifecycle } from './blockchain_lifecycle';
-export { web3Factory } from './web3_factory';
-export { constants as devConstants } from './constants';
-export { env, EnvVars } from './env';
-export { callbackErrorReporter } from './callback_error_reporter';
diff --git a/packages/dev-utils/src/web3_factory.ts b/packages/dev-utils/src/web3_factory.ts
deleted file mode 100644
index 5f8981a46..000000000
--- a/packages/dev-utils/src/web3_factory.ts
+++ /dev/null
@@ -1,71 +0,0 @@
-import {
- EmptyWalletSubprovider,
- FakeGasEstimateSubprovider,
- GanacheSubprovider,
- RPCSubprovider,
- Web3ProviderEngine,
-} from '@0x/subproviders';
-import * as fs from 'fs';
-import * as _ from 'lodash';
-
-import { constants } from './constants';
-import { env, EnvVars } from './env';
-
-export interface Web3Config {
- hasAddresses?: boolean; // default: true
- shouldUseInProcessGanache?: boolean; // default: false
- shouldThrowErrorsOnGanacheRPCResponse?: boolean; // default: true
- rpcUrl?: string; // default: localhost:8545
- shouldUseFakeGasEstimate?: boolean; // default: true
- ganacheDatabasePath?: string; // default: undefined, creates a tmp dir
-}
-
-export const web3Factory = {
- getRpcProvider(config: Web3Config = {}): Web3ProviderEngine {
- const provider = new Web3ProviderEngine();
- const hasAddresses = _.isUndefined(config.hasAddresses) || config.hasAddresses;
- config.shouldUseFakeGasEstimate =
- _.isUndefined(config.shouldUseFakeGasEstimate) || config.shouldUseFakeGasEstimate;
- if (!hasAddresses) {
- provider.addProvider(new EmptyWalletSubprovider());
- }
-
- if (config.shouldUseFakeGasEstimate) {
- provider.addProvider(new FakeGasEstimateSubprovider(constants.GAS_LIMIT));
- }
- const logger = {
- log: (arg: any) => {
- fs.appendFileSync('ganache.log', `${arg}\n`);
- },
- };
- const shouldUseInProcessGanache = !!config.shouldUseInProcessGanache;
- if (shouldUseInProcessGanache) {
- if (!_.isUndefined(config.rpcUrl)) {
- throw new Error('Cannot use both GanacheSubrovider and RPCSubprovider');
- }
- const shouldThrowErrorsOnGanacheRPCResponse =
- _.isUndefined(config.shouldThrowErrorsOnGanacheRPCResponse) ||
- config.shouldThrowErrorsOnGanacheRPCResponse;
- if (!_.isUndefined(config.ganacheDatabasePath)) {
- // Saving the snapshot to a local db. Ganache requires this directory to exist
- fs.mkdirSync(config.ganacheDatabasePath);
- }
- provider.addProvider(
- new GanacheSubprovider({
- vmErrorsOnRPCResponse: shouldThrowErrorsOnGanacheRPCResponse,
- db_path: config.ganacheDatabasePath,
- gasLimit: constants.GAS_LIMIT,
- logger,
- verbose: env.parseBoolean(EnvVars.VerboseGanache),
- port: 8545,
- network_id: 50,
- mnemonic: 'concert load couple harbor equip island argue ramp clarify fence smart topic',
- } as any), // TODO remove any once types are merged in DefinitelyTyped
- );
- } else {
- provider.addProvider(new RPCSubprovider(config.rpcUrl || constants.RPC_URL));
- }
- provider.start();
- return provider;
- },
-};
diff --git a/packages/dev-utils/test/.npmignore b/packages/dev-utils/test/.npmignore
deleted file mode 100644
index 87bc30436..000000000
--- a/packages/dev-utils/test/.npmignore
+++ /dev/null
@@ -1,5 +0,0 @@
-.*
-yarn-error.log
-/src/
-/scripts/
-tsconfig.json
diff --git a/packages/dev-utils/test/blockchain_lifecycle_test.ts b/packages/dev-utils/test/blockchain_lifecycle_test.ts
deleted file mode 100644
index d7e54f0e8..000000000
--- a/packages/dev-utils/test/blockchain_lifecycle_test.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import * as chai from 'chai';
-import 'mocha';
-
-import { BlockchainLifecycle, web3Factory } from '../src';
-
-const expect = chai.expect;
-
-describe('BlockchainLifecycle tests', () => {
- const provider = web3Factory.getRpcProvider({ shouldUseInProcessGanache: true });
- const web3Wrapper = new Web3Wrapper(provider);
- const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
- describe('#startAsync/revertAsync', () => {
- it('reverts changes in between', async () => {
- const blockNumberBefore = await web3Wrapper.getBlockNumberAsync();
- await blockchainLifecycle.startAsync();
- await web3Wrapper.mineBlockAsync();
- const blockNumberAfter = await web3Wrapper.getBlockNumberAsync();
- // tslint:disable-next-line:restrict-plus-operands
- expect(blockNumberAfter).to.be.equal(blockNumberBefore + 1);
- await blockchainLifecycle.revertAsync();
- const blockNumberAfterRevert = await web3Wrapper.getBlockNumberAsync();
- expect(blockNumberAfterRevert).to.be.equal(blockNumberBefore);
- });
- });
-});
diff --git a/packages/dev-utils/test/rpc_test.ts b/packages/dev-utils/test/rpc_test.ts
deleted file mode 100644
index f8cea4580..000000000
--- a/packages/dev-utils/test/rpc_test.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import * as chai from 'chai';
-import { BlockParamLiteral } from 'ethereum-types';
-import 'mocha';
-
-import { web3Factory } from '../src';
-
-const expect = chai.expect;
-
-describe('RPC tests', () => {
- const provider = web3Factory.getRpcProvider({ shouldUseInProcessGanache: true });
- const web3Wrapper = new Web3Wrapper(provider);
- describe('#mineBlockAsync', () => {
- it('increases block number when called', async () => {
- const blockNumberBefore = await web3Wrapper.getBlockNumberAsync();
- await web3Wrapper.mineBlockAsync();
- const blockNumberAfter = await web3Wrapper.getBlockNumberAsync();
- // tslint:disable-next-line:restrict-plus-operands
- expect(blockNumberAfter).to.be.equal(blockNumberBefore + 1);
- });
- });
- describe('#increaseTimeAsync', () => {
- it('increases time when called', async () => {
- const TIME_DELTA = 1000;
- const blockTimestampBefore = await web3Wrapper.getBlockTimestampAsync(BlockParamLiteral.Latest);
- await web3Wrapper.increaseTimeAsync(TIME_DELTA);
- await web3Wrapper.mineBlockAsync();
- const blockTimestampAfter = await web3Wrapper.getBlockTimestampAsync(BlockParamLiteral.Latest);
- // tslint:disable-next-line:restrict-plus-operands
- expect(blockTimestampAfter).to.be.at.least(blockTimestampBefore + TIME_DELTA);
- });
- });
- describe('#takeSnapshotAsync/revertSnapshotAsync', () => {
- it('reverts changes in between', async () => {
- const blockNumberBefore = await web3Wrapper.getBlockNumberAsync();
- const snapshotId = await web3Wrapper.takeSnapshotAsync();
- await web3Wrapper.mineBlockAsync();
- await web3Wrapper.revertSnapshotAsync(snapshotId);
- const blockNumberAfter = await web3Wrapper.getBlockNumberAsync();
- expect(blockNumberAfter).to.be.equal(blockNumberBefore);
- });
- });
-});
diff --git a/packages/dev-utils/tsconfig.json b/packages/dev-utils/tsconfig.json
deleted file mode 100644
index 2ee711adc..000000000
--- a/packages/dev-utils/tsconfig.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "extends": "../../tsconfig",
- "compilerOptions": {
- "outDir": "lib",
- "rootDir": "."
- },
- "include": ["./src/**/*", "./test/**/*"]
-}
diff --git a/packages/dev-utils/tslint.json b/packages/dev-utils/tslint.json
deleted file mode 100644
index 631f46bca..000000000
--- a/packages/dev-utils/tslint.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "extends": ["@0x/tslint-config"],
- "rules": {
- "completed-docs": false
- }
-}