aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-utils
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-05-15 21:14:36 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-05-23 06:20:34 +0800
commit1ff34bd0f4084d2f9dfd6f07447bb63684ac51ac (patch)
treee7f1870dab995b33c381924707a17acc1feaf3c8 /packages/dev-utils
parentb86248f13fcb8f326098252beee6ca557e0175e7 (diff)
downloaddexon-sol-tools-1ff34bd0f4084d2f9dfd6f07447bb63684ac51ac.tar
dexon-sol-tools-1ff34bd0f4084d2f9dfd6f07447bb63684ac51ac.tar.gz
dexon-sol-tools-1ff34bd0f4084d2f9dfd6f07447bb63684ac51ac.tar.bz2
dexon-sol-tools-1ff34bd0f4084d2f9dfd6f07447bb63684ac51ac.tar.lz
dexon-sol-tools-1ff34bd0f4084d2f9dfd6f07447bb63684ac51ac.tar.xz
dexon-sol-tools-1ff34bd0f4084d2f9dfd6f07447bb63684ac51ac.tar.zst
dexon-sol-tools-1ff34bd0f4084d2f9dfd6f07447bb63684ac51ac.zip
Remove web3Factory.create and remove dev-tools dependency on sol-cov
Diffstat (limited to 'packages/dev-utils')
-rw-r--r--packages/dev-utils/package.json1
-rw-r--r--packages/dev-utils/src/coverage.ts22
-rw-r--r--packages/dev-utils/src/index.ts1
-rw-r--r--packages/dev-utils/src/web3_factory.ts20
4 files changed, 1 insertions, 43 deletions
diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json
index 49964c82a..9dd3750c5 100644
--- a/packages/dev-utils/package.json
+++ b/packages/dev-utils/package.json
@@ -44,7 +44,6 @@
"typescript": "2.7.1"
},
"dependencies": {
- "@0xproject/sol-cov": "^0.0.10",
"@0xproject/subproviders": "^0.10.1",
"@0xproject/types": "^0.6.3",
"@0xproject/typescript-typings": "^0.3.1",
diff --git a/packages/dev-utils/src/coverage.ts b/packages/dev-utils/src/coverage.ts
deleted file mode 100644
index caf04672f..000000000
--- a/packages/dev-utils/src/coverage.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { CoverageSubprovider, ZeroExArtifactAdapter } from '@0xproject/sol-cov';
-import * as _ from 'lodash';
-
-import { constants } from './constants';
-
-let coverageSubprovider: CoverageSubprovider;
-
-export const coverage = {
- getCoverageSubproviderSingleton(): CoverageSubprovider {
- if (_.isUndefined(coverageSubprovider)) {
- coverageSubprovider = coverage._getCoverageSubprovider();
- }
- return coverageSubprovider;
- },
- _getCoverageSubprovider(): CoverageSubprovider {
- const artifactsPath = '../migrations/artifacts/1.0.0';
- const contractsPath = 'src/contracts';
- const defaultFromAddress = constants.TESTRPC_FIRST_ADDRESS;
- const zeroExArtifactsAdapter = new ZeroExArtifactAdapter(artifactsPath, contractsPath);
- return new CoverageSubprovider(zeroExArtifactsAdapter, defaultFromAddress);
- },
-};
diff --git a/packages/dev-utils/src/index.ts b/packages/dev-utils/src/index.ts
index 9124f3e28..d4c19f1bf 100644
--- a/packages/dev-utils/src/index.ts
+++ b/packages/dev-utils/src/index.ts
@@ -1,6 +1,5 @@
export { BlockchainLifecycle } from './blockchain_lifecycle';
export { web3Factory } from './web3_factory';
export { constants as devConstants } from './constants';
-export { coverage } from './coverage';
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
index 4cd343c44..5b32d3930 100644
--- a/packages/dev-utils/src/web3_factory.ts
+++ b/packages/dev-utils/src/web3_factory.ts
@@ -13,16 +13,8 @@ import * as _ from 'lodash';
import * as process from 'process';
import { constants } from './constants';
-import { coverage } from './coverage';
import { env, EnvVars } from './env';
-// HACK: web3 leaks XMLHttpRequest into the global scope and causes requests to hang
-// because they are using the wrong XHR package.
-// importing web3 after subproviders fixes this issue
-// Filed issue: https://github.com/ethereum/web3.js/issues/844
-// tslint:disable-next-line:ordered-imports
-import * as Web3 from 'web3';
-
export interface Web3Config {
hasAddresses?: boolean; // default: true
shouldUseInProcessGanache?: boolean; // default: false
@@ -30,18 +22,8 @@ export interface Web3Config {
}
export const web3Factory = {
- create(config: Web3Config = {}): Web3 {
- const provider = this.getRpcProvider(config);
- const web3 = new Web3();
- web3.setProvider(provider);
- return web3;
- },
- getRpcProvider(config: Web3Config = {}): Provider {
+ getRpcProvider(config: Web3Config = {}): ProviderEngine {
const provider = new ProviderEngine();
- const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage);
- if (isCoverageEnabled) {
- provider.addProvider(coverage.getCoverageSubproviderSingleton());
- }
const hasAddresses = _.isUndefined(config.hasAddresses) || config.hasAddresses;
if (!hasAddresses) {
provider.addProvider(new EmptyWalletSubprovider());